hexsha
stringlengths
40
40
size
int64
19
11.4M
ext
stringclasses
13 values
lang
stringclasses
1 value
max_stars_repo_path
stringlengths
3
270
max_stars_repo_name
stringlengths
5
110
max_stars_repo_head_hexsha
stringlengths
40
40
max_stars_repo_licenses
listlengths
1
9
max_stars_count
float64
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
3
270
max_issues_repo_name
stringlengths
5
116
max_issues_repo_head_hexsha
stringlengths
40
78
max_issues_repo_licenses
listlengths
1
9
max_issues_count
float64
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
3
270
max_forks_repo_name
stringlengths
5
116
max_forks_repo_head_hexsha
stringlengths
40
78
max_forks_repo_licenses
listlengths
1
9
max_forks_count
float64
1
105k
max_forks_repo_forks_event_min_datetime
stringlengths
24
24
max_forks_repo_forks_event_max_datetime
stringlengths
24
24
content
stringlengths
19
11.4M
avg_line_length
float64
1.93
229k
max_line_length
int64
12
688k
alphanum_fraction
float64
0.07
0.99
matches
listlengths
1
10
d438abe67c1676b40403894170606937e5375ab9
1,054
cpp
C++
test/math/box/corner_points.cpp
freundlich/fcppt
17df1b1ad08bf2435f6902d5465e3bc3fe5e3022
[ "BSL-1.0" ]
13
2015-02-21T18:35:14.000Z
2019-12-29T14:08:29.000Z
test/math/box/corner_points.cpp
cpreh/fcppt
17df1b1ad08bf2435f6902d5465e3bc3fe5e3022
[ "BSL-1.0" ]
5
2016-08-27T07:35:47.000Z
2019-04-21T10:55:34.000Z
test/math/box/corner_points.cpp
freundlich/fcppt
17df1b1ad08bf2435f6902d5465e3bc3fe5e3022
[ "BSL-1.0" ]
8
2015-01-10T09:22:37.000Z
2019-12-01T08:31:12.000Z
// Copyright Carl Philipp Reh 2009 - 2021. // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) #include <fcppt/array/object.hpp> #include <fcppt/catch/begin.hpp> #include <fcppt/catch/end.hpp> #include <fcppt/math/box/corner_points.hpp> #include <fcppt/math/box/object_impl.hpp> #include <fcppt/math/vector/comparison.hpp> #include <fcppt/math/vector/output.hpp> #include <fcppt/config/external_begin.hpp> #include <catch2/catch.hpp> #include <fcppt/config/external_end.hpp> FCPPT_CATCH_BEGIN TEST_CASE("math::box::corner_points", "[math],[box]") { using box_type = fcppt::math::box::object<int, 2>; CHECK( fcppt::math::box::corner_points(box_type{box_type::vector{10, 12}, box_type::dim{24, 26}}) == fcppt::array::object<box_type::vector, 4>{ box_type::vector(10, 12), box_type::vector(34, 12), box_type::vector(10, 38), box_type::vector(34, 38)}); } FCPPT_CATCH_END
31.939394
99
0.685958
[ "object", "vector" ]
d4391ecdfca8c6f94c26b1b9778b19c8c79436ee
3,194
cpp
C++
include/IMAGE_TRACKER/runtracker.cpp
lanfis/Camera_Controler
b63b61722f5ca8505ae017962bc1ccfbc1879c2b
[ "BSD-2-Clause" ]
null
null
null
include/IMAGE_TRACKER/runtracker.cpp
lanfis/Camera_Controler
b63b61722f5ca8505ae017962bc1ccfbc1879c2b
[ "BSD-2-Clause" ]
null
null
null
include/IMAGE_TRACKER/runtracker.cpp
lanfis/Camera_Controler
b63b61722f5ca8505ae017962bc1ccfbc1879c2b
[ "BSD-2-Clause" ]
null
null
null
#include <iostream> #include <fstream> #include <sstream> #include <algorithm> #include <opencv2/core/core.hpp> #include <opencv2/highgui/highgui.hpp> #include "kcftracker.hpp" #include <dirent.h> using namespace std; using namespace cv; int main(int argc, char* argv[]){ if (argc > 5) return -1; bool HOG = true; bool FIXEDWINDOW = false; bool MULTISCALE = true; bool SILENT = true; bool LAB = false; for(int i = 0; i < argc; i++){ if ( strcmp (argv[i], "hog") == 0 ) HOG = true; if ( strcmp (argv[i], "fixed_window") == 0 ) FIXEDWINDOW = true; if ( strcmp (argv[i], "singlescale") == 0 ) MULTISCALE = false; if ( strcmp (argv[i], "show") == 0 ) SILENT = false; if ( strcmp (argv[i], "lab") == 0 ){ LAB = true; HOG = true; } if ( strcmp (argv[i], "gray") == 0 ) HOG = false; } // Create KCFTracker object KCFTracker tracker(HOG, FIXEDWINDOW, MULTISCALE, LAB); // Frame readed Mat frame; // Tracker results Rect result; // Path to list.txt ifstream listFile; string fileName = "images.txt"; listFile.open(fileName); // Read groundtruth for the 1st frame ifstream groundtruthFile; string groundtruth = "region.txt"; groundtruthFile.open(groundtruth); string firstLine; getline(groundtruthFile, firstLine); groundtruthFile.close(); istringstream ss(firstLine); // Read groundtruth like a dumb float x1, y1, x2, y2, x3, y3, x4, y4; char ch; ss >> x1; ss >> ch; ss >> y1; ss >> ch; ss >> x2; ss >> ch; ss >> y2; ss >> ch; ss >> x3; ss >> ch; ss >> y3; ss >> ch; ss >> x4; ss >> ch; ss >> y4; // Using min and max of X and Y for groundtruth rectangle float xMin = min(x1, min(x2, min(x3, x4))); float yMin = min(y1, min(y2, min(y3, y4))); float width = max(x1, max(x2, max(x3, x4))) - xMin; float height = max(y1, max(y2, max(y3, y4))) - yMin; // Read Images ifstream listFramesFile; string listFrames = "images.txt"; listFramesFile.open(listFrames); string frameName; // Write Results ofstream resultsFile; string resultsPath = "output.txt"; resultsFile.open(resultsPath); // Frame counter int nFrames = 0; while ( getline(listFramesFile, frameName) ){ frameName = frameName; // Read each frame from the list frame = imread(frameName, CV_LOAD_IMAGE_COLOR); // First frame, give the groundtruth to the tracker if (nFrames == 0) { tracker.init( Rect(xMin, yMin, width, height), frame ); rectangle( frame, Point( xMin, yMin ), Point( xMin+width, yMin+height), Scalar( 0, 255, 255 ), 1, 8 ); resultsFile << xMin << "," << yMin << "," << width << "," << height << endl; } // Update else{ result = tracker.update(frame); rectangle( frame, Point( result.x, result.y ), Point( result.x+result.width, result.y+result.height), Scalar( 0, 255, 255 ), 1, 8 ); resultsFile << result.x << "," << result.y << "," << result.width << "," << result.height << endl; } nFrames++; if (!SILENT){ imshow("Image", frame); waitKey(1); } } resultsFile.close(); listFile.close(); }
22.814286
136
0.595492
[ "object" ]
d43a72ba19eb4697dbfbde55d2cecd605595a894
2,536
cpp
C++
src/Stencils/Stencil_Creater.cpp
fossabot/mpicartreorderlib
8ca5ff41c34011de03deb2d853f385677f7e65f4
[ "MIT" ]
1
2020-06-19T10:22:53.000Z
2020-06-19T10:22:53.000Z
src/Stencils/Stencil_Creater.cpp
fossabot/mpicartreorderlib
8ca5ff41c34011de03deb2d853f385677f7e65f4
[ "MIT" ]
1
2020-06-10T09:50:43.000Z
2020-06-10T09:50:43.000Z
src/Stencils/Stencil_Creater.cpp
fossabot/mpicartreorderlib
8ca5ff41c34011de03deb2d853f385677f7e65f4
[ "MIT" ]
2
2020-06-10T08:35:57.000Z
2020-06-10T09:45:17.000Z
// // Created by konradvonkirchbach on 5/27/20. // #include "Stencil_Creater.h" namespace mpireorderinglib { void five_point_stencil(std::vector< int >& stencil, const int ndims, int * n_neighbors){ int stencil_size = 2*ndims*ndims + ndims; *n_neighbors = 2*ndims + 1; int dim_to_set = 0; stencil.resize(stencil_size); for(int& i : stencil) i = 0; for( int i {0}; i < stencil_size - ndims; i += (*n_neighbors - 1)){ stencil[i + dim_to_set] = 1; stencil[i + dim_to_set + ndims] = -1; dim_to_set++; } } } namespace mpireorderinglib { /** * Expects the string to hold integer values, sperated by @ * Example for a 2D nearest neighbor stencil: 1@0@-1@0@0@1@0@-1 * @param str the string passed by the environment variable CART_REORDER_STENCIL * @param v vector in which to write the values */ void extract_stencil_from_string(const std::string& str, std::vector<int>& v, int* n_neighbors, int ndims) { std::istringstream tokenStream (str); std::string token; while (getline(tokenStream, token, '@')) { try { v.push_back(std::atoi(token.data())); } catch (std::exception& e) { CARTREORDER_ERROR("Tried to convert " + token + " to int"); std::cerr << e.what() << std::endl; } } if (v.size() % ndims != 0) { CARTREORDER_WARN("Passed stencil is not a multiple of the number of dimensions! Padding with zeros!"); while (v.size() % ndims) v.push_back(0); #ifdef LOGGING std::string str_v = ""; for (int i : v) str_v += std::to_string(i) + " "; CARTREORDER_INFO("New stencil = " + str_v); #endif } *n_neighbors = v.size()/ndims; #ifdef LOGGING std::string s = ""; for(int i : v) s += std::to_string(i) + " "; CARTREORDER_INFO("Stencil is " + s); #endif } } void mpireorderinglib::Stencil_Creater::create_stencil(const int ndims, std::vector<int> &stencil, int* n_neighbors) { if ( str_stencil == "UNDEFINED" ) { CARTREORDER_INFO("No stencil pattern defined. Proceeding with ndims dimensional nearest neighbor stencil."); mpireorderinglib::five_point_stencil(stencil, ndims, n_neighbors); } else { CARTREORDER_INFO("Try to build stencil from " + str_stencil); mpireorderinglib::extract_stencil_from_string(str_stencil, stencil, n_neighbors, ndims); } } void mpireorderinglib::Stencil_Creater::set_stencil(const std::string& str) { str_stencil = str; } mpireorderinglib::Stencil_Creater::Stencil_Creater() : str_stencil("UNDEFINED") { } mpireorderinglib::Stencil_Creater::Stencil_Creater(std::string &str) { str_stencil = str; }
31.7
118
0.684937
[ "vector" ]
d4427ef7ec05afb3f01ce79948c6bf900a8fb32d
2,861
cpp
C++
Andromeda/Graphics/Animation/DualQuaternion.cpp
DrakonPL/Andromeda-Lib
47cd3b74a736b21050222ef57c45e326304e85a6
[ "MIT", "Unlicense" ]
1
2020-04-01T12:19:48.000Z
2020-04-01T12:19:48.000Z
Andromeda/Graphics/Animation/DualQuaternion.cpp
DrakonPL/Andromeda-Lib
47cd3b74a736b21050222ef57c45e326304e85a6
[ "MIT", "Unlicense" ]
null
null
null
Andromeda/Graphics/Animation/DualQuaternion.cpp
DrakonPL/Andromeda-Lib
47cd3b74a736b21050222ef57c45e326304e85a6
[ "MIT", "Unlicense" ]
1
2020-12-25T18:15:37.000Z
2020-12-25T18:15:37.000Z
#include "DualQuaternion.h" #include <cmath> DualQuaternion operator+(const DualQuaternion& l, const DualQuaternion& r) { return DualQuaternion(real(l) + real(r), dual(l) + dual(r)); } DualQuaternion operator*(const DualQuaternion& dq, float f) { return DualQuaternion(real(dq) * f, dual(dq) * f); } bool operator==(const DualQuaternion& l, const DualQuaternion& r) { return real(l) == real(r) && dual(l) == dual(r); } bool operator!=(const DualQuaternion& l, const DualQuaternion& r) { return real(l) != real(r) || dual(l) != dual(r); } // Remember, multiplication order is left to right. // This is the opposite of matrix and quaternion multiplication order DualQuaternion operator*(const DualQuaternion& l, const DualQuaternion& r) { DualQuaternion lhs = normalized(l); DualQuaternion rhs = normalized(r); return DualQuaternion(real(lhs) * real(rhs), real(lhs) * dual(rhs) + dual(lhs) * real(rhs)); } AnimQuat real(DualQuaternion quat) { return AnimQuat(quat.v[0], quat.v[1], quat.v[2], quat.v[3]); } AnimQuat dual(DualQuaternion quat) { return AnimQuat(quat.v[4], quat.v[5], quat.v[6], quat.v[7]); } void real(DualQuaternion quat, AnimQuat real) { quat.v[0] = real.v[0]; quat.v[1] = real.v[1]; quat.v[2] = real.v[2]; quat.v[3] = real.v[3]; } void dual(DualQuaternion quat, AnimQuat dual) { quat.v[4] = dual.v[0]; quat.v[5] = dual.v[1]; quat.v[6] = dual.v[2]; quat.v[7] = dual.v[3]; } float dot(const DualQuaternion& l, const DualQuaternion& r) { //return dot(l.real, r.real); return dot(real(l), real(r)); } DualQuaternion conjugate(const DualQuaternion& dq) { return DualQuaternion(conjugate(real(dq)), conjugate(dual(dq))); } DualQuaternion normalized(const DualQuaternion& dq) { float magSq = dot(real(dq), real(dq)); if (magSq < 0.000001f) { return DualQuaternion(); } float invMag = 1.0f / sqrtf(magSq); return DualQuaternion(real(dq) * invMag, dual(dq) * invMag); } void normalize(DualQuaternion& dq) { float magSq = dot(real(dq), real(dq)); if (magSq < 0.000001f) { return; } float invMag = 1.0f / sqrtf(magSq); real(dq,real(dq) * invMag); dual(dq, dual(dq) * invMag); } DualQuaternion transformToDualQuat(const Transform& t) { AnimQuat d(t.position.x, t.position.y, t.position.z, 0); AnimQuat qr = t.rotation; AnimQuat qd = qr * d * 0.5f; return DualQuaternion(qr, qd); } Transform dualQuatToTransform(const DualQuaternion& dq) { Transform result; result.rotation = real(dq); AnimQuat d = conjugate(real(dq)) * (dual(dq) * 2.0f); result.position = AnimVec3(d.x, d.y, d.z); return result; } AnimVec3 transformVector(const DualQuaternion& dq, const AnimVec3& v) { return real(dq) * v; } AnimVec3 transformPoint(const DualQuaternion& dq, const AnimVec3& v) { AnimQuat d = conjugate(real(dq)) * (dual(dq) * 2.0f); AnimVec3 t = AnimVec3(d.x, d.y, d.z); return real(dq) * v + t; }
25.096491
93
0.68158
[ "transform" ]
d44569290f7fed48dcc7cfbe898be64fe26b9682
11,869
cpp
C++
src/GameLogic/Systems/DebugDrawSystem.cpp
gameraccoon/HideAndSeek
bc1e9c8dd725968ad4bc204877d8ddca2132ace7
[ "MIT" ]
null
null
null
src/GameLogic/Systems/DebugDrawSystem.cpp
gameraccoon/HideAndSeek
bc1e9c8dd725968ad4bc204877d8ddca2132ace7
[ "MIT" ]
null
null
null
src/GameLogic/Systems/DebugDrawSystem.cpp
gameraccoon/HideAndSeek
bc1e9c8dd725968ad4bc204877d8ddca2132ace7
[ "MIT" ]
null
null
null
#include "Base/precomp.h" #include "GameLogic/Systems/DebugDrawSystem.h" #include <algorithm> #include "Base/Random/Random.h" #include "Base/Types/TemplateHelpers.h" #include "GameData/Components/AiControllerComponent.generated.h" #include "GameData/Components/CharacterStateComponent.generated.h" #include "GameData/Components/CollisionComponent.generated.h" #include "GameData/Components/DebugDrawComponent.generated.h" #include "GameData/Components/NavMeshComponent.generated.h" #include "GameData/Components/RenderAccessorComponent.generated.h" #include "GameData/Components/RenderModeComponent.generated.h" #include "GameData/Components/TransformComponent.generated.h" #include "GameData/Components/WorldCachedDataComponent.generated.h" #include "GameData/Components/TimeComponent.generated.h" #include "GameData/GameData.h" #include "GameData/World.h" #include "Utils/Geometry/VisibilityPolygon.h" #include "HAL/Graphics/Font.h" #include "HAL/Graphics/Sprite.h" #include "GameLogic/Render/RenderAccessor.h" DebugDrawSystem::DebugDrawSystem( WorldHolder& worldHolder, ResourceManager& resourceManager) noexcept : mWorldHolder(worldHolder) , mResourceManager(resourceManager) { } template<typename T> void RemoveOldDrawElement(std::vector<T>& vector, GameplayTimestamp now) { std::erase_if( vector, [now](const T& val){ return val.isLifeTimeExceeded(now); } ); } static void DrawPath(RenderData& renderData, const std::vector<Vector2D>& path, const ResourceHandle& navMeshSprite, Vector2D drawShift) { if (path.size() > 1) { StripRenderData& stripData = TemplateHelpers::EmplaceVariant<StripRenderData>(renderData.layers); stripData.points.reserve(path.size() * 2); stripData.spriteHandle = navMeshSprite; stripData.drawShift = drawShift; stripData.alpha = 0.5f; { float u1 = static_cast<float>(Random::gGlobalGenerator()) * 1.0f / static_cast<float>(Random::GlobalGeneratorType::max()); float v1 = static_cast<float>(Random::gGlobalGenerator()) * 1.0f / static_cast<float>(Random::GlobalGeneratorType::max()); float u2 = static_cast<float>(Random::gGlobalGenerator()) * 1.0f / static_cast<float>(Random::GlobalGeneratorType::max()); float v2 = static_cast<float>(Random::gGlobalGenerator()) * 1.0f / static_cast<float>(Random::GlobalGeneratorType::max()); Vector2D normal = (path[1] - path[0]).normal() * 3; stripData.points.push_back(Graphics::DrawPoint{path[0] + normal, {u1, v1}}); stripData.points.push_back(Graphics::DrawPoint{path[0] - normal, {u2, v2}}); } for (size_t i = 1; i < path.size(); ++i) { float u1 = static_cast<float>(Random::gGlobalGenerator()) * 1.0f / static_cast<float>(Random::GlobalGeneratorType::max()); float v1 = static_cast<float>(Random::gGlobalGenerator()) * 1.0f / static_cast<float>(Random::GlobalGeneratorType::max()); float u2 = static_cast<float>(Random::gGlobalGenerator()) * 1.0f / static_cast<float>(Random::GlobalGeneratorType::max()); float v2 = static_cast<float>(Random::gGlobalGenerator()) * 1.0f / static_cast<float>(Random::GlobalGeneratorType::max()); Vector2D normal = (path[i] - path[i-1]).normal() * 3; stripData.points.push_back(Graphics::DrawPoint{path[i] + normal, {u1, v1}}); stripData.points.push_back(Graphics::DrawPoint{path[i] - normal, {u2, v2}}); } } } void DebugDrawSystem::update() { SCOPED_PROFILER("DebugDrawSystem::update"); World& world = mWorldHolder.getWorld(); GameData& gameData = mWorldHolder.getGameData(); const auto [time] = world.getWorldComponents().getComponents<const TimeComponent>(); const TimeData& timeValue = time->getValue(); auto [worldCachedData] = world.getWorldComponents().getComponents<WorldCachedDataComponent>(); const Vector2D workingRect = worldCachedData->getScreenSize(); const Vector2D cameraLocation = worldCachedData->getCameraPos(); const CellPos cameraCell = worldCachedData->getCameraCellPos(); SpatialEntityManager spatialManager = world.getSpatialData().getCellManagersAround(cameraLocation, workingRect); auto [renderMode] = gameData.getGameComponents().getComponents<const RenderModeComponent>(); const Vector2D screenHalfSize = workingRect * 0.5f; const Vector2D drawShift = screenHalfSize - cameraLocation; auto [renderAccessorCmp] = gameData.getGameComponents().getComponents<RenderAccessorComponent>(); if (renderAccessorCmp == nullptr || !renderAccessorCmp->getAccessor().has_value()) { return; } RenderAccessorGameRef renderAccessor = *renderAccessorCmp->getAccessor(); std::unique_ptr<RenderData> renderData = std::make_unique<RenderData>(); if (renderMode && renderMode->getIsDrawDebugCellInfoEnabled()) { std::vector<WorldCell*> cellsAround = world.getSpatialData().getCellsAround(cameraLocation, screenHalfSize*2.0f); for (WorldCell* cell : cellsAround) { CellPos cellPos = cell->getPos(); Vector2D location = SpatialWorldData::GetRelativeLocation(cameraCell, cellPos, drawShift); QuadRenderData& quadData = TemplateHelpers::EmplaceVariant<QuadRenderData>(renderData->layers); quadData.position = location; quadData.size = SpatialWorldData::CellSizeVector; quadData.spriteHandle = mCollisionSpriteHandle; TextRenderData& textData = TemplateHelpers::EmplaceVariant<TextRenderData>(renderData->layers); textData.color = {255, 255, 255, 255}; textData.fontHandle = mFontHandle; textData.pos = SpatialWorldData::CellSizeVector*0.5 + SpatialWorldData::GetCellRealDistance(cellPos - cameraCell) - cameraLocation + screenHalfSize; textData.text = FormatString("(%d, %d)", cellPos.x, cellPos.y); } } if (renderMode && renderMode->getIsDrawDebugCollisionsEnabled()) { spatialManager.forEachComponentSet<const CollisionComponent, const TransformComponent>( [&renderData, &collisionSpriteHandle = mCollisionSpriteHandle, drawShift](const CollisionComponent* collision, const TransformComponent* transform) { const Vector2D location = transform->getLocation() + drawShift; QuadRenderData& quadData = TemplateHelpers::EmplaceVariant<QuadRenderData>(renderData->layers); quadData.position = Vector2D(collision->getBoundingBox().minX + location.x, collision->getBoundingBox().minY + location.y); quadData.rotation = 0.0f; quadData.size = Vector2D(collision->getBoundingBox().maxX-collision->getBoundingBox().minX, collision->getBoundingBox().maxY-collision->getBoundingBox().minY); quadData.spriteHandle = collisionSpriteHandle; quadData.anchor = ZERO_VECTOR; }); } if (renderMode && renderMode->getIsDrawDebugAiDataEnabled()) { auto [navMeshComponent] = world.getWorldComponents().getComponents<NavMeshComponent>(); if (navMeshComponent) { const NavMesh& navMesh = navMeshComponent->getNavMesh(); const NavMesh::Geometry& navMeshGeometry = navMesh.geometry; for (size_t k = 0; k < navMeshGeometry.polygonsCount; ++k) { PolygonRenderData& polygon = TemplateHelpers::EmplaceVariant<PolygonRenderData>(renderData->layers); polygon.points.reserve(navMeshGeometry.verticesPerPoly); for (size_t j = 0; j < navMeshGeometry.verticesPerPoly; ++j) { float u = static_cast<float>(Random::gGlobalGenerator()) * 1.0f / static_cast<float>(Random::GlobalGeneratorType::max()); float v = static_cast<float>(Random::gGlobalGenerator()) * 1.0f / static_cast<float>(Random::GlobalGeneratorType::max()); Vector2D pos = navMeshGeometry.vertices[navMeshGeometry.indexes[k*navMeshGeometry.verticesPerPoly + j]]; polygon.points.push_back(Graphics::DrawPoint{pos, {u, v}}); } polygon.spriteHandle = mNavmeshSpriteHandle; polygon.alpha = 0.3f; polygon.drawShift = drawShift; } } spatialManager.forEachComponentSet<const AiControllerComponent>( [&navMeshSpriteHandle = mNavmeshSpriteHandle, &renderData, drawShift](const AiControllerComponent* aiController) { DrawPath(*renderData, aiController->getPath().smoothPath, navMeshSpriteHandle, drawShift); }); } if (renderMode && renderMode->getIsDrawDebugPrimitivesEnabled()) { auto [debugDraw] = gameData.getGameComponents().getComponents<const DebugDrawComponent>(); if (debugDraw != nullptr) { Vector2D pointSize(6, 6); for (const auto& screenPoint : debugDraw->getScreenPoints()) { QuadRenderData& quadData = TemplateHelpers::EmplaceVariant<QuadRenderData>(renderData->layers); quadData.position = screenPoint.screenPos; quadData.size = pointSize; quadData.spriteHandle = mPointTextureHandle; if (!screenPoint.name.empty()) { TextRenderData& textData = TemplateHelpers::EmplaceVariant<TextRenderData>(renderData->layers); textData.color = {255, 255, 255, 255}; textData.fontHandle = mFontHandle; textData.pos = screenPoint.screenPos; textData.text = screenPoint.name; } } for (const auto& worldPoint : debugDraw->getWorldPoints()) { Vector2D screenPos = worldPoint.pos - cameraLocation + screenHalfSize; QuadRenderData& quadData = TemplateHelpers::EmplaceVariant<QuadRenderData>(renderData->layers); quadData.position = screenPos; quadData.rotation = 0.0f; quadData.size = pointSize; quadData.spriteHandle = mPointTextureHandle; if (!worldPoint.name.empty()) { TextRenderData& textData = TemplateHelpers::EmplaceVariant<TextRenderData>(renderData->layers); textData.color = {255, 255, 255, 255}; textData.fontHandle = mFontHandle; textData.pos = screenPos; textData.text = worldPoint.name; } } for (const auto& worldLineSegment : debugDraw->getWorldLineSegments()) { QuadRenderData& quadData = TemplateHelpers::EmplaceVariant<QuadRenderData>(renderData->layers); Vector2D screenPosStart = worldLineSegment.startPos - cameraLocation + screenHalfSize; Vector2D screenPosEnd = worldLineSegment.endPos - cameraLocation + screenHalfSize; Vector2D diff = screenPosEnd - screenPosStart; quadData.position = (screenPosStart + screenPosEnd) * 0.5f; quadData.rotation = diff.rotation().getValue(); quadData.size = {diff.size(), pointSize.y}; quadData.spriteHandle = mLineTextureHandle; } } } if (renderMode && renderMode->getIsDrawDebugCharacterInfoEnabled()) { spatialManager.forEachComponentSet<const CharacterStateComponent, const TransformComponent>( [&renderData, fontHandle = mFontHandle, drawShift](const CharacterStateComponent* characterState, const TransformComponent* transform) { TextRenderData& textData = TemplateHelpers::EmplaceVariant<TextRenderData>(renderData->layers); textData.color = {255, 255, 255, 255}; textData.fontHandle = fontHandle; textData.pos = transform->getLocation() + drawShift; textData.text = ID_TO_STR(enum_to_string(characterState->getState())); }); } auto [debugDraw] = gameData.getGameComponents().getComponents<DebugDrawComponent>(); if (debugDraw != nullptr) { RemoveOldDrawElement(debugDraw->getWorldPointsRef(), timeValue.lastFixedUpdateTimestamp); RemoveOldDrawElement(debugDraw->getScreenPointsRef(), timeValue.lastFixedUpdateTimestamp); RemoveOldDrawElement(debugDraw->getWorldLineSegmentsRef(), timeValue.lastFixedUpdateTimestamp); } renderAccessor.submitData(std::move(renderData)); } void DebugDrawSystem::init() { SCOPED_PROFILER("DebugDrawSystem::initResources"); mCollisionSpriteHandle = mResourceManager.lockResource<Graphics::Sprite>(ResourcePath("resources/textures/collision.png")); mNavmeshSpriteHandle = mResourceManager.lockResource<Graphics::Sprite>(ResourcePath("resources/textures/testTexture.png")); mPointTextureHandle = mResourceManager.lockResource<Graphics::Sprite>(ResourcePath("resources/textures/collision.png")); mLineTextureHandle = mResourceManager.lockResource<Graphics::Sprite>(ResourcePath("resources/textures/testTexture.png")); mFontHandle = mResourceManager.lockResource<Graphics::Font>("resources/fonts/prstart.ttf", 16); }
43.16
151
0.758362
[ "geometry", "render", "vector", "transform" ]
d44b8bf417f091f733311d99219986a3f0535425
6,799
hpp
C++
src/layer/common/softmax_func_layer-inl.hpp
pl8787/textnet-release
c85a4162c55b4cfe22eab6f8f0c8b615854f9b8f
[ "Apache-2.0" ]
114
2017-06-14T07:05:31.000Z
2021-06-13T05:30:49.000Z
src/layer/common/softmax_func_layer-inl.hpp
pl8787/textnet-release
c85a4162c55b4cfe22eab6f8f0c8b615854f9b8f
[ "Apache-2.0" ]
7
2017-11-17T08:16:55.000Z
2019-10-05T00:09:20.000Z
src/layer/common/softmax_func_layer-inl.hpp
pl8787/textnet-release
c85a4162c55b4cfe22eab6f8f0c8b615854f9b8f
[ "Apache-2.0" ]
40
2017-06-15T03:21:10.000Z
2021-10-31T15:03:30.000Z
#ifndef TEXTNET_LAYER_SOFTMAX_FUNC_LAYER_INL_HPP_ #define TEXTNET_LAYER_SOFTMAX_FUNC_LAYER_INL_HPP_ #include <iostream> #include <fstream> #include <sstream> #include <set> #include <mshadow/tensor.h> #include "../layer.h" #include "../op.h" namespace textnet { namespace layer { template<typename xpu> class SoftmaxFuncLayer : public Layer<xpu>{ public: SoftmaxFuncLayer(LayerType type) { this->layer_type = type; } virtual ~SoftmaxFuncLayer(void) {} virtual int BottomNodeNum() { return 1; } virtual int TopNodeNum() { return 1; } virtual int ParamNodeNum() { return 0; } virtual void Require() { // default value, just set the value you want this->defaults["crop"] = SettingV(0.00001f); // require value, set to SettingV(), // it will force custom to set in config this->defaults["axis"] = SettingV(); Layer<xpu>::Require(); } virtual void SetupLayer(std::map<std::string, SettingV> &setting, const std::vector<Node<xpu>*> &bottom, const std::vector<Node<xpu>*> &top, mshadow::Random<xpu> *prnd) { Layer<xpu>::SetupLayer(setting, bottom, top, prnd); utils::Check(bottom.size() == BottomNodeNum(), "SoftmaxFuncLayer:bottom size problem."); utils::Check(top.size() == TopNodeNum(), "SoftmaxFuncLayer:top size problem."); axis = setting["axis"].iVal(); crop = setting["crop"].fVal(); utils::Check(0 < axis && axis < 4, "SoftmaxFuncLayer: axis error."); } virtual void Reshape(const std::vector<Node<xpu>*> &bottom, const std::vector<Node<xpu>*> &top, bool show_info = false) { utils::Check(bottom.size() == BottomNodeNum(), "SoftmaxFuncLayer:bottom size problem."); utils::Check(top.size() == TopNodeNum(), "SoftmaxFuncLayer:top size problem."); top[0]->Resize(bottom[0]->data.shape_, bottom[0]->length.shape_, true); if (show_info) { bottom[0]->PrintShape("bottom0"); top[0]->PrintShape("top0"); } } virtual void CheckReshape(const std::vector<Node<xpu>*> &bottom, const std::vector<Node<xpu>*> &top) { // Check for reshape bool need_reshape = false; if (top[0]->data.shape_[0] != bottom[0]->data.shape_[0]) { need_reshape = true; } // Do reshape if (need_reshape) { this->Reshape(bottom, top); } } void checkNan(float *p, int l) { for (int i = 0; i < l; ++i) { assert(!std::isnan(p[i])); } } virtual void Forward(const std::vector<Node<xpu>*> &bottom, const std::vector<Node<xpu>*> &top) { using namespace mshadow::expr; top[0]->length = F<op::identity>(bottom[0]->length); mshadow::Tensor<xpu, 4> bottom_data = bottom[0]->data; mshadow::Shape<4> bottom_shape= bottom[0]->data.shape_; mshadow::Tensor<xpu, 4> top_data = top[0]->data; int row = 1, col = 1; for (int i = 0; i < axis; ++i) { row *= int(bottom_shape[i]); } for (int i = axis; i < 4; ++i) { col *= int(bottom_shape[i]); } mshadow::Tensor<xpu, 2> input(bottom_data.dptr_, mshadow::Shape2(row, col)); mshadow::Tensor<xpu, 2> output(top_data.dptr_, mshadow::Shape2(row, col)); mshadow::Softmax(output, input); int crop_count = 0; for (int i = 0; i < output.size(0); ++i) { for (int j = 0; j < output.size(1); ++j) { if (output[i][j] < crop) { output[i][j] = crop; ++crop_count; } } } #if DEBUG std::cout << "SoftmaxFuncLayer: WARNING, prob too small, crop. " << crop_count << std::endl; checkNan(top[0]->data.dptr_, top[0]->data.shape_.Size()); #endif } virtual void Backprop(const std::vector<Node<xpu>*> &bottom, const std::vector<Node<xpu>*> &top) { if(!this->prop_error[0]) return; using namespace mshadow::expr; mshadow::Shape<4> bottom_shape= bottom[0]->data.shape_; mshadow::Tensor<xpu, 4> bottom_diff = bottom[0]->diff; mshadow::Tensor<xpu, 4> top_data = top[0]->data; mshadow::Tensor<xpu, 4> top_diff = top[0]->diff; int row = 1, col = 1; for (int i = 0; i < axis; ++i) { row *= int(bottom_shape[i]); } for (int i = axis; i < 4; ++i) { col *= int(bottom_shape[i]); } mshadow::Tensor<xpu, 2> output_data(top_data.dptr_, mshadow::Shape2(row, col)); mshadow::Tensor<xpu, 2> input_diff(bottom_diff.dptr_, mshadow::Shape2(row, col)); mshadow::Tensor<xpu, 2> output_diff(top_diff.dptr_, mshadow::Shape2(row, col)); for (int row_idx = 0; row_idx < row; ++row_idx) { float error_sum = 0.0f; for (int col_idx = 0; col_idx < col; ++col_idx) { error_sum += output_diff[row_idx][col_idx] * output_data[row_idx][col_idx]; } for (int col_idx = 0; col_idx < col; ++col_idx) { input_diff[row_idx][col_idx] += (output_diff[row_idx][col_idx] - error_sum) * output_data[row_idx][col_idx]; } } #if DEBUG checkNan(bottom[0]->diff.dptr_, bottom[0]->diff.shape_.Size()); #endif } /* virtual void Backprop(const std::vector<Node<xpu>*> &bottom, const std::vector<Node<xpu>*> &top) { using namespace mshadow::expr; mshadow::Shape<4> bottom_shape= bottom[0]->data.shape_; mshadow::Tensor<xpu, 4> bottom_diff = bottom[0]->diff; mshadow::Tensor<xpu, 4> top_data = top[0]->data; mshadow::Tensor<xpu, 4> top_diff = top[0]->diff; int row = 1, col = 1; for (int i = 0; i < axis; ++i) { row *= int(bottom_shape[i]); } for (int i = axis; i < 4; ++i) { col *= int(bottom_shape[i]); } mshadow::Tensor<xpu, 2> output_data(top_data.dptr_, mshadow::Shape2(row, col)); mshadow::Tensor<xpu, 2> input_diff(bottom_diff.dptr_, mshadow::Shape2(row, col)); mshadow::Tensor<xpu, 2> output_diff(top_diff.dptr_, mshadow::Shape2(row, col)); for (int row_idx = 0; row_idx < row; ++row_idx) { for (int col_idx = 0; col_idx < col; ++col_idx) { for (int jacobi_row_idx = 0; jacobi_row_idx < col; ++jacobi_row_idx) { float top = output_diff[row_idx][jacobi_row_idx]; float p_0 = output_data[row_idx][col_idx]; float p_1 = output_data[row_idx][jacobi_row_idx]; if (jacobi_row_idx == col_idx) { input_diff[row_idx][col_idx] += top * (-(p_0*p_0) + p_0); } else { input_diff[row_idx][col_idx] += top * (-(p_0*p_1)); } } } } #if DEBUG checkNan(bottom[0]->diff.dptr_, bottom[0]->diff.shape_.Size()); #endif } */ protected: int axis; float crop; }; } // namespace layer } // namespace textnet #endif // LAYER_SOFTMAX_FUNC_LAYER_INL_HPP_
34.338384
116
0.591116
[ "shape", "vector" ]
d454b21a9b0989c10305cc17fad42d2c3cd13f73
852
cpp
C++
HDUOJ/3232/math_expectation.cpp
codgician/ACM
391f3ce9b89b0a4bbbe3ff60eb2369fef57460d4
[ "MIT" ]
2
2018-02-14T01:59:31.000Z
2018-03-28T03:30:45.000Z
HDUOJ/3232/math_expectation.cpp
codgician/ACM
391f3ce9b89b0a4bbbe3ff60eb2369fef57460d4
[ "MIT" ]
null
null
null
HDUOJ/3232/math_expectation.cpp
codgician/ACM
391f3ce9b89b0a4bbbe3ff60eb2369fef57460d4
[ "MIT" ]
2
2017-12-30T02:46:35.000Z
2018-03-28T03:30:49.000Z
#include <iostream> #include <cstdio> #include <algorithm> #include <cmath> #include <string> #include <cstring> #include <iomanip> #include <climits> #include <vector> #include <set> #include <queue> #include <map> using namespace std; int main() { ios::sync_with_stdio(false); int riverNum, dis, casePt = 1; while (cin >> riverNum >> dis) { if (riverNum == 0 && dis == 0) break; double ans = 0; int riverLenSum = 0; for (int i = 0; i < riverNum; i++) { int dis, len, velocity; cin >> dis >> len >> velocity; ans += (double)(len << 1) / velocity; riverLenSum += len; } ans += (dis - riverLenSum); cout << "Case " << casePt++ << ": " << fixed << setprecision(3) << ans << endl << endl; } return 0; }
21.846154
95
0.518779
[ "vector" ]
d4554aa9de7b8a880299656baa913a0aa54ab0dd
1,413
cpp
C++
platform/android/src/test/render_test_runner.cpp
cristianadam/mapbox-gl-native
5b38cfee18800cbb3c6a3186882744592662c3d6
[ "BSL-1.0", "Apache-2.0" ]
1
2019-11-09T17:52:14.000Z
2019-11-09T17:52:14.000Z
platform/android/src/test/render_test_runner.cpp
cristianadam/mapbox-gl-native
5b38cfee18800cbb3c6a3186882744592662c3d6
[ "BSL-1.0", "Apache-2.0" ]
1
2020-11-21T06:55:47.000Z
2020-11-21T06:55:52.000Z
platform/android/src/test/render_test_runner.cpp
cristianadam/mapbox-gl-native
5b38cfee18800cbb3c6a3186882744592662c3d6
[ "BSL-1.0", "Apache-2.0" ]
null
null
null
#include <android_native_app_glue.h> #include <mbgl/render_test.hpp> #include "jni.hpp" #include "logger.hpp" #include <string> #include <vector> #include <mbgl/util/logging.hpp> #include <android/log.h> namespace mbgl { namespace { int severityToPriority(EventSeverity severity) { switch (severity) { case EventSeverity::Debug: return ANDROID_LOG_DEBUG; case EventSeverity::Info: return ANDROID_LOG_INFO; case EventSeverity::Warning: return ANDROID_LOG_WARN; case EventSeverity::Error: return ANDROID_LOG_ERROR; default: return ANDROID_LOG_VERBOSE; } } } // namespace void Log::platformRecord(EventSeverity severity, const std::string& msg) { __android_log_print(severityToPriority(severity), "mbgl", "%s", msg.c_str()); } } // namespace mbgl void android_main(struct android_app* app) { mbgl::android::theJVM = app->activity->vm; JNIEnv* env; app->activity->vm->AttachCurrentThread(&env, NULL); std::vector<std::string> arguments = {"mbgl-render-test-runner", "-p", "/sdcard/render-test/android-manifest.json"}; std::vector<char*> argv; for (const auto& arg : arguments) { argv.push_back((char*)arg.data()); } argv.push_back(nullptr); (void)mbgl::runRenderTests(argv.size() - 1, argv.data()); app->activity->vm->DetachCurrentThread(); }
24.789474
120
0.661713
[ "render", "vector" ]
d45abbed9c48229665d58897e20b71697a35a58b
1,291
cpp
C++
Direct3D/PngImage.cpp
AinoMegumi/Direct3D12
d9540baa71b304f7307c70ac5581b13eded1c7b3
[ "MIT" ]
4
2018-11-28T03:14:30.000Z
2020-11-02T15:06:23.000Z
Direct3D/PngImage.cpp
AinoMegumi/Direct3D12
d9540baa71b304f7307c70ac5581b13eded1c7b3
[ "MIT" ]
null
null
null
Direct3D/PngImage.cpp
AinoMegumi/Direct3D12
d9540baa71b304f7307c70ac5581b13eded1c7b3
[ "MIT" ]
1
2021-05-29T12:22:53.000Z
2021-05-29T12:22:53.000Z
#include "PictureLoad.hpp" #include <png.h> #include <pngconf.h> #include <type_traits> #include <tuple> namespace { template<typename Func, std::enable_if_t< std::is_same< decltype(std::declval<Func>()(std::declval<png_image*>()), std::true_type{}), std::true_type>::value, std::nullptr_t > = nullptr> std::tuple<std::vector<BYTE>, std::uint32_t, std::uint32_t> Read(Func&& png_image_begin_read) { std::vector<BYTE> Data; png_image png{}; png.version = PNG_IMAGE_VERSION; png_image_begin_read(&png); if (PNG_IMAGE_FAILED(png)) throw std::runtime_error(png.message); uint32_t stride = PNG_IMAGE_ROW_STRIDE(png); Data.resize(PNG_IMAGE_BUFFER_SIZE(png, stride)); png_image_finish_read(&png, NULL, reinterpret_cast<void*>(Data.data()), stride, nullptr); const std::uint32_t w = png.width, h = png.height; png_image_free(&png); return { Data, w, h }; } } PngImage::PngImage(const std::string FilePath) { std::tie(this->Data, this->Width, this->Height) = Read([&FilePath](png_image* png) { png_image_begin_read_from_file(png, FilePath.c_str()); }); } PngImage::PngImage(void* PngImage, size_t Size) { std::tie(this->Data, this->Width, this->Height) = Read([PngImage, Size](png_image* png) { png_image_begin_read_from_memory(png, PngImage, Size); }); }
34.891892
149
0.711077
[ "vector" ]
d45b3921f5de71d54dc1b09ef97770b13bef3836
9,901
cpp
C++
src/Graphics/VulkanPipeline.cpp
llGuy/Ondine
325c2d3ea5bd5ef5456b0181c53ad227571fada3
[ "MIT" ]
1
2022-01-24T18:15:56.000Z
2022-01-24T18:15:56.000Z
src/Graphics/VulkanPipeline.cpp
llGuy/Ondine
325c2d3ea5bd5ef5456b0181c53ad227571fada3
[ "MIT" ]
null
null
null
src/Graphics/VulkanPipeline.cpp
llGuy/Ondine
325c2d3ea5bd5ef5456b0181c53ad227571fada3
[ "MIT" ]
null
null
null
#include "Vulkan.hpp" #include "FileSystem.hpp" #include "VulkanDevice.hpp" #include "VulkanPipeline.hpp" #include "VulkanDescriptor.hpp" #include "VulkanRenderPass.hpp" namespace Ondine::Graphics { VulkanShader::VulkanShader( const VulkanDevice &device, const Buffer &source, VulkanShaderType type) : mType(type) { VkShaderModuleCreateInfo shaderInfo = {}; shaderInfo.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO; shaderInfo.codeSize = source.size; shaderInfo.pCode = (uint32_t *)source.data; VK_CHECK( vkCreateShaderModule( device.mLogicalDevice, &shaderInfo, NULL, &mModule)); } VulkanShader::VulkanShader(const VulkanDevice &device, const char *path) { size_t pathLen = strlen(path); const char *ext = &path[pathLen - 8]; if (!strcmp(ext, "vert.spv")) { mType = VulkanShaderType::Vertex; } else if (!strcmp(ext, "geom.spv")) { mType = VulkanShaderType::Geometry; } else if (!strcmp(ext, "frag.spv")) { mType = VulkanShaderType::Fragment; } else { LOG_ERRORV("Unknown shader file extention: %s\n", path); PANIC_AND_EXIT(); } Core::File file = Core::gFileSystem->createFile( (Core::MountPoint)Core::ApplicationMountPoints::Application, path, Core::FileOpenType::Binary | Core::FileOpenType::In); Buffer data = file.readBinary(); VkShaderModuleCreateInfo shaderInfo = {}; shaderInfo.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO; shaderInfo.codeSize = data.size; shaderInfo.pCode = (uint32_t *)data.data; VK_CHECK( vkCreateShaderModule( device.mLogicalDevice, &shaderInfo, NULL, &mModule)); } void VulkanPipelineConfig::enableBlendingSame( uint32_t attachmentIndex, VkBlendOp op, VkBlendFactor src, VkBlendFactor dst) { auto &blendState = mBlendStates[attachmentIndex]; blendState.blendEnable = VK_TRUE; blendState.colorBlendOp = op; blendState.alphaBlendOp = op; blendState.srcColorBlendFactor = src; blendState.srcAlphaBlendFactor = src; blendState.dstColorBlendFactor = dst; blendState.dstAlphaBlendFactor = dst; // Color write mask is already set } void VulkanPipelineConfig::enableDepthTesting() { mDepthStencil.depthTestEnable = VK_TRUE; mDepthStencil.depthWriteEnable = VK_TRUE; mDepthStencil.depthCompareOp = VK_COMPARE_OP_LESS; mDepthStencil.minDepthBounds = 0.0f; mDepthStencil.maxDepthBounds = 1.0f; } void VulkanPipelineConfig::configureVertexInput( uint32_t attribCount, uint32_t bindingCount) { mAttributes.init(attribCount); mBindings.init(bindingCount); mVertexInput.pVertexBindingDescriptions = mBindings.data; mVertexInput.vertexBindingDescriptionCount = bindingCount; mVertexInput.pVertexAttributeDescriptions = mAttributes.data; mVertexInput.vertexAttributeDescriptionCount = attribCount; } void VulkanPipelineConfig::setBinding( uint32_t bindingIdx, uint32_t stride, VkVertexInputRate inputRate) { auto &binding = mBindings[bindingIdx]; binding.binding = bindingIdx; binding.stride = stride; binding.inputRate = inputRate; } void VulkanPipelineConfig::setBindingAttribute( uint32_t location, uint32_t binding, VkFormat format, uint32_t offset) { auto &attribute = mAttributes[location]; attribute.location = location; attribute.binding = binding; attribute.format = format; attribute.offset = offset; } void VulkanPipelineConfig::setToWireframe() { mRasterization.polygonMode = VK_POLYGON_MODE_LINE; } void VulkanPipelineConfig::setDefaultValues() { /* Blend states */ const auto &renderPass = mTarget.renderPass; const auto &subpass = renderPass.mSubpasses[mTarget.subpassIndex]; uint32_t colorAttachmentCount = subpass.colorAttachmentCount; mBlendStates.init(colorAttachmentCount); mBlendStates.zero(); for (int i = 0; i < colorAttachmentCount; ++i) { const auto &colorRef = subpass.pColorAttachments[i]; const auto &attachmentDesc = renderPass.mAttachments[colorRef.attachment]; auto &blendState = mBlendStates[mBlendStates.size++]; switch (attachmentDesc.format) { // TODO: Add other formats as they come up case VK_FORMAT_B8G8R8A8_UNORM: case VK_FORMAT_R8G8B8A8_UNORM: case VK_FORMAT_R32G32B32A32_SFLOAT: case VK_FORMAT_R16G16B16A16_SFLOAT: { blendState.colorWriteMask = VK_COLOR_COMPONENT_R_BIT | VK_COLOR_COMPONENT_G_BIT | VK_COLOR_COMPONENT_B_BIT | VK_COLOR_COMPONENT_A_BIT; } break; case VK_FORMAT_R32G32_SFLOAT: case VK_FORMAT_R16G16_SFLOAT: { blendState.colorWriteMask = VK_COLOR_COMPONENT_R_BIT | VK_COLOR_COMPONENT_G_BIT; } break; case VK_FORMAT_R16_SFLOAT: { blendState.colorWriteMask = VK_COLOR_COMPONENT_R_BIT; } break; default: { LOG_ERROR("Handling unsupported format for color blending!\n"); PANIC_AND_EXIT(); } break; } } mBlending.sType = VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO; mBlending.logicOpEnable = VK_FALSE; mBlending.attachmentCount = colorAttachmentCount; mBlending.pAttachments = mBlendStates.data; mBlending.logicOp = VK_LOGIC_OP_COPY; /* Vertex input (empty by default) */ mVertexInput.sType = VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO; /* Input assembly (triangle strip by default) */ mInputAssembly.sType = VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO; mInputAssembly.topology = VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP; /* Viewport */ mViewport.width = 1; mViewport.height = 1; mViewport.maxDepth = 1.0f; mRect.extent = {1, 1}; mViewportInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO; mViewportInfo.viewportCount = 1; mViewportInfo.pViewports = &mViewport; mViewportInfo.scissorCount = 1; mViewportInfo.pScissors = &mRect; /* Rasterization */ mRasterization.sType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO; mRasterization.polygonMode = VK_POLYGON_MODE_FILL; mRasterization.cullMode = VK_CULL_MODE_NONE; mRasterization.frontFace = VK_FRONT_FACE_CLOCKWISE; mRasterization.lineWidth = 1.0f; /* Multisampling */ mMultisample.sType = VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO; mMultisample.rasterizationSamples = VK_SAMPLE_COUNT_1_BIT; mMultisample.minSampleShading = 1.0f; /* Dynamic states */ mDynamicStates = makeArray<VkDynamicState, AllocationType::Linear>( VK_DYNAMIC_STATE_VIEWPORT, VK_DYNAMIC_STATE_SCISSOR); mDynamicState.sType = VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO; mDynamicState.dynamicStateCount = mDynamicStates.size; mDynamicState.pDynamicStates = mDynamicStates.data; /* Depth stencil - off by default */ mDepthStencil.sType = VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO; mDepthStencil.depthTestEnable = VK_FALSE; mDepthStencil.depthWriteEnable = VK_FALSE; } void VulkanPipelineConfig::setTopology(VkPrimitiveTopology topology) { mInputAssembly.topology = topology; } void VulkanPipelineConfig::setShaderStages( const Array<VulkanShader, AllocationType::Linear> &shaders) { for (int i = 0; i < shaders.size; ++i) { VkPipelineShaderStageCreateInfo *info = &mShaderStages[i]; info->sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO; info->pName = "main"; info->stage = (VkShaderStageFlagBits)shaders[i].mType; info->module = shaders[i].mModule; } mShaderStages.size = shaders.size; } void VulkanPipelineConfig::finishConfiguration( const VulkanDevice &device, VulkanDescriptorSetLayoutMaker &layout) { /* Create pipeline layout */ VkPushConstantRange pushConstantRange = {}; pushConstantRange.stageFlags = VK_SHADER_STAGE_ALL; pushConstantRange.offset = 0; pushConstantRange.size = mPushConstantSize; VkDescriptorSetLayout *layouts = STACK_ALLOC( VkDescriptorSetLayout, mLayouts.size); for (int i = 0; i < mLayouts.size; ++i) { layouts[i] = layout.getDescriptorSetLayout( device, mLayouts[i].type, mLayouts[i].count); } VkPipelineLayoutCreateInfo pipelineLayoutInfo = {}; pipelineLayoutInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO; pipelineLayoutInfo.setLayoutCount = mLayouts.size; pipelineLayoutInfo.pSetLayouts = layouts; if (mPushConstantSize) { pipelineLayoutInfo.pushConstantRangeCount = 1; pipelineLayoutInfo.pPushConstantRanges = &pushConstantRange; } VK_CHECK( vkCreatePipelineLayout( device.mLogicalDevice, &pipelineLayoutInfo, NULL, &mPipelineLayout)); mCreateInfo.sType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO; mCreateInfo.stageCount = mShaderStages.size; mCreateInfo.pStages = mShaderStages.data; mCreateInfo.pVertexInputState = &mVertexInput; mCreateInfo.pInputAssemblyState = &mInputAssembly; mCreateInfo.pViewportState = &mViewportInfo; mCreateInfo.pRasterizationState = &mRasterization; mCreateInfo.pMultisampleState = &mMultisample; mCreateInfo.pDepthStencilState = &mDepthStencil; mCreateInfo.pColorBlendState = &mBlending; mCreateInfo.pDynamicState = &mDynamicState; mCreateInfo.layout = mPipelineLayout; mCreateInfo.renderPass = mTarget.renderPass.mRenderPass; mCreateInfo.subpass = mTarget.subpassIndex; mCreateInfo.basePipelineHandle = VK_NULL_HANDLE; mCreateInfo.basePipelineIndex = -1; } void VulkanPipeline::init( const VulkanDevice &device, VulkanDescriptorSetLayoutMaker &layouts, VulkanPipelineConfig &config) { config.finishConfiguration(device, layouts); VK_CHECK( vkCreateGraphicsPipelines( device.mLogicalDevice, VK_NULL_HANDLE, 1, &config.mCreateInfo, NULL, &mPipeline)); mPipelineLayout = config.mPipelineLayout; } void VulkanPipeline::destroy(const VulkanDevice &device) { vkDestroyPipeline(device.mLogicalDevice, mPipeline, nullptr); vkDestroyPipelineLayout(device.mLogicalDevice, mPipelineLayout, nullptr); } }
31.632588
81
0.763458
[ "geometry" ]
d460570408cad8d7f3499faf0cea0d28cbfd7ca9
6,573
cpp
C++
dev/Code/Sandbox/Plugins/EditorUI_QT/VariableWidgets/QAmazonDoubleSpinBox.cpp
BenjaminHCheung/lumberyard
f875f9634ebb128d1bbb5334720596e19cb6db54
[ "AML" ]
1
2021-07-09T06:32:31.000Z
2021-07-09T06:32:31.000Z
dev/Code/Sandbox/Plugins/EditorUI_QT/VariableWidgets/QAmazonDoubleSpinBox.cpp
BenjaminHCheung/lumberyard
f875f9634ebb128d1bbb5334720596e19cb6db54
[ "AML" ]
null
null
null
dev/Code/Sandbox/Plugins/EditorUI_QT/VariableWidgets/QAmazonDoubleSpinBox.cpp
BenjaminHCheung/lumberyard
f875f9634ebb128d1bbb5334720596e19cb6db54
[ "AML" ]
null
null
null
/* * All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or * its licensors. * * For complete copyright and license terms please see the LICENSE at the root of this * distribution (the "License"). All use of this software is governed by the License, * or, if provided, by the license below or the license accompanying this file. Do not * remove or modify any license notices. This file is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * */ #include "QAmazonDoubleSpinBox.h" #include <QLineEdit> #include <QMouseEvent> #include <QDebug> #include <QApplication> #include <QtWidgets/QDesktopWidget> QAmazonDoubleSpinBox::QAmazonDoubleSpinBox(QWidget* parent) : AzQtComponents::DoubleSpinBox(parent) { setDecimals(m_precision); lineEdit()->installEventFilter(this); connect(lineEdit(), &QLineEdit::editingFinished, this, [=]() { m_isEditInProgress = false; }); } QAmazonDoubleSpinBox::~QAmazonDoubleSpinBox() { lineEdit()->removeEventFilter(this); } void QAmazonDoubleSpinBox::focusInEvent(QFocusEvent* event) { m_isFocusedIn = true; m_isEditInProgress = true; QDoubleSpinBox::focusInEvent(event); setValue(value()); selectAll(); } void QAmazonDoubleSpinBox::MouseEvent(QEvent* event) { // This code is very similiar to MouseEvent() in DHQSpinbox.cpp. We need the mouse input functionality but // the ParticleEditor has a completely separate UX system from the main Editor, so we aren't set up to share // implementation at this time. Consider merging this functionality with DHQSpinbox someday. bool& isMouseCaptured = m_mouseCaptured; bool& isMouseDragging = m_mouseDragging; QAbstractSpinBox* spinBox = this; switch (event->type()) { case QEvent::MouseButtonPress: { QMouseEvent* mouseEvent = static_cast<QMouseEvent*>(event); m_lastMousePosition = mouseEvent->globalPos(); isMouseCaptured = true; } break; case QEvent::MouseButtonRelease: { if (isMouseCaptured) { spinBox->unsetCursor(); isMouseCaptured = false; } if (isMouseDragging) { isMouseDragging = false; Q_EMIT spinnerDragFinished(); } } break; case QEvent::MouseMove: { if (isMouseCaptured) { Q_EMIT spinnerDragged(); m_mouseDragging = true; spinBox->setCursor(Qt::SizeVerCursor); QMouseEvent* mouseEvent = static_cast<QMouseEvent*>(event); QPoint mousePos = mouseEvent->globalPos(); int distance = m_lastMousePosition.y() - mousePos.y(); spinBox->stepBy(distance); m_lastMousePosition = mouseEvent->globalPos(); int screenId = QApplication::desktop()->screenNumber(mousePos); QRect screenSize = QApplication::desktop()->screen(screenId)->geometry(); if (mouseEvent->globalPos().y() >= screenSize.height() - 1) { mousePos.setY(1); spinBox->cursor().setPos(mousePos); } else if (mouseEvent->globalPos().y() <= 0) { mousePos.setY(screenSize.height() - 2); spinBox->cursor().setPos(mousePos); } m_lastMousePosition = mousePos; } } break; } } bool QAmazonDoubleSpinBox::event(QEvent* event) { // This code is copied directly from event() in DHQSpinbox.cpp. We need the same mouse input functionality but // the ParticleEditor has a completely separate UX system from the main Editor, so we aren't set up to share // implementation at this time. Consider merging this functionality with DHQSpinbox someday. if (isEnabled()) { if (event->type() == QEvent::Wheel) { if (hasFocus()) { QWheelEvent* wheelEvent = static_cast<QWheelEvent*>(event); QDoubleSpinBox::wheelEvent(wheelEvent); } else { event->ignore(); return true; } } else { // MouseEvent doesn't need to accept/ignore the event. // We can check the event and still pass it up to our parent. MouseEvent(event); } } return QDoubleSpinBox::event(event); } bool QAmazonDoubleSpinBox::eventFilter(QObject* obj, QEvent* e) { QObject* _lineEdit = static_cast<QObject*>(lineEdit()); if (obj == _lineEdit) { if (e->type() == QMouseEvent::MouseButtonDblClick) { QMouseEvent* mev = static_cast<QMouseEvent*>(e); if (mev->button() == Qt::LeftButton) { lineEdit()->selectAll(); return true; } } if (e->type() == QMouseEvent::MouseButtonPress) { // If the mouse button press event happened when mouse FocusIn // the widget, ignored the mousebuttonpress event if (m_isFocusedIn) { m_isFocusedIn = false; return true; } } } return QDoubleSpinBox::eventFilter(obj, e); } void QAmazonDoubleSpinBox::keyPressEvent(QKeyEvent* event) { m_isEditInProgress = true; QDoubleSpinBox::keyPressEvent(event); //fix the issue with DoubleSpinbox: when enter key pressed after editing the text won't be all selected if ((event->key() == Qt::Key_Enter) || (event->key() == Qt::Key_Return)) { lineEdit()->selectAll(); } } void QAmazonDoubleSpinBox::focusOutEvent(QFocusEvent* event) { m_isEditInProgress = false; m_isFocusedIn = false; return QDoubleSpinBox::focusOutEvent(event); } QString QAmazonDoubleSpinBox::textFromValue(double val) const { QString text = ""; // We show fewer decimal places when not editing for a cleaner visual style. text = QString::number(val, m_decimalFormat, (m_isEditInProgress ? m_decimalsLong : m_decimalsShort)); // Remove trailing 0's text.remove(QRegExp("0+$")); // Remove trailing decimal point in case all post-decimal digits were 0's text.remove(QRegExp("\\.$")); return text; } // The default valueFromText function can only convert value with precious of 5 double QAmazonDoubleSpinBox::valueFromText(const QString& text) const { return QDoubleSpinBox::valueFromText(text); } #include <VariableWidgets/QAmazonDoubleSpinBox.moc>
30.430556
115
0.628632
[ "geometry" ]
d460c54cbbb3e53e188fd42e7b8c2acbbcad452c
3,529
cpp
C++
src/STEPS.cpp
tymoshenko/cf
4f4e9465ec3700ec16e03e24e9f09542a88534ec
[ "MIT" ]
1
2018-03-01T03:21:10.000Z
2018-03-01T03:21:10.000Z
src/STEPS.cpp
tymoshenko/cf
4f4e9465ec3700ec16e03e24e9f09542a88534ec
[ "MIT" ]
null
null
null
src/STEPS.cpp
tymoshenko/cf
4f4e9465ec3700ec16e03e24e9f09542a88534ec
[ "MIT" ]
null
null
null
#include "cf.hpp" struct STEPS : Module { enum ParamIds { LEVEL1_PARAM, TRIM1_PARAM, NUM_PARAMS }; enum InputIds { LIN1_INPUT, IN1_INPUT, NUM_INPUTS }; enum OutputIds { OUT1_OUTPUT, NUM_OUTPUTS }; int max_steps = 8 ; STEPS() : Module(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS) {} void step() override; }; void STEPS::step() { if (inputs[LIN1_INPUT].active) { max_steps = round(clamp(params[LEVEL1_PARAM].value + inputs[LIN1_INPUT].value*0.32*params[TRIM1_PARAM].value,1.0f,32.0f)); outputs[OUT1_OUTPUT].value = floor((inputs[IN1_INPUT].value * round(clamp(params[LEVEL1_PARAM].value + inputs[LIN1_INPUT].value*0.32*params[TRIM1_PARAM].value,1.0f,32.0f))) / 10.01) * (10 / round(clamp(params[LEVEL1_PARAM].value + inputs[LIN1_INPUT].value*0.32*params[TRIM1_PARAM].value,1.0f,32.0f))) ; } else { max_steps = round(params[LEVEL1_PARAM].value); outputs[OUT1_OUTPUT].value = floor((inputs[IN1_INPUT].value * round(params[LEVEL1_PARAM].value)) / 10.01) * (10 / round(params[LEVEL1_PARAM].value)) ; } } struct NumbeDisplayWidget : TransparentWidget { int *value; std::shared_ptr<Font> font; NumbeDisplayWidget() { font = Font::load(assetPlugin(plugin, "res/Segment7Standard.ttf")); }; void draw(NVGcontext *vg) { // Background NVGcolor backgroundColor = nvgRGB(0x44, 0x44, 0x44); NVGcolor borderColor = nvgRGB(0x10, 0x10, 0x10); nvgBeginPath(vg); nvgRoundedRect(vg, 0.0, 0.0, box.size.x, box.size.y, 4.0); nvgFillColor(vg, backgroundColor); nvgFill(vg); nvgStrokeWidth(vg, 1.0); nvgStrokeColor(vg, borderColor); nvgStroke(vg); nvgFontSize(vg, 18); nvgFontFaceId(vg, font->handle); nvgTextLetterSpacing(vg, 2.5); std::string to_display = std::to_string(*value); while(to_display.length()<3) to_display = ' ' + to_display; Vec textPos = Vec(6.0f, 17.0f); NVGcolor textColor = nvgRGB(0xdf, 0xd2, 0x2c); nvgFillColor(vg, nvgTransRGBA(textColor, 16)); nvgText(vg, textPos.x, textPos.y, "~~~", NULL); textColor = nvgRGB(0xda, 0xe9, 0x29); nvgFillColor(vg, nvgTransRGBA(textColor, 16)); nvgText(vg, textPos.x, textPos.y, "\\\\\\", NULL); textColor = nvgRGB(0x28, 0xb0, 0xf3); nvgFillColor(vg, textColor); nvgText(vg, textPos.x, textPos.y, to_display.c_str(), NULL); } }; struct STEPSWidget : ModuleWidget { STEPSWidget(STEPS *module); }; STEPSWidget::STEPSWidget(STEPS *module) : ModuleWidget(module) { setPanel(SVG::load(assetPlugin(plugin, "res/STEPS.svg"))); addChild(Widget::create<ScrewSilver>(Vec(15, 0))); addChild(Widget::create<ScrewSilver>(Vec(box.size.x-30, 0))); addChild(Widget::create<ScrewSilver>(Vec(15, 365))); addChild(Widget::create<ScrewSilver>(Vec(box.size.x-30, 365))); addParam(ParamWidget::create<RoundBlackKnob>(Vec(27, 157), module, STEPS::LEVEL1_PARAM, 1.0f, 32.0f, 8.1f)); addParam(ParamWidget::create<Trimpot>(Vec(37, 207), module, STEPS::TRIM1_PARAM, -10.0f, 10.0f, 0.0f)); addInput(Port::create<PJ301MPort>(Vec(34, 250), Port::INPUT, module, STEPS::LIN1_INPUT)); addInput(Port::create<PJ301MPort>(Vec(11, 321), Port::INPUT, module, STEPS::IN1_INPUT)); addOutput(Port::create<PJ301MPort>(Vec(54, 321), Port::OUTPUT, module, STEPS::OUT1_OUTPUT)); NumbeDisplayWidget *display = new NumbeDisplayWidget(); display->box.pos = Vec(20,56); display->box.size = Vec(50, 20); display->value = &module->max_steps; addChild(display); } Model *modelSTEPS = Model::create<STEPS, STEPSWidget>("cf", "STEPS", "Steps", UTILITY_TAG);
28.92623
303
0.68943
[ "model" ]
d4661e09e6a5d525cf613bb31c5f7d7556cb8f4e
10,859
cpp
C++
logdevice/test/StreamWriterIntegrationTest.cpp
yzhdanov/LogDevice
809262310df981eb8ed1e2b3252b1ccf4f6aa875
[ "BSD-3-Clause" ]
1
2018-09-12T15:45:05.000Z
2018-09-12T15:45:05.000Z
logdevice/test/StreamWriterIntegrationTest.cpp
march-github/LogDevice
e32e9fd8337cfbe7861c5f78846d42a9abd82d96
[ "BSD-3-Clause" ]
null
null
null
logdevice/test/StreamWriterIntegrationTest.cpp
march-github/LogDevice
e32e9fd8337cfbe7861c5f78846d42a9abd82d96
[ "BSD-3-Clause" ]
null
null
null
/** * Copyright (c) 2017-present, Facebook, Inc. and its affiliates. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. */ #include <mutex> #include <string> #include <thread> #include <gtest/gtest.h> #include "logdevice/common/Semaphore.h" #include "logdevice/common/StreamWriterAppendSink.h" #include "logdevice/common/debug.h" #include "logdevice/lib/ClientImpl.h" #include "logdevice/lib/ClientProcessor.h" #include "logdevice/test/BufferedWriterTestUtils.h" #include "logdevice/test/utils/IntegrationTestBase.h" #include "logdevice/test/utils/IntegrationTestUtils.h" /** * @file Integration tests for BufferedWriter with StreamWriterAppendSink. */ using namespace facebook::logdevice; /** * Callback used to test if ACKs for messages happen in FIFO order and that once * accepted a message never fails. */ class FIFOTestCallback : public BufferedWriter::AppendCallback { public: // Ensures that messages are ACKed in FIFO order and posts on the semaphore // that the client waits on. Also, maintains lsn_range (the smallest and // largest LSN) that has been ACKed to the callback. void onSuccess(logid_t, ContextSet contexts, const DataRecordAttributes& attrs) override { std::lock_guard<std::mutex> guard(mutex_); if (lsn_range.first == LSN_INVALID) { lsn_range.first = attrs.lsn; } lsn_range.first = std::min(lsn_range.first, attrs.lsn); lsn_range.second = std::max(lsn_range.second, attrs.lsn); for (auto& ctx : contexts) { auto& seq_num = *((int*)ctx.first); ASSERT_EQ(next_seq_num, seq_num); delete ((int*)ctx.first); ++next_seq_num; sem.post(); } } // Message once accepted in the stream must never fail. void onFailure(logid_t /*log_id*/, ContextSet /*contexts*/, Status /*status*/) override { ADD_FAILURE(); } // Each successful append posts to this semaphore. Semaphore sem; // Next expected message seq number. Should always increase by one. int next_seq_num = 0; // LSN range that was written. std::pair<lsn_t, lsn_t> lsn_range{LSN_INVALID, LSN_INVALID}; private: std::mutex mutex_; }; class StreamWriterIntegrationTest : public IntegrationTestBase { public: using Node = IntegrationTestUtils::Node; using Cluster = IntegrationTestUtils::Cluster; using Context = BufferedWriter::AppendCallback::Context; // Initializes a cluster with the given configuration, creates a client and a // BufferedWriter that sends appends to StreamWriterAppendSink. void init(size_t num_nodes = 5, int replication_factor = 2, int node_set_size = 10, uint32_t num_logs = 32); // Reads back records and verifies if the payload and order are same as sent // over the stream according to the weak FIFO guarantee i.e. for all i, the // first occurrence of message m_i is before the first occurrence of message // m_{i+1}. Message m_i has a payload "i". void verifyRecords(); // Obtains the sequencer in the cluster by posting a GET_SEQ_STATE request. Node& getSequencer() { int seq_idx = cluster->getHashAssignedSequencerNodeId(LOG_ID, client.get()); ld_check_ne(-1, seq_idx); return cluster->getNode(seq_idx); } // Stalls append requests from being processed in any node by disallowing all // storage nodes as copysets. Node keeps trying again and again until we // explicitly unstall them. void stallRequests() { std::string all_nodes = ""; bool first = true; for (auto& pr : cluster->getNodes()) { all_nodes += (first ? "" : ","); all_nodes += std::to_string(pr.first); first = false; } auto& nodes = cluster->getNodes(); for (auto& it : nodes) { auto& node = it.second; if (node->isRunning()) { node->updateSetting("test-do-not-pick-in-copysets", all_nodes); } } } // Unstalls append requests. Now sequencer node can process append requests. void unstallRequests() { auto& nodes = cluster->getNodes(); for (auto& it : nodes) { auto& node = it.second; if (node->isRunning()) { node->unsetSetting("test-do-not-pick-in-copysets"); } } } // Sends messages m_{msgs_sent} ... m_{until-1} via the buffered stream // writer and flushes them periodically. void sendMessagesUntil(int until) { for (; msgs_sent < until; ++msgs_sent) { auto ctx = (Context) new int(msgs_sent); ASSERT_EQ(0, writer->append(LOG_ID, std::to_string(msgs_sent), ctx)); if (msgs_sent && !(msgs_sent % num_messages_per_flush)) { ASSERT_EQ(0, writer->flushAll()); } } writer->flushAll(); } // Waits until all messages until m_{until-1} have been acked. Note that // messages until m_{msgs_rcvd-1} have already been ACKed. void waitForMessagesUntil(int until) { ld_check(until <= msgs_sent); for (; msgs_rcvd < until; ++msgs_rcvd) { callback.sem.wait(); } } std::unique_ptr<Cluster> cluster; std::shared_ptr<Client> client; std::unique_ptr<BufferedWriter> writer; FIFOTestCallback callback; const logid_t LOG_ID = logid_t(1); const int num_messages_per_flush = 5; int msgs_sent = 0; int msgs_rcvd = 0; }; void StreamWriterIntegrationTest::init(size_t num_nodes, int replication_factor, int node_set_size, uint32_t num_logs) { Configuration::Nodes nodes; for (int i = 0; i < num_nodes; ++i) { auto& node = nodes[i]; node.generation = 1; node.addSequencerRole(); node.addStorageRole(); } auto log_attrs = logsconfig::LogAttributes() .with_replicationFactor(replication_factor) .with_nodeSetSize(node_set_size); cluster = IntegrationTestUtils::ClusterFactory() .setNodes(nodes) .setNumLogs(num_logs) .setLogAttributes(log_attrs) .useHashBasedSequencerAssignment(100, "10s") .enableMessageErrorInjection() .setLogGroupName("test_range") .setParam("--sequencer-reactivation-delay-secs", "1200s..2000s") .setParam("--nodeset-adjustment-period", "0s") .setParam("--nodeset-adjustment-min-window", "1s") .setParam("--nodeset-size-adjustment-min-factor", "0") .create(num_nodes); for (const auto& it : nodes) { node_index_t idx = it.first; cluster->waitUntilGossip(/* alive */ true, idx); } client = cluster->createClient(std::chrono::seconds(5)); BufferedWriter::Options options; options.retry_initial_delay = std::chrono::milliseconds(10); options.retry_max_delay = std::chrono::milliseconds(1000); options.mode = BufferedWriter::Options::Mode::STREAM; writer = BufferedWriter::create(client, &callback, options); } void StreamWriterIntegrationTest::verifyRecords() { auto reader = client->createReader(1); lsn_t first_lsn = callback.lsn_range.first; lsn_t until_lsn = callback.lsn_range.second; int rv = reader->startReading(LOG_ID, first_lsn, until_lsn); ASSERT_EQ(0, rv); reader->setTimeout(std::chrono::milliseconds(100)); // Read one by one to verify that isReading() stays true until we have // consumed all records. std::vector<std::string> received; while (reader->isReading(LOG_ID)) { std::vector<std::unique_ptr<DataRecord>> data; GapRecord gap; ssize_t nread = reader->read(1, &data, &gap); if (nread > 0) { for (const auto& record : data) { Payload p = record->payload; received.emplace_back((const char*)p.data(), p.size()); } } } int seq_num = -1; for (auto& data : received) { int data_seq_num = std::stoi(data); if (data_seq_num > seq_num) { ASSERT_EQ(data_seq_num, seq_num + 1); ++seq_num; } } ASSERT_EQ(seq_num, msgs_sent - 1); ASSERT_FALSE(reader->isReading(LOG_ID)); } TEST_F(StreamWriterIntegrationTest, SimpleStreamTest) { init(); // Send 100 messages over the stream and wait for the ACKs. Read it using a // reader and verify the payloads and order of messages. sendMessagesUntil(100); waitForMessagesUntil(100); verifyRecords(); } TEST_F(StreamWriterIntegrationTest, SequencerFailure) { init(); // Send some messages over the stream, wait for first ACK and then kill // sequencer. Now send some more records over the stream. Read and verify the // records back using a reader. auto& sequencer = getSequencer(); sendMessagesUntil(25); waitForMessagesUntil(1); sequencer.kill(); sendMessagesUntil(50); waitForMessagesUntil(50); verifyRecords(); // Make sure that it is indeed a different sequencer. ASSERT_NE(lsn_to_epoch(callback.lsn_range.first), lsn_to_epoch(callback.lsn_range.second)); } TEST_F(StreamWriterIntegrationTest, MultipleInflight) { init(); // Send some messages to current sequencer and wait for ACKs. sendMessagesUntil(25); waitForMessagesUntil(25); // Now stall the sequencer so that multiple requests become inflight. stallRequests(); sendMessagesUntil(50); // Here we check that no more ACKs since m25 have been received. This check is // indeed weak since we are checking that something did not happen at a // particular time, which does not preclude it from happening later. But, it // is strictly better than not checking. ASSERT_EQ(25, callback.next_seq_num); // Unstall the sequencer now. The inflight requests m26..m50 will be processed // now. Go ahead and wait for their ACKs now. unstallRequests(); waitForMessagesUntil(50); // Send some more messages and wait for their ACKs. sendMessagesUntil(75); waitForMessagesUntil(75); // Read and verify the records we sent over the stream. verifyRecords(); } TEST_F(StreamWriterIntegrationTest, InflightSequencerFailed) { init(); // Send some messages to current sequencer and wait for ACKs. auto& sequencer = getSequencer(); sendMessagesUntil(25); waitForMessagesUntil(25); // Stall the current sequencer and send some more requests. Once sent, kill // the sequencer. This simulates inflight requests that fail. The system must // identify next sequencer and append messages to log using that. stallRequests(); sendMessagesUntil(50); sequencer.kill(); unstallRequests(); waitForMessagesUntil(50); // Make sure that it is indeed a different sequencer. ASSERT_NE(lsn_to_epoch(callback.lsn_range.first), lsn_to_epoch(callback.lsn_range.second)); // Send some more messages over the stream. sendMessagesUntil(75); waitForMessagesUntil(75); verifyRecords(); }
33.309816
80
0.679713
[ "vector" ]
d46759a933a1576051906b43365906fc28a53f88
7,142
cpp
C++
test/rewrite_pooling_test.cpp
pfultz2/AMDMIGraphX
25fffe5984f54590d76f94ff58c0d6b7034df8ea
[ "MIT" ]
null
null
null
test/rewrite_pooling_test.cpp
pfultz2/AMDMIGraphX
25fffe5984f54590d76f94ff58c0d6b7034df8ea
[ "MIT" ]
null
null
null
test/rewrite_pooling_test.cpp
pfultz2/AMDMIGraphX
25fffe5984f54590d76f94ff58c0d6b7034df8ea
[ "MIT" ]
null
null
null
#include <migraphx/rewrite_pooling.hpp> #include <migraphx/dead_code_elimination.hpp> #include <migraphx/program.hpp> #include <migraphx/ref/target.hpp> #include <migraphx/instruction.hpp> #include <migraphx/generate.hpp> #include <migraphx/ranges.hpp> #include <test.hpp> #include <migraphx/make_op.hpp> #include <migraphx/verify.hpp> bool is_pooling(migraphx::instruction& ins) { return ins.name() == "pooling"; } static void opt_pooling(migraphx::program& prog) { auto* mm = prog.get_main_module(); migraphx::rewrite_pooling rp; migraphx::dead_code_elimination dce; rp.apply(*mm); dce.apply(*mm); } TEST_CASE(rewrite_pooling_test) { migraphx::shape s{migraphx::shape::float_type, {2, 2, 3, 4, 5}}; auto pooling_program = [&](const std::string& mode) { migraphx::program p; auto* mm = p.get_main_module(); auto input = mm->add_parameter("x", s); auto ret = mm->add_instruction(migraphx::make_op("pooling", {{"mode", mode}, {"padding", {0, 0, 0}}, {"stride", {1, 1, 1}}, {"lengths", {3, 4, 5}}}), input); mm->add_return({ret}); return p; }; auto opt_program = [&](const migraphx::operation& reduce_op) { migraphx::program p; auto* mm = p.get_main_module(); auto input = mm->add_parameter("x", s); auto rsp = mm->add_instruction(migraphx::make_op("reshape", {{"dims", {4, -1}}}), input); auto rdm = mm->add_instruction(reduce_op, rsp); auto ret = mm->add_instruction(migraphx::make_op("reshape", {{"dims", {2, 2, 1, 1, 1}}}), rdm); mm->add_return({ret}); return p; }; auto test_rewrite = [&](const std::string& mode, const migraphx::operation& op) { migraphx::program p1 = pooling_program(mode); migraphx::program p2 = opt_program(op); opt_pooling(p1); EXPECT(p1 == p2); }; test_rewrite("average", migraphx::make_op("reduce_mean", {{"axes", {1}}})); test_rewrite("max", migraphx::make_op("reduce_max", {{"axes", {1}}})); } TEST_CASE(rewrite_avepooling_na1_test) { migraphx::shape s{migraphx::shape::float_type, {2, 2, 3, 4, 5}}; auto pooling_program = [&]() { migraphx::program p; auto* mm = p.get_main_module(); auto input = mm->add_parameter("x", s); auto ret = mm->add_instruction(migraphx::make_op("pooling", {{"mode", "average"}, {"padding", {0, 1, 0}}, {"stride", {1, 1, 1}}, {"lengths", {3, 4, 5}}}), input); mm->add_return({ret}); return p; }; migraphx::program p1 = pooling_program(); migraphx::program p2 = p1; opt_pooling(p1); EXPECT(p1 == p2); } TEST_CASE(rewrite_avepooling_na2_test) { migraphx::shape s{migraphx::shape::float_type, {2, 2, 3, 4, 5}}; auto pooling_program = [&]() { migraphx::program p; auto* mm = p.get_main_module(); auto input = mm->add_parameter("x", s); auto ret = mm->add_instruction(migraphx::make_op("pooling", {{"mode", "average"}, {"padding", {0, 0, 0}}, {"stride", {1, 2, 1}}, {"lengths", {3, 4, 5}}}), input); mm->add_return({ret}); return p; }; migraphx::program p1 = pooling_program(); migraphx::program p2 = p1; opt_pooling(p1); EXPECT(p1 == p2); } TEST_CASE(rewrite_avepooling_na3_test) { migraphx::shape s{migraphx::shape::float_type, {2, 2, 3, 4, 5}}; auto pooling_program = [&]() { migraphx::program p; auto* mm = p.get_main_module(); auto input = mm->add_parameter("x", s); auto ret = mm->add_instruction(migraphx::make_op("pooling", {{"mode", "max"}, {"padding", {0, 0, 0}}, {"stride", {1, 1, 1}}, {"lengths", {3, 3, 5}}}), input); mm->add_return({ret}); return p; }; migraphx::program p1 = pooling_program(); migraphx::program p2 = p1; opt_pooling(p1); EXPECT(p1 == p2); } TEST_CASE(literal_rewrite_pooling_test) { migraphx::shape s{migraphx::shape::float_type, {2, 2, 3, 4, 5}}; std::vector<float> data(s.elements()); std::iota(data.begin(), data.end(), 1.0f); auto pooling_program = [&](const std::string& mode) { migraphx::program p; auto* mm = p.get_main_module(); auto input = mm->add_literal(migraphx::literal(s, data)); auto ret = mm->add_instruction(migraphx::make_op("pooling", {{"mode", mode}, {"padding", {0, 0, 0}}, {"stride", {1, 1, 1}}, {"lengths", {3, 4, 5}}}), input); mm->add_return({ret}); return p; }; auto opt_program = [&](const migraphx::operation& op) { migraphx::program p; auto* mm = p.get_main_module(); auto input = mm->add_literal(migraphx::literal(s, data)); auto rsp = mm->add_instruction(migraphx::make_op("reshape", {{"dims", {4, -1}}}), input); auto rdm = mm->add_instruction(op, rsp); auto ret = mm->add_instruction(migraphx::make_op("reshape", {{"dims", {2, 2, 1, 1, 1}}}), rdm); mm->add_return({ret}); return p; }; auto test_rewrite_pooling = [&](const std::string& mode, const migraphx::operation& op) { migraphx::program p1 = pooling_program(mode); migraphx::program p2 = opt_program(op); p1.compile(migraphx::ref::target{}); p2.compile(migraphx::ref::target{}); auto result1 = p1.eval({}).back(); auto result2 = p2.eval({}).back(); visit_all(result1, result2)([&](auto r1, auto r2) { EXPECT(migraphx::verify_range(r1, r2)); }); }; test_rewrite_pooling("max", migraphx::make_op("reduce_max", {{"axes", {1}}})); test_rewrite_pooling("average", migraphx::make_op("reduce_mean", {{"axes", {1}}})); } int main(int argc, const char* argv[]) { test::run(argc, argv); }
37.989362
99
0.475777
[ "shape", "vector" ]
d46a6bde8eae01ff01ffd400b8b6e2a1e63d4fcc
2,704
cpp
C++
src/InitialExperience/SdkModel/InitialExperienceModuleBase.cpp
usamakhan049/assignment
40eb153e8fd74f73ba52ce29417d8220ab744b5d
[ "BSD-2-Clause" ]
69
2017-06-07T10:47:03.000Z
2022-03-24T08:33:33.000Z
src/InitialExperience/SdkModel/InitialExperienceModuleBase.cpp
usamakhan049/assignment
40eb153e8fd74f73ba52ce29417d8220ab744b5d
[ "BSD-2-Clause" ]
23
2017-06-07T10:47:00.000Z
2020-07-09T10:31:17.000Z
src/InitialExperience/SdkModel/InitialExperienceModuleBase.cpp
usamakhan049/assignment
40eb153e8fd74f73ba52ce29417d8220ab744b5d
[ "BSD-2-Clause" ]
31
2017-08-12T13:19:32.000Z
2022-01-04T20:33:40.000Z
// Copyright eeGeo Ltd (2012-2015), All Rights Reserved #include "InitialExperienceModuleBase.h" #include "InitialExperience.h" #include "InitialExperienceModel.h" #include "InitialExperienceController.h" namespace ExampleApp { namespace InitialExperience { namespace SdkModel { InitialExperienceModuleBase::InitialExperienceModuleBase(PersistentSettings::IPersistentSettingsModel& persistentSettings) : m_pInitialExperienceModel(NULL) , m_pInitialExperienceController(NULL) , m_persistentSettings(persistentSettings) { } InitialExperienceModuleBase::~InitialExperienceModuleBase() { TearDown(); } PersistentSettings::IPersistentSettingsModel& InitialExperienceModuleBase::GetPersistentSettings() const { return m_persistentSettings; } void InitialExperienceModuleBase::InitialiseWithApplicationModels(WorldAreaLoader::SdkModel::IWorldAreaLoaderModel &worldAreaLoaderModel) { Eegeo_ASSERT(m_pInitialExperienceModel == NULL, "Cannot call InitialExperienceModule::InitialiseWithApplicationModels twice.\n"); std::vector<IInitialExperienceStep*> steps = CreateSteps(worldAreaLoaderModel); const int lastCameraLockedStep = 0; m_pInitialExperienceModel = Eegeo_NEW(InitialExperienceModel)(steps, lastCameraLockedStep); m_pInitialExperienceController = Eegeo_NEW(InitialExperienceController)(*m_pInitialExperienceModel); } void InitialExperienceModuleBase::TearDown() { Eegeo_DELETE m_pInitialExperienceController; m_pInitialExperienceController = NULL; Eegeo_DELETE m_pInitialExperienceModel; m_pInitialExperienceModel = NULL; } IInitialExperienceModel& InitialExperienceModuleBase::GetInitialExperienceModel() const { Eegeo_ASSERT(m_pInitialExperienceModel != NULL, "Must call InitialExperienceModule::InitialiseWithApplicationModels before accessing model.\n"); return *m_pInitialExperienceModel; } IInitialExperienceController& InitialExperienceModuleBase::GetInitialExperienceController() const { Eegeo_ASSERT(m_pInitialExperienceController != NULL, "Must call InitialExperienceModule::InitialiseWithApplicationModels before accessing controller.\n"); return *m_pInitialExperienceController; } } } }
40.358209
170
0.668639
[ "vector", "model" ]
d46aa490a32cf64eabeb5df724c9bcbc43f16ad1
18,055
cpp
C++
util/def.cpp
Hower91/Apache-C-Standard-Library-4.2.x
4d9011d60dbb38b3ff80dcfe54dccd3a4647d9d3
[ "Apache-2.0" ]
null
null
null
util/def.cpp
Hower91/Apache-C-Standard-Library-4.2.x
4d9011d60dbb38b3ff80dcfe54dccd3a4647d9d3
[ "Apache-2.0" ]
null
null
null
util/def.cpp
Hower91/Apache-C-Standard-Library-4.2.x
4d9011d60dbb38b3ff80dcfe54dccd3a4647d9d3
[ "Apache-2.0" ]
null
null
null
/*************************************************************************** * * def.cpp * * $Id: //stdlib/dev/source/stdlib/util/def.cpp#2 $ * *************************************************************************** * * Copyright (c) 1994-2005 Quovadx, Inc., acting through its Rogue Wave * Software division. Licensed under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance with the * License. You may obtain a copy of the License at * http://www.apache.org/licenses/LICENSE-2.0. Unless required by * applicable law or agreed to in writing, software distributed under * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR * CONDITIONS OF ANY KIND, either express or implied. See the License * for the specific language governing permissions and limitations under * the License. * **************************************************************************/ // #ifndef _RWSTD_NO_PURE_C_HEADERS // # define _RWSTD_NO_PURE_C_HEADERS // #endif // _RWSTD_NO_PURE_C_HEADERS // #ifndef _RWSTD_NO_DEPRECATED_C_HEADERS // # define _RWSTD_NO_DEPRECATED_C_HEADERS // #endif // _RWSTD_NO_DEPRECATED_C_HEADERS #ifdef __DECCXX # undef __PURE_CNAME #endif // __DECCXX #include <algorithm> #include <fstream> #include <iostream> #include <locale> #include <map> #include <string> #include <vector> #include <cassert> #include <cctype> #include <cerrno> #include <climits> #include <clocale> #include <cstdio> #include <cstdlib> #include "aliases.h" #include "def.h" #include "diagnostic.h" #include "loc_exception.h" #include "path.h" #define UTF8_MAX_SIZE 6 // convert_to_ext converts a wchar_t value with some encoding into // a narrow character string in the current locale's encoding std::string Def::convert_to_ext (wchar_t val) { rn_cmap_iter2 it; if ((it = charmap_.get_rn_cmap2().find(val)) != charmap_.get_rn_cmap2().end()){ return it->second; } issue_diag (E_CVT2EXT, true, 0, "unable to convert character %d to external " "representation\n", val); return std::string(""); } // convert the wchar_t value into a utf8 string std::string Def::utf8_encode (wchar_t wc) { unsigned int wc_int = _RWSTD_STATIC_CAST (unsigned int, wc); std::string ret; std::size_t size = 0; char buf[UTF8_MAX_SIZE + 1]; char* bufp = buf; if (wc_int < 0x80) { size = 1; *bufp++ = wc_int; } else { int b; for (b = 2; b < UTF8_MAX_SIZE; b++) if ((wc_int & (~(wchar_t)0 << (5 * b + 1))) == 0) break; size = b; *bufp = (unsigned char) (~0xff >> b); --b; do { bufp[b] = 0x80 | (wc_int & 0x3f); wc_int >>= 6; } while (--b > 0); *bufp |= wc_int; } buf[size] = (char)0; for (unsigned int i = 0; i < size; i++) ret += buf[i]; return ret; } void Def::copy_file (const std::string& name, const std::string& outname) { assert (name.size() > 0); assert (outname.size() > 0); std::ifstream from (name.c_str(), std::ios::binary); if (!from) { issue_diag (E_OPENRD, true, &next, "unable to open locale database %s\n", name.c_str()); } from.exceptions (std::ios::badbit); std::ofstream to (outname.c_str(), std::ios::binary); if (!to) { issue_diag (E_OPENWR, true, &next, "unable to create locale database %s\n", outname.c_str()); } to.exceptions (std::ios::failbit | std::ios::badbit); // copy the file to << from.rdbuf (); } void Def::copy_category(int category, std::string name) { assert (name.size() > 0); // create the name of the file to copy to and call copy_file std::string outname (output_name_); makedir (outname.c_str ()); switch (category) { // append the category name to both 'name' and 'outname' // and call the copy_file routine // the xxx_written variable is set to true so that write_xxx // does not overwrite the file that is written here case LC_CTYPE: (name += _RWSTD_PATH_SEP) += "LC_CTYPE"; (outname += _RWSTD_PATH_SEP) += "LC_CTYPE"; copy_file (name, outname); ctype_written_ = true; break; case LC_COLLATE: (name += _RWSTD_PATH_SEP) += "LC_COLLATE"; (outname += _RWSTD_PATH_SEP) += "LC_COLLATE"; copy_file(name, outname); collate_written_ = true; break; case LC_MONETARY: (name += _RWSTD_PATH_SEP) += "LC_MONETARY"; (outname += _RWSTD_PATH_SEP) += "LC_MONETARY"; copy_file(name, outname); mon_written_ = true; break; case LC_NUMERIC: (name += _RWSTD_PATH_SEP) += "LC_NUMERIC"; (outname += _RWSTD_PATH_SEP) += "LC_NUMERIC"; copy_file(name, outname); num_written_ = true; break; case LC_TIME: (name += _RWSTD_PATH_SEP) += "LC_TIME"; (outname += _RWSTD_PATH_SEP) += "LC_TIME"; copy_file(name, outname); time_written_ = true; break; #ifdef LC_MESSAGES case LC_MESSAGES: (name += _RWSTD_PATH_SEP) += "LC_MESSAGES"; (outname += _RWSTD_PATH_SEP) += "LC_MESSAGES"; copy_file(name, outname); messages_written_ = true; break; #endif // LC_MESSAGES default: break; } } // strip a pair, which should be in the form '(<sym>,<sym2>)' void Def::strip_pair (const std::string &tok, std::string &sym, std::string &sym2) { int i = 0; if(tok[i] == '(') { if(tok[++i] == '<') while (tok[i] != '>'){ if (tok[i] == scanner_.escape_char ()) i++; sym.push_back(tok[i++]); } // this push_back is safe because the while loop above ends when // tok[i] == '>' sym.push_back(tok[i++]); if (tok[i++] != ',') issue_diag (E_PAIR, true, &next, "invalid pair %s\n", tok.c_str()); if (tok[i] == '<') while (tok[i] != '>'){ if (tok[i] == scanner_.escape_char ()) sym2.push_back(tok[i++]); if ('\0' != tok[i]) sym2.push_back(tok[i++]); else issue_diag (E_PAIR, true, &next, "invalid pair %s\n", tok.c_str()); } // this push_back is safe because the while loop above ends when // tok[i] == '>' sym2.push_back(tok[i++]); } } // converts str, which is a string in the following format // "[<sym_name>][char]" including the quotes to a string of characters // str is not a const reference because if the string spans multiple lines // str is modified std::string Def::convert_string (const std::string &str1) { assert (str1[0] == '\"'); std::string ret; std::string sym; // the index starts at 1 so that we ignore the initial '"' int idx = 1; const char* str = str1.c_str(); while (str[idx] != '\"') { sym.clear(); // if we reach the null-terminator before we see an end-quote // then we must have a multi-line string, so get the next token if (str[idx] == '\0') { if((next = scanner_.next_token()).token == Scanner::tok_string) break; str = next.name.c_str(); idx = 0; } // '<' marks the beginning of a symbolic name // construct the name and look up its value in the cmap if (str[idx] == '<') { while (str[idx] != '>') { if (str[idx] == scanner_.escape_char ()) idx++; sym += str[idx++]; } // this is safe because the while loop ended with *str == '>' sym += str[idx++]; w_cmap_iter w_pos = charmap_.get_w_cmap().find (sym); if (w_pos != charmap_.get_w_cmap().end()) { ret += convert_to_ext(w_pos->second); } else { return std::string(); } } // the definition file contains a sting with non-symbol names. // process each character as it's actual character value. // Locale definitions that use this may not be portable. else { ret += (char)str[idx++]; } } return ret; } #ifndef _RWSTD_NO_WCHAR_T // converts a collating element definition to an array of wide characters // (the wide characters the collating element is composed of). // this overload deals with collating elements defined through // a sequence of symbolic names, NOT enclosed within quotes. std::wstring Def::convert_wstring (const StringVector& sym_array) { std::wstring ret; StringVector::const_iterator it = sym_array.begin (); while (it != sym_array.end ()) { // lookup the symbol we just constructed w_cmap_iter w_pos = charmap_.get_w_cmap().find (*it); if (w_pos != charmap_.get_w_cmap().end()) { ret += w_pos->second; it++; } else { // we return an empty string if we couldn't find any character // in the character map ret.clear(); return ret; } } return ret; } // this overload deals with collating elements defined through // a sequence of characters or symbolic names, enclosed within quotes. std::wstring Def::convert_wstring (const token_t& t) { std::wstring ret; std::string sym; std::string str1 (t.name); int idx = 0; char term = 0; const char* str = str1.c_str(); // skip first character if quote if (str[idx] == '\"') { term = '\"', idx++; } while (str[idx] != term) { sym.clear(); // '<' marks the beginning of a symbolic name // construct the name and look up its value in the cmap if (str[idx] == '<') { while (str[idx] != '>') { if (str[idx] == scanner_.escape_char ()) { // sym += str[idx++]; idx++; } if ('\0' != str[idx]) sym += str[idx++]; else issue_diag (E_SYMEND, true, &t, "end of symbolic name not found\n"); } // this is safe because the while loop ended with *str == '>' sym += str[idx++]; // lookup the symbol we just constructed w_cmap_iter w_pos = charmap_.get_w_cmap().find (sym); if (w_pos != charmap_.get_w_cmap().end()) { ret += w_pos->second; } else { // if we can't find a symbol then return an empty string, // most likely this will happen if inside a collating-element // the user uses a character that is not in the current // codeset, in this case the collating element will be ignored ret.clear(); return ret; } } // the definition file contains a string with non-symbol names. // process each character as it's actual character value. // Locale definitions that use this may not be portable. else ret += (wchar_t)str[idx++]; } return ret; } #endif // _RWSTD_NO_WCHAR_T // automatically fill any categories that depend on other categories void Def::auto_fill () { mask_iter mask_pos; for (std::size_t i = 0; i <= UCHAR_MAX; i++) { if ( ctype_out_.mask_tab[i] & std::ctype_base::upper || ctype_out_.mask_tab[i] & std::ctype_base::lower || ctype_out_.mask_tab[i] & std::ctype_base::alpha || ctype_out_.mask_tab[i] & std::ctype_base::digit || ctype_out_.mask_tab[i] & std::ctype_base::xdigit || ctype_out_.mask_tab[i] & std::ctype_base::punct) ctype_out_.mask_tab[i] |= std::ctype_base::print; if ( ctype_out_.mask_tab[i] & std::ctype_base::upper || ctype_out_.mask_tab[i] & std::ctype_base::lower) ctype_out_.mask_tab[i] |= std::ctype_base::alpha; if ( ctype_out_.mask_tab[i] & std::ctype_base::upper || ctype_out_.mask_tab[i] & std::ctype_base::lower || ctype_out_.mask_tab[i] & std::ctype_base::alpha || ctype_out_.mask_tab[i] & std::ctype_base::digit || ctype_out_.mask_tab[i] & std::ctype_base::xdigit || ctype_out_.mask_tab[i] & std::ctype_base::punct) ctype_out_.mask_tab[i] |= std::ctype_base::graph; } for (mask_pos = mask_.begin(); mask_pos != mask_.end(); mask_pos++) { // all lower, alpha, digit, xdigit, and punct, and space // characters are automatically print if ( mask_pos->second & std::ctype_base::upper || mask_pos->second & std::ctype_base::lower || mask_pos->second & std::ctype_base::alpha || mask_pos->second & std::ctype_base::digit || mask_pos->second & std::ctype_base::xdigit || mask_pos->second & std::ctype_base::punct) // || mask_pos->second & std::ctype_base::space) mask_pos->second |= std::ctype_base::print; // all upper and lower characters are alpha if ( mask_pos->second & std::ctype_base::upper || mask_pos->second & std::ctype_base::lower) mask_pos->second |= std::ctype_base::alpha; // all upper, lower, alpha, digit, xdigit, and punct characters // are graph characters if ( mask_pos->second & std::ctype_base::upper || mask_pos->second & std::ctype_base::lower || mask_pos->second & std::ctype_base::alpha || mask_pos->second & std::ctype_base::digit || mask_pos->second & std::ctype_base::xdigit || mask_pos->second & std::ctype_base::punct) mask_pos->second |= std::ctype_base::graph; } } void Def::process_input () { while ((next = scanner_.next_token ()).token != Scanner::tok_end_tokens) { switch (next.token) { case Scanner::tok_comment: scanner_.ignore_line (); break; case Scanner::tok_ctype: issue_diag (I_STAGE, false, 0, "processing LC_CTYPE\n"); process_ctype (); break; case Scanner::tok_collate: issue_diag (I_STAGE, false, 0, "processing LC_COLLATE\n"); process_collate (); break; case Scanner::tok_monetary: issue_diag (I_STAGE, false, 0, "processing LC_MONETARY\n"); process_monetary (); break; case Scanner::tok_numeric: issue_diag (I_STAGE, false, 0, "processing LC_NUMERIC\n"); process_numeric (); break; case Scanner::tok_time: issue_diag (I_STAGE, false, 0, "processing LC_TIME\n"); process_time (); break; case Scanner::tok_messages: issue_diag (I_STAGE, false, 0, "processing LC_MESSAGES\n"); process_messages (); break; case Scanner::tok_nl: break; default: scanner_.ignore_line (); break; } } auto_fill (); } Def::Def (const char* filename, const char* out_name, Charmap& char_map, bool no_position) : warnings_occurred_ (false), scan_ahead_ (false), next_offset_ (0), output_name_ (out_name), charmap_ (char_map), ctype_written_ (false), codecvt_written_ (false), collate_written_ (false), time_written_ (false), num_written_ (false), mon_written_ (false), messages_written_ (false), ctype_def_found_ (false), collate_def_found_ (false), time_def_found_ (false), num_def_found_ (false), mon_def_found_ (false), messages_def_found_ (false), undefined_keyword_found_ (false), no_position_ (no_position) { // make sure ctype_out object is cleared std::memset (&ctype_out_, 0, sizeof (ctype_out_)); std::memset (&time_out_, 0, sizeof (time_out_)); mon_out_.frac_digits [0] = -1; mon_out_.frac_digits [1] = -1; mon_out_.p_cs_precedes [0] = -1; mon_out_.p_sep_by_space [0] = -1; mon_out_.n_cs_precedes [0] = -1; mon_out_.n_sep_by_space [0] = -1; mon_out_.p_sign_posn [0] = -1; mon_out_.n_sign_posn [0] = -1; mon_st_.mon_grouping += -1; // c99 extension mon_out_.p_cs_precedes [1] = -1; mon_out_.p_sep_by_space [1] = -1; mon_out_.n_cs_precedes [1] = -1; mon_out_.n_sep_by_space [1] = -1; mon_out_.p_sign_posn [1] = -1; mon_out_.n_sign_posn [1] = -1; num_st_.grouping += -1; collate_out_.largest_ce = 1; collate_out_.longest_weight = 1; collate_out_.num_wchars = 0; std::memset (collate_out_.weight_type, 0, sizeof (collate_out_.weight_type)); // initialize all extensions to 0 ctype_out_.ctype_ext_off = 0; num_out_.numeric_ext_off = 0; collate_out_.collate_ext_off = 0; mon_out_.monetary_ext_off = 0; time_out_.time_ext_off = 0; // actual processing scanner_.open (filename); } Def::~Def () { // free up the memory that was allocated coll_map_iter coll_map_pos; for (coll_map_pos = coll_map_.begin(); coll_map_pos != coll_map_.end(); coll_map_pos ++) { delete[] (coll_map_pos->second.weights); } }
29.892384
78
0.550706
[ "object", "vector" ]
d474aa3362bb63569e49f4ba3bba329b8f74a5df
1,436
cpp
C++
COMP1005/a5/a5.cpp
hansolo669/Class
cf05e0aad68ccc53311cda2c945b6ac5cd5faf2b
[ "MIT" ]
null
null
null
COMP1005/a5/a5.cpp
hansolo669/Class
cf05e0aad68ccc53311cda2c945b6ac5cd5faf2b
[ "MIT" ]
null
null
null
COMP1005/a5/a5.cpp
hansolo669/Class
cf05e0aad68ccc53311cda2c945b6ac5cd5faf2b
[ "MIT" ]
null
null
null
#include <set> #include <map> #include <vector> #include <iterator> #include <iostream> #include <algorithm> #include "a5.h" using namespace std; vector<int> unique(vector<int> a){ set<int> b{a.begin(), a.end()}; vector<int> y; for (std::vector<int>::iterator i = a.begin(); i != a.end(); ++i){ if (b.count(*i) != 0){ y.push_back(*i); b.erase(*i); } } return y; } vector<int> pos_and_neg(vector<int> a){ set<int> b{a.begin(), a.end()}; vector<int> y; for (std::vector<int>::iterator i = a.begin(); i != a.end(); ++i){ if (b.count(*i) && b.count(-*i)){ y.push_back(*i); } } return y; } string encrypt(string s, map<char, char> d){ string y; for(char& c : s){ if (d.count(c) == 1){ y += d.find(c)->second; } else { y += "?"; } } return y; } int main(int argc, char const *argv[]){ auto lambda = []{ cout << "lambda!\n";}; vector<int> v = unique(vector<int> {2,1,3,1,4}); print_each(v); vector<int> v2 = pos_and_neg(vector<int> {-1,-2,3,1,2}); print_each(v2); map<char, char> d = {{'a','m'}, {'b','d'}, {'c','l'}, {'d','x'}, {'e','j'}, {'f','t'}, {'g','u'}, {'h','k'}, {'i','z'}, {'j','d'}, {'k','o'}, {'l','y'}, {'m','i'}, {'n','v'}, {'o','p'}, {'p','q'}, {'q','f'}, {'r','c'}, {'s','r'}, {'t','b'}, {'u','j'}, {'v','w'}, {'w','n'}, {'x','h'}, {'y','s'}, {'z','a'}}; string v3 = encrypt("supercalifragilisticexpialidocious", d); cout << v3 << "\n"; return 0; }
24.338983
308
0.490251
[ "vector" ]
d480392fd2ed277e9fc3c396658d748f886bd724
9,041
cpp
C++
controller/src/utils/infobus.cpp
GuttinRibeiro/TCC
fa0fe1f65e651f940ac0b9c2d0cf228c986f32bd
[ "MIT" ]
null
null
null
controller/src/utils/infobus.cpp
GuttinRibeiro/TCC
fa0fe1f65e651f940ac0b9c2d0cf228c986f32bd
[ "MIT" ]
null
null
null
controller/src/utils/infobus.cpp
GuttinRibeiro/TCC
fa0fe1f65e651f940ac0b9c2d0cf228c986f32bd
[ "MIT" ]
null
null
null
#include "infobus.hpp" #include "../utils/groups.hpp" InfoBus::InfoBus(qint8 id, std::string team, rclcpp::Client<ctr_msgs::srv::Elementrequest>::SharedPtr *clientPosition, rclcpp::Client<ctr_msgs::srv::Idrequest>::SharedPtr *clientInformation, rclcpp::Client<ctr_msgs::srv::Fieldinformationrequest>::SharedPtr *clientField) { _id = id; _clientPosition = clientPosition; _clientInformation = clientInformation; _clientField = clientField; // Check team color if(team == "blue") { _group = Groups::BLUE; } else if(team == "yellow") { _group = Groups::YELLOW; } else { _group = Groups::UNKNOWN; } } Vector InfoBus::myPosition() const { return robotPosition(_group, _id); } float InfoBus::myRadius() const { return robotRadius(_group, _id); } float InfoBus::myOrientation() const { return robotOrientation(_group, _id); } Vector InfoBus::ballPosition() const { return robotPosition(Groups::BALL, 0); } float InfoBus::ballRadius() const { return robotRadius(Groups::BALL, 0); } float InfoBus::ballOrientation() const { return robotOrientation(Groups::BALL, 0); } QList<qint8> InfoBus::ourPlayers() const { auto request = std::make_shared<ctr_msgs::srv::Idrequest::Request>(); request->group = _group; // Wait for service: while (!(*_clientInformation)->wait_for_service(std::chrono::seconds(1))) { RCLCPP_INFO(rclcpp::get_logger("rclcpp"), "[INFOBUS] Information service not available, waiting again..."); } QList<qint8> ret; auto response = (*_clientInformation)->async_send_request(request); auto status = response.wait_for(std::chrono::seconds(1)); if(status == std::future_status::ready) { for(int i = 0; i < response.get()->ids.size(); i++) { ret.insert(i, response.get()->ids.at(i)); } } else { RCLCPP_INFO(rclcpp::get_logger("rclcpp"), "[INFOBUS] Failed to request a list of ids"); } return ret; } QList<qint8> InfoBus::theirPlayers() const { auto request = std::make_shared<ctr_msgs::srv::Idrequest::Request>(); QList<qint8> ret; if(_group == Groups::BLUE) { request->group = Groups::YELLOW; } else if(_group == Groups::YELLOW) { request->group = Groups::BLUE; } else { std::cout << "[INFOBUS] Failed to request a list of ids due to an invalid group request\n"; return ret; } auto response = (*_clientInformation)->async_send_request(request); auto status = response.wait_for(std::chrono::seconds(1)); if(status == std::future_status::ready) { for(int i = 0; i < response.get()->ids.size(); i++) { ret.insert(i, response.get()->ids.at(i)); } } else { RCLCPP_INFO(rclcpp::get_logger("rclcpp"), "[INFOBUS] Failed to request a list of ids"); } return ret; } Vector InfoBus::robotPosition(const int &group, const qint8 &id) const { auto request = std::make_shared<ctr_msgs::srv::Elementrequest::Request>(); request->id = id; request->group = group; // Wait for service: while (!(*_clientPosition)->wait_for_service(std::chrono::seconds(1))) { RCLCPP_INFO(rclcpp::get_logger("rclcpp"), "[INFOBUS] Position service not available, waiting again..."); } Vector ret; auto response = (*_clientPosition)->async_send_request(request); auto status = response.wait_for(std::chrono::seconds(1)); if(status == std::future_status::ready) { ret.setX(response.get()->pos.x); ret.setY(response.get()->pos.y); ret.setZ(response.get()->pos.z); ret.setIsUnknown(!response.get()->pos.isvalid); } else { RCLCPP_INFO(rclcpp::get_logger("rclcpp"), "[INFOBUS] Failed to request position"); } return ret; } float InfoBus::robotRadius(const int &group, const qint8 &id) const { auto request = std::make_shared<ctr_msgs::srv::Elementrequest::Request>(); request->id = id; request->group = group; // Wait for service: while (!(*_clientPosition)->wait_for_service(std::chrono::seconds(1))) { RCLCPP_INFO(rclcpp::get_logger("rclcpp"), "[INFOBUS] Position service not available, waiting again..."); } float ret = -1; auto response = (*_clientPosition)->async_send_request(request); auto status = response.wait_for(std::chrono::seconds(1)); if(status == std::future_status::ready) { ret = response.get()->radius; } else { RCLCPP_INFO(rclcpp::get_logger("rclcpp"), "[INFOBUS] Failed to request radius"); } return ret; } float InfoBus::robotOrientation(const int &group, const qint8 &id) const { auto request = std::make_shared<ctr_msgs::srv::Elementrequest::Request>(); request->id = id; request->group = group; // Wait for service: while (!(*_clientPosition)->wait_for_service(std::chrono::seconds(1))) { RCLCPP_INFO(rclcpp::get_logger("rclcpp"), "[INFOBUS] Position service not available, waiting again..."); } float ret = -1; auto response = (*_clientPosition)->async_send_request(request); auto status = response.wait_for(std::chrono::seconds(1)); if(status == std::future_status::ready) { if(response.get()->hasorientation) { ret = response.get()->orientation; } } else { RCLCPP_INFO(rclcpp::get_logger("rclcpp"), "[INFOBUS] Failed to request orientation"); } return ret; } float InfoBus::maxX() const { return requestFieldValue("max x"); } float InfoBus::minY() const { return requestFieldValue("min y"); } float InfoBus::minX() const { return requestFieldValue("min x"); } float InfoBus::maxY() const { return requestFieldValue("max y"); } float InfoBus::goalDepth() const { return requestFieldValue("goal depth"); } float InfoBus::goalWidth() const { return requestFieldValue("goal width"); } float InfoBus::fieldWidth() const { return requestFieldValue("field width"); } float InfoBus::fieldLength() const { return requestFieldValue("field length"); } float InfoBus::centerRadius() const { return requestFieldValue("center radius"); } float InfoBus::defenseWidth() const { return requestFieldValue("defense width"); } float InfoBus::defenseLength() const { return requestFieldValue("defense length"); } float InfoBus::requestFieldValue(std::string info_requested) const { auto request = std::make_shared<ctr_msgs::srv::Fieldinformationrequest::Request>(); request->request = info_requested; // Wait for service: while (!(*_clientField)->wait_for_service(std::chrono::seconds(1))) { RCLCPP_INFO(rclcpp::get_logger("rclcpp"), "[INFOBUS] Field service not available, waiting again..."); } auto respose = (*_clientField)->async_send_request(request); auto status = respose.wait_for(std::chrono::seconds(1)); if(status == std::future_status::ready && respose.get()->error == false) { return respose.get()->value; } RCLCPP_INFO(rclcpp::get_logger("rclcpp"), "[INFOBUS] Failed to request a field value"); return -1.0; } Vector InfoBus::ourGoal() const { return requestFieldPosition("our goal"); } Vector InfoBus::theirGoal() const { return requestFieldPosition("their goal"); } Vector InfoBus::ourGoalLeftPost() const { return requestFieldPosition("our goal left post"); } Vector InfoBus::ourGoalRightPost() const { return requestFieldPosition("our goal right post"); } Vector InfoBus::theirGoalLeftPost() const { return requestFieldPosition("their goal left post"); } Vector InfoBus::theirGoalRightPost() const { return requestFieldPosition("their goal right post"); } Vector InfoBus::fieldCenter() const { return requestFieldPosition("field center"); } Vector InfoBus::ourFieldLeftCorner() const { return requestFieldPosition("our field left corner"); } Vector InfoBus::ourFieldRightCorner() const { return requestFieldPosition("our field right corner"); } Vector InfoBus::theirFieldLeftCorner() const { return requestFieldPosition("their field left corner"); } Vector InfoBus::theirFieldRightCorner() const { return requestFieldPosition("their field right corner"); } Vector InfoBus::requestFieldPosition(std::string info_requested) const { auto request = std::make_shared<ctr_msgs::srv::Fieldinformationrequest::Request>(); request->request = info_requested; // Wait for service: while (!(*_clientField)->wait_for_service(std::chrono::seconds(1))) { RCLCPP_INFO(rclcpp::get_logger("rclcpp"), "[INFOBUS] Field service not available, waiting again..."); } auto respose = (*_clientField)->async_send_request(request); auto status = respose.wait_for(std::chrono::seconds(1)); Vector ret; if(status == std::future_status::ready && respose.get()->error == false) { ret.setX(respose.get()->pos.x); ret.setY(respose.get()->pos.y); ret.setZ(respose.get()->pos.z); ret.setIsUnknown(!respose.get()->pos.isvalid); } else { RCLCPP_INFO(rclcpp::get_logger("rclcpp"), "[INFOBUS] Failed to request a field value"); } return ret; } int InfoBus::ourGroup() const { return _group; } int InfoBus::theirGroup() const { if(_group == Groups::BLUE) { return Groups::YELLOW; } if(_group == Groups::YELLOW) { return Groups::BLUE; } return Groups::UNKNOWN; }
28.977564
111
0.691738
[ "vector" ]
d4808664209846cb68a22693213ba8298a6d7b1f
929
cpp
C++
src/application/EditCommands/RemoveObjectCommand.cpp
AluminiumRat/mtt
3052f8ad0ffabead05a1033e1d714a61e77d0aa8
[ "MIT" ]
null
null
null
src/application/EditCommands/RemoveObjectCommand.cpp
AluminiumRat/mtt
3052f8ad0ffabead05a1033e1d714a61e77d0aa8
[ "MIT" ]
null
null
null
src/application/EditCommands/RemoveObjectCommand.cpp
AluminiumRat/mtt
3052f8ad0ffabead05a1033e1d714a61e77d0aa8
[ "MIT" ]
null
null
null
#include <stdexcept> #include <mtt/application/EditCommands/RemoveObjectCommand.h> #include <mtt/utilities/Abort.h> using namespace mtt; RemoveObjectCommand::RemoveObjectCommand(Object& object, Object& group) : _objectRef(object), _group(group) { if(!_group.subobjectCanBeAddedAndRemoved(_objectRef)) Abort("RemoveObjectCommand::RemoveObjectCommand: adding or removing is not supported."); } inline void RemoveObjectCommand::make() { if (_object != nullptr) Abort("RemoveObjectCommand::make: object is not null"); _object = _group.tryRemoveSubobject(_objectRef, true); if (_object == nullptr) throw(std::runtime_error("Unable to remove subobject.")); } inline void RemoveObjectCommand::undo() { if (_object == nullptr) Abort("RemoveObjectCommand::make: object is null"); _object = _group.tryAddSubobject(std::move(_object)); if (_object != nullptr) throw(std::runtime_error("Unable to add subobject.")); }
33.178571
144
0.757804
[ "object" ]
d483c6fa6f0bec8161aef4dad8870e2ca2edd6d7
44,125
cxx
C++
opal-3.16.2/src/sip/sippres.cxx
wwl33695/myopal
d302113c8ad8156b3392ce514cde491cf42d51af
[ "MIT" ]
null
null
null
opal-3.16.2/src/sip/sippres.cxx
wwl33695/myopal
d302113c8ad8156b3392ce514cde491cf42d51af
[ "MIT" ]
null
null
null
opal-3.16.2/src/sip/sippres.cxx
wwl33695/myopal
d302113c8ad8156b3392ce514cde491cf42d51af
[ "MIT" ]
null
null
null
/* * sippres.cxx * * SIP Presence classes for Opal * * Open Phone Abstraction Library (OPAL) * * Copyright (c) 2009 Post Increment * * The contents of this file are subject to the Mozilla Public License * Version 1.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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See * the License for the specific language governing rights and limitations * under the License. * * The Original Code is Open Phone Abstraction Library. * * The Initial Developer of the Original Code is Post Increment * * Contributor(s): ______________________________________. * * $Revision: 22858 $ * $Author: csoutheren $ * $Date: 2009-06-12 22:50:19 +1000 (Fri, 12 Jun 2009) $ */ /* * This code implements all or part of the following RFCs * * RFC 3856 "A Presence Event Package for the Session Initiation Protocol (SIP)" * RFC 3857 "A Watcher Information Event Template-Package for the Session Initiation Protocol (SIP)" * RFC 3858 "An Extensible Markup Language (XML) Based Format for Watcher Information" * RFC 3863 "Presence Information Data Format (PIDF)" * RFC 4825 "The Extensible Markup Language (XML) Configuration Access Protocol (XCAP)" * RFC 4827 "An Extensible Markup Language (XML) Configuration Access Protocol (XCAP) Usage for Manipulating Presence Document Contents" * RFC 5025 "Presence Authorization Rules" * * This code does not implement the following RFCs * * RFC 5263 "Session Initiation Protocol (SIP) Extension for Partial Notification of Presence Information" * */ #include <ptlib.h> #include <opal_config.h> #if OPAL_SIP_PRESENCE #include <sip/sippres.h> #include <ptclib/pdns.h> #include <ptclib/pxml.h> #include <ptclib/random.h> PFACTORY_CREATE(PFactory<OpalPresentity>, SIP_Presentity, "sip", false); PFACTORY_SYNONYM(PFactory<OpalPresentity>, SIP_Presentity, pres, "pres"); const PCaselessString & SIP_Presentity::PIDFEntityKey() { static const PConstCaselessString s("PIDF-Entity"); return s; } const PCaselessString & SIP_Presentity::SubProtocolKey() { static const PConstCaselessString s("Sub-Protocol"); return s; } const PCaselessString & SIP_Presentity::PresenceAgentKey() { static const PConstCaselessString s("Presence Agent"); return s; } const PCaselessString & SIP_Presentity::TransportKey() { static const PConstCaselessString s("Transport"); return s; } const PCaselessString & SIP_Presentity::XcapRootKey() { static const PConstCaselessString s("XCAP Root"); return s; } const PCaselessString & SIP_Presentity::XcapAuthIdKey() { static const PConstCaselessString s("XCAP Auth ID"); return s; } const PCaselessString & SIP_Presentity::XcapPasswordKey() { static const PConstCaselessString s("XCAP Password"); return s; } const PCaselessString & SIP_Presentity::XcapAuthAuidKey() { static const PConstCaselessString s("XCAP AUID"); return s; } const PCaselessString & SIP_Presentity::XcapAuthFileKey() { static const PConstCaselessString s("XCAP AuthFile"); return s; } const PCaselessString & SIP_Presentity::XcapBuddyListKey() { static const PConstCaselessString s("XCAP BuddyList"); return s; } static struct SIPAttributeInfo { const char * m_name; const char * m_type; } const AttributeInfo[] = { /* 0 */ { SIP_Presentity::PIDFEntityKey(), "URL" }, /* 1 */ { SIP_Presentity::SubProtocolKey(), "Enum\nPeerToPeer,Agent,XCAP,OMA\nAgent" }, /* 2 */ { SIP_Presentity::PresenceAgentKey(), "String" }, /* 3 */ { SIP_Presentity::TransportKey(), "Enum\nUDP,TCP,TLS\nTCP" }, /* 4 */ { OpalPresentity::AuthNameKey(), "String" }, /* 5 */ { OpalPresentity::AuthPasswordKey(), "Password" }, /* 6 */ { SIP_Presentity::XcapRootKey(), "URL" }, /* 7 */ { SIP_Presentity::XcapAuthIdKey(), "String" }, /* 8 */ { SIP_Presentity::XcapPasswordKey(), "Password" }, /* 9 */ { SIP_Presentity::XcapAuthAuidKey(), "String" }, /* 10 */ { SIP_Presentity::XcapAuthFileKey(), "String" }, /* 11 */ { SIP_Presentity::XcapBuddyListKey(), "String" }, /* 12 */ { OpalPresentity::TimeToLiveKey(), "Integer\n1,999999999\n300" } }; OPAL_PRESENTITY_COMMAND(OpalSetLocalPresenceCommand, SIP_Presentity, Internal_SendLocalPresence); OPAL_PRESENTITY_COMMAND(OpalSubscribeToPresenceCommand, SIP_Presentity, Internal_SubscribeToPresence); OPAL_PRESENTITY_COMMAND(SIPWatcherInfoCommand, SIP_Presentity, Internal_SubscribeToWatcherInfo); OPAL_PRESENTITY_COMMAND(OpalAuthorisationRequestCommand, SIP_Presentity, Internal_AuthorisationRequest); static const char * const AuthNames[OpalPresentity::NumAuthorisations] = { "allow", "block", "polite-block", "confirm", "remove" }; static atomic<unsigned> NextRuleId(PRandom::Number()); ////////////////////////////////////////////////////////////////////////////////////// SIP_Presentity::SIP_Presentity() : m_endpoint(NULL) , m_subProtocol(e_OMA) , m_watcherInfoVersion(-1) { m_attributes.Set(SubProtocolKey, "Agent"); } SIP_Presentity::SIP_Presentity(const SIP_Presentity & other) : OpalPresentityWithCommandThread(other) , PValidatedNotifierTarget(other) , m_endpoint(NULL) , m_watcherInfoVersion(-1) { } SIP_Presentity::~SIP_Presentity() { Close(); } PStringArray SIP_Presentity::GetAttributeNames() const { PStringArray names; for (PINDEX i = 0; i < PARRAYSIZE(AttributeInfo); ++i) names += AttributeInfo[i].m_name; return names; } PStringArray SIP_Presentity::GetAttributeTypes() const { PStringArray types; for (PINDEX i = 0; i < PARRAYSIZE(AttributeInfo); ++i) types += AttributeInfo[i].m_type; return types; } bool SIP_Presentity::Open() { if (!OpalPresentityWithCommandThread::Open()) return false; // find the endpoint m_endpoint = m_manager->FindEndPointAs<SIPEndPoint>("sip"); if (m_endpoint == NULL) { PTRACE(1, "SIPPres\tCannot open SIP_Presentity without sip endpoint"); return false; } PCaselessString subProto = m_attributes.Get(SubProtocolKey); if (subProto == "PeerToPeer") m_subProtocol = e_PeerToPeer; else if (subProto == "Agent") m_subProtocol = e_WithAgent; else if (subProto == "XCAP") m_subProtocol = e_XCAP; else if (subProto == "OMA") m_subProtocol = e_OMA; else { PTRACE(1, "SIPPres\tUnknown sub-protocol \"" << subProto << '"'); return false; } if (m_subProtocol == e_PeerToPeer) { m_presenceAgentURL = PString::Empty(); PTRACE(3, "SIPPres\tUsing peer to peer mode for " << m_aor); } else { // find presence server for Presentity as per RFC 3861 // if not found, look for default presence server setting // if none, use hostname portion of domain name PCaselessString presenceAgent = m_attributes.Get(PresenceAgentKey); if (presenceAgent.IsEmpty()) { presenceAgent = m_aor.GetHostPort(); #if OPAL_PTLIB_DNS_RESOLVER if (m_aor.GetScheme() == "pres") { PStringList hosts; bool found = PDNS::LookupSRV(m_aor.GetHostName(), "_pres._sip", hosts) && !hosts.IsEmpty(); PTRACE(2, "SIPPres\tSRV lookup for '_pres._sip." << m_aor.GetHostName() << "' " << (found ? "succeeded" : "failed")); if (found) presenceAgent = hosts.front(); } #endif // OPAL_PTLIB_DNS_RESOLVER } m_presenceAgentURL.Parse(presenceAgent); m_presenceAgentURL.SetParamVar("transport", m_attributes.Get(TransportKey, "tcp").ToLower()); m_defaultRootURL.Parse(m_attributes.Get(XcapRootKey), "http"); if (m_defaultRootURL.IsEmpty()) { presenceAgent.Splice("http://", 0, presenceAgent.NumCompare("sip:") == EqualTo ? 4 : 0); presenceAgent += '/'; m_defaultRootURL.Parse(presenceAgent); m_defaultRootURL.SetPort(0); } PTRACE(3, "SIPPres\tPresentity " << m_aor << " using agent " << m_presenceAgentURL << " and XCAP root " << m_defaultRootURL); } m_watcherSubscriptionAOR.MakeEmpty(); m_watcherInfoVersion = -1; StartThread(); // subscribe to presence watcher infoformation SendCommand(CreateCommand<SIPWatcherInfoCommand>()); return true; } bool SIP_Presentity::Close() { if (!OpalPresentityWithCommandThread::Close()) return false; StopThread(); if (!m_publishedTupleId.IsEmpty()) { SIP_Presentity_OpalSetLocalPresenceCommand cmd; cmd.m_state = OpalPresenceInfo::NoPresence; Internal_SendLocalPresence(cmd); } m_notificationMutex.Wait(); PString watcherSubscriptionAOR = m_watcherSubscriptionAOR; m_watcherSubscriptionAOR.MakeEmpty(); StringMap presenceIdByAor = m_presenceIdByAor; m_watcherAorById.clear(); m_presenceIdByAor.clear(); m_presenceAorById.clear(); m_authorisationIdByAor.clear(); m_notificationMutex.Signal(); if (!watcherSubscriptionAOR.IsEmpty()) { PTRACE(3, "SIPPres\t'" << m_aor << "' sending final unsubscribe for own presence watcher"); m_endpoint->Unsubscribe(SIPSubscribe::Presence | SIPSubscribe::Watcher, watcherSubscriptionAOR, true); } for (StringMap::iterator subs = presenceIdByAor.begin(); subs != presenceIdByAor.end(); ++subs) { PTRACE(3, "SIPPres\t'" << m_aor << "' sending final unsubscribe to " << subs->first); m_endpoint->Unsubscribe(SIPSubscribe::Presence, subs->second, true); } PTRACE(4, "SIPPres\t'" << m_aor << "' awaiting unsubscriptions to complete."); while (m_endpoint->IsSubscribed(SIPSubscribe::Presence | SIPSubscribe::Watcher, watcherSubscriptionAOR, true)) PThread::Sleep(100); for (StringMap::iterator subs = presenceIdByAor.begin(); subs != presenceIdByAor.end(); ++subs) { while (m_endpoint->IsSubscribed(SIPSubscribe::Presence, subs->second, true)) PThread::Sleep(100); } m_endpoint = NULL; PTRACE(3, "SIPPres\t'" << m_aor << "' closed."); return true; } void SIP_Presentity::Internal_SubscribeToPresence(const OpalSubscribeToPresenceCommand & cmd) { if (cmd.m_subscribe) { if (m_presenceIdByAor.find(cmd.m_presentity) != m_presenceIdByAor.end()) { PTRACE(3, "SIPPres\t'" << m_aor << "' already subscribed to presence of '" << cmd.m_presentity << '\''); return; } PTRACE(3, "SIPPres\t'" << m_aor << "' subscribing to presence of '" << cmd.m_presentity << '\''); // subscribe to the presence event on the presence server SIPSubscribe::Params param(SIPSubscribe::Presence); param.m_localAddress = m_aor.AsString(); param.m_addressOfRecord = cmd.m_presentity; param.m_remoteAddress = m_presenceAgentURL; param.m_authID = m_attributes.Get(OpalPresentity::AuthNameKey, m_aor.GetUserName()); param.m_password = m_attributes.Get(OpalPresentity::AuthPasswordKey); param.m_expire = GetExpiryTime(); param.m_contentType = "application/pidf+xml"; param.m_eventList = true; param.m_onSubcribeStatus = PCREATE_NOTIFIER(OnPresenceSubscriptionStatus); param.m_onNotify = PCREATE_NOTIFIER(OnPresenceNotify); PString id; if (m_endpoint->Subscribe(param, id, false)) { m_presenceIdByAor[cmd.m_presentity] = id; m_presenceAorById[id] = cmd.m_presentity; } } else { StringMap::iterator id = m_presenceIdByAor.find(cmd.m_presentity); if (id == m_presenceIdByAor.end()) { PTRACE(3, "SIPPres\t'" << m_aor << "' already unsubscribed to presence of '" << cmd.m_presentity << '\''); return; } PTRACE(3, "SIPPres\t'" << m_aor << "' unsubscribing to presence of '" << cmd.m_presentity << '\''); m_endpoint->Unsubscribe(SIPSubscribe::Presence, id->second); } } void SIP_Presentity::OnPresenceSubscriptionStatus(SIPSubscribeHandler &, const SIPSubscribe::SubscriptionStatus & status) { if (status.m_reason/100 == 1) return; m_notificationMutex.Wait(); PString id = status.m_handler->GetCallID(); StringMap::iterator aor = m_presenceAorById.find(id); if (aor == m_presenceAorById.end()) { PTRACE(2, "SIPPres\t'" << m_aor << "' " << "recieved subscription status for unknown ID " << id); } else { SIPPresenceInfo info(status.m_reason, status.m_wasSubscribing); SetPIDFEntity(info.m_entity); info.m_target = aor->second; OnPresenceChange(info); if (!status.m_wasSubscribing) { m_presenceIdByAor.erase(aor->second); m_presenceAorById.erase(aor); } } m_notificationMutex.Signal(); } void SIP_Presentity::OnPresenceNotify(SIPSubscribeHandler &, SIPSubscribe::NotifyCallbackInfo & notifyInfo) { list<SIPPresenceInfo> infoList; if (!SIPPresenceInfo::ParseNotify(notifyInfo, infoList)) return; // send 200 OK now, and flag caller NOT to send the response notifyInfo.SendResponse(); m_notificationMutex.Wait(); for (list<SIPPresenceInfo>::iterator it = infoList.begin(); it != infoList.end(); ++it) { SetPIDFEntity(it->m_target); PTRACE(3, "SIPPres\t'" << m_aor << "' request for presence of '" << it->m_entity << "' is " << it->m_state); OnPresenceChange(*it); } m_notificationMutex.Signal(); } unsigned SIP_Presentity::GetExpiryTime() const { int ttl = m_attributes.Get(OpalPresentity::TimeToLiveKey, "300").AsInteger(); return ttl > 0 ? ttl : 300; } void SIP_Presentity::Internal_SubscribeToWatcherInfo(const SIPWatcherInfoCommand & cmd) { if (m_subProtocol == e_PeerToPeer) { PTRACE(3, "SIPPres\tRequires agent to do watcher, aor=" << m_aor); return; } if (cmd.m_unsubscribe) { if (m_watcherSubscriptionAOR.IsEmpty()) { PTRACE(3, "SIPPres\tAlredy unsubscribed presence watcher for " << m_aor); return; } PTRACE(3, "SIPPres\t'" << m_aor << "' sending unsubscribe for own presence watcher"); m_endpoint->Unsubscribe(SIPSubscribe::Presence | SIPSubscribe::Watcher, m_watcherSubscriptionAOR); return; } PString aorStr = m_aor.AsString(); PTRACE(3, "SIPPres\t'" << aorStr << "' sending subscribe for own presence.watcherinfo"); // subscribe to the presence.winfo event on the presence server SIPSubscribe::Params param(SIPSubscribe::Presence | SIPSubscribe::Watcher); param.m_contentType = "application/watcherinfo+xml"; param.m_localAddress = aorStr; param.m_addressOfRecord = aorStr; param.m_remoteAddress = m_presenceAgentURL; param.m_authID = m_attributes.Get(OpalPresentity::AuthNameKey, m_aor.GetUserName()); param.m_password = m_attributes.Get(OpalPresentity::AuthPasswordKey); param.m_expire = GetExpiryTime(); param.m_onSubcribeStatus = PCREATE_NOTIFIER(OnWatcherInfoSubscriptionStatus); param.m_onNotify = PCREATE_NOTIFIER(OnWatcherInfoNotify); m_endpoint->Subscribe(param, m_watcherSubscriptionAOR); } void SIP_Presentity::SetPIDFEntity(PURL & entity) { if (entity.Parse(m_attributes.Get(SIP_Presentity::PIDFEntityKey), "pres")) { PTRACE(4, "SIPPres\tPIDF entity set via attribute to " << entity); return; } if (m_aor.GetScheme() == "pres") { entity = m_aor; PTRACE(4, "SIPPres\tPIDF entity set via AOR to " << entity); } if (entity.Parse(m_aor.GetUserName() + '@' + m_aor.GetHostName(), "pres")) { PTRACE(4, "SIPPres\tPIDF entity derived from AOR as " << entity); return; } entity = m_aor; PTRACE(4, "SIPPres\tPIDF entity set via failsafe AOR of " << entity); } void SIP_Presentity::OnWatcherInfoSubscriptionStatus(SIPSubscribeHandler &, const SIPSubscribe::SubscriptionStatus & status) { if (status.m_reason/100 == 1) return; SIPPresenceInfo info(status.m_reason, status.m_wasSubscribing); SetPIDFEntity(info.m_entity); info.m_target = info.m_entity; m_notificationMutex.Wait(); OnPresenceChange(info); if (!status.m_wasSubscribing) m_watcherSubscriptionAOR.MakeEmpty(); m_notificationMutex.Signal(); } void SIP_Presentity::OnWatcherInfoNotify(SIPSubscribeHandler &, SIPSubscribe::NotifyCallbackInfo & notifyInfo) { static PXML::ValidationInfo const WatcherValidation[] = { { PXML::RequiredNonEmptyAttribute, "id" }, { PXML::RequiredAttributeWithValue, "status", { "pending\nactive\nwaiting\nterminated" } }, { PXML::RequiredAttributeWithValue, "event", { "subscribe\napproved\ndeactivated\nprobation\nrejected\ntimeout\ngiveup" } }, { PXML::EndOfValidationList } }; static PXML::ValidationInfo const WatcherListValidation[] = { { PXML::RequiredNonEmptyAttribute, "resource" }, { PXML::RequiredAttributeWithValue, "package", { "presence" } }, { PXML::Subtree, "watcher", { WatcherValidation } , 0 }, { PXML::EndOfValidationList } }; static PXML::ValidationInfo const WatcherInfoValidation[] = { { PXML::SetDefaultNamespace, "urn:ietf:params:xml:ns:watcherinfo" }, { PXML::ElementName, "watcherinfo", }, { PXML::RequiredNonEmptyAttribute, "version"}, { PXML::RequiredAttributeWithValue, "state", { "full\npartial" } }, { PXML::Subtree, "watcher-list", { WatcherListValidation }, 0 }, { PXML::EndOfValidationList } }; PXML xml; if (!notifyInfo.LoadAndValidate(xml, WatcherInfoValidation)) return; // send 200 OK now, and flag caller NOT to send the response notifyInfo.SendResponse(); PXMLElement * rootElement = xml.GetRootElement(); int version = rootElement->GetAttribute("version").AsUnsigned(); PWaitAndSignal mutex(m_notificationMutex); // check version number if (m_watcherInfoVersion >= 0 && version <= m_watcherInfoVersion) { PTRACE(3, "SIPPres\t'" << m_aor << "' received repeated NOTIFY for own presence.watcherinfo, already processed"); return; } // if this is a full list of watcher info, we can empty out our pending lists if (rootElement->GetAttribute("state") *= "full") { PTRACE(3, "SIPPres\t'" << m_aor << "' received full watcher list for own presence.watcherinfo"); m_watcherAorById.clear(); } else if (m_watcherInfoVersion < 0) { PTRACE(2, "SIPPres\t'" << m_aor << "' received partial watcher list for own presence.watcherinfo, but awaiting full list"); return; } else if (version != m_watcherInfoVersion+1) { PTRACE(2, "SIPPres\t'" << m_aor << "' received partial watcher list for own presence.watcherinfo, but have missing sequence number, resubscribing"); m_watcherInfoVersion = -1; SendCommand(CreateCommand<SIPWatcherInfoCommand>()); return; } else { PTRACE(3, "SIPPres\t'" << m_aor << "' received partial watcher list for own presence.watcherinfo"); } m_watcherInfoVersion = version; // go through list of watcher information PINDEX watcherListIndex = 0; PXMLElement * watcherList; while ((watcherList = rootElement->GetElement("watcher-list", watcherListIndex++)) != NULL) { PINDEX watcherIndex = 0; PXMLElement * watcher; while ((watcher = watcherList->GetElement("watcher", watcherIndex++)) != NULL) OnReceivedWatcherStatus(watcher); } } void SIP_Presentity::OnReceivedWatcherStatus(PXMLElement * watcher) { PString id = watcher->GetAttribute("id"); PString status = watcher->GetAttribute("status"); AuthorisationRequest authreq; authreq.m_presentity = watcher->GetData().Trim(); StringMap::iterator existingAOR = m_watcherAorById.find(id); // save pending subscription status from this user if (status == "pending") { if (existingAOR != m_watcherAorById.end()) { PTRACE(3, "SIPPres\t'" << m_aor << "' received followup to request from '" << authreq.m_presentity << "' for access to presence information"); } else { m_watcherAorById[id] = authreq.m_presentity; PTRACE(3, "SIPPres\t'" << authreq.m_presentity << "' has requested access to presence information of '" << m_aor << '\''); OnAuthorisationRequest(authreq); } } else { PTRACE(3, "SIPPres\t'" << m_aor << "' has received event '" << watcher->GetAttribute("event") << "', status '" << status << "', for '" << authreq.m_presentity << '\''); } } static atomic<uint32_t> g_idNumber; void SIP_Presentity::Internal_SendLocalPresence(const OpalSetLocalPresenceCommand & cmd) { PTRACE(3, "SIPPres\t'" << m_aor << "' sending own presence " << cmd.m_state << "/" << cmd.m_note); SIPPresenceInfo sipPresence(cmd); sipPresence.m_personId = PString(++g_idNumber); SetPIDFEntity(sipPresence.m_entity); sipPresence.m_contact = m_aor; // As required by OMA-TS-Presence_SIMPLE-V2_0-20090917-C sipPresence.m_presenceAgent = m_presenceAgentURL.AsString(); if (!sipPresence.m_service.IsEmpty()) m_publishedTupleId = sipPresence.m_service; else { if (m_publishedTupleId.IsEmpty()) m_publishedTupleId = PGloballyUniqueID().AsString(); sipPresence.m_service = m_publishedTupleId; } if (m_subProtocol != e_PeerToPeer) m_endpoint->PublishPresence(sipPresence, m_open ? GetExpiryTime() : 0); else m_endpoint->Notify(m_aor, SIPSubscribe::Presence, sipPresence.AsXML()); } bool SIP_Presentity::ChangeAuthNode(XCAPClient & xcap, const OpalAuthorisationRequestCommand & cmd) { PString ruleId = m_authorisationIdByAor[cmd.m_presentity]; XCAPClient::NodeSelector node; node.SetNamespace("urn:ietf:params:xml:ns:pres-rules", "pr"); node.SetNamespace("urn:ietf:params:xml:ns:common-policy", "cr"); node.AddElement("cr:ruleset"); node.AddElement("cr:rule", "id", ruleId); xcap.SetNode(node); if (cmd.m_authorisation == AuthorisationRemove) { if (xcap.DeleteXml()) { PTRACE(3, "SIPPres\tRule id=" << ruleId << " removed for '" << cmd.m_presentity << "' at '" << m_aor << '\''); } else { PTRACE(3, "SIPPres\tCould not remove rule id=" << ruleId << " for '" << cmd.m_presentity << "' at '" << m_aor << "\'\n" << xcap.GetLastResponseCode() << ' ' << xcap.GetLastResponseInfo()); } return true; } PXML xml; if (!xcap.GetXml(xml)) { PTRACE(3, "SIPPres\tCould not locate existing rule id=" << ruleId << " for '" << cmd.m_presentity << "' at '" << m_aor << '\''); return false; } PXMLElement * root, * actions, * subHandling = NULL; if ((root = xml.GetRootElement()) == NULL || (actions = root->GetElement("cr:actions")) == NULL || (subHandling = actions->GetElement("pr:sub-handling")) == NULL) { PTRACE(2, "SIPPres\tInvalid XML in existing rule id=" << ruleId << " for '" << cmd.m_presentity << "' at '" << m_aor << '\''); return false; } if (subHandling->GetData() *= AuthNames[cmd.m_authorisation]) { PTRACE(3, "SIPPres\tRule id=" << ruleId << " already set to " << AuthNames[cmd.m_authorisation] << " for '" << cmd.m_presentity << "' at '" << m_aor << '\''); return true; } // Adjust the authorisation subHandling->SetData(AuthNames[cmd.m_authorisation]); if (xcap.PutXml(xml)) { PTRACE(3, "SIPPres\tRule id=" << ruleId << " changed to" << AuthNames[cmd.m_authorisation] << " for '" << cmd.m_presentity << "' at '" << m_aor << '\''); return true; } PTRACE(3, "SIPPres\tCould not change existing rule id=" << ruleId << " for '" << cmd.m_presentity << "' at '" << m_aor << "\'\n" << xcap.GetLastResponseCode() << ' ' << xcap.GetLastResponseInfo()); return false; } void SIP_Presentity::Internal_AuthorisationRequest(const OpalAuthorisationRequestCommand & cmd) { if (m_subProtocol < e_XCAP) { PTRACE(4, "SIPPres\tRequires XCAP to do authorisation, aor=" << m_aor); return; } XCAPClient xcap; xcap.SetRoot(m_defaultRootURL); xcap.SetApplicationUniqueID(m_attributes.Get(XcapAuthAuidKey, m_subProtocol == e_OMA ? "org.openmobilealliance.pres-rules" : "pres-rules")); // As per RFC5025/9.1 xcap.SetContentType("application/auth-policy+xml"); // As per RFC5025/9.4 xcap.SetUserIdentifier(m_aor.AsString()); // As per RFC5025/9.7 xcap.SetAuthenticationInfo(m_attributes.Get(XcapAuthIdKey, m_attributes.Get(AuthNameKey, xcap.GetUserIdentifier())), m_attributes.Get(XcapPasswordKey, m_attributes.Get(AuthPasswordKey))); xcap.SetFilename(m_attributes.Get(XcapAuthFileKey, m_subProtocol == e_OMA ? "pres-rules" : "index")); // See if we can use teh quick method if (m_authorisationIdByAor.find(cmd.m_presentity) != m_authorisationIdByAor.end()) { if (ChangeAuthNode(xcap, cmd)) return; } PXML xml; PXMLElement * element; // Could not find rule element quickly, get the whole document if (!xcap.GetXml(xml)) { if (xcap.GetLastResponseCode() != PHTTP::NotFound) { PTRACE(2, "SIPPres\tUnexpected error getting rule file for '" << cmd.m_presentity << "' at '" << m_aor << "\'\n" << xcap.GetLastResponseCode() << ' ' << xcap.GetLastResponseInfo()); return; } // No whole document, create a fresh one xml.SetOptions(PXML::NoOptions); element = xml.SetRootElement("cr:ruleset"); element->SetAttribute("xmlns:pr", "urn:ietf:params:xml:ns:pres-rules"); element->SetAttribute("xmlns:cr", "urn:ietf:params:xml:ns:common-policy"); element = element->AddElement("rule", "id", "presence_allow_own"); element->AddElement("cr:conditions")->AddElement("cr:identity")->AddElement("cr:one")->SetAttribute("id", m_aor.AsString()); element->AddElement("cr:actions")->AddElement("pr:sub-handling", AuthNames[AuthorisationPermitted]); element = element->AddElement("cr:transformations"); element->AddElement("pr:provide-services")->AddElement("pr:all-services"); element->AddElement("pr:provide-persons")->AddElement("pr:all-persons"); element->AddElement("pr:provide-all-attributes"); if (m_subProtocol == e_OMA) { PXMLElement * root = xml.GetRootElement(); root->SetAttribute("xmlns:ocp", "urn:oma:xml:xdm:common-policy"); element = root->AddElement("cr:rule", "id", "wp_prs_block_anonymous"); element->AddElement("cr:conditions")->AddElement("ocp:anonymous-request"); element->AddElement("cr:actions")->AddElement("pr:sub-handling", AuthNames[AuthorisationDenied]); element = root->AddElement("cr:rule", "id", "wp_prs_unlisted"); element->AddElement("cr:conditions")->AddElement("ocp:other-identity"); element->AddElement("cr:actions")->AddElement("pr:sub-handling", AuthNames[AuthorisationConfirming]); // Use an xcap object to calculate horrible URL XCAPClient xcap; InitBuddyXcap(xcap, PString::Empty(), "oma_grantedcontacts"); element = root->AddElement("cr:rule", "id", "wp_prs_grantedcontacts"); element->AddElement("cr:conditions")->AddElement("ocp:external-list")->AddElement("ocp:entry", "anc", xcap.BuildURL().AsString()); element->AddElement("cr:actions")->AddElement("pr:sub-handling", AuthNames[AuthorisationPermitted]); element = element->AddElement("cr:transformations"); element->AddElement("pr:provide-services")->AddElement("pr:all-services"); element->AddElement("pr:provide-persons")->AddElement("pr:all-persons"); element->AddElement("pr:provide-all-attributes"); InitBuddyXcap(xcap, PString::Empty(), "oma_blockedcontacts"); element = root->AddElement("cr:rule", "id", "wp_prs_blockedcontacts"); element->AddElement("cr:conditions")->AddElement("ocp:external-list")->AddElement("ocp:entry", "anc", xcap.BuildURL().AsString()); element->AddElement("cr:actions")->AddElement("pr:sub-handling", AuthNames[AuthorisationDenied]); } if (!xcap.PutXml(xml)) { PTRACE(2, "SIPPres\tCould not add new rule file for '" << m_aor << "\'\n" << xcap.GetLastResponseCode() << ' ' << xcap.GetLastResponseInfo()); return; } PTRACE(3, "SIPPres\tNew rule file created for '" << m_aor << '\''); } // Extract all the rules from it m_authorisationIdByAor.clear(); bool existingRuleForWatcher = false; PINDEX ruleIndex = 0; while ((element = xml.GetElement("cr:rule", ruleIndex++)) != NULL) { PString ruleId = element->GetAttribute("id"); if ((element = element->GetElement("cr:conditions")) != NULL && (element = element->GetElement("cr:identity")) != NULL && (element = element->GetElement("cr:one")) != NULL) { PString watcher = element->GetAttribute("id"); m_authorisationIdByAor[watcher] = ruleId; PTRACE(4, "SIPPres\tGetting rule id=" << ruleId << " for '" << watcher << "' at '" << m_aor << '\''); if (watcher == cmd.m_presentity) existingRuleForWatcher = true; } } if (existingRuleForWatcher) { ChangeAuthNode(xcap, cmd); return; } // Create new rule with id as per http://www.w3.org/TR/1999/REC-xml-names-19990114/#NT-NCName PString newRuleId(PString::Printf, "wp_prs%s_one_%lu", cmd.m_authorisation == AuthorisationPermitted ? "_allow" : "", ++NextRuleId); xml.SetOptions(PXML::FragmentOnly); element = xml.SetRootElement("cr:rule"); element->SetAttribute("xmlns:pr", "urn:ietf:params:xml:ns:pres-rules"); element->SetAttribute("xmlns:cr", "urn:ietf:params:xml:ns:common-policy"); element->SetAttribute("id", newRuleId); element->AddElement("cr:conditions")->AddElement("cr:identity")->AddElement("cr:one")->SetAttribute("id", cmd.m_presentity); element->AddElement("cr:actions")->AddElement("pr:sub-handling")->SetData(AuthNames[cmd.m_authorisation]); element = element->AddElement("cr:transformations"); element->AddElement("pr:provide-services")->AddElement("pr:all-services"); element->AddElement("pr:provide-persons")->AddElement("pr:all-persons"); element->AddElement("pr:provide-all-attributes"); XCAPClient::NodeSelector node; node.SetNamespace("urn:ietf:params:xml:ns:pres-rules", "pr"); node.SetNamespace("urn:ietf:params:xml:ns:common-policy", "cr"); node.AddElement("cr:ruleset"); node.AddElement("cr:rule", "id", newRuleId); xcap.SetNode(node); if (xcap.PutXml(xml)) { PTRACE(3, "SIPPres\tNew rule set to" << AuthNames[cmd.m_authorisation] << " for '" << cmd.m_presentity << "' at '" << m_aor << '\''); m_authorisationIdByAor[cmd.m_presentity] = newRuleId; return; } PTRACE(2, "SIPPres\tCould not add new rule for '" << cmd.m_presentity << "' at '" << m_aor << "\'\n" << xcap.GetLastResponseCode() << ' ' << xcap.GetLastResponseInfo()); } void SIP_Presentity::InitBuddyXcap(XCAPClient & xcap, const PString & entryName, const PString & listName) { xcap.SetRoot(m_defaultRootURL); xcap.SetApplicationUniqueID("resource-lists"); // As per RFC5025/9.1 xcap.SetContentType("application/resource-lists+xml"); // As per RFC5025/9.4 xcap.SetUserIdentifier(m_aor.AsString()); // As per RFC5025/9.7 xcap.SetAuthenticationInfo(m_attributes.Get(XcapAuthIdKey, m_attributes.Get(OpalPresentity::AuthNameKey, xcap.GetUserIdentifier())), m_attributes.Get(XcapPasswordKey, m_attributes.Get(AuthPasswordKey))); xcap.SetFilename("index"); XCAPClient::NodeSelector node; node.SetNamespace("urn:ietf:params:xml:ns:resource-lists"); node.AddElement("resource-lists"); node.AddElement("list", "name", listName.IsEmpty() ? m_attributes.Get(XcapBuddyListKey, m_subProtocol == e_OMA ? "oma_buddylist" : "buddylist") : listName); if (!entryName.IsEmpty()) node.AddElement("entry", "uri", entryName); xcap.SetNode(node); } static void BuddyInfoToXML(const OpalPresentity::BuddyInfo & buddy, PXMLElement * parent) { PXMLElement * element = parent->GetName() == "entry" ? parent : parent->AddElement("entry"); element->SetAttribute("uri", buddy.m_presentity); if (!buddy.m_displayName.IsEmpty()) element->AddElement("display-name", buddy.m_displayName); } static bool XMLToBuddyInfo(const PXMLElement * element, OpalPresentity::BuddyInfo & buddy) { if (element == NULL || element->GetName() != "entry") return false; buddy.m_presentity = element->GetAttribute("uri"); PXMLElement * itemElement; if ((itemElement= element->GetElement("urn:ietf:params:xml:ns:pidf:cipid:display-name")) != NULL) buddy.m_displayName = itemElement->GetData(); #if P_VCARD if ((itemElement= element->GetElement("urn:ietf:params:xml:ns:pidf:cipid:card")) != NULL) { PURL url; if (url.Parse(itemElement->GetData())) { PString str; if (url.LoadResource(str)) buddy.m_vCard.Parse(str); } } #endif // P_VCARD if ((itemElement= element->GetElement("urn:ietf:params:xml:ns:pidf:cipid:icon")) != NULL) buddy.m_icon = itemElement->GetData(); if ((itemElement= element->GetElement("urn:ietf:params:xml:ns:pidf:cipid:map")) != NULL) buddy.m_map = itemElement->GetData(); if ((itemElement= element->GetElement("urn:ietf:params:xml:ns:pidf:cipid:sound")) != NULL) buddy.m_sound = itemElement->GetData(); if ((itemElement= element->GetElement("urn:ietf:params:xml:ns:pidf:cipid:homepage")) != NULL) buddy.m_homePage = itemElement->GetData(); buddy.m_contentType = "application/resource-lists+xml"; buddy.m_rawXML = element->AsString(); return true; } static bool RecursiveGetBuddyList(OpalPresentity::BuddyList & buddies, XCAPClient & xcap, const PURL & url) { if (url.IsEmpty()) return false; PXML xml; if (!xcap.GetXml(url, xml)) return false; PXMLElement * element; PINDEX idx = 0; while ((element = xml.GetElement("entry", idx++)) != NULL) { OpalPresentity::BuddyInfo buddy; if (XMLToBuddyInfo(element, buddy)) buddies.push_back(buddy); } idx = 0; while ((element = xml.GetElement("external", idx++)) != NULL) RecursiveGetBuddyList(buddies, xcap, element->GetAttribute("anchor")); idx = 0; while ((element = xml.GetElement("entry-ref", idx++)) != NULL) { PURL url(xcap.GetRoot()); url.SetPathStr(url.GetPathStr() + element->GetAttribute("ref")); RecursiveGetBuddyList(buddies, xcap, url); } return true; } OpalPresentity::BuddyStatus SIP_Presentity::GetBuddyListEx(BuddyList & buddies) { if (m_subProtocol < e_XCAP) { PTRACE(4, "SIPPres\tRequires XCAP to have buddies, aor=" << m_aor); return BuddyStatus_ListFeatureNotImplemented; } XCAPClient xcap; InitBuddyXcap(xcap); if (RecursiveGetBuddyList(buddies, xcap, xcap.BuildURL()) || !buddies.empty() || xcap.GetLastResponseCode() == PHTTP::NotFound) return BuddyStatus_OK; return BuddyStatus_GenericFailure; } OpalPresentity::BuddyStatus SIP_Presentity::SetBuddyListEx(const BuddyList & buddies) { if (m_subProtocol < e_XCAP) { PTRACE(4, "SIPPres\tRequires XCAP to have buddies, aor=" << m_aor); return BuddyStatus_ListFeatureNotImplemented; } PXML xml(PXML::FragmentOnly); PString buddyListKey = m_subProtocol == e_OMA ? "oma_buddylist" : "buddylist"; PXMLElement * root = xml.SetRootElement("list"); root->SetAttribute("xmlns", "urn:ietf:params:xml:ns:resource-lists"); root->SetAttribute("name", m_attributes.Get(XcapBuddyListKey, buddyListKey)); for (BuddyList::const_iterator it = buddies.begin(); it != buddies.end(); ++it) BuddyInfoToXML(*it, root); XCAPClient xcap; InitBuddyXcap(xcap); if (xcap.PutXml(xml)) return BuddyStatus_OK; if (xcap.GetLastResponseCode() == PHTTP::Conflict && xcap.GetLastResponseInfo().Find("Parent") != P_MAX_INDEX) { // Got "Parent does not exist" error, so need to add whole file xml.SetOptions(PXML::NoOptions); root = xml.SetRootElement("resource-lists"); root->SetAttribute("xmlns", "urn:ietf:params:xml:ns:resource-lists"); PXMLElement * listElement = root->AddElement("list", "name", m_attributes.Get(XcapBuddyListKey, buddyListKey)); for (BuddyList::const_iterator it = buddies.begin(); it != buddies.end(); ++it) BuddyInfoToXML(*it, listElement); xcap.ClearNode(); if (xcap.PutXml(xml)) return BuddyStatus_OK; } PTRACE(2, "SIPPres\tError setting buddy list of '" << m_aor << "\'\n" << xcap.GetLastResponseCode() << ' ' << xcap.GetLastResponseInfo()); return BuddyStatus_GenericFailure; } OpalPresentity::BuddyStatus SIP_Presentity::DeleteBuddyListEx() { if (m_subProtocol < e_XCAP) { PTRACE(4, "SIPPres\tRequires XCAP to have buddies, aor=" << m_aor); return BuddyStatus_ListFeatureNotImplemented; } XCAPClient xcap; InitBuddyXcap(xcap); if (xcap.DeleteXml()) return BuddyStatus_OK; PTRACE(2, "SIPPres\tError deleting buddy list of '" << m_aor << "\'\n" << xcap.GetLastResponseCode() << ' ' << xcap.GetLastResponseInfo()); return BuddyStatus_GenericFailure; } OpalPresentity::BuddyStatus SIP_Presentity::GetBuddyEx(BuddyInfo & buddy) { if (m_subProtocol < e_XCAP) { PTRACE(4, "SIPPres\tRequires XCAP to have buddies, aor=" << m_aor); return BuddyStatus_ListFeatureNotImplemented; } XCAPClient xcap; InitBuddyXcap(xcap, buddy.m_presentity); PXML xml; if (xcap.GetXml(xml) && XMLToBuddyInfo(xml.GetRootElement(), buddy)) return BuddyStatus_OK; else return BuddyStatus_GenericFailure; } OpalPresentity::BuddyStatus SIP_Presentity::SetBuddyEx(const BuddyInfo & buddy) { if (m_subProtocol < e_XCAP) { PTRACE(4, "SIPPres\tRequires XCAP to have buddies, aor=" << m_aor); return BuddyStatus_ListFeatureNotImplemented; } if (buddy.m_presentity.IsEmpty()) return BuddyStatus_GenericFailure; XCAPClient xcap; InitBuddyXcap(xcap, buddy.m_presentity); PXML xml(PXML::FragmentOnly); BuddyInfoToXML(buddy, xml.SetRootElement("entry")); if (xcap.PutXml(xml)) return BuddyStatus_OK; if (xcap.GetLastResponseCode() != PHTTP::Conflict || xcap.GetLastResponseInfo().Find("Parent") == P_MAX_INDEX) { PTRACE(2, "SIPPres\tError setting buddy '" << buddy.m_presentity << "' of '" << m_aor << "\'\n" << xcap.GetLastResponseCode() << ' ' << xcap.GetLastResponseInfo()); return BuddyStatus_GenericFailure; } // Got "Parent does not exist" error, so need to add whole list BuddyList buddies; buddies.push_back(buddy); return SetBuddyListEx(buddies); } OpalPresentity::BuddyStatus SIP_Presentity::DeleteBuddyEx(const PURL & presentity) { if (m_subProtocol < e_XCAP) { PTRACE(4, "SIPPres\tRequires XCAP to have buddies, aor=" << m_aor); return BuddyStatus_ListFeatureNotImplemented; } XCAPClient xcap; InitBuddyXcap(xcap, presentity); if (xcap.DeleteXml()) return BuddyStatus_OK; PTRACE(2, "SIPPres\tError deleting buddy '" << presentity << "' of '" << m_aor << "\'\n" << xcap.GetLastResponseCode() << ' ' << xcap.GetLastResponseInfo()); return BuddyStatus_GenericFailure; } OpalPresentity::BuddyStatus SIP_Presentity::SubscribeBuddyListEx(PINDEX & numSuccessful, bool subscribe) { if (m_subProtocol < e_XCAP) { PTRACE(4, "SIPPres\tRequires XCAP to have buddies, aor=" << m_aor); return BuddyStatus_ListFeatureNotImplemented; } PXML xml; XCAPClient xcap; xcap.SetRoot(m_defaultRootURL); xcap.SetApplicationUniqueID("rls-services"); xcap.SetContentType("application/rls-services+xml"); xcap.SetUserIdentifier(m_aor.AsString()); xcap.SetAuthenticationInfo(m_attributes.Get(XcapAuthIdKey, m_attributes.Get(AuthNameKey, xcap.GetUserIdentifier())), m_attributes.Get(XcapPasswordKey, m_attributes.Get(AuthPasswordKey))); xcap.SetFilename("index"); PString serviceURI = xcap.GetUserIdentifier() + ";pres-list=oma_buddylist"; if (!xcap.GetXml(xml)) { if (xcap.GetLastResponseCode() != PHTTP::NotFound) { PTRACE(2, "SIPPres\tUnexpected error getting rls-services file for at '" << m_aor << "\'\n" << xcap.GetLastResponseCode() << ' ' << xcap.GetLastResponseInfo()); return OpalPresentity::SubscribeBuddyListEx(numSuccessful, subscribe); // Do individual subscribes } // No file at all, add the root element. xml.SetRootElement("rls-services")->SetAttribute("xmlns", "urn:ietf:params:xml:ns:rls-services"); } else { // Have file, see if have specific service PXMLElement * element = xml.GetElement("service", "uri", serviceURI); if (element != NULL) { PTRACE(4, "SIPPres\tConfirmed rls-services entry for '" << serviceURI << "\' is\n" << xml); numSuccessful = P_MAX_INDEX; return SubscribeToPresence(serviceURI, subscribe) ? BuddyStatus_OK : BuddyStatus_GenericFailure; } // Nope, so add it } // Added service to existing XML or newly rooted one PXMLElement * element = xml.GetRootElement()->AddElement("service"); element->SetAttribute("uri", serviceURI); // Calculate the horrible URL using a temporary XCAP client XCAPClient xcapTemp; InitBuddyXcap(xcapTemp); element->AddElement("resource-list")->SetData(xcapTemp.BuildURL().AsString()); element->AddElement("packages")->AddElement("package")->SetData("presence"); if (xcap.PutXml(xml)) { numSuccessful = P_MAX_INDEX; return SubscribeToPresence(serviceURI, subscribe) ? BuddyStatus_OK : BuddyStatus_GenericFailure; } PTRACE(2, "SIPPres\tCould not add new rls-services entry for '" << m_aor << "\'\n" << xcap.GetLastResponseCode() << ' ' << xcap.GetLastResponseInfo()); return OpalPresentity::SubscribeBuddyListEx(numSuccessful, subscribe); // Do individual subscribes } ////////////////////////////////////////////////////////////// XCAPClient::XCAPClient() : m_global(false) , m_filename("index") { } PURL XCAPClient::BuildURL() { PURL uri(m_root); // XCAP root uri.AppendPath(m_auid); // Application Unique ID uri.AppendPath(m_global ? "global" : "users"); // RFC4825/6.2, The path segment after the AUID MUST either be "global" or "users". if (!m_global) uri.AppendPath(m_xui); // XCAP User Identifier if (!m_filename.IsEmpty()) { uri.AppendPath(m_filename); // Final resource name m_node.AddToURL(uri); } return uri; } static bool HasNode(const PURL & url) { const PStringArray & path = url.GetPath(); for (PINDEX i = 0; i < path.GetSize(); ++i) { if (path[i] == "~~") return true; } return false; } bool XCAPClient::GetXml(const PURL & url, PXML & xml) { bool hasNode = HasNode(url); PString body; if (!GetTextDocument(url, body, hasNode ? "application/xcap-el+xml" : m_contentType)) { PTRACE(3, "SIPPres\tError getting buddy list at '" << url << "\'\n" << GetLastResponseCode() << ' ' << GetLastResponseInfo()); return false; } if (xml.Load(body, hasNode ? PXML::FragmentOnly : PXML::NoOptions)) return true; PTRACE(2, "XCAP\tError parsing XML for '" << url << "\'\n" "Line " << xml.GetErrorLine() << ", Column " << xml.GetErrorColumn() << ": " << xml.GetErrorString()); return false; } bool XCAPClient::PutXml(const PURL & url, const PXML & xml) { PStringStream strm; strm << xml; return PutTextDocument(url, strm, HasNode(url) ? "application/xcap-el+xml" : m_contentType); } PString XCAPClient::ElementSelector::AsString() const { PStringStream strm; strm << m_name; if (!m_position.IsEmpty()) strm << '[' << m_position << ']'; if (!m_attribute.IsEmpty()) strm << "[@" << m_attribute << "=\"" << m_value << "\"]"; return strm; } void XCAPClient::NodeSelector::AddToURL(PURL & uri) const { if (empty()) return; uri.AppendPath("~~"); // Node selector for (const_iterator it = begin(); it != end(); ++it) uri.AppendPath(it->AsString()); if (m_namespaces.empty()) return; PStringStream query; for (std::map<PString, PString>::const_iterator it = m_namespaces.begin(); it != m_namespaces.end(); ++it) { query << "xmlns("; if (!it->first.IsEmpty()) query << it->first << '='; query << it->second << ')'; } // Non-standard format query parameter, we fake that by having one // dictionary element at key value empty string uri.SetQueryVar(PString::Empty(), query); } ////////////////////////////////////////////////////////////// #endif // OPAL_SIP_PRESENCE
35.699838
152
0.679705
[ "object" ]
d48de53c3509005dd3cd920a4ff40cece438cc47
6,002
cpp
C++
mozilla/gfx/2d/ExtendInputEffectD2D1.cpp
naver/webgraphics
4f9b9aa6a13428b5872dd020eaf34ec77b33f240
[ "MS-PL" ]
5
2016-12-20T15:48:05.000Z
2020-05-01T20:12:09.000Z
mozilla/gfx/2d/ExtendInputEffectD2D1.cpp
naver/webgraphics
4f9b9aa6a13428b5872dd020eaf34ec77b33f240
[ "MS-PL" ]
null
null
null
mozilla/gfx/2d/ExtendInputEffectD2D1.cpp
naver/webgraphics
4f9b9aa6a13428b5872dd020eaf34ec77b33f240
[ "MS-PL" ]
2
2016-12-20T15:48:13.000Z
2019-12-10T15:15:05.000Z
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*- * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "ExtendInputEffectD2D1.h" #include "Logging.h" #include "ShadersD2D1.h" #include "HelpersD2D.h" #include <vector> #define TEXTW(x) L##x #define XML(X) TEXTW(#X) // This macro creates a single string from multiple lines of text. static const PCWSTR kXmlDescription = XML( <?xml version='1.0'?> <Effect> <!-- System Properties --> <Property name='DisplayName' type='string' value='ExtendInputEffect'/> <Property name='Author' type='string' value='Mozilla'/> <Property name='Category' type='string' value='Utility Effects'/> <Property name='Description' type='string' value='This effect is used to extend the output rect of any input effect to a specified rect.'/> <Inputs> <Input name='InputEffect'/> </Inputs> <Property name='OutputRect' type='vector4'> <Property name='DisplayName' type='string' value='Output Rect'/> </Property> </Effect> ); namespace mozilla { namespace gfx { ExtendInputEffectD2D1::ExtendInputEffectD2D1() : mRefCount(0) , mOutputRect(D2D1::Vector4F(-FLT_MAX, -FLT_MAX, FLT_MAX, FLT_MAX)) { } IFACEMETHODIMP ExtendInputEffectD2D1::Initialize(ID2D1EffectContext* pContextInternal, ID2D1TransformGraph* pTransformGraph) { HRESULT hr; hr = pTransformGraph->SetSingleTransformNode(this); if (FAILED(hr)) { return hr; } return S_OK; } IFACEMETHODIMP ExtendInputEffectD2D1::PrepareForRender(D2D1_CHANGE_TYPE changeType) { return S_OK; } IFACEMETHODIMP ExtendInputEffectD2D1::SetGraph(ID2D1TransformGraph* pGraph) { return E_NOTIMPL; } IFACEMETHODIMP_(ULONG) ExtendInputEffectD2D1::AddRef() { return ++mRefCount; } IFACEMETHODIMP_(ULONG) ExtendInputEffectD2D1::Release() { if (!--mRefCount) { delete this; return 0; } return mRefCount; } IFACEMETHODIMP ExtendInputEffectD2D1::QueryInterface(const IID &aIID, void **aPtr) { if (!aPtr) { return E_POINTER; } if (aIID == IID_IUnknown) { *aPtr = static_cast<IUnknown*>(static_cast<ID2D1EffectImpl*>(this)); } else if (aIID == IID_ID2D1EffectImpl) { *aPtr = static_cast<ID2D1EffectImpl*>(this); } else if (aIID == IID_ID2D1DrawTransform) { *aPtr = static_cast<ID2D1DrawTransform*>(this); } else if (aIID == IID_ID2D1Transform) { *aPtr = static_cast<ID2D1Transform*>(this); } else if (aIID == IID_ID2D1TransformNode) { *aPtr = static_cast<ID2D1TransformNode*>(this); } else { return E_NOINTERFACE; } static_cast<IUnknown*>(*aPtr)->AddRef(); return S_OK; } static D2D1_RECT_L ConvertFloatToLongRect(const D2D1_VECTOR_4F& aRect) { // Clamp values to LONG range. We can't use std::min/max here because we want // the comparison to operate on a type that's different from the type of the // result. return D2D1::RectL(aRect.x <= LONG_MIN ? LONG_MIN : LONG(aRect.x), aRect.y <= LONG_MIN ? LONG_MIN : LONG(aRect.y), aRect.z >= LONG_MAX ? LONG_MAX : LONG(aRect.z), aRect.w >= LONG_MAX ? LONG_MAX : LONG(aRect.w)); } static D2D1_RECT_L IntersectRect(const D2D1_RECT_L& aRect1, const D2D1_RECT_L& aRect2) { return D2D1::RectL(std::max(aRect1.left, aRect2.left), std::max(aRect1.top, aRect2.top), std::min(aRect1.right, aRect2.right), std::min(aRect1.bottom, aRect2.bottom)); } IFACEMETHODIMP ExtendInputEffectD2D1::MapInputRectsToOutputRect(const D2D1_RECT_L* pInputRects, const D2D1_RECT_L* pInputOpaqueSubRects, UINT32 inputRectCount, D2D1_RECT_L* pOutputRect, D2D1_RECT_L* pOutputOpaqueSubRect) { // This transform only accepts one input, so there will only be one input rect. if (inputRectCount != 1) { return E_INVALIDARG; } // Set the output rect to the specified rect. This is the whole purpose of this effect. *pOutputRect = ConvertFloatToLongRect(mOutputRect); *pOutputOpaqueSubRect = IntersectRect(*pOutputRect, pInputOpaqueSubRects[0]); return S_OK; } IFACEMETHODIMP ExtendInputEffectD2D1::MapOutputRectToInputRects(const D2D1_RECT_L* pOutputRect, D2D1_RECT_L* pInputRects, UINT32 inputRectCount) const { if (inputRectCount != 1) { return E_INVALIDARG; } *pInputRects = *pOutputRect; return S_OK; } IFACEMETHODIMP ExtendInputEffectD2D1::MapInvalidRect(UINT32 inputIndex, D2D1_RECT_L invalidInputRect, D2D1_RECT_L* pInvalidOutputRect) const { MOZ_ASSERT(inputIndex == 0); *pInvalidOutputRect = invalidInputRect; return S_OK; } HRESULT ExtendInputEffectD2D1::Register(ID2D1Factory1 *aFactory) { D2D1_PROPERTY_BINDING bindings[] = { D2D1_VALUE_TYPE_BINDING(L"OutputRect", &ExtendInputEffectD2D1::SetOutputRect, &ExtendInputEffectD2D1::GetOutputRect), }; HRESULT hr = aFactory->RegisterEffectFromString(CLSID_ExtendInputEffect, kXmlDescription, bindings, 1, CreateEffect); if (FAILED(hr)) { gfxWarning() << "Failed to register extend input effect."; } return hr; } void ExtendInputEffectD2D1::Unregister(ID2D1Factory1 *aFactory) { aFactory->UnregisterEffect(CLSID_ExtendInputEffect); } HRESULT __stdcall ExtendInputEffectD2D1::CreateEffect(IUnknown **aEffectImpl) { *aEffectImpl = static_cast<ID2D1EffectImpl*>(new ExtendInputEffectD2D1()); (*aEffectImpl)->AddRef(); return S_OK; } } }
29.278049
151
0.657781
[ "vector", "transform" ]
d48e1722515d31629e33ef0da9232337ee5a496b
7,489
cpp
C++
src/memory/basic_memory.cpp
LePtitDev/lite-script
2bd3233586737b6e53d5748b03cc21d53702a6c2
[ "BSD-3-Clause" ]
6
2017-09-01T11:27:47.000Z
2020-01-16T18:53:10.000Z
src/memory/basic_memory.cpp
LePtitDev/lite-script
2bd3233586737b6e53d5748b03cc21d53702a6c2
[ "BSD-3-Clause" ]
null
null
null
src/memory/basic_memory.cpp
LePtitDev/lite-script
2bd3233586737b6e53d5748b03cc21d53702a6c2
[ "BSD-3-Clause" ]
null
null
null
///////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////// /* Copyright (C) 2017 LePtitDev All rights reserved. This software may be modified and distributed under the terms of the BSD license. See the LICENSE file for details. Author: Arthur Ferré <leptitdev.com> */ ///////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////// #include "basic_memory.hpp" #include "variable.hpp" #include "../streamer.hpp" ////// BASIC_MEMORY_0 ////// LiteScript::_BasicMemory_0::_BasicMemory_0(Memory &mem) : count(0), first_free(0), memory(mem), Count(count) { for (short i = 0; i < LITESCRIPT_MEMORY_0_SIZE; i++) this->free[i] = i + (short)1; } LiteScript::_BasicMemory_0::~_BasicMemory_0() { for (unsigned int i = 0; i < LITESCRIPT_MEMORY_0_SIZE; i++) { if (this->free[i] == -1) this->allocator.destroy(&(*this)[i]); } } LiteScript::Variable LiteScript::_BasicMemory_0::Create(Type &type, unsigned int id) { unsigned int index = (unsigned int)this->first_free; this->allocator.construct(&((*this)[index]), this->memory, id | index); if (type != Type::NIL) type.AssignObject((*this)[index]); this->ref_cpt[index] = 0; this->count++; this->first_free = this->free[index]; this->free[index] = -1; return Variable((*this)[index], this->ref_cpt[index]); } LiteScript::Object& LiteScript::_BasicMemory_0::CreateAt(unsigned int id) { unsigned int i = id & 0xff; this->allocator.construct(&((*this)[i]), this->memory, id); this->free[i] = this->first_free; this->first_free = (short)i; this->ref_cpt[i] = 0; this->free[i] = -1; this->count++; return (*this)[i]; } void LiteScript::_BasicMemory_0::Remove(unsigned int id) { if (this->free[id] != -1) return; this->free[id] = this->first_free; this->first_free = (short)id; this->allocator.destroy(&(*this)[id]); this->count--; } LiteScript::Nullable<LiteScript::Variable> LiteScript::_BasicMemory_0::GetVariable(unsigned int id) { if (this->free[id] == -1) return Nullable<Variable>(Variable((*this)[id], this->ref_cpt[id])); else return Nullable<Variable>(); } void LiteScript::_BasicMemory_0::FlagsInit() { this->flags.fill(false); } bool LiteScript::_BasicMemory_0::FlagsProtect(unsigned int i) { if (this->flags[i] == true) return true; this->flags[i] = true; return false; } void LiteScript::_BasicMemory_0::FlagsErase() { for (unsigned int i = 0, sz = LITESCRIPT_MEMORY_0_SIZE; i < sz; i++) { if (this->free[i] == -1 && !this->flags[i]) this->Remove(i); } } void LiteScript::_BasicMemory_0::Save(std::ostream &stream, bool (Memory::*caller)(std::ostream&, unsigned int)) { OStreamer streamer(stream); for (unsigned int i = 0; i < LITESCRIPT_MEMORY_0_SIZE; i++) { if (this->free[i] == -1 && this->flags[i] == false) { streamer << (unsigned char)1 << i << (*this)[i].GetType().GetID(); (*this)[i].GetType().Save(stream, (*this)[i], caller); } } } ////// BASIC_MEMORY_1 ////// LiteScript::_BasicMemory_1::_BasicMemory_1(Memory &memory) : count(0), memory(memory), first_nfull(0), Count(count) { for (short i = 0; i < LITESCRIPT_MEMORY_1_SIZE; i++) { this->arr[i] = nullptr; this->nfull[i] = i + (short)1; } } LiteScript::_BasicMemory_1::~_BasicMemory_1() { for (unsigned int i = 0; i < LITESCRIPT_MEMORY_1_SIZE; i++) { if (this->arr[i] != nullptr) delete this->arr[i]; } } LiteScript::Variable LiteScript::_BasicMemory_1::Create(Type &type, unsigned int id) { // Si le premier non plein n'existe pas, on le crée if (this->arr[this->first_nfull] == nullptr) this->arr[this->first_nfull] = new LiteScript::_BasicMemory_0(this->memory); // On crée l'objet Variable result = this->arr[this->first_nfull]->Create(type, id | (((unsigned int)this->first_nfull) << 8)); // Si le premier non plein devient plein, on passe au suivant if (this->arr[this->first_nfull]->isFull()) this->first_nfull = this->nfull[this->first_nfull]; // On incrémente le compteur d'objets this->count++; // On retourne la variable return result; } LiteScript::Object& LiteScript::_BasicMemory_1::CreateAt(unsigned int id) { unsigned int block = id >> 8; if (this->arr[block] == nullptr) { this->arr[block] = new LiteScript::_BasicMemory_0(this->memory); this->nfull[block] = this->first_nfull; this->first_nfull = (short)block; } Object& obj = this->arr[block]->CreateAt(id); this->count++; if (this->arr[block]->isFull()) { unsigned int j; for (j = 0; j < LITESCRIPT_MEMORY_1_SIZE && this->nfull[j] != block; j++); if (j == LITESCRIPT_MEMORY_1_SIZE) this->first_nfull = this->nfull[block]; else this->nfull[j] = this->nfull[block]; } return obj; } void LiteScript::_BasicMemory_1::Remove(unsigned int id) { unsigned int block = id >> 8; if (this->arr[block] != nullptr) { bool wasFull = this->arr[block]->isFull(); unsigned int nb = this->arr[block]->Count; this->arr[block]->Remove(id & 0xff); // Si le block n'est plus plein, on le place en premier if (wasFull && !this->arr[block]->isFull()) { this->nfull[block] = this->first_nfull; this->first_nfull = (short)block; } // Si le nombre d'objet à diminué, on décrémente le compteur if (nb != this->arr[block]->Count) this->count--; } } LiteScript::Nullable<LiteScript::Variable> LiteScript::_BasicMemory_1::GetVariable(unsigned int id) { unsigned int block = id >> 8; if (this->arr[block] != nullptr) return Nullable<Variable>(this->arr[block]->GetVariable(id & 0xff)); return Nullable<Variable>(); } void LiteScript::_BasicMemory_1::FlagsInit() { for (unsigned int i = 0, sz = LITESCRIPT_MEMORY_1_SIZE; i < sz; i++) { if (this->arr[i] != nullptr) this->arr[i]->FlagsInit(); } } bool LiteScript::_BasicMemory_1::FlagsProtect(unsigned int i) { unsigned int block = i >> 8; if (this->arr[block] != nullptr) return this->arr[block]->FlagsProtect(i & 0xff); return false; } void LiteScript::_BasicMemory_1::FlagsErase() { for (unsigned int i = 0, sz = LITESCRIPT_MEMORY_1_SIZE; i < sz; i++) { if (this->arr[i] != nullptr) { bool wasFull = this->arr[i]->isFull(); unsigned int nb = this->arr[i]->Count; this->arr[i]->FlagsErase(); // Si le block n'est plus plein, on le place en premier if (wasFull && !this->arr[i]->isFull()) { this->nfull[i] = this->first_nfull; this->first_nfull = (short)i; } // Si le nombre d'objet à diminué, on décrémente le compteur if (nb != this->arr[i]->Count) this->count--; } } } void LiteScript::_BasicMemory_1::Save(std::ostream &stream, bool (Memory::*caller)(std::ostream&, unsigned int)) const { for (unsigned int i = 0; i < LITESCRIPT_MEMORY_1_SIZE; i++) { if (this->arr[i] != nullptr) this->arr[i]->Save(stream, caller); } }
34.671296
120
0.580051
[ "object" ]
d49315880e0efb78a32ce833f807fb132e45d5bc
2,111
hpp
C++
Spike/Models/SpikingModel.hpp
wxie2013/Spike
36a3cfab2390a3d4b6dea9e49e1465987f469cd0
[ "MIT" ]
39
2016-01-28T17:09:23.000Z
2021-05-04T18:40:19.000Z
Spike/Models/SpikingModel.hpp
wxie2013/Spike
36a3cfab2390a3d4b6dea9e49e1465987f469cd0
[ "MIT" ]
19
2016-03-24T13:52:33.000Z
2019-10-12T09:12:07.000Z
Spike/Models/SpikingModel.hpp
wxie2013/Spike
36a3cfab2390a3d4b6dea9e49e1465987f469cd0
[ "MIT" ]
12
2016-11-05T10:48:55.000Z
2021-07-15T10:08:12.000Z
#ifndef SpikingModel_H #define SpikingModel_H #define SILENCE_MODEL_SETUP class SpikingModel; // Forward Declaration #include <stdio.h> #include "../Backend/Context.hpp" #include "../Synapses/SpikingSynapses.hpp" #include "../Plasticity/STDPPlasticity.hpp" #include "../Neurons/Neurons.hpp" #include "../Neurons/SpikingNeurons.hpp" #include "../Helpers/TimerWithMessages.hpp" #include "../Helpers/RandomStateManager.hpp" #include "../ActivityMonitor/ActivityMonitor.hpp" #include <string> #include <fstream> #include <vector> #include <iostream> using namespace std; class SpikingModel { private: void perform_per_step_model_instructions(bool plasticity_on); float current_time_in_seconds = 0.0f; public: // Constructor/Destructor //SpikingModel(SpikingNeurons* spiking_neurons, SpikingNeurons* input_spiking_neurons, SpikingSynapses* spiking_synapses); SpikingModel(); ~SpikingModel(); Context* context = nullptr; // Call init_backend to set this up! SpikingNeurons * spiking_neurons = nullptr; SpikingSynapses * spiking_synapses = nullptr; SpikingNeurons * input_spiking_neurons = nullptr; vector<STDPPlasticity*> plasticity_rule_vec; vector<ActivityMonitor*> monitors_vec; bool model_complete = false; float timestep = 0.0001; int timestep_grouping = 1; void SetTimestep(float timestep_parameter); int AddNeuronGroup(neuron_parameters_struct * group_params); int AddInputNeuronGroup(neuron_parameters_struct * group_params); int AddSynapseGroup(int presynaptic_group_id, int postsynaptic_group_id, synapse_parameters_struct * synapse_params); void AddSynapseGroupsForNeuronGroupAndEachInputGroup(int postsynaptic_group_id, synapse_parameters_struct * synapse_params); void AddPlasticityRule(STDPPlasticity * plasticity_rule); void AddActivityMonitor(ActivityMonitor * activityMonitor); void reset_state(); void reset_time(); void run(float seconds, bool plasticity_on=true); virtual void init_backend(); virtual void prepare_backend(); virtual void finalise_model(); protected: virtual void create_parameter_arrays() {} }; #endif
30.157143
126
0.789673
[ "vector" ]
d49744936e46b2618b829783f87bba2c0f78187d
1,475
cpp
C++
2M3/Source/Client/Systems/NetworkWorldState.cpp
simatic/MultiplayerLab
f483a80882f32249923c4fbcc876cfdca2b7da10
[ "MIT" ]
null
null
null
2M3/Source/Client/Systems/NetworkWorldState.cpp
simatic/MultiplayerLab
f483a80882f32249923c4fbcc876cfdca2b7da10
[ "MIT" ]
45
2020-10-08T13:32:36.000Z
2020-12-17T14:41:40.000Z
2M3/Source/Client/Systems/NetworkWorldState.cpp
simatic/MultiplayerLab
f483a80882f32249923c4fbcc876cfdca2b7da10
[ "MIT" ]
3
2020-10-02T09:02:20.000Z
2020-11-07T00:14:13.000Z
#include <Client/Systems/NetworkWorldState.h> #include <Common/Managers/GameManager.h> NetworkWorldState::NetworkWorldState(GameManager* const gameManager, ClientNetworkModule* const networkModule) : ClientNetworkSystem<Transform>(gameManager, networkModule) {} void NetworkWorldState::applyWorldStateEntities(const std::vector<WorldStatePacket::EntityInformation>& entities) { for(const auto& info : entities) { auto entityID = info.id; auto entity = gameManager->getEntityWithID(entityID); if(!entity) { // the entity does not exist yet, create it entity = Prefab::create(info.type, true); gameManager->addEntityWithID(entity, entityID); } if(info.hasTransform) { if(auto transform = entity->getComponent<Transform>()) { transform->position = sf::Vector2f(info.x, info.y); transform->rotation = info.angle; } else { throw std::runtime_error("Because `info.hasTransform` is `true`, expected entity with Transform component, but none could be found!"); } } } } void NetworkWorldState::update(const sf::Time& dt) { if (!networkModule->isBufferEmpty()) { auto packets = networkModule->extractPacketsOfType<WorldStatePacket>(); while(!packets.empty()) { auto worldStatePacket = packets.fetchPacket(); applyWorldStateEntities(worldStatePacket->getEntityInformation()); } } }
39.864865
150
0.671186
[ "vector", "transform" ]
d49b257005ff0ab4d6e5854db906b0cbd05f7715
4,125
cpp
C++
Source/SystemQOR/MSWindows/WinQL/Application/Backup/WinQLBackup.cpp
mfaithfull/QOR
0fa51789344da482e8c2726309265d56e7271971
[ "BSL-1.0" ]
9
2016-05-27T01:00:39.000Z
2021-04-01T08:54:46.000Z
Source/SystemQOR/MSWindows/WinQL/Application/Backup/WinQLBackup.cpp
mfaithfull/QOR
0fa51789344da482e8c2726309265d56e7271971
[ "BSL-1.0" ]
1
2016-03-03T22:54:08.000Z
2016-03-03T22:54:08.000Z
Source/SystemQOR/MSWindows/WinQL/Application/Backup/WinQLBackup.cpp
mfaithfull/QOR
0fa51789344da482e8c2726309265d56e7271971
[ "BSL-1.0" ]
4
2016-05-27T01:00:43.000Z
2018-08-19T08:47:49.000Z
//WinQLBackup.cpp // Copyright Querysoft Limited 2013 // // Permission is hereby granted, free of charge, to any person or organization // obtaining a copy of the software and accompanying documentation covered by // this license (the "Software") to use, reproduce, display, distribute, // execute, and transmit the Software, and to prepare derivative works of the // Software, and to permit third-parties to whom the Software is furnished to // do so, all subject to the following: // // The copyright notices in the Software and this entire statement, including // the above license grant, this restriction and the following disclaimer, // must be included in all copies of the Software, in whole or in part, and // all derivative works of the Software, unless such copies or derivative // works are solely in the form of machine-executable object code generated by // a source language processor. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. #include "WinQL/Application/ErrorSystem/WinQLError.h" #include "WinQL/Application/Backup/WinQLBackup.h" #include "WinQL/System/FileSystem/WinQLFile.h" #include "WinQAPI/Kernel32.h" //-------------------------------------------------------------------------------- namespace nsWin32 { using namespace nsWinQAPI; __QOR_IMPLEMENT_OCLASS_LUID( CBackup ); //-------------------------------------------------------------------------------- CBackup::CBackup( CFile& File ) : m_File( File ) , m_iReadWrite( 0 ) , m_pContext( 0 ) { _WINQ_FCONTEXT( "CBackup::CBackup" ); } //-------------------------------------------------------------------------------- CBackup::~CBackup() { _WINQ_FCONTEXT( "CBackup::~CBackup" ); if( m_iReadWrite == 1 ) { CKernel32::BackupRead( m_File.Handle()->Use(), 0, 0, 0, TRUE, FALSE, &m_pContext ); } else if( m_iReadWrite == 2 ) { CKernel32::BackupWrite( m_File.Handle()->Use(), 0, 0, 0, TRUE, FALSE, &m_pContext ); } } //-------------------------------------------------------------------------------- bool CBackup::Read( unsigned char* lpBuffer, unsigned long nNumberOfBytesToRead, unsigned long* lpNumberOfBytesRead, bool bProcessSecurity ) { _WINQ_FCONTEXT( "CBackup::Read" ); bool bResult = false; __QOR_PROTECT { if( m_iReadWrite != 2 ) { m_iReadWrite = 1; bResult = CKernel32::BackupRead( m_File.Handle()->Use(), lpBuffer, nNumberOfBytesToRead, lpNumberOfBytesRead, FALSE, bProcessSecurity ? TRUE : FALSE, &m_pContext ) ? true : false; } }__QOR_ENDPROTECT return bResult; } //-------------------------------------------------------------------------------- bool CBackup::Seek( unsigned long dwLowBytesToSeek, unsigned long dwHighBytesToSeek, unsigned long* lpdwLowByteSeeked, unsigned long* lpdwHighByteSeeked ) { _WINQ_FCONTEXT( "CBackup::Seek" ); bool bResult = false; __QOR_PROTECT { bResult = CKernel32::BackupSeek( m_File.Handle()->Use(), dwLowBytesToSeek, dwHighBytesToSeek, lpdwLowByteSeeked, lpdwHighByteSeeked, &m_pContext ) ? true : false; }__QOR_ENDPROTECT return bResult; } //-------------------------------------------------------------------------------- bool CBackup::Write( unsigned char* lpBuffer, unsigned long nNumberOfBytesToWrite, unsigned long* lpNumberOfBytesWritten, bool bProcessSecurity ) { _WINQ_FCONTEXT( "CBackup::Write" ); bool bResult = false; __QOR_PROTECT { if( m_iReadWrite != 1 ) { m_iReadWrite = 2; bResult = CKernel32::BackupWrite( m_File.Handle()->Use(), lpBuffer, nNumberOfBytesToWrite, lpNumberOfBytesWritten, FALSE, bProcessSecurity ? TRUE : FALSE, &m_pContext ) ? true : false; } }__QOR_ENDPROTECT return bResult; } }//nsWin32
38.551402
188
0.646545
[ "object" ]
d49e1afaeb2661c8684dd4d1a2804e5f3da4578e
2,597
cc
C++
src/test/cpp/util/strings_windows_test.cc
sevki/bazel
b18915752a69fbbc6ed94e1710198167593565fc
[ "Apache-2.0" ]
5
2019-01-10T09:41:11.000Z
2020-07-15T12:02:22.000Z
src/test/cpp/util/strings_windows_test.cc
sevki/bazel
b18915752a69fbbc6ed94e1710198167593565fc
[ "Apache-2.0" ]
1
2020-01-19T03:55:41.000Z
2020-01-19T03:55:41.000Z
src/test/cpp/util/strings_windows_test.cc
sevki/bazel
b18915752a69fbbc6ed94e1710198167593565fc
[ "Apache-2.0" ]
3
2019-05-05T01:52:36.000Z
2020-11-04T03:16:14.000Z
// Copyright 2018 The Bazel Authors. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #include "src/main/cpp/util/strings.h" #include <wchar.h> #include <memory> #include <string> #include <vector> #include "googletest/include/gtest/gtest.h" namespace blaze_util { static const char kAsciiLatin[] = {'A', 'b', 'c', '\0'}; static const wchar_t kUtf16Latin[] = {L'A', L'b', L'c', L'\0'}; static const char kUtf8Cyrillic[] = { 'H', 'e', 'y', '=', // 0xd0, 0x9f, // Cyrillic Capital Letter Pe 0xd1, 0x80, // Cyrillic Small Letter Er 0xd0, 0xb8, // Cyrillic Small Letter I 0xd0, 0xb2, // Cyrillic Small Letter Ve 0xd0, 0xb5, // Cyrillic Small Letter Ie 0xd1, 0x82, // Cyrillic Small Letter Te 0, }; static const wchar_t kUtf16Cyrillic[] = { L'H', L'e', L'y', L'=', 0x41F, // Cyrillic Capital Letter Pe 0x440, // Cyrillic Small Letter Er 0x438, // Cyrillic Small Letter I 0x432, // Cyrillic Small Letter Ve 0x435, // Cyrillic Small Letter Ie 0x442, // Cyrillic Small Letter Te 0x0, }; TEST(BlazeUtil, WcsToAcpTest) { std::string actual; uint32_t win32_err; ASSERT_TRUE(WcsToAcp(kUtf16Latin, &actual, &win32_err)); ASSERT_TRUE(actual == kAsciiLatin); } TEST(BlazeUtil, WcsToUtf8Test) { std::string actual; uint32_t win32_err; ASSERT_TRUE(WcsToUtf8(kUtf16Latin, &actual, &win32_err)); ASSERT_TRUE(actual == kAsciiLatin); ASSERT_TRUE(WcsToUtf8(kUtf16Cyrillic, &actual, &win32_err)); ASSERT_TRUE(actual == kUtf8Cyrillic); } TEST(BlazeUtil, AcpToWcsTest) { std::wstring actual; uint32_t win32_err; ASSERT_TRUE(AcpToWcs(kAsciiLatin, &actual, &win32_err)); ASSERT_TRUE(actual == kUtf16Latin); } TEST(BlazeUtil, Utf8ToWcsTest) { std::wstring actual; uint32_t win32_err; ASSERT_TRUE(Utf8ToWcs(kAsciiLatin, &actual, &win32_err)); ASSERT_TRUE(actual == kUtf16Latin); ASSERT_TRUE(Utf8ToWcs(kUtf8Cyrillic, &actual, &win32_err)); ASSERT_TRUE(actual == kUtf16Cyrillic); } } // namespace blaze_util
31.670732
75
0.682326
[ "vector" ]
d4a0497c2147649b2ec4b08496e6a19911552e21
4,254
cc
C++
contrib/kafka/filters/network/test/mesh/upstream_kafka_facade_unit_test.cc
dcillera/envoy
cb54ba8eec26f768f8c1ae412113b07bacde7321
[ "Apache-2.0" ]
17,703
2017-09-14T18:23:43.000Z
2022-03-31T22:04:17.000Z
contrib/kafka/filters/network/test/mesh/upstream_kafka_facade_unit_test.cc
dcillera/envoy
cb54ba8eec26f768f8c1ae412113b07bacde7321
[ "Apache-2.0" ]
15,957
2017-09-14T16:38:22.000Z
2022-03-31T23:56:30.000Z
contrib/kafka/filters/network/test/mesh/upstream_kafka_facade_unit_test.cc
dcillera/envoy
cb54ba8eec26f768f8c1ae412113b07bacde7321
[ "Apache-2.0" ]
3,780
2017-09-14T18:58:47.000Z
2022-03-31T17:10:47.000Z
#include "envoy/thread/thread.h" #include "envoy/thread_local/thread_local.h" #include "test/mocks/thread_local/mocks.h" #include "test/test_common/thread_factory_for_test.h" #include "contrib/kafka/filters/network/source/mesh/upstream_kafka_facade.h" #include "gmock/gmock.h" #include "gtest/gtest.h" using testing::Return; namespace Envoy { namespace Extensions { namespace NetworkFilters { namespace Kafka { namespace Mesh { namespace { class MockUpstreamKafkaConfiguration : public UpstreamKafkaConfiguration { public: MOCK_METHOD(absl::optional<ClusterConfig>, computeClusterConfigForTopic, (const std::string&), (const)); MOCK_METHOD((std::pair<std::string, int32_t>), getAdvertisedAddress, (), (const)); }; class MockThreadFactory : public Thread::ThreadFactory { public: MOCK_METHOD(Thread::ThreadPtr, createThread, (std::function<void()>, Thread::OptionsOptConstRef)); MOCK_METHOD(Thread::ThreadId, currentThreadId, ()); }; TEST(UpstreamKafkaFacadeTest, shouldCreateProducerOnlyOnceForTheSameCluster) { // given const std::string topic1 = "topic1"; const std::string topic2 = "topic2"; MockUpstreamKafkaConfiguration configuration; const ClusterConfig cluster_config = {"cluster", 1, {{"bootstrap.servers", "localhost:9092"}}}; EXPECT_CALL(configuration, computeClusterConfigForTopic(topic1)).WillOnce(Return(cluster_config)); EXPECT_CALL(configuration, computeClusterConfigForTopic(topic2)).WillOnce(Return(cluster_config)); ThreadLocal::MockInstance slot_allocator; EXPECT_CALL(slot_allocator, allocateSlot()) .WillOnce(Invoke(&slot_allocator, &ThreadLocal::MockInstance::allocateSlotMock)); Thread::ThreadFactory& thread_factory = Thread::threadFactoryForTest(); UpstreamKafkaFacadeImpl testee = {configuration, slot_allocator, thread_factory}; // when auto& result1 = testee.getProducerForTopic(topic1); auto& result2 = testee.getProducerForTopic(topic2); // then EXPECT_EQ(&result1, &result2); EXPECT_EQ(testee.getProducerCountForTest(), 1); } TEST(UpstreamKafkaFacadeTest, shouldCreateDifferentProducersForDifferentClusters) { // given const std::string topic1 = "topic1"; const std::string topic2 = "topic2"; MockUpstreamKafkaConfiguration configuration; // Notice it's the cluster name that matters, not the producer config. const ClusterConfig cluster_config1 = {"cluster1", 1, {{"bootstrap.servers", "localhost:9092"}}}; EXPECT_CALL(configuration, computeClusterConfigForTopic(topic1)) .WillOnce(Return(cluster_config1)); const ClusterConfig cluster_config2 = {"cluster2", 1, {{"bootstrap.servers", "localhost:9092"}}}; EXPECT_CALL(configuration, computeClusterConfigForTopic(topic2)) .WillOnce(Return(cluster_config2)); ThreadLocal::MockInstance slot_allocator; EXPECT_CALL(slot_allocator, allocateSlot()) .WillOnce(Invoke(&slot_allocator, &ThreadLocal::MockInstance::allocateSlotMock)); Thread::ThreadFactory& thread_factory = Thread::threadFactoryForTest(); UpstreamKafkaFacadeImpl testee = {configuration, slot_allocator, thread_factory}; // when auto& result1 = testee.getProducerForTopic(topic1); auto& result2 = testee.getProducerForTopic(topic2); // then EXPECT_NE(&result1, &result2); EXPECT_EQ(testee.getProducerCountForTest(), 2); } TEST(UpstreamKafkaFacadeTest, shouldThrowIfThereIsNoConfigurationForGivenTopic) { // given const std::string topic = "topic1"; MockUpstreamKafkaConfiguration configuration; const ClusterConfig cluster_config = {"cluster", 1, {{"bootstrap.servers", "localhost:9092"}}}; EXPECT_CALL(configuration, computeClusterConfigForTopic(topic)).WillOnce(Return(absl::nullopt)); ThreadLocal::MockInstance slot_allocator; EXPECT_CALL(slot_allocator, allocateSlot()) .WillOnce(Invoke(&slot_allocator, &ThreadLocal::MockInstance::allocateSlotMock)); Thread::ThreadFactory& thread_factory = Thread::threadFactoryForTest(); UpstreamKafkaFacadeImpl testee = {configuration, slot_allocator, thread_factory}; // when, then - exception gets thrown. EXPECT_THROW(testee.getProducerForTopic(topic), EnvoyException); } } // namespace } // namespace Mesh } // namespace Kafka } // namespace NetworkFilters } // namespace Extensions } // namespace Envoy
39.388889
100
0.77339
[ "mesh" ]
d4abed332160c2f7036a7de15601dfb2014ff65b
1,627
cpp
C++
encrypt-config/ConfigFile.cpp
nandorsoma/nifi-minifi-cpp
182e5b98a390d6073c43ffc88ecf7511ad0d3ff5
[ "Apache-2.0" ]
null
null
null
encrypt-config/ConfigFile.cpp
nandorsoma/nifi-minifi-cpp
182e5b98a390d6073c43ffc88ecf7511ad0d3ff5
[ "Apache-2.0" ]
null
null
null
encrypt-config/ConfigFile.cpp
nandorsoma/nifi-minifi-cpp
182e5b98a390d6073c43ffc88ecf7511ad0d3ff5
[ "Apache-2.0" ]
null
null
null
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "ConfigFile.h" #include <algorithm> #include <fstream> #include <utility> #include <optional> #include "utils/StringUtils.h" #include "properties/Configuration.h" namespace org::apache::nifi::minifi::encrypt_config { std::vector<std::string> ConfigFile::getSensitiveProperties() const { auto sensitive_properties = Configuration::getSensitiveProperties([this](const std::string& sensitive_props) { return getValue(sensitive_props); }); const auto not_found = [this](const std::string& property_name) { return !hasValue(property_name); }; const auto new_end = std::remove_if(sensitive_properties.begin(), sensitive_properties.end(), not_found); sensitive_properties.erase(new_end, sensitive_properties.end()); return sensitive_properties; } } // namespace org::apache::nifi::minifi::encrypt_config
40.675
150
0.762754
[ "vector" ]
d4b1306bbc995502d041fa445e87670129eee82c
2,660
cc
C++
y2020/vision/sift/testing_sift.cc
AustinSchuh/971-Robot-Code
99abc66fd2d899c0bdab338dc6f57dc5def9be8d
[ "Apache-2.0" ]
39
2021-06-18T03:22:30.000Z
2022-03-21T15:23:43.000Z
y2020/vision/sift/testing_sift.cc
AustinSchuh/971-Robot-Code
99abc66fd2d899c0bdab338dc6f57dc5def9be8d
[ "Apache-2.0" ]
10
2021-06-18T03:22:19.000Z
2022-03-18T22:14:15.000Z
y2020/vision/sift/testing_sift.cc
AustinSchuh/971-Robot-Code
99abc66fd2d899c0bdab338dc6f57dc5def9be8d
[ "Apache-2.0" ]
4
2021-08-19T19:20:04.000Z
2022-03-08T07:33:18.000Z
#include <memory> #include <opencv2/highgui/highgui.hpp> #include <opencv2/imgcodecs.hpp> #include <opencv2/imgproc.hpp> #include "aos/init.h" #include "aos/time/time.h" #include "y2020/vision/sift/fast_gaussian.h" #include "glog/logging.h" #include "y2020/vision/sift/sift971.h" DEFINE_string(image, "", "Image to test with"); int main(int argc, char **argv) { aos::InitGoogle(&argc, &argv); cv::setNumThreads (4); const cv::Mat raw_image = cv::imread(FLAGS_image); CHECK(!raw_image.empty()) << ": Failed to read: " << FLAGS_image; CHECK_EQ(CV_8UC3, raw_image.type()); #if 0 cv::Mat color_image; raw_image.convertTo(color_image, CV_32F, 1.0/255.0); cv::Mat image; cv::cvtColor(color_image, image, cv::COLOR_BGR2GRAY); #else cv::Mat gray_image; cv::cvtColor(raw_image, gray_image, cv::COLOR_BGR2GRAY); cv::Mat float_image; #if 0 gray_image.convertTo(float_image, CV_32F, 0.00390625); #else float_image = gray_image; #endif cv::Mat image; cv::resize(float_image, image, cv::Size(1280, 720), 0, 0, cv::INTER_AREA); #endif #if 0 #if 0 cv::namedWindow("source", cv::WINDOW_AUTOSIZE); cv::imshow("source", raw_image); cv::namedWindow("converted", cv::WINDOW_AUTOSIZE); cv::imshow("converted", image); #endif cv::Mat slow_blurred, fast_blurred; const double sigma = 3.0900155872895909; cv::GaussianBlur(image, slow_blurred, cv::Size(9, 9), sigma, sigma); frc971::vision::FastGaussian(image, &fast_blurred, sigma); cv::namedWindow("slow", cv::WINDOW_AUTOSIZE); cv::imshow("slow", slow_blurred); cv::namedWindow("fast", cv::WINDOW_AUTOSIZE); cv::imshow("fast", fast_blurred); cv::waitKey(0); return 0; #endif LOG(INFO); std::unique_ptr<frc971::vision::SIFT971_Impl> sift(new frc971::vision::SIFT971_Impl()); std::vector<cv::KeyPoint> keypoints; cv::Mat descriptors; LOG(INFO) << "detectAndCompute on " << image.rows << "x" << image.cols; sift->detectAndCompute(image, cv::noArray(), keypoints, descriptors); LOG(INFO); #if 0 return 0; #endif static constexpr int kIterations = 40; const auto start = aos::monotonic_clock::now(); for (int i = 0; i < kIterations; ++i) { keypoints.clear(); descriptors.release(); sift->detectAndCompute(image, cv::noArray(), keypoints, descriptors); } const auto end = aos::monotonic_clock::now(); LOG(INFO) << "Took: " << (std::chrono::duration<double>(end - start) / kIterations).count(); // Should be ~352 for FRC-Image4-cleaned.png downscaled to 640x360. // 376 in DoG_TYPE_SHORT mode. // 344 now with 1280x720 non-upscaled. LOG(INFO) << "found " << keypoints.size() << " and " << descriptors.size(); }
30.227273
89
0.68609
[ "vector" ]
d4b5b2212928cd76a3191dcf45bf086baa52b6a8
4,767
hpp
C++
src/readScl.hpp
choltz95/c-pcb-annealer
ca962f5fe5a6e398e4f8ef8d1142e619817beb1b
[ "BSD-3-Clause" ]
12
2019-11-01T00:57:42.000Z
2022-02-27T05:38:17.000Z
src/readScl.hpp
sethhillbrand/SA-PCB
5403d495f4478861fa61592481342820046e4dcd
[ "BSD-3-Clause" ]
1
2019-12-23T17:22:24.000Z
2019-12-23T17:22:24.000Z
src/readScl.hpp
sethhillbrand/SA-PCB
5403d495f4478861fa61592481342820046e4dcd
[ "BSD-3-Clause" ]
7
2020-01-30T20:44:11.000Z
2021-12-21T13:17:38.000Z
/////////////////////////////////////////////////////////////////////////////// // Authors: Chester Holtz, Devon Merrill, James (Ting-Chou) Lin, Connie (Yen-Yi) Wu // (respective Ph.D. advisors: Chung-Kuan Cheng, Andrew B. Kahng, Steven Swanson). // // BSD 3-Clause License // // Copyright (c) 2018, The Regents of the University of California // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are met: // // * Redistributions of source code must retain the above copyright notice, this // list of conditions and the following disclaimer. // // * Redistributions in binary form must reproduce the above copyright notice, // this list of conditions and the following disclaimer in the documentation // and/or other materials provided with the distribution. // // * Neither the name of the copyright holder nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE // ARE // DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /////////////////////////////////////////////////////////////////////////////// #include <iostream> #include <vector> #include <fstream> #include <boost/algorithm/string/split.hpp> #include <boost/algorithm/string.hpp> #include <string> #include <iostream> #include <map> using namespace std; void readSclFile(); class row; extern map < int, row > rowId; extern int RowWidth; extern int xLimit; class row { public: int Id; int coOrdinate; int height; int siteWidth; int siteSpacing; string siteOrient; string siteSymmetry; int siteRowOrigin; int numSites; int overlap; vector < string > cellList; void setId(int Id) { this -> Id = Id; } void setParameterRows(int coOrdinate, int height, int siteWidth, int siteSpacing, string siteOrient, string siteSymmetry, int siteRowOrigin, int numSites) { this -> coOrdinate = coOrdinate; this -> height = height; this -> siteWidth = siteWidth; this -> siteSpacing = siteSpacing; this -> siteOrient = siteOrient; this -> siteSymmetry = siteSymmetry; this -> siteRowOrigin = siteRowOrigin; this -> numSites = numSites; } void setCellList(string cellId) { cellList.push_back(cellId); } vector < string > sortByX() { int x = 0; map < int, string > sortx; map < int, string > ::iterator it; //vector < string > ::iterator itl; vector < string > list; for (unsigned long i = 0; i < this -> cellList.size(); i++) { x = nodeId.find(cellList[i]) -> second.xCoordinate; sortx.insert(pair < int, string > (x, cellList[i])); } for (it = sortx.begin(); it != sortx.end(); ++it) { list.push_back(it -> second); } this -> cellList = list; return this -> cellList; } void calcRowOverlap() { //vector < string > ::iterator it1; int xLast = 0, widthLast = 0; xLast = nodeId[cellList[cellList.size() - 1]].xCoordinate; widthLast = nodeId[cellList[cellList.size() - 1]].width; this->overlap = xLast + widthLast - (RowWidth + xLimit); } void printParameter() { cout << "rowId " << this -> Id << " " << endl; cout << "Row-Co-ordinate " << this -> coOrdinate << endl; cout << "height " << this -> height << endl; cout << "siteWidth " << this -> siteWidth << endl; cout << "siteSpacing " << this -> siteSpacing << endl; cout << "siteOrientation " << this -> siteOrient << endl; cout << "siteSymmetry " << this -> siteSymmetry << endl; cout << "siteRowOrigin " << this -> siteRowOrigin << endl; cout << "numSites " << this -> numSites << endl; cout << "Overlap of this row " << overlap << endl; cout << "cellsInRow " << " "; vector < string > ::iterator it1; for (it1 = cellList.begin(); it1 != cellList.end(); ++it1) { cout << * it1 << " "; } cout << "\n" << endl; } };
36.113636
158
0.639815
[ "vector" ]
d4b8bcc9919a7febca69a72ce43c16c0f1899c85
3,730
hh
C++
construct/UnitBuilder.hh
celeritas-project/orange-port
9aa2d36984a24a02ed6d14688a889d4266f7b1af
[ "Apache-2.0", "MIT" ]
null
null
null
construct/UnitBuilder.hh
celeritas-project/orange-port
9aa2d36984a24a02ed6d14688a889d4266f7b1af
[ "Apache-2.0", "MIT" ]
null
null
null
construct/UnitBuilder.hh
celeritas-project/orange-port
9aa2d36984a24a02ed6d14688a889d4266f7b1af
[ "Apache-2.0", "MIT" ]
null
null
null
//---------------------------------*-C++-*-----------------------------------// /*! * \file construct/UnitBuilder.hh * \brief UnitBuilder class declaration * \note Copyright (c) 2020 Oak Ridge National Laboratory, UT-Battelle, LLC. */ //---------------------------------------------------------------------------// #pragma once #include <memory> #include <set> #include <utility> #include <vector> #include "base/FastHashSet.hh" #include "orange/query/ObjectMetadata.hh" #include "orange/query/UnitMetadata.hh" #include "orange/surfaces/SurfaceContainer.hh" #include "CSGTree.hh" #include "UnitRegion.hh" #include "detail/HashPair.hh" #include "detail/SurfaceInserter.hh" namespace celeritas { //---------------------------------------------------------------------------// /*! * Construct the geometry for a unit from shapes. * * The added regions must be given in decreasing Z order. At least two cells * must be present: an exterior (cell zero) and an interior. * * This is primarily an implementation detail of UnitProto::build(), but it's * also used to construct tests in the Trackers. */ class UnitBuilder { public: //@{ //! Public type aliases using SPConstShape = std::shared_ptr<const PlacedShape>; using Halfspace = std::pair<Sense, SPConstShape>; using VecSenseShape = std::vector<Halfspace>; using VecUnitRegion = std::vector<UnitRegion>; //@} struct result_type { SurfaceContainer surfaces; std::vector<UnitRegion> regions; std::shared_ptr<UnitMetadata> md; }; public: // Constructor UnitBuilder(); // Reserve space for regions void reserve(size_type num_regions); // Add an exterior cell using its implicit complement void exterior(const VecSenseShape& interior, ZOrder zorder, ObjectMetadata md); // Build a region in the unit VolumeId region(const VecSenseShape& interior, ZOrder zorder, ObjectMetadata md, real_type volume = 0.0); // Whether all regions have the same Z order bool is_simple() const; // Build and invalidate this builder result_type operator()(ObjectMetadata unit_md); private: using VecMetadata = UnitMetadata::VecMetadata; using VecDbl = UnitMetadata::VecDbl; using ShapeFace = UnitMetadata::ShapeFace; using SFHash = detail::HashPair<ShapeFace>; using SetShapeFace = FastHashSet<ShapeFace, SFHash>; using NodeId = CSGTree::NodeId; //// DATA //// // Cell properties (all same size) std::vector<UnitRegion> regions_; std::vector<NodeId> cell_nodes_; VecMetadata cell_md_; VecDbl volumes_; CSGTree tree_; // Surface properties SurfaceContainer surfaces_; std::vector<SetShapeFace> surface_md_; detail::SurfaceInserter insert_surface_; // Exterior definition VecSenseShape implicit_interior_; BoundingBox interior_bbox_; //// IMPLEMENTATION FUNCTIONS //// BoundingBox calc_bbox(const VecSenseShape& interior); VolumeId add_volume(Sense sense, const VecSenseShape& interior, ZOrder zorder, ObjectMetadata md, real_type volume); void add_surface(SurfaceId surface, SPConstShape shape, std::string ext); }; //---------------------------------------------------------------------------// } // namespace celeritas //---------------------------------------------------------------------------//
31.344538
79
0.568633
[ "geometry", "shape", "vector" ]
d4ba27181a3fd19755124cc60d866c675187d5f9
16,788
cc
C++
components/autofill/content/common/autofill_types_struct_traits_unittest.cc
metux/chromium-deb
3c08e9b89a1b6f95f103a61ff4f528dbcd57fc42
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
null
null
null
components/autofill/content/common/autofill_types_struct_traits_unittest.cc
metux/chromium-deb
3c08e9b89a1b6f95f103a61ff4f528dbcd57fc42
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
null
null
null
components/autofill/content/common/autofill_types_struct_traits_unittest.cc
metux/chromium-deb
3c08e9b89a1b6f95f103a61ff4f528dbcd57fc42
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
null
null
null
// Copyright 2016 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 <utility> #include "base/message_loop/message_loop.h" #include "base/run_loop.h" #include "base/strings/utf_string_conversions.h" #include "components/autofill/content/common/test_autofill_types.mojom.h" #include "components/autofill/core/browser/autofill_test_utils.h" #include "components/autofill/core/common/form_data.h" #include "components/autofill/core/common/form_field_data.h" #include "components/autofill/core/common/signatures_util.h" #include "mojo/public/cpp/bindings/binding_set.h" #include "mojo/public/cpp/bindings/interface_request.h" #include "testing/gtest/include/gtest/gtest.h" namespace autofill { const std::vector<const char*> kOptions = {"Option1", "Option2", "Option3", "Option4"}; namespace { void CreateTestFieldDataPredictions(const std::string& signature, FormFieldDataPredictions* field_predict) { test::CreateTestSelectField("TestLabel", "TestName", "TestValue", kOptions, kOptions, 4, &field_predict->field); field_predict->signature = signature; field_predict->heuristic_type = "TestSignature"; field_predict->server_type = "TestServerType"; field_predict->overall_type = "TestOverallType"; field_predict->parseable_name = "TestParseableName"; } void CreateTestPasswordFormFillData(PasswordFormFillData* fill_data) { fill_data->name = base::ASCIIToUTF16("TestName"); fill_data->origin = GURL("https://foo.com/"); fill_data->action = GURL("https://foo.com/login"); test::CreateTestSelectField("TestUsernameFieldLabel", "TestUsernameFieldName", "TestUsernameFieldValue", kOptions, kOptions, 4, &fill_data->username_field); test::CreateTestSelectField("TestPasswordFieldLabel", "TestPasswordFieldName", "TestPasswordFieldValue", kOptions, kOptions, 4, &fill_data->password_field); fill_data->preferred_realm = "https://foo.com/"; base::string16 name; PasswordAndRealm pr; name = base::ASCIIToUTF16("Tom"); pr.password = base::ASCIIToUTF16("Tom_Password"); pr.realm = "https://foo.com/"; fill_data->additional_logins[name] = pr; name = base::ASCIIToUTF16("Jerry"); pr.password = base::ASCIIToUTF16("Jerry_Password"); pr.realm = "https://bar.com/"; fill_data->additional_logins[name] = pr; fill_data->wait_for_username = true; fill_data->is_possible_change_password_form = false; } void CreateTestPasswordForm(PasswordForm* form) { form->scheme = PasswordForm::Scheme::SCHEME_HTML; form->signon_realm = "https://foo.com/"; form->origin = GURL("https://foo.com/"); form->action = GURL("https://foo.com/login"); form->affiliated_web_realm = "https://foo.com/"; form->submit_element = base::ASCIIToUTF16("test_submit"); form->username_element = base::ASCIIToUTF16("username"); form->username_marked_by_site = true; form->username_value = base::ASCIIToUTF16("test@gmail.com"); form->other_possible_usernames.push_back(PossibleUsernamePair( base::ASCIIToUTF16("Jerry_1"), base::ASCIIToUTF16("id1"))); form->other_possible_usernames.push_back(PossibleUsernamePair( base::ASCIIToUTF16("Jerry_2"), base::ASCIIToUTF16("id2"))); form->password_element = base::ASCIIToUTF16("password"); form->password_value = base::ASCIIToUTF16("test"); form->password_value_is_default = true; form->new_password_element = base::ASCIIToUTF16("new_password"); form->new_password_value = base::ASCIIToUTF16("new_password_value"); form->new_password_value_is_default = false; form->new_password_marked_by_site = false; form->new_password_element = base::ASCIIToUTF16("confirmation_password"); form->preferred = false; form->date_created = base::Time::Now(); form->date_synced = base::Time::Now(); form->blacklisted_by_user = false; form->type = PasswordForm::Type::TYPE_GENERATED; form->times_used = 999; test::CreateTestAddressFormData(&form->form_data); form->generation_upload_status = PasswordForm::GenerationUploadStatus::POSITIVE_SIGNAL_SENT; form->display_name = base::ASCIIToUTF16("test display name"); form->icon_url = GURL("https://foo.com/icon.png"); form->federation_origin = url::Origin::UnsafelyCreateOriginWithoutNormalization( "http", "www.google.com", 80, ""); form->skip_zero_click = false; form->layout = PasswordForm::Layout::LAYOUT_LOGIN_AND_SIGNUP; form->was_parsed_using_autofill_predictions = false; form->is_public_suffix_match = true; form->is_affiliation_based_match = true; form->does_look_like_signup_form = true; form->submission_event = PasswordForm::SubmissionIndicatorEvent::SAME_DOCUMENT_NAVIGATION; } void CreateTestFormsPredictionsMap(FormsPredictionsMap* predictions) { FormsPredictionsMap& result_map = *predictions; // 1st element. FormData form_data; test::CreateTestAddressFormData(&form_data); ASSERT_TRUE(form_data.fields.size() >= 4); result_map[form_data][form_data.fields[0]] = PasswordFormFieldPredictionType::PREDICTION_USERNAME; result_map[form_data][form_data.fields[1]] = PasswordFormFieldPredictionType::PREDICTION_CURRENT_PASSWORD; result_map[form_data][form_data.fields[2]] = PasswordFormFieldPredictionType::PREDICTION_NEW_PASSWORD; result_map[form_data][form_data.fields[3]] = PasswordFormFieldPredictionType::PREDICTION_NOT_PASSWORD; // 2nd element. form_data.fields.clear(); result_map[form_data] = std::map<FormFieldData, PasswordFormFieldPredictionType>(); // 3rd element. FormFieldData field_data; test::CreateTestSelectField("TestLabel1", "TestName1", "TestValue1", kOptions, kOptions, 4, &field_data); form_data.fields.push_back(field_data); test::CreateTestSelectField("TestLabel2", "TestName2", "TestValue2", kOptions, kOptions, 4, &field_data); form_data.fields.push_back(field_data); result_map[form_data][form_data.fields[0]] = PasswordFormFieldPredictionType::PREDICTION_NEW_PASSWORD; result_map[form_data][form_data.fields[1]] = PasswordFormFieldPredictionType::PREDICTION_CURRENT_PASSWORD; } void CheckEqualPasswordFormFillData(const PasswordFormFillData& expected, const PasswordFormFillData& actual) { EXPECT_EQ(expected.name, actual.name); EXPECT_EQ(expected.origin, actual.origin); EXPECT_EQ(expected.action, actual.action); EXPECT_EQ(expected.username_field, actual.username_field); EXPECT_EQ(expected.password_field, actual.password_field); EXPECT_EQ(expected.preferred_realm, actual.preferred_realm); { EXPECT_EQ(expected.additional_logins.size(), actual.additional_logins.size()); auto iter1 = expected.additional_logins.begin(); auto end1 = expected.additional_logins.end(); auto iter2 = actual.additional_logins.begin(); auto end2 = actual.additional_logins.end(); for (; iter1 != end1 && iter2 != end2; ++iter1, ++iter2) { EXPECT_EQ(iter1->first, iter2->first); EXPECT_EQ(iter1->second.password, iter2->second.password); EXPECT_EQ(iter1->second.realm, iter2->second.realm); } ASSERT_EQ(iter1, end1); ASSERT_EQ(iter2, end2); } { EXPECT_EQ(expected.other_possible_usernames.size(), actual.other_possible_usernames.size()); auto iter1 = expected.other_possible_usernames.begin(); auto end1 = expected.other_possible_usernames.end(); auto iter2 = actual.other_possible_usernames.begin(); auto end2 = actual.other_possible_usernames.end(); for (; iter1 != end1 && iter2 != end2; ++iter1, ++iter2) { EXPECT_EQ(iter1->first.username, iter2->first.username); EXPECT_EQ(iter1->first.password, iter2->first.password); EXPECT_EQ(iter1->first.realm, iter2->first.realm); EXPECT_EQ(iter1->second, iter2->second); } ASSERT_EQ(iter1, end1); ASSERT_EQ(iter2, end2); } EXPECT_EQ(expected.wait_for_username, actual.wait_for_username); EXPECT_EQ(expected.is_possible_change_password_form, actual.is_possible_change_password_form); } void CheckEqualPasswordFormGenerationData( const PasswordFormGenerationData& expected, const PasswordFormGenerationData& actual) { EXPECT_EQ(expected.form_signature, actual.form_signature); EXPECT_EQ(expected.field_signature, actual.field_signature); ASSERT_EQ(expected.confirmation_field_signature.has_value(), actual.confirmation_field_signature.has_value()); EXPECT_EQ(expected.confirmation_field_signature.value(), actual.confirmation_field_signature.value()); } } // namespace class AutofillTypeTraitsTestImpl : public testing::Test, public mojom::TypeTraitsTest { public: AutofillTypeTraitsTestImpl() {} mojom::TypeTraitsTestPtr GetTypeTraitsTestProxy() { mojom::TypeTraitsTestPtr proxy; bindings_.AddBinding(this, mojo::MakeRequest(&proxy)); return proxy; } // mojom::TypeTraitsTest: void PassFormData(const FormData& s, PassFormDataCallback callback) override { std::move(callback).Run(s); } void PassFormFieldData(const FormFieldData& s, PassFormFieldDataCallback callback) override { std::move(callback).Run(s); } void PassFormDataPredictions( const FormDataPredictions& s, PassFormDataPredictionsCallback callback) override { std::move(callback).Run(s); } void PassFormFieldDataPredictions( const FormFieldDataPredictions& s, PassFormFieldDataPredictionsCallback callback) override { std::move(callback).Run(s); } void PassPasswordFormFillData( const PasswordFormFillData& s, PassPasswordFormFillDataCallback callback) override { std::move(callback).Run(s); } void PassPasswordFormGenerationData( const PasswordFormGenerationData& s, PassPasswordFormGenerationDataCallback callback) override { std::move(callback).Run(s); } void PassPasswordForm(const PasswordForm& s, PassPasswordFormCallback callback) override { std::move(callback).Run(s); } void PassFormsPredictionsMap( const FormsPredictionsMap& s, PassFormsPredictionsMapCallback callback) override { std::move(callback).Run(s); } private: base::MessageLoop loop_; mojo::BindingSet<TypeTraitsTest> bindings_; }; void ExpectFormFieldData(const FormFieldData& expected, const base::Closure& closure, const FormFieldData& passed) { EXPECT_EQ(expected, passed); closure.Run(); } void ExpectFormData(const FormData& expected, const base::Closure& closure, const FormData& passed) { EXPECT_EQ(expected, passed); closure.Run(); } void ExpectFormFieldDataPredictions(const FormFieldDataPredictions& expected, const base::Closure& closure, const FormFieldDataPredictions& passed) { EXPECT_EQ(expected, passed); closure.Run(); } void ExpectFormDataPredictions(const FormDataPredictions& expected, const base::Closure& closure, const FormDataPredictions& passed) { EXPECT_EQ(expected, passed); closure.Run(); } void ExpectPasswordFormFillData(const PasswordFormFillData& expected, const base::Closure& closure, const PasswordFormFillData& passed) { CheckEqualPasswordFormFillData(expected, passed); closure.Run(); } void ExpectPasswordFormGenerationData( const PasswordFormGenerationData& expected, const base::Closure& closure, const PasswordFormGenerationData& passed) { CheckEqualPasswordFormGenerationData(expected, passed); closure.Run(); } void ExpectPasswordForm(const PasswordForm& expected, const base::Closure& closure, const PasswordForm& passed) { EXPECT_EQ(expected, passed); closure.Run(); } void ExpectFormsPredictionsMap(const FormsPredictionsMap& expected, const base::Closure& closure, const FormsPredictionsMap& passed) { EXPECT_EQ(expected, passed); closure.Run(); } TEST_F(AutofillTypeTraitsTestImpl, PassFormFieldData) { FormFieldData input; test::CreateTestSelectField("TestLabel", "TestName", "TestValue", kOptions, kOptions, 4, &input); // Set other attributes to check if they are passed correctly. input.id = base::ASCIIToUTF16("id"); input.autocomplete_attribute = "on"; input.placeholder = base::ASCIIToUTF16("placeholder"); input.css_classes = base::ASCIIToUTF16("class1"); input.max_length = 12345; input.is_autofilled = true; input.check_status = FormFieldData::CHECKED; input.should_autocomplete = true; input.role = FormFieldData::ROLE_ATTRIBUTE_PRESENTATION; input.text_direction = base::i18n::RIGHT_TO_LEFT; input.properties_mask = FieldPropertiesFlags::HAD_FOCUS; base::RunLoop loop; mojom::TypeTraitsTestPtr proxy = GetTypeTraitsTestProxy(); proxy->PassFormFieldData( input, base::Bind(&ExpectFormFieldData, input, loop.QuitClosure())); loop.Run(); } TEST_F(AutofillTypeTraitsTestImpl, PassFormData) { FormData input; test::CreateTestAddressFormData(&input); base::RunLoop loop; mojom::TypeTraitsTestPtr proxy = GetTypeTraitsTestProxy(); proxy->PassFormData(input, base::Bind(&ExpectFormData, input, loop.QuitClosure())); loop.Run(); } TEST_F(AutofillTypeTraitsTestImpl, PassFormFieldDataPredictions) { FormFieldDataPredictions input; CreateTestFieldDataPredictions("TestSignature", &input); base::RunLoop loop; mojom::TypeTraitsTestPtr proxy = GetTypeTraitsTestProxy(); proxy->PassFormFieldDataPredictions( input, base::Bind(&ExpectFormFieldDataPredictions, input, loop.QuitClosure())); loop.Run(); } TEST_F(AutofillTypeTraitsTestImpl, PassFormDataPredictions) { FormDataPredictions input; test::CreateTestAddressFormData(&input.data); input.signature = "TestSignature"; FormFieldDataPredictions field_predict; CreateTestFieldDataPredictions("Tom", &field_predict); input.fields.push_back(field_predict); CreateTestFieldDataPredictions("Jerry", &field_predict); input.fields.push_back(field_predict); CreateTestFieldDataPredictions("NoOne", &field_predict); input.fields.push_back(field_predict); base::RunLoop loop; mojom::TypeTraitsTestPtr proxy = GetTypeTraitsTestProxy(); proxy->PassFormDataPredictions( input, base::Bind(&ExpectFormDataPredictions, input, loop.QuitClosure())); loop.Run(); } TEST_F(AutofillTypeTraitsTestImpl, PassPasswordFormFillData) { PasswordFormFillData input; CreateTestPasswordFormFillData(&input); base::RunLoop loop; mojom::TypeTraitsTestPtr proxy = GetTypeTraitsTestProxy(); proxy->PassPasswordFormFillData(input, base::Bind(&ExpectPasswordFormFillData, input, loop.QuitClosure())); loop.Run(); } TEST_F(AutofillTypeTraitsTestImpl, PassPasswordFormGenerationData) { FormData form; test::CreateTestAddressFormData(&form); FormSignature form_signature = CalculateFormSignature(form); FieldSignature field_signature = CalculateFieldSignatureForField(form.fields[0]); FieldSignature confirmation_field_signature = CalculateFieldSignatureForField(form.fields[1]); PasswordFormGenerationData input(form_signature, field_signature); input.confirmation_field_signature.emplace(confirmation_field_signature); base::RunLoop loop; mojom::TypeTraitsTestPtr proxy = GetTypeTraitsTestProxy(); proxy->PassPasswordFormGenerationData( input, base::Bind(&ExpectPasswordFormGenerationData, input, loop.QuitClosure())); loop.Run(); } TEST_F(AutofillTypeTraitsTestImpl, PassPasswordForm) { PasswordForm input; CreateTestPasswordForm(&input); base::RunLoop loop; mojom::TypeTraitsTestPtr proxy = GetTypeTraitsTestProxy(); proxy->PassPasswordForm( input, base::Bind(&ExpectPasswordForm, input, loop.QuitClosure())); loop.Run(); } TEST_F(AutofillTypeTraitsTestImpl, PassFormsPredictionsMap) { FormsPredictionsMap input; CreateTestFormsPredictionsMap(&input); base::RunLoop loop; mojom::TypeTraitsTestPtr proxy = GetTypeTraitsTestProxy(); proxy->PassFormsPredictionsMap( input, base::Bind(&ExpectFormsPredictionsMap, input, loop.QuitClosure())); loop.Run(); } } // namespace autofill
37.9819
80
0.719621
[ "vector" ]
d4be793b87c2c20f23cc110a430dc6e96bafcd17
2,488
cpp
C++
spmv/crs/spmv.cpp
ada-hackathon/team05
561cc3669b0b4e537e82817e87ebfd25e8912e6d
[ "BSD-3-Clause" ]
null
null
null
spmv/crs/spmv.cpp
ada-hackathon/team05
561cc3669b0b4e537e82817e87ebfd25e8912e6d
[ "BSD-3-Clause" ]
null
null
null
spmv/crs/spmv.cpp
ada-hackathon/team05
561cc3669b0b4e537e82817e87ebfd25e8912e6d
[ "BSD-3-Clause" ]
null
null
null
/* Based on algorithm described here: http://www.cs.berkeley.edu/~mhoemmen/matrix-seminar/slides/UCB_sparse_tutorial_1.pdf */ #include "spmv.h" #include "xcl2.hpp" void spmv(TYPE val[NNZ], int32_t cols[NNZ], int32_t rowDelimiters[N_MAT+1], TYPE vec[N_MAT], TYPE out[N_MAT]){ //OPENCL HOST CODE AREA START std::vector<cl::Device> devices = xcl::get_xil_devices(); cl::Device device = devices[0]; cl::Context context(device); cl::CommandQueue q(context, device, CL_QUEUE_PROFILING_ENABLE); std::string device_name = device.getInfo<CL_DEVICE_NAME>(); //Create Program and Kernel std::string binaryFile = xcl::find_binary_file(device_name,"spmv"); cl::Program::Binaries bins = xcl::import_binary_file(binaryFile); devices.resize(1); cl::Program program(context, devices, bins); cl::Kernel krnl_spmv(program,"spmv"); //Allocate Buffer in Global Memory cl::Buffer buffer_val (context, CL_MEM_READ_ONLY, NNZ * sizeof(TYPE)); cl::Buffer buffer_cols (context, CL_MEM_READ_ONLY, (NNZ) * sizeof(int32_t)); cl::Buffer buffer_rowDelimiters (context, CL_MEM_READ_ONLY, (N_MAT+1) * sizeof(int32_t)); cl::Buffer buffer_vec (context, CL_MEM_READ_ONLY, (N_MAT) * sizeof(TYPE)); cl::Buffer buffer_out(context, CL_MEM_WRITE_ONLY, N_MAT * sizeof(TYPE)); //Copy input data to device global memory q.enqueueWriteBuffer(buffer_val, CL_TRUE, 0, NNZ * sizeof(TYPE), val); q.enqueueWriteBuffer(buffer_cols, CL_TRUE, 0, NNZ * sizeof(int32_t), cols); q.enqueueWriteBuffer(buffer_rowDelimiters, CL_TRUE, 0, (N_MAT+1) * sizeof(int32_t), rowDelimiters); q.enqueueWriteBuffer(buffer_vec, CL_TRUE, 0, (N_MAT) * sizeof(TYPE), vec); // int inc = INCR_VALUE; //Set the Kernel Arguments int narg=0; krnl_spmv.setArg(narg++,buffer_val); krnl_spmv.setArg(narg++,buffer_cols); krnl_spmv.setArg(narg++,buffer_rowDelimiters); krnl_spmv.setArg(narg++,buffer_vec); krnl_spmv.setArg(narg++,buffer_out); printf("Launching kernel\n"); //Launch the Kernel q.enqueueNDRangeKernel(krnl_spmv,cl::NullRange,cl::NDRange(N_MAT, 1),cl::NDRange(1, 1)); printf("Finished kernel\n"); //Copy Result from Device Global Memory to Host Local Memory q.enqueueReadBuffer(buffer_out, CL_TRUE, 0, N_MAT * sizeof(TYPE), out); printf("Finished reading results\n"); q.finish(); }
38.875
110
0.677653
[ "vector" ]
d4c00fb8915c886e8852939088d73cfa8d3b707c
1,363
cpp
C++
Train/Sheet/Sheet-B/base/60-80/61-70/65.Mr. Kitayuta's Colorful Graph.cpp
mohamedGamalAbuGalala/Practice
2a5fa3bdaf995d0c304f04231e1a69e6960f72c8
[ "MIT" ]
1
2019-12-19T06:51:20.000Z
2019-12-19T06:51:20.000Z
Train/Sheet/Sheet-B/base/60-80/61-70/65.Mr. Kitayuta's Colorful Graph.cpp
mohamedGamalAbuGalala/Practice
2a5fa3bdaf995d0c304f04231e1a69e6960f72c8
[ "MIT" ]
null
null
null
Train/Sheet/Sheet-B/base/60-80/61-70/65.Mr. Kitayuta's Colorful Graph.cpp
mohamedGamalAbuGalala/Practice
2a5fa3bdaf995d0c304f04231e1a69e6960f72c8
[ "MIT" ]
null
null
null
#include <bits/stdc++.h> using namespace std; void fl() { #ifndef ONLINE_JUDGE freopen("in.txt", "r", stdin); // freopen("ot.txt", "w", stdout); #else // freopen("jumping.in", "r", stdin); // HERE #endif } typedef vector<int> vi; #define in(n) scanf("%d",&n) //scan int #define ot(x) printf("%d", x) //output int #define ln() printf("\n") //output new line int i, j, k; #define forr(i,j, n) for(i = j;i < n;i++) #define frr(i,j, n) for(i = j;i >= n;i--) #define pb push_back #define mem(a,b) memset(a,b,sizeof(a)) #define sz(v) ((int)((v).size())) // eg... vector<int> v; sz(v) //////////////////////////////////////////////////////////////////////////////////////////////// // snippet :: dinp , dhelp , dvec , lli , dfor , dcons , dbit vi ar[101][101]; int vis[101]; int bfs(int s, int e, int col, int sz = 1, int cur = 0) { queue<int> q; q.push(s); for (; sz(q); sz = sz(q)) while (sz--) { cur = q.front(), q.pop(); if (cur == e) return 1; for (auto it : ar[col][cur]) if (!vis[it]) vis[it] = 1, q.push(it); } return 0; } int main() { // dfil fl(); //TODO int n, m, u, v, c, q, ans = 0; in(n), in(m); forr(i,0,m and in(u) and in(v) and in(c)) ar[c][u].pb(v), ar[c][v].pb(u); in(q); forr(i,0,q and in(u) and in(v)) { ans = 0; forr(j,0,m+1) mem(vis, 0), ans += bfs(u, v, j); ot(ans), ln(); } return 0; }
22.716667
96
0.495965
[ "vector" ]
d4c073123f30c4e9cf9336b583666a72118c9d89
655
hpp
C++
src/gaia/DebugDraw.hpp
tomrosling/gaia
cb26e9951d399a402d4ab4deca5f75b64cf13700
[ "MIT" ]
null
null
null
src/gaia/DebugDraw.hpp
tomrosling/gaia
cb26e9951d399a402d4ab4deca5f75b64cf13700
[ "MIT" ]
null
null
null
src/gaia/DebugDraw.hpp
tomrosling/gaia
cb26e9951d399a402d4ab4deca5f75b64cf13700
[ "MIT" ]
null
null
null
#pragma once namespace gaia { class Renderer; class DebugDraw { public: struct DebugVertex; static DebugDraw& Instance() { static DebugDraw inst; return inst; } void Init(Renderer& renderer); void Render(Renderer& renderer); void Point(Vec3f pos, float halfSize, Vec4u8 col); void Lines(int numPoints, const Vec3f* points, Vec4u8 col); private: ComPtr<ID3D12PipelineState> m_pipelineState; ComPtr<ID3D12Resource> m_doubleVertexBuffer[2]; ComPtr<ID3D12Resource> m_uploadBuffer; DebugVertex* m_mappedVertexBuffer = nullptr; int m_currentBuffer = 0; int m_usedVertices = 0; }; }
19.264706
63
0.69771
[ "render" ]
d4c6ed646a67f1cc5cebb476c8c30d56d6e01e65
557
cpp
C++
codeforces/467B.cpp
sgrade/cpptest
84ade6ec03ea394d4a4489c7559d12b4799c0b62
[ "MIT" ]
null
null
null
codeforces/467B.cpp
sgrade/cpptest
84ade6ec03ea394d4a4489c7559d12b4799c0b62
[ "MIT" ]
null
null
null
codeforces/467B.cpp
sgrade/cpptest
84ade6ec03ea394d4a4489c7559d12b4799c0b62
[ "MIT" ]
null
null
null
// B. Fedor and New Game #include <iostream> #include <vector> #include <bitset> #include <algorithm> using namespace std; int main(){ size_t n; int m, k; cin >> n >> m >> k; int tmp; vector< bitset<20> > v(m+1); for (int i=0; i<m+1; ++i){ cin >> tmp; v[i] = bitset<20>(tmp); } int friends = 0; for (auto it=v.rbegin()+1; it != v.rend(); it++){ auto result = v[m] ^ *it; if (result.count() <= k){ ++friends; } } cout << friends << endl; return 0; }
15.914286
53
0.472172
[ "vector" ]
d4c7e635c4579b4456df1a7328073658f3c25db6
7,745
cpp
C++
Software/STM32CubeDemo/RotaryEncoderWithDisplay/Middlewares/ST/touchgfx/framework/source/touchgfx/widgets/canvas/Line.cpp
MitkoDyakov/RED
3bacb4df47867bbbf23c3c02d0ea1f8faa8d5779
[ "MIT" ]
15
2021-09-21T13:55:54.000Z
2022-03-08T14:05:39.000Z
Software/STM32CubeDemo/RotaryEncoderWithDisplay/Middlewares/ST/touchgfx/framework/source/touchgfx/widgets/canvas/Line.cpp
DynamixYANG/Roendi
2f6703d63922071fd0dfc8e4d2c9bba95ea04f08
[ "MIT" ]
7
2021-09-22T07:56:52.000Z
2022-03-21T17:39:34.000Z
Software/STM32CubeDemo/RotaryEncoderWithDisplay/Middlewares/ST/touchgfx/framework/source/touchgfx/widgets/canvas/Line.cpp
DynamixYANG/Roendi
2f6703d63922071fd0dfc8e4d2c9bba95ea04f08
[ "MIT" ]
1
2022-03-07T07:51:50.000Z
2022-03-07T07:51:50.000Z
/****************************************************************************** * Copyright (c) 2018(-2021) STMicroelectronics. * All rights reserved. * * This file is part of the TouchGFX 4.17.0 distribution. * * This software is licensed under terms that can be found in the LICENSE file in * the root directory of this software component. * If no LICENSE file comes with this software, it is provided AS-IS. * *******************************************************************************/ #include <touchgfx/hal/Types.hpp> #include <touchgfx/Drawable.hpp> #include <touchgfx/widgets/canvas/CWRUtil.hpp> #include <touchgfx/widgets/canvas/Canvas.hpp> #include <touchgfx/widgets/canvas/CanvasWidget.hpp> #include <touchgfx/widgets/canvas/Line.hpp> namespace touchgfx { Line::Line() : CanvasWidget(), startX(0), startY(0), endX(0), endY(0), lineWidth(CWRUtil::toQ5<int>(1)), lineEnding(BUTT_CAP_ENDING), minimalRect(), lineCapArcIncrement(18) { Drawable::setWidthHeight(0, 0); } void Line::setStart(CWRUtil::Q5 xQ5, CWRUtil::Q5 yQ5) { if (startX == xQ5 && startY == yQ5) { return; } startX = xQ5; startY = yQ5; updateCachedShape(); } void Line::updateStart(CWRUtil::Q5 xQ5, CWRUtil::Q5 yQ5) { if (startX == xQ5 && startY == yQ5) { return; } Rect rectBefore = getMinimalRect(); invalidateRect(rectBefore); startX = xQ5; startY = yQ5; updateCachedShape(); Rect rectAfter = getMinimalRect(); invalidateRect(rectAfter); } void Line::setEnd(CWRUtil::Q5 xQ5, CWRUtil::Q5 yQ5) { if (endX == xQ5 && endY == yQ5) { return; } endX = xQ5; endY = yQ5; updateCachedShape(); } void Line::updateEnd(CWRUtil::Q5 xQ5, CWRUtil::Q5 yQ5) { if (endX == xQ5 && endY == yQ5) { return; } Rect rectBefore = getMinimalRect(); invalidateRect(rectBefore); endX = xQ5; endY = yQ5; updateCachedShape(); Rect rectAfter = getMinimalRect(); invalidateRect(rectAfter); } void Line::setLineEndingStyle(Line::LINE_ENDING_STYLE lineEndingStyle) { lineEnding = lineEndingStyle; updateCachedShape(); } Line::LINE_ENDING_STYLE Line::getLineEndingStyle() const { return lineEnding; } void Line::setCapPrecision(int precision) { if (precision < 1) { precision = 1; } if (precision > 180) { precision = 180; } lineCapArcIncrement = precision; } bool Line::drawCanvasWidget(const Rect& invalidatedArea) const { Canvas canvas(this, invalidatedArea); CWRUtil::Q5 radius; int angleInDegrees = CWRUtil::angle(xCorner[0] - startX, yCorner[0] - startY, radius); canvas.moveTo(xCorner[0], yCorner[0]); canvas.lineTo(xCorner[1], yCorner[1]); if (lineEnding == ROUND_CAP_ENDING) { // Fixed 10 steps (steps 0 and 9 are at Corner[1] and [2]) for (int i = lineCapArcIncrement; i < 180; i += lineCapArcIncrement) { canvas.lineTo(endX + radius * CWRUtil::sine(angleInDegrees - i), endY - radius * CWRUtil::cosine(angleInDegrees - i)); } } canvas.lineTo(xCorner[2], yCorner[2]); canvas.lineTo(xCorner[3], yCorner[3]); if (lineEnding == ROUND_CAP_ENDING) { // Fixed 10 steps (steps 0 and 9 are at Corner[3] and [0]) for (int i = 180 - lineCapArcIncrement; i > 0; i -= lineCapArcIncrement) { canvas.lineTo(startX + radius * CWRUtil::sine(angleInDegrees + i), startY - radius * CWRUtil::cosine(angleInDegrees + i)); } } return canvas.render(); } void Line::updateCachedShape() { CWRUtil::Q5 dx = endX - startX; CWRUtil::Q5 dy = endY - startY; CWRUtil::Q5 d = CWRUtil::toQ5<int>(0); // Look for horizontal, vertical or no-line if ((int32_t)dx == 0) { if ((int32_t)dy == 0) { xCorner[0] = xCorner[1] = xCorner[2] = xCorner[3] = startX; yCorner[0] = yCorner[1] = yCorner[2] = yCorner[3] = startY; return; } d = abs(dy); } else if ((int32_t)dy == 0) { d = abs(dx); } else { // We want to hit as close to the limit inside 32bits. // sqrt(0x7FFFFFFF / 2) = 46340, which is roughly toQ5(1448) static const int32_t MAXVAL = 46340; int32_t common_divisor = gcd(abs((int32_t)dx), abs((int32_t)dy)); // First try to scale down if (common_divisor != 1) { dx = CWRUtil::Q5((int32_t)dx / common_divisor); dy = CWRUtil::Q5((int32_t)dy / common_divisor); } // Neither dx or dy is zero, find the largest multiplier / smallest divisor to stay within limit if (abs((int32_t)dx) <= MAXVAL || abs((int32_t)dy) <= MAXVAL) { // Look for largest multiplier int32_t mulx = MAXVAL / abs((int32_t)dx); int32_t muly = MAXVAL / abs((int32_t)dy); int32_t mult = MIN(mulx, muly); dx = CWRUtil::Q5(mult * (int32_t)dx); dy = CWRUtil::Q5(mult * (int32_t)dy); } else { // Look for smallest divisor int32_t divx = abs((int32_t)dx) / MAXVAL; int32_t divy = abs((int32_t)dy) / MAXVAL; int32_t divi = MAX(divx, divy) + 1; dx = CWRUtil::Q5((int32_t)dx / divi); dy = CWRUtil::Q5((int32_t)dy / divi); } d = CWRUtil::length(dx, dy); } dy = CWRUtil::muldivQ5(lineWidth, dy, d) / 2; dx = CWRUtil::muldivQ5(lineWidth, dx, d) / 2; switch (lineEnding) { case BUTT_CAP_ENDING: xCorner[0] = startX - dy; yCorner[0] = startY + dx; xCorner[1] = endX - dy; yCorner[1] = endY + dx; xCorner[2] = endX + dy; yCorner[2] = endY - dx; xCorner[3] = startX + dy; yCorner[3] = startY - dx; break; case ROUND_CAP_ENDING: // Nothing cached, calculated on each draw, but extremes are same as SQUARE_CAP_ENDING, so // Fall Through (for calculations) default: case SQUARE_CAP_ENDING: xCorner[0] = startX - dy - dx; yCorner[0] = startY + dx - dy; xCorner[1] = endX - dy + dx; yCorner[1] = endY + dx + dy; xCorner[2] = endX + dy + dx; yCorner[2] = endY - dx + dy; xCorner[3] = startX + dy - dx; yCorner[3] = startY - dx - dy; break; } CWRUtil::Q5 xMin = xCorner[0]; CWRUtil::Q5 xMax = xCorner[0]; CWRUtil::Q5 yMin = yCorner[0]; CWRUtil::Q5 yMax = yCorner[0]; for (int i = 1; i < 4; i++) { if (xCorner[i] < xMin) { xMin = xCorner[i]; } if (xCorner[i] > xMax) { xMax = xCorner[i]; } if (yCorner[i] < yMin) { yMin = yCorner[i]; } if (yCorner[i] > yMax) { yMax = yCorner[i]; } } int16_t minX = xMin.to<int>(); int16_t minY = yMin.to<int>(); int16_t maxX = xMax.to<int>(); int16_t maxY = yMax.to<int>(); minimalRect = Rect(minX, minY, maxX - minX + 1, maxY - minY + 1); if (lineEnding == ROUND_CAP_ENDING) { xCorner[0] = startX - dy; yCorner[0] = startY + dx; xCorner[1] = endX - dy; yCorner[1] = endY + dx; xCorner[2] = endX + dy; yCorner[2] = endY - dx; xCorner[3] = startX + dy; yCorner[3] = startY - dx; } } Rect Line::getMinimalRect() const { return minimalRect; } void Line::updateLengthAndAngle(CWRUtil::Q5 length, CWRUtil::Q5 angle) { updateEnd(startX + length * CWRUtil::sine(angle), startY - length * CWRUtil::cosine(angle)); } } // namespace touchgfx
26.799308
134
0.557779
[ "render" ]
d4cbeaee7a5e188b648deea1dd3b733988868e4e
4,850
hpp
C++
ShadowPeople/dx11/CommandBufferImpl.hpp
SamuelSiltanen/ShadowPeople
58f94a4397dc5084d9705d4378599cae480b4776
[ "Apache-2.0" ]
null
null
null
ShadowPeople/dx11/CommandBufferImpl.hpp
SamuelSiltanen/ShadowPeople
58f94a4397dc5084d9705d4378599cae480b4776
[ "Apache-2.0" ]
null
null
null
ShadowPeople/dx11/CommandBufferImpl.hpp
SamuelSiltanen/ShadowPeople
58f94a4397dc5084d9705d4378599cae480b4776
[ "Apache-2.0" ]
null
null
null
/* Copyright 2018 Samuel Siltanen CommandBufferImpl.hpp */ #pragma once #include <d3d11.h> #include <cstdint> #include "DX11Utils.hpp" #include "../Types.hpp" #include "../Errors.hpp" namespace graphics { class DeviceImpl; class TextureImpl; class TextureViewImpl; class BufferImpl; class MappingImpl; class GraphicsPipelineImpl; class ComputePipelineImpl; class ResourceViewImpl; class Image; class CommandBufferImpl { public: CommandBufferImpl(DeviceImpl& device); NO_COPY_CLASS(CommandBufferImpl); void clear(TextureViewImpl& view, float r, float g, float b, float a); void clear(TextureViewImpl& view, uint32_t r, uint32_t g, uint32_t b, uint32_t a); void clear(TextureViewImpl& view, float depth); void clear(TextureViewImpl& view, float depth, uint8_t stencil); void clear(TextureViewImpl& view, uint8_t stencil); void copy(TextureImpl& dst, const TextureImpl& src); void copy(TextureImpl& dst, const TextureImpl& src, int3 dstCorner, Rect<int, 3> srcRect, Subresource dstSubresource, Subresource srcSubresource); void copyToBackBuffer(const TextureImpl& src); template<typename T> void copyToConstantBuffer(BufferImpl& dst, Range<const T> src) { D3D11_MAPPED_SUBRESOURCE mapping; HRESULT hr = m_context.Map(dst.m_buffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mapping); SP_ASSERT_HR(hr, ERROR_CODE_MAP_DISCARD_FAILED); memcpy(mapping.pData, src.begin(), src.byteSize()); m_context.Unmap(dst.m_buffer, 0); } void update(TextureImpl& dst, const Image& src, int2 dstCorner = { 0, 0 }, Rect<int, 2> srcRect = Rect<int, 2>(), Subresource dstSubresource = Subresource()); void update(BufferImpl& dst, Range<const uint8_t> cpuData, uint32_t dstOffset = 0); void setRenderTargets(); void setRenderTargets(TextureViewImpl& rtv); void setRenderTargets(TextureViewImpl& dsv, TextureViewImpl& rtv); void setVertexBuffer(); void setVertexBuffer(BufferImpl& buffer, GraphicsPipelineImpl& pipeline); void setIndexBuffer(); void setIndexBuffer(BufferImpl& buffer); std::shared_ptr<MappingImpl> map(BufferImpl& buf); void dispatch(ComputePipelineImpl& pipeline, uint32_t threadGroupsX, uint32_t threadGroupsY, uint32_t threadGroupsZ); void dispatchIndirect(ComputePipelineImpl& pipeline, const BufferImpl& argsBuffer, uint32_t argsOffset); void draw(GraphicsPipelineImpl& pipeline, uint32_t vertexCount, uint32_t startVertexOffset); void drawIndexed(GraphicsPipelineImpl& pipeline, uint32_t indexCount, uint32_t startIndexOffset, uint32_t vertexOffset); void drawInstanced(GraphicsPipelineImpl& pipeline, uint32_t vertexCountPerInstance, uint32_t instanceCount, uint32_t startVextexOffset, uint32_t startInstanceOffset); void drawIndexedInstanced(GraphicsPipelineImpl& pipeline, uint32_t vertexCountPerInstance, uint32_t instanceCount, uint32_t startVextexOffset, uint32_t vertexOffset, uint32_t startInstanceOffset); void drawInstancedIndirect(GraphicsPipelineImpl& pipeline, const BufferImpl& argsBuffer, uint32_t argsOffset); void drawIndexedInstancedIndirect(GraphicsPipelineImpl& pipeline, const BufferImpl& argsBuffer, uint32_t argsOffset); private: bool isSimilarForCopy(const TextureImpl& dst, const TextureImpl& src); void setupResources(ComputePipelineImpl& pipeline); void setupResources(GraphicsPipelineImpl& pipeline); void clearResources(ComputePipelineImpl& pipeline); void clearResources(GraphicsPipelineImpl& pipeline); void setViewport(); void setDepthStencilState(GraphicsPipelineImpl& pipeline); void setBlendState(GraphicsPipelineImpl& pipeline); void setPrimitiveTopology(GraphicsPipelineImpl& pipeline); void setRasterizerState(GraphicsPipelineImpl& pipeline); struct RenderTargets { std::vector<const ResourceViewImpl*> rtvs; const ResourceViewImpl* dsv; int2 renderTargetSize; }; RenderTargets m_currentRenderTargets; ID3D11DeviceContext& m_context; // TODO: Perhaps not the whole device - we don't want to allow resource creation here DeviceImpl& m_device; }; }
40.416667
115
0.657113
[ "vector" ]
d4dcf6f46ff6518350be6d4699bd1b94364b33f8
19,568
cc
C++
cpp_src/core/cbinding/reindexer_c.cc
andyoknen/reindexer
ff1b2bcc0a80c4692361c9c184243d74a920ead7
[ "Apache-2.0" ]
null
null
null
cpp_src/core/cbinding/reindexer_c.cc
andyoknen/reindexer
ff1b2bcc0a80c4692361c9c184243d74a920ead7
[ "Apache-2.0" ]
null
null
null
cpp_src/core/cbinding/reindexer_c.cc
andyoknen/reindexer
ff1b2bcc0a80c4692361c9c184243d74a920ead7
[ "Apache-2.0" ]
null
null
null
#include "reindexer_c.h" #include <stdlib.h> #include <string.h> #include <locale> #include <mutex> #include "cgocancelcontextpool.h" #include "core/selectfunc/selectfuncparser.h" #include "core/transactionimpl.h" #include "debug/allocdebug.h" #include "estl/syncpool.h" #include "reindexer_version.h" #include "resultserializer.h" #include "tools/logger.h" #include "tools/semversion.h" #include "tools/stringstools.h" using namespace reindexer; using std::move; const int kQueryResultsPoolSize = 1024; const int kMaxConcurentQueries = 65534; const size_t kCtxArrSize = 1024; const size_t kWarnLargeResultsLimit = 0x40000000; const size_t kMaxPooledResultsCap = 0x10000; static Error err_not_init(-1, "Reindexer db has not initialized"); static Error err_too_many_queries(errLogic, "Too many parallel queries"); static reindexer_error error2c(const Error& err_) { reindexer_error err; err.code = err_.code(); #ifdef _WIN32 err.what = err_.what().length() ? _strdup(err_.what().c_str()) : nullptr; #else err.what = err_.what().length() ? strdup(err_.what().c_str()) : nullptr; #endif return err; } static reindexer_ret ret2c(const Error& err_, const reindexer_resbuffer& out) { reindexer_ret ret; ret.err_code = err_.code(); if (ret.err_code) { ret.out.results_ptr = 0; #ifdef _WIN32 ret.out.data = uintptr_t(err_.what().length() ? _strdup(err_.what().c_str()) : nullptr); #else ret.out.data = uintptr_t(err_.what().length() ? strdup(err_.what().c_str()) : nullptr); #endif } else { ret.out = out; } return ret; } static string str2c(reindexer_string gs) { return string(reinterpret_cast<const char*>(gs.p), gs.n); } static string_view str2cv(reindexer_string gs) { return string_view(reinterpret_cast<const char*>(gs.p), gs.n); } struct QueryResultsWrapper : QueryResults { WrResultSerializer ser; }; struct TransactionWrapper { TransactionWrapper(Transaction&& tr) : tr_(std::move(tr)) {} WrResultSerializer ser_; Transaction tr_; }; static sync_pool<QueryResultsWrapper, kQueryResultsPoolSize, kMaxConcurentQueries> res_pool; static CGOCtxPool ctx_pool(kCtxArrSize); static void put_results_to_pool(QueryResultsWrapper* res) { res->Clear(); if (res->ser.Cap() > kMaxPooledResultsCap) { res->ser = WrResultSerializer(); } else { res->ser.Reset(); } res_pool.put(res); } static QueryResultsWrapper* new_results() { return res_pool.get(); } static void results2c(QueryResultsWrapper* result, struct reindexer_resbuffer* out, int as_json = 0, int32_t* pt_versions = nullptr, int pt_versions_count = 0) { int flags = as_json ? kResultsJson : (kResultsPtrs | kResultsWithItemID); flags |= (pt_versions && as_json == 0) ? kResultsWithPayloadTypes : 0; result->ser.SetOpts({flags, span<int32_t>(pt_versions, pt_versions_count), 0, INT_MAX}); result->ser.PutResults(result); out->len = result->ser.Len(); out->data = uintptr_t(result->ser.Buf()); out->results_ptr = uintptr_t(result); } uintptr_t init_reindexer() { Reindexer* db = new Reindexer(); setvbuf(stdout, 0, _IONBF, 0); setvbuf(stderr, 0, _IONBF, 0); setlocale(LC_CTYPE, ""); setlocale(LC_NUMERIC, "C"); return reinterpret_cast<uintptr_t>(db); } void destroy_reindexer(uintptr_t rx) { auto db = reinterpret_cast<Reindexer*>(rx); delete db; db = nullptr; } reindexer_error reindexer_ping(uintptr_t rx) { auto db = reinterpret_cast<Reindexer*>(rx); return error2c(db ? Error(errOK) : err_not_init); } static void procces_packed_item(Item& item, int mode, int state_token, reindexer_buffer data, const vector<string>& precepts, int format, Error& err) { if (item.Status().ok()) { switch (format) { case FormatJson: err = item.FromJSON(string_view(reinterpret_cast<const char*>(data.data), data.len), 0, mode == ModeDelete); break; case FormatCJson: if (item.GetStateToken() != state_token) { err = Error(errStateInvalidated, "stateToken mismatch: %08X, need %08X. Can't process item", state_token, item.GetStateToken()); } else { err = item.FromCJSON(string_view(reinterpret_cast<const char*>(data.data), data.len), mode == ModeDelete); } break; default: err = Error(-1, "Invalid source item format %d", format); } if (err.ok()) { item.SetPrecepts(precepts); } } else { err = item.Status(); } } reindexer_error reindexer_modify_item_packed_tx(uintptr_t rx, uintptr_t tr, reindexer_buffer args, reindexer_buffer data) { auto db = reinterpret_cast<Reindexer*>(rx); TransactionWrapper* trw = reinterpret_cast<TransactionWrapper*>(tr); if (!db) { return error2c(err_not_init); } if (!tr) { return error2c(errOK); } Serializer ser(args.data, args.len); int format = ser.GetVarUint(); int mode = ser.GetVarUint(); int state_token = ser.GetVarUint(); unsigned preceptsCount = ser.GetVarUint(); vector<string> precepts; while (preceptsCount--) { precepts.push_back(string(ser.GetVString())); } Error err = err_not_init; auto item = trw->tr_.NewItem(); procces_packed_item(item, mode, state_token, data, precepts, format, err); if (err.code() == errTagsMissmatch) { item = db->NewItem(trw->tr_.GetName()); err = item.Status(); if (err.ok()) { procces_packed_item(item, mode, state_token, data, precepts, format, err); } } if (err.ok()) { trw->tr_.Modify(std::move(item), ItemModifyMode(mode)); } return error2c(err); } reindexer_ret reindexer_modify_item_packed(uintptr_t rx, reindexer_buffer args, reindexer_buffer data, reindexer_ctx_info ctx_info) { Serializer ser(args.data, args.len); string_view ns = ser.GetVString(); int format = ser.GetVarUint(); int mode = ser.GetVarUint(); int state_token = ser.GetVarUint(); unsigned preceptsCount = ser.GetVarUint(); vector<string> precepts; while (preceptsCount--) { precepts.push_back(string(ser.GetVString())); } reindexer_resbuffer out = {0, 0, 0}; Error err = err_not_init; if (rx) { CGORdxCtxKeeper rdxKeeper(rx, ctx_info, ctx_pool); Item item = rdxKeeper.db().NewItem(ns); procces_packed_item(item, mode, state_token, data, precepts, format, err); if (err.ok()) { switch (mode) { case ModeUpsert: err = rdxKeeper.db().Upsert(ns, item); break; case ModeInsert: err = rdxKeeper.db().Insert(ns, item); break; case ModeUpdate: err = rdxKeeper.db().Update(ns, item); break; case ModeDelete: err = rdxKeeper.db().Delete(ns, item); break; } } if (err.ok()) { QueryResultsWrapper* res = new_results(); if (!res) { return ret2c(err_too_many_queries, out); } res->AddItem(item, !precepts.empty()); int32_t ptVers = -1; bool tmUpdated = item.IsTagsUpdated(); results2c(res, &out, 0, tmUpdated ? &ptVers : nullptr, tmUpdated ? 1 : 0); } } return ret2c(err, out); } reindexer_tx_ret reindexer_start_transaction(uintptr_t rx, reindexer_string nsName) { auto db = reinterpret_cast<Reindexer*>(rx); reindexer_tx_ret ret{0, {nullptr, 0}}; if (!db) { ret.err = error2c(err_not_init); return ret; } Transaction tr = db->NewTransaction(str2cv(nsName)); if (tr.Status().ok()) { auto trw = new TransactionWrapper(move(tr)); ret.tx_id = reinterpret_cast<uintptr_t>(trw); } else { ret.err = error2c(tr.Status()); } return ret; } reindexer_error reindexer_rollback_transaction(uintptr_t rx, uintptr_t tr) { auto db = reinterpret_cast<Reindexer*>(rx); if (!db) { return error2c(err_not_init); } auto trw = std::unique_ptr<TransactionWrapper>(reinterpret_cast<TransactionWrapper*>(tr)); if (!trw) { return error2c(errOK); } auto err = db->RollBackTransaction(trw->tr_); return error2c(err); } reindexer_ret reindexer_commit_transaction(uintptr_t rx, uintptr_t tr, reindexer_ctx_info ctx_info) { reindexer_resbuffer out = {0, 0, 0}; if (!rx) { return ret2c(err_not_init, out); } std::unique_ptr<TransactionWrapper> trw(reinterpret_cast<TransactionWrapper*>(tr)); if (!trw) { return ret2c(errOK, out); } std::unique_ptr<QueryResultsWrapper> res(new_results()); if (!res) { return ret2c(err_too_many_queries, out); } CGORdxCtxKeeper rdxKeeper(rx, ctx_info, ctx_pool); auto err = rdxKeeper.db().CommitTransaction(trw->tr_, *res); if (err.ok()) { int32_t ptVers = -1; results2c(res.release(), &out, 0, trw->tr_.IsTagsUpdated() ? &ptVers : nullptr, trw->tr_.IsTagsUpdated() ? 1 : 0); } return ret2c(err, out); } reindexer_error reindexer_open_namespace(uintptr_t rx, reindexer_string nsName, StorageOpts opts, reindexer_ctx_info ctx_info) { Error res = err_not_init; if (rx) { CGORdxCtxKeeper rdxKeeper(rx, ctx_info, ctx_pool); res = rdxKeeper.db().OpenNamespace(str2cv(nsName), opts); } return error2c(res); } reindexer_error reindexer_drop_namespace(uintptr_t rx, reindexer_string nsName, reindexer_ctx_info ctx_info) { Error res = err_not_init; if (rx) { CGORdxCtxKeeper rdxKeeper(rx, ctx_info, ctx_pool); res = rdxKeeper.db().DropNamespace(str2cv(nsName)); } return error2c(res); } reindexer_error reindexer_truncate_namespace(uintptr_t rx, reindexer_string nsName, reindexer_ctx_info ctx_info) { Error res = err_not_init; if (rx) { CGORdxCtxKeeper rdxKeeper(rx, ctx_info, ctx_pool); res = rdxKeeper.db().TruncateNamespace(str2cv(nsName)); } return error2c(res); } reindexer_error reindexer_rename_namespace(uintptr_t rx, reindexer_string srcNsName, reindexer_string dstNsName, reindexer_ctx_info ctx_info) { Error res = err_not_init; if (rx) { CGORdxCtxKeeper rdxKeeper(rx, ctx_info, ctx_pool); res = rdxKeeper.db().RenameNamespace(str2cv(srcNsName), str2c(dstNsName)); } return error2c(res); } reindexer_error reindexer_close_namespace(uintptr_t rx, reindexer_string nsName, reindexer_ctx_info ctx_info) { Error res = err_not_init; if (rx) { CGORdxCtxKeeper rdxKeeper(rx, ctx_info, ctx_pool); res = rdxKeeper.db().CloseNamespace(str2cv(nsName)); } return error2c(res); } reindexer_error reindexer_add_index(uintptr_t rx, reindexer_string nsName, reindexer_string indexDefJson, reindexer_ctx_info ctx_info) { Error res = err_not_init; if (rx) { CGORdxCtxKeeper rdxKeeper(rx, ctx_info, ctx_pool); string json(str2cv(indexDefJson)); IndexDef indexDef; auto err = indexDef.FromJSON(giftStr(json)); if (!err.ok()) { return error2c(err); } res = rdxKeeper.db().AddIndex(str2cv(nsName), indexDef); } return error2c(res); } reindexer_error reindexer_update_index(uintptr_t rx, reindexer_string nsName, reindexer_string indexDefJson, reindexer_ctx_info ctx_info) { Error res = err_not_init; if (rx) { CGORdxCtxKeeper rdxKeeper(rx, ctx_info, ctx_pool); string json(str2cv(indexDefJson)); IndexDef indexDef; auto err = indexDef.FromJSON(giftStr(json)); if (!err.ok()) { return error2c(err); } res = rdxKeeper.db().UpdateIndex(str2cv(nsName), indexDef); } return error2c(res); } reindexer_error reindexer_drop_index(uintptr_t rx, reindexer_string nsName, reindexer_string index, reindexer_ctx_info ctx_info) { Error res = err_not_init; if (rx) { CGORdxCtxKeeper rdxKeeper(rx, ctx_info, ctx_pool); res = rdxKeeper.db().DropIndex(str2cv(nsName), IndexDef(str2c(index))); } return error2c(res); } reindexer_error reindexer_set_schema(uintptr_t rx, reindexer_string nsName, reindexer_string schemaJson, reindexer_ctx_info ctx_info) { Error res = err_not_init; if (rx) { CGORdxCtxKeeper rdxKeeper(rx, ctx_info, ctx_pool); res = rdxKeeper.db().SetSchema(str2cv(nsName), str2cv(schemaJson)); } return error2c(res); } reindexer_error reindexer_enable_storage(uintptr_t rx, reindexer_string path, reindexer_ctx_info ctx_info) { Error res = err_not_init; if (rx) { CGORdxCtxKeeper rdxKeeper(rx, ctx_info, ctx_pool); res = rdxKeeper.db().EnableStorage(str2c(path)); } return error2c(res); } reindexer_error reindexer_connect(uintptr_t rx, reindexer_string dsn, ConnectOpts opts, reindexer_string client_vers) { if (opts.options & kConnectOptWarnVersion) { SemVersion cliVersion(str2cv(client_vers)); SemVersion libVersion(REINDEX_VERSION); if (cliVersion != libVersion) { std::cerr << "Warning: Used Reindexer client version: " << str2cv(client_vers) << " with library version: " << REINDEX_VERSION << ". It is strongly recommended to sync client & library versions" << std::endl; } } Reindexer* db = reinterpret_cast<Reindexer*>(rx); if (!db) return error2c(err_not_init); Error err = db->Connect(str2c(dsn), opts); if (err.ok() && db->NeedTraceActivity()) db->SetActivityTracer("builtin", ""); return error2c(err); } reindexer_error reindexer_init_system_namespaces(uintptr_t rx) { Reindexer* db = reinterpret_cast<Reindexer*>(rx); if (!db) return error2c(err_not_init); Error err = db->InitSystemNamespaces(); if (err.ok() && db->NeedTraceActivity()) db->SetActivityTracer("builtin", ""); return error2c(err); } reindexer_ret reindexer_select(uintptr_t rx, reindexer_string query, int as_json, int32_t* pt_versions, int pt_versions_count, reindexer_ctx_info ctx_info) { reindexer_resbuffer out = {0, 0, 0}; Error res = err_not_init; if (rx) { CGORdxCtxKeeper rdxKeeper(rx, ctx_info, ctx_pool); auto result = new_results(); if (!result) { return ret2c(err_too_many_queries, out); } res = rdxKeeper.db().Select(str2cv(query), *result); if (res.ok()) { results2c(result, &out, as_json, pt_versions, pt_versions_count); if (result->ser.Cap() >= kWarnLargeResultsLimit) { logPrintf(LogWarning, "Query too large results: count=%d size=%d,cap=%d, q=%s", result->Count(), result->ser.Len(), result->ser.Cap(), str2cv(query)); } } else { put_results_to_pool(result); } } return ret2c(res, out); } reindexer_ret reindexer_select_query(uintptr_t rx, struct reindexer_buffer in, int as_json, int32_t* pt_versions, int pt_versions_count, reindexer_ctx_info ctx_info) { Error res = err_not_init; reindexer_resbuffer out = {0, 0, 0}; if (rx) { res = Error(errOK); Serializer ser(in.data, in.len); CGORdxCtxKeeper rdxKeeper(rx, ctx_info, ctx_pool); Query q; q.Deserialize(ser); while (!ser.Eof()) { JoinedQuery q1; q1.joinType = JoinType(ser.GetVarUint()); q1.Deserialize(ser); q1.debugLevel = q.debugLevel; if (q1.joinType == JoinType::Merge) { q.mergeQueries_.emplace_back(std::move(q1)); } else { q.joinQueries_.emplace_back(std::move(q1)); } } QueryResultsWrapper* result = new_results(); if (!result) { return ret2c(err_too_many_queries, out); } res = rdxKeeper.db().Select(q, *result); if (q.debugLevel >= LogError && res.code() != errOK) logPrintf(LogError, "Query error %s", res.what()); if (res.ok()) { results2c(result, &out, as_json, pt_versions, pt_versions_count); } else { if (result->ser.Cap() >= kWarnLargeResultsLimit) { logPrintf(LogWarning, "Query too large results: count=%d size=%d,cap=%d, q=%s", result->Count(), result->ser.Len(), result->ser.Cap(), q.GetSQL()); } put_results_to_pool(result); } } return ret2c(res, out); } reindexer_ret reindexer_delete_query(uintptr_t rx, reindexer_buffer in, reindexer_ctx_info ctx_info) { reindexer_resbuffer out{0, 0, 0}; Error res = err_not_init; if (rx) { res = Error(errOK); Serializer ser(in.data, in.len); CGORdxCtxKeeper rdxKeeper(rx, ctx_info, ctx_pool); Query q; q.type_ = QueryDelete; q.Deserialize(ser); QueryResultsWrapper* result = new_results(); if (!result) { return ret2c(err_too_many_queries, out); } res = rdxKeeper.db().Delete(q, *result); if (q.debugLevel >= LogError && res.code() != errOK) logPrintf(LogError, "Query error %s", res.what()); if (res.ok()) { results2c(result, &out); } else { put_results_to_pool(result); } ctx_pool.removeContext(ctx_info); } return ret2c(res, out); } reindexer_ret reindexer_update_query(uintptr_t rx, reindexer_buffer in, reindexer_ctx_info ctx_info) { reindexer_resbuffer out{0, 0, 0}; Error res = err_not_init; if (rx) { res = Error(errOK); Serializer ser(in.data, in.len); CGORdxCtxKeeper rdxKeeper(rx, ctx_info, ctx_pool); Query q; q.Deserialize(ser); q.type_ = QueryUpdate; QueryResultsWrapper* result = new_results(); if (!result) { ctx_pool.removeContext(ctx_info); return ret2c(err_too_many_queries, out); } res = rdxKeeper.db().Update(q, *result); if (q.debugLevel >= LogError && res.code() != errOK) logPrintf(LogError, "Query error %s", res.what()); if (res.ok()) { int32_t ptVers = -1; results2c(result, &out, 0, &ptVers, 1); } else { put_results_to_pool(result); } } return ret2c(res, out); } reindexer_error reindexer_delete_query_tx(uintptr_t rx, uintptr_t tr, reindexer_buffer in) { auto db = reinterpret_cast<Reindexer*>(rx); TransactionWrapper* trw = reinterpret_cast<TransactionWrapper*>(tr); if (!db) { return error2c(err_not_init); } if (!tr) { return error2c(errOK); } Serializer ser(in.data, in.len); Query q; q.Deserialize(ser); q.type_ = QueryDelete; trw->tr_.Modify(std::move(q)); return error2c(errOK); } reindexer_error reindexer_update_query_tx(uintptr_t rx, uintptr_t tr, reindexer_buffer in) { auto db = reinterpret_cast<Reindexer*>(rx); TransactionWrapper* trw = reinterpret_cast<TransactionWrapper*>(tr); if (!db) { return error2c(err_not_init); } if (!tr) { return error2c(errOK); } Serializer ser(in.data, in.len); Query q; q.Deserialize(ser); q.type_ = QueryUpdate; trw->tr_.Modify(std::move(q)); return error2c(errOK); } reindexer_error reindexer_put_meta(uintptr_t rx, reindexer_string ns, reindexer_string key, reindexer_string data, reindexer_ctx_info ctx_info) { Error res = err_not_init; if (rx) { CGORdxCtxKeeper rdxKeeper(rx, ctx_info, ctx_pool); res = rdxKeeper.db().PutMeta(str2c(ns), str2c(key), str2c(data)); } return error2c(res); } reindexer_ret reindexer_get_meta(uintptr_t rx, reindexer_string ns, reindexer_string key, reindexer_ctx_info ctx_info) { reindexer_resbuffer out{0, 0, 0}; Error res = err_not_init; if (rx) { CGORdxCtxKeeper rdxKeeper(rx, ctx_info, ctx_pool); QueryResultsWrapper* results = new_results(); if (!results) { return ret2c(err_too_many_queries, out); } string data; res = rdxKeeper.db().GetMeta(str2c(ns), str2c(key), data); results->ser.Write(data); out.len = results->ser.Len(); out.data = uintptr_t(results->ser.Buf()); out.results_ptr = uintptr_t(results); } return ret2c(res, out); } reindexer_error reindexer_commit(uintptr_t rx, reindexer_string nsName) { auto db = reinterpret_cast<Reindexer*>(rx); return error2c(!db ? err_not_init : db->Commit(str2cv(nsName))); } void reindexer_enable_logger(void (*logWriter)(int, char*)) { logInstallWriter(logWriter); } void reindexer_disable_logger() { logInstallWriter(nullptr); } reindexer_error reindexer_free_buffer(reindexer_resbuffer in) { put_results_to_pool(reinterpret_cast<QueryResultsWrapper*>(in.results_ptr)); return error2c(Error(errOK)); } reindexer_error reindexer_free_buffers(reindexer_resbuffer* in, int count) { for (int i = 0; i < count; i++) { reindexer_free_buffer(in[i]); } return error2c(Error(errOK)); } reindexer_error reindexer_cancel_context(reindexer_ctx_info ctx_info, ctx_cancel_type how) { auto howCPP = CancelType::None; switch (how) { case cancel_expilicitly: howCPP = CancelType::Explicit; break; case cancel_on_timeout: howCPP = CancelType::Timeout; break; default: assert(false); } if (ctx_pool.cancelContext(ctx_info, howCPP)) { return error2c(Error(errOK)); } return error2c(Error(errParams)); }
29.874809
139
0.71668
[ "vector" ]
d4e0137ee00a23de2629ab7e3b723173b51ed0e8
117,275
cpp
C++
wxWidgets-2.9.1/src/osx/carbon/dataview.cpp
gamekit-developers/gamekit
74c896af5826ebe8fb72f2911015738f38ab7bb2
[ "Zlib", "MIT" ]
241
2015-01-04T00:36:58.000Z
2022-01-06T19:19:23.000Z
wxWidgets-2.9.1/src/osx/carbon/dataview.cpp
gamekit-developers/gamekit
74c896af5826ebe8fb72f2911015738f38ab7bb2
[ "Zlib", "MIT" ]
10
2015-07-10T18:27:17.000Z
2019-06-26T20:59:59.000Z
wxWidgets-2.9.1/src/osx/carbon/dataview.cpp
gamekit-developers/gamekit
74c896af5826ebe8fb72f2911015738f38ab7bb2
[ "Zlib", "MIT" ]
82
2015-01-25T18:02:35.000Z
2022-03-05T12:28:17.000Z
///////////////////////////////////////////////////////////////////////////// // Name: src/osx/carbon/dataview.cpp // Purpose: wxDataViewCtrl native carbon implementation // Author: // Id: $Id: dataview.cpp 58317 2009-01-23 // Copyright: (c) 2009 // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" #if (wxUSE_DATAVIEWCTRL == 1) && !defined(wxUSE_GENERICDATAVIEWCTRL) #ifndef WX_PRECOMP #include "wx/app.h" #include "wx/toplevel.h" #include "wx/font.h" #include "wx/settings.h" #include "wx/utils.h" #endif #include "wx/osx/carbon/dataview.h" #include "wx/osx/private.h" #include "wx/osx/uma.h" #include "wx/renderer.h" #include <limits> // ============================================================================ // Variables used locally in dataview.cpp // ============================================================================ static DataBrowserGetContextualMenuUPP gDataBrowserTableViewGetContextualMenuUPP = NULL; static DataBrowserItemCompareUPP gDataBrowserTableViewItemCompareUPP = NULL; static DataBrowserItemDataUPP gDataBrowserTableViewItemDataUPP = NULL; static DataBrowserItemNotificationUPP gDataBrowserTableViewItemNotificationUPP = NULL; static DataBrowserAcceptDragUPP gDataBrowserTableViewAcceptDragUPP = NULL; static DataBrowserAddDragItemUPP gDataBrowserTableViewAddDragItemUPP = NULL; static DataBrowserReceiveDragUPP gDataBrowserTableViewReceiveDragUPP = NULL; static DataBrowserDrawItemUPP gDataBrowserTableViewDrawItemUPP = NULL; static DataBrowserEditItemUPP gDataBrowserTableViewEditItemUPP = NULL; static DataBrowserHitTestUPP gDataBrowserTableViewHitTestUPP = NULL; static DataBrowserTrackingUPP gDataBrowserTableViewTrackingUPP = NULL; // ============================================================================ // Functions used locally in dataview.cpp // ============================================================================ static DataBrowserItemID* CreateDataBrowserItemIDArray(size_t& noOfEntries, wxDataViewItemArray const& items) // returns a newly allocated pointer to valid data browser item IDs { size_t const noOfItems = items.GetCount(); DataBrowserItemID* itemIDs(new DataBrowserItemID[noOfItems]); // convert all valid data view items to data browser items noOfEntries = 0; for (size_t i=0; i<noOfItems; ++i) if (items[i].IsOk()) { itemIDs[noOfEntries] = reinterpret_cast<DataBrowserItemID>(items[i].GetID()); ++noOfEntries; } // done: return itemIDs; } static const EventTypeSpec eventList[] = { { kEventClassControl, kEventControlHit }, { kEventClassControl, kEventControlDraw } }; static pascal OSStatus DataBrowserCtrlEventHandler(EventHandlerCallRef handler, EventRef EventReference, void* Data) { wxDataViewCtrl* DataViewCtrlPtr((wxDataViewCtrl*) Data); // the 'Data' variable always contains a pointer to the data view control that installed the handler wxMacCarbonEvent CarbonEvent(EventReference) ; switch (GetEventKind(EventReference)) { case kEventControlDraw: { OSStatus status; DataViewCtrlPtr->MacSetDrawingContext(CarbonEvent.GetParameter<CGContextRef>(kEventParamCGContextRef,typeCGContextRef)); status = ::CallNextEventHandler(handler,EventReference); DataViewCtrlPtr->MacSetDrawingContext(NULL); return status; } case kEventControlHit : if (CarbonEvent.GetParameter<ControlPartCode>(kEventParamControlPart,typeControlPartCode) == kControlButtonPart) // we only care about the header { ControlRef controlReference; DataBrowserPropertyID columnPropertyID; DataBrowserSortOrder order; unsigned long columnIndex; wxDataViewColumn* column; OSStatus status; wxDataViewEvent DataViewEvent(wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_CLICK,DataViewCtrlPtr->GetId()); CarbonEvent.GetParameter(kEventParamDirectObject,&controlReference); // determine the column that triggered the event (this is the column that is responsible for sorting the data view): status = ::GetDataBrowserSortProperty(controlReference,&columnPropertyID); wxCHECK(status == noErr,status); status = ::GetDataBrowserTableViewColumnPosition(controlReference,columnPropertyID,&columnIndex); if (status == errDataBrowserPropertyNotFound) // user clicked into part of the header that does not have a property return ::CallNextEventHandler(handler,EventReference); wxCHECK(status == noErr,status); column = DataViewCtrlPtr->GetColumn(columnIndex); // set the column sort order: status = ::GetDataBrowserSortOrder(controlReference,&order); wxCHECK(status == noErr,status); column->SetSortOrderVariable(order == kDataBrowserOrderIncreasing); // initialize wxWidget event handler: DataViewEvent.SetEventObject(DataViewCtrlPtr); DataViewEvent.SetColumn(columnIndex); DataViewEvent.SetDataViewColumn(column); // finally sent the equivalent wxWidget event: DataViewCtrlPtr->HandleWindowEvent(DataViewEvent); return ::CallNextEventHandler(handler,EventReference); } else return eventNotHandledErr; } return eventNotHandledErr; } static bool InitializeColumnDescription(DataBrowserListViewColumnDesc& columnDescription, wxDataViewColumn const* columnPtr, wxCFStringRef const& title) { // set properties for the column: columnDescription.propertyDesc.propertyID = columnPtr->GetNativeData()->GetPropertyID(); columnDescription.propertyDesc.propertyType = columnPtr->GetRenderer()->GetNativeData()->GetPropertyType(); columnDescription.propertyDesc.propertyFlags = kDataBrowserListViewSelectionColumn; // make the column selectable if (columnPtr->IsReorderable()) columnDescription.propertyDesc.propertyFlags |= kDataBrowserListViewMovableColumn; if (columnPtr->IsResizeable()) { columnDescription.headerBtnDesc.minimumWidth = 0; columnDescription.headerBtnDesc.maximumWidth = 30000; // 32767 is the theoretical maximum though but 30000 looks nicer } else { columnDescription.headerBtnDesc.minimumWidth = columnPtr->GetWidth(); columnDescription.headerBtnDesc.maximumWidth = columnPtr->GetWidth(); } if (columnPtr->IsSortable()) columnDescription.propertyDesc.propertyFlags |= kDataBrowserListViewSortableColumn; if ((columnPtr->GetRenderer()->GetMode() == wxDATAVIEW_CELL_EDITABLE) || (columnPtr->GetRenderer()->GetMode() == wxDATAVIEW_CELL_ACTIVATABLE)) columnDescription.propertyDesc.propertyFlags |= kDataBrowserPropertyIsEditable; if ((columnDescription.propertyDesc.propertyType == kDataBrowserCustomType) || (columnDescription.propertyDesc.propertyType == kDataBrowserDateTimeType) || (columnDescription.propertyDesc.propertyType == kDataBrowserIconAndTextType) || (columnDescription.propertyDesc.propertyType == kDataBrowserTextType)) columnDescription.propertyDesc.propertyFlags |= kDataBrowserListViewTypeSelectColumn; // enables generally the possibility to have user input for the mentioned types #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4 columnDescription.propertyDesc.propertyFlags |= kDataBrowserListViewNoGapForIconInHeaderButton; #endif // set header's properties: columnDescription.headerBtnDesc.version = kDataBrowserListViewLatestHeaderDesc; columnDescription.headerBtnDesc.titleOffset = 0; columnDescription.headerBtnDesc.titleString = ::CFStringCreateCopy(kCFAllocatorDefault,title); columnDescription.headerBtnDesc.initialOrder = kDataBrowserOrderIncreasing; // choose one of the orders as "undefined" is not supported anyway (s. ControlDefs.h in the HIToolbox framework) columnDescription.headerBtnDesc.btnFontStyle.flags = kControlUseFontMask | kControlUseJustMask; switch (columnPtr->GetAlignment()) { case wxALIGN_CENTER: case wxALIGN_CENTER_HORIZONTAL: columnDescription.headerBtnDesc.btnFontStyle.just = teCenter; break; case wxALIGN_LEFT: columnDescription.headerBtnDesc.btnFontStyle.just = teFlushLeft; break; case wxALIGN_RIGHT: columnDescription.headerBtnDesc.btnFontStyle.just = teFlushRight; break; default: columnDescription.headerBtnDesc.btnFontStyle.just = teFlushDefault; } columnDescription.headerBtnDesc.btnFontStyle.font = kControlFontViewSystemFont; columnDescription.headerBtnDesc.btnFontStyle.style = normal; if (columnPtr->GetBitmap().IsOk()) { columnDescription.headerBtnDesc.btnContentInfo.contentType = kControlContentIconRef; columnDescription.headerBtnDesc.btnContentInfo.u.iconRef = columnPtr->GetBitmap().GetIconRef(); } else { // not text only as we otherwise could not add a bitmap later // columnDescription.headerBtnDesc.btnContentInfo.contentType = kControlContentTextOnly; columnDescription.headerBtnDesc.btnContentInfo.contentType = kControlContentIconRef; columnDescription.headerBtnDesc.btnContentInfo.u.iconRef = NULL; } // done: return true; } // ============================================================================ // Type definitions of locally used function pointers // ============================================================================ DEFINE_ONE_SHOT_HANDLER_GETTER(DataBrowserCtrlEventHandler) // ============================================================================ // Helper functions for dataview implementation on OSX // ============================================================================ wxWidgetImplType* CreateDataView(wxWindowMac* wxpeer, wxWindowMac* WXUNUSED(parent), wxWindowID WXUNUSED(id), wxPoint const& pos, wxSize const& size, long style, long WXUNUSED(extraStyle)) { return new wxMacDataViewDataBrowserListViewControl(wxpeer,pos,size,style); } // ============================================================================ // wxMacDataBrowserTableViewControl // ============================================================================ pascal Boolean wxMacDataBrowserTableViewControl::DataBrowserCompareProc(ControlRef browser, DataBrowserItemID itemOneID, DataBrowserItemID itemTwoID, DataBrowserPropertyID sortProperty) { wxMacDataBrowserTableViewControl* ControlPtr(dynamic_cast<wxMacDataBrowserTableViewControl*>(wxMacControl::GetReferenceFromNativeControl(browser))); if (ControlPtr != NULL) return ControlPtr->DataBrowserCompareProc(itemOneID,itemTwoID,sortProperty); else return FALSE; } pascal void wxMacDataBrowserTableViewControl::DataBrowserGetContextualMenuProc(ControlRef browser, MenuRef* menu, UInt32* helpType, CFStringRef* helpItemString, AEDesc* selection) { wxMacDataBrowserTableViewControl* ControlPtr(dynamic_cast<wxMacDataBrowserTableViewControl*>(wxMacControl::GetReferenceFromNativeControl(browser))); if (ControlPtr != NULL) ControlPtr->DataBrowserGetContextualMenuProc(menu,helpType,helpItemString,selection); } pascal OSStatus wxMacDataBrowserTableViewControl::DataBrowserGetSetItemDataProc(ControlRef browser, DataBrowserItemID itemID, DataBrowserPropertyID propertyID, DataBrowserItemDataRef itemData, Boolean getValue) { wxMacDataBrowserTableViewControl* ControlPtr(dynamic_cast<wxMacDataBrowserTableViewControl*>(wxMacControl::GetReferenceFromNativeControl(browser))); if (ControlPtr != NULL) return ControlPtr->DataBrowserGetSetItemDataProc(itemID,propertyID,itemData,getValue); else return errDataBrowserPropertyNotSupported; } pascal void wxMacDataBrowserTableViewControl::DataBrowserItemNotificationProc(ControlRef browser, DataBrowserItemID itemID, DataBrowserItemNotification message, DataBrowserItemDataRef itemData) { wxMacDataBrowserTableViewControl* ControlPtr(dynamic_cast<wxMacDataBrowserTableViewControl*>(wxMacControl::GetReferenceFromNativeControl(browser))); if (ControlPtr != NULL) ControlPtr->DataBrowserItemNotificationProc(itemID,message,itemData); } pascal void wxMacDataBrowserTableViewControl::DataBrowserDrawItemProc(ControlRef browser, DataBrowserItemID itemID, DataBrowserPropertyID propertyID, DataBrowserItemState state, Rect const* rectangle, SInt16 bitDepth, Boolean colorDevice) { wxMacDataBrowserTableViewControl* ControlPtr(dynamic_cast<wxMacDataBrowserTableViewControl*>(wxMacControl::GetReferenceFromNativeControl(browser))); if (ControlPtr != NULL) ControlPtr->DataBrowserDrawItemProc(itemID,propertyID,state,rectangle,bitDepth,colorDevice); } pascal Boolean wxMacDataBrowserTableViewControl::DataBrowserEditItemProc(ControlRef browser, DataBrowserItemID itemID, DataBrowserPropertyID propertyID, CFStringRef theString, Rect* maxEditTextRect, Boolean* shrinkToFit) { wxMacDataBrowserTableViewControl* ControlPtr(dynamic_cast<wxMacDataBrowserTableViewControl*>(wxMacControl::GetReferenceFromNativeControl(browser))); return ((ControlPtr != NULL) && ControlPtr->DataBrowserEditItemProc(itemID,propertyID,theString,maxEditTextRect,shrinkToFit)); } pascal Boolean wxMacDataBrowserTableViewControl::DataBrowserHitTestProc(ControlRef browser, DataBrowserItemID itemID, DataBrowserPropertyID propertyID, Rect const* theRect, Rect const* mouseRect) { wxMacDataBrowserTableViewControl* ControlPtr(dynamic_cast<wxMacDataBrowserTableViewControl*>(wxMacControl::GetReferenceFromNativeControl(browser))); return ((ControlPtr != NULL) && ControlPtr->DataBrowserHitTestProc(itemID,propertyID,theRect,mouseRect)); } pascal DataBrowserTrackingResult wxMacDataBrowserTableViewControl::DataBrowserTrackingProc(ControlRef browser, DataBrowserItemID itemID, DataBrowserPropertyID propertyID, Rect const* theRect, Point startPt, EventModifiers modifiers) { wxMacDataBrowserTableViewControl* ControlPtr(dynamic_cast<wxMacDataBrowserTableViewControl*>(wxMacControl::GetReferenceFromNativeControl(browser))); if (ControlPtr != NULL) return ControlPtr->DataBrowserTrackingProc(itemID,propertyID,theRect,startPt,modifiers); else return kDataBrowserNothingHit; } pascal Boolean wxMacDataBrowserTableViewControl::DataBrowserAcceptDragProc(ControlRef browser, DragReference dragRef, DataBrowserItemID itemID) { wxMacDataBrowserTableViewControl* controlPtr(dynamic_cast<wxMacDataBrowserTableViewControl*>(wxMacControl::GetReferenceFromNativeControl(browser))); return ((controlPtr != NULL) && controlPtr->DataBrowserAcceptDragProc(dragRef,itemID)); } pascal Boolean wxMacDataBrowserTableViewControl::DataBrowserAddDragItemProc(ControlRef browser, DragReference dragRef, DataBrowserItemID itemID, ItemReference* itemRef) { wxMacDataBrowserTableViewControl* controlPtr(dynamic_cast<wxMacDataBrowserTableViewControl*>(wxMacControl::GetReferenceFromNativeControl(browser))); return ((controlPtr != NULL) && controlPtr->DataBrowserAddDragItemProc(dragRef,itemID,itemRef)); } pascal Boolean wxMacDataBrowserTableViewControl::DataBrowserReceiveDragProc(ControlRef browser, DragReference dragRef, DataBrowserItemID itemID) { wxMacDataBrowserTableViewControl* controlPtr(dynamic_cast<wxMacDataBrowserTableViewControl*>(wxMacControl::GetReferenceFromNativeControl(browser))); return ((controlPtr != NULL) && controlPtr->DataBrowserReceiveDragProc(dragRef,itemID)); } wxMacDataBrowserTableViewControl::wxMacDataBrowserTableViewControl(wxWindow* peer, wxPoint const& pos, wxSize const& size, long style) :wxMacControl(peer) { Rect bounds = wxMacGetBoundsForControl(peer,pos,size); OSStatus err = ::CreateDataBrowserControl(MAC_WXHWND(peer->MacGetTopLevelWindowRef()),&bounds,kDataBrowserListView,&(m_controlRef)); SetReferenceInNativeControl(); verify_noerr(err); ::InstallControlEventHandler(m_controlRef, GetDataBrowserCtrlEventHandlerUPP(), GetEventTypeCount(eventList), eventList, peer, (EventHandlerRef *)&m_macDataViewCtrlEventHandler); // setup standard callbacks: if (gDataBrowserTableViewGetContextualMenuUPP == NULL) gDataBrowserTableViewGetContextualMenuUPP = NewDataBrowserGetContextualMenuUPP(wxMacDataBrowserTableViewControl::DataBrowserGetContextualMenuProc); if (gDataBrowserTableViewItemCompareUPP == NULL) gDataBrowserTableViewItemCompareUPP = NewDataBrowserItemCompareUPP (wxMacDataBrowserTableViewControl::DataBrowserCompareProc); if (gDataBrowserTableViewItemDataUPP == NULL) gDataBrowserTableViewItemDataUPP = NewDataBrowserItemDataUPP (wxMacDataBrowserTableViewControl::DataBrowserGetSetItemDataProc); if (gDataBrowserTableViewItemNotificationUPP == NULL) { gDataBrowserTableViewItemNotificationUPP = #if TARGET_API_MAC_OSX (DataBrowserItemNotificationUPP) NewDataBrowserItemNotificationWithItemUPP(wxMacDataBrowserTableViewControl::DataBrowserItemNotificationProc); #else NewDataBrowserItemNotificationUPP(wxMacDataBrowserTableViewControl::DataBrowserItemNotificationProc); #endif } // setup drag and drop callbacks: if (gDataBrowserTableViewAcceptDragUPP == NULL) gDataBrowserTableViewAcceptDragUPP = NewDataBrowserAcceptDragUPP (wxMacDataBrowserTableViewControl::DataBrowserAcceptDragProc); if (gDataBrowserTableViewAddDragItemUPP == NULL) gDataBrowserTableViewAddDragItemUPP = NewDataBrowserAddDragItemUPP(wxMacDataBrowserTableViewControl::DataBrowserAddDragItemProc); if (gDataBrowserTableViewReceiveDragUPP == NULL) gDataBrowserTableViewReceiveDragUPP = NewDataBrowserReceiveDragUPP(wxMacDataBrowserTableViewControl::DataBrowserReceiveDragProc); DataBrowserCallbacks callbacks; // variable definition InitializeDataBrowserCallbacks(&callbacks,kDataBrowserLatestCallbacks); callbacks.u.v1.getContextualMenuCallback = gDataBrowserTableViewGetContextualMenuUPP; callbacks.u.v1.itemDataCallback = gDataBrowserTableViewItemDataUPP; callbacks.u.v1.itemCompareCallback = gDataBrowserTableViewItemCompareUPP; callbacks.u.v1.itemNotificationCallback = gDataBrowserTableViewItemNotificationUPP; callbacks.u.v1.acceptDragCallback = gDataBrowserTableViewAcceptDragUPP; callbacks.u.v1.addDragItemCallback = gDataBrowserTableViewAddDragItemUPP; callbacks.u.v1.receiveDragCallback = gDataBrowserTableViewReceiveDragUPP; SetCallbacks(&callbacks); // setup callbacks for customized items: if (gDataBrowserTableViewDrawItemUPP == NULL) gDataBrowserTableViewDrawItemUPP = NewDataBrowserDrawItemUPP(wxMacDataBrowserTableViewControl::DataBrowserDrawItemProc); if (gDataBrowserTableViewEditItemUPP == NULL) gDataBrowserTableViewEditItemUPP = NewDataBrowserEditItemUPP(wxMacDataBrowserTableViewControl::DataBrowserEditItemProc); if (gDataBrowserTableViewHitTestUPP == NULL) gDataBrowserTableViewHitTestUPP = NewDataBrowserHitTestUPP (wxMacDataBrowserTableViewControl::DataBrowserHitTestProc); if (gDataBrowserTableViewTrackingUPP == NULL) gDataBrowserTableViewTrackingUPP = NewDataBrowserTrackingUPP(wxMacDataBrowserTableViewControl::DataBrowserTrackingProc); DataBrowserCustomCallbacks customCallbacks; // variable definition InitializeDataBrowserCustomCallbacks(&customCallbacks,kDataBrowserLatestCallbacks); customCallbacks.u.v1.drawItemCallback = gDataBrowserTableViewDrawItemUPP; customCallbacks.u.v1.editTextCallback = gDataBrowserTableViewEditItemUPP; customCallbacks.u.v1.hitTestCallback = gDataBrowserTableViewHitTestUPP; customCallbacks.u.v1.trackingCallback = gDataBrowserTableViewTrackingUPP; SetCustomCallbacks(&customCallbacks); // style setting: EnableCellSizeModification( ((style & wxDV_VARIABLE_LINE_HEIGHT) != 0), true ); DataBrowserSelectionFlags flags; // variable definition if (GetSelectionFlags(&flags) == noErr) // get default settings { if ((style & wxDV_MULTIPLE) != 0) flags &= ~kDataBrowserSelectOnlyOne; else flags |= kDataBrowserSelectOnlyOne; (void) SetSelectionFlags(flags); } OptionBits attributes; // variable definition if (GetAttributes(&attributes) == noErr) // get default settings { if ((style & wxDV_VERT_RULES) != 0) attributes |= kDataBrowserAttributeListViewDrawColumnDividers; else attributes &= ~kDataBrowserAttributeListViewDrawColumnDividers; if ((style & wxDV_ROW_LINES) != 0) attributes |= kDataBrowserAttributeListViewAlternatingRowColors; else attributes &= ~kDataBrowserAttributeListViewAlternatingRowColors; (void) SetAttributes(attributes); } if ((style & wxDV_NO_HEADER) != 0) SetHeaderButtonHeight(0); } wxMacDataBrowserTableViewControl::~wxMacDataBrowserTableViewControl() { ::RemoveEventHandler((EventHandlerRef) m_macDataViewCtrlEventHandler); } // // callback handling // OSStatus wxMacDataBrowserTableViewControl::SetCallbacks(DataBrowserCallbacks const* callbacks) { return ::SetDataBrowserCallbacks(m_controlRef,callbacks); } OSStatus wxMacDataBrowserTableViewControl::SetCustomCallbacks(DataBrowserCustomCallbacks const* customCallbacks) { return ::SetDataBrowserCustomCallbacks(m_controlRef,customCallbacks); } // // DnD handling // OSStatus wxMacDataBrowserTableViewControl::EnableAutomaticDragTracking(bool enable) { return ::SetAutomaticControlDragTrackingEnabledForWindow(::GetControlOwner(m_controlRef),enable); } // // header handling // OSStatus wxMacDataBrowserTableViewControl::GetHeaderDesc(DataBrowserPropertyID propertyID, DataBrowserListViewHeaderDesc* desc) const { desc->version = kDataBrowserListViewLatestHeaderDesc; // if this statement is missing the next call will fail (NOT DOCUMENTED!!) return ::GetDataBrowserListViewHeaderDesc(m_controlRef,propertyID,desc); } OSStatus wxMacDataBrowserTableViewControl::SetHeaderDesc(DataBrowserPropertyID propertyID, DataBrowserListViewHeaderDesc* desc) { return ::SetDataBrowserListViewHeaderDesc(m_controlRef,propertyID,desc); } // // layout handling // OSStatus wxMacDataBrowserTableViewControl::AutoSizeColumns() { return AutoSizeDataBrowserListViewColumns(m_controlRef); } OSStatus wxMacDataBrowserTableViewControl::EnableCellSizeModification(bool enableHeight, bool enableWidth) { return ::SetDataBrowserTableViewGeometry(GetControlRef(),enableWidth,enableHeight); } OSStatus wxMacDataBrowserTableViewControl::GetAttributes(OptionBits* attributes) { return ::DataBrowserGetAttributes(GetControlRef(),attributes); } OSStatus wxMacDataBrowserTableViewControl::GetColumnWidth(DataBrowserPropertyID propertyID, UInt16* width) const { return ::GetDataBrowserTableViewNamedColumnWidth(m_controlRef,propertyID,width); } OSStatus wxMacDataBrowserTableViewControl::GetDefaultColumnWidth( UInt16 *width ) const { return GetDataBrowserTableViewColumnWidth(m_controlRef, width ); } OSStatus wxMacDataBrowserTableViewControl::GetDefaultRowHeight(UInt16* height) const { return ::GetDataBrowserTableViewRowHeight(m_controlRef,height); } OSStatus wxMacDataBrowserTableViewControl::GetHeaderButtonHeight(UInt16 *height) { return ::GetDataBrowserListViewHeaderBtnHeight(m_controlRef,height); } OSStatus wxMacDataBrowserTableViewControl::GetPartBounds(DataBrowserItemID item, DataBrowserPropertyID propertyID, DataBrowserPropertyPart part, Rect* bounds) { return ::GetDataBrowserItemPartBounds(m_controlRef,item,propertyID,part,bounds); } OSStatus wxMacDataBrowserTableViewControl::GetRowHeight(DataBrowserItemID item, UInt16* height) const { return ::GetDataBrowserTableViewItemRowHeight(m_controlRef,item,height); } OSStatus wxMacDataBrowserTableViewControl::GetScrollPosition( UInt32 *top , UInt32 *left ) const { return GetDataBrowserScrollPosition(m_controlRef, top , left ); } OSStatus wxMacDataBrowserTableViewControl::SetAttributes(OptionBits attributes) { return ::DataBrowserChangeAttributes(GetControlRef(),attributes,~attributes); } OSStatus wxMacDataBrowserTableViewControl::SetColumnWidth(DataBrowserPropertyID propertyID, UInt16 width) { return ::SetDataBrowserTableViewNamedColumnWidth(m_controlRef,propertyID,width); } OSStatus wxMacDataBrowserTableViewControl::SetDefaultColumnWidth(UInt16 width) { return ::SetDataBrowserTableViewColumnWidth(m_controlRef,width); } OSStatus wxMacDataBrowserTableViewControl::SetDefaultRowHeight(UInt16 height) { return ::SetDataBrowserTableViewRowHeight(m_controlRef,height); } OSStatus wxMacDataBrowserTableViewControl::SetHasScrollBars(bool horiz, bool vert) { return ::SetDataBrowserHasScrollBars(m_controlRef,horiz,vert); } OSStatus wxMacDataBrowserTableViewControl::SetHeaderButtonHeight(UInt16 height) { return ::SetDataBrowserListViewHeaderBtnHeight(m_controlRef,height); } OSStatus wxMacDataBrowserTableViewControl::SetHiliteStyle(DataBrowserTableViewHiliteStyle hiliteStyle) { return ::SetDataBrowserTableViewHiliteStyle(m_controlRef,hiliteStyle); } OSStatus wxMacDataBrowserTableViewControl::SetIndent(float Indent) { return ::DataBrowserSetMetric(m_controlRef,kDataBrowserMetricDisclosureColumnPerDepthGap,true,Indent); } OSStatus wxMacDataBrowserTableViewControl::SetItemRowHeight(DataBrowserItemID item, UInt16 height) { return ::SetDataBrowserTableViewItemRowHeight(m_controlRef,item,height); } OSStatus wxMacDataBrowserTableViewControl::SetScrollPosition(UInt32 top, UInt32 left) { return ::SetDataBrowserScrollPosition(m_controlRef,top,left); } // // column handling // OSStatus wxMacDataBrowserTableViewControl::GetColumnCount(UInt32* numColumns) const { return ::GetDataBrowserTableViewColumnCount(m_controlRef,numColumns); } OSStatus wxMacDataBrowserTableViewControl::GetColumnIndex(DataBrowserPropertyID propertyID, DataBrowserTableViewColumnIndex* index) const { return ::GetDataBrowserTableViewColumnPosition(m_controlRef,propertyID,index); } OSStatus wxMacDataBrowserTableViewControl::GetFreePropertyID(DataBrowserPropertyID* propertyID) const { for (*propertyID=kMinPropertyID; *propertyID<std::numeric_limits<DataBrowserPropertyID>::max(); ++(*propertyID)) if (IsUsedPropertyID(*propertyID) == errDataBrowserPropertyNotFound) return noErr; return errDataBrowserPropertyNotSupported; } OSStatus wxMacDataBrowserTableViewControl::GetPropertyFlags(DataBrowserPropertyID propertyID, DataBrowserPropertyFlags *flags) const { return ::GetDataBrowserPropertyFlags(m_controlRef,propertyID,flags); } OSStatus wxMacDataBrowserTableViewControl::GetPropertyID(DataBrowserItemDataRef itemData, DataBrowserPropertyID* propertyID) const { return ::GetDataBrowserItemDataProperty(itemData,propertyID); } OSStatus wxMacDataBrowserTableViewControl::GetPropertyID(DataBrowserTableViewColumnIndex index, DataBrowserTableViewColumnID* propertyID) const { return ::GetDataBrowserTableViewColumnProperty(m_controlRef,index,propertyID); } OSStatus wxMacDataBrowserTableViewControl::IsUsedPropertyID(DataBrowserPropertyID propertyID) const { // as the Mac interface does not provide a function that checks if the property id is in use or not a function is chosen that should not // lead to a large overhead for the call but returns an error code if the property id does not exist, here we use the function that returns // the column position for the property id: DataBrowserTableViewColumnIndex index; return ::GetDataBrowserTableViewColumnPosition(m_controlRef,propertyID,&index); } OSStatus wxMacDataBrowserTableViewControl::RemoveColumnByProperty(DataBrowserTableViewColumnID propertyID) { return ::RemoveDataBrowserTableViewColumn(m_controlRef,propertyID); } OSStatus wxMacDataBrowserTableViewControl::RemoveColumnByIndex(DataBrowserTableViewColumnIndex index) { DataBrowserTableViewColumnID propertyID; GetPropertyID(index,&propertyID); return ::RemoveDataBrowserTableViewColumn(m_controlRef,propertyID); } OSStatus wxMacDataBrowserTableViewControl::SetColumnIndex(DataBrowserPropertyID propertyID, DataBrowserTableViewColumnIndex index) { return ::SetDataBrowserTableViewColumnPosition(m_controlRef,propertyID,index); } OSStatus wxMacDataBrowserTableViewControl::SetDisclosureColumn(DataBrowserPropertyID propertyID, Boolean expandableRows) { return ::SetDataBrowserListViewDisclosureColumn(m_controlRef,propertyID,expandableRows); } OSStatus wxMacDataBrowserTableViewControl::SetPropertyFlags(DataBrowserPropertyID propertyID, DataBrowserPropertyFlags flags) { return ::SetDataBrowserPropertyFlags(m_controlRef,propertyID,flags); } // // item handling // OSStatus wxMacDataBrowserTableViewControl::AddItems(DataBrowserItemID container, UInt32 numItems, DataBrowserItemID const* items, DataBrowserPropertyID preSortProperty) { return ::AddDataBrowserItems(m_controlRef,container,numItems,items,preSortProperty); } OSStatus wxMacDataBrowserTableViewControl::GetFreeItemID(DataBrowserItemID* id) const { ItemCount noOfItems; OSStatus status; status = GetItemCount(&noOfItems); wxCHECK_MSG(status == noErr,status,_("Could not retrieve number of items")); if (noOfItems == 0) { *id = 1; return noErr; } else { // as there might be a lot of items in the data browser and mostly the data is added item by item the largest used ID number is roughly in the order of magnitude // as the number of items; therefore, start from the number of items to look for a new ID: for (*id=noOfItems; *id<std::numeric_limits<DataBrowserItemID>::max(); ++(*id)) if (IsUsedItemID(*id) == errDataBrowserItemNotFound) return noErr; // as the first approach was not successful, try from the beginning: for (*id=0; *id<noOfItems; ++(*id)) if (IsUsedItemID(*id) == errDataBrowserItemNotFound) return noErr; // sorry, data browser is full: return errDataBrowserItemNotAdded; } } OSStatus wxMacDataBrowserTableViewControl::GetItemCount(DataBrowserItemID container, Boolean recurse, DataBrowserItemState state, ItemCount* numItems) const { return GetDataBrowserItemCount(m_controlRef,container,recurse,state,numItems); } OSStatus wxMacDataBrowserTableViewControl::GetItemID( DataBrowserTableViewRowIndex row, DataBrowserItemID * item ) const { return GetDataBrowserTableViewItemID(m_controlRef,row,item); } OSStatus wxMacDataBrowserTableViewControl::GetItems(DataBrowserItemID container, Boolean recurse, DataBrowserItemState state, Handle items) const { return GetDataBrowserItems(m_controlRef,container,recurse,state,items); } OSStatus wxMacDataBrowserTableViewControl::GetItemRow(DataBrowserItemID item, DataBrowserTableViewRowIndex* row) const { return GetDataBrowserTableViewItemRow(m_controlRef,item,row); } OSStatus wxMacDataBrowserTableViewControl::GetItemState(DataBrowserItemID item, DataBrowserItemState* state) const { return ::GetDataBrowserItemState(m_controlRef,item,state); } OSStatus wxMacDataBrowserTableViewControl::IsUsedItemID(DataBrowserItemID itemID) const { // as the Mac interface does not provide a function that checks if the property id is in use or not a function is chosen that should not // lead to a large overhead for the call but returns an error code if the property id does not exist, here we use the function that returns // the column position for the property id: DataBrowserTableViewColumnIndex index; return ::GetDataBrowserTableViewItemRow(m_controlRef,itemID,&index); } OSStatus wxMacDataBrowserTableViewControl::RemoveItems(DataBrowserItemID container, UInt32 numItems, DataBrowserItemID const* items, DataBrowserPropertyID preSortProperty) { return ::RemoveDataBrowserItems(m_controlRef,container,numItems,items,preSortProperty); } OSStatus wxMacDataBrowserTableViewControl::RevealItem(DataBrowserItemID item, DataBrowserPropertyID propertyID, DataBrowserRevealOptions options) const { return ::RevealDataBrowserItem(m_controlRef,item,propertyID,options); } OSStatus wxMacDataBrowserTableViewControl::UpdateItems(DataBrowserItemID container, UInt32 numItems, DataBrowserItemID const* items, DataBrowserPropertyID preSortProperty, DataBrowserPropertyID propertyID) const { return UpdateDataBrowserItems(m_controlRef,container,numItems,items,preSortProperty,propertyID); } // // item selection // size_t wxMacDataBrowserTableViewControl::GetSelectedItemIDs(wxArrayDataBrowserItemID& itemIDs) const { DataBrowserItemID* itemIDPtr; Handle handle(::NewHandle(0)); size_t noOfItems; wxCHECK_MSG(GetItems(kDataBrowserNoItem,true,kDataBrowserItemIsSelected,handle) == noErr,0,_("Could not get selected items.")); noOfItems = static_cast<size_t>(::GetHandleSize(handle)/sizeof(DataBrowserItemID)); itemIDs.Empty(); itemIDs.Alloc(noOfItems); HLock(handle); itemIDPtr = (DataBrowserItemID*) (*handle); for (size_t i=0; i<noOfItems; ++i) { itemIDs.Add(*itemIDPtr); ++itemIDPtr; } HUnlock(handle); DisposeHandle(handle); return noOfItems; } OSStatus wxMacDataBrowserTableViewControl::GetSelectionAnchor(DataBrowserItemID* first, DataBrowserItemID* last) const { return ::GetDataBrowserSelectionAnchor(m_controlRef,first,last); } OSStatus wxMacDataBrowserTableViewControl::GetSelectionFlags(DataBrowserSelectionFlags* flags) const { return ::GetDataBrowserSelectionFlags(m_controlRef,flags); } bool wxMacDataBrowserTableViewControl::IsItemSelected(DataBrowserItemID item) const { return ::IsDataBrowserItemSelected(m_controlRef,item); } OSStatus wxMacDataBrowserTableViewControl::SetSelectionFlags(DataBrowserSelectionFlags flags) { return ::SetDataBrowserSelectionFlags(m_controlRef,flags); } OSStatus wxMacDataBrowserTableViewControl::SetSelectedItems(UInt32 numItems, DataBrowserItemID const* items, DataBrowserSetOption operation) { return ::SetDataBrowserSelectedItems(m_controlRef, numItems, items, operation ); } OSStatus wxMacDataBrowserTableViewControl::GetSortOrder(DataBrowserSortOrder* order) const { return ::GetDataBrowserSortOrder(m_controlRef,order); } OSStatus wxMacDataBrowserTableViewControl::GetSortProperty(DataBrowserPropertyID* propertyID) const { return ::GetDataBrowserSortProperty(m_controlRef,propertyID); } OSStatus wxMacDataBrowserTableViewControl::Resort(DataBrowserItemID container, Boolean sortChildren) { return ::SortDataBrowserContainer(m_controlRef,container,sortChildren); } OSStatus wxMacDataBrowserTableViewControl::SetSortOrder(DataBrowserSortOrder order) { return ::SetDataBrowserSortOrder(m_controlRef,order); } OSStatus wxMacDataBrowserTableViewControl::SetSortProperty(DataBrowserPropertyID propertyID) { return ::SetDataBrowserSortProperty(m_controlRef,propertyID); } // // container handling // OSStatus wxMacDataBrowserTableViewControl::CloseContainer(DataBrowserItemID containerID) { return ::CloseDataBrowserContainer(m_controlRef,containerID); } OSStatus wxMacDataBrowserTableViewControl::OpenContainer(DataBrowserItemID containerID) { return ::OpenDataBrowserContainer(m_controlRef,containerID); } IMPLEMENT_ABSTRACT_CLASS(wxMacDataBrowserTableViewControl,wxMacControl) // ============================================================================ // wxMacDataBrowserListViewControl // ============================================================================ #pragma mark - // // column handling // OSStatus wxMacDataBrowserListViewControl::AddColumn(DataBrowserListViewColumnDesc *columnDesc, DataBrowserTableViewColumnIndex position) { return AddDataBrowserListViewColumn(m_controlRef,columnDesc,position); } // ============================================================================ // wxMacDataViewDataBrowserListViewControl // ============================================================================ #pragma mark - // // constructors / destructor // wxMacDataViewDataBrowserListViewControl::wxMacDataViewDataBrowserListViewControl(wxWindow* peer, wxPoint const& pos, wxSize const& size, long style) :wxMacDataBrowserListViewControl(peer,pos,size,style) { if ((style & wxBORDER_NONE) != 0) SetData(kControlNoPart,kControlDataBrowserIncludesFrameAndFocusTag,(Boolean) false); (void) EnableAutomaticDragTracking(); (void) SetHiliteStyle(kDataBrowserTableViewFillHilite); } // // column related methods (inherited from wxDataViewWidgetImpl) // bool wxMacDataViewDataBrowserListViewControl::ClearColumns() { UInt32 noOfColumns; wxCHECK_MSG(GetColumnCount(&noOfColumns) == noErr,false,_("Could not determine number of columns.")); for (UInt32 i=0; i<noOfColumns; ++i) wxCHECK_MSG(RemoveColumnByIndex(0) == noErr,false,_("Could not remove column.")); return true; } bool wxMacDataViewDataBrowserListViewControl::DeleteColumn(wxDataViewColumn* columnPtr) { return (RemoveColumnByProperty(columnPtr->GetNativeData()->GetPropertyID()) == noErr); } void wxMacDataViewDataBrowserListViewControl::DoSetExpanderColumn(wxDataViewColumn const* columnPtr) { SetDisclosureColumn(columnPtr->GetNativeData()->GetPropertyID(),false); // second parameter explicitely passed to ensure that arrow is centered } wxDataViewColumn* wxMacDataViewDataBrowserListViewControl::GetColumn(unsigned int pos) const { DataBrowserPropertyID propertyID; if (GetPropertyID(pos,&propertyID) == noErr) return GetColumnPtr(propertyID); else return NULL; } int wxMacDataViewDataBrowserListViewControl::GetColumnPosition(wxDataViewColumn const* columnPtr) const { if (columnPtr != NULL) { DataBrowserTableViewColumnIndex Position; wxCHECK_MSG(GetColumnIndex(columnPtr->GetNativeData()->GetPropertyID(),&Position) == noErr,wxNOT_FOUND,_("Could not determine column's position")); return static_cast<int>(Position); } else return wxNOT_FOUND; } bool wxMacDataViewDataBrowserListViewControl::InsertColumn(unsigned int pos, wxDataViewColumn* columnPtr) { DataBrowserListViewColumnDesc columnDescription; DataBrowserPropertyID newPropertyID; UInt32 noOfColumns; wxCFStringRef title(columnPtr->GetTitle(),m_font.Ok() ? dynamic_cast<wxDataViewCtrl*>(GetWXPeer())->GetFont().GetEncoding() : wxLocale::GetSystemEncoding()); // try to get new ID for the column: wxCHECK_MSG(GetFreePropertyID(&newPropertyID) == noErr,false,_("Cannot create new column's ID. Probably max. number of columns reached.")); // set native data: columnPtr->GetNativeData()->SetPropertyID(newPropertyID); // create a column description, add column to the native control and do some final layout adjustments: wxCHECK_MSG(::InitializeColumnDescription(columnDescription,columnPtr,title), false,_("Column description could not be initialized.")); wxCHECK_MSG(AddColumn(&columnDescription,pos) == noErr, false,_("Column could not be added.")); wxCHECK_MSG(SetColumnWidth(newPropertyID,columnPtr->GetWidth()) == noErr,false,_("Column width could not be set.")); wxCHECK_MSG(GetColumnCount(&noOfColumns) == noErr, false,_("Number of columns could not be determined.")); if (noOfColumns == 1) { wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(GetWXPeer())); wxCHECK_MSG(dataViewCtrlPtr != NULL,false,_("wxWidget's control not initialized.")); dataViewCtrlPtr->AddChildren(wxDataViewItem()); return true; } else return Update(columnPtr); } // // item related methods (inherited from wxDataViewWidgetImpl) // bool wxMacDataViewDataBrowserListViewControl::Add(wxDataViewItem const& parent, wxDataViewItem const& item) { DataBrowserItemID itemID(reinterpret_cast<DataBrowserItemID>(item.GetID())); return (( parent.IsOk() && AddItem(reinterpret_cast<DataBrowserItemID>(parent.GetID()),&itemID) == noErr) || (!(parent.IsOk()) && AddItem(kDataBrowserNoItem,&itemID) == noErr)); } bool wxMacDataViewDataBrowserListViewControl::Add(wxDataViewItem const& parent, wxDataViewItemArray const& items) { bool noFailureFlag; DataBrowserItemID* itemIDs; size_t noOfEntries; // convert all valid data view items to data browser items: itemIDs = ::CreateDataBrowserItemIDArray(noOfEntries,items); // insert all valid items into control: noFailureFlag = ((noOfEntries == 0) || !(parent.IsOk()) && (AddItems(kDataBrowserNoItem,noOfEntries,itemIDs,kDataBrowserItemNoProperty) == noErr) || parent.IsOk() && (AddItems(reinterpret_cast<DataBrowserItemID>(parent.GetID()),noOfEntries,itemIDs,kDataBrowserItemNoProperty) == noErr)); // give allocated array space free again: delete[] itemIDs; // done: return noFailureFlag; } void wxMacDataViewDataBrowserListViewControl::Collapse(wxDataViewItem const& item) { CloseContainer(reinterpret_cast<DataBrowserItemID>(item.GetID())); } void wxMacDataViewDataBrowserListViewControl::EnsureVisible(wxDataViewItem const& item, const wxDataViewColumn* columnPtr) { DataBrowserPropertyID propertyID; if (columnPtr != NULL) propertyID = columnPtr->GetNativeData()->GetPropertyID(); else propertyID = kDataBrowserNoItem; RevealItem(reinterpret_cast<DataBrowserItemID>(item.GetID()),propertyID,kDataBrowserRevealOnly); } void wxMacDataViewDataBrowserListViewControl::Expand(wxDataViewItem const& item) { OpenContainer(reinterpret_cast<DataBrowserItemID>(item.GetID())); } unsigned int wxMacDataViewDataBrowserListViewControl::GetCount() const { ItemCount noOfItems; wxCHECK_MSG(GetItemCount(&noOfItems) == noErr,0,_("Could not determine number of items")); return noOfItems; } wxRect wxMacDataViewDataBrowserListViewControl::GetRectangle(wxDataViewItem const& item, wxDataViewColumn const* columnPtr) { Rect MacRectangle; if (GetPartBounds(reinterpret_cast<DataBrowserItemID>(item.GetID()),columnPtr->GetNativeData()->GetPropertyID(),kDataBrowserPropertyContentPart,&MacRectangle) == noErr) { wxRect rectangle; ::wxMacNativeToRect(&MacRectangle,&rectangle); return rectangle; } else return wxRect(); } bool wxMacDataViewDataBrowserListViewControl::IsExpanded(wxDataViewItem const& item) const { DataBrowserItemState state = 0; if (GetItemState(reinterpret_cast<DataBrowserItemID>(item.GetID()),&state) != noErr) return false; return ((state & kDataBrowserContainerIsOpen) != 0); } bool wxMacDataViewDataBrowserListViewControl::Reload() { bool noFailureFlag; wxDataViewItemArray dataViewChildren; noFailureFlag = (RemoveItems() == noErr); SetScrollPosition(0,0); // even after having removed all items the scrollbars may remain at their old position -> reset them GetDataViewCtrl()->GetModel()->GetChildren(wxDataViewItem(),dataViewChildren); GetDataViewCtrl()->GetModel()->ItemsAdded(wxDataViewItem(),dataViewChildren); return noFailureFlag; } bool wxMacDataViewDataBrowserListViewControl::Remove(wxDataViewItem const& parent, wxDataViewItem const& item) { DataBrowserItemID itemID(reinterpret_cast<DataBrowserItemID>(item.GetID())); return (RemoveItem(reinterpret_cast<DataBrowserItemID>(parent.GetID()),&itemID) == noErr); } bool wxMacDataViewDataBrowserListViewControl::Remove(wxDataViewItem const& parent, wxDataViewItemArray const& items) { bool noFailureFlag; DataBrowserItemID* itemIDs; size_t noOfEntries; // convert all valid data view items to data browser items: itemIDs = ::CreateDataBrowserItemIDArray(noOfEntries,items); // insert all valid items into control: noFailureFlag = ((noOfEntries == 0) || !(parent.IsOk()) && (RemoveItems(kDataBrowserNoItem,noOfEntries,itemIDs,kDataBrowserItemNoProperty) == noErr) || parent.IsOk() && (RemoveItems(reinterpret_cast<DataBrowserItemID>(parent.GetID()),noOfEntries,itemIDs,kDataBrowserItemNoProperty) == noErr)); // give allocated array space free again: delete[] itemIDs; // done: return noFailureFlag; } bool wxMacDataViewDataBrowserListViewControl::Update(wxDataViewColumn const* columnPtr) { return (UpdateItems(kDataBrowserNoItem,0,NULL,kDataBrowserItemNoProperty,columnPtr->GetNativeData()->GetPropertyID()) == noErr); } bool wxMacDataViewDataBrowserListViewControl::Update(wxDataViewItem const& parent, wxDataViewItem const& item) { DataBrowserItemID itemID(reinterpret_cast<DataBrowserItemID>(item.GetID())); if (parent.IsOk()) return (UpdateItem(reinterpret_cast<DataBrowserItemID>(parent.GetID()),&itemID) == noErr); else return (UpdateItem(kDataBrowserNoItem,&itemID) == noErr); } bool wxMacDataViewDataBrowserListViewControl::Update(wxDataViewItem const& parent, wxDataViewItemArray const& items) { bool noFailureFlag; DataBrowserItemID* itemIDs; size_t noOfEntries; // convert all valid data view items to data browser items: itemIDs = ::CreateDataBrowserItemIDArray(noOfEntries,items); if (parent.IsOk()) noFailureFlag = (UpdateItems(reinterpret_cast<DataBrowserItemID>(parent.GetID()),noOfEntries,itemIDs,kDataBrowserItemNoProperty,kDataBrowserItemNoProperty) == noErr); else noFailureFlag = (UpdateItems(kDataBrowserNoItem,noOfEntries,itemIDs,kDataBrowserItemNoProperty,kDataBrowserItemNoProperty) == noErr); // release allocated array space: delete[] itemIDs; // done: return noFailureFlag; } // // model related methods // bool wxMacDataViewDataBrowserListViewControl::AssociateModel(wxDataViewModel* WXUNUSED(model)) { return true; } // // selection related methods (inherited from wxDataViewWidgetImpl) // int wxMacDataViewDataBrowserListViewControl::GetSelections(wxDataViewItemArray& sel) const { size_t noOfSelectedItems; wxArrayDataBrowserItemID itemIDs; noOfSelectedItems = GetSelectedItemIDs(itemIDs); sel.Empty(); sel.SetCount(noOfSelectedItems); for (size_t i=0; i<noOfSelectedItems; ++i) sel[i] = wxDataViewItem(reinterpret_cast<void*>(itemIDs[i])); return static_cast<int>(noOfSelectedItems); } bool wxMacDataViewDataBrowserListViewControl::IsSelected(wxDataViewItem const& item) const { return IsItemSelected(reinterpret_cast<DataBrowserItemID>(item.GetID())); } void wxMacDataViewDataBrowserListViewControl::Select(wxDataViewItem const& item) { DataBrowserItemID itemID(reinterpret_cast<DataBrowserItemID>(item.GetID())); SetSelectedItems(1,&itemID,kDataBrowserItemsAdd); } void wxMacDataViewDataBrowserListViewControl::SelectAll() { DataBrowserItemID* itemIDPtr; Handle handle(::NewHandle(0)); size_t noOfItems; wxCHECK_RET(GetItems(kDataBrowserNoItem,true,kDataBrowserItemAnyState,handle) == noErr,_("Could not get items.")); noOfItems = static_cast<size_t>(::GetHandleSize(handle)/sizeof(DataBrowserItemID)); ::HLock(handle); itemIDPtr = (DataBrowserItemID*) (*handle); SetSelectedItems(noOfItems,itemIDPtr,kDataBrowserItemsAssign); ::HUnlock(handle); ::DisposeHandle(handle); } void wxMacDataViewDataBrowserListViewControl::Unselect(wxDataViewItem const& item) { DataBrowserItemID itemID(reinterpret_cast<DataBrowserItemID>(item.GetID())); SetSelectedItems(1,&itemID,kDataBrowserItemsRemove); } void wxMacDataViewDataBrowserListViewControl::UnselectAll() { DataBrowserItemID* itemIDPtr; Handle handle(::NewHandle(0)); size_t noOfItems; wxCHECK_RET(GetItems(kDataBrowserNoItem,true,kDataBrowserItemAnyState,handle) == noErr,_("Could not get items.")); noOfItems = static_cast<size_t>(::GetHandleSize(handle)/sizeof(DataBrowserItemID)); ::HLock(handle); itemIDPtr = (DataBrowserItemID*) (*handle); SetSelectedItems(noOfItems,itemIDPtr,kDataBrowserItemsRemove); ::HUnlock(handle); ::DisposeHandle(handle); } // // sorting related methods // wxDataViewColumn* wxMacDataViewDataBrowserListViewControl::GetSortingColumn() const { DataBrowserPropertyID propertyID; if (GetSortProperty(&propertyID) == noErr) return GetColumnPtr(propertyID); else return NULL; } void wxMacDataViewDataBrowserListViewControl::Resort() { (void) wxMacDataBrowserListViewControl::Resort(); } // // other methods (inherited from wxDataViewWidgetImpl) // void wxMacDataViewDataBrowserListViewControl::HitTest(const wxPoint& WXUNUSED(point), wxDataViewItem& item, wxDataViewColumn*& columnPtr) const { // not yet implemented: item = wxDataViewItem(); columnPtr = NULL; } void wxMacDataViewDataBrowserListViewControl::DoSetIndent(int indent) { SetIndent(static_cast<float>(indent)); } void wxMacDataViewDataBrowserListViewControl::SetRowHeight(wxDataViewItem const& item, unsigned int height) { SetItemRowHeight(reinterpret_cast<DataBrowserItemID>(item.GetID()),static_cast<UInt16>(height)); } void wxMacDataViewDataBrowserListViewControl::OnSize() { UInt32 noOfColumns; GetColumnCount(&noOfColumns); if (noOfColumns <= 1) // no horizontal scroll bar and the only column expands to the width of the whole control { SetHasScrollBars(false,true); AutoSizeColumns(); } else // otherwise keep the current column size and have scrollbars in both directions SetHasScrollBars(true,true); } // // callback functions (inherited from wxMacDataBrowserTableViewControl) // Boolean wxMacDataViewDataBrowserListViewControl::DataBrowserCompareProc(DataBrowserItemID itemOneID, DataBrowserItemID itemTwoID, DataBrowserPropertyID sortProperty) { DataBrowserSortOrder sortOrder; DataBrowserTableViewColumnIndex modelColumnIndex; wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(GetWXPeer())); wxCHECK_MSG(dataViewCtrlPtr != NULL, false,_("Pointer to data view control not set correctly.")); wxCHECK_MSG(dataViewCtrlPtr->GetModel() != NULL,false,_("Pointer to model not set correctly.")); if (sortProperty >= kMinPropertyID) { // variable definition and initialization: wxDataViewColumn* ColumnPtr(GetColumnPtr(sortProperty)); wxCHECK_MSG(ColumnPtr != NULL,false,_("Could not determine column index.")); modelColumnIndex = ColumnPtr->GetModelColumn(); } else modelColumnIndex = 0; GetSortOrder(&sortOrder); return static_cast<Boolean>(dataViewCtrlPtr->GetModel()->Compare(wxDataViewItem(reinterpret_cast<void*>(itemOneID)),wxDataViewItem(reinterpret_cast<void*>(itemTwoID)), modelColumnIndex,sortOrder != kDataBrowserOrderDecreasing) < 0); } void wxMacDataViewDataBrowserListViewControl::DataBrowserGetContextualMenuProc(MenuRef* menu, UInt32* helpType, CFStringRef* helpItemString, AEDesc* WXUNUSED(selection)) // In this method we do not supply a contextual menu handler at all but only send a wxEVT_COMMAND_DATAVIEW_ITEM_CONTEXT_MENU. { wxArrayDataBrowserItemID itemIDs; wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(GetWXPeer())); wxCHECK_RET(dataViewCtrlPtr != NULL,_("wxWidget control pointer is not a data view pointer")); // initialize parameters so that no context menu will be displayed automatically by the native data browser: *menu = NULL; *helpType = kCMHelpItemNoHelp; *helpItemString = NULL; // create information for a context menu event: wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_ITEM_CONTEXT_MENU,dataViewCtrlPtr->GetId()); dataViewEvent.SetEventObject(dataViewCtrlPtr); dataViewEvent.SetModel(dataViewCtrlPtr->GetModel()); // get the item information; // theoretically more than one ID can be returned but the event can only handle one item, therefore all item related data is using the data of the first item in the array: if (GetSelectedItemIDs(itemIDs) > 0) dataViewEvent.SetItem(wxDataViewItem(reinterpret_cast<void*>(itemIDs[0]))); // finally send the equivalent wxWidget event: dataViewCtrlPtr->GetEventHandler()->ProcessEvent(dataViewEvent); } OSStatus wxMacDataViewDataBrowserListViewControl::DataBrowserGetSetItemDataProc(DataBrowserItemID itemID, DataBrowserPropertyID propertyID, DataBrowserItemDataRef itemData, Boolean getValue) { if (getValue) { // variable definitions: wxDataViewCtrl* dataViewCtrlPtr; dataViewCtrlPtr = dynamic_cast<wxDataViewCtrl*>(GetWXPeer()); wxCHECK_MSG(dataViewCtrlPtr != NULL,errDataBrowserNotConfigured,_("Pointer to data view control not set correctly.")); if (dataViewCtrlPtr->IsDeleting()) return noErr; // if a delete process is running the data of editable fields cannot be saved because the associated model variable may already have been deleted else { // variable definitions: OSStatus errorStatus; wxDataViewColumn* dataViewColumnPtr; wxCHECK_MSG(dataViewCtrlPtr->GetModel() != NULL,errDataBrowserNotConfigured,_("Pointer to model not set correctly.")); dataViewColumnPtr = GetColumnPtr(propertyID); wxCHECK_MSG((dataViewColumnPtr != NULL) && (dataViewColumnPtr->GetRenderer() != NULL),errDataBrowserNotConfigured,_("There is no column or renderer for the specified column index.")); wxDataViewItem dvItem(reinterpret_cast<void*>(itemID)); unsigned int col = dataViewColumnPtr->GetModelColumn(); switch (dataViewColumnPtr->GetRenderer()->GetNativeData()->GetPropertyType()) { case kDataBrowserCheckboxType: { // variable definition: ThemeButtonValue buttonValue; errorStatus = ::GetDataBrowserItemDataButtonValue(itemData,&buttonValue); if (errorStatus == noErr) { if (buttonValue == kThemeButtonOn) { // variable definition and initialization: wxVariant modifiedData(true); if (dataViewCtrlPtr->GetModel()->ChangeValue(modifiedData, dvItem, col)) return noErr; else return errDataBrowserInvalidPropertyData; } else if (buttonValue == kThemeButtonOff) { // variable definition and initialization: wxVariant modifiedData(false); if (dataViewCtrlPtr->GetModel()->ChangeValue(modifiedData, dvItem, col)) return noErr; else return errDataBrowserInvalidPropertyData; } else return errDataBrowserInvalidPropertyData; } else return errorStatus; } /* block */ case kDataBrowserTextType: { // variable definitions: CFStringRef stringReference; errorStatus = ::GetDataBrowserItemDataText(itemData,&stringReference); if (errorStatus == noErr) { // variable definitions and initializations: #if wxCHECK_VERSION(2,9,0) wxCFStringRef modifiedString(stringReference); #else wxMacCFStringHolder modifiedString(stringReference); #endif wxVariant modifiedData(modifiedString.AsString()); if (dataViewCtrlPtr->GetModel()->ChangeValue(modifiedData, dvItem, col)) return noErr; else return errDataBrowserInvalidPropertyData; } else return errorStatus; } /* block */ default: return errDataBrowserPropertyNotSupported; } } } else { if (propertyID >= kMinPropertyID) // in case data columns set the data { // variable definitions: wxVariant variant; wxDataViewColumn* dataViewColumnPtr; wxDataViewCtrl* dataViewCtrlPtr; dataViewCtrlPtr = dynamic_cast<wxDataViewCtrl*>(GetWXPeer()); wxCHECK_MSG(dataViewCtrlPtr != NULL,errDataBrowserNotConfigured,_("Pointer to data view control not set correctly.")); wxCHECK_MSG(dataViewCtrlPtr->GetModel() != NULL,errDataBrowserNotConfigured,_("Pointer to model not set correctly.")); dataViewColumnPtr = GetColumnPtr(propertyID); wxCHECK_MSG(dataViewColumnPtr != NULL,errDataBrowserNotConfigured,_("No column for the specified column position existing.")); wxCHECK_MSG(dataViewColumnPtr->GetRenderer() != NULL,errDataBrowserNotConfigured,_("No renderer specified for column.")); dataViewCtrlPtr->GetModel()->GetValue(variant,wxDataViewItem(reinterpret_cast<void*>(itemID)),dataViewColumnPtr->GetModelColumn()); if (!(variant.IsNull())) { dataViewColumnPtr->GetRenderer()->GetNativeData()->SetItemDataRef(itemData); dataViewColumnPtr->GetRenderer()->SetValue(variant); wxCHECK_MSG(dataViewColumnPtr->GetRenderer()->MacRender(),errDataBrowserNotConfigured,_("Rendering failed.")); } return noErr; } else // react on special system requests { switch (propertyID) { case kDataBrowserContainerIsClosableProperty: { // variable definitions: wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(GetWXPeer())); wxCHECK_MSG(dataViewCtrlPtr != NULL,errDataBrowserNotConfigured,_("Pointer to data view control not set correctly.")); // initialize wxWidget event: wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_ITEM_COLLAPSING,dataViewCtrlPtr->GetId()); // variable definition dataViewEvent.SetEventObject(dataViewCtrlPtr); dataViewEvent.SetItem (wxDataViewItem(reinterpret_cast<void*>(itemID))); dataViewEvent.SetModel (dataViewCtrlPtr->GetModel()); // finally send the equivalent wxWidget event: dataViewCtrlPtr->GetEventHandler()->ProcessEvent(dataViewEvent); // opening the container is allowed if not vetoed: return ::SetDataBrowserItemDataBooleanValue(itemData,dataViewEvent.IsAllowed()); } /* block */ case kDataBrowserContainerIsOpenableProperty: { // variable definitions: wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(GetWXPeer())); wxCHECK_MSG(dataViewCtrlPtr != NULL,errDataBrowserNotConfigured,_("Pointer to data view control not set correctly.")); // initialize wxWidget event: wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_ITEM_EXPANDING,dataViewCtrlPtr->GetId()); // variable definition dataViewEvent.SetEventObject(dataViewCtrlPtr); dataViewEvent.SetItem (wxDataViewItem(reinterpret_cast<void*>(itemID))); dataViewEvent.SetModel (dataViewCtrlPtr->GetModel()); // finally send the equivalent wxWidget event: dataViewCtrlPtr->GetEventHandler()->ProcessEvent(dataViewEvent); // opening the container is allowed if not vetoed: return ::SetDataBrowserItemDataBooleanValue(itemData,dataViewEvent.IsAllowed()); } /* block */ case kDataBrowserItemIsContainerProperty: { // variable definition: wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(GetWXPeer())); wxCHECK_MSG(dataViewCtrlPtr != NULL,errDataBrowserNotConfigured,_("Pointer to data view control not set correctly.")); wxCHECK_MSG(dataViewCtrlPtr->GetModel() != NULL,errDataBrowserNotConfigured,_("Pointer to model not set correctly.")); return ::SetDataBrowserItemDataBooleanValue(itemData,dataViewCtrlPtr->GetModel()->IsContainer(wxDataViewItem(reinterpret_cast<void*>(itemID)))); } /* block */ case kDataBrowserItemIsEditableProperty: return ::SetDataBrowserItemDataBooleanValue(itemData,true); } } } return errDataBrowserPropertyNotSupported; } void wxMacDataViewDataBrowserListViewControl::DataBrowserItemNotificationProc(DataBrowserItemID itemID, DataBrowserItemNotification message, DataBrowserItemDataRef itemData) { wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(GetWXPeer())); // check if the data view control pointer still exists because this call back function can still be called when the control has already been deleted: if (dataViewCtrlPtr != NULL) switch (message) { case kDataBrowserContainerClosed: dataViewCtrlPtr->FinishCustomItemEditing(); // stop editing of a custom item first (if necessary) { // initialize wxWidget event: wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_ITEM_COLLAPSED,dataViewCtrlPtr->GetId()); // variable definition dataViewEvent.SetEventObject(dataViewCtrlPtr); dataViewEvent.SetItem(wxDataViewItem(reinterpret_cast<void*>(itemID))); // finally send the equivalent wxWidget event: dataViewCtrlPtr->GetEventHandler()->ProcessEvent(dataViewEvent); } /* block */ break; case kDataBrowserContainerOpened: dataViewCtrlPtr->FinishCustomItemEditing(); // stop editing of a custom item first (if necessary) { // initialize wxWidget event: wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_ITEM_EXPANDED,dataViewCtrlPtr->GetId()); // variable definition dataViewEvent.SetEventObject(dataViewCtrlPtr); dataViewEvent.SetItem(wxDataViewItem(reinterpret_cast<void*>(itemID))); // finally send the equivalent wxWidget event: dataViewCtrlPtr->GetEventHandler()->ProcessEvent(dataViewEvent); // add children to the expanded container: dataViewCtrlPtr->AddChildren(wxDataViewItem(reinterpret_cast<void*>(itemID))); } /* block */ break; case kDataBrowserEditStarted: dataViewCtrlPtr->FinishCustomItemEditing(); // stop editing of a custom item first (if necessary) { // initialize wxWidget event: DataBrowserPropertyID propertyID; wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_STARTED,dataViewCtrlPtr->GetId()); // variable definition dataViewEvent.SetEventObject(dataViewCtrlPtr); dataViewEvent.SetItem(wxDataViewItem(reinterpret_cast<void*>(itemID))); if (GetPropertyID(itemData,&propertyID) == noErr) { // variable definition and initialization: DataBrowserTableViewColumnIndex columnIndex; wxCHECK_RET(GetColumnIndex(propertyID,&columnIndex),_("Column index not found.")); dataViewEvent.SetColumn(columnIndex); dataViewEvent.SetDataViewColumn(GetColumnPtr(propertyID)); } // finally send the equivalent wxWidget event: dataViewCtrlPtr->GetEventHandler()->ProcessEvent(dataViewEvent); } /* block */ break; case kDataBrowserEditStopped: { // initialize wxWidget event: DataBrowserPropertyID propertyID; wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_DONE,dataViewCtrlPtr->GetId()); // variable definition dataViewEvent.SetEventObject(dataViewCtrlPtr); dataViewEvent.SetItem(wxDataViewItem(reinterpret_cast<void*>(itemID))); if (GetPropertyID(itemData,&propertyID) == noErr) { // variable definition and initialization: DataBrowserTableViewColumnIndex columnIndex; wxCHECK_RET(GetColumnIndex(propertyID,&columnIndex),_("Column index not found.")); dataViewEvent.SetColumn(columnIndex); dataViewEvent.SetDataViewColumn(GetColumnPtr(propertyID)); } // finally send the equivalent wxWidget event: dataViewCtrlPtr->GetEventHandler()->ProcessEvent(dataViewEvent); } /* block */ break; case kDataBrowserItemAdded: dataViewCtrlPtr->FinishCustomItemEditing(); break; case kDataBrowserItemDeselected: dataViewCtrlPtr->FinishCustomItemEditing(); break; case kDataBrowserItemDoubleClicked: { // initialize wxWidget event: wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_ITEM_ACTIVATED,dataViewCtrlPtr->GetId()); // variable definition dataViewEvent.SetEventObject(dataViewCtrlPtr); dataViewEvent.SetItem(wxDataViewItem(reinterpret_cast<void*>(itemID))); // finally send the equivalent wxWidget event: dataViewCtrlPtr->GetEventHandler()->ProcessEvent(dataViewEvent); } /* block */ break; case kDataBrowserItemRemoved: dataViewCtrlPtr->FinishCustomItemEditing(); // stop editing of a custom item first (if necessary) break; case kDataBrowserItemSelected: break; // not implemented by wxWidgets; see kDataBrowserSelectionSetChanged case kDataBrowserSelectionSetChanged: { // initialize wxWidget event: wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_SELECTION_CHANGED,dataViewCtrlPtr->GetId()); // variable definition dataViewEvent.SetEventObject(dataViewCtrlPtr); dataViewEvent.SetModel (dataViewCtrlPtr->GetModel()); // finally send the equivalent wxWidget event: dataViewCtrlPtr->GetEventHandler()->ProcessEvent(dataViewEvent); } /* block */ break; case kDataBrowserTargetChanged: // no idea if this notification is ever sent break; case kDataBrowserUserStateChanged: { // finish custom item editing if necessary: dataViewCtrlPtr->FinishCustomItemEditing(); // update column widths: for (size_t i=0; i<dataViewCtrlPtr->GetColumnCount(); ++i) { // constant definition for abbreviational purposes: wxDataViewColumn* const columnPtr = dataViewCtrlPtr->GetColumnPtr(i); // variable definition: UInt16 columnWidth; wxCHECK_RET(GetColumnWidth(columnPtr->GetNativeData()->GetPropertyID(),&columnWidth) == noErr,_("Column width could not be determined")); columnPtr->SetWidthVariable(columnWidth); } // update sorting orders: DataBrowserPropertyID propertyID; // variable definition if ((GetSortProperty(&propertyID) == noErr) && (propertyID >= kMinPropertyID)) { DataBrowserSortOrder sortOrder; DataBrowserTableViewColumnIndex columnIndex; if ((GetSortOrder(&sortOrder) == noErr) && (GetColumnIndex(propertyID,&columnIndex) == noErr)) { // variable definition and initialization: wxDataViewColumn* columnPtr; columnPtr = dataViewCtrlPtr->GetColumn(columnIndex); // check if the sort order has changed: if ( columnPtr->IsSortOrderAscending() && (sortOrder == kDataBrowserOrderDecreasing) || !(columnPtr->IsSortOrderAscending()) && (sortOrder == kDataBrowserOrderIncreasing)) { columnPtr->SetSortOrder(!(columnPtr->IsSortOrderAscending())); // initialize wxWidget event: wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_COLUMN_SORTED,dataViewCtrlPtr->GetId()); // variable defintion dataViewEvent.SetEventObject(dataViewCtrlPtr); dataViewEvent.SetColumn(columnIndex); dataViewEvent.SetDataViewColumn(columnPtr); // finally send the equivalent wxWidget event: dataViewCtrlPtr->GetEventHandler()->ProcessEvent(dataViewEvent); } } } } /* block */ break; } } void wxMacDataViewDataBrowserListViewControl::DataBrowserDrawItemProc(DataBrowserItemID itemID, DataBrowserPropertyID propertyID, DataBrowserItemState state, Rect const* rectangle, SInt16 WXUNUSED(bitDepth), Boolean WXUNUSED(colorDevice)) { DataBrowserTableViewColumnIndex columnIndex; wxDataViewColumn* dataViewColumnPtr; wxDataViewCtrl* dataViewCtrlPtr; wxDataViewCustomRenderer* dataViewCustomRendererPtr; wxVariant dataToRender; dataViewCtrlPtr = dynamic_cast<wxDataViewCtrl*>(GetWXPeer()); wxCHECK_RET(dataViewCtrlPtr != NULL, _("Pointer to data view control not set correctly.")); wxCHECK_RET(dataViewCtrlPtr->GetModel() != NULL, _("Pointer to model not set correctly.")); wxCHECK_RET(GetColumnIndex(propertyID,&columnIndex) == noErr,_("Could not determine column index.")); dataViewColumnPtr = GetColumnPtr(propertyID); wxCHECK_RET(dataViewColumnPtr != NULL,_("No column for the specified column existing.")); dataViewCustomRendererPtr = dynamic_cast<wxDataViewCustomRenderer*>(dataViewColumnPtr->GetRenderer()); wxCHECK_RET(dataViewCustomRendererPtr != NULL,_("No renderer or invalid renderer type specified for custom data column.")); dataViewCtrlPtr->GetModel()->GetValue(dataToRender,wxDataViewItem(reinterpret_cast<void*>(itemID)),dataViewColumnPtr->GetModelColumn()); dataViewCustomRendererPtr->SetValue(dataToRender); wxDataViewItem dataItem( reinterpret_cast<void*>(itemID) ); dataViewCtrlPtr->GetModel()->GetValue(dataToRender,dataItem,dataViewColumnPtr->GetModelColumn()); dataViewCustomRendererPtr->SetValue(dataToRender); // try to determine the content's size (drawable part): Rect content; RgnHandle rgn(NewRgn()); UInt16 headerHeight; if (GetControlRegion(m_controlRef,kControlContentMetaPart,rgn) == noErr) GetRegionBounds(rgn,&content); else GetControlBounds(m_controlRef, &content); ::DisposeRgn(rgn); // space for the header GetHeaderButtonHeight(&headerHeight); content.top += headerHeight; // extra space for the frame (todo: do not how to determine the space automatically from the control) content.top += 5; content.left += 5; content.right -= 3; content.bottom -= 3; // extra space for the scrollbars: content.bottom -= wxSystemSettings::GetMetric(wxSYS_HSCROLL_Y); content.right -= wxSystemSettings::GetMetric(wxSYS_VSCROLL_X); wxDC *dc = dataViewCustomRendererPtr->GetDC(); int active_border_fudge = 0; if (dataViewCtrlPtr->HasFocus() && !dataViewCtrlPtr->HasFlag( wxBORDER_NONE )) active_border_fudge = 1; else active_border_fudge = -2; wxRect cellrect( static_cast<int>(rectangle->left + active_border_fudge), static_cast<int>(rectangle->top + active_border_fudge), static_cast<int>(1+rectangle->right-rectangle->left), static_cast<int>(rectangle->bottom-rectangle->top) ); bool is_active = IsControlActive( m_controlRef ); if (state == kDataBrowserItemIsSelected) { wxColour col( wxMacCreateCGColorFromHITheme( (is_active) ? kThemeBrushAlternatePrimaryHighlightColor : kThemeBrushSecondaryHighlightColor ) ); wxRect rect = cellrect; Rect itemrect; GetDataBrowserItemPartBounds( m_controlRef, itemID, propertyID, kDataBrowserPropertyEnclosingPart, &itemrect ); rect.x = itemrect.left-2; rect.width = itemrect.right-itemrect.left+3; wxDCPenChanger setPen(*dc, *wxTRANSPARENT_PEN); wxDCBrushChanger setBrush(*dc, col); dc->DrawRectangle(rect); } wxDataViewModel *model = dataViewCtrlPtr->GetModel(); if ((columnIndex == 0) || !model->IsContainer(dataItem) || model->HasContainerColumns(dataItem)) { // make sure that 'Render' can draw only in the allowed area: dc->SetClippingRegion(content.left,content.top,content.right-content.left+1,content.bottom-content.top+1); (void) (dataViewCustomRendererPtr->WXCallRender( cellrect, dc, ((state == kDataBrowserItemIsSelected) ? wxDATAVIEW_CELL_SELECTED : 0))); dc->DestroyClippingRegion(); // probably not necessary } dataViewCustomRendererPtr->SetDC(NULL); } Boolean wxMacDataViewDataBrowserListViewControl::DataBrowserEditItemProc( DataBrowserItemID WXUNUSED(itemID), DataBrowserPropertyID WXUNUSED(propertyID), CFStringRef WXUNUSED(theString), Rect* WXUNUSED(maxEditTextRect), Boolean* WXUNUSED(shrinkToFit)) { return false; } Boolean wxMacDataViewDataBrowserListViewControl::DataBrowserHitTestProc(DataBrowserItemID WXUNUSED(itemID), DataBrowserPropertyID WXUNUSED(property), Rect const* WXUNUSED(theRect), Rect const* WXUNUSED(mouseRect)) { return true; } DataBrowserTrackingResult wxMacDataViewDataBrowserListViewControl::DataBrowserTrackingProc(DataBrowserItemID itemID, DataBrowserPropertyID propertyID, Rect const* theRect, Point WXUNUSED(startPt), EventModifiers WXUNUSED(modifiers)) { wxDataViewColumn* dataViewColumnPtr; wxDataViewCtrl* dataViewCtrlPtr; wxDataViewCustomRenderer* dataViewCustomRendererPtr; wxDataViewItem dataViewCustomRendererItem; dataViewCtrlPtr = dynamic_cast<wxDataViewCtrl*>(GetWXPeer()); wxCHECK_MSG(dataViewCtrlPtr != NULL, false,_("Pointer to data view control not set correctly.")); wxCHECK_MSG(dataViewCtrlPtr->GetModel() != NULL,false,_("Pointer to model not set correctly.")); dataViewCustomRendererItem = reinterpret_cast<void*>(itemID); wxCHECK_MSG(dataViewCustomRendererItem.IsOk(),kDataBrowserNothingHit,_("Invalid data view item")); dataViewColumnPtr = GetColumnPtr(propertyID); wxCHECK_MSG(dataViewColumnPtr != NULL,kDataBrowserNothingHit,_("No column existing.")); dataViewCustomRendererPtr = dynamic_cast<wxDataViewCustomRenderer*>(dataViewColumnPtr->GetRenderer()); wxCHECK_MSG(dataViewCustomRendererPtr != NULL,kDataBrowserNothingHit,_("No renderer or invalid renderer type specified for custom data column.")); // if the currently edited item is identical to the to be edited nothing is done (this hit should only be handled in the control itself): if (dataViewCtrlPtr->GetCustomRendererItem() == dataViewCustomRendererItem) return kDataBrowserContentHit; // an(other) item is going to be edited and therefore the current editing - if existing - has to be finished: if (dataViewCtrlPtr->GetCustomRendererPtr() != NULL) { dataViewCtrlPtr->GetCustomRendererPtr()->FinishEditing(); dataViewCtrlPtr->SetCustomRendererItem(wxDataViewItem()); dataViewCtrlPtr->SetCustomRendererPtr (NULL); } // check if renderer has got a valid editor control for editing; if this is the case start editing of the new item: if (dataViewCustomRendererPtr->HasEditorCtrl()) { // variable definition: wxRect wxRectangle; ::wxMacNativeToRect(theRect,&wxRectangle); dataViewCustomRendererPtr->StartEditing(dataViewCustomRendererItem,wxRectangle); dataViewCtrlPtr->SetCustomRendererItem(dataViewCustomRendererItem); dataViewCtrlPtr->SetCustomRendererPtr (dataViewCustomRendererPtr); } return kDataBrowserContentHit; } Boolean wxMacDataViewDataBrowserListViewControl::DataBrowserAcceptDragProc(DragReference dragRef, DataBrowserItemID itemID) { bool acceptDrag; UInt16 noOfDraggedItems; wxDataViewCtrl* dataViewCtrlPtr; dataViewCtrlPtr = dynamic_cast<wxDataViewCtrl*>(GetWXPeer()); wxCHECK_MSG(dataViewCtrlPtr != NULL, false,_("Pointer to data view control not set correctly.")); wxCHECK_MSG(dataViewCtrlPtr->GetModel() != NULL,false,_("Pointer to model not set correctly.")); // send a drag possible event for each available and item und proceed with it unless the event is vetoed: ::CountDragItems(dragRef,&noOfDraggedItems); for (UInt16 indexDraggedItem=1; indexDraggedItem<=noOfDraggedItems; ++indexDraggedItem) { // collect native information: ItemReference itemRef; wxDataObjectComposite* dataObjects; wxMemoryBuffer buffer; ::GetDragItemReferenceNumber(dragRef,indexDraggedItem,&itemRef); // the index begins with 1! dataObjects = GetDnDDataObjects(dragRef,itemRef); // create wxWidget's event: wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_ITEM_DROP_POSSIBLE,dataViewCtrlPtr->GetId()); dataViewEvent.SetEventObject(dataViewCtrlPtr); dataViewEvent.SetItem(reinterpret_cast<void*>(itemID)); // this is the item that receives the event // (can be an invalid item ID, this is especially useful if the dataview does not contain any items) dataViewEvent.SetModel(dataViewCtrlPtr->GetModel()); dataViewEvent.SetDataObject(dataObjects); dataViewEvent.SetDataFormat(GetDnDDataFormat(dataObjects)); if (dataViewEvent.GetDataFormat().GetType() != wxDF_INVALID) { dataViewEvent.SetDataSize(dataObjects->GetDataSize(dataViewEvent.GetDataFormat().GetType())); dataObjects->GetDataHere(dataViewEvent.GetDataFormat().GetType(),buffer.GetWriteBuf(dataViewEvent.GetDataSize())); buffer.UngetWriteBuf(dataViewEvent.GetDataSize()); dataViewEvent.SetDataBuffer(buffer.GetData()); } // send event: acceptDrag = dataViewCtrlPtr->HandleWindowEvent(dataViewEvent) && dataViewEvent.IsAllowed(); delete dataObjects; if (!acceptDrag) return false; } return true; } Boolean wxMacDataViewDataBrowserListViewControl::DataBrowserAddDragItemProc(DragReference dragRef, DataBrowserItemID itemID, ItemReference* itemRef) { Boolean addDragItem; wxDataViewCtrl* dataViewCtrlPtr; wxDataViewItem dataViewItem; dataViewCtrlPtr = dynamic_cast<wxDataViewCtrl*>(GetWXPeer()); wxCHECK_MSG(dataViewCtrlPtr != NULL, false,_("Pointer to data view control not set correctly.")); wxCHECK_MSG(dataViewCtrlPtr->GetModel() != NULL,false,_("Pointer to model not set correctly.")); dataViewItem = reinterpret_cast<void*>(itemID); wxCHECK_MSG(dataViewItem.IsOk(),false,_("Invalid data view item")); // send a begin drag event and proceed with dragging unless the event is vetoed: wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_ITEM_BEGIN_DRAG,dataViewCtrlPtr->GetId()); dataViewEvent.SetEventObject(dataViewCtrlPtr); dataViewEvent.SetItem(dataViewItem); dataViewEvent.SetModel(dataViewCtrlPtr->GetModel()); // the dataview event object is also initialized with a default set of data; as it is a set of data and the user should be able to easily complete // the object a wxDataObjectComposite object is used; // currently, the composite object only contains a TAB concatenated string of all data: wxDataObjectComposite* dataObject(new wxDataObjectComposite()); dataObject->Add(new wxTextDataObject(::ConcatenateDataViewItemValues(dataViewCtrlPtr,dataViewItem))); dataViewEvent.SetDataObject(dataObject); // check if event has not been vetoed: addDragItem = dataViewCtrlPtr->HandleWindowEvent(dataViewEvent) && dataViewEvent.IsAllowed(); if (addDragItem) { // for the internal drag & drop functions create two flavors: // - the data browser's item id; // - the data contained the dataview event object (if available). // Definition: a flavor is the type dependent representation of identical data. // Example: a number can be represented by its value and by its value converted to a string. In this case the flavor // of the number's internal representation is typeSInt32 while its string representation has got the flavor 'TEXT'. // Item id is one of the flavors: wxCHECK_MSG(::AddDragItemFlavor(dragRef,*itemRef,typeUInt32,&itemID,sizeof(itemID),0) == noErr,false,_("Unable to handle native drag&drop data")); // if the dataview event object contains data it is used for additional flavors; all natively known flavors are supported: if (dataViewEvent.GetDataObject() != NULL) { // constant definition for abbreviational purposes: size_t const noOfFormats = dataViewEvent.GetDataObject()->GetFormatCount(); if (noOfFormats > 0) { // variable definition: wxDataFormat* dataFormats; dataFormats = new wxDataFormat[noOfFormats]; dataViewEvent.GetDataObject()->GetAllFormats(dataFormats,wxDataObject::Get); for (size_t i=0; i<noOfFormats; ++i) switch (dataFormats[i].GetType()) { case wxDF_INVALID: wxFAIL_MSG(_("Data object has invalid data format")); break; case wxDF_TEXT: { // constant definition for abbreviational purposes: size_t const dataSize = dataViewEvent.GetDataObject()->GetDataSize(wxDF_TEXT); // variable definition and initialization: wxMemoryBuffer dataObject(dataSize); dataViewEvent.GetDataObject()->GetDataHere(wxDF_TEXT,dataObject.GetWriteBuf(dataSize)); dataObject.UngetWriteBuf(dataSize); if (::AddDragItemFlavor(dragRef,*itemRef,'TEXT',dataObject.GetData(),dataSize,0) != noErr) wxFAIL_MSG(_("Adding flavor TEXT failed")); } /* block */ break; case wxDF_UNICODETEXT: { // constant definition for abbreviational purposes: size_t const dataSize = dataViewEvent.GetDataObject()->GetDataSize(wxDF_TEXT); // as there is no direct access to the data copy it to a memory buffer: wxMemoryBuffer dataObject(dataSize); dataViewEvent.GetDataObject()->GetDataHere(wxDF_TEXT,dataObject.GetWriteBuf(dataSize)); dataObject.UngetWriteBuf(dataSize); // if the data is stored in unicode format the internal representation is utf-8 (not mentioned in the documentation but in the source code); // DnD uses fixed utf-16 representation -> use the OSX functions for a conversion: CFDataRef osxData (::CFDataCreateWithBytesNoCopy(kCFAllocatorDefault,reinterpret_cast<UInt8*>(dataObject.GetData()),dataSize,kCFAllocatorNull)); CFStringRef osxString(::CFStringCreateFromExternalRepresentation(kCFAllocatorDefault,osxData,kCFStringEncodingUTF8)); // the osxString contains now the data and therefore the previously occupied memory can be released and re-used: ::CFRelease(osxData); osxData = ::CFStringCreateExternalRepresentation(kCFAllocatorDefault,osxString,kCFStringEncodingUTF16,32); if (::AddDragItemFlavor(dragRef,*itemRef,'utxt',::CFDataGetBytePtr(osxData),::CFDataGetLength(osxData),0) != noErr) wxFAIL_MSG(_("Adding flavor utxt failed")); // clean up: ::CFRelease(osxData); ::CFRelease(osxString); } /* block */ break; case wxDF_BITMAP: case wxDF_METAFILE: case wxDF_SYLK: case wxDF_DIF: case wxDF_TIFF: case wxDF_OEMTEXT: case wxDF_DIB: case wxDF_PALETTE: case wxDF_PENDATA: case wxDF_RIFF: case wxDF_WAVE: case wxDF_ENHMETAFILE: case wxDF_FILENAME: case wxDF_LOCALE: case wxDF_PRIVATE: case wxDF_HTML: break; // not (yet) supported data formats default: wxFAIL_MSG(_("Unknown data format")); } delete[] dataFormats; } } } // clean-up and return result: delete dataObject; return addDragItem; } Boolean wxMacDataViewDataBrowserListViewControl::DataBrowserReceiveDragProc(DragReference dragRef, DataBrowserItemID itemID) { UInt16 noOfDraggedItems; wxDataViewCtrl* dataViewCtrlPtr; dataViewCtrlPtr = dynamic_cast<wxDataViewCtrl*>(GetWXPeer()); wxCHECK_MSG(dataViewCtrlPtr != NULL, false,_("Pointer to data view control not set correctly.")); wxCHECK_MSG(dataViewCtrlPtr->GetModel() != NULL,false,_("Pointer to model not set correctly.")); // send a drag possible event for each available and item und proceed with it unless the event is vetoed: ::CountDragItems(dragRef,&noOfDraggedItems); for (UInt16 indexDraggedItem=1; indexDraggedItem<=noOfDraggedItems; ++indexDraggedItem) { bool receiveDrag; ItemReference itemRef; wxDataObjectComposite* dataObjects; wxMemoryBuffer buffer; // collect native information: ::GetDragItemReferenceNumber(dragRef,indexDraggedItem,&itemRef); // the index begins with 1! dataObjects = GetDnDDataObjects(dragRef,itemRef); // create wxWidget's event: wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_ITEM_DROP,dataViewCtrlPtr->GetId()); dataViewEvent.SetEventObject(dataViewCtrlPtr); dataViewEvent.SetItem(reinterpret_cast<void*>(itemID)); // this is the item that receives the event // (can be an invalid item ID, this is especially useful if the dataview does not contain any items) dataViewEvent.SetModel(dataViewCtrlPtr->GetModel()); dataViewEvent.SetDataObject(dataObjects); dataViewEvent.SetDataFormat(GetDnDDataFormat(dataObjects)); if (dataViewEvent.GetDataFormat().GetType() != wxDF_INVALID) { dataViewEvent.SetDataSize(dataObjects->GetDataSize(dataViewEvent.GetDataFormat().GetType())); dataObjects->GetDataHere(dataViewEvent.GetDataFormat().GetType(),buffer.GetWriteBuf(dataViewEvent.GetDataSize())); buffer.UngetWriteBuf(dataViewEvent.GetDataSize()); dataViewEvent.SetDataBuffer(buffer.GetData()); } // send event: receiveDrag = dataViewCtrlPtr->HandleWindowEvent(dataViewEvent) && dataViewEvent.IsAllowed(); delete dataObjects; if (!receiveDrag) return false; } return true; } // // drag & drop helper methods // wxDataFormat wxMacDataViewDataBrowserListViewControl::GetDnDDataFormat(wxDataObjectComposite* dataObjects) { wxDataFormat resultFormat; if (dataObjects != NULL) { bool compatible(true); size_t const noOfFormats = dataObjects->GetFormatCount(); size_t indexFormat; wxDataFormat* formats; // get all formats and check afterwards if the formats are compatible; if they are compatible the preferred format is returned otherwise // wxDF_INVALID is returned; // currently compatible types (ordered by priority are): // - wxDF_UNICODETEXT - wxDF_TEXT formats = new wxDataFormat[noOfFormats]; dataObjects->GetAllFormats(formats); indexFormat = 0; while ((indexFormat < noOfFormats) && compatible) { switch (resultFormat.GetType()) { case wxDF_INVALID: resultFormat.SetType(formats[indexFormat].GetType()); // first format (should only be reached if indexFormat == 0 break; case wxDF_TEXT: if (formats[indexFormat].GetType() == wxDF_UNICODETEXT) resultFormat.SetType(wxDF_UNICODETEXT); else // incompatible { resultFormat.SetType(wxDF_INVALID); compatible = false; } break; case wxDF_UNICODETEXT: if (formats[indexFormat].GetType() != wxDF_TEXT) { resultFormat.SetType(wxDF_INVALID); compatible = false; } break; default: resultFormat.SetType(wxDF_INVALID); // not (yet) supported format compatible = false; } ++indexFormat; } /* while */ // clean up: delete[] formats; } else resultFormat = wxDF_INVALID; return resultFormat; } wxDataObjectComposite* wxMacDataViewDataBrowserListViewControl::GetDnDDataObjects(DragReference dragRef, ItemReference itemRef) const { UInt16 noOfFlavors; wxDataObjectComposite* dataObject; ::CountDragItemFlavors(dragRef,itemRef,&noOfFlavors); if (noOfFlavors > 0) { // as the native drag data can be separated into TEXT and UTXT a pointer to a wxTextDataObject is used to track the existence of 'TEXT' and 'utxt' flavors: wxTextDataObject* textDataObject(NULL); dataObject = new wxDataObjectComposite(); for (UInt16 indexFlavor=1; indexFlavor<=noOfFlavors; ++indexFlavor) { // variable definition: FlavorType flavorDataObject; if (::GetFlavorType(dragRef,itemRef,indexFlavor,&flavorDataObject) == noErr) // GetFlavorType uses a 1 based index! switch (flavorDataObject) { case 'TEXT': if (textDataObject == NULL) // otherwise a 'utxt' flavor has already been found that gets priority compared to the 'TEXT' flavor { // variable definitions: Size nativeDataSize; wxMemoryBuffer nativeData; if ((::GetFlavorDataSize(dragRef,itemRef,'TEXT',&nativeDataSize) == noErr) && (::GetFlavorData(dragRef,itemRef,'TEXT',nativeData.GetWriteBuf(nativeDataSize),&nativeDataSize,0) == noErr)) { nativeData.UngetWriteBuf(nativeDataSize); textDataObject = new wxTextDataObject(); if (textDataObject->SetData(nativeData.GetDataLen(),nativeData.GetData())) dataObject->Add(textDataObject); else { wxDELETE(textDataObject); } } } /* block */ break; case 'utxt': { // variable definition: Size nativeDataSize; if (::GetFlavorDataSize(dragRef,itemRef,'utxt',&nativeDataSize) == noErr) { CFMutableDataRef draggedData; draggedData = ::CFDataCreateMutable(kCFAllocatorDefault,nativeDataSize); ::CFDataSetLength(draggedData,nativeDataSize); if (::GetFlavorData(dragRef,itemRef,'utxt',::CFDataGetMutableBytePtr(draggedData),&nativeDataSize,0) == noErr) { // convert internally used UTF-16 representation to a UTF-8 representation: CFDataRef osxData; CFStringRef osxString; osxString = ::CFStringCreateFromExternalRepresentation(kCFAllocatorDefault,draggedData,kCFStringEncodingUTF16); // BOM character is handled by this function automatically osxData = ::CFStringCreateExternalRepresentation(kCFAllocatorDefault,osxString,kCFStringEncodingUTF8,32); if (textDataObject == NULL) { textDataObject = new wxTextDataObject(); if (textDataObject->SetData(::CFDataGetLength(osxData),::CFDataGetBytePtr(osxData))) dataObject->Add(textDataObject); else { wxDELETE(textDataObject); } } else // overwrite data because the 'utxt' flavor has priority over the 'TEXT' flavor (void) textDataObject->SetData(::CFDataGetLength(osxData),::CFDataGetBytePtr(osxData)); // clean up: ::CFRelease(osxData); ::CFRelease(osxString); } // clean up: ::CFRelease(draggedData); } } /* block */ break; } } } else dataObject = NULL; return dataObject; } // // other methods // wxDataViewColumn* wxMacDataViewDataBrowserListViewControl::GetColumnPtr(DataBrowserPropertyID propertyID) const { wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(GetWXPeer())); if (dataViewCtrlPtr != NULL) { size_t const noOfColumns = dataViewCtrlPtr->GetColumnCount(); for (size_t i=0; i<noOfColumns; ++i) if (dataViewCtrlPtr->GetColumnPtr(i)->GetNativeData()->GetPropertyID() == propertyID) return dataViewCtrlPtr->GetColumnPtr(i); } return NULL; } // --------------------------------------------------------- // wxDataViewRenderer // --------------------------------------------------------- wxDataViewRenderer::wxDataViewRenderer(wxString const& varianttype, wxDataViewCellMode mode, int align) :wxDataViewRendererBase(varianttype,mode,align), m_alignment(align), m_mode(mode), m_NativeDataPtr(NULL) { } wxDataViewRenderer::~wxDataViewRenderer() { delete m_NativeDataPtr; } void wxDataViewRenderer::SetAlignment(int align) { m_alignment = align; } namespace { // get the browser control or NULL if anything went wrong (it's not supposed to // so we assert if it did) wxMacDataViewDataBrowserListViewControl * GetBrowserFromCol(wxDataViewColumn *col) { wxCHECK_MSG( col, NULL, "should have a valid column" ); wxDataViewCtrl * const dvc = col->GetOwner(); wxCHECK_MSG( dvc, NULL, "column must be associated with the control" ); return static_cast<wxMacDataViewDataBrowserListViewControl *>(dvc->GetPeer()); } } // anonymous namespace void wxDataViewRenderer::SetMode(wxDataViewCellMode mode) { wxDataViewColumn * const col = GetOwner(); wxMacDataViewDataBrowserListViewControl * const browser = GetBrowserFromCol(col); wxCHECK_RET( browser, "must be fully initialized" ); const DataBrowserPropertyID colID = col->GetNativeData()->GetPropertyID(); DataBrowserPropertyFlags flags; verify_noerr( browser->GetPropertyFlags(colID, &flags) ); if ( (mode == wxDATAVIEW_CELL_EDITABLE) || (mode == wxDATAVIEW_CELL_ACTIVATABLE) ) flags |= kDataBrowserPropertyIsEditable; else flags &= ~kDataBrowserPropertyIsEditable; verify_noerr( browser->SetPropertyFlags(colID, flags) ); } void wxDataViewRenderer::EnableEllipsize(wxEllipsizeMode mode) { wxDataViewColumn * const col = GetOwner(); wxMacDataViewDataBrowserListViewControl * const browser = GetBrowserFromCol(col); wxCHECK_RET( browser, "must be fully initialized" ); const DataBrowserPropertyID colID = col->GetNativeData()->GetPropertyID(); DataBrowserPropertyFlags flags; browser->GetPropertyFlags(colID, &flags); flags &= ~(kDataBrowserDoNotTruncateText | kDataBrowserTruncateTextAtStart | kDataBrowserTruncateTextMiddle | kDataBrowserTruncateTextAtEnd); int flagToSet = 0; switch ( mode ) { case wxELLIPSIZE_NONE: flagToSet = kDataBrowserDoNotTruncateText; break; case wxELLIPSIZE_START: flagToSet = kDataBrowserTruncateTextAtStart; break; case wxELLIPSIZE_MIDDLE: flagToSet = kDataBrowserTruncateTextMiddle; break; case wxELLIPSIZE_END: flagToSet = kDataBrowserTruncateTextAtEnd; break; } wxCHECK_RET( flagToSet, "unknown wxEllipsizeMode value" ); flags |= flagToSet; verify_noerr( browser->SetPropertyFlags(colID, flags) ); } wxEllipsizeMode wxDataViewRenderer::GetEllipsizeMode() const { wxDataViewColumn * const col = GetOwner(); wxMacDataViewDataBrowserListViewControl * const browser = GetBrowserFromCol(col); wxCHECK_MSG( browser, wxELLIPSIZE_NONE, "must be fully initialized" ); const DataBrowserPropertyID colID = col->GetNativeData()->GetPropertyID(); DataBrowserPropertyFlags flags; browser->GetPropertyFlags(colID, &flags); if ( flags & kDataBrowserDoNotTruncateText ) return wxELLIPSIZE_NONE; if ( flags & kDataBrowserTruncateTextAtStart ) return wxELLIPSIZE_START; if ( flags & kDataBrowserTruncateTextAtEnd ) return wxELLIPSIZE_END; // kDataBrowserTruncateTextMiddle == 0 so there is no need to test for it return wxELLIPSIZE_MIDDLE; } void wxDataViewRenderer::SetNativeData(wxDataViewRendererNativeData* newNativeDataPtr) { delete m_NativeDataPtr; m_NativeDataPtr = newNativeDataPtr; } IMPLEMENT_ABSTRACT_CLASS(wxDataViewRenderer,wxDataViewRendererBase) // --------------------------------------------------------- // wxDataViewCustomRenderer // --------------------------------------------------------- wxDataViewCustomRenderer::wxDataViewCustomRenderer(wxString const& varianttype, wxDataViewCellMode mode, int align) :wxDataViewCustomRendererBase(varianttype,mode,align), m_editorCtrlPtr(NULL), m_DCPtr(NULL) { SetNativeData(new wxDataViewRendererNativeData(kDataBrowserCustomType)); } bool wxDataViewCustomRenderer::MacRender() { return true; } IMPLEMENT_ABSTRACT_CLASS(wxDataViewCustomRenderer, wxDataViewRenderer) // --------------------------------------------------------- // wxDataViewTextRenderer // --------------------------------------------------------- wxDataViewTextRenderer::wxDataViewTextRenderer(wxString const& varianttype, wxDataViewCellMode mode, int align) :wxDataViewRenderer(varianttype,mode,align) { SetNativeData(new wxDataViewRendererNativeData(kDataBrowserTextType)); } bool wxDataViewTextRenderer::MacRender() { wxCHECK_MSG(GetValue().GetType() == GetVariantType(),false,wxString(_("Text renderer cannot render value; value type: ")) << GetValue().GetType()); wxCFStringRef cfString(GetValue().GetString(),(GetView()->GetFont().Ok() ? GetView()->GetFont().GetEncoding() : wxLocale::GetSystemEncoding())); return (::SetDataBrowserItemDataText(GetNativeData()->GetItemDataRef(),cfString) == noErr); } IMPLEMENT_CLASS(wxDataViewTextRenderer,wxDataViewRenderer) // --------------------------------------------------------- // wxDataViewBitmapRenderer // --------------------------------------------------------- wxDataViewBitmapRenderer::wxDataViewBitmapRenderer(wxString const& varianttype, wxDataViewCellMode mode, int align) :wxDataViewRenderer(varianttype,mode,align) { SetNativeData(new wxDataViewRendererNativeData(kDataBrowserIconType)); } bool wxDataViewBitmapRenderer::MacRender() // This method returns 'true' if // - the passed bitmap is valid and it could be assigned to the native data browser; // - the passed bitmap is invalid (or is not initialized); this case simulates a non-existing bitmap. // In all other cases the method returns 'false'. { wxCHECK_MSG(GetValue().GetType() == GetVariantType(),false,wxString(_("Bitmap renderer cannot render value; value type: ")) << GetValue().GetType()); wxBitmap bitmap; bitmap << GetValue(); return (!(bitmap.Ok()) || (::SetDataBrowserItemDataIcon(GetNativeData()->GetItemDataRef(),bitmap.GetIconRef()) == noErr)); } IMPLEMENT_CLASS(wxDataViewBitmapRenderer,wxDataViewRenderer) // --------------------------------------------------------- // wxDataViewIconTextRenderer // --------------------------------------------------------- wxDataViewIconTextRenderer::wxDataViewIconTextRenderer( const wxString& varianttype, wxDataViewCellMode mode, int WXUNUSED(align)) :wxDataViewRenderer(varianttype,mode) { SetNativeData(new wxDataViewRendererNativeData(kDataBrowserIconAndTextType)); } bool wxDataViewIconTextRenderer::MacRender() { wxCHECK_MSG(GetValue().GetType() == GetVariantType(),false,wxString(_("Icon & text renderer cannot render value; value type: ")) << GetValue().GetType()); wxDataViewIconText iconText; iconText << GetValue(); wxCFStringRef cfString(iconText.GetText(),(GetView()->GetFont().Ok() ? GetView()->GetFont().GetEncoding() : wxLocale::GetSystemEncoding())); if (iconText.GetIcon().IsOk()) if (::SetDataBrowserItemDataIcon(GetNativeData()->GetItemDataRef(),MAC_WXHICON(iconText.GetIcon().GetHICON())) != noErr) return false; return (::SetDataBrowserItemDataText(GetNativeData()->GetItemDataRef(),cfString) == noErr); } IMPLEMENT_ABSTRACT_CLASS(wxDataViewIconTextRenderer,wxDataViewRenderer) // --------------------------------------------------------- // wxDataViewToggleRenderer // --------------------------------------------------------- wxDataViewToggleRenderer::wxDataViewToggleRenderer( const wxString& varianttype, wxDataViewCellMode mode, int WXUNUSED(align)) :wxDataViewRenderer(varianttype,mode) { SetNativeData(new wxDataViewRendererNativeData(kDataBrowserCheckboxType)); } bool wxDataViewToggleRenderer::MacRender() { wxCHECK_MSG(GetValue().GetType() == GetVariantType(),false,wxString(_("Toggle renderer cannot render value; value type: ")) << GetValue().GetType()); return (::SetDataBrowserItemDataButtonValue(GetNativeData()->GetItemDataRef(),GetValue().GetBool()) == noErr); } IMPLEMENT_ABSTRACT_CLASS(wxDataViewToggleRenderer,wxDataViewRenderer) // --------------------------------------------------------- // wxDataViewProgressRenderer // --------------------------------------------------------- wxDataViewProgressRenderer::wxDataViewProgressRenderer( const wxString& WXUNUSED(label), wxString const& varianttype, wxDataViewCellMode mode, int align) :wxDataViewRenderer(varianttype,mode,align) { SetNativeData(new wxDataViewRendererNativeData(kDataBrowserProgressBarType)); } bool wxDataViewProgressRenderer::MacRender() { wxCHECK_MSG(GetValue().GetType() == GetVariantType(),false,wxString(_("Progress renderer cannot render value type; value type: ")) << GetValue().GetType()); return ((::SetDataBrowserItemDataMinimum(GetNativeData()->GetItemDataRef(), 0) == noErr) && (::SetDataBrowserItemDataMaximum(GetNativeData()->GetItemDataRef(),100) == noErr) && (::SetDataBrowserItemDataValue (GetNativeData()->GetItemDataRef(),GetValue().GetLong()) == noErr)); } IMPLEMENT_ABSTRACT_CLASS(wxDataViewProgressRenderer,wxDataViewRenderer) // --------------------------------------------------------- // wxDataViewDateRenderer // --------------------------------------------------------- wxDataViewDateRenderer::wxDataViewDateRenderer(wxString const& varianttype, wxDataViewCellMode mode, int align) :wxDataViewRenderer(varianttype,mode,align) { SetNativeData(new wxDataViewRendererNativeData(kDataBrowserDateTimeType)); } bool wxDataViewDateRenderer::MacRender() { wxCHECK_MSG(GetValue().GetType() == GetVariantType(),false,wxString(_("Date renderer cannot render value; value type: ")) << GetValue().GetType()); return (::SetDataBrowserItemDataDateTime(GetNativeData()->GetItemDataRef(),GetValue().GetDateTime().Subtract(wxDateTime(1,wxDateTime::Jan,1904)).GetSeconds().GetLo()) == noErr); } IMPLEMENT_ABSTRACT_CLASS(wxDataViewDateRenderer,wxDataViewRenderer) // --------------------------------------------------------- // wxDataViewColumn // --------------------------------------------------------- wxDataViewColumn::wxDataViewColumn(const wxString& title, wxDataViewRenderer* renderer, unsigned int model_column, int width, wxAlignment align, int flags) :wxDataViewColumnBase(renderer, model_column), m_NativeDataPtr(new wxDataViewColumnNativeData()), m_title(title) { InitCommon(width, align, flags); if ((renderer != NULL) && (renderer->GetAlignment() == wxDVR_DEFAULT_ALIGNMENT)) renderer->SetAlignment(align); } wxDataViewColumn::wxDataViewColumn(const wxBitmap& bitmap, wxDataViewRenderer* renderer, unsigned int model_column, int width, wxAlignment align, int flags) :wxDataViewColumnBase(bitmap, renderer, model_column), m_NativeDataPtr(new wxDataViewColumnNativeData()) { InitCommon(width, align, flags); if ((renderer != NULL) && (renderer->GetAlignment() == wxDVR_DEFAULT_ALIGNMENT)) renderer->SetAlignment(align); } wxDataViewColumn::~wxDataViewColumn() { delete m_NativeDataPtr; } int wxDataViewColumn::GetWidth() const { // FIXME: This returns the last programatically set width and will not work if // the user changes the column's width by dragging it with the mouse. return m_width; } bool wxDataViewColumn::IsSortKey() const { wxDataViewCtrl * const dataViewCtrlPtr(GetOwner()); wxMacDataViewDataBrowserListViewControlPointer macDataViewListCtrlPtr( dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer>( dataViewCtrlPtr->GetPeer())); DataBrowserPropertyID propertyID; return (macDataViewListCtrlPtr->GetSortProperty(&propertyID) == noErr) && (propertyID == GetNativeData()->GetPropertyID()); } void wxDataViewColumn::SetAlignment(wxAlignment align) { wxDataViewCtrl* dataViewCtrlPtr(GetOwner()); m_alignment = align; if (dataViewCtrlPtr != NULL) { wxMacDataViewDataBrowserListViewControlPointer macDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer>(dataViewCtrlPtr->GetPeer())); if (macDataViewListCtrlPtr != NULL) { DataBrowserListViewHeaderDesc headerDescription; wxCHECK_RET(macDataViewListCtrlPtr->GetHeaderDesc(GetNativeData()->GetPropertyID(),&headerDescription) == noErr,_("Could not get header description.")); switch (align) { case wxALIGN_CENTER: case wxALIGN_CENTER_HORIZONTAL: headerDescription.btnFontStyle.just = teCenter; break; case wxALIGN_LEFT: headerDescription.btnFontStyle.just = teFlushLeft; break; case wxALIGN_RIGHT: headerDescription.btnFontStyle.just = teFlushRight; break; default: headerDescription.btnFontStyle.just = teFlushDefault; } wxCHECK_RET(macDataViewListCtrlPtr->SetHeaderDesc(GetNativeData()->GetPropertyID(),&headerDescription) == noErr,_("Could not set alignment.")); } } } void wxDataViewColumn::SetBitmap(wxBitmap const& bitmap) { wxDataViewCtrl* dataViewCtrlPtr(GetOwner()); wxDataViewColumnBase::SetBitmap(bitmap); if (dataViewCtrlPtr != NULL) { wxMacDataViewDataBrowserListViewControlPointer macDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer>(dataViewCtrlPtr->GetPeer())); if (macDataViewListCtrlPtr != NULL) { DataBrowserListViewHeaderDesc headerDescription; wxCHECK_RET(macDataViewListCtrlPtr->GetHeaderDesc(GetNativeData()->GetPropertyID(),&headerDescription) == noErr,_("Could not get header description.")); if (GetBitmap().Ok()) headerDescription.btnContentInfo.u.iconRef = GetBitmap().GetIconRef(); else headerDescription.btnContentInfo.u.iconRef = NULL; wxCHECK_RET(macDataViewListCtrlPtr->SetHeaderDesc(GetNativeData()->GetPropertyID(),&headerDescription) == noErr,_("Could not set icon.")); } } } void wxDataViewColumn::SetMaxWidth(int maxWidth) { wxDataViewCtrl* dataViewCtrlPtr(GetOwner()); m_maxWidth = maxWidth; if (dataViewCtrlPtr != NULL) { wxMacDataViewDataBrowserListViewControlPointer macDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer>(dataViewCtrlPtr->GetPeer())); if (macDataViewListCtrlPtr != NULL) { DataBrowserListViewHeaderDesc headerDescription; wxCHECK_RET(macDataViewListCtrlPtr->GetHeaderDesc(GetNativeData()->GetPropertyID(),&headerDescription) == noErr,_("Could not get header description.")); headerDescription.maximumWidth = static_cast<UInt16>(maxWidth); wxCHECK_RET(macDataViewListCtrlPtr->SetHeaderDesc(GetNativeData()->GetPropertyID(),&headerDescription) == noErr,_("Could not set maximum width.")); } } } void wxDataViewColumn::SetMinWidth(int minWidth) { wxDataViewCtrl* dataViewCtrlPtr(GetOwner()); m_minWidth = minWidth; if (dataViewCtrlPtr != NULL) { wxMacDataViewDataBrowserListViewControlPointer macDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer>(dataViewCtrlPtr->GetPeer())); if (macDataViewListCtrlPtr != NULL) { DataBrowserListViewHeaderDesc headerDescription; wxCHECK_RET(macDataViewListCtrlPtr->GetHeaderDesc(GetNativeData()->GetPropertyID(),&headerDescription) == noErr,_("Could not get header description.")); headerDescription.minimumWidth = static_cast<UInt16>(minWidth); wxCHECK_RET(macDataViewListCtrlPtr->SetHeaderDesc(GetNativeData()->GetPropertyID(),&headerDescription) == noErr,_("Could not set minimum width.")); } } } void wxDataViewColumn::SetReorderable(bool reorderable) { // first set the internal flag of the column: if (reorderable) m_flags |= wxDATAVIEW_COL_REORDERABLE; else m_flags &= ~wxDATAVIEW_COL_REORDERABLE; // if the column is associated with a control change also immediately the flags of the control: wxDataViewCtrl* dataViewCtrlPtr(GetOwner()); if (dataViewCtrlPtr != NULL) { DataBrowserPropertyFlags flags; wxMacDataViewDataBrowserListViewControlPointer macDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer>(dataViewCtrlPtr->GetPeer())); wxCHECK_RET(macDataViewListCtrlPtr != NULL, _("Valid pointer to native data view control does not exist")); wxCHECK_RET(macDataViewListCtrlPtr->GetPropertyFlags(GetNativeData()->GetPropertyID(),&flags) == noErr,_("Could not get property flags.")); if (reorderable) flags |= kDataBrowserListViewMovableColumn; else flags &= ~kDataBrowserListViewMovableColumn; wxCHECK_RET(macDataViewListCtrlPtr->SetPropertyFlags(GetNativeData()->GetPropertyID(),flags) == noErr,_("Could not set property flags.")); } } void wxDataViewColumn::SetResizeable(bool resizeable) { // first set the internal flag of the column: if (resizeable) m_flags |= wxDATAVIEW_COL_RESIZABLE; else m_flags &= ~wxDATAVIEW_COL_RESIZABLE; // if the column is associated with a control change also immediately the flags of the control: wxDataViewCtrl* dataViewCtrlPtr(GetOwner()); if (dataViewCtrlPtr != NULL) { wxMacDataViewDataBrowserListViewControlPointer macDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer>(dataViewCtrlPtr->GetPeer())); if (macDataViewListCtrlPtr != NULL) { DataBrowserListViewHeaderDesc headerDescription; verify_noerr(macDataViewListCtrlPtr->GetHeaderDesc(GetNativeData()->GetPropertyID(),&headerDescription)); if (resizeable) { if (GetMinWidth() >= GetMaxWidth()) { m_minWidth = 0; m_maxWidth = 30000; } headerDescription.minimumWidth = m_minWidth; headerDescription.maximumWidth = m_maxWidth; } else { headerDescription.minimumWidth = m_width; headerDescription.maximumWidth = m_width; } verify_noerr(macDataViewListCtrlPtr->SetHeaderDesc(GetNativeData()->GetPropertyID(),&headerDescription)); macDataViewListCtrlPtr->SetSortProperty(GetNativeData()->GetPropertyID()); } } } void wxDataViewColumn::SetSortable(bool sortable) { // first set the internal flag of the column: if (sortable) m_flags |= wxDATAVIEW_COL_SORTABLE; else m_flags &= ~wxDATAVIEW_COL_SORTABLE; // if the column is associated with a control change also immediately the flags of the control: wxDataViewCtrl* dataViewCtrlPtr(GetOwner()); if (dataViewCtrlPtr != NULL) { DataBrowserPropertyFlags flags; wxMacDataViewDataBrowserListViewControlPointer macDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer>(dataViewCtrlPtr->GetPeer())); wxCHECK_RET(macDataViewListCtrlPtr != NULL, _("Valid pointer to native data view control does not exist")); wxCHECK_RET(macDataViewListCtrlPtr->GetPropertyFlags(GetNativeData()->GetPropertyID(),&flags) == noErr,_("Could not get property flags.")); if (sortable) flags |= kDataBrowserListViewSortableColumn; else flags &= ~kDataBrowserListViewSortableColumn; wxCHECK_RET(macDataViewListCtrlPtr->SetPropertyFlags(GetNativeData()->GetPropertyID(),flags) == noErr,_("Could not set property flags.")); } } void wxDataViewColumn::SetSortOrder(bool ascending) { wxDataViewCtrl* dataViewCtrlPtr(GetOwner()); m_ascending = ascending; if (dataViewCtrlPtr != NULL) { wxMacDataViewDataBrowserListViewControlPointer macDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer>(dataViewCtrlPtr->GetPeer())); if (macDataViewListCtrlPtr != NULL) { DataBrowserListViewHeaderDesc headerDescription; verify_noerr(macDataViewListCtrlPtr->GetHeaderDesc(GetNativeData()->GetPropertyID(),&headerDescription)); if (ascending) headerDescription.initialOrder = kDataBrowserOrderIncreasing; else headerDescription.initialOrder = kDataBrowserOrderDecreasing; verify_noerr(macDataViewListCtrlPtr->SetHeaderDesc(GetNativeData()->GetPropertyID(),&headerDescription)); macDataViewListCtrlPtr->SetSortProperty(GetNativeData()->GetPropertyID()); } } } void wxDataViewColumn::SetTitle(wxString const& title) { wxDataViewCtrl* dataViewCtrlPtr(GetOwner()); m_title = title; if (dataViewCtrlPtr != NULL) { wxMacDataViewDataBrowserListViewControlPointer macDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer>(dataViewCtrlPtr->GetPeer())); if (macDataViewListCtrlPtr != NULL) { DataBrowserListViewHeaderDesc headerDescription; wxCFStringRef cfTitle(title,(dataViewCtrlPtr->GetFont().Ok() ? dataViewCtrlPtr->GetFont().GetEncoding() : wxLocale::GetSystemEncoding())); wxCHECK_RET(macDataViewListCtrlPtr->GetHeaderDesc(GetNativeData()->GetPropertyID(),&headerDescription) == noErr,_("Could not get header description.")); headerDescription.titleString = cfTitle; wxCHECK_RET(macDataViewListCtrlPtr->SetHeaderDesc(GetNativeData()->GetPropertyID(),&headerDescription) == noErr,_("Could not set header description.")); } } } void wxDataViewColumn::SetWidth(int width) { wxDataViewCtrl* dataViewCtrlPtr(GetOwner()); if ((width >= m_minWidth) && (width <= m_maxWidth)) { m_width = width; if (dataViewCtrlPtr != NULL) { wxMacDataViewDataBrowserListViewControlPointer macDataViewListCtrlPtr(dynamic_cast<wxMacDataViewDataBrowserListViewControlPointer>(dataViewCtrlPtr->GetPeer())); if (macDataViewListCtrlPtr != NULL) wxCHECK_RET(macDataViewListCtrlPtr->SetColumnWidth(GetNativeData()->GetPropertyID(),static_cast<UInt16>(width)) == noErr,_("Could not set column width.")); } } } void wxDataViewColumn::SetHidden(bool WXUNUSED(hidden)) { // How to do that? } bool wxDataViewColumn::IsHidden() const { return true; } void wxDataViewColumn::SetAsSortKey(bool WXUNUSED(sort)) { // see wxGTK native wxDataViewColumn implementation wxFAIL_MSG( "not implemented" ); } void wxDataViewColumn::SetNativeData(wxDataViewColumnNativeData* newNativeDataPtr) { delete m_NativeDataPtr; m_NativeDataPtr = newNativeDataPtr; } #endif // wxUSE_DATAVIEWCTRL && !wxUSE_GENERICDATAVIEWCTRL
42.261261
239
0.710936
[ "render", "object", "model" ]
d4e21d44053496e952fe26c16e57239c243b2ae9
2,022
cpp
C++
data/dailyCodingProblem68.cpp
vidit1999/daily_coding_problem
b90319cb4ddce11149f54010ba36c4bd6fa0a787
[ "MIT" ]
2
2020-09-04T20:56:23.000Z
2021-06-11T07:42:26.000Z
data/dailyCodingProblem68.cpp
vidit1999/daily_coding_problem
b90319cb4ddce11149f54010ba36c4bd6fa0a787
[ "MIT" ]
null
null
null
data/dailyCodingProblem68.cpp
vidit1999/daily_coding_problem
b90319cb4ddce11149f54010ba36c4bd6fa0a787
[ "MIT" ]
null
null
null
#include <bits/stdc++.h> using namespace std; /* On our special chessboard, two bishops attack each other if they share the same diagonal. This includes bishops that have another bishop located between them, i.e. bishops can attack through pieces. You are given N bishops, represented as (row, column) tuples on a M by M chessboard. Write a function to count the number of pairs of bishops that attack each other. The ordering of the pair doesn't matter: (1, 2) is considered the same as (2, 1). For example, given M = 5 and the list of bishops: (0, 0) (1, 2) (2, 2) (4, 0) The board would look like this: [b 0 0 0 0] [0 0 b 0 0] [0 0 b 0 0] [0 0 0 0 0] [b 0 0 0 0] You should return 2, since bishops 1 and 3 attack each other, as well as bishops 3 and 4. */ int countBishopDiagonal(vector<vector<char>>& mat, int x, int y){ int count = 0; // top left corner for(int i=x-1, j=y-1; i>=0 && j>=0; i--, j--){ if(mat[i][j] == 'b') count++; } // bottom left corner for(int i=x+1, j=y-1; i<mat.size() && j>=0; i++, j--){ if(mat[i][j] == 'b') count++; } // top right corner for(int i=x-1, j=y+1; i>=0 && j<mat[0].size(); i--, j++){ if(mat[i][j] == 'b') count++; } // bottom right corner for(int i=x+1, j=y+1; i<mat.size() && j<mat[0].size(); i++, j++){ if(mat[i][j] == 'b') count++; } return count; } int countBishopAttacking(vector<vector<char>>& mat){ int count = 0; for(int i=0; i<mat.size(); i++){ for(int j=0; j<mat[0].size(); j++){ if(mat[i][j] == 'b'){ count += countBishopDiagonal(mat, i, j); } } } return count/2; } int countBishop(int M, vector<pair<int, int>> arr){ vector<vector<char>> mat(M, vector<char>(M, '0')); for(auto p : arr){ mat[p.first][p.second] = 'b'; } for(int i=0; i<M; i++){ for(int j=0; j<M; j++){ cout << mat[i][j] << " "; } cout << "\n"; } return countBishopAttacking(mat); } // main function int main(){ cout << countBishop( 5, { {0, 0}, {1, 2}, {2, 2}, {4, 0}, } ) << "\n"; return 0; }
18.722222
66
0.578635
[ "vector" ]
d4e743026c62f18d64cfbbed29020ed920f6a9a2
1,472
cpp
C++
Code/Framework/AzFramework/Platform/Mac/AzFramework/TargetManagement/TargetManagementComponent_Mac.cpp
aaarsene/o3de
37e3b0226958974defd14dd6d808e8557dcd7345
[ "Apache-2.0", "MIT" ]
1
2021-09-13T00:01:12.000Z
2021-09-13T00:01:12.000Z
Code/Framework/AzFramework/Platform/Mac/AzFramework/TargetManagement/TargetManagementComponent_Mac.cpp
aaarsene/o3de
37e3b0226958974defd14dd6d808e8557dcd7345
[ "Apache-2.0", "MIT" ]
null
null
null
Code/Framework/AzFramework/Platform/Mac/AzFramework/TargetManagement/TargetManagementComponent_Mac.cpp
aaarsene/o3de
37e3b0226958974defd14dd6d808e8557dcd7345
[ "Apache-2.0", "MIT" ]
1
2021-07-20T11:07:25.000Z
2021-07-20T11:07:25.000Z
/* * Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution. * * SPDX-License-Identifier: Apache-2.0 OR MIT * */ #include <AzFramework/StringFunc/StringFunc.h> #include <AzCore/IO/SystemFile.h> #include <AzCore/Utils/Utils.h> #include <unistd.h> namespace AzFramework { namespace Platform { AZStd::string GetPersistentName() { AZStd::string persistentName = "Lumberyard"; char procPath[AZ_MAX_PATH_LEN]; AZ::Utils::GetExecutablePathReturnType ret = AZ::Utils::GetExecutablePath(procPath, AZ_MAX_PATH_LEN); if (ret.m_pathStored == AZ::Utils::ExecutablePathResult::Success) { AzFramework::StringFunc::Path::GetFileName(procPath, persistentName); } return persistentName; } //! On mac, if the neighborhood name was not provided we //! will use the hostname as the name since most of //! the time the hub should be running on the local machine. AZStd::string GetNeighborhoodName() { AZStd::string neighborhoodName; char localhost[512]; if (gethostname(localhost, sizeof(localhost)) == 0) { neighborhoodName = localhost; } return neighborhoodName; } } } // namespace AzFramework
31.319149
158
0.616168
[ "3d" ]
d4e981f33c55a43d5ae3b1271ca94d9d58fe775c
3,130
cpp
C++
src/gltf/GltfModel.cpp
ZLima12/FBX2glTF
aa536080ce893a2b5066e18476f343bfeedb9323
[ "BSD-3-Clause" ]
1,495
2017-10-19T16:41:38.000Z
2022-03-31T23:12:49.000Z
src/gltf/GltfModel.cpp
ZLima12/FBX2glTF
aa536080ce893a2b5066e18476f343bfeedb9323
[ "BSD-3-Clause" ]
238
2017-10-19T17:17:45.000Z
2022-03-28T01:36:27.000Z
src/gltf/GltfModel.cpp
ZLima12/FBX2glTF
aa536080ce893a2b5066e18476f343bfeedb9323
[ "BSD-3-Clause" ]
285
2017-10-20T00:32:28.000Z
2022-03-28T07:43:22.000Z
/** * Copyright (c) Facebook, Inc. and its affiliates. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. */ #include "GltfModel.hpp" std::shared_ptr<BufferViewData> GltfModel::GetAlignedBufferView( BufferData& buffer, const BufferViewData::GL_ArrayType target) { uint32_t bufferSize = to_uint32(this->binary->size()); if ((bufferSize % 4) > 0) { bufferSize += (4 - (bufferSize % 4)); this->binary->resize(bufferSize); } return this->bufferViews.hold(new BufferViewData(buffer, bufferSize, target)); } // add a bufferview on the fly and copy data into it std::shared_ptr<BufferViewData> GltfModel::AddRawBufferView(BufferData& buffer, const char* source, uint32_t bytes) { auto bufferView = GetAlignedBufferView(buffer, BufferViewData::GL_ARRAY_NONE); bufferView->byteLength = bytes; // make space for the new bytes (possibly moving the underlying data) uint32_t bufferSize = to_uint32(this->binary->size()); this->binary->resize(bufferSize + bytes); // and copy them into place memcpy(&(*this->binary)[bufferSize], source, bytes); return bufferView; } std::shared_ptr<BufferViewData> GltfModel::AddBufferViewForFile( BufferData& buffer, const std::string& filename) { // see if we've already created a BufferViewData for this precise file auto iter = filenameToBufferView.find(filename); if (iter != filenameToBufferView.end()) { return iter->second; } std::shared_ptr<BufferViewData> result; std::ifstream file(filename, std::ios::binary | std::ios::ate); if (file) { std::streamsize size = file.tellg(); file.seekg(0, std::ios::beg); std::vector<char> fileBuffer(size); if (file.read(fileBuffer.data(), size)) { result = AddRawBufferView(buffer, fileBuffer.data(), to_uint32(size)); } else { fmt::printf("Warning: Couldn't read %lu bytes from %s, skipping file.\n", size, filename); } } else { fmt::printf("Warning: Couldn't open file %s, skipping file.\n", filename); } // note that we persist here not only success, but also failure, as nullptr filenameToBufferView[filename] = result; return result; } void GltfModel::serializeHolders(json& glTFJson) { serializeHolder(glTFJson, "buffers", buffers); serializeHolder(glTFJson, "bufferViews", bufferViews); serializeHolder(glTFJson, "scenes", scenes); serializeHolder(glTFJson, "accessors", accessors); serializeHolder(glTFJson, "images", images); serializeHolder(glTFJson, "samplers", samplers); serializeHolder(glTFJson, "textures", textures); serializeHolder(glTFJson, "materials", materials); serializeHolder(glTFJson, "meshes", meshes); serializeHolder(glTFJson, "skins", skins); serializeHolder(glTFJson, "animations", animations); serializeHolder(glTFJson, "cameras", cameras); serializeHolder(glTFJson, "nodes", nodes); if (!lights.ptrs.empty()) { json lightsJson = json::object(); serializeHolder(lightsJson, "lights", lights); glTFJson["extensions"][KHR_LIGHTS_PUNCTUAL] = lightsJson; } }
36.395349
96
0.715016
[ "object", "vector" ]
d4ec2898ef56139936581b70e2453dec70aeb779
28,549
cpp
C++
vectorforth/compiler.cpp
janm31415/vectorforth
be0c4e5f7338c922be1975dd4c4321f89cce7cc6
[ "MIT" ]
5
2020-10-06T14:06:26.000Z
2022-01-28T16:45:41.000Z
vectorforth/compiler.cpp
janm31415/vectorforth
be0c4e5f7338c922be1975dd4c4321f89cce7cc6
[ "MIT" ]
1
2020-06-13T13:01:03.000Z
2020-06-13T15:48:20.000Z
vectorforth/compiler.cpp
janm31415/vectorforth
be0c4e5f7338c922be1975dd4c4321f89cce7cc6
[ "MIT" ]
null
null
null
#include "compiler.h" #include "compile_data.h" #include "compile_error.h" #include "constant_folding.h" #include "context_defs.h" #include "expand.h" #include "expand_data.h" #include "primitives.h" #include "strength_reduction.h" #include "superoperators.h" #include "asm_aux.h" #include "tokenize.h" #include <cassert> #include <sstream> #include <algorithm> using namespace ASM; VF_BEGIN ///////////////////////////////////////////////////////////// // Singlepass compiler ///////////////////////////////////////////////////////////// void compile_words_single_pass(asmcode& code, dictionary& d, expand_data& ed, compile_data& cd, std::vector<token>& words); void compile_word_single_pass(asmcode& code, dictionary& d, expand_data& ed, compile_data& cd, token word); void compile_primitive_single_pass(asmcode& code, dictionary& d, expand_data& ed, compile_data& cd, token word) { static prim_map pm = generate_primitives_map(); if (word.value == "create") { if (ed.create_called) throw std::runtime_error(compile_error_text(VF_ERROR_CREATE_WAS_ALREADY_CALLED, word.line_nr, word.column_nr).c_str()); ed.create_called = true; code.add(asmcode::COMMENT, "BEGIN CREATE VARIABLE"); code.add(asmcode::MOV, asmcode::RAX, CONSTANT_SPACE_POINTER); if (ed.binding_space_offset) code.add(asmcode::ADD, asmcode::RAX, asmcode::NUMBER, ed.binding_space_offset); code.add(asmcode::VMOVAPS, AVX_REG0, MEM_STACK_REGISTER); code.add(asmcode::ADD, STACK_REGISTER, asmcode::NUMBER, AVX_CELLS(1)); code.add(asmcode::VMOVAPS, asmcode::MEM_RAX, AVX_REG0); code.add(asmcode::COMMENT, "END CREATE VARIABLE"); } else if (word.value == "to") { if (ed.to_called || ed.create_called) throw std::runtime_error(compile_error_text(VF_ERROR_UNCLEAR_TARGET_FOR_TO, word.line_nr, word.column_nr).c_str()); ed.to_called = true; } else { auto it = pm.find(word.value); if (it == pm.end()) { if (ed.create_called) { ed.create_called = false; dictionary_entry de; de.type = dictionary_entry::T_VARIABLE; de.name = word.value; de.address = ed.binding_space_offset; ed.binding_space_offset += AVX_ALIGNMENT; push(d, de); return; } else { dictionary_entry e; if (find(e, d, word.value)) { compile_word_single_pass(code, d, ed, cd, word); return; } else throw std::runtime_error(compile_error_text(VF_ERROR_WORD_UNKNOWN, word.line_nr, word.column_nr, word.value).c_str()); } } it->second(code, cd); } } void compile_variable_single_pass(asmcode& code, expand_data& ed, uint64_t address) { if (ed.to_called) { code.add(asmcode::COMMENT, "BEGIN UPDATE VARIABLE VALUE"); ed.to_called = false; code.add(asmcode::MOV, asmcode::RAX, CONSTANT_SPACE_POINTER); if (address) code.add(asmcode::ADD, asmcode::RAX, asmcode::NUMBER, address); code.add(asmcode::VMOVAPS, AVX_REG0, MEM_STACK_REGISTER); code.add(asmcode::ADD, STACK_REGISTER, asmcode::NUMBER, AVX_CELLS(1)); code.add(asmcode::VMOVAPS, asmcode::MEM_RAX, AVX_REG0); code.add(asmcode::COMMENT, "END UPDATE VARIABLE VALUE"); } else { code.add(asmcode::COMMENT, "BEGIN PUSH VARIABLE ADDRESS OR VALUE ON STACK"); code.add(asmcode::MOV, asmcode::RAX, CONSTANT_SPACE_POINTER); if (address) code.add(asmcode::ADD, asmcode::RAX, asmcode::NUMBER, address); code.add(asmcode::VMOVAPS, AVX_REG0, asmcode::MEM_RAX); code.add(asmcode::SUB, STACK_REGISTER, asmcode::NUMBER, AVX_CELLS(1)); code.add(asmcode::VMOVAPS, MEM_STACK_REGISTER, AVX_REG0); code.add(asmcode::COMMENT, "END PUSH VARIABLE ADDRESS OR VALUE ON STACK"); } } void compile_word_single_pass(asmcode& code, dictionary& d, expand_data& ed, compile_data& cd, token word) { dictionary_entry e; if (find(e, d, word.value)) { switch (e.type) { case dictionary_entry::T_FUNCTION: { compile_words_single_pass(code, d, ed, cd, e.words); break; } case dictionary_entry::T_VARIABLE: { if (ed.create_called) // overwriting existing variable { code.add(asmcode::COMMENT, "BEGIN OVERWRITE EXISTING VARIABLE"); code.add(asmcode::MOV, asmcode::RAX, CONSTANT_SPACE_POINTER); code.add(asmcode::ADD, asmcode::RAX, asmcode::NUMBER, ed.binding_space_offset); code.add(asmcode::VMOVAPS, AVX_REG0, asmcode::MEM_RAX); code.add(asmcode::SUB, asmcode::RAX, asmcode::NUMBER, (ed.binding_space_offset - e.address)); code.add(asmcode::VMOVAPS, asmcode::MEM_RAX, AVX_REG0); code.add(asmcode::COMMENT, "END OVERWRITE EXISTING VARIABLE"); ed.create_called = false; return; } else compile_variable_single_pass(code, ed, e.address); break; } default: { throw std::runtime_error("compiler error: not implemented"); break; } } } else { compile_primitive_single_pass(code, d, ed, cd, word); } } void compile_float_single_pass(asmcode& code, token word) { code.add(asmcode::COMMENT, "BEGIN PUSH FLOAT ON THE STACK"); assert(word.type == token::T_FLOAT); float f = to_float(word.value.c_str()); uint32_t v = *(reinterpret_cast<uint32_t*>(&f)); code.add(asmcode::SUB, STACK_REGISTER, asmcode::NUMBER, AVX_CELLS(1)); code.add(asmcode::MOV, DWORD_MEM_STACK_REGISTER, asmcode::NUMBER, v); code.add(asmcode::VBROADCASTSS, AVX_REG0, DWORD_MEM_STACK_REGISTER); code.add(asmcode::VMOVAPS, MEM_STACK_REGISTER, AVX_REG0); code.add(asmcode::COMMENT, "BEGIN END FLOAT ON THE STACK"); } void compile_integer_single_pass(asmcode& code, token word) { code.add(asmcode::COMMENT, "BEGIN PUSH ADDRESS ON THE STACK"); assert(word.type == token::T_INTEGER); std::stringstream ss; ss << word.value; int64_t v; ss >> v; code.add(asmcode::MOV, asmcode::RAX, asmcode::NUMBER, v); code.add(asmcode::MOV, MEM_STACK_REGISTER, -AVX_CELLS(1), asmcode::RAX); code.add(asmcode::SUB, STACK_REGISTER, asmcode::NUMBER, AVX_CELLS(1)); code.add(asmcode::COMMENT, "END PUSH FLOAT ON THE STACK"); } void compile_vector_single_pass(asmcode& code, const std::vector<token>& words) { code.add(asmcode::COMMENT, "BEGIN PUSH VECTOR ON THE STACK"); assert(words.size() == AVX_LENGTH); for (int i = 0; i < AVX_LENGTH/2; ++i) { assert(words[2 * i].type == token::T_FLOAT || words[2 * i].type == token::T_INTEGER); assert(words[2 * i + 1].type == token::T_FLOAT || words[2 * i + 1].type == token::T_INTEGER); uint64_t v1_64, v2_64; if (words[2 * i].type == token::T_FLOAT) { float f = to_float(words[i * 2].value.c_str()); uint32_t v = *(reinterpret_cast<uint32_t*>(&f)); v1_64 = (uint64_t)v; } else { std::stringstream ss; ss << words[i * 2].value; uint32_t v; ss >> v; v1_64 = (uint64_t)v; } if (words[2 * i + 1].type == token::T_FLOAT) { float f = to_float(words[i * 2 + 1].value.c_str()); uint32_t v = *(reinterpret_cast<uint32_t*>(&f)); v2_64 = (uint64_t)v; } else { std::stringstream ss; ss << words[i * 2 + 1].value; uint32_t v; ss >> v; v2_64 = (uint64_t)v; } uint64_t v = (v1_64 << 32) | v2_64; code.add(asmcode::MOV, asmcode::RAX, asmcode::NUMBER, v); code.add(asmcode::MOV, MEM_STACK_REGISTER, -CELLS(i + 1), asmcode::RAX); } code.add(asmcode::SUB, STACK_REGISTER, asmcode::NUMBER, AVX_CELLS(1)); code.add(asmcode::COMMENT, "END PUSH FLOAT ON THE STACK"); } void compile_definition_single_pass(dictionary& d, std::vector<token>& words, int line_nr, int column_nr) { if (words.empty()) throw std::runtime_error(compile_error_text(VF_ERROR_EMPTY_DEFINITION, line_nr, column_nr).c_str()); if (words.front().type != token::T_WORD) throw std::runtime_error(compile_error_text(VF_ERROR_INVALID_DEFINITION_NAME, words.front().line_nr, words.front().column_nr).c_str()); register_definition(d, words); } void compile_words_single_pass(asmcode& code, dictionary& d, expand_data& ed, compile_data& cd, std::vector<token>& words) { while (!words.empty()) { token word = words.back(); words.pop_back(); switch (word.type) { case token::T_WORD: { compile_word_single_pass(code, d, ed, cd, word); break; } case token::T_PRIMITIVE: { compile_primitive_single_pass(code, d, ed, cd, word); break; } case token::T_FLOAT: { compile_float_single_pass(code, word); break; } case token::T_VECTOR: { std::vector<token> vector_words; if (words.size() < AVX_LENGTH) #ifdef AVX512 throw std::runtime_error(compile_error_text(VF_ERROR_VECTOR16_INVALID_SYNTAX, word.line_nr, word.column_nr).c_str()); #else throw std::runtime_error(compile_error_text(VF_ERROR_VECTOR8_INVALID_SYNTAX, word.line_nr, word.column_nr).c_str()); #endif for (int i = 0; i < AVX_LENGTH; ++i) { vector_words.push_back(words.back()); if (vector_words.back().type != token::T_FLOAT && vector_words.back().type != token::T_INTEGER) #ifdef AVX512 throw std::runtime_error(compile_error_text(VF_ERROR_VECTOR16_INVALID_SYNTAX, word.line_nr, word.column_nr).c_str()); #else throw std::runtime_error(compile_error_text(VF_ERROR_VECTOR8_INVALID_SYNTAX, word.line_nr, word.column_nr).c_str()); #endif words.pop_back(); } compile_vector_single_pass(code, vector_words); break; } case token::T_COLON: { std::vector<token> definition_words; if (words.empty()) throw std::runtime_error(compile_error_text(VF_ERROR_NO_CORRESPONDING_SEMICOLON, word.line_nr, word.column_nr).c_str()); while (!words.empty()) { definition_words.push_back(words.back()); words.pop_back(); if (definition_words.back().type == token::T_SEMICOLON) break; } if (definition_words.back().type != token::T_SEMICOLON) throw std::runtime_error(compile_error_text(VF_ERROR_NO_CORRESPONDING_SEMICOLON, word.line_nr, word.column_nr).c_str()); definition_words.pop_back(); // last item is semicolon, we don't need that for the definition compile_definition_single_pass(d, definition_words, word.line_nr, word.column_nr); break; } case token::T_SEMICOLON: { throw std::runtime_error(compile_error_text(VF_ERROR_NO_CORRESPONDING_COLON, word.line_nr, word.column_nr).c_str()); break; } case token::T_INTEGER: { compile_integer_single_pass(code, word); break; } default: throw std::runtime_error("not implemented"); } } } void compile_single_pass(asmcode& code, dictionary& d, expand_data& ed, std::vector<token> words) { assert(!ed.to_called); assert(!ed.create_called); std::reverse(words.begin(), words.end()); compile_data cd = create_compile_data(); code.add(asmcode::GLOBAL, "forth_entry"); #ifdef _WIN32 /* windows parameters calling convention: rcx, rdx, r8, r9 First parameter (rcx) points to the context. We store the pointer to the context in register r10. */ code.add(asmcode::MOV, CONTEXT, asmcode::RCX); #else /* Linux parameters calling convention: rdi, rsi, rdx, rcx, r8, r9 First parameter (rdi) points to the context. We store the pointer to the context in register r10. */ code.add(asmcode::MOV, CONTEXT, asmcode::RDI); #endif /* Save the current content of the registers in the context */ store_registers(code); code.add(asmcode::MOV, STACK_REGISTER, STACK_POINTER); code.add(asmcode::MOV, HERE, HERE_POINTER); /* Align stack with 64 byte boundary */ code.add(asmcode::AND, asmcode::RSP, asmcode::NUMBER, 0xFFFFFFFFFFFFFFC0); code.add(asmcode::MOV, RSP_TOP, asmcode::RSP); compile_words_single_pass(code, d, ed, cd, words); code.add(asmcode::MOV, STACK_POINTER, STACK_REGISTER); /*Restore the registers to their original state*/ load_registers(code); /*Return to the caller*/ code.add(asmcode::RET); if (ed.to_called) throw std::runtime_error(compile_error_text(VF_ERROR_UNCLEAR_TARGET_FOR_TO, -1, -1).c_str()); if (ed.create_called) throw std::runtime_error(compile_error_text(VF_ERROR_UNCLEAR_TARGET_FOR_CREATE, -1, -1).c_str()); } ///////////////////////////////////////////////////////////// // Multipass compiler ///////////////////////////////////////////////////////////// void compile_words(asmcode& code, compile_data& cd, std::vector<expanded_token>& words) { while (!words.empty()) { expanded_token word = words.back(); words.pop_back(); switch (word.t) { case expanded_token::ET_PRIMITIVE: { word.prim(code, cd); break; } case expanded_token::ET_SUPEROPERATOR: { word.supop(code, word); break; } case expanded_token::ET_INTEGER: { code.add(asmcode::COMMENT, "BEGIN PUSH ADDRESS ON THE STACK"); code.add(asmcode::MOV, asmcode::RAX, asmcode::NUMBER, word.int_value); code.add(asmcode::MOV, MEM_STACK_REGISTER, -AVX_CELLS(1), asmcode::RAX); code.add(asmcode::SUB, STACK_REGISTER, asmcode::NUMBER, AVX_CELLS(1)); code.add(asmcode::COMMENT, "END PUSH ADDRESS ON THE STACK"); break; } case expanded_token::ET_FLOAT: { code.add(asmcode::COMMENT, "BEGIN PUSH FLOAT ON THE STACK"); uint32_t v = *(reinterpret_cast<uint32_t*>(&word.f[0])); code.add(asmcode::SUB, STACK_REGISTER, asmcode::NUMBER, AVX_CELLS(1)); code.add(asmcode::MOV, DWORD_MEM_STACK_REGISTER, asmcode::NUMBER, v); code.add(asmcode::VBROADCASTSS, AVX_REG0, DWORD_MEM_STACK_REGISTER); code.add(asmcode::VMOVAPS, MEM_STACK_REGISTER, AVX_REG0); code.add(asmcode::COMMENT, "END PUSH FLOAT ON THE STACK"); break; } case expanded_token::ET_FLOAT2: { code.add(asmcode::COMMENT, "BEGIN PUSH TWO FLOATS ON THE STACK"); uint32_t v1 = *(reinterpret_cast<uint32_t*>(&word.f[1])); uint32_t v2 = *(reinterpret_cast<uint32_t*>(&word.f[0])); code.add(asmcode::MOV, DWORD_MEM_STACK_REGISTER, -AVX_CELLS(1), asmcode::NUMBER, v1); if (v2 == v1) { code.add(asmcode::VBROADCASTSS, AVX_REG0, DWORD_MEM_STACK_REGISTER, -AVX_CELLS(1)); code.add(asmcode::VMOVAPS, MEM_STACK_REGISTER, -AVX_CELLS(1), AVX_REG0); code.add(asmcode::VMOVAPS, MEM_STACK_REGISTER, -AVX_CELLS(2), AVX_REG0); } else { code.add(asmcode::MOV, DWORD_MEM_STACK_REGISTER, -AVX_CELLS(1) - 4, asmcode::NUMBER, v2); code.add(asmcode::VBROADCASTSS, AVX_REG0, DWORD_MEM_STACK_REGISTER, -AVX_CELLS(1)); code.add(asmcode::VBROADCASTSS, AVX_REG1, DWORD_MEM_STACK_REGISTER, -AVX_CELLS(1) - 4); code.add(asmcode::VMOVAPS, MEM_STACK_REGISTER, -AVX_CELLS(1), AVX_REG1); code.add(asmcode::VMOVAPS, MEM_STACK_REGISTER, -AVX_CELLS(2), AVX_REG0); } code.add(asmcode::SUB, STACK_REGISTER, asmcode::NUMBER, AVX_CELLS(2)); code.add(asmcode::COMMENT, "END PUSH TWO FLOATS ON THE STACK"); break; } case expanded_token::ET_FLOAT3: { code.add(asmcode::COMMENT, "BEGIN PUSH THREE FLOATS ON THE STACK"); uint32_t v1 = *(reinterpret_cast<uint32_t*>(&word.f[2])); uint32_t v2 = *(reinterpret_cast<uint32_t*>(&word.f[1])); uint32_t v3 = *(reinterpret_cast<uint32_t*>(&word.f[0])); code.add(asmcode::MOV, DWORD_MEM_STACK_REGISTER, -AVX_CELLS(1), asmcode::NUMBER, v1); code.add(asmcode::VBROADCASTSS, AVX_REG0, DWORD_MEM_STACK_REGISTER, -AVX_CELLS(1)); if (v1 == v2) { code.add(asmcode::VMOVAPS, AVX_REG1, AVX_REG0); } else { code.add(asmcode::MOV, DWORD_MEM_STACK_REGISTER, -AVX_CELLS(1) - 4, asmcode::NUMBER, v2); code.add(asmcode::VBROADCASTSS, AVX_REG1, DWORD_MEM_STACK_REGISTER, -AVX_CELLS(1) - 4); } if (v1 == v3) { code.add(asmcode::VMOVAPS, AVX_REG2, AVX_REG0); } else if (v2 == v3) { code.add(asmcode::VMOVAPS, AVX_REG2, AVX_REG1); } else { code.add(asmcode::MOV, DWORD_MEM_STACK_REGISTER, -AVX_CELLS(1) - 8, asmcode::NUMBER, v3); code.add(asmcode::VBROADCASTSS, AVX_REG2, DWORD_MEM_STACK_REGISTER, -AVX_CELLS(1) - 8); } code.add(asmcode::VMOVAPS, MEM_STACK_REGISTER, - AVX_CELLS(1), AVX_REG2); code.add(asmcode::VMOVAPS, MEM_STACK_REGISTER, - AVX_CELLS(2), AVX_REG1); code.add(asmcode::VMOVAPS, MEM_STACK_REGISTER, - AVX_CELLS(3), AVX_REG0); code.add(asmcode::SUB, STACK_REGISTER, asmcode::NUMBER, AVX_CELLS(3)); code.add(asmcode::COMMENT, "END PUSH THREE FLOATS ON THE STACK"); break; } case expanded_token::ET_FLOAT4: { code.add(asmcode::COMMENT, "BEGIN PUSH FOUR FLOATS ON THE STACK"); uint32_t v1 = *(reinterpret_cast<uint32_t*>(&word.f[3])); uint32_t v2 = *(reinterpret_cast<uint32_t*>(&word.f[2])); uint32_t v3 = *(reinterpret_cast<uint32_t*>(&word.f[1])); uint32_t v4 = *(reinterpret_cast<uint32_t*>(&word.f[0])); code.add(asmcode::MOV, DWORD_MEM_STACK_REGISTER, -AVX_CELLS(1), asmcode::NUMBER, v1); code.add(asmcode::MOV, DWORD_MEM_STACK_REGISTER, -AVX_CELLS(1) - 4, asmcode::NUMBER, v2); code.add(asmcode::MOV, DWORD_MEM_STACK_REGISTER, -AVX_CELLS(1) - 8, asmcode::NUMBER, v3); code.add(asmcode::MOV, DWORD_MEM_STACK_REGISTER, -AVX_CELLS(1) - 12, asmcode::NUMBER, v4); code.add(asmcode::VBROADCASTSS, AVX_REG0, DWORD_MEM_STACK_REGISTER, -AVX_CELLS(1)); code.add(asmcode::VBROADCASTSS, AVX_REG1, DWORD_MEM_STACK_REGISTER, -AVX_CELLS(1) - 4); code.add(asmcode::VBROADCASTSS, AVX_REG2, DWORD_MEM_STACK_REGISTER, -AVX_CELLS(1) - 8); code.add(asmcode::VBROADCASTSS, AVX_REG3, DWORD_MEM_STACK_REGISTER, -AVX_CELLS(1) - 12); code.add(asmcode::VMOVAPS, MEM_STACK_REGISTER, -AVX_CELLS(1), AVX_REG3); code.add(asmcode::VMOVAPS, MEM_STACK_REGISTER, -AVX_CELLS(2), AVX_REG2); code.add(asmcode::VMOVAPS, MEM_STACK_REGISTER, -AVX_CELLS(3), AVX_REG1); code.add(asmcode::VMOVAPS, MEM_STACK_REGISTER, -AVX_CELLS(4), AVX_REG0); code.add(asmcode::SUB, STACK_REGISTER, asmcode::NUMBER, AVX_CELLS(4)); code.add(asmcode::COMMENT, "END PUSH FOUR FLOATS ON THE STACK"); break; } case expanded_token::ET_FLOAT5: { code.add(asmcode::COMMENT, "BEGIN PUSH FIVE FLOATS ON THE STACK"); uint32_t v1 = *(reinterpret_cast<uint32_t*>(&word.f[4])); uint32_t v2 = *(reinterpret_cast<uint32_t*>(&word.f[3])); uint32_t v3 = *(reinterpret_cast<uint32_t*>(&word.f[2])); uint32_t v4 = *(reinterpret_cast<uint32_t*>(&word.f[1])); uint32_t v5 = *(reinterpret_cast<uint32_t*>(&word.f[0])); code.add(asmcode::MOV, DWORD_MEM_STACK_REGISTER, -AVX_CELLS(1), asmcode::NUMBER, v1); code.add(asmcode::MOV, DWORD_MEM_STACK_REGISTER, -AVX_CELLS(1) - 4, asmcode::NUMBER, v2); code.add(asmcode::MOV, DWORD_MEM_STACK_REGISTER, -AVX_CELLS(1) - 8, asmcode::NUMBER, v3); code.add(asmcode::MOV, DWORD_MEM_STACK_REGISTER, -AVX_CELLS(1) - 12, asmcode::NUMBER, v4); code.add(asmcode::MOV, DWORD_MEM_STACK_REGISTER, -AVX_CELLS(1) - 16, asmcode::NUMBER, v5); code.add(asmcode::VBROADCASTSS, AVX_REG0, DWORD_MEM_STACK_REGISTER, -AVX_CELLS(1)); code.add(asmcode::VBROADCASTSS, AVX_REG1, DWORD_MEM_STACK_REGISTER, -AVX_CELLS(1) - 4); code.add(asmcode::VBROADCASTSS, AVX_REG2, DWORD_MEM_STACK_REGISTER, -AVX_CELLS(1) - 8); code.add(asmcode::VBROADCASTSS, AVX_REG3, DWORD_MEM_STACK_REGISTER, -AVX_CELLS(1) - 12); code.add(asmcode::VBROADCASTSS, AVX_REG4, DWORD_MEM_STACK_REGISTER, -AVX_CELLS(1) - 16); code.add(asmcode::VMOVAPS, MEM_STACK_REGISTER, -AVX_CELLS(1), AVX_REG4); code.add(asmcode::VMOVAPS, MEM_STACK_REGISTER, -AVX_CELLS(2), AVX_REG3); code.add(asmcode::VMOVAPS, MEM_STACK_REGISTER, -AVX_CELLS(3), AVX_REG2); code.add(asmcode::VMOVAPS, MEM_STACK_REGISTER, -AVX_CELLS(4), AVX_REG1); code.add(asmcode::VMOVAPS, MEM_STACK_REGISTER, -AVX_CELLS(5), AVX_REG0); code.add(asmcode::SUB, STACK_REGISTER, asmcode::NUMBER, AVX_CELLS(5)); code.add(asmcode::COMMENT, "END PUSH FIVE FLOATS ON THE STACK"); break; } case expanded_token::ET_FLOAT6: { code.add(asmcode::COMMENT, "BEGIN PUSH SIX FLOATS ON THE STACK"); uint32_t v1 = *(reinterpret_cast<uint32_t*>(&word.f[5])); uint32_t v2 = *(reinterpret_cast<uint32_t*>(&word.f[4])); uint32_t v3 = *(reinterpret_cast<uint32_t*>(&word.f[3])); uint32_t v4 = *(reinterpret_cast<uint32_t*>(&word.f[2])); uint32_t v5 = *(reinterpret_cast<uint32_t*>(&word.f[1])); uint32_t v6 = *(reinterpret_cast<uint32_t*>(&word.f[0])); code.add(asmcode::MOV, DWORD_MEM_STACK_REGISTER, -AVX_CELLS(1), asmcode::NUMBER, v1); code.add(asmcode::MOV, DWORD_MEM_STACK_REGISTER, -AVX_CELLS(1) - 4, asmcode::NUMBER, v2); code.add(asmcode::MOV, DWORD_MEM_STACK_REGISTER, -AVX_CELLS(1) - 8, asmcode::NUMBER, v3); code.add(asmcode::MOV, DWORD_MEM_STACK_REGISTER, -AVX_CELLS(1) - 12, asmcode::NUMBER, v4); code.add(asmcode::MOV, DWORD_MEM_STACK_REGISTER, -AVX_CELLS(1) - 16, asmcode::NUMBER, v5); code.add(asmcode::MOV, DWORD_MEM_STACK_REGISTER, -AVX_CELLS(1) - 20, asmcode::NUMBER, v6); code.add(asmcode::VBROADCASTSS, AVX_REG0, DWORD_MEM_STACK_REGISTER, -AVX_CELLS(1)); code.add(asmcode::VBROADCASTSS, AVX_REG1, DWORD_MEM_STACK_REGISTER, -AVX_CELLS(1) - 4); code.add(asmcode::VBROADCASTSS, AVX_REG2, DWORD_MEM_STACK_REGISTER, -AVX_CELLS(1) - 8); code.add(asmcode::VBROADCASTSS, AVX_REG3, DWORD_MEM_STACK_REGISTER, -AVX_CELLS(1) - 12); code.add(asmcode::VBROADCASTSS, AVX_REG4, DWORD_MEM_STACK_REGISTER, -AVX_CELLS(1) - 16); code.add(asmcode::VBROADCASTSS, AVX_REG5, DWORD_MEM_STACK_REGISTER, -AVX_CELLS(1) - 20); code.add(asmcode::VMOVAPS, MEM_STACK_REGISTER, -AVX_CELLS(1), AVX_REG5); code.add(asmcode::VMOVAPS, MEM_STACK_REGISTER, -AVX_CELLS(2), AVX_REG4); code.add(asmcode::VMOVAPS, MEM_STACK_REGISTER, -AVX_CELLS(3), AVX_REG3); code.add(asmcode::VMOVAPS, MEM_STACK_REGISTER, -AVX_CELLS(4), AVX_REG2); code.add(asmcode::VMOVAPS, MEM_STACK_REGISTER, -AVX_CELLS(5), AVX_REG1); code.add(asmcode::VMOVAPS, MEM_STACK_REGISTER, -AVX_CELLS(6), AVX_REG0); code.add(asmcode::SUB, STACK_REGISTER, asmcode::NUMBER, AVX_CELLS(6)); code.add(asmcode::COMMENT, "END PUSH SIX FLOATS ON THE STACK"); break; } case expanded_token::ET_VECTOR: { code.add(asmcode::COMMENT, "BEGIN PUSH FLOAT VECTOR ON THE STACK"); for (int i = 0; i < AVX_LENGTH/2; ++i) { uint64_t v1_64, v2_64; float f = word.f[i * 2]; uint32_t v = *(reinterpret_cast<uint32_t*>(&f)); v1_64 = (uint64_t)v; f = word.f[i * 2 + 1]; v = *(reinterpret_cast<uint32_t*>(&f)); v2_64 = (uint64_t)v; uint64_t vv = (v1_64 << 32) | v2_64; code.add(asmcode::MOV, asmcode::RAX, asmcode::NUMBER, vv); code.add(asmcode::MOV, MEM_STACK_REGISTER, -CELLS(i + 1), asmcode::RAX); } code.add(asmcode::SUB, STACK_REGISTER, asmcode::NUMBER, AVX_CELLS(1)); code.add(asmcode::COMMENT, "END PUSH FLOAT VECTOR ON THE STACK"); break; } case expanded_token::ET_OVERWRITE_VARIABLE: { code.add(asmcode::COMMENT, "BEGIN OVERWRITE EXISTING VARIABLE"); code.add(asmcode::MOV, asmcode::RAX, CONSTANT_SPACE_POINTER); code.add(asmcode::ADD, asmcode::RAX, asmcode::NUMBER, word.binding_space_offset); code.add(asmcode::VMOVAPS, AVX_REG0, asmcode::MEM_RAX); code.add(asmcode::SUB, asmcode::RAX, asmcode::NUMBER, (word.binding_space_offset - word.variable_address)); code.add(asmcode::VMOVAPS, asmcode::MEM_RAX, AVX_REG0); code.add(asmcode::COMMENT, "END OVERWRITE EXISTING VARIABLE"); break; } case expanded_token::ET_UPDATE_VARIABLE: { code.add(asmcode::COMMENT, "BEGIN UPDATE VARIABLE VALUE"); code.add(asmcode::MOV, asmcode::RAX, CONSTANT_SPACE_POINTER); if (word.variable_address) code.add(asmcode::ADD, asmcode::RAX, asmcode::NUMBER, word.variable_address); code.add(asmcode::VMOVAPS, AVX_REG0, MEM_STACK_REGISTER); code.add(asmcode::ADD, STACK_REGISTER, asmcode::NUMBER, AVX_CELLS(1)); code.add(asmcode::VMOVAPS, asmcode::MEM_RAX, AVX_REG0); code.add(asmcode::COMMENT, "END UPDATE VARIABLE VALUE"); break; } case expanded_token::ET_VARIABLE: { code.add(asmcode::COMMENT, "BEGIN PUSH VARIABLE ADDRESS OR VALUE ON STACK"); code.add(asmcode::MOV, asmcode::RAX, CONSTANT_SPACE_POINTER); if (word.variable_address) code.add(asmcode::ADD, asmcode::RAX, asmcode::NUMBER, word.variable_address); code.add(asmcode::VMOVAPS, AVX_REG0, asmcode::MEM_RAX); code.add(asmcode::SUB, STACK_REGISTER, asmcode::NUMBER, AVX_CELLS(1)); code.add(asmcode::VMOVAPS, MEM_STACK_REGISTER, AVX_REG0); code.add(asmcode::COMMENT, "END PUSH VARIABLE ADDRESS OR VALUE ON STACK"); break; } case expanded_token::ET_CREATE_VARIABLE: { code.add(asmcode::COMMENT, "BEGIN CREATE VARIABLE"); code.add(asmcode::MOV, asmcode::RAX, CONSTANT_SPACE_POINTER); if (word.binding_space_offset) code.add(asmcode::ADD, asmcode::RAX, asmcode::NUMBER, word.binding_space_offset); code.add(asmcode::VMOVAPS, AVX_REG0, MEM_STACK_REGISTER); code.add(asmcode::ADD, STACK_REGISTER, asmcode::NUMBER, AVX_CELLS(1)); code.add(asmcode::VMOVAPS, asmcode::MEM_RAX, AVX_REG0); code.add(asmcode::COMMENT, "END CREATE VARIABLE"); break; } } // switch } } void compile(ASM::asmcode& code, dictionary& d, expand_data& ed, const std::vector<token>& words) { compile_data cd = create_compile_data(); std::vector<expanded_token> expanded; expand(expanded, d, ed, words); for (int iter = 0; iter < 2; ++iter) { strength_reduction(expanded); constant_folding(expanded); } superoperators(expanded); std::reverse(expanded.begin(), expanded.end()); code.add(asmcode::GLOBAL, "forth_entry"); #ifdef _WIN32 /* windows parameters calling convention: rcx, rdx, r8, r9 First parameter (rcx) points to the context. We store the pointer to the context in register r10. */ code.add(asmcode::COMMENT, "CONTEXT POINTER (INPUT) IS SAVED IN REGISTER R10"); code.add(asmcode::MOV, CONTEXT, asmcode::RCX); #else /* Linux parameters calling convention: rdi, rsi, rdx, rcx, r8, r9 First parameter (rdi) points to the context. We store the pointer to the context in register r10. */ code.add(asmcode::MOV, CONTEXT, asmcode::RDI); #endif /* Save the current content of the registers in the context */ code.add(asmcode::COMMENT, "STORE REGISTERS AS REQUESTED BY THE CALLING CONVENTIONS"); store_registers(code); code.add(asmcode::COMMENT, "SAVE THE STACK POINTER IN ITS ASSIGNED REGISTER"); code.add(asmcode::MOV, STACK_REGISTER, STACK_POINTER); code.add(asmcode::COMMENT, "SAVE THE HERE POINTER (HEAP) IN ITS ASSIGNED REGISTER"); code.add(asmcode::MOV, HERE, HERE_POINTER); /* Align stack with 64 byte boundary */ code.add(asmcode::COMMENT, "ALIGN RSP TO 64 BYTE BOUNDARY"); code.add(asmcode::AND, asmcode::RSP, asmcode::NUMBER, 0xFFFFFFFFFFFFFFC0); code.add(asmcode::COMMENT, "STORE THE RETURN STACK TOP"); code.add(asmcode::MOV, RSP_TOP, asmcode::RSP); code.add(asmcode::COMMENT, "START COMPILATION OF WORDS"); compile_words(code, cd, expanded); code.add(asmcode::COMMENT, "END COMPILATION OF WORDS"); code.add(asmcode::COMMENT, "SAVE CURRENT STACK POINTER IN CONTEXT"); code.add(asmcode::MOV, STACK_POINTER, STACK_REGISTER); /*Restore the registers to their original state*/ code.add(asmcode::COMMENT, "RESTORE THE REGISTERS AS REQUESTED BY THE CALLING CONVENTIONS"); load_registers(code); code.add(asmcode::COMMENT, "RETURN TO CALLER"); /*Return to the caller*/ code.add(asmcode::RET); } VF_END
40.266573
139
0.66223
[ "vector" ]
d4f0b35f4117d4a64fc11027168aaf8a3f354de7
3,217
cc
C++
src/backend/Win32Backend.cc
NodeOS/node-canvas
e3efd6800ba5b44c210868de10bc11f30910ac8b
[ "Unlicense" ]
2
2015-07-06T21:09:28.000Z
2016-06-08T17:07:15.000Z
src/backend/Win32Backend.cc
NodeOS/node-canvas
e3efd6800ba5b44c210868de10bc11f30910ac8b
[ "Unlicense" ]
null
null
null
src/backend/Win32Backend.cc
NodeOS/node-canvas
e3efd6800ba5b44c210868de10bc11f30910ac8b
[ "Unlicense" ]
2
2015-07-06T21:09:28.000Z
2017-01-24T15:38:59.000Z
#include "Win32Backend.h" using namespace v8; UINT style = WS_BORDER | WS_CAPTION | WS_MINIMIZEBOX | WS_OVERLAPPED; void adjustWindowRect(LPRECT pRect, int width, int height) { pRect->left = CW_USEDEFAULT; pRect->top = CW_USEDEFAULT; pRect->right = width; pRect->bottom = height; if(!AdjustWindowRect(pRect, style, FALSE)) { std::ostringstream o; o << "cannot adjust window rect"; throw Win32BackendException(o.str()); }; } Win32Backend::Win32Backend(int width, int height) : ScreenBackend("win32", width, height) { RECT rect; adjustWindowRect(&rect, width, height); this->window = CreateWindow('', '', style, rect.left, rect.top, rect.right, rect.bottom, NULL, NULL, NULL, NULL ); if(!this->window) { std::ostringstream o; o << "cannot create the window"; throw Win32BackendException(o.str()); }; // Disable window close button IntPtr menuHandle = GetSystemMenu(this->window, FALSE); if(EnableMenuItem(menuHandle, SC_CLOSE | SC_MOVE | SC_SIZE, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED) == -1) { std::ostringstream o; o << "cannot enable menu item"; throw Win32BackendException(o.str()); }; if(!DestroyMenu(menuHandle)) { std::ostringstream o; o << "cannot destroy menu handler"; throw Win32BackendException(o.str()); }; } Win32Backend::~Win32Backend() { if(!DestroyWindow(this->window)) { std::ostringstream o; o << "cannot destroy the window"; throw Win32BackendException(o.str()); }; } void Win32Backend::createSurface() { assert(!surface); this->surface = cairo_win32_surface_create(hdc); } void Win32Backend::setWidth(int width) { RECT rect; adjustWindowRect(&rect, width, height); if(!SetWindowPos(this->window, HWND_TOP, 0, 0, rect.right, rect.bottom, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOZORDER)) { std::ostringstream o; o << "cannot set width \"" << width << "\""; throw Win32BackendException(o.str()); }; ScreenBackend::setWidth(width); } void Win32Backend::setHeight(int height) { RECT rect; adjustWindowRect(&rect, width, height); if(!SetWindowPos(this->window, HWND_TOP, 0, 0, rect.right, rect.bottom, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOZORDER)) { std::ostringstream o; o << "cannot set height \"" << height << "\""; throw Win32BackendException(o.str()); }; ScreenBackend::setHeight(height); } Nan::Persistent<FunctionTemplate> Win32Backend::constructor; void Win32Backend::Initialize(Handle<Object> target) { Nan::HandleScope scope; Local<FunctionTemplate> ctor = Nan::New<FunctionTemplate>(Win32Backend::New); Win32Backend::constructor.Reset(ctor); ctor->InstanceTemplate()->SetInternalFieldCount(1); ctor->SetClassName(Nan::New<String>("Win32Backend").ToLocalChecked()); ScreenBackend::Initialize(ctor); Nan::Set(target, Nan::New<String>("Win32Backend").ToLocalChecked(), Nan::GetFunction(ctor).ToLocalChecked()).Check(); } NAN_METHOD(Win32Backend::New) { int width = 0; int height = 0; if(info[0]->IsNumber()) width = info[0]->Uint32Value(); if(info[1]->IsNumber()) height = info[1]->Uint32Value(); Win32Backend* backend = new Win32Backend(width, height); backend->Wrap(info.This()); info.GetReturnValue().Set(info.This()); }
21.884354
78
0.695679
[ "object" ]
d4f524f8a20b2eb95fb965ee9b8331d2c365b3dd
4,022
cpp
C++
lumino/Graphics/src/GraphicsCommandBuffer.cpp
GameDevery/Lumino
abce2ddca4b7678b04dbfd0ae5348e196c3c9379
[ "MIT" ]
113
2020-03-05T01:27:59.000Z
2022-03-28T13:20:51.000Z
lumino/Graphics/src/GraphicsCommandBuffer.cpp
GameDevery/Lumino
abce2ddca4b7678b04dbfd0ae5348e196c3c9379
[ "MIT" ]
13
2020-03-23T20:36:44.000Z
2022-02-28T11:07:32.000Z
lumino/Graphics/src/GraphicsCommandBuffer.cpp
GameDevery/Lumino
abce2ddca4b7678b04dbfd0ae5348e196c3c9379
[ "MIT" ]
12
2020-12-21T12:03:59.000Z
2021-12-15T02:07:49.000Z
 #include "Internal.hpp" #include "GraphicsManager.hpp" #include "RHIs/GraphicsDeviceContext.hpp" #include <LuminoGraphics/GraphicsCommandBuffer.hpp> #include <LuminoGraphics/Shader.hpp> #include <LuminoGraphics/ShaderDescriptor.hpp> #include "SingleFrameAllocator.hpp" namespace ln { namespace detail { //============================================================================== // GraphicsCommandList GraphicsCommandList::GraphicsCommandList() : m_drawCall(0) { } void GraphicsCommandList::init(GraphicsManager* manager) { m_rhiResource = manager->deviceContext()->createCommandList(); m_allocator = makeRef<LinearAllocator>(manager->linearAllocatorPageManager()); m_singleFrameUniformBufferAllocator = makeRef<detail::SingleFrameUniformBufferAllocator>(manager->singleFrameUniformBufferAllocatorPageManager()); m_uniformBufferOffsetAlignment = manager->deviceContext()->caps().uniformBufferOffsetAlignment; } void GraphicsCommandList::dispose() { reset(); if (m_rhiResource) { m_rhiResource = nullptr; } //for (const auto& pair : m_usingDescriptorPools) { // pair.descriptorPool->dispose(); //} m_usingDescriptorPools.clear(); } void GraphicsCommandList::reset() { // 実行終了を待つ m_rhiResource->wait(); m_allocator->cleanup(); //m_singleFrameUniformBufferAllocator->cleanup(); for (const auto& pair : m_usingDescriptorPools) { pair.shaderPass->releaseDescriptorSetsPool(pair.descriptorPool); } m_usingDescriptorPools.clear(); m_drawCall = 0; m_vertexBufferDataTransferredSize = 0; m_indexBufferDataTransferredSize = 0; m_textureDataTransferredSize = 0; } detail::ConstantBufferView GraphicsCommandList::allocateUniformBuffer(size_t size) { return m_singleFrameUniformBufferAllocator->allocate(size, m_uniformBufferOffsetAlignment); } ShaderSecondaryDescriptor* GraphicsCommandList::acquireShaderDescriptor(Shader* shader) { return shader->acquireDescriptor(); } IDescriptorPool* GraphicsCommandList::getDescriptorPool(ShaderPass* shaderPass) { // このコマンド実行中に新たな ShaderPass が使われるたびに、新しく VulkanShaderPass から Pool を確保しようとする。 // ただし、毎回やると重いので簡単なキャッシュを設ける。 // 線形探索だけど、ShaderPass が1フレームに 100 も 200 も使われることはそうないだろう。 int usingShaderPass = -1; for (int i = 0; i < m_usingDescriptorPools.size(); i++) { if (m_usingDescriptorPools[i].shaderPass == shaderPass) { usingShaderPass = i; } } if (usingShaderPass == -1) { auto pool = shaderPass->getDescriptorSetsPool(); ShaderPassDescriptorPair pair; pair.shaderPass = shaderPass; pair.descriptorPool = pool; m_usingDescriptorPools.push_back(pair); usingShaderPass = m_usingDescriptorPools.size() - 1; } return m_usingDescriptorPools[usingShaderPass].descriptorPool; } } // namespace detail #if 0 //============================================================================== // GraphicsCommandBuffer GraphicsCommandBuffer::GraphicsCommandBuffer() : m_manager(nullptr) , m_rhiObject() { } GraphicsCommandBuffer::~GraphicsCommandBuffer() { } void GraphicsCommandBuffer::init() { Object::init(); detail::GraphicsResourceInternal::initializeHelper_GraphicsResource(this, &m_manager); m_singleFrameUniformBufferAllocator = makeRef<detail::SingleFrameUniformBufferAllocator>(m_manager->singleFrameUniformBufferAllocatorPageManager()); } void GraphicsCommandBuffer::onDispose(bool explicitDisposing) { detail::GraphicsResourceInternal::finalizeHelper_GraphicsResource(this, &m_manager); Object::onDispose(explicitDisposing); } detail::UniformBufferView GraphicsCommandBuffer::allocateUniformBuffer(size_t size) { return m_singleFrameUniformBufferAllocator->allocate(size); } void GraphicsCommandBuffer::onChangeDevice(detail::IGraphicsDevice* device) { } detail::ICommandList* GraphicsCommandBuffer::resolveRHIObject(GraphicsContext* context, bool* outModified) { return nullptr; } #endif } // namespace ln
28.125874
152
0.727001
[ "object" ]
d4f7ddde0dd41895ffa1e97fd608c864f4ee4185
16,121
cpp
C++
Classifiers/GRT/ClusteringModules/SelfOrganizingMap/SelfOrganizingMap.cpp
humberto-trujillo/Badminton_Shot_Classifier
402dfed5824c957a415b0f1a5d8a51b3494fb164
[ "MIT" ]
2
2018-12-19T05:43:35.000Z
2018-12-20T04:15:26.000Z
Classifiers/GRT/ClusteringModules/SelfOrganizingMap/SelfOrganizingMap.cpp
humberto-trujillo/IMU_GestureClassifier
402dfed5824c957a415b0f1a5d8a51b3494fb164
[ "MIT" ]
null
null
null
Classifiers/GRT/ClusteringModules/SelfOrganizingMap/SelfOrganizingMap.cpp
humberto-trujillo/IMU_GestureClassifier
402dfed5824c957a415b0f1a5d8a51b3494fb164
[ "MIT" ]
null
null
null
/* GRT MIT License Copyright (c) <2012> <Nicholas Gillian, Media Lab, MIT> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #define GRT_DLL_EXPORTS #include "SelfOrganizingMap.h" GRT_BEGIN_NAMESPACE #define SOM_MIN_TARGET -1.0 #define SOM_MAX_TARGET 1.0 //Define the string that will be used to identify the object const std::string SelfOrganizingMap::id = "SelfOrganizingMap"; std::string SelfOrganizingMap::getId() { return SelfOrganizingMap::id; } //Register the SelfOrganizingMap class with the Clusterer base class RegisterClustererModule< SelfOrganizingMap > SelfOrganizingMap::registerModule( SelfOrganizingMap::getId() ); SelfOrganizingMap::SelfOrganizingMap( const UINT networkSize, const UINT networkTypology, const UINT maxNumEpochs, const Float sigmaWeight, const Float alphaStart, const Float alphaEnd ) : Clusterer( SelfOrganizingMap::getId() ) { this->numClusters = networkSize; this->networkTypology = networkTypology; this->maxNumEpochs = maxNumEpochs; this->sigmaWeight = sigmaWeight; this->alphaStart = alphaStart; this->alphaEnd = alphaEnd; } SelfOrganizingMap::SelfOrganizingMap(const SelfOrganizingMap &rhs) : Clusterer( SelfOrganizingMap::getId() ) { if( this != &rhs ){ this->numClusters = rhs.numClusters; this->networkTypology = rhs.networkTypology; this->sigmaWeight = rhs.sigmaWeight; this->alphaStart = rhs.alphaStart; this->alphaEnd = rhs.alphaEnd; this->neurons = rhs.neurons; this->mappedData = rhs.mappedData; //Clone the Clusterer variables copyBaseVariables( (Clusterer*)&rhs ); } } SelfOrganizingMap::~SelfOrganizingMap(){ } SelfOrganizingMap& SelfOrganizingMap::operator=(const SelfOrganizingMap &rhs){ if( this != &rhs ){ this->numClusters = rhs.numClusters; this->networkTypology = rhs.networkTypology; this->sigmaWeight = rhs.sigmaWeight; this->alphaStart = rhs.alphaStart; this->alphaEnd = rhs.alphaEnd; this->neurons = rhs.neurons; this->mappedData = rhs.mappedData; //Clone the Clusterer variables copyBaseVariables( (Clusterer*)&rhs ); } return *this; } bool SelfOrganizingMap::deepCopyFrom(const Clusterer *clusterer){ if( clusterer == NULL ) return false; if( this->getId() == clusterer->getId() ){ //Clone the SelfOrganizingMap values const SelfOrganizingMap *ptr = dynamic_cast<const SelfOrganizingMap*>(clusterer); this->numClusters = ptr->numClusters; this->networkTypology = ptr->networkTypology; this->sigmaWeight = ptr->sigmaWeight; this->alphaStart = ptr->alphaStart; this->alphaEnd = ptr->alphaEnd; this->neurons = ptr->neurons; this->mappedData = ptr->mappedData; //Clone the Clusterer variables return copyBaseVariables( clusterer ); } return false; } bool SelfOrganizingMap::reset(){ //Reset the base class Clusterer::reset(); return true; } bool SelfOrganizingMap::clear(){ //Reset the base class Clusterer::clear(); //Clear the SelfOrganizingMap models neurons.clear(); return true; } bool SelfOrganizingMap::train_( MatrixFloat &data ){ //Clear any previous models clear(); const UINT M = data.getNumRows(); const UINT N = data.getNumCols(); numInputDimensions = N; numOutputDimensions = numClusters*numClusters; Random rand; //Setup the neurons neurons.resize( numClusters, numClusters ); if( neurons.getSize() != numClusters*numClusters ){ errorLog << "train_( MatrixFloat &data ) - Failed to resize neurons matrix, there might not be enough memory!" << std::endl; return false; } //Init the neurons for(UINT i=0; i<numClusters; i++){ for(UINT j=0; j<numClusters; j++){ neurons[i][j].init( N, 0.5, SOM_MIN_TARGET, SOM_MAX_TARGET ); } } //Scale the data if needed ranges = data.getRanges(); if( useScaling ){ for(UINT i=0; i<M; i++){ for(UINT j=0; j<numInputDimensions; j++){ data[i][j] = scale(data[i][j],ranges[j].minValue,ranges[j].maxValue,SOM_MIN_TARGET,SOM_MAX_TARGET); } } } Float error = 0; Float lastError = 0; Float trainingSampleError = 0; Float delta = 0; Float minChange = 0; Float weightUpdate = 0; Float alpha = 1.0; Float neuronDiff = 0; Float neuronWeightFunction = 0; Float gamma = 0; UINT iter = 0; bool keepTraining = true; VectorFloat trainingSample; Vector< UINT > randomTrainingOrder(M); //In most cases, the training data is grouped into classes (100 samples for class 1, followed by 100 samples for class 2, etc.) //This can cause a problem for stochastic gradient descent algorithm. To avoid this issue, we randomly shuffle the order of the //training samples. This random order is then used at each epoch. for(UINT i=0; i<M; i++){ randomTrainingOrder[i] = i; } std::random_shuffle(randomTrainingOrder.begin(), randomTrainingOrder.end()); //Enter the main training loop while( keepTraining ){ //Update alpha based on the current iteration alpha = Util::scale(iter,0,maxNumEpochs,alphaStart,alphaEnd); //Run one epoch of training using the online best-matching-unit algorithm error = 0; for(UINT m=0; m<M; m++){ trainingSampleError = 0; //Get the i'th random training sample trainingSample = data.getRowVector( randomTrainingOrder[m] ); //Find the best matching unit Float dist = 0; Float bestDist = grt_numeric_limits< Float >::max(); UINT bestIndexRow = 0; UINT bestIndexCol = 0; for(UINT i=0; i<numClusters; i++){ for(UINT j=0; j<numClusters; j++){ dist = neurons[i][j].getSquaredWeightDistance( trainingSample ); if( dist < bestDist ){ bestDist = dist; bestIndexRow = i; bestIndexCol = j; } } } error += bestDist; //Update the weights based on the distance to the winning neuron //Neurons closer to the winning neuron will have their weights update more const Float bir = bestIndexRow; const Float bic = bestIndexCol; for(UINT i=0; i<numClusters; i++){ for(UINT j=0; j<numClusters; j++){ //Update the weights for all the neurons, pulling them a little closer to the input example neuronDiff = 0; gamma = 2.0 * grt_sqr( numClusters * sigmaWeight ); neuronWeightFunction = exp( -grt_sqr(bir-i)/gamma ) * exp( -grt_sqr(bic-j)/gamma ); //std::cout << "best index: " << bestIndexRow << " " << bestIndexCol << " bestDist: " << bestDist << " pos: " << i << " " << j << " neuronWeightFunction: " << neuronWeightFunction << std::endl; for(UINT n=0; n<N; n++){ neuronDiff = trainingSample[n] - neurons[i][j][n]; weightUpdate = neuronWeightFunction * alpha * neuronDiff; neurons[i][j][n] += weightUpdate; } } } } error = error / M; trainingLog << "iter: " << iter << " average error: " << error << std::endl; //Compute the error delta = fabs( error-lastError ); lastError = error; //Check to see if we should stop if( delta <= minChange && false ){ converged = true; keepTraining = false; } if( grt_isinf( error ) ){ errorLog << "train_(MatrixFloat &data) - Training failed! Error is NAN!" << std::endl; return false; } if( ++iter >= maxNumEpochs ){ keepTraining = false; } trainingLog << "Epoch: " << iter << " Squared Error: " << error << " Delta: " << delta << " Alpha: " << alpha << std::endl; } numTrainingIterationsToConverge = iter; trained = true; return true; } bool SelfOrganizingMap::train_(ClassificationData &trainingData){ MatrixFloat data = trainingData.getDataAsMatrixFloat(); return train_(data); } bool SelfOrganizingMap::train_(UnlabelledData &trainingData){ MatrixFloat data = trainingData.getDataAsMatrixFloat(); return train_(data); } bool SelfOrganizingMap::map_( VectorFloat &x ){ if( !trained ){ return false; } if( useScaling ){ for(UINT i=0; i<numInputDimensions; i++){ x[i] = scale(x[i], ranges[i].minValue, ranges[i].maxValue, SOM_MIN_TARGET, SOM_MAX_TARGET); } } if( mappedData.getSize() != numClusters*numClusters ) mappedData.resize( numClusters*numClusters ); UINT index = 0; for(UINT i=0; i<numClusters; i++){ for(UINT j=0; j<numClusters; j++){ mappedData[index++] = neurons[i][j].fire( x ); } } return true; } bool SelfOrganizingMap::save( std::fstream &file ) const{ if( !trained ){ errorLog << "save(fstream &file) - Can't save model to file, the model has not been trained!" << std::endl; return false; } file << "GRT_SELF_ORGANIZING_MAP_MODEL_FILE_V1.0\n"; if( !saveClustererSettingsToFile( file ) ){ errorLog << "save(fstream &file) - Failed to save cluster settings to file!" << std::endl; return false; } file << "NetworkTypology: " << networkTypology << std::endl; file << "AlphaStart: " << alphaStart << std::endl; file << "AlphaEnd: " << alphaEnd << std::endl; if( trained ){ file << "Neurons: \n"; for(UINT i=0; i<neurons.getNumRows(); i++){ for(UINT j=0; j<neurons.getNumCols(); j++){ if( !neurons[i][j].save( file ) ){ errorLog << "save(fstream &file) - Failed to save neuron to file!" << std::endl; return false; } } } } return true; } bool SelfOrganizingMap::load( std::fstream &file ){ //Clear any previous model clear(); std::string word; file >> word; if( word != "GRT_SELF_ORGANIZING_MAP_MODEL_FILE_V1.0" ){ errorLog << "load(fstream &file) - Failed to load file header!" << std::endl; return false; } if( !loadClustererSettingsFromFile( file ) ){ errorLog << "load(fstream &file) - Failed to load cluster settings from file!" << std::endl; return false; } file >> word; if( word != "NetworkTypology:" ){ errorLog << "load(fstream &file) - Failed to load NetworkTypology header!" << std::endl; return false; } file >> networkTypology; file >> word; if( word != "AlphaStart:" ){ errorLog << "load(fstream &file) - Failed to load AlphaStart header!" << std::endl; return false; } file >> alphaStart; file >> word; if( word != "AlphaEnd:" ){ errorLog << "load(fstream &file) - Failed to load alphaEnd header!" << std::endl; return false; } file >> alphaEnd; //Load the model if it has been trained if( trained ){ file >> word; if( word != "Neurons:" ){ errorLog << "load(fstream &file) - Failed to load Neurons header!" << std::endl; return false; } neurons.resize(numClusters,numClusters); for(UINT i=0; i<neurons.getNumRows(); i++){ for(UINT j=0; j<neurons.getNumCols(); j++){ if( !neurons[i][j].load( file ) ){ errorLog << "load(fstream &file) - Failed to save neuron to file!" << std::endl; return false; } } } } return true; } bool SelfOrganizingMap::validateNetworkTypology( const UINT networkTypology ){ if( networkTypology == RANDOM_NETWORK ) return true; warningLog << "validateNetworkTypology(const UINT networkTypology) - Unknown networkTypology!" << std::endl; return false; } UINT SelfOrganizingMap::getNetworkSize() const{ return numClusters; } Float SelfOrganizingMap::getAlphaStart() const{ return alphaStart; } Float SelfOrganizingMap::getAlphaEnd() const{ return alphaEnd; } VectorFloat SelfOrganizingMap::getMappedData() const{ return mappedData; } Matrix< GaussNeuron > SelfOrganizingMap::getNeurons() const{ return neurons; } const Matrix< GaussNeuron >& SelfOrganizingMap::getNeuronsRef() const{ return neurons; } Matrix< VectorFloat > SelfOrganizingMap::getWeightsMatrix() const { if( !trained ) return Matrix< VectorFloat >(); Matrix< VectorFloat > weights( numClusters, numClusters, VectorFloat(numInputDimensions) ); for(UINT i=0; i<numClusters; i++){ for(UINT j=0; j<numClusters; j++){ for(UINT n=0; n<numInputDimensions; n++){ weights[i][j][n] = neurons[i][j][n]; } } } return weights; } bool SelfOrganizingMap::setNetworkSize( const UINT networkSize ){ if( networkSize > 0 ){ this->numClusters = networkSize; return true; } warningLog << "setNetworkSize(const UINT networkSize) - The networkSize must be greater than 0!" << std::endl; return false; } bool SelfOrganizingMap::setNetworkTypology( const UINT networkTypology ){ if( validateNetworkTypology( networkTypology ) ){ this->networkTypology = networkTypology; return true; } return false; } bool SelfOrganizingMap::setAlphaStart( const Float alphaStart ){ if( alphaStart > 0 ){ this->alphaStart = alphaStart; return true; } warningLog << "setAlphaStart(const Float alphaStart) - AlphaStart must be greater than zero!" << std::endl; return false; } bool SelfOrganizingMap::setAlphaEnd( const Float alphaEnd ){ if( alphaEnd > 0 ){ this->alphaEnd = alphaEnd; return true; } warningLog << "setAlphaEnd(const Float alphaEnd) - AlphaEnd must be greater than zero!" << std::endl; return false; } bool SelfOrganizingMap::setSigmaWeight( const Float sigmaWeight ){ if( sigmaWeight > 0 ){ this->sigmaWeight = sigmaWeight; return true; } warningLog << "setSigmaWeight(const Float sigmaWeight) - sigmaWeight must be greater than zero!" << std::endl; return false; } GRT_END_NAMESPACE
31.986111
228
0.601203
[ "object", "vector", "model" ]
d4faed20f4a476ceff81356da765aeab010a29c8
35,837
cpp
C++
Editor/Source/Editor.cpp
SemperParatusGithub/MiniEngine
bd362c8644f92b041163b30bd33e5d51d0283fb1
[ "MIT" ]
3
2021-04-25T20:13:28.000Z
2021-08-10T20:58:51.000Z
Editor/Source/Editor.cpp
SemperParatusGithub/MiniEngine
bd362c8644f92b041163b30bd33e5d51d0283fb1
[ "MIT" ]
null
null
null
Editor/Source/Editor.cpp
SemperParatusGithub/MiniEngine
bd362c8644f92b041163b30bd33e5d51d0283fb1
[ "MIT" ]
1
2021-08-10T20:58:54.000Z
2021-08-10T20:58:54.000Z
#include "Editor.h" #define NOMINMAX #include <Windows.h> #include <Glad/glad.h> #include <imgui/imgui.h> #include <imgui/imgui_internal.h> #include <glm/gtc/matrix_transform.hpp> #include <ImGuizmo/ImGuizmo.h> #include <stb_image/stb_image.h> #include <GLFW/glfw3.h> #define GLFW_EXPOSE_NATIVE_WIN32 #include <GLFW/glfw3native.h> static std::string OpenFileDialog(const char* filter) { OPENFILENAMEA ofn; // common dialog box structure CHAR szFile[260] = { 0 }; // if using TCHAR macros // Initialize OPENFILENAME ZeroMemory(&ofn, sizeof(OPENFILENAME)); ofn.lStructSize = sizeof(OPENFILENAME); ofn.hwndOwner = glfwGetWin32Window((GLFWwindow*)Engine::Application::GetInstance()->GetWindow()->GetWindowPointer()); ofn.lpstrFile = szFile; ofn.nMaxFile = sizeof(szFile); ofn.lpstrFilter = filter; ofn.nFilterIndex = 1; ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST | OFN_NOCHANGEDIR; if (GetOpenFileNameA(&ofn) == TRUE) { return ofn.lpstrFile; } return std::string(""); } static std::string SaveFileDialog(const char* filter) { OPENFILENAMEA ofn; CHAR szFile[260] = { 0 }; CHAR currentDir[256] = { 0 }; ZeroMemory(&ofn, sizeof(OPENFILENAME)); ofn.lStructSize = sizeof(OPENFILENAME); ofn.hwndOwner = glfwGetWin32Window((GLFWwindow*)Engine::Application::GetInstance()->GetWindow()->GetWindowPointer()); ofn.lpstrFile = szFile; ofn.nMaxFile = sizeof(szFile); if (GetCurrentDirectoryA(256, currentDir)) ofn.lpstrInitialDir = currentDir; ofn.lpstrFilter = filter; ofn.nFilterIndex = 1; ofn.Flags = OFN_PATHMUSTEXIST | OFN_OVERWRITEPROMPT | OFN_NOCHANGEDIR; // Sets the default extension by extracting it from the filter ofn.lpstrDefExt = strchr(filter, '\0') + 1; if (GetSaveFileNameA(&ofn) == TRUE) { return ofn.lpstrFile; } return std::string(""); } Editor::Editor(): m_Camera(Engine::CameraType::Orbit) { } Editor::~Editor() { } void Editor::OnCreate() { auto& window = Application::GetInstance()->GetWindow(); window->Maximize(); window->SetVSync(false); m_MainFramebuffer = MakeShared<Engine::Framebuffer>(1280, 720); m_MainFramebuffer->multisampled = true; m_MainFramebuffer->samples = 8; m_MainFramebuffer->attachments = { Engine::FramebufferTextureFormat::RGBA32F, Engine::FramebufferTextureFormat::DEPTH24STENCIL8 }; m_MainFramebuffer->Create(); m_FinalFramebuffer = MakeShared<Engine::Framebuffer>(1280, 720); m_FinalFramebuffer->multisampled = false; m_FinalFramebuffer->attachments = { Engine::FramebufferTextureFormat::RGBA8 }; m_FinalFramebuffer->Create(); m_EditorScene = MakeShared<Engine::Scene>(); m_RuntimeScene = MakeShared<Engine::Scene>(); m_EditorScene->environment = CreateEnvironment("Assets/Environments/Clouds.hdr"); // Test Scene { std::vector<Engine::Transform> staticBodies = { Engine::Transform({ 0.0f, 0.0f, 0.0f }, {0.0f, 0.0f, 0.0f}, {20.0f, 1.0f, 5.0f}), // Ground Engine::Transform({-3.0f, 4.0f, 0.0f }, {0.0f, 0.0f, glm::radians(-30.0f)}, {5.0f, 1.0f, 1.0f}), Engine::Transform({ 3.0f, 7.0f, 0.0f }, {0.0f, 0.0f, glm::radians(30.0f)}, {5.0f, 1.0f, 1.0f}), Engine::Transform({-3.0f, 10.0f, 0.0f }, {0.0f, 0.0f, glm::radians(-30.0f)}, {5.0f, 1.0f, 1.0f}) }; std::vector<Engine::Transform> dynamicBodies = { Engine::Transform({ 2.0f, 11.0f, 0.0f }, {0.0f, 0.0f, glm::radians(45.0f)}, {1.0f, 1.0f, 1.0f}), // Ground Engine::Transform({-2.0f, 12.0f, 0.0f }, {0.0f, 0.0f, glm::radians(45.0f)}, {1.0f, 1.0f, 1.0f}), Engine::Transform({ 2.0f, 13.0f, 0.0f }, {0.0f, 0.0f, glm::radians(45.0f)}, {1.0f, 1.0f, 1.0f}), Engine::Transform({-2.0f, 14.0f, 0.0f }, {0.0f, 0.0f, glm::radians(45.0f)}, {1.0f, 1.0f, 1.0f}) }; for (std::size_t i = 0; i < staticBodies.size(); i++) { auto& transform = staticBodies[i]; std::string name = "Static Body #" + std::to_string(i); auto entity = m_EditorScene->CreateEntity(name); entity.Get<Engine::TransformComponent>().transform = transform; entity.Add<Engine::MeshComponent>("Assets/Meshes/Cube.fbx"); entity.Add<Engine::Rigidbody2DComponent>(); entity.Add<Engine::BoxCollider2DComponent>(); } for (std::size_t i = 0; i < dynamicBodies.size(); i++) { auto& transform = dynamicBodies[i]; std::string name = "Dynamic Body #" + std::to_string(i); auto entity = m_EditorScene->CreateEntity(name); entity.Get<Engine::TransformComponent>().transform = transform; entity.Add<Engine::MeshComponent>("Assets/Meshes/Cube.fbx"); auto& body = entity.Add<Engine::Rigidbody2DComponent>(); auto& collider = entity.Add<Engine::BoxCollider2DComponent>(); body.Type = Engine::Rigidbody2DComponent::BodyType::Dynamic; collider.Restitution = 0.5f; } } } void Editor::OnDestroy() { } void Editor::OnUpdate(float delta) { switch (m_SceneState) { case SceneState::Editing: { // Gizmos if (Engine::Input::IsKeyPressed(Engine::Key::LeftControl) && !ImGuizmo::IsUsing()) { if (Engine::Input::IsKeyPressed(Engine::Key::D1)) m_ImGuizmoOperation = ImGuizmo::OPERATION::TRANSLATE; if (Engine::Input::IsKeyPressed(Engine::Key::D2)) m_ImGuizmoOperation = ImGuizmo::OPERATION::ROTATE; if (Engine::Input::IsKeyPressed(Engine::Key::D3)) m_ImGuizmoOperation = ImGuizmo::OPERATION::SCALE; if (Engine::Input::IsKeyPressed(Engine::Key::D0)) m_ImGuizmoOperation = -1; } break; } case SceneState::Playing: { m_RuntimeScene->OnUpdate(delta); break; } case SceneState::Pausing: { break; } } m_Camera.OnUpdate(delta); if (m_ViewportSizeChanged) { m_Camera.OnResize(static_cast<u32>(m_ViewportSize.x), static_cast<u32>(m_ViewportSize.y)); m_MainFramebuffer->Resize(static_cast<u32>(m_ViewportSize.x), static_cast<u32>(m_ViewportSize.y)); m_FinalFramebuffer->Resize(static_cast<u32>(m_ViewportSize.x), static_cast<u32>(m_ViewportSize.y)); m_ViewportSizeChanged = false; } // Render { Engine::Renderer::SetClearColor(glm::vec4{ 0.7f, 0.7f, 0.7f, 1.0f }); Engine::Renderer::Clear(); MainRenderPass(); CompositionRenderPass(); } } void Editor::OnEvent(Engine::Event &event) { m_Camera.OnEvent(event); if (Engine::Input::IsKeyPressed(Engine::Key::LeftControl)) { if (event.type == Engine::EventType::KeyPressed && event.key.code == Engine::Key::D) { if (m_SelectedEntity) m_SelectedEntity = m_EditorScene->DuplicateEntity(m_SelectedEntity); } } if (event.type == Engine::EventType::KeyPressed && event.key.code == Engine::Key::Delete) { if (m_SelectedEntity) m_SelectedEntity.Destroy(); } if (event.type == Engine::EventType::MouseButtonPressed && m_SceneState != SceneState::Playing && event.mouse.code == Engine::Mouse::ButtonLeft && m_ViewportHovered && !ImGuizmo::IsUsing() && !ImGuizmo::IsOver()) { m_SelectedEntity = Engine::Entity(); auto mouseRay = CastRay(); auto view = m_EditorScene->GetRegistry().view<Engine::TransformComponent, Engine::MeshComponent>(); view.each([&](const entt::entity ent, const Engine::TransformComponent& tc, const Engine::MeshComponent& mc) { auto entity = Engine::Entity(ent, m_EditorScene.get()); auto& subMeshes = mc.mesh->GetSubMeshes(); for (u32 i = 0; i < subMeshes.size(); i++) { auto& subMesh = subMeshes[i]; glm::mat4 transform = tc.transform.GetTransform(); Engine::Ray ray = { glm::inverse(transform * subMesh.transform) * glm::vec4(mouseRay.origin, 1.0f), glm::inverse(glm::mat3(transform) * glm::mat3(subMesh.transform)) * mouseRay.direction }; bool intersection = false; const auto& triangleMesh = mc.mesh->GetTriangleRepresentation(); for (auto& triangle : triangleMesh) { float distance; if (Engine::Math::RayIntersectsTriangle(ray, triangle, distance)) { m_SelectedEntity = Engine::Entity(ent, m_EditorScene.get()); } } } }); } } void Editor::OnImGui() { BeginDockspace(); if (ImGui::BeginMenuBar()) { if (ImGui::BeginMenu("File")) { ImGui::MenuItem("New", "Ctrl+N"); ImGui::MenuItem("Open...", "Ctrl+O"); ImGui::MenuItem("Save As...", "Ctrl+Shift+S"); ImGui::MenuItem("Exit"); ImGui::EndMenu(); } if (ImGui::BeginMenu("Settings")) { ImGui::MenuItem("Option 1"); ImGui::MenuItem("Option 2"); ImGui::MenuItem("Option 3"); ImGui::MenuItem("Option 4"); ImGui::EndMenu(); } ImGui::EndMenuBar(); } ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2{ 0, 0 }); ImGui::SetNextWindowSizeConstraints(ImVec2(600.0f, 400.0f), ImVec2(4000.0f, 3000.0f)); ImGui::Begin("Viewport"); m_ViewportFocused = ImGui::IsWindowFocused(); m_ViewportHovered = ImGui::IsWindowHovered(); m_ViewportPosition = { ImGui::GetWindowPos().x + ImGui::GetCursorPos().x, ImGui::GetWindowPos().y + ImGui::GetCursorPos().y }; glm::vec2 newViewportSize = { ImGui::GetWindowSize().x - ImGui::GetCursorPos().x, ImGui::GetWindowSize().y - ImGui::GetCursorPos().y }; if (newViewportSize != m_ViewportSize) { m_ViewportSize = newViewportSize; m_ViewportSizeChanged = true; } ImGui::Image((ImTextureID) m_FinalFramebuffer->GetColorAttachmentRendererID(), ImVec2(m_ViewportSize.x, m_ViewportSize.y), ImVec2{ 0, 1 }, ImVec2{ 1, 0 }); UpdateGizmos(); ImGui::End(); ImGui::PopStyleVar(); DrawDebugInfo(); DrawEnvironmentSettings(); DrawHierarchy(); DrawInspector(); EndDockspace(); } void Editor::MainRenderPass() { m_MainFramebuffer->Bind(); bool isMeshSelected = false; if (m_SelectedEntity) isMeshSelected = m_SelectedEntity.Has<Engine::MeshComponent>(); if (isMeshSelected) glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE); Engine::Renderer::SetClearColor(glm::vec4{ 0.7f, 0.7f, 0.7f, 1.0f }); Engine::Renderer::Clear(); if (isMeshSelected) glStencilMask(0); auto& scene = m_SceneState == SceneState::Playing ? m_RuntimeScene : m_EditorScene; // Render Scene { auto& shader = Engine::Renderer::GetShader("PBR"); shader->Bind(); shader->SetUniformMatrix4("u_ProjectionView", m_Camera.GetProjectionViewMatrix()); shader->SetUniformFloat3("u_CameraPosition", m_Camera.GetPosition()); auto &directionalLight = scene->environment.directionalLight; shader->SetUniformInt("u_DirectionalLights[0].Active", directionalLight.active); shader->SetUniformFloat3("u_DirectionalLights[0].Direction", directionalLight.direction); shader->SetUniformFloat3("u_DirectionalLights[0].Radiance", directionalLight.radiance); shader->SetUniformFloat("u_DirectionalLights[0].Multiplier", directionalLight.intensity); shader->SetUniformInt("u_BRDFLUTTexture", 5); shader->SetUniformInt("u_EnvRadianceTex", 6); shader->SetUniformInt("u_EnvIrradianceTex", 7); scene->environment.brdflutTexture->Bind(5); scene->environment.radianceMap->Bind(6); scene->environment.irradianceMap->Bind(7); auto view = scene->GetRegistry().view<Engine::TransformComponent, Engine::MeshComponent>(); view.each([=](const entt::entity ent, const Engine::TransformComponent& tc, const Engine::MeshComponent& mc) { if (mc.mesh->IsLoaded() && m_SelectedEntity.GetEntity() != ent) Engine::Renderer::SubmitMesh(mc.mesh, tc.transform.GetTransform()); }); } // Render Skybox { const auto &shader = Engine::Renderer::GetShader("Skybox"); const auto &proj = m_Camera.GetProjectionMatrix(); auto view = glm::mat4(glm::mat3(m_Camera.GetViewMatrix())); shader->Bind(); shader->SetUniformMatrix4("u_Projection", proj); shader->SetUniformMatrix4("u_View", view); shader->SetUniformInt("u_ImageCube", 0); shader->SetUniformFloat("u_TextureLod", scene->environment.textureLod); shader->SetUniformFloat("u_Exposure", scene->environment.exposure); scene->environment.radianceMap->Bind(0); Engine::Renderer::SubmitSkybox(scene->environment.radianceMap, shader); } // Render selected mesh if(isMeshSelected) { glStencilFunc(GL_ALWAYS, 1, 0xff); glStencilMask(0xff); auto &selectedMesh = m_SelectedEntity.Get<Engine::MeshComponent>(); const auto &transform = m_SelectedEntity.Get<Engine::TransformComponent>(); if (selectedMesh.mesh->IsLoaded()) { auto& shader = Engine::Renderer::GetShader("PBR"); shader->Bind(); shader->SetUniformMatrix4("u_ProjectionView", m_Camera.GetProjectionViewMatrix()); shader->SetUniformFloat3("u_CameraPosition", m_Camera.GetPosition()); shader->SetUniformFloat3("u_AlbedoColor", glm::vec3(0.8f, 0.1f, 0.15f)); shader->SetUniformInt("u_EnableAlbedoTexture", 0); shader->SetUniformInt("u_EnableNormalMapTexture", 0); shader->SetUniformInt("u_EnableMetalnessTexture", 0); shader->SetUniformInt("u_EnableRoughnessTexture", 0); shader->SetUniformInt("u_DirectionalLights[0].Active", 1); shader->SetUniformFloat3("u_DirectionalLights[0].Direction", glm::vec3(glm::radians(30.0f), glm::radians(20.0f), 0.0f)); shader->SetUniformFloat3("u_DirectionalLights[0].Radiance", glm::vec3(1.0f)); shader->SetUniformFloat("u_DirectionalLights[0].Multiplier", 1.0f); shader->SetUniformInt("u_DirectionalLights[1].Active", 0); shader->SetUniformInt("u_DirectionalLights[2].Active", 0); shader->SetUniformInt("u_DirectionalLights[3].Active", 0); shader->SetUniformInt("u_BRDFLUTTexture", 5); shader->SetUniformInt("u_EnvRadianceTex", 6); shader->SetUniformInt("u_EnvIrradianceTex", 7); scene->environment.brdflutTexture->Bind(5); scene->environment.radianceMap->Bind(6); scene->environment.irradianceMap->Bind(7); Engine::Renderer::SubmitMesh(selectedMesh.mesh, transform.transform.GetTransform()); glStencilFunc(GL_NOTEQUAL, 1, 0xff); glStencilMask(0x00); glDisable(GL_DEPTH_TEST); glLineWidth(10); glEnable(GL_LINE_SMOOTH); glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); auto& outlineShader = Engine::Renderer::GetShader("Outline"); outlineShader->Bind(); outlineShader->SetUniformMatrix4("u_ProjectionView", m_Camera.GetProjectionViewMatrix()); Engine::Renderer::SubmitMeshWithShader(selectedMesh.mesh, transform.transform.GetTransform() * glm::scale(glm::mat4(1.0f), glm::vec3(1.015f)), outlineShader); glPointSize(10); glPolygonMode(GL_FRONT_AND_BACK, GL_POINT); Engine::Renderer::SubmitMeshWithShader(selectedMesh.mesh, transform.transform.GetTransform() * glm::scale(glm::mat4(1.0f), glm::vec3(1.015f)), outlineShader); glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); glStencilMask(0xff); glStencilFunc(GL_ALWAYS, 1, 0xff); glEnable(GL_DEPTH_TEST); } } m_MainFramebuffer->UnBind(); } void Editor::CompositionRenderPass() { m_FinalFramebuffer->Bind(); auto& shader = Engine::Renderer::GetShader("Composition"); shader->Bind(); shader->SetUniformInt("u_Texture", 0); shader->SetUniformInt("u_TextureSamples", m_MainFramebuffer->samples); shader->SetUniformInt("u_EnableTonemapping", m_EnableTonemapping); shader->SetUniformFloat("u_Exposure", m_Exposure); glBindTextureUnit(0, m_MainFramebuffer->GetColorAttachmentRendererID()); Engine::Renderer::Clear(); Engine::Renderer::SubmitQuad(shader); m_FinalFramebuffer->UnBind(); } Engine::Environment Editor::CreateEnvironment(const std::string& filepath) { Engine::Environment environment; constexpr uint32_t cubemapSize = 1024; constexpr uint32_t irradianceMapSize = 32; SharedPtr<Engine::ComputeShader> EquirectangularToCubemapShader = MakeShared<Engine::ComputeShader>("Assets/Shaders/EquirectangularToCubemap.compute.glsl"); SharedPtr<Engine::TextureCube> environmentTextureCube = MakeShared<Engine::TextureCube>(cubemapSize, cubemapSize); SharedPtr<Engine::Texture> HDRTexture = MakeShared<Engine::Texture>(filepath.c_str()); EquirectangularToCubemapShader->Bind(); HDRTexture->Bind(1); glBindImageTexture(0, environmentTextureCube->GetRendererID(), 0, GL_TRUE, 0, GL_WRITE_ONLY, GL_RGBA32F); ME_INFO("Dispatching compute"); glDispatchCompute(32, 32, 6); glMemoryBarrier(GL_TEXTURE_FETCH_BARRIER_BIT | GL_SHADER_IMAGE_ACCESS_BARRIER_BIT); glGenerateTextureMipmap(environmentTextureCube->GetRendererID()); ME_INFO("Computation finished"); // TODO: Filter environment map and create irradiance map for ibl SharedPtr<Engine::ComputeShader> environmentFilteringShader = MakeShared<Engine::ComputeShader>("Assets/Shaders/EnvironmentFiltering.compute.glsl"); SharedPtr<Engine::TextureCube> filteredEnvironmentTextureCube = MakeShared<Engine::TextureCube>(cubemapSize, cubemapSize); glCopyImageSubData(environmentTextureCube->GetRendererID(), GL_TEXTURE_CUBE_MAP, 0, 0, 0, 0, filteredEnvironmentTextureCube->GetRendererID(), GL_TEXTURE_CUBE_MAP, 0, 0, 0, 0, filteredEnvironmentTextureCube->GetWidth(), filteredEnvironmentTextureCube->GetHeight(), 6); environmentFilteringShader->Bind(); environmentTextureCube->Bind(1); const float deltaRoughness = 1.0f / glm::max(float(filteredEnvironmentTextureCube->GetMipLevelCount()) - 1.0f, 1.0f); for (uint32_t level = 1, size = cubemapSize / 2; level < filteredEnvironmentTextureCube->GetMipLevelCount(); level++, size /= 2) // <= ? { glBindImageTexture(0, filteredEnvironmentTextureCube->GetRendererID(), level, GL_TRUE, 0, GL_WRITE_ONLY, GL_RGBA32F); const GLint roughnessUniformLocation = glGetUniformLocation(environmentFilteringShader->GetRendererID(), "u_Roughness"); ME_ASSERT(roughnessUniformLocation != -1); glUniform1f(roughnessUniformLocation, (float)level * deltaRoughness); const GLuint numGroups = glm::max(1u, size / 32); glDispatchCompute(numGroups, numGroups, 6); glMemoryBarrier(GL_TEXTURE_FETCH_BARRIER_BIT | GL_SHADER_IMAGE_ACCESS_BARRIER_BIT); } SharedPtr<Engine::ComputeShader> envIrradianceShader = MakeShared<Engine::ComputeShader>("Assets/Shaders/EnvironmentIrradiance.compute.glsl"); SharedPtr<Engine::TextureCube> irradianceMap = MakeShared<Engine::TextureCube>(irradianceMapSize, irradianceMapSize); envIrradianceShader->Bind(); filteredEnvironmentTextureCube->Bind(1); glBindImageTexture(0, irradianceMap->GetRendererID(), 0, GL_TRUE, 0, GL_WRITE_ONLY, GL_RGBA32F); glDispatchCompute(irradianceMap->GetWidth() / 32, irradianceMap->GetHeight() / 32, 6); glMemoryBarrier(GL_TEXTURE_FETCH_BARRIER_BIT | GL_SHADER_IMAGE_ACCESS_BARRIER_BIT); glGenerateTextureMipmap(irradianceMap->GetRendererID()); environment.radianceMap = filteredEnvironmentTextureCube; environment.irradianceMap = irradianceMap; environment.brdflutTexture = MakeShared<Engine::Texture>("Assets/Textures/BRDF.tga"); environment.exposure = 1.0f; environment.textureLod = 0.0f; environment.directionalLight.active = true; return environment; } void Editor::BeginDockspace() { ImGuiWindowFlags dockSpaceWindowFlags = ImGuiWindowFlags_MenuBar | ImGuiWindowFlags_NoDocking | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoBringToFrontOnFocus | ImGuiWindowFlags_NoNavFocus; ImGuiViewport* viewport = ImGui::GetMainViewport(); ImGui::SetNextWindowPos(viewport->Pos); ImGui::SetNextWindowSize(viewport->Size); ImGui::SetNextWindowViewport(viewport->ID); ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 0.0f); ImGui::PushStyleVar(ImGuiStyleVar_WindowBorderSize, 0.0f); ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0.0f, 0.0f)); ImGui::Begin("DockSpace", 0, dockSpaceWindowFlags); ImGui::PopStyleVar(3); ImGuiID dockSpaceID = ImGui::GetID("DockSpace"); // Dockspace ImGui::DockSpace(dockSpaceID, ImVec2(0.0f, 0.0f), ImGuiDockNodeFlags_NoCloseButton | ImGuiDockNodeFlags_NoWindowMenuButton); } void Editor::EndDockspace() { ImGui::End(); } void Editor::DrawHierarchy() { ImGui::Begin("Hierarchy"); if (ImGui::BeginPopupContextWindow(0, 1, false)) { if (ImGui::BeginMenu("Create")) { if (ImGui::MenuItem("Entity")) { m_SelectedEntity = m_EditorScene->CreateEntity(); } ImGui::EndMenu(); } ImGui::EndPopup(); } auto view = m_EditorScene->GetRegistry().view<Engine::IDComponent>(); for (auto entity : view) { Engine::Entity currentEntity = Engine::Entity(entity, m_EditorScene.get()); bool isActive = currentEntity.GetEntity() == m_SelectedEntity.GetEntity(); auto& idc = view.get<Engine::IDComponent>(entity); ImGui::PushID((int)currentEntity.GetEntity()); if (ImGui::Selectable(idc.name.c_str(), &isActive)) m_SelectedEntity = currentEntity; ImGui::PopID(); } ImGui::End(); } void Editor::DrawInspector() { ImGui::Begin("Inspector"); if (!m_SelectedEntity) { ImGui::End(); return; } Engine::Entity entity = m_SelectedEntity; // ID Component { auto& idc = entity.Get<Engine::IDComponent>(); char buffer[64]; std::memset(buffer, 0, 64); std::memcpy(buffer, idc.name.c_str(), idc.name.length()); float buttonSize = GImGui->Font->FontSize + GImGui->Style.FramePadding.y * 2.0f; float nameWidth = ImGui::GetContentRegionAvail().x - buttonSize; ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0.0f, 5.0f)); ImGui::SetNextItemWidth(nameWidth); if (ImGui::InputText("##Name", buffer, 64)) idc.name = std::string(buffer); ImGui::SameLine(); if (ImGui::Button("...", ImVec2(buttonSize, buttonSize))) ImGui::OpenPopup("Settings"); ImGui::PopStyleVar(); // Item spacing if (ImGui::BeginPopup("Settings")) { if (ImGui::BeginMenu("Add Component")) { if (ImGui::MenuItem("Transform")) if (!entity.Has<Engine::TransformComponent>()) entity.Add<Engine::TransformComponent>(Engine::TransformComponent{}); if (ImGui::MenuItem("Mesh")) if (!entity.Has<Engine::MeshComponent>()) entity.Add<Engine::MeshComponent>(Engine::MeshComponent{}); if (ImGui::MenuItem("Camera")) if (!entity.Has<Engine::CameraComponent>()) entity.Add<Engine::CameraComponent>(Engine::CameraComponent{}); if (ImGui::MenuItem("Rigid Body 2D")) if (!entity.Has<Engine::Rigidbody2DComponent>()) entity.Add<Engine::Rigidbody2DComponent>(Engine::Rigidbody2DComponent{}); if (ImGui::MenuItem("Box Collider 2D")) if (!entity.Has<Engine::BoxCollider2DComponent>()) entity.Add<Engine::BoxCollider2DComponent>(Engine::BoxCollider2DComponent{}); if (ImGui::MenuItem(" Circle Collider 2D")) if (!entity.Has<Engine::CircleCollider2DComponent>()) entity.Add<Engine::CircleCollider2DComponent>(Engine::CircleCollider2DComponent{}); ImGui::EndMenu(); } if (ImGui::MenuItem("Delete Entity")) { entity.Destroy(); ImGui::EndPopup(); ImGui::End(); return; } ImGui::EndPopup(); } } // Transform Component if (entity.Has<Engine::TransformComponent>()) { auto& transform = entity.Get<Engine::TransformComponent>().transform; auto translation = entity.Get<Engine::TransformComponent>().transform.GetTranslation(); auto rotation = entity.Get<Engine::TransformComponent>().transform.GetRotation(); auto scale = entity.Get<Engine::TransformComponent>().transform.GetScale(); if (ImGui::CollapsingHeader("Transform Settings")) { if (ImGui::IsItemHovered() && ImGui::IsMouseDown(1)) ImGui::OpenPopup("Component Options##Transform"); glm::vec3 rotationDeg = glm::degrees(rotation); ImGui::PushID((int)entity.GetEntity()); if (DrawSliderFloat3(" Translation", 110.0f, translation, 0.0f)) transform.SetTranslation(translation); if (DrawSliderFloat3(" Rotation", 110.0f, rotationDeg, 0.0f)) transform.SetRotation(glm::radians(rotationDeg)); if (DrawSliderFloat3(" Scale", 110.0f, scale, 1.0f)) transform.SetScale(scale); ImGui::PopID(); } else if (ImGui::IsItemHovered() && ImGui::IsMouseDown(1)) ImGui::OpenPopup("Component Options##Transform"); if (ImGui::BeginPopup("Component Options##Transform")) { if (ImGui::MenuItem("Remove Component")) entity.Remove<Engine::TransformComponent>(); ImGui::EndPopup(); } } // Mesh Component if (entity.Has<Engine::MeshComponent>()) { auto& mc = entity.Get<Engine::MeshComponent>(); if (ImGui::CollapsingHeader("Mesh Settings")) { ImGui::TextWrapped("Filepath: %s", mc.mesh->GetFilepath().c_str()); if (ImGui::Button("Load")) { std::string filepath = OpenFileDialog(""); mc.mesh.reset(new Engine::Mesh(filepath)); } static bool showMaterials = false; if (ImGui::Button("Open Material Settings")) showMaterials = true; if (showMaterials && !mc.mesh->GetSubMeshes().empty()) { auto& subMaterials = mc.mesh->GetMaterials(); ImGui::Begin("Materials", &showMaterials, ImGuiWindowFlags_NoDocking); static u32 selected = 0; ImGui::BeginChild("left pane", ImVec2(150, 0), true); for (int i = 0; i < subMaterials.size(); i++) { std::string name = subMaterials[i].GetName(); if (ImGui::Selectable(name.c_str(), i == selected)) selected = i; } ImGui::EndChild(); ImGui::SameLine(); // If the Mesh changed make sure we don't go out of bounds selected = selected >= subMaterials.size() ? 0 : selected; ImGui::BeginChild("Settings"); if (ImGui::BeginTabBar("##Tabs", ImGuiTabBarFlags_None)) { if (ImGui::BeginTabItem("Parameters")) { auto& params = subMaterials[selected].GetParameters(); ImGui::ColorEdit3("Albedo Color", &params.albedo[0]); ImGui::SliderFloat("Metalness", &params.metalness, 0.0f, 1.0f); ImGui::SliderFloat("Roughness", &params.roughness, 0.0f, 1.0f); ImGui::EndTabItem(); } if (ImGui::BeginTabItem("Textures")) { auto& textures = subMaterials[selected].GetTextures(); auto CheckForClickAndSetTexture = [](SharedPtr<Engine::Texture>& texture) { if (ImGui::IsItemClicked()) { std::string filepath = OpenFileDialog(""); if (filepath != "") texture = MakeShared<Engine::Texture>(filepath); } }; // Albedo { ImGui::Text("Albedo Texture"); if (!textures.albedo->IsLoaded()) ImGui::Image(0, ImVec2(64.0f, 64.0f)); else ImGui::Image((ImTextureID)textures.albedo->GetRendererID(), ImVec2(64.0f, 64.0f)); CheckForClickAndSetTexture(textures.albedo); ImGui::Checkbox("Enable##Albedo", &textures.useAlbedo); } // Normal Map { ImGui::Text("Normal Map"); if (!textures.normal->IsLoaded()) ImGui::Image(0, ImVec2(64.0f, 64.0f)); else ImGui::Image((ImTextureID)textures.normal->GetRendererID(), ImVec2(64.0f, 64.0f)); CheckForClickAndSetTexture(textures.normal); ImGui::Checkbox("Enable##Normal", &textures.useNormal); } // Metalness { ImGui::Text("Metalness Texture"); if (!textures.metalness->IsLoaded()) ImGui::Image(0, ImVec2(64.0f, 64.0f)); else ImGui::Image((ImTextureID)textures.metalness->GetRendererID(), ImVec2(64.0f, 64.0f)); CheckForClickAndSetTexture(textures.metalness); ImGui::Checkbox("Enable##Metalness", &textures.useMetalness); } // Roughness { ImGui::Text("Roughness Texture"); if (!textures.roughness->IsLoaded()) ImGui::Image(0, ImVec2(64.0f, 64.0f)); else ImGui::Image((ImTextureID)textures.roughness->GetRendererID(), ImVec2(64.0f, 64.0f)); CheckForClickAndSetTexture(textures.roughness); ImGui::Checkbox("Enable##Roughness", &textures.useRoughness); } ImGui::EndTabItem(); } ImGui::EndTabBar(); } ImGui::EndChild(); ImGui::End(); } } } // Scene Camera if (entity.Has<Engine::CameraComponent>()) { auto& camera = entity.Get<Engine::CameraComponent>().camera; if (ImGui::CollapsingHeader("Camera Settings")) { ImGui::Text("Perspective Camera"); float FOV = camera.GetFOV(); if (ImGui::SliderFloat("FOV", &FOV, 40.0f, 100.0f)) camera.SetFOV(FOV); float nearClip = camera.GetNearClip(); float farClip = camera.GetFarClip(); if (ImGui::SliderFloat("Near Clip", &nearClip, 0.0f, 1000.0f)) camera.SetNearClip(nearClip); if (ImGui::SliderFloat("Far Clip", &farClip, 0.0f, 1000.0f)) camera.SetFarClip(farClip); } } // BoxCollider 2D if (entity.Has<Engine::BoxCollider2DComponent>()) { auto& collider = entity.Get<Engine::BoxCollider2DComponent>(); if (ImGui::CollapsingHeader("Box Collider 2D Settings")) { ImGui::SliderFloat2("Size", &collider.Size[0], 0.0f, 1000.0f); ImGui::SliderFloat2("Offset", &collider.Offset[0], 0.0f, 1000.0f); ImGui::SliderFloat("Density", &collider.Density, 0.0f, 10.0f); ImGui::SliderFloat("Friction", &collider.Friction, 0.0f, 10.0f); ImGui::SliderFloat("Restitution", &collider.Restitution, 0.0f, 10.0f); ImGui::SliderFloat("RestitutionThreshold", &collider.RestitutionThreshold, 0.0f, 10.0f); } } // BoxCollider 2D if (entity.Has<Engine::CircleCollider2DComponent>()) { auto& collider = entity.Get<Engine::CircleCollider2DComponent>(); if (ImGui::CollapsingHeader("Circle Collider 2D Settings")) { ImGui::SliderFloat("Radius", &collider.Radius, 0.0f, 1000.0f); ImGui::SliderFloat2("Offset", &collider.Offset[0], 0.0f, 1000.0f); ImGui::SliderFloat("Density", &collider.Density, 0.0f, 10.0f); ImGui::SliderFloat("Friction", &collider.Friction, 0.0f, 10.0f); ImGui::SliderFloat("Restitution", &collider.Restitution, 0.0f, 10.0f); ImGui::SliderFloat("RestitutionThreshold", &collider.RestitutionThreshold, 0.0f, 10.0f); } } // Rigid Body 2D if (entity.Has<Engine::Rigidbody2DComponent>()) { auto& body = entity.Get<Engine::Rigidbody2DComponent>(); if (ImGui::CollapsingHeader("Rigid Body 2D Settings")) { ImGui::SliderInt("BodyType", (int*)&body.Type, 0, 2); switch (body.Type) { case Engine::Rigidbody2DComponent::BodyType::Static: ImGui::Text("BodyType::Static"); break; case Engine::Rigidbody2DComponent::BodyType::Dynamic: ImGui::Text("BodyType::Dynamic"); break; case Engine::Rigidbody2DComponent::BodyType::Kinematic: ImGui::Text("BodyType::Kinematic"); break; } } } ImGui::End(); } void Editor::DrawDebugInfo() { ImGui::Begin("Debug"); ImGui::Text("Framerate: %.2f FPS", ImGui::GetIO().Framerate); ImGui::Text("Frametime: %.2f ms", 1.0f / ImGui::GetIO().Framerate * 1000.0f); static bool renderLines = false; if (ImGui::Checkbox("Render Lines", &renderLines)) { Engine::Renderer::SetLineThickness(0.1f); Engine::Renderer::RenderLines(renderLines); } ImGui::Text("Multisampled Anti-Aliasing activated"); static int samples = 4; if (ImGui::SliderInt("Samples", &samples, 2, 16)) { // Recreate Framebuffer m_MainFramebuffer->samples = samples; m_MainFramebuffer->Create(); } ImGui::Separator(); ImGui::Checkbox("Tonemapping", &m_EnableTonemapping); ImGui::SliderFloat("Exposure", &m_Exposure, 0.1f, 10.0f); static bool fpscam = false; if (ImGui::Checkbox("FPS Camera", &fpscam)) m_Camera.SetCameraType(fpscam ? Engine::CameraType::FPS : Engine::CameraType::Orbit); if (m_SelectedEntity) { auto name = m_SelectedEntity.Get<Engine::IDComponent>().name; ImGui::Text("Selected entity: %s", name.c_str()); } if (ImGui::Button("Play")) { m_SceneState = SceneState::Playing; if (m_SceneState == SceneState::Pausing) return; m_SelectedEntity = Engine::Entity(); m_ImGuizmoOperation = -1; Engine::Scene::Copy(m_EditorScene, m_RuntimeScene); m_RuntimeScene->SetupPhysicsSimulation(); } if (ImGui::Button("Pause")) { if (m_SceneState == SceneState::Playing) // Can't pause when we are not playing { m_SceneState = SceneState::Pausing; } } if (ImGui::Button("Reset")) { m_SceneState = SceneState::Editing; } ImGui::SliderFloat("Physics Simulation Speed", &m_SimulationSpeed, 0.0f, 2.0f); ImGui::End(); } void Editor::DrawEnvironmentSettings() { auto& env = m_EditorScene->environment; auto& dl = env.directionalLight; ImGui::Begin("Environment"); ImGui::SliderFloat("Exposure", &env.exposure, 0.1f, 10.0f); ImGui::SliderFloat("TextureLod", &env.textureLod, 0.0f, 1.0f); ImGui::Separator(); ImGui::Text("Directional Light"); ImGui::Checkbox("Active", &dl.active); DrawSliderFloat3("Direction", 110.0f, dl.direction, 0.0f); DrawSliderFloat3("Radiance", 110.0f, dl.radiance, 0.0f); ImGui::SliderFloat("Intensity", &dl.intensity, 0.1f, 10.0f); ImGui::End(); } void Editor::UpdateGizmos() { Engine::Entity activeEntity = m_SelectedEntity; if (activeEntity && m_ImGuizmoOperation != -1) { ImGuizmo::SetOrthographic(false); ImGuizmo::SetDrawlist(); ImGuizmo::SetRect(m_ViewportPosition.x, m_ViewportPosition.y, m_ViewportSize.x, m_ViewportSize.y); const glm::mat4 &view = m_Camera.GetViewMatrix(); const glm::mat4 &proj = m_Camera.GetProjectionMatrix(); auto& tc = activeEntity.Get<Engine::TransformComponent>(); glm::mat4 transform = tc.transform.GetTransform(); bool snap = Engine::Input::IsKeyPressed(Engine::Key::LeftControl); float snapValue = m_ImGuizmoOperation == ImGuizmo::OPERATION::ROTATE ? 45.0f : 0.5f; float snapValues[3] = { snapValue, snapValue, snapValue }; ImGuizmo::Manipulate(&view[0][0], &proj[0][0], (ImGuizmo::OPERATION)m_ImGuizmoOperation, ImGuizmo::LOCAL, &transform[0][0], nullptr, snap ? snapValues : nullptr); if (ImGuizmo::IsUsing()) { auto [translation, rotation, scale] = Engine::Math::Decompose(transform); glm::vec3 deltaRotation = rotation - tc.transform.GetRotation(); if (m_ImGuizmoOperation == ImGuizmo::OPERATION::TRANSLATE) tc.transform.SetTranslation(translation); if (m_ImGuizmoOperation == ImGuizmo::OPERATION::ROTATE) tc.transform.Rotate(deltaRotation); if (m_ImGuizmoOperation == ImGuizmo::OPERATION::SCALE) tc.transform.SetScale(scale); } } } bool Editor::DrawSliderFloat3(const std::string &name, float labelWidth, glm::vec3& vector, float resetValue) { bool valuesChanged = false; float regionWidth = ImGui::GetContentRegionAvail().x - labelWidth; float sz = GImGui->Font->FontSize + GImGui->Style.FramePadding.y * 2.0f; ImVec2 buttonSize = { sz, sz }; float sliderSize = regionWidth / 3.0f - buttonSize.x; ImGui::PushID(name.c_str()); ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 2.0f); ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2{ 0.0f, 5.0f }); ImGui::Text(name.c_str()); ImGui::SameLine(labelWidth); ImGui::SetNextItemWidth(sliderSize); if (ImGui::DragFloat("##x", &vector[0], 0.1f, 0.0f, 0.0f, "%.3f")) valuesChanged = true; ImGui::SameLine(); ImGui::PushStyleColor(ImGuiCol_Button, ImVec4{ 0.8f, 0.1f, 0.15f, 1.0f }); ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4{ 0.9f, 0.2f, 0.2f, 1.0f }); ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4{ 0.8f, 0.1f, 0.15f, 1.0f }); if (ImGui::Button("X", buttonSize)) { vector.x = resetValue; valuesChanged = true; } ImGui::PopStyleColor(3); ImGui::SameLine(); ImGui::SetNextItemWidth(sliderSize); if (ImGui::DragFloat("##y", &vector[1], 0.1f, 0.0f, 0.0f, "%.3f")) valuesChanged = true; ImGui::SameLine(); ImGui::PushStyleColor(ImGuiCol_Button, ImVec4{ 0.2f, 0.7f, 0.2f, 1.0f }); ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4{ 0.3f, 0.8f, 0.3f, 1.0f }); ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4{ 0.2f, 0.7f, 0.2f, 1.0f }); if (ImGui::Button("Y", buttonSize)) { vector.y = resetValue; valuesChanged = true; } ImGui::PopStyleColor(3); ImGui::SameLine(); ImGui::SetNextItemWidth(sliderSize); if (ImGui::DragFloat("##z", &vector[2], 0.1f, 0.0f, 0.0f, "%.3f")) valuesChanged = true; ImGui::SameLine(); ImGui::PushStyleColor(ImGuiCol_Button, ImVec4{ 0.1f, 0.25f, 0.8f, 1.0f }); ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4{ 0.2f, 0.35f, 0.9f, 1.0f }); ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4{ 0.1f, 0.25f, 0.8f, 1.0f }); if (ImGui::Button("Z", buttonSize)) { vector.z = resetValue; valuesChanged = true; } ImGui::PopStyleColor(3); ImGui::PopStyleVar(2); // Item Spacing, Frame Rounding ImGui::PopID(); return valuesChanged; }
32.054562
161
0.70324
[ "mesh", "render", "vector", "transform" ]
d4ff596c4e5f6828c3f71e423695903f547d0b2e
9,322
hpp
C++
include/eos/render/detail/render_affine_detail.hpp
srxdev0619/eos-expression-aware-proxy
74de8379be25e8b718059d28e406a9a60e13176b
[ "Apache-2.0" ]
13
2019-08-15T12:16:54.000Z
2022-03-29T02:45:18.000Z
include/eos/render/detail/render_affine_detail.hpp
srxdev0619/eos-expression-aware-proxy
74de8379be25e8b718059d28e406a9a60e13176b
[ "Apache-2.0" ]
2
2019-11-28T05:19:55.000Z
2019-12-17T01:32:50.000Z
include/eos/render/detail/render_affine_detail.hpp
srxdev0619/eos-expression-aware-proxy
74de8379be25e8b718059d28e406a9a60e13176b
[ "Apache-2.0" ]
4
2019-09-03T12:11:12.000Z
2020-12-21T08:36:43.000Z
/* * eos - A 3D Morphable Model fitting library written in modern C++11/14. * * File: include/eos/render/detail/render_affine_detail.hpp * * Copyright 2014, 2015 Patrik Huber * * 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. */ #pragma once #ifndef RENDER_AFFINE_DETAIL_HPP_ #define RENDER_AFFINE_DETAIL_HPP_ #include "eos/core/Image.hpp" #include "eos/render/detail/TriangleToRasterize.hpp" #include "eos/render/detail/render_detail_utils.hpp" #include "glm/vec3.hpp" #include "Eigen/Core" #include "Eigen/Geometry" /** * Implementations of internal functions, not part of the * API we expose and not meant to be used by a user. * * This file contains things specific to the affine rendering. */ namespace eos { namespace render { namespace detail { /** * Takes a 3x4 affine camera matrix estimated with fitting::estimate_affine_camera * and computes the cross product of the first two rows to create a third axis that * is orthogonal to the first two. * This allows us to produce z values and figure out correct depth ordering in the * rendering and for texture extraction. * * @param[in] affine_camera_matrix A 3x4 affine camera matrix. * @return The matrix with a third row inserted. */ inline Eigen::Matrix<float, 4, 4> calculate_affine_z_direction(Eigen::Matrix<float, 3, 4> affine_camera_matrix) { // Take the cross product of row 0 with row 1 to get the direction perpendicular to the viewing plane (= // the viewing direction). Todo: We should check if we look/project into the right direction - the sign // could be wrong? Eigen::Vector4f affine_cam_z_rotation = affine_camera_matrix.row(0).transpose().cross3(affine_camera_matrix.row(1).transpose()); affine_cam_z_rotation .normalize(); // The 4th component is zero, so it does not influence the normalisation. // The 4x4 affine camera matrix Eigen::Matrix<float, 4, 4> affine_cam_4x4 = Eigen::Matrix<float, 4, 4>::Zero(); // Copy the first 2 rows from the input matrix affine_cam_4x4.block<2, 4>(0, 0) = affine_camera_matrix.block<2, 4>(0, 0); // Replace the third row with the camera-direction (z) affine_cam_4x4.block<1, 3>(2, 0) = affine_cam_z_rotation.head<3>().transpose(); // Set first 3 components. 4th component stays 0. // The 4th row is (0, 0, 0, 1): affine_cam_4x4(3, 3) = 1.0f; return affine_cam_4x4; }; /** * Rasters a triangle into the given colour and depth buffer. * * In essence, loop through the pixels inside the triangle's bounding * box, calculate the barycentric coordinates, and if inside the triangle * and the z-test is passed, then draw the point using the barycentric * coordinates for colour interpolation. * Does not do perspective-correct weighting, and therefore only works * with the affine rendering pipeline. * * No texturing at the moment. * * Note/Todo: See where and how this is used, and how similar it is to * the "normal" raster_triangle. Maybe rename to raster_triangle_vertexcolour? * * @param[in] triangle A triangle. * @param[in] colourbuffer The colour buffer to draw into. * @param[in] depthbuffer The depth buffer to draw into and use for the depth test. */ // CZ: change of function interface inline void raster_triangle_affine(TriangleToRasterize triangle, core::Image4u& colourbuffer, core::Image1d& depthbuffer, std::vector<Eigen::Vector4f>* tri_vertices_coords_3d_before_projection = 0, core::Image3d* coordsbuffer = 0, core::Image2d* texcoordsbuffer = 0) { for (int yi = triangle.min_y; yi <= triangle.max_y; ++yi) { for (int xi = triangle.min_x; xi <= triangle.max_x; ++xi) { // we want centers of pixels to be used in computations. Todo: Do we? const float x = static_cast<float>(xi) + 0.5f; const float y = static_cast<float>(yi) + 0.5f; // these will be used for barycentric weights computation const double one_over_v0ToLine12 = 1.0 / implicit_line(triangle.v0.position[0], triangle.v0.position[1], triangle.v1.position, triangle.v2.position); const double one_over_v1ToLine20 = 1.0 / implicit_line(triangle.v1.position[0], triangle.v1.position[1], triangle.v2.position, triangle.v0.position); const double one_over_v2ToLine01 = 1.0 / implicit_line(triangle.v2.position[0], triangle.v2.position[1], triangle.v0.position, triangle.v1.position); // affine barycentric weights const double alpha = implicit_line(x, y, triangle.v1.position, triangle.v2.position) * one_over_v0ToLine12; const double beta = implicit_line(x, y, triangle.v2.position, triangle.v0.position) * one_over_v1ToLine20; const double gamma = implicit_line(x, y, triangle.v0.position, triangle.v1.position) * one_over_v2ToLine01; // if pixel (x, y) is inside the triangle or on one of its edges if (alpha >= 0 && beta >= 0 && gamma >= 0) { const int pixel_index_row = yi; const int pixel_index_col = xi; const double z_affine = alpha * static_cast<double>(triangle.v0.position[2]) + beta * static_cast<double>(triangle.v1.position[2]) + gamma * static_cast<double>(triangle.v2.position[2]); if (z_affine < depthbuffer(pixel_index_row, pixel_index_col)) { // attributes interpolation // pixel_color is in RGB, v.color are RGB glm::tvec3<float> pixel_color = static_cast<float>(alpha) * triangle.v0.color + static_cast<float>(beta) * triangle.v1.color + static_cast<float>(gamma) * triangle.v2.color; // clamp bytes to 255 const unsigned char red = static_cast<unsigned char>( 255.0f * std::min(pixel_color[0], 1.0f)); // Todo: Proper casting (rounding?) const unsigned char green = static_cast<unsigned char>(255.0f * std::min(pixel_color[1], 1.0f)); const unsigned char blue = static_cast<unsigned char>(255.0f * std::min(pixel_color[2], 1.0f)); // update buffers colourbuffer(pixel_index_row, pixel_index_col)[0] = blue; colourbuffer(pixel_index_row, pixel_index_col)[1] = green; colourbuffer(pixel_index_row, pixel_index_col)[2] = red; colourbuffer(pixel_index_row, pixel_index_col)[3] = 255; // alpha channel depthbuffer(pixel_index_row, pixel_index_col) = z_affine; // CZ: update coordsbuffer if (tri_vertices_coords_3d_before_projection != 0 && coordsbuffer != 0) { (*coordsbuffer)(pixel_index_row, pixel_index_col)[0] = alpha * static_cast<double>((*tri_vertices_coords_3d_before_projection)[0](0)) + beta * static_cast<double>((*tri_vertices_coords_3d_before_projection)[1](0)) + gamma * static_cast<double>((*tri_vertices_coords_3d_before_projection)[2](0)); (*coordsbuffer)(pixel_index_row, pixel_index_col)[1] = alpha * static_cast<double>((*tri_vertices_coords_3d_before_projection)[0](1)) + beta * static_cast<double>((*tri_vertices_coords_3d_before_projection)[1](1)) + gamma * static_cast<double>((*tri_vertices_coords_3d_before_projection)[2](1)); (*coordsbuffer)(pixel_index_row, pixel_index_col)[2] = alpha * static_cast<double>((*tri_vertices_coords_3d_before_projection)[0](2)) + beta * static_cast<double>((*tri_vertices_coords_3d_before_projection)[1](2)) + gamma * static_cast<double>((*tri_vertices_coords_3d_before_projection)[2](2)); } // CZ: update texcoordsbuffer if (texcoordsbuffer != 0) { (*texcoordsbuffer)(pixel_index_row, pixel_index_col)[0] = alpha * static_cast<double>(triangle.v0.texcoords[0]) + beta * static_cast<double>(triangle.v1.texcoords[0]) + gamma * static_cast<double>(triangle.v2.texcoords[0]); (*texcoordsbuffer)(pixel_index_row, pixel_index_col)[1] = alpha * static_cast<double>(triangle.v0.texcoords[1]) + beta * static_cast<double>(triangle.v1.texcoords[1]) + gamma * static_cast<double>(triangle.v2.texcoords[1]); } } } } } }; } /* namespace detail */ } /* namespace render */ } /* namespace eos */ #endif /* RENDER_AFFINE_DETAIL_HPP_ */
48.806283
301
0.650826
[ "geometry", "render", "vector", "model", "3d" ]
d4ffced7f69dba9d9783a5fb68362b3e109d434b
38,925
cpp
C++
demo_lib_sift.cpp
Jorann/CTImageComp
51356597d9481eca28b99fcaa09ea102dd510257
[ "BSD-2-Clause" ]
1
2017-08-23T19:04:50.000Z
2017-08-23T19:04:50.000Z
demo_lib_sift.cpp
Jorann/CTImageComp
51356597d9481eca28b99fcaa09ea102dd510257
[ "BSD-2-Clause" ]
null
null
null
demo_lib_sift.cpp
Jorann/CTImageComp
51356597d9481eca28b99fcaa09ea102dd510257
[ "BSD-2-Clause" ]
7
2016-04-22T01:36:27.000Z
2022-03-12T06:22:12.000Z
// Authors: Unknown. Please, if you are the author of this file, or if you // know who are the authors of this file, let us know, so we can give the // adequate credits and/or get the adequate authorizations. // WARNING: // This file implements an algorithm possibly linked to the patent // // David Lowe "Method and apparatus for identifying scale invariant // features in an image and use of same for locating an object in an // image", U.S. Patent 6,711,293. // // This file is made available for the exclusive aim of serving as // scientific tool to verify of the soundness and // completeness of the algorithm description. Compilation, // execution and redistribution of this file may violate exclusive // patents rights in certain countries. // The situation being different for every country and changing // over time, it is your responsibility to determine which patent // rights restrictions apply to you before you compile, use, // modify, or redistribute this file. A patent lawyer is qualified // to make this determination. // If and only if they don't conflict with any patent terms, you // can benefit from the following license terms attached to this // file. // // This program is provided for scientific and educational only: // you can use and/or modify it for these purposes, but you are // not allowed to redistribute this work or derivative works in // source or executable form. A license must be obtained from the // patent right holders for any other use. #include "demo_lib_sift.h" #define DEBUG 0 #define ABS(x) (((x) > 0) ? (x) : (-(x))) void default_sift_parameters(siftPar &par) { par.OctaveMax=100000; par.DoubleImSize = 0; par.order = 3; par.InitSigma = 1.6; par.BorderDist = 5; par.Scales = 3; par.PeakThresh = 255.0 * 0.04 / 3.0; par.EdgeThresh = 0.06; par.EdgeThresh1 = 0.08; par.OriBins = 36; par.OriSigma = 1.5; par.OriHistThresh = 0.8; par.MaxIndexVal = 0.2; par.MagFactor = 3; par.IndexSigma = 1.0; par.IgnoreGradSign = 0; // par.MatchRatio = 0.6; // par.MatchRatio = 0.75; // Guoshen Yu. Since l1 distance is used for matching instead of l2, a larger threshold is needed. par.MatchRatio = 0.73; // Guoshen Yu. Since l1 distance is used for matching instead of l2, a larger threshold is needed. par.MatchXradius = 1000000.0f; par.MatchYradius = 1000000.0f; par.noncorrectlylocalized = 0; }; ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// SIFT Keypoint detection ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// void OctaveKeypoints(flimage & image, float octSize, keypointslist& keys,siftPar &par); void FindMaxMin( flimage* dogs, flimage* blur, float octSize ,keypointslist& keys,siftPar &par); bool LocalMax(float val, flimage& dog, int y0, int x0); bool LocalMin(float val, flimage& dog, int y0, int x0); bool LocalMaxMin(float val, const flimage& dog, int y0, int x0); int NotOnEdge( flimage& dog, int r, int c, float octSize,siftPar &par); float FitQuadratic(float offset[3], flimage* dogs, int s, int r, int c); void InterpKeyPoint( flimage* dogs, int s, int r, int c, const flimage& grad, const flimage& ori, flimage& map, float octSize, keypointslist& keys, int movesRemain,siftPar &par); void AssignOriHist( const flimage& grad, const flimage& ori, float octSize, float octScale, float octRow, float octCol, keypointslist& keys,siftPar &par); void SmoothHistogram( float* hist, int bins); float InterpPeak( float a, float b, float c); void MakeKeypoint( const flimage& grad, const flimage& ori, float octSize, float octScale, float octRow, float octCol, float angle, keypointslist& keys,siftPar &par); void MakeKeypointSample( keypoint& key, const flimage& grad, const flimage& ori, float scale, float row, float col,siftPar &par); void NormalizeVec( float* vec); void KeySampleVec( keypoint& key, const flimage& grad, const flimage& ori, float scale, float row, float col,siftPar &par); void KeySample( float index[IndexSize][IndexSize][OriSize], keypoint& key, const flimage& grad, const flimage& ori, float scale, float row, float col,siftPar &par); void AddSample( float index[IndexSize][IndexSize][OriSize], keypoint& key, const flimage& grad, const flimage& orim, float r, float c, float rpos, float cpos, float rx, float cx,siftPar &par); void PlaceInIndex( float index[IndexSize][IndexSize][OriSize], float mag, float ori, float rx, float cx,siftPar &par); void compute_sift_keypoints(float *input, keypointslist& keypoints, int width, int height, siftPar &par) { flimage image; /// Make zoom of image if necessary float octSize = 1.0; if (par.DoubleImSize){ //printf("... compute_sift_keypoints :: applying zoom\n"); // image.create(2*width, 2*height); // apply_zoom(input,image.getPlane(),2.0,par.order,width,height); // octSize *= 0.5; printf("Doulbe image size not allowed. Guoshen Yu\n"); exit(-1); } else { image.create(width,height,input); } // printf("Using initial Dog value: %f\n", par.PeakThresh); // printf("Double image size: %d\n", par.DoubleImSize); // printf("Interpolation order: %d\n", par.order); /// Apply initial smoothing to input image to raise its smoothing to par.InitSigma. /// We assume image from camera has smoothing of sigma = 0.5, which becomes sigma = 1.0 if image has been doubled. /// increase = sqrt(Init^2 - Current^2) float curSigma; if (par.DoubleImSize) curSigma = 1.0; else curSigma = 0.5; if (par.InitSigma > curSigma ) { if (DEBUG) printf("Convolving initial image to achieve std: %f \n", par.InitSigma); float sigma = (float) sqrt((double)(par.InitSigma * par.InitSigma - curSigma * curSigma)); gaussian_convolution( image.getPlane(), image.getPlane(), image.nwidth(), image.nheight(), sigma); } /// Convolve by par.InitSigma at each step inside OctaveKeypoints by steps of /// Subsample of factor 2 while reasonable image size /// Keep reducing image by factors of 2 until one dimension is /// smaller than minimum size at which a feature could be detected. int minsize = 2 * par.BorderDist + 2; int OctaveCounter = 0; //printf("... compute_sift_keypoints :: maximum number of scales : %d\n", par.OctaveMax); while (image.nwidth() > minsize && image.nheight() > minsize && OctaveCounter < par.OctaveMax) { if (DEBUG) printf("Calling OctaveKeypoints \n"); OctaveKeypoints(image, octSize, keypoints,par); // image is blurred inside OctaveKeypoints and therefore can be sampled flimage aux( (int)((float) image.nwidth() / 2.0f) , (int)((float) image.nheight() / 2.0f)); if (DEBUG) printf("Sampling initial image \n"); sample(image.getPlane(), aux.getPlane(), 2.0f, image.nwidth(), image.nheight()); image = aux; octSize *= 2.0; OctaveCounter++; } /* printf("sift:: %d keypoints\n", keypoints.size()); printf("sift:: plus non correctly localized: %d \n", par.noncorrectlylocalized);*/ } ///////////////////////////////////////////////// /// EXTREMA DETECTION IN ONE SCALE-SPACE OCTAVE: ///////////////////////////////////////////////// /// par.Scales determine how many steps we perform to pass from one scale to the next one: sigI --> 2*sigI /// At each step we pass from sigma_0 --> sigma0 * (1 + R) /// At the last step sigI * (1 + R)^par.Scales = 2 * sigI /// (1+R) = 2 ^(1 / par.Scales) it is called sigmaRatio /// It seems that blur[par.Scales+1] is compared in two succesive iterations void OctaveKeypoints(flimage & image, float octSize, keypointslist& keys,siftPar &par) { // Guoshen Yu, 2010.09.21, Windows version // flimage blur[par.Scales+3], dogs[par.Scales+2]; int size_blur = par.Scales+3; int size_dogs = par.Scales+2; flimage *blur = new flimage[size_blur]; flimage *dogs = new flimage[size_dogs]; float sigmaRatio = (float) pow(2.0, 1.0 / (double) par.Scales); /* Build array, blur, holding par.Scales+3 blurred versions of the image. */ blur[0] = flimage(image); /* First level is input to this routine. */ float prevSigma = par.InitSigma; /* Input image has par.InitSigma smoothing. */ /* Form each level by adding incremental blur from previous level. Increase in blur is from prevSigma to prevSigma * sigmaRatio, so increase^2 = (prevSigma * sigmaRatio)^2 - prevSigma^2 */ for (int i = 1; i < par.Scales + 3; i++) { if (DEBUG) printf("Convolving scale: %d \n", i); blur[i] = flimage(blur[i-1]); float increase = prevSigma*(float)sqrt((double)(sigmaRatio*sigmaRatio-1.0)); gaussian_convolution( blur[i].getPlane(), blur[i].getPlane(), blur[i].nwidth(), blur[i].nheight(), increase); prevSigma *= sigmaRatio; } /* Compute an array, dogs, of difference-of-Gaussian images by subtracting each image from its next blurred version. */ for (int i = 0; i < par.Scales + 2; i++) { dogs[i] = flimage(blur[i]); /// dogs[i] = dogs[i] - blur[i+1] combine(dogs[i].getPlane(),1.0f, blur[i+1].getPlane(),-1.0f, dogs[i].getPlane(), dogs[i].nwidth() * dogs[i].nheight()); } // Image with exact blur to be subsampled is blur[scales] image = blur[par.Scales]; /* Scale-space extrema detection in this octave */ if (DEBUG) printf("Looking for local maxima \n"); FindMaxMin(dogs, blur, octSize, keys,par); // Guoshen Yu, 2010.09.22, Windows version delete [] blur; delete [] dogs; } ///////////////////////////////////////////////// ///Find the local maxima and minima of the DOG images in scale space. Return the keypoints for these locations. ///////////////////////////////////////////////// /// For each point at each scale we decide if it is a local maxima: /// - |dogs(x,y,s)| > 0.8 * par.PeakThresh /// - Local maximum or minimum in s-1,s,s+1 /// - NotonEdge: ratio of the two principle curvatures of the DOG function at this point be below a threshold. /// blur[par.Scales+1] is not used in order to look for extrema /// while these could be computed using avalaible blur and dogs void FindMaxMin( flimage* dogs, flimage* blur, float octSize, keypointslist& keys,siftPar &par) { int width = dogs[0].nwidth(), height = dogs[0].nheight(); /* Create an image map in which locations that have a keypoint are marked with value 1.0, to prevent two keypoints being located at same position. This may seem an inefficient data structure, but does not add significant overhead. */ flimage map(width,height,0.0f); flimage grad(width,height,0.0f); flimage ori(width,height,0.0f); /* Search through each scale, leaving 1 scale below and 1 above. There are par.Scales+2 dog images. */ for (int s = 1; s < par.Scales+1; s++) { if (DEBUG) printf("************************scale: %d\n", s); //getchar(); /* For each intermediate image, compute gradient and orientation images to be used for keypoint description. */ compute_gradient_orientation(blur[s].getPlane(), grad.getPlane(), ori.getPlane(), blur[s].nwidth(), blur[s].nheight()); /* Only find peaks at least par.BorderDist samples from image border, as peaks centered close to the border will lack stability. */ assert(par.BorderDist >= 2); float val; int partialcounter = 0; for (int r = par.BorderDist; r < height - par.BorderDist; r++) for (int c = par.BorderDist; c < width - par.BorderDist; c++) { /* Pixel value at (c,r) position. */ val = dogs[s](c,r); /* DOG magnitude must be above 0.8 * par.PeakThresh threshold (precise threshold check will be done once peak interpolation is performed). Then check whether this point is a peak in 3x3 region at each level, and is not on an elongated edge. */ if (fabs(val) > 0.8 * par.PeakThresh) { /* // If local maxima if (LocalMax(val, dogs[s-1], r, c,par) && LocalMax(val, dogs[s], r, c, par) && LocalMax(val, dogs[s+1], r, c,par) && NotOnEdge(dogs[s], r, c, octSize,par)) { if (DEBUG) printf("Maximum Keypoint found (%d,%d,%d) val: %f\n",s,r,c,val); InterpKeyPoint( dogs, s, r, c, grad, ori, map, octSize, keys, 5,par); } else if (LocalMin(val, dogs[s-1], r, c,par) && LocalMin(val, dogs[s], r, c,par) && LocalMin(val, dogs[s+1], r, c,par) && NotOnEdge(dogs[s], r, c, octSize,par)) { if (DEBUG) printf("Minimum Keypoint found (%d,%d,%d) val: %f\n",s,r,c,val); InterpKeyPoint( dogs, s, r, c, grad, ori, map, octSize, keys, 5,par); } */ if (LocalMaxMin(val, dogs[s-1], r, c) && LocalMaxMin(val, dogs[s], r, c) && LocalMaxMin(val, dogs[s+1], r, c) && NotOnEdge(dogs[s], r, c, octSize,par)) { partialcounter++; if (DEBUG) printf("%d: (%d,%d,%d) val: %f\n",partialcounter, s,r,c,val); InterpKeyPoint( dogs, s, r, c, grad, ori, map, octSize, keys, 5,par); //getchar(); } } } } } //bool LocalMax(float val, flimage& dog, int y0, int x0, siftPar &par) bool LocalMax(float val, flimage& dog, int y0, int x0) { for (int x = x0 - 1; x <= x0 + 1; x++) for (int y = y0 - 1; y <= y0 + 1; y++){ //printf("%f \t", dog(x,y)); if (dog(x,y) > val) return 0; } return 1; } bool LocalMin(float val, flimage& dog, int y0, int x0) { for (int x = x0 - 1; x <= x0 + 1; x++) for (int y = y0 - 1; y <= y0 + 1; y++){ //printf("%f \t", dog(x,y)); if (dog(x,y) < val) return 0; } return 1; } /* Return TRUE iff val is a local maximum (positive value) or minimum (negative value) compared to the 3x3 neighbourhood that is centered at (row,col). */ bool LocalMaxMin(float val, const flimage& dog, int y0, int x0) { // For efficiency, use separate cases for maxima or minima, and // return as soon as possible if (val > 0.0) { for (int x = x0 - 1; x <= x0 + 1; x++) for (int y = y0 - 1; y <= y0 + 1; y++){ if (dog(x,y) > val) return false; } } else { for (int x = x0 - 1; x <= x0 + 1; x++) for (int y = y0 - 1; y <= y0 + 1; y++){ if (dog(x,y) < val) return false; } } return true; } /* Returns FALSE if this point on the DOG function lies on an edge. This test is done early because it is very efficient and eliminates many points. It requires that the ratio of the two principle curvatures of the DOG function at this point be below a threshold. Edge threshold is higher on the first scale where SNR is small in order to reduce the number of unstable keypoints. */ int NotOnEdge(flimage& dog, int r, int c, float octSize,siftPar &par) { /* Compute 2x2 Hessian values from pixel differences. */ float H00 = dog(c,r-1) - 2.0 * dog(c,r) + dog(c,r+1), /* AMIR: div by ? */ H11 = dog(c-1,r) - 2.0 * dog(c,r) + dog(c+1,r), H01 = ( (dog(c+1,r+1) - dog(c-1,r+1)) - (dog(c+1,r-1) - dog(c-1,r-1)) ) / 4.0; /* Compute determinant and trace of the Hessian. */ float det = H00 * H11 - H01 * H01, /// Det H = \prod l_i trace = H00 + H11; /// tr H = \sum l_i /// As we do not desire edges but only corners we demand l_max / l_min less than a threshold /// In practice if A = k B, A*B = k B^2 /// (A + B)^2 = (k+1)^2 * B^2 /// k B^2 > t * (k+1)^2 * B^2 sii k / (k+1)^2 > t /// This is a decreasing function for k > 1 and value 0.3 at k=1. /// Setting t = 0.08, means k<=10 /* To detect an edge response, we require the ratio of smallest to largest principle curvatures of the DOG function (eigenvalues of the Hessian) to be below a threshold. For efficiency, we use Harris' idea of requiring the determinant to be above par.EdgeThresh times the squared trace, as for eigenvalues A and B, det = AB, trace = A+B. So if A = 10B, then det = 10B**2, and trace**2 = (11B)**2 = 121B**2, so par.EdgeThresh = 10/121 = 0.08 to require ratio of eigenvalues less than 10. */ if (octSize <= 1) return (det > par.EdgeThresh1 * trace * trace); else return (det > par.EdgeThresh * trace * trace); } /* Create a keypoint at a peak near scale space location (s,r,c), where s is scale (index of DOGs image), and (r,c) is (row, col) location. Add to the list of keys with any new keys added. */ void InterpKeyPoint( flimage* dogs, int s, int r, int c, const flimage& grad, const flimage& ori, flimage& map, float octSize, keypointslist& keys, int movesRemain,siftPar &par) { /* Fit quadratic to determine offset and peak value. */ float offset[3]; float peakval = FitQuadratic(offset, dogs, s, r, c); if (DEBUG) printf("peakval: %f, of[0]: %f of[1]: %f of[2]: %f\n", peakval, offset[0], offset[1], offset[2]); /* Move to an adjacent (row,col) location if quadratic interpolation is larger than 0.6 units in some direction (we use 0.6 instead of 0.5 to avoid jumping back and forth near boundary). We do not perform move to adjacent scales, as it is seldom useful and we do not have easy access to adjacent scale structures. The movesRemain counter allows only a fixed number of moves to prevent possibility of infinite loops. */ int newr = r, newc = c; if (offset[1] > 0.6 && r < dogs[0].nheight() - 3) newr++; else if (offset[1] < -0.6 && r > 3) newr--; if (offset[2] > 0.6 && c < dogs[0].nwidth() - 3) newc++; else if (offset[2] < -0.6 && c > 3) newc--; if (movesRemain > 0 && (newr != r || newc != c)) { InterpKeyPoint( dogs, s, newr, newc, grad, ori, map, octSize, keys,movesRemain - 1,par); return; } /* Do not create a keypoint if interpolation still remains far outside expected limits, or if magnitude of peak value is below threshold (i.e., contrast is too low). */ if ( fabs(offset[0]) > 1.5 || fabs(offset[1]) > 1.5 || fabs(offset[2]) > 1.5 || fabs(peakval) < par.PeakThresh) { if (DEBUG) printf("Point not well localized by FitQuadratic\n"); par.noncorrectlylocalized++; return; } /* Check that no keypoint has been created at this location (to avoid duplicates). Otherwise, mark this map location. */ if (map(c,r) > 0.0) return; map(c,r) = 1.0; /* The scale relative to this octave is given by octScale. The scale units are in terms of sigma for the smallest of the Gaussians in the DOG used to identify that scale. */ // Guoshen Yu, 2010.09.21 Windows version // float octScale = par.InitSigma * pow(2.0, (s + offset[0]) / (float) par.Scales); float octScale = par.InitSigma * pow(2.0, (s + offset[0]) / (double) par.Scales); /// always use histogram of orientations //if (UseHistogramOri) AssignOriHist( grad, ori, octSize, octScale, r + offset[1], c + offset[2], keys, par); //else // AssignOriAvg( // grad, ori, octSize, octScale, // r + offset[1], c + offset[2], keys); } /* Apply the method developed by Matthew Brown (see BMVC 02 paper) to fit a 3D quadratic function through the DOG function values around the location (s,r,c), i.e., (scale,row,col), at which a peak has been detected. Return the interpolated peak position as a vector in "offset", which gives offset from position (s,r,c). The returned value is the interpolated DOG magnitude at this peak. */ float FitQuadratic(float offset[3], flimage* dogs, int s, int r, int c) { float g[3]; flimage *dog0, *dog1, *dog2; int i; //s = 1; r = 128; c = 128; float ** H = allocate_float_matrix(3, 3); /* Select the dog images at peak scale, dog1, as well as the scale below, dog0, and scale above, dog2. */ dog0 = &dogs[s-1]; dog1 = &dogs[s]; dog2 = &dogs[s+1]; /* Fill in the values of the gradient from pixel differences. */ g[0] = ((*dog2)(c,r) - (*dog0)(c,r)) / 2.0; g[1] = ((*dog1)(c,r+1) - (*dog1)(c,r-1)) / 2.0; g[2] = ((*dog1)(c+1,r) - (*dog1)(c-1,r)) / 2.0; /* Fill in the values of the Hessian from pixel differences. */ H[0][0] = (*dog0)(c,r) - 2.0 * (*dog1)(c,r) + (*dog2)(c,r); H[1][1] = (*dog1)(c,r-1) - 2.0 * (*dog1)(c,r) + (*dog1)(c,r+1); H[2][2] = (*dog1)(c-1,r) - 2.0 * (*dog1)(c,r) + (*dog1)(c+1,r); H[0][1] = H[1][0] = ( ((*dog2)(c,r+1) - (*dog2)(c,r-1)) - ((*dog0)(c,r+1) - (*dog0)(c,r-1)) ) / 4.0; H[0][2] = H[2][0] = ( ((*dog2)(c+1,r) - (*dog2)(c-1,r)) - ((*dog0)(c+1,r) - (*dog0)(c-1,r)) ) / 4.0; H[1][2] = H[2][1] = ( ((*dog1)(c+1,r+1) - (*dog1)(c-1,r+1)) - ((*dog1)(c+1,r-1) - (*dog1)(c-1,r-1)) ) / 4.0; /* Solve the 3x3 linear sytem, Hx = -g. Result, x, gives peak offset. Note that SolveLinearSystem destroys contents of H. */ offset[0] = - g[0]; offset[1] = - g[1]; offset[2] = - g[2]; // for(i=0; i < 3; i++){ // // for(j=0; j < 3; j++) printf("%f ", H[i][j]); // printf("\n"); // } // printf("\n"); // // for(i=0; i < 3; i++) printf("%f ", offset[i]); // printf("\n"); float solution[3]; lusolve(H, solution, offset,3); // printf("\n"); // for(i=0; i < 3; i++) printf("%f ", solution[i]); // printf("\n"); desallocate_float_matrix(H,3,3); delete[] H; /*memcheck*/ /* Also return value of DOG at peak location using initial value plus 0.5 times linear interpolation with gradient to peak position (this is correct for a quadratic approximation). */ for(i=0; i < 3; i++) offset[i] = solution[i]; return ((*dog1)(c,r) + 0.5 * (solution[0]*g[0]+solution[1]*g[1]+solution[2]*g[2])); } /// - Compute histogram of orientation in a neighborhood weighted by gradient and distance to center /// - Look for local (3-neighborhood) maximum with valuer larger or equal than par.OriHistThresh * maxval /* Assign an orientation to this keypoint. This is done by creating a Gaussian weighted histogram of the gradient directions in the region. The histogram is smoothed and the largest peak selected. The results are in the range of -PI to PI. */ void AssignOriHist( const flimage& grad, const flimage& ori, float octSize, float octScale, float octRow, float octCol,keypointslist& keys,siftPar &par) { int bin, prev, next; // Guoshen Yu, 2010.09.21 Windows version // float hist[par.OriBins], distsq, dif, gval, weight, angle, interp; float distsq, dif, gval, weight, angle, interp; int tmp_size = par.OriBins; float *hist = new float[tmp_size]; float radius2, sigma2; int row = (int) (octRow+0.5), col = (int) (octCol+0.5), rows = grad.nheight(), cols = grad.nwidth(); for (int i = 0; i < par.OriBins; i++) hist[i] = 0.0; /* Look at pixels within 3 sigma around the point and sum their Gaussian weighted gradient magnitudes into the histogram. */ float sigma = par.OriSigma * octScale; int radius = (int) (sigma * 3.0); int rmin = MAX(0,row-radius); int cmin = MAX(0,col-radius); int rmax = MIN(row+radius,rows-2); int cmax = MIN(col+radius,cols-2); radius2 = (float)(radius * radius); sigma2 = 2.0*sigma*sigma; for (int r = rmin; r <= rmax; r++) { for (int c = cmin; c <= cmax; c++) { gval = grad(c,r); dif = (r - octRow); distsq = dif*dif; dif = (c - octCol); distsq += dif*dif; if (gval > 0.0 && distsq < radius2 + 0.5) { weight = exp(- distsq / sigma2); /* Ori is in range of -PI to PI. */ angle = ori(c,r); bin = (int) (par.OriBins * (angle + PI + 0.001) / (2.0 * PI)); assert(bin >= 0 && bin <= par.OriBins); bin = MIN(bin, par.OriBins - 1); hist[bin] += weight * gval; } } } /* Apply smoothing 6 times for accurate Gaussian approximation. */ for (int i = 0; i < 6; i++) SmoothHistogram(hist, par.OriBins); /* Find maximum value in histogram. */ float maxval = 0.0; for (int i = 0; i < par.OriBins; i++) if (hist[i] > maxval) maxval = hist[i]; /* Look for each local peak in histogram. If value is within par.OriHistThresh of maximum value, then generate a keypoint. */ for (int i = 0; i < par.OriBins; i++) { prev = (i == 0 ? par.OriBins - 1 : i - 1); next = (i == par.OriBins - 1 ? 0 : i + 1); if ( hist[i] > hist[prev] && hist[i] > hist[next] && hist[i] >= par.OriHistThresh * maxval ) { /* Use parabolic fit to interpolate peak location from 3 samples. Set angle in range -PI to PI. */ interp = InterpPeak(hist[prev], hist[i], hist[next]); angle = 2.0 * PI * (i + 0.5 + interp) / par.OriBins - PI; assert(angle >= -PI && angle <= PI); if (DEBUG) printf("angle selected: %f \t location: (%f,%f)\n", angle, octRow, octCol); ; /* Create a keypoint with this orientation. */ MakeKeypoint( grad, ori, octSize, octScale, octRow, octCol, angle, keys,par); } } // Guoshen Yu, 2010.09.22, Windows version delete [] hist; } /* Smooth a histogram by using a [1/3 1/3 1/3] kernel. Assume the histogram is connected in a circular buffer. */ void SmoothHistogram(float* hist, int bins) { float prev, temp; prev = hist[bins - 1]; for (int i = 0; i < bins; i++) { temp = hist[i]; hist[i] = ( prev + hist[i] + hist[(i + 1 == bins) ? 0 : i + 1] ) / 3.0; prev = temp; } } /* Return a number in the range [-0.5, 0.5] that represents the location of the peak of a parabola passing through the 3 evenly spaced samples. The center value is assumed to be greater than or equal to the other values if positive, or less than if negative. */ float InterpPeak(float a, float b, float c) { if (b < 0.0) { a = -a; b = -b; c = -c; } assert(b >= a && b >= c); return 0.5 * (a - c) / (a - 2.0 * b + c); } /* Joan Pau: Add a new keypoint to a vector of keypoints Create a new keypoint and return list of keypoints with new one added. */ void MakeKeypoint( const flimage& grad, const flimage& ori, float octSize, float octScale, float octRow, float octCol, float angle, keypointslist& keys,siftPar &par) { keypoint newkeypoint; newkeypoint.x = octSize * octCol; /*x coordinate */ newkeypoint.y = octSize * octRow; /*y coordinate */ newkeypoint.scale = octSize * octScale; /* scale */ newkeypoint.angle = angle; /* orientation */ MakeKeypointSample(newkeypoint,grad,ori,octScale,octRow,octCol,par); keys.push_back(newkeypoint); } /* Use the parameters of this keypoint to sample the gradient images at a set of locations within a circular region around the keypoint. The (scale,row,col) values are relative to current octave sampling. The resulting vector is stored in the key. */ void MakeKeypointSample( keypoint& key, const flimage& grad, const flimage& ori, float scale, float row, float col,siftPar &par) { /* Produce sample vector. */ KeySampleVec(key, grad, ori, scale, row, col,par); /* Normalize vector. This should provide illumination invariance for planar lambertian surfaces (except for saturation effects). Normalization also improves nearest-neighbor metric by increasing relative distance for vectors with few features. It is also useful to implement a distance threshold and to allow conversion to integer format. */ NormalizeVec(key.vec); /* Now that normalization has been done, threshold elements of index vector to decrease emphasis on large gradient magnitudes. Admittedly, the large magnitude values will have affected the normalization, and therefore the threshold, so this is of limited value. */ bool changed = false; for (int i = 0; i < VecLength; i++) if (key.vec[i] > par.MaxIndexVal) { key.vec[i] = par.MaxIndexVal; changed = true; } if (changed) NormalizeVec(key.vec); /* Convert float vector to integer. Assume largest value in normalized vector is likely to be less than 0.5. */ /// QUESTION: why is the vector quantized to integer int intval; for (int i = 0; i < VecLength; i++) { intval = (int)(512.0 * key.vec[i]); key.vec[i] = (int) MIN(255, intval); } } /* Normalize length of vec to 1.0. */ void NormalizeVec(float* vec) { float val, fac; float sqlen = 0.0; for (int i = 0; i < VecLength; i++) { val = vec[i]; sqlen += val * val; } fac = 1.0 / sqrt(sqlen); for (int i = 0; i < VecLength; i++) vec[i] *= fac; } /* Create a 3D index array into which gradient values are accumulated. After filling array, copy values back into vec. */ void KeySampleVec( keypoint& key, const flimage& grad, const flimage& ori, float scale, float row, float col,siftPar &par) { float index[IndexSize][IndexSize][OriSize]; /* Initialize index array. */ for (int i = 0; i < IndexSize; i++) for (int j = 0; j < IndexSize; j++) for (int k = 0; k < OriSize; k++) index[i][j][k] = 0.0; KeySample(index, key, grad, ori, scale, row, col, par); /* Unwrap the 3D index values into 1D vec. */ int v = 0; for (int i = 0; i < IndexSize; i++) for (int j = 0; j < IndexSize; j++) for (int k = 0; k < OriSize; k++) key.vec[v++] = index[i][j][k]; } /* Add features to vec obtained from sampling the grad and ori images for a particular scale. Location of key is (scale,row,col) with respect to images at this scale. We examine each pixel within a circular region containing the keypoint, and distribute the gradient for that pixel into the appropriate bins of the index array. */ void KeySample( float index[IndexSize][IndexSize][OriSize], keypoint& key, const flimage& grad, const flimage& ori, float scale, float row, float col,siftPar &par) { float rpos, cpos, rx, cx; int irow = (int) (row + 0.5), icol = (int) (col + 0.5); float sine = (float) sin(key.angle), cosine = (float) cos(key.angle); /* The spacing of index samples in terms of pixels at this scale. */ float spacing = scale * par.MagFactor; /* Radius of index sample region must extend to diagonal corner of index patch plus half sample for interpolation. */ float radius = 1.414 * spacing * (IndexSize + 1) / 2.0; int iradius = (int) (radius + 0.5); /* Examine all points from the gradient image that could lie within the index square. */ for (int i = -iradius; i <= iradius; i++) { for (int j = -iradius; j <= iradius; j++) { /* Rotate sample offset to make it relative to key orientation. Uses (row,col) instead of (x,y) coords. Also, make subpixel correction as later image offset must be an integer. Divide by spacing to put in index units. */ /* Guoshen Yu, inverse the rotation */ rpos = ((cosine * i - sine * j) - (row - irow)) / spacing; cpos = ((sine * i + cosine * j) - (col - icol)) / spacing; /* rpos = ((cosine * i + sine * j) - (row - irow)) / spacing; cpos = ((- sine * i + cosine * j) - (col - icol)) / spacing;*/ /* Compute location of sample in terms of real-valued index array coordinates. Subtract 0.5 so that rx of 1.0 means to put full weight on index[1] (e.g., when rpos is 0 and IndexSize is 3. */ rx = rpos + IndexSize / 2.0 - 0.5; cx = cpos + IndexSize / 2.0 - 0.5; /* Test whether this sample falls within boundary of index patch. */ if ( rx > -1.0 && rx < (float) IndexSize && cx > -1.0 && cx < (float) IndexSize ) AddSample( index, key, grad, ori, irow + i, icol + j, rpos, cpos, rx, cx,par); } } } /* Given a sample from the image gradient, place it in the index array. */ void AddSample( float index[IndexSize][IndexSize][OriSize], keypoint& key, const flimage& grad, const flimage& orim, float r, float c, float rpos, float cpos, float rx, float cx,siftPar &par) { /* Clip at image boundaries. */ if (r < 0 || r >= grad.nheight() || c < 0 || c >= grad.nwidth()) return; /* Compute Gaussian weight for sample, as function of radial distance from center. Sigma is relative to half-width of index. */ float sigma = par.IndexSigma * 0.5 * IndexSize, weight = exp(- (rpos * rpos + cpos * cpos) / (2.0 * sigma * sigma)), // mag = weight * grad(c,r); mag = weight * grad((int)c,(int)r); // Guoshen Yu, explicitely cast to int to avoid warning /* Subtract keypoint orientation to give ori relative to keypoint. */ // float ori = orim(c,r) - key.angle; float ori = orim((int)c,(int)r) - key.angle; // Guoshen Yu, explicitely cast to int to avoid warning /* Put orientation in range [0, 2*PI]. If sign of gradient is to be ignored, then put in range [0, PI]. */ if (par.IgnoreGradSign) { while (ori > PI ) ori -= PI; while (ori < 0.0) ori += PI; } else { while (ori > 2.0*PI) ori -= 2.0*PI; while (ori < 0.0 ) ori += 2.0*PI; } PlaceInIndex(index, mag, ori, rx, cx,par); } /* Increment the appropriate locations in the index to incorporate this image sample. The location of the sample in the index is (rx,cx). */ void PlaceInIndex( float index[IndexSize][IndexSize][OriSize], float mag, float ori, float rx, float cx,siftPar &par) { int orr, rindex, cindex, oindex; float rweight, cweight, oweight; float *ivec; float oval = OriSize * ori / (par.IgnoreGradSign ? PI : 2.0*PI); // int ri = (rx >= 0.0) ? rx : rx - 1.0, /* Round down to next integer. */ // ci = (cx >= 0.0) ? cx : cx - 1.0, // oi = (oval >= 0.0) ? oval : oval - 1.0; int ri = (int)((rx >= 0.0) ? rx : rx - 1.0), /* Round down to next integer. */ // Guoshen Yu, explicitely cast to int to avoid warning ci = (int)((cx >= 0.0) ? cx : cx - 1.0), // Guoshen Yu, explicitely cast to int to avoid warning oi = (int)((oval >= 0.0) ? oval : oval - 1.0); // Guoshen Yu, explicitely cast to int to avoid warning float rfrac = rx - ri, /* Fractional part of location. */ cfrac = cx - ci, ofrac = oval - oi; assert( ri >= -1 && ri < IndexSize && oi >= 0 && oi <= OriSize && rfrac >= 0.0 && rfrac <= 1.0); /* Put appropriate fraction in each of 8 buckets around this point in the (row,col,ori) dimensions. This loop is written for efficiency, as it is the inner loop of key sampling. */ for (int r = 0; r < 2; r++) { rindex = ri + r; if (rindex >=0 && rindex < IndexSize) { rweight = mag * ((r == 0) ? 1.0 - rfrac : rfrac); for (int c = 0; c < 2; c++) { cindex = ci + c; if (cindex >=0 && cindex < IndexSize) { cweight = rweight * ((c == 0) ? 1.0 - cfrac : cfrac); ivec = index[rindex][cindex]; for (orr = 0; orr < 2; orr++) { oindex = oi + orr; if (oindex >= OriSize) /* Orientation wraps around at PI. */ oindex = 0; oweight = cweight * ((orr == 0) ? 1.0 - ofrac : ofrac); ivec[oindex] += oweight; } } } } } } ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// SIFT keypoint matching ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// float DistSquared(keypoint &k1,keypoint &k2, float tdist, siftPar &par) { float dif; float distsq = 0.0; // if (abs(k1.x - k2.x) > par.MatchXradius || abs(k1.y - k2.y) > par.MatchYradius) return tdist; if (ABS(k1.x - k2.x) > par.MatchXradius || ABS(k1.y - k2.y) > par.MatchYradius) return tdist; float *ik1 = k1.vec; float *ik2 = k2.vec; for (int i = 0; i < VecLength && distsq <= tdist; i++) { // for (int i = 0; i < VecLength ; i++) { dif = ik1[i] - ik2[i]; distsq += dif * dif; //distsq += ABS(dif); // distsq += ((ik1[i] > ik2[i]) ? (ik1[i] - ik2[i]) : (-ik1[i] + ik2[i])); } return distsq; } float DistSquared_short(keypoint_short &k1,keypoint_short &k2, float tdist, siftPar &par) { // For Mac/Linux compilation using make: vectorization is possible with short. unsigned short distsq = 0; // For Windows compilation using Intel C++ compiler: vectorization is possible with int. // int distsq = 0; if (ABS(k1.x - k2.x) > par.MatchXradius || ABS(k1.y - k2.y) > par.MatchYradius) return tdist; unsigned short *ik1 = k1.vec; unsigned short *ik2 = k2.vec; for (int i = 0; i < VecLength ; i++) { distsq += ((ik1[i] > ik2[i]) ? (ik1[i] - ik2[i]) : (-ik1[i] + ik2[i])); } return distsq; } /* This searches through the keypoints in klist for the two closest matches to key. It returns the ratio of the distance to key of the closest and next to closest keypoints in klist, while bestindex is the index of the closest keypoint. */ float CheckForMatch( keypoint& key, keypointslist& klist, int& min,siftPar &par) { int nexttomin = -1; float dsq, distsq1, distsq2; distsq1 = distsq2 = 1000000000000.0f; for (int j=0; j< (int) klist.size(); j++){ dsq = DistSquared(key, klist[j], distsq2,par); if (dsq < distsq1) { distsq2 = distsq1; distsq1 = dsq; nexttomin = min; min = j; } else if (dsq < distsq2) { distsq2 = dsq; nexttomin = j; } } return distsq1/distsq2 ; } float CheckForMatch_short( keypoint_short& key, keypointslist_short& klist, int& min,siftPar &par) { int nexttomin = -1; float dsq, distsq1, distsq2; distsq1 = distsq2 = 1000000000000.0f; for (int j=0; j< (int) klist.size(); j++){ dsq = DistSquared_short(key, klist[j], distsq2,par); if (dsq < distsq1) { distsq2 = distsq1; distsq1 = dsq; nexttomin = min; min = j; } else if (dsq < distsq2) { distsq2 = dsq; nexttomin = j; } } return distsq1/distsq2 ; } void compute_sift_matches( keypointslist& keys1, keypointslist& keys2, matchingslist& matchings,siftPar &par) { int imatch=0; float sqminratio = par.MatchRatio * par.MatchRatio, sqratio; // write the keypoint descriptors in char keypointslist_short keys1_short(keys1.size()); for (int i=0; i< (int) keys1.size(); i++) { keys1_short[i].x = keys1[i].x; keys1_short[i].y = keys1[i].y; keys1_short[i].scale = keys1[i].scale; keys1_short[i].angle = keys1[i].angle; for (int k=0; k < VecLength; k++) { keys1_short[i].vec[k] = (unsigned short) (keys1[i].vec[k]); } } keypointslist_short keys2_short(keys2.size()); for (int i=0; i< (int) keys2.size(); i++) { keys2_short[i].x = keys2[i].x; keys2_short[i].y = keys2[i].y; keys2_short[i].scale = keys2[i].scale; keys2_short[i].angle = keys2[i].angle; for (int k=0; k < VecLength; k++) { keys2_short[i].vec[k] = (unsigned short) (keys2[i].vec[k]); } } for (int i=0; i< (int) keys1.size(); i++) { // sqratio = CheckForMatch(keys1[i], keys2, imatch,par); sqratio = CheckForMatch_short(keys1_short[i], keys2_short, imatch,par); if (sqratio< sqminratio) matchings.push_back( matching(keys1[i],keys2[imatch] )); // matchings.push_back( matching_char(keys1_char[i],keys2_char[imatch] )); } }
31.827473
167
0.617187
[ "object", "vector", "3d" ]
be0dab4bed9cacca64ec9c70ab675d0e63abe15b
14,479
hh
C++
Kaskade/io/rangecoder.hh
chenzongxiong/streambox
76f95780d1bf6c02731e39d8ac73937cea352b95
[ "Unlicense" ]
3
2019-07-03T14:03:31.000Z
2021-12-19T10:18:49.000Z
Kaskade/io/rangecoder.hh
chenzongxiong/streambox
76f95780d1bf6c02731e39d8ac73937cea352b95
[ "Unlicense" ]
6
2020-02-17T12:01:31.000Z
2021-12-09T22:02:36.000Z
Kaskade/io/rangecoder.hh
chenzongxiong/streambox
76f95780d1bf6c02731e39d8ac73937cea352b95
[ "Unlicense" ]
2
2020-12-03T04:41:18.000Z
2021-01-11T21:44:42.000Z
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ /* This file is part of the library KASKADE 7 */ /* see http://www.zib.de/projects/kaskade7-finite-element-toolbox */ /* */ /* Copyright (C) 2002-2015 Zuse Institute Berlin */ /* */ /* KASKADE 7 is distributed under the terms of the ZIB Academic License. */ /* see $KASKADE/academic.txt */ /* */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #ifndef RANGECODER_HH #define RANGECODER_HH /** * \file * \brief Range coder for fast entropy coding. * \author Martin Weiser */ #include <algorithm> #include <cassert> #include <exception> #include <ios> #include <limits> #include <numeric> #include <vector> /** * \ingroup entropycoding * \brief Base class for entropy coding with range encoder and decoder. * * The coding works on sequences \f$ (s_i)_i \f$ of symbols. The * symbols \f$ s_i \f$ are elements of an alphabet \f$ S_i \f$, which * may be a different one for any position \f$ i \f$. * * Each symbol \f$ s \f$ is a pair of values \f$ * (s_{\text{low}},s_{\text{high}}) \f$ with \f$ s_{\text{low}} < * s_{\text{high}} \f$. Symbols represent half-open integer * ranges. Symbols from the same alphabet are non-overlapping, i.e., * \f$ s,t\in S \Rightarrow s_{\text{high}} \le t_{\text{low}} \vee * t_{\text{high}} \le s_{\text{low}} \f$. * * Each alphabet \f$ S \f$ is a setof nonoverlapping symbols such that * \f$ s_{\text{high}} \le \text{maxRange} \f$ for all \f$ s\in S \f$. * * Note that the range coder is not self-terminating. That means that * spurious trailing symbols can be extracted. For a correct * termination of the symbol sequence on decoding, you either need to * transmit the length of the symbol sequence beforehand or define a * special EOF symbol. * * The range coder algorithm is derived from the implementation by * Dmitry Subbotin. See also https://en.wikipedia.org/wiki/Range_encoding. * * \tparam UInt an unsigned integral type with more than 16 bits (usually 32 or 64 bit * usigned integer). */ template <class UInt> class RangeCoder { protected: // The number of binary digits in our unsigned integral type UInt. static int const digits = std::numeric_limits<UInt>::digits; // Mask for shifting of ranges during normalization. All numbers // smaller than top have 8 zero leading bits. // // Smaller value of top, e.g. 1 << digits-16, would allow to shift // the range by a larger amount and output short's instead of char's // for improved performance. A dawback of this is that bottom needs // to be decreased as well, which leads to a small maxRange and // hence a low resolution of the alphabet's probability table. static UInt const top = static_cast<UInt>(1) << (digits-8); // The smallest value of range that is possible. The class invariant // is range>=bottom. In contrast to top, the shift of bottom does // not need to be a multiple of 8. Smaller values of bottom lead to // a lower resolution of the alphabet's probability table (and hence // a worse approximation of symbol probabilities, in particular for // very different probabilities), however, it also saves space due // to fewer carry compensations. static UInt const bottom = static_cast<UInt>(1) << (digits-16); public: /** * \brief Maximal total range of alphabets. */ static const UInt maxRange = bottom; /** * \brief Number of processed encoded bytes. * * When encoding, this is the number of bytes already written to the * output stream. When decoding, this is the number of bytes already * read from the input stream. */ size_t size() const { return count; } protected: RangeCoder() : low(0), range(std::numeric_limits<UInt>::max()), count(0) { assert(std::numeric_limits<UInt>::is_specialized); assert(!std::numeric_limits<UInt>::is_signed); assert(digits > 16); } UInt low, range; size_t count; }; //--------------------------------------------------------------------- /** * \ingroup entropycoding * \brief Entropy coding with range encoder. * * A range encoder. It encodes a sequence of symbols \f$ (s_i)_i \f$. * See base class RangeCoder for a definition of symbols and * alphabets. * * Note that the encoding is completed only after destruction of the * encoder, since the destructor writes the remaining characters to * the output stream. * * \tparam UInt an unsigned integral type (usually 32 or * 64 bit usigned integer). */ template <class UInt> class RangeEncoder:public RangeCoder<UInt> { static UInt const bottom = RangeCoder<UInt>::bottom; static UInt const top = RangeCoder<UInt>::top; static UInt const digits = RangeCoder<UInt>::digits; public: static UInt const maxRange = RangeCoder<UInt>::maxRange; RangeEncoder(std::ostream& out_) : out(out_), fill(0) {} /** * \brief Destructor writes the remaining data to the output stream. */ ~RangeEncoder() { for(int i=0; i<digits/8; i++) put(); out.write((char const*)buf,fill); } /** * \brief Encodes one symbol. * * Encodes the symbol that covers the half-open range * [s.first,s.second[ of the totalRange. totalRange must not exceed * maxRange. Characters may be written to the output stream. If the * write operation is not successful, this method throws an * exception. * * See also the convenience function \ref encodeSymbol(). */ void push(std::pair<UInt,UInt> s, UInt totalRange) { // Check parameters. assert(s.first<s.second); assert(totalRange <= maxRange); UInt& range = this->range; UInt& low = this->low; // Check class invariant assert(range >= bottom); assert(range-1 <= std::numeric_limits<UInt>::max()-low); range /= totalRange; low += s.first*range; range *= s.second-s.first; // Perform range normalization while ( (low^(low+range)) < top || (range<bottom && ((range= -low & (bottom-1)),true)) ) put(); // Output of highest byte and shifting of range // Check class invariant assert(range >= bottom); assert(range-1 <= std::numeric_limits<UInt>::max()-low); } private: std::ostream& out; // Putting one char at a time into the std::ostream is quite // inefficient. We store the bytes in a small buffer and feed the // buffer into the ostream once it is full. A buffer size of 64 // seems to be a good compromise between performance improvement and // memory consumption. static int const bufsize = 64; unsigned char buf[bufsize]; int fill; void put() { UInt& range = this->range; UInt& low = this->low; if (fill==bufsize) { out.write((char const*)buf,bufsize); if (!out) throw std::ios_base::failure("write error"); fill = 0; this->count += bufsize; } // Store eight most significant bits (top) in stream buffer. buf[fill] = low >> (digits-8); ++fill; // shift window range <<= 8; low <<= 8; } }; //--------------------------------------------------------------------- /** * \ingroup entropycoding * \brief Entropy coding with range decoder. * * A range decoder. It decodes to a sequence of symbols \f$ (s_i)_i * \f$. See base class RangeCoder for a definition of symbols and * alphabets. * * \tparam UInt an unsigned integral type (usually 32 or * 64 bit usigned integer). */ template <class UInt> class RangeDecoder:public RangeCoder<UInt> { static UInt const bottom = RangeCoder<UInt>::bottom; static UInt const top = RangeCoder<UInt>::top; static UInt const digits = RangeCoder<UInt>::digits; UInt code; std::istream& in; public: static UInt const maxRange = RangeCoder<UInt>::maxRange; /** * Constructor. Note that reading the input stream starts already on * construction. Keep this in mind if you decide to transmit the * length of the symbol sequence before the encoded characters. */ RangeDecoder(std::istream& input_) : code(0), in(input_) { // Throw ios_base::failure if end of stream is reached. in.exceptions(std::ios_base::eofbit | in.exceptions()); // Fill range for(int i=0; i<digits/8; i++) { code = (code << 8) | in.get(); if (!in) throw std::ios_base::failure("read error"); ++this->count; } } /** * Returns a value \f$ c \f$ that is contained in the half-open * range of the current symbol \f$ s \f$: \f$ s_{\text{low}} \le c < * s_{\text{high}} \f$. * * See also the convenience function decodeSymbol(). */ UInt front(UInt totalRange) const { UInt const& range = this->range; UInt const& low = this->low; return (code-low)/(range/totalRange); } /** * Removes the current symbol from the sequence. The given symbol * must mach the current symbol, i.e., s.first <= front(totalRange) < * s.second. * * Characters may be read from the input stream. If this operation * fails (e.g. because of end of stream is reached), an exception is * thrown. * * If the same number of symbols are pop'ed as have previously been * push'ed, the same number of encoded characters is read from the * input stream as has previously been written to the output * stream. Note that this does NOT imply that only as many symbols * can be pop'ed as have been push'ed before (it only means that at * least as many symbols can be decoded as have been * encoded). Spurious trailing symbols may be encountered before EOF * is reached. */ void pop(std::pair<UInt,UInt> s, UInt totalRange) { UInt& range = this->range; UInt& low = this->low; assert(s.first<=front(totalRange) && front(totalRange)<s.second); range /= totalRange; low += s.first*range; range *= s.second-s.first; // Perform range normalization while ( (low^(low+range))<top || (range<bottom && ((range= -low & (bottom-1)),true)) ) { code = code<<8 | in.get(); range <<= 8; low <<= 8; ++this->count; } } }; //--------------------------------------------------------------------- //--------------------------------------------------------------------- /** * \ingroup entropycoding * \brief A simple alphabet of symbols with frequencies to be used with the range coder. * * The symbols are consecutive integers 0..(size()-1). The half-open * ranges associated to the symbols are derived from given frequencies * of the symbols. */ template <class UInt> class Alphabet { public: /** * Constructs an alphabet from a sequence of frequencies of * symbols. Note that for each symbol the frequency must be larger * than 0. */ template <class InIter> Alphabet(InIter first, InIter last) : cumFreq(std::distance(first,last)+1) { cumFreq[0] = 0; std::partial_sum(first,last,cumFreq.begin()+1,std::plus<UInt>()); } /** * \brief Modifies the symbols' half-open ranges to represent the symbols' * frequencies given in the range [first,last[. * * Note that for each symbol the frequency must be larger than 0. The length of the * given sequence must match the size of the alphabet. */ template <class InIter> void update(InIter first, InIter last) { assert(std::distance(first,last)==size()); // check that all symbols are covered assert(std::find(first,last,0)==last); // check that all frequencies are greater than zero std::partial_sum(first,last,cumFreq.begin()+1,std::plus<UInt>()); // compute cumulative distribution } /** * \brief Returns the total range, i.e. the maximum upper range bound of any symbol in the alphabet. */ UInt totalRange() const { return cumFreq.back(); } /** * \brief Returns the number of symbols in the alphabet. */ UInt size() const { return cumFreq.size()-1; } /** * \brief Returns the symbol that contains the given value. */ UInt symbol(UInt value) const { typename std::vector<UInt>::const_iterator i = std::upper_bound(cumFreq.begin(),cumFreq.end(), value); assert(i==cumFreq.end() || *i>value); assert(i!=cumFreq.begin()); return i-cumFreq.begin()-1; } /** * \brief Returns the symbol's half-open cumulative frequency range. */ std::pair<UInt,UInt> range(UInt symbol) const { assert(symbol<size()); return std::make_pair(cumFreq[symbol],cumFreq[symbol+1]); } private: // cumulated frequencies for the symbols std::vector<UInt> cumFreq; }; //--------------------------------------------------------------------- //--------------------------------------------------------------------- /** * \ingroup entropycoding * \brief A convenience function that encodes a symbol in a range encoder. * \relates RangeEncoder */ template <class UInt, class Symbol> void encodeSymbol(RangeEncoder<UInt>& encoder, Alphabet<UInt> const& alphabet, Symbol const& s) { encoder.push(alphabet.range(s),alphabet.totalRange()); } /** * \ingroup entropycoding * \brief A convenience function that retrieves and pops the current symbol from a range decoder. * \relates RangeDecoder */ template <class UInt> UInt decodeSymbol(RangeDecoder<UInt>& decoder, Alphabet<UInt> const& alphabet) { UInt s = alphabet.symbol(decoder.front(alphabet.totalRange())); decoder.pop(alphabet.range(s),alphabet.totalRange()); return s; } //--------------------------------------------------------------------- //--------------------------------------------------------------------- #endif
32.319196
105
0.591339
[ "vector" ]
be29ab1744e56d01019920820ea8dd2657c37775
2,062
cxx
C++
Code/Graph/SingleSourceShortestPath/testCaseBellmanFord.cxx
konny0311/algorithms-nutshell-2ed
760b0b8a296fb6be923c89406f61e773a48c59db
[ "MIT" ]
522
2016-02-21T18:44:23.000Z
2022-03-31T09:29:04.000Z
Code/Graph/SingleSourceShortestPath/testCaseBellmanFord.cxx
linfachen/algorithms-nutshell-2ed
17bd6e9cf9917727501f9eeadbfb2100f94eede0
[ "MIT" ]
3
2020-04-09T01:52:52.000Z
2022-01-13T08:18:55.000Z
Code/Graph/SingleSourceShortestPath/testCaseBellmanFord.cxx
linfachen/algorithms-nutshell-2ed
17bd6e9cf9917727501f9eeadbfb2100f94eede0
[ "MIT" ]
216
2015-10-16T16:50:10.000Z
2022-02-10T00:57:20.000Z
/** * @file testCaseBellmanFord.cxx another test case for Bellman Ford * @brief * * A test case * * @author George Heineman * @date 6/15/08 */ #include <cassert> #include <iostream> #include "singleSourceShortest.h" /** * A test case for Bellman Ford. * Note there are two versions of the code, which requires you to modify * it to see both graphs. Figure 6-17 is generated by using both versions * of the code. */ int main () { int n = 5; Graph g (n,true); // in this arrangement, four edges found in first pass, one in second if (1) { g.addEdge (0, 1, 2); g.addEdge (1, 3, 4); g.addEdge (1, 4, 5); g.addEdge (4, 3, -2); g.addEdge (3, 2, 6); g.addEdge (2, 4, -3); } // in this arrangement, two edges found in first pass, two in second if (0) { g.addEdge (0, 4, 2); g.addEdge (4, 3, 4); g.addEdge (4, 1, 5); g.addEdge (1, 3, -2); g.addEdge (3, 2, 6); g.addEdge (2, 1, -3); } vector<int> dist(n); vector<int> pred(n); singleSourceShortest(g, 0, dist, pred); for (int i = 0; i < n; i++) { cout << i << ". " << dist[i] << " " << pred[i] << "\n"; } n = 4; Graph g2 (n, true); g2.addEdge (0,1,4); g2.addEdge (0,2,3); g2.addEdge (2,1,1); g2.addEdge (3,0,5); g2.addEdge (3,1,10); g2.addEdge (3,2,7); vector<int> dist2(n); vector<int> pred2(n); singleSourceShortest(g2, 0, dist2, pred2); assert (dist2[0] == 0); assert (dist2[1] == 4); assert (dist2[2] == 3); assert (dist2[3] == numeric_limits<int>::max()); // try another one singleSourceShortest(g2, 3, dist2, pred2); assert (dist2[0] == 5); assert (dist2[1] == 8); assert (dist2[2] == 7); assert (dist2[3] == 0); // detect negative cycle n = 3; Graph g3 (n, true); g3.addEdge (0,1,-3); g3.addEdge (1,2,-2); g3.addEdge (2,0,-1); vector<int> dist3(n); vector<int> pred3(n); try { singleSourceShortest(g3, 0, dist3, pred3); assert (0 == 1); // FAILURE CASE } catch (...) { cout << "caught proper exception\n"; } }
21.040816
73
0.559651
[ "vector" ]
be2ab42b0406f244f3531be7bb6653cbd68b48e0
4,072
hh
C++
3rd_party/augustus-3.2.1/include/orthoexon.hh
genomecuration/JAM
8b834d3efe32f79c48887c2797005619ac2c3a1d
[ "BSD-3-Clause" ]
null
null
null
3rd_party/augustus-3.2.1/include/orthoexon.hh
genomecuration/JAM
8b834d3efe32f79c48887c2797005619ac2c3a1d
[ "BSD-3-Clause" ]
null
null
null
3rd_party/augustus-3.2.1/include/orthoexon.hh
genomecuration/JAM
8b834d3efe32f79c48887c2797005619ac2c3a1d
[ "BSD-3-Clause" ]
null
null
null
/********************************************************************** * file: orthoexon.hh * licence: Artistic Licence, see file LICENCE.TXT or * http://www.opensource.org/licenses/artistic-license.php * descr.: maintains orthologous exons for comparative gene prediction * authors: Stefanie König * *********************************************************************/ #ifndef _ORTHOEXON_HH #define _ORTHOEXON_HH #include "exoncand.hh" #include "projectio.hh" #include "types.hh" #include "phylotree.hh" #include <vector> #include <string> #include <list> //forward declarations: class Node; class OrthoExon { public: OrthoExon(int_fast64_t k, size_t numSpecies); ~OrthoExon() {}; // get and and set functions StateType getStateType() const; // all exon candidates agree in type int numExons() const; double getOmega() const { return omega; } double getEomega() const { return Eomega; } double getVarOmega() const { return VarOmega; } double getSubst() const { return subst; } double getConsScore() const {return cons;} double getDiversity() const {return diversity;} size_t getContainment() const {return containment;} bool hasOmega() const {return Eomega >= 0.0;} bit_vector getBV() const {return bv;} vector<int> getRFC(vector<int> offsets) const; PhyloTree* getTree() const {return tree;} int getAliStart() const {return (key>>22);} // start position of HECT in alignment int getAliLen() const {int aliStart=getAliStart(); int n=key-(aliStart<<22); return (n>>7);} // length of HECT + 1 int getAliEnd() const {return getAliStart() + getAliLen();} bool exonExists(int pos) const; // returns true if OE has a candidate exon at position pos void setOmega(double o){omega=o;} void setOmega(vector<double>* llo, CodonEvo* codonevo, bool oeStart); void setSubst(int s){ subst=s;} void setConsScore(double c){cons=c;} void setDiversity(double d){diversity=d;} void setContainment(int c) { containment = c; } void setLabelpattern(); // updates the labelpattern void setTree(PhyloTree* t); void setBV(bit_vector b){bv = b;} vector<int> getRFC(vector<int> offsets); string getStoredLabelpattern() {return labelpattern;} // retrieving labelpattern without updating string getCurrentLabelpattern() { setLabelpattern(); return labelpattern;} //retrieving labelpattern with updating double getLogRegScore(); vector<ExonCandidate*> orthoex; vector<Node*> orthonode; //corresponding nodes in the graph vector<double> weights; vector<int> labels; //TODO: instead of an attribute write a function getLabelpattern() which returns the current //label pattern. This is the safer way and guarantees to always have the current label pattern. std::string labelpattern; int ID; private: int_fast64_t key; // key encodes all of: aliStart aliEnd type lenMod3 double omega; vector<double> loglikOmegas; double Eomega; double VarOmega; int subst; double cons; // conservation score double diversity; // sum of branch lengths of the subtree induced by the OrthoExon (measure of phylogenetic diversity) size_t containment; // how many bases overhang on average has the largest OrthoExon that includes this one in the same frame bit_vector bv; // stores in one bit for each species its absence/presence (0/1) PhyloTree *tree; // corresponding tree topology of an OE }; /* * read and write functions for orthologous exons * TODO: - allow orthologous exons to be on different strands * - substract offset; on reverse strand, start/end positions have to be made relative to the * reverse complement */ // old code: //std::list<OrthoExon> readOrthoExons(std::string filename); //reads list of orthologous exons from a file //void writeOrthoExons(const std::list<OrthoExon> &all_orthoex); std::ostream& operator<<(std::ostream& ostrm, const OrthoExon &ex_tuple); std::istream& operator>>(std::istream& istrm, OrthoExon& ex_tuple); #endif
40.72
128
0.688605
[ "vector" ]
be2ad37b0a9173c5eefccda1403960f280cc42b5
4,823
hpp
C++
src/cxx/pathfinder2d/cfg/pathfinder2d.hpp
c0de4un/pathfinder_2d
778a7f6281d5816ca42ac9071794cc61a4420ec1
[ "MIT" ]
1
2019-03-10T04:12:29.000Z
2019-03-10T04:12:29.000Z
src/cxx/pathfinder2d/cfg/pathfinder2d.hpp
c0de4un/pathfinder_2d
778a7f6281d5816ca42ac9071794cc61a4420ec1
[ "MIT" ]
null
null
null
src/cxx/pathfinder2d/cfg/pathfinder2d.hpp
c0de4un/pathfinder_2d
778a7f6281d5816ca42ac9071794cc61a4420ec1
[ "MIT" ]
null
null
null
/** * Copyright © 2019 Denis Z. (code4un@yandex.ru) All rights reserved. * Authors: Denis Z. (code4un@yandex.ru) * All rights reserved. * License: see LICENSE.txt * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS * IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS OR CONTRIBUTORS * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. **/ #ifndef C0DE4UN_PATHFINDER_2D_HPP #define C0DE4UN_PATHFINDER_2D_HPP // ----------------------------------------------------------- // =========================================================== // INCLUDES // =========================================================== // Include C++ stack #include <stack> // Include C++ bitset. #include <bitset> // Include C++ vector #include <vector> // C++ assert #ifdef DEBUG // DEBUG #include <cassert> #endif // DEBUG // =========================================================== // FORWARD-DECLARATIONS // =========================================================== // Forward-declare Map2D, Tile2D, Path2D #ifndef C0DE4UN_PATHFINDER_2D_MAP_DECL #define C0DE4UN_PATHFINDER_2D_MAP_DECL class IMap2D; class Map2D; class IMap2DEventsHandler; #endif // !C0DE4UN_PATHFINDER_2D_MAP_DECL // =========================================================== // TYPES // =========================================================== typedef unsigned int tint32_t; /** Diagonal-Search flag bit-mask. **/ static constexpr unsigned char DIAGONAL_SEARCH_FLAG_MASK = 0; /** Parial-Result flag bit-mask. **/ static constexpr unsigned char PARTIAL_SEARCH_FLAG_MASK = 1; // Enable structure-data (fields, variables) alignment (by compilator) to 1 byte #pragma pack( push, 1 ) /** * Tile states enum. * * @since 23.12.2019 * @version 1.0 * @authors Denis Z. (code4un@yandex.ru) **/ enum ETileState : unsigned char { // ----------------------------------------------------------- AVAILABLE = 0, PROCESSING = 1, PATH_RESERVED = 2, OCCUPIED = 3 // ----------------------------------------------------------- }; /** * Path search criteria. * * @since 23.12.2019 * @version 1.0 * @authors Denis Z. (code4un@yandex.ru) **/ enum ESearchCriteria : unsigned char { // ----------------------------------------------------------- SHORTEST, LONGEST // ----------------------------------------------------------- }; /** * Path search params. * * @since 23.12.2019 * @version 1.0 * @authors Denis Z. (code4un@yandex.ru) **/ struct PathSearchParams { // ----------------------------------------------------------- // =========================================================== // CONSTANTS & FIELDS // =========================================================== /** Start **/ tint32_t mSrcRow; tint32_t mSrcCol; /** Finish **/ tint32_t mDstRow; tint32_t mDstCol; /** Callbacks Interface **/ IMap2DEventsHandler* MapListener; /** Search-Flags. **/ std::bitset<2> mSearchFlags; /** Search Criteria. **/ ESearchCriteria mSearchCriteria; // ----------------------------------------------------------- }; /// PathSearchParams /** * Tile2D - 2D Tile struct. * * @since 23.12.2019 * @version 1.0 * @authors Denis Z. (code4un@yandex.ru) **/ struct Tile2D { // ----------------------------------------------------------- /** Row **/ tint32_t mRow; /** Col **/ tint32_t mCol; /** Tile State **/ ETileState mState; /** Step Index. **/ tint32_t mStep; // ----------------------------------------------------------- }; /** * 2D Path struct. * * @since 23.12.2019 * @version 1.0 * @authors Denis Z. (code4un@yandex.ru) **/ struct Path2D { // ----------------------------------------------------------- /** Tiles **/ std::vector<Tile2D*> mTiles; /** Start-Tile **/ const Tile2D* const mStart; /** Finish-Tile **/ const Tile2D* const mFinish; // ----------------------------------------------------------- }; /// Path2D // Restore structure-data alignment to default (8-byte on MSVC) #pragma pack( pop ) // ----------------------------------------------------------- #endif C0DE4UN_PATHFINDER_2D_HPP // !C0DE4UN_PATHFINDER_2D_HPP
23.526829
80
0.496164
[ "vector" ]
be30f7fdd73a7b9b102c30bf956d7fe3afd60beb
16,596
cpp
C++
N64 Midi Tool/N64MidiLibrary/NaganoDecoder.cpp
Raspberryfloof/N64-Tools
96738d434ce3922dec0168cdd42f8e7ca131d0c5
[ "Unlicense" ]
160
2018-09-15T00:33:00.000Z
2022-03-28T23:39:46.000Z
N64 Midi Tool/N64MidiLibrary/NaganoDecoder.cpp
Raspberryfloof/N64-Tools
96738d434ce3922dec0168cdd42f8e7ca131d0c5
[ "Unlicense" ]
32
2018-09-15T17:49:01.000Z
2022-03-17T21:38:46.000Z
N64 Midi Tool/N64MidiLibrary/NaganoDecoder.cpp
Raspberryfloof/N64-Tools
96738d434ce3922dec0168cdd42f8e7ca131d0c5
[ "Unlicense" ]
132
2018-09-15T00:44:39.000Z
2022-03-26T01:46:36.000Z
#include "StdAfx.h" #include "NaganoDecoder.h" #include <algorithm> #include <vector> // By Zoinkity!!! CNaganoDecoder::CNaganoDecoder(void) { } CNaganoDecoder::~CNaganoDecoder(void) { } void WriteLongToBuffer(unsigned char* Buffer, unsigned long address, unsigned long data) { Buffer[address] = ((data >> 24) & 0xFF); Buffer[address+1] = ((data >> 16) & 0xFF); Buffer[address+2] = ((data >> 8) & 0xFF); Buffer[address+3] = ((data) & 0xFF); } void WriteShortToBuffer(unsigned char* Buffer, unsigned long address, unsigned short data) { Buffer[address] = ((data >> 8) & 0xFF); Buffer[address+1] = ((data) & 0xFF); } void CNaganoDecoder::KonamiLZW(unsigned char* inputBuffer, int compressedSizeSection, int& inputPosition, unsigned char* output, int& outputPosition) { unsigned long endPosition = (inputPosition + compressedSizeSection - 4); while (inputPosition < endPosition) { unsigned char i = inputBuffer[inputPosition++]; if (i < 0x80) { unsigned long b = (i<<8) + inputBuffer[inputPosition++]; b &= 0x3FF; i >>= 2; for (int j = 0; j <(i+2); j++) output[outputPosition++] = output[outputPosition-b]; } else if (i < 0xA0) { i &= 0x1F; for (int j = 0; j < i; j++) { output[outputPosition++] = inputBuffer[inputPosition++]; } } else if (i < 0xE0) { i &= 0x1F; unsigned char v = inputBuffer[inputPosition++]; int end = i+2; for (int j = 0; j < end; j++) { output[outputPosition++] = v; } } else if (i < 0xFF) { i &= 0x1F; for (int j = 0; j < (i + 2); j++) output[outputPosition++] = 0x00; } else // if (i == 0xFF) { int end = inputBuffer[inputPosition++] + 2; for (int j = 0; j < end; j++) output[outputPosition++] = 0x00; } } } int CNaganoDecoder::dec(unsigned char* inputBuffer, int compressedSize, unsigned char* output) { int inputPosition = 0; int outputPosition = 0; while (outputPosition < compressedSize) { if ((compressedSize - outputPosition) <= 0x18) break; unsigned long size = ((((((inputBuffer[inputPosition] << 8) | inputBuffer[inputPosition+1]) << 8) | inputBuffer[inputPosition+2]) << 8) | inputBuffer[inputPosition+3]); unsigned long width = size >> 28; if (width != 0) { // #Interleaved data. inputPosition += 4; for (int w = 0; w < (width+1); w++) { size = ((((((inputBuffer[inputPosition] << 8) | inputBuffer[inputPosition+1]) << 8) | inputBuffer[inputPosition+2]) << 8) | inputBuffer[inputPosition+3]); size &= 0xFFFFFFF; inputPosition += 4; KonamiLZW(inputBuffer, size, inputPosition, output, outputPosition); } } else { size &= 0xFFFFFFF; inputPosition += 4; KonamiLZW(inputBuffer, size, inputPosition, output, outputPosition); } } return outputPosition; } //# Subfunction to return copylengths for comparison during sliding window. void samelength(int p, int& length, int& value, unsigned char* data, int sz) { //"""Determines number of duplicates of char starting at [p]osition. //Returns (length, char)""" unsigned char c = data[p]; if (((p+1) >= sz) || (data[p+1] != c)) { length = 0; value = c; return; } int l; if (c != 0) l = min(p + 33, sz+1); else l = min(p + 257, sz+1); int i = 0; for (i = (p + 2); i < l; i++) { //# This line bugfixes first zero not recognized as part of set. if (i == sz) break; if (data[i] != c) break; } length = (i - p); value = c; return; } bool Compare(unsigned char* array, unsigned char* needle, int needleLen, int startIndex) { // compare for (int i = 0, p = startIndex; i < needleLen; i++, p++) { if (array[p] != needle[i]) { return false; } } return true; } int Find(unsigned char* array, unsigned char* needle, int needleLen, int startIndex, int sourceLength) { int index; while (startIndex < (sourceLength - needleLen + 1)) { // find needle's starting element int index = -1; for (int r = startIndex; r < (sourceLength - needleLen + 1); r++) { if (array[r] == needle[0]) { index = r; break; } } // if we did not find even the first element of the needle, then the search is failed if (index == -1) return -1; int i, p; // check for needle for (i = 0, p = index; i < needleLen; i++, p++) { if (array[p] != needle[i]) { break; } } if (i == needleLen) { // needle was found return index; } // continue to search for needle //sourceLength -= (index - startIndex + 1); startIndex = index + 1; } return -1; } void copylength(int p, int& length, int& position, unsigned char* data, int sz) { //"""Determines longest duplicate of sequence starting at [p]osition. //Returns (length, position)""" if ((p+1) >= sz) { length = 0; position = 0; return; } int l = 2; std::vector<int> hl; int i = 0; int c = min(p+0x401, sz); while (true) { i = Find(&data[p], &data[p], l, i+1, (c-p)); if (i < 0) break; hl.push_back(i + p); } if (hl.size() == 0) { length = 0; position = 0; return; } //# Uh, this needs to check if hit EOF... while (l < 34) { l += 1; std::vector<int> hh; for (i = 0; i < hl.size(); i++) { if (Compare(&data[hl[i]], &data[p], l, 0)) { hh.push_back(hl[i]); } } if (hh.size() == 0) break; hl = hh; } l -= 1; for (int r = 0; r < hl.size(); r++) { c = *std::min_element(hl.begin(), hl.end()) - p; } length = l; position = c; return; } std::vector<int> modella(int start, int length, int enclen, unsigned char* data, int sz) { std::vector<int> ret; ret.resize(3); //"""Given a start position, length, and encoded command length, //returns optimal length for command.""" //# First figure what your actual hit gets you. int oe = enclen; int ol = length; int x = 0; int y = 0; samelength(start+length, x, y, data, sz); int throwawayPos = 0; int v = 0; copylength(start+length, v, throwawayPos, data, sz); int e = (y != 0) | (x > 33); if (x >= (v+e)) { oe = enclen + 1 + e; ol += x; } else if (v != 0) { oe += 2; ol += v; } //# This checks if a shorter initial copy leads to longer copies later. ret[0] = length; ret[1] = ol; ret[2] = oe; int f = 1; for (int i = 1; i < length; i++) { int te = 0; if (i == 1) te = 2; else te = enclen; int tl = i; while ((tl < ol) && (te < oe)) { samelength(start+tl, x, y, data, sz); int throwadayPos; copylength(start+tl, v, throwadayPos, data, sz); e = (y == 0) && (x < 33); if (f > 30) f = 0; if ((x == 0) && (v == 0)) { if (f == 0) te += 1; te += 1; tl += 1; f += 1; continue; } else if (x >= (v - e)) { te += 1 + (int)(bool)(y != 0); tl += x; } else if (v != 0) { te += 2; tl += v; x = v; e = false; } if ((0 < f) && (f < 0x1C) && (x == 2) && (e == 0)) { int e = 0; int tempValue = 0; samelength(start+tl, e, tempValue, data, sz); int eTemp = 0; copylength(start+tl, e, tempValue, data, sz); e |= eTemp; if (e == 0) f += 2; else f = 0; } else f = 0; } //# If encoded length shorter for same distance, prefer it. if ((te <= oe) && (tl >= ol)) { ret[0] = i; ret[1] = tl; ret[2] = te; } //## # DEBUGGERY! //## if ret[0] != length: //## print("Case! 0x{:X}, 0x{:X} encodes to 0x{:X} (0x{:X}, 0x{:X})".format(start, length, ret[0], ret[1], ret[2])) } return ret; } void flushpush(int l, int p, unsigned char* data, unsigned char* out, int& outputPosition) { if (l == 0) return; for (int r = p-l; r < p; r++) out[outputPosition++] = data[r]; out[outputPosition++] = (0x80 | l); //## print("\tpush\t{:02X} \t{:02X}".format(out[-1], l)) } void flushcopy(int l, int p, unsigned char* out, int& outputPosition) { l -= 2; out[outputPosition++] = (p & 0xFF); out[outputPosition++] = ((l << 2) | (p >> 8)); //## print("\tcopy\t{:02X}{:02X}\t{:02X} {:02X}".format(out[-1], out[-2], l+2, p)) } void flushsame(int l, int c, unsigned char* out, int& outputPosition) { l -= 2; if (c != 0) { out[outputPosition++] = c; out[outputPosition++] = (0xC0 | l); } else if (l > 31) { out[outputPosition++] = l; out[outputPosition++] = 0xFF; //## print("\tcopy\t{:02X}{:02X}\t{:02X} {:02X}".format(out[-1], out[-2], c, l+2)) return; } else { out[outputPosition++] = (0xE0 | l); //## print("\tsame\t{:02X} \t{:02X} {:02X}".format(out[-1], c, l+2)) } } int CNaganoDecoder::EncodeKonamiLZW(unsigned char* inputBuffer, int uncompressedSize, unsigned char* outputBuffer, int outputBufferSize, int& compressedSize, int& compressedRealSize, int level = 9) { unsigned char* out = new unsigned char[outputBufferSize]; int outputPosition = 0; //"""Compresses [data], returning a bytes object. //Current compression levels: //9 slowest and hopefully most aggressive compresion //3 applies one-step lookahead model //2 naive compression, optimizing short copies when raw shorter //1 naive compression with no attempt at optimization //0 spits out raw data in wrappers; probably larger than input //""" //# [0]11111.11 11111111 copy u+2 bytes from -l (33) //# [100]11111 push next n bytes (31) //# [110]11111. 11111111 push l u+2 times (33) //# [111]11111 push n+2 zeroes (32) //# [11111111] 11111111 push n+2 zeroes (257) unsigned char* data = new unsigned char[uncompressedSize]; for (int x = 0; x < uncompressedSize; x++) { data[x] = inputBuffer[uncompressedSize - x - 1]; } /*FILE* reverse = fopen("C:\\temp\\reverse.bin", "wb"); fwrite(data, 1, uncompressedSize, reverse); fclose(reverse);*/ int sz = uncompressedSize; int pos = 0; //# Normalize level. if (level > 9) level = 9; if (level < 0) level = 0; int pl = 0; if (level == 0) { //# Stuffs data in wrappers. Output likely larger than input. while (pos < sz) { int sl, ss; samelength(pos, sl, ss, data, sz); if (sl == 0) { pl += 1; pos += 1; if (pl == 31) { flushpush(pl, pos, data, out, outputPosition); pl = 0; } continue; } if (pl != 0) { flushpush(pl, pos, data, out, outputPosition); pl = 0; } flushsame(sl, ss, out, outputPosition); pos += sl; } } else { while (pos < sz) { /*FILE* outA = fopen("C:\\temp\\pos.txt", "a"); fprintf(outA, "%d\n", pos); fclose(outA);*/ int cl = 0; int cs = 0; int sl = 0; int ss = 0; //# same-length, copy-length, push-length samelength(pos, sl, ss, data, sz); copylength(pos, cl, cs, data, sz); if ((sl == 0) && (cl == 0)) { pl += 1; pos += 1; if (pl == 31) { flushpush(pl, pos, data, out, outputPosition); pl = 0; } continue; } //# Check the end of the samelength to see if a copylength can be encoded. //# Prefer samelengths since algo decodes them (marginally) faster. else if (sl >= cl) { if (level > 2) { if (ss != 0) { sl = modella(pos, sl, 2, data, sz)[0]; } //# Test if a shorter sequence results in a 1-byte encode. else if ((32 < sl) && (sl < 65)) { //## sl = modella(pos+31, sl-31, 1) std::vector<int> i = modella(pos, 33, 1, data, sz); //# Would be faster with a shorter sequence, but anyone who actually knows how to write a compressor would have thrown all this script out by now. std::vector<int> j = modella(pos, sl, 2, data, sz); if ((i[2] < j[2]) && (i[1] >= j[1])) sl = i[0]; } } if (level > 1) { //# If length 2, not pushing zeroes, and not at end of pl, check encoding as raws. if ((sl == 2) && (ss != 0) && (0 < pl) && (pl < 0x1C) && ((pos+sl) < sz)) { int tempValue = 0; int i = 0; samelength(pos+2, i, tempValue, data, sz); int tempI = 0; copylength(pos+2, tempI, tempValue, data, sz); i |= tempI; if (i == 0) { pl += 2; pos += 2; continue; } } } if (sl == 1) { pl += 1; pos += 1; continue; } //# Encode this command; allow next pass to handle the next one. if (pl != 0) { flushpush(pl, pos, data, out, outputPosition); pl = 0; } flushsame(sl, ss, out, outputPosition); pos += sl; //# Check copylength if samelengths can be encoded to produce a shorter total sequence. } else { if (level > 2) { //# Check copylength if samelengths can be encoded to produce a shorter total sequence. cl = modella(pos, cl, 2, data, sz)[0]; } if (level > 1) { //# If length 2 and not at end of pl, check encoding as raws. if ((cl == 2) && (0 < pl) && (pl < 0x1C) && ((pos+pl) < sz)) { int i = 0; int tempValue; samelength(pos+2, i, tempValue, data, sz); int tempI; copylength(pos+2, tempI, tempValue, data, sz); i |= tempI; if (i == 0) { pl += 2; pos += 2; continue; } } } if (cl == 1) { pl += 1; pos += 1; continue; } //# Encode this command; allow next pass to handle the next one. if (pl != 0) { flushpush(pl, pos, data, out, outputPosition); pl = 0; } flushcopy(cl, cs, out, outputPosition); pos += cl; } } } //# Flush any remaining bytes. if (pl != 0) flushpush(pl, pos, data, out, outputPosition); for (int x = 0; x < outputPosition; x++) outputBuffer[x + 4] = out[outputPosition - x - 1]; outputPosition += 4; WriteLongToBuffer(outputBuffer, 0, outputPosition); compressedRealSize = outputPosition; int pad = ((outputPosition) % 0x10); if (pad != 0) { for (int x = 0; x < (0x10 - pad); x++) outputBuffer[outputPosition++] = 0x00; } delete [] data; compressedSize = outputPosition; delete [] out; return compressedSize; }
25.890796
197
0.467944
[ "object", "vector", "model" ]
be36595e377af39a02063f8c7448b80c19a55295
17,036
cpp
C++
vipss/src/rbf_Hermite.cpp
ErvinXie/VIPSS
f60a3bb0149c9d8d025060c25122da9eeb537f75
[ "MIT" ]
null
null
null
vipss/src/rbf_Hermite.cpp
ErvinXie/VIPSS
f60a3bb0149c9d8d025060c25122da9eeb537f75
[ "MIT" ]
null
null
null
vipss/src/rbf_Hermite.cpp
ErvinXie/VIPSS
f60a3bb0149c9d8d025060c25122da9eeb537f75
[ "MIT" ]
null
null
null
#include "rbfcore.h" #include "utility.h" #include "Solver.h" #include <armadillo> #include <fstream> #include <limits> #include <unordered_map> #include <ctime> #include <chrono> #include <iomanip> #include <algorithm> #include <queue> #include "readers.h" //#include "mymesh/UnionFind.h" //#include "mymesh/tinyply.h" typedef std::chrono::high_resolution_clock Clock; double randomdouble() { return static_cast <double> (rand()) / static_cast <double> (RAND_MAX); } double randomdouble(double be, double ed) { return be + randomdouble() * (ed - be); } void RBF_Core::NormalRecification(double maxlen, vector<double> &nors) { double maxlen_r = -1; auto p_vn = nors.data(); int np = nors.size() / 3; if (1) { for (int i = 0; i < np; ++i) { maxlen_r = max(maxlen_r, MyUtility::normVec(p_vn + i * 3)); } cout << "maxlen_r: " << maxlen_r << endl; double ratio = maxlen / maxlen_r; for (auto &a:nors)a *= ratio; } else { for (int i = 0; i < np; ++i) { MyUtility::normalize(p_vn + i * 3); } } } bool RBF_Core::Write_Hermite_NormalPrediction(string fname, int mode) { // vector<uchar>labelcolor(npt*4); // vector<uint>f2v; // uchar red[] = {255,0,0, 255}; // uchar green[] = {0,255,0, 255}; // uchar blue[] = {0,0,255, 255}; // for(int i=0;i<labels.size();++i){ // uchar *pcolor; // if(labels[i]==0)pcolor = green; // else if(labels[i]==-1)pcolor = blue; // else if(labels[i]==1)pcolor = red; // for(int j=0;j<4;++j)labelcolor[i*4+j] = pcolor[j]; // } //fname += mp_RBF_METHOD[curMethod]; // for(int i=0;i<npt;++i){ // uchar *pcolor = green; // for(int j=0;j<4;++j)labelcolor[i*4+j] = pcolor[j]; // } vector<double> nors; if (mode == 0)nors = initnormals; else if (mode == 1)nors = newnormals; else if (mode == 2)nors = initnormals_uninorm; NormalRecification(1., nors); //for(int i=0;i<npt;++i)if(randomdouble()<0.5)MyUtility::negVec(nors.data()+i*3); //cout<<pts.size()<<' '<<f2v.size()<<' '<<nors.size()<<' '<<labelcolor.size()<<endl; //writePLYFile(fname,pts,f2v,nors,labelcolor); // writeObjFile_vn(fname,pts,nors); writePLYFile_VN(fname, pts, nors); return 1; } void RBF_Core::Set_HermiteRBF(vector<double> &pts) { int n = pts.size() / 3; cout << "Set_HermiteRBF" << endl; isHermite = true; M.set_size(n * 4, n * 4); double *p_pts = pts.data(); for (int i = 0; i < n; ++i) { for (int j = i; j < n; ++j) { M(i, j) = M(j, i) = Kernal_Function_2p(p_pts + i * 3, p_pts + j * 3); } } double G[3]; for (int i = 0; i < n; ++i) { for (int j = 0; j < n; ++j) { Kernal_Gradient_Function_2p(p_pts + i * 3, p_pts + j * 3, G); for (int k = 0; k < 3; ++k) M(n + j * 3 + k, i) = M(i, n + j * 3 + k) = G[k]; } } double H[9]; for (int i = 0; i < n; ++i) { for (int j = i; j < n; ++j) { Kernal_Hessian_Function_2p(p_pts + i * 3, p_pts + j * 3, H); for (int k = 0; k < 3; ++k) for (int l = 0; l < 3; ++l) M(n + j * 3 + l, n + i * 3 + k) = M(n + i * 3 + k, n + j * 3 + l) = -H[k * 3 + l]; } } //cout<<std::setprecision(5)<<std::fixed<<M<<endl; bsize = 4; N.zeros(n * 4, 4); for (int i = 0; i < n; ++i) { for (int j = 0; j < 3; ++j) N(i, j + 1) = pts[i * 3 + j]; N(i, 0) = 1; } for (int i = 0; i < n; ++i) { for (int j = 0; j < 3; ++j) N(n + i * 3 + j, j + 1) = -1; } //cout<<N<<endl; //arma::vec eigval = eig_sym( M ) ; //cout<<eigval.t()<<endl; // ` if (!isnewformula) { // cout << "start solve M: " << endl; // auto t1 = Clock::now(); // if (isinv) // Minv = inv(M); // else { // arma::mat Eye; // Eye.eye(npt * 4, npt * 4); // Minv = solve(M, Eye); // } // cout << "solved M: " << (invM_time = std::chrono::nanoseconds(Clock::now() - t1).count() / 1e9) << endl; // // t1 = Clock::now(); // if (isinv) // bprey = inv_sympd(N.t() * Minv * N) * N.t() * Minv; // else { // arma::mat Eye2; // Eye2.eye(bsize, bsize); // bprey = solve(N.t() * Minv * N, Eye2) * N.t() * Minv; // } // cout << "solved bprey " << std::chrono::nanoseconds(Clock::now() - t1).count() / 1e9 << endl; // } else { // // // }` } double Gaussian_2p(const double *p1, const double *p2, double sigma) { return exp(-MyUtility::vecSquareDist(p1, p2) / (2 * sigma * sigma)); } void RBF_Core::Set_Actual_User_LSCoef(double user_ls) { User_Lambda = User_Lamnbda_inject = user_ls > 0 ? user_ls : 0; } void RBF_Core::Set_Actual_Hermite_LSCoef(double hermite_ls) { ls_coef = Hermite_ls_weight_inject = hermite_ls > 0 ? hermite_ls : 0; } void RBF_Core::Set_SparsePara(double spa) { sparse_para = spa; } void RBF_Core::Set_User_Lamnda_ToMatrix(double user_ls) { { Set_Actual_User_LSCoef(user_ls); auto t1 = Clock::now(); cout << "setting J, User_Lambda" << endl; if (User_Lambda > 0) { arma::sp_mat eye; eye.eye(npt, npt); dI = inv(eye + User_Lambda * J00); saveJ_finalH = J = J11 - (User_Lambda) * (J01.t() * dI * J01); } else saveJ_finalH = J = J11; cout << "solved: " << (std::chrono::nanoseconds(Clock::now() - t1).count() / 1e9) << endl; } finalH = saveJ_finalH; } void RBF_Core::Set_HermiteApprox_Lambda(double hermite_ls) { { Set_Actual_Hermite_LSCoef(hermite_ls); auto t1 = Clock::now(); cout << "setting J, HermiteApprox_Lambda" << endl; if (ls_coef > 0) { arma::sp_mat eye; eye.eye(npt, npt); if (ls_coef > 0) { arma::mat tmpdI = inv(eye + (ls_coef + User_Lambda) * J00); J = J11 - (ls_coef + User_Lambda) * (J01.t() * tmpdI * J01); } else { J = saveJ_finalH; } } cout << "solved: " << (std::chrono::nanoseconds(Clock::now() - t1).count() / 1e9) << endl; } } void RBF_Core::Set_Hermite_PredictNormal(vector<double> &pts) { Set_HermiteRBF(pts); auto t1 = Clock::now(); cout << "setting J" << endl; if (!isnewformula) { arma::mat D = N.t() * Minv; J = Minv - D.t() * inv(D * N) * D; J = J.submat(npt, npt, npt * 4 - 1, npt * 4 - 1); finalH = saveJ_finalH = J; } else { cout << "using new formula" << endl; A.zeros((npt + 1) * 4, (npt + 1) * 4); A.submat(0, 0, npt * 4 - 1, npt * 4 - 1) = M; A.submat(0, npt * 4, (npt) * 4 - 1, (npt + 1) * 4 - 1) = N; A.submat(npt * 4, 0, (npt + 1) * 4 - 1, (npt) * 4 - 1) = N.t(); //for(int i=0;i<4;++i)A(i+(npt)*4,i+(npt)*4) = 1; auto t2 = Clock::now(); Ainv = inv(A); cout << "Ainv: " << (setK_time = std::chrono::nanoseconds(Clock::now() - t2).count() / 1e9) << endl; for (int i = 0; i < 10; i++) { for (int j = 0; j < 10; j++) { cout << setprecision(3) << Ainv(i, j) << " "; } cout << endl; } A.clear(); Minv = Ainv.submat(0, 0, npt * 4 - 1, npt * 4 - 1); Ninv = Ainv.submat(0, npt * 4, (npt) * 4 - 1, (npt + 1) * 4 - 1); // Ainv.clear(); //J = Minv - Ninv *(N.t()*Minv); J = Minv; J00 = J.submat(0, 0, npt - 1, npt - 1); J01 = J.submat(0, npt, npt - 1, npt * 4 - 1); J11 = J.submat(npt, npt, npt * 4 - 1, npt * 4 - 1); M.clear(); N.clear(); cout << "J11: " << J11.n_cols << endl; //Set_Hermite_DesignedCurve(); Set_User_Lamnda_ToMatrix(User_Lamnbda_inject); // arma::vec eigval, ny; // arma::mat eigvec; // ny = eig_sym( eigval, eigvec, J); // cout<<ny<<endl; cout << "J: " << J.n_cols << endl; } //J = ( J.t() + J )/2; cout << "solve J total: " << (setK_time = std::chrono::nanoseconds(Clock::now() - t1).count() / 1e9) << endl; return; } void RBF_Core::SetInitnormal_Uninorm() { initnormals_uninorm = initnormals; for (int i = 0; i < npt; ++i) MyUtility::normalize(initnormals_uninorm.data() + i * 3); } int RBF_Core::Solve_Hermite_PredictNormal_UnitNorm() { arma::vec eigval, ny; arma::mat eigvec; if (!isuse_sparse) { ny = eig_sym(eigval, eigvec, J); } else { // cout<<"use sparse eigen"<<endl; // int k = 4; // do{ // ny = eigs_sym( eigval, eigvec, sp_K, k, "sa" ); // k+=4; // }while(ny(0)==0); } cout << "eigval(0): " << eigval(0) << endl; int smalleig = 0; initnormals.resize(npt * 3); arma::vec y(npt * 4); for (int i = 0; i < npt; ++i) y(i) = 0; for (int i = 0; i < npt * 3; ++i) y(i + npt) = eigvec(i, smalleig); for (int i = 0; i < npt; ++i) { initnormals[i * 3] = y(npt + i * 3); initnormals[i * 3 + 1] = y(npt + i * 3 + 1); initnormals[i * 3 + 2] = y(npt + i * 3 + 2); //MyUtility::normalize(normals.data()+i*3); } SetInitnormal_Uninorm(); cout << "Solve_Hermite_PredictNormal_UnitNorm finish" << endl; return 1; } /***************************************************************************************************/ /***************************************************************************************************/ double acc_time; static int countopt = 0; double optfunc_Hermite(const vector<double> &x, vector<double> &grad, void *fdata) { auto t1 = Clock::now(); RBF_Core *drbf = reinterpret_cast<RBF_Core *>(fdata); int n = drbf->npt; arma::vec arma_x(n * 3); //( sin(a)cos(b), sin(a)sin(b), cos(a) ) a =>[0, pi], b => [-pi, pi]; vector<double> sina_cosa_sinb_cosb(n * 4); for (int i = 0; i < n; ++i) { int ind = i * 4; sina_cosa_sinb_cosb[ind] = sin(x[i * 2]); sina_cosa_sinb_cosb[ind + 1] = cos(x[i * 2]); sina_cosa_sinb_cosb[ind + 2] = sin(x[i * 2 + 1]); sina_cosa_sinb_cosb[ind + 3] = cos(x[i * 2 + 1]); } for (int i = 0; i < n; ++i) { auto p_scsc = sina_cosa_sinb_cosb.data() + i * 4; // int ind = i*3; // arma_x(ind) = p_scsc[0] * p_scsc[3]; // arma_x(ind+1) = p_scsc[0] * p_scsc[2]; // arma_x(ind+2) = p_scsc[1]; arma_x(i * 3) = p_scsc[0] * p_scsc[3]; arma_x(i * 3 + 1) = p_scsc[0] * p_scsc[2]; arma_x(i * 3 + 2) = p_scsc[1]; } arma::vec a2; //if(drbf->isuse_sparse)a2 = drbf->sp_H * arma_x; //else a2 = drbf->finalH * arma_x; if (!grad.empty()) { grad.resize(n * 2); for (int i = 0; i < n; ++i) { auto p_scsc = sina_cosa_sinb_cosb.data() + i * 4; // int ind = i*3; // grad[i*2] = a2(ind) * p_scsc[1] * p_scsc[3] + a2(ind+1) * p_scsc[1] * p_scsc[2] - a2(ind+2) * p_scsc[0]; // grad[i*2+1] = -a2(ind) * p_scsc[0] * p_scsc[2] + a2(ind+1) * p_scsc[0] * p_scsc[3]; grad[i * 2] = a2(i * 3) * p_scsc[1] * p_scsc[3] + a2(i * 3 + 1) * p_scsc[1] * p_scsc[2] - a2(i * 3 + 2) * p_scsc[0]; grad[i * 2 + 1] = -a2(i * 3) * p_scsc[0] * p_scsc[2] + a2(i * 3 + 1) * p_scsc[0] * p_scsc[3]; } } double re = arma::dot(arma_x, a2); countopt++; acc_time += (std::chrono::nanoseconds(Clock::now() - t1).count() / 1e9); //cout<<countopt++<<' '<<re<<endl; return re; } int RBF_Core::Opt_Hermite_PredictNormal_UnitNormal() { sol.solveval.resize(npt * 2); for (int i = 0; i < npt; ++i) { double *veccc = initnormals.data() + i * 3; { //MyUtility::normalize(veccc); sol.solveval[i * 2] = atan2(sqrt(veccc[0] * veccc[0] + veccc[1] * veccc[1]), veccc[2]); sol.solveval[i * 2 + 1] = atan2(veccc[1], veccc[0]); } } //cout<<"smallvec: "<<smallvec<<endl; if (1) { vector<double> upper(npt * 2); vector<double> lower(npt * 2); for (int i = 0; i < npt; ++i) { upper[i * 2] = 2 * my_PI; upper[i * 2 + 1] = 2 * my_PI; lower[i * 2] = -2 * my_PI; lower[i * 2 + 1] = -2 * my_PI; } countopt = 0; acc_time = 0; //LocalIterativeSolver(sol,kk==0?normals:newnormals,300,1e-7); Solver::nloptwrapper(lower, upper, optfunc_Hermite, this, 1e-7, 3000, sol); cout << "number of call: " << countopt << " t: " << acc_time << " ave: " << acc_time / countopt << endl; callfunc_time = acc_time; solve_time = sol.time; //for(int i=0;i<npt;++i)cout<< sol.solveval[i]<<' ';cout<<endl; } newnormals.resize(npt * 3); arma::vec y(npt * 4); for (int i = 0; i < npt; ++i) y(i) = 0; for (int i = 0; i < npt; ++i) { double a = sol.solveval[i * 2], b = sol.solveval[i * 2 + 1]; newnormals[i * 3] = y(npt + i * 3) = sin(a) * cos(b); newnormals[i * 3 + 1] = y(npt + i * 3 + 1) = sin(a) * sin(b); newnormals[i * 3 + 2] = y(npt + i * 3 + 2) = cos(a); MyUtility::normalize(newnormals.data() + i * 3); } Set_RBFCoef(y); //sol.energy = arma::dot(a,M*a); cout << "Opt_Hermite_PredictNormal_UnitNormal" << endl; return 1; } void RBF_Core::Set_RBFCoef(arma::vec &y) { cout << "Set_RBFCoef" << endl; if (curMethod == HandCraft) { cout << "HandCraft, not RBF" << endl; return; } if (!isnewformula) { b = bprey * y; a = Minv * (y - N * b); } else { if (User_Lambda > 0) y.subvec(0, npt - 1) = -User_Lambda * dI * J01 * y.subvec(npt, npt * 4 - 1); a = Minv * y; b = Ninv.t() * y; } } int RBF_Core::Lambda_Search_GlobalEigen() { // vector<double> lambda_list({0.01}); vector<double> lambda_list({0.001, 0.01, 0.1, 1}); //vector<double>lambda_list({ 0.5,0.6,0.7,0.8,0.9,1,1.1,1.5,2,3}); //lambda_list.clear(); //for(double i=1.5;i<2.5;i+=0.1)lambda_list.push_back(i); //vector<double>lambda_list({0}); vector<double> initen_list(lambda_list.size()); vector<double> finalen_list(lambda_list.size()); vector<vector<double>> init_normallist; vector<vector<double>> opt_normallist; lamnbda_list_sa = lambda_list; for (int i = 0; i < lambda_list.size(); ++i) { Set_HermiteApprox_Lambda(lambda_list[i]); if (curMethod == Hermite_UnitNormal) { Solve_Hermite_PredictNormal_UnitNorm(); } //Solve_Hermite_PredictNormal_UnitNorm(); OptNormal(1); initen_list[i] = sol.init_energy; finalen_list[i] = sol.energy; init_normallist.emplace_back(initnormals); opt_normallist.emplace_back(newnormals); } lamnbdaGlobal_Be.emplace_back(initen_list); lamnbdaGlobal_Ed.emplace_back(finalen_list); cout << std::setprecision(8); for (int i = 0; i < initen_list.size(); ++i) { cout << lambda_list[i] << ": " << initen_list[i] << " -> " << finalen_list[i] << endl; } int minind = min_element(finalen_list.begin(), finalen_list.end()) - finalen_list.begin(); cout << "min energy: " << endl; cout << lambda_list[minind] << ": " << initen_list[minind] << " -> " << finalen_list[minind] << endl; initnormals = init_normallist[minind]; SetInitnormal_Uninorm(); newnormals = opt_normallist[minind]; return 1; } void RBF_Core::Print_LamnbdaSearchTest(string fname) { cout << setprecision(7); cout << "Print_LamnbdaSearchTest" << endl; for (int i = 0; i < lamnbda_list_sa.size(); ++i)cout << lamnbda_list_sa[i] << ' '; cout << endl; cout << lamnbdaGlobal_Be.size() << endl; for (int i = 0; i < lamnbdaGlobal_Be.size(); ++i) { for (int j = 0; j < lamnbdaGlobal_Be[i].size(); ++j) { cout << lamnbdaGlobal_Be[i][j] << "\t" << lamnbdaGlobal_Ed[i][j] << "\t"; } cout << gtBe[i] << "\t" << gtEd[i] << endl; } ofstream fout(fname); fout << setprecision(7); if (!fout.fail()) { for (int i = 0; i < lamnbda_list_sa.size(); ++i)fout << lamnbda_list_sa[i] << ' '; fout << endl; fout << lamnbdaGlobal_Be.size() << endl; for (int i = 0; i < lamnbdaGlobal_Be.size(); ++i) { for (int j = 0; j < lamnbdaGlobal_Be[i].size(); ++j) { fout << lamnbdaGlobal_Be[i][j] << "\t" << lamnbdaGlobal_Ed[i][j] << "\t"; } fout << gtBe[i] << "\t" << gtEd[i] << endl; } } fout.close(); }
29.679443
130
0.494247
[ "vector" ]
be4256d5329894044beae678ed1b0946157fe1ba
3,061
cpp
C++
chres/chres.cpp
xKippi/chres
1a8f05096404f0de0dabe07e0f71bb893cb9a759
[ "Apache-2.0" ]
null
null
null
chres/chres.cpp
xKippi/chres
1a8f05096404f0de0dabe07e0f71bb893cb9a759
[ "Apache-2.0" ]
null
null
null
chres/chres.cpp
xKippi/chres
1a8f05096404f0de0dabe07e0f71bb893cb9a759
[ "Apache-2.0" ]
null
null
null
#include "stdafx.h" #include "chres.h" #include <stdio.h> #include <winuser.h> #include <iostream> #include <fstream> #include <sstream> #include <vector> #pragma warning(disable : 4996) void GetCurrentResolution(unsigned int& horizontal, unsigned int& vertical) { DEVMODE dm; //Getting current display settings and write them into the dm variable EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &dm); horizontal = dm.dmPelsWidth; vertical = dm.dmPelsHeight; } //Splits a string using char as delimeter std::vector<std::string> split(std::string strToSplit, char delimeter) { std::stringstream ss(strToSplit); std::string item; std::vector<std::string> splittedStrings; while (std::getline(ss, item, delimeter)) { splittedStrings.push_back(item); } return splittedStrings; } //Reads a whole file and returns it as string std::string slurp(std::ifstream& in) { return static_cast<std::stringstream const&>(std::stringstream() << in.rdbuf()).str(); } //Checks if the specified file exists inline bool fileExists(const std::string& name) { std::ifstream f(name.c_str()); return f.good(); } //This is the main method, the method which will be called when the program is run int APIENTRY wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _In_ LPWSTR lpCmdLine, _In_ int nCmdShow) { std::string tmpfile = getenv("temp"); tmpfile.append("\\chres.tmp"); std::string conf; std::string confFile = getenv("appdata"); confFile.append("\\chres.conf"); unsigned int width, heigth; GetCurrentResolution(width, heigth); conf += std::to_string(width) + "x" + std::to_string(heigth) + "\n1280x800"; //if config does not exist create config, else read config if (!fileExists(confFile)) { //create config std::ofstream confStream; confStream.open(confFile); confStream << conf; confStream.close(); } else { //read config std::ifstream confStream; confStream.open(confFile); conf = slurp(confStream); confStream.close(); } //Parse config std::vector<std::string> splitStr = split(conf, '\n'); std::vector<std::string> values; if (fileExists(tmpfile)) { values = split(*splitStr.begin(), 'x'); remove(tmpfile.c_str()); } else { values = split(*++splitStr.begin(), 'x'); std::ofstream outfile; outfile.open(tmpfile); outfile << '\x01'; outfile.close(); } width = stoi(*values.begin()); heigth = stoi(*++values.begin()); DEVMODE dm, maxdm; maxdm.dmDisplayFrequency = 0; for (int i = 0; EnumDisplaySettings(NULL, i, &dm); i++) { //Get the display with the rigth resolution and the highest Frequency if (dm.dmPelsWidth == width && dm.dmPelsHeight == heigth && dm.dmDisplayFrequency > maxdm.dmDisplayFrequency) maxdm = dm; //std::cout << dm.dmPelsWidth << "x" << dm.dmPelsHeight << " @ " << dm.dmDisplayFrequency << "Hz, " << dm.dmBitsPerPel << " " << dm.dmDisplayFlags << "\n"; } ChangeDisplaySettings(&maxdm, 0); return 0; }
26.162393
160
0.669389
[ "vector" ]
be4a561f79f8b4e753b86e1db1e86dda43babd0e
3,422
cpp
C++
source/specfun.cpp
cet-ivan/cppexts
bc57045cafecfadcf3c5e3c1ac4896b79028b97a
[ "BSL-1.0" ]
null
null
null
source/specfun.cpp
cet-ivan/cppexts
bc57045cafecfadcf3c5e3c1ac4896b79028b97a
[ "BSL-1.0" ]
null
null
null
source/specfun.cpp
cet-ivan/cppexts
bc57045cafecfadcf3c5e3c1ac4896b79028b97a
[ "BSL-1.0" ]
null
null
null
// Copyright Ivan Stanojevic 2010. // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) #include "specfun.h" #include "qde.h" // *** STIRLING_NUMBER_OF_1ST_KIND *** // pre: n >= 0, 0 <= k <= n exint stirling_number_of_1st_kind ( sint n, sint k ) { assert ( n >= 0 ) ; assert ( k >= 0 ) ; assert ( k <= n ) ; static vector < vector < exint > > data ( 1, vector < exint > ( 1, 1 ) ) ; while ( data.size ( ) <= n ) { data.push_back ( vector < exint > ( ) ) ; const vector < exint > & dn_1 = * ( data.end ( ) - 2 ) ; vector < exint > & dn = * ( data.end ( ) - 1 ) ; dn.reserve ( data.size ( ) ) ; dn.push_back ( exint ( ) ) ; sint s = data.size ( ) - 2 ; exint t ( s ) ; for ( sint i = 0 ; i < s ; ++ i ) dn.push_back ( dn_1 [ i ] - t * dn_1 [ i + 1 ] ) ; dn.push_back ( exint ( 1 ) ) ; } return data [ n ] [ k ] ; } // *** BERNOULLI NUMBER *** // pre: n >= 0 fraction < exint > bernoulli_number ( sint n ) { class local_data : public vector < fraction < exint > > { public: local_data ( ) { push_back ( 1 ) ; push_back ( fraction < exint > ( -1, 2 ) ) ; push_back ( fraction < exint > ( 1, 6 ) ) ; } } ; assert ( n >= 0 ) ; static local_data data ; while ( data.size ( ) <= n ) if ( ( data.size ( ) & 1 ) != 0 ) data.push_back ( 0 ) ; else { fraction < exint > s ; exint f ( 1 ) ; for ( sint i = 0 ; i < data.size ( ) ; ++ i ) { s += f * data [ i ] ; f *= data.size ( ) + 1 - i ; f /= i + 1 ; } data.push_back ( - s / ( data.size ( ) + 1 ) ) ; } return data [ n ] ; } // *** GAMMA_ASYMPTOTIC_SERIES_COEFFICIENT *** // pre: n >= 0 fraction < exint > gamma_asymptotic_series_coefficient ( sint n ) { assert ( n >= 0 ) ; static vector < fraction < exint > > data ( 2, 1 ) ; while ( data.size ( ) <= ( n << 1 ) + 1 ) { fraction < exint > t ( data.back ( ) ) ; for ( sint i = 2 ; i < data.size ( ) ; ++ i ) t -= i * data [ i ] * data [ data.size ( ) + 1 - i ] ; data.push_back ( t / ( data.size ( ) + 1 ) ) ; } static exint factor ( 1 ) ; static vector < fraction < exint > > scaled_data ; while ( scaled_data.size ( ) <= n ) { sint i = ( scaled_data.size ( ) << 1 ) + 1 ; factor *= i ; scaled_data.push_back ( factor * data [ i ] ) ; } return scaled_data [ n ] ; } // *** GAMMA_CONTINUED_FRACTION_COEFFICIENT *** // pre: n >= 0 fraction < exint > gamma_continued_fraction_coefficient ( sint n ) { assert ( n >= 0 ) ; static quotient_difference_evaluator < fraction < exint > > qde ; while ( qde.data ( ).size ( ) <= n ) { fraction < exint > c ( gamma_asymptotic_series_coefficient ( qde.data ( ).size ( ) + 1 ) ) ; if ( ( qde.data ( ).size ( ) & 1 ) != 0 ) c.negate ( ) ; qde.step ( c ) ; } return qde.data ( ) [ n ] ; } // *** LOG_GAMMA_CONTINUED_FRACTION_COEFFICIENT *** // pre: n >= 0 fraction < exint > log_gamma_continued_fraction_coefficient ( sint n ) { assert ( n >= 0 ) ; static quotient_difference_evaluator < fraction < exint > > qde ; while ( qde.data ( ).size ( ) <= n ) { fraction < exint > c ( log_gamma_asymptotic_series_coefficient ( qde.data ( ).size ( ) ) ) ; if ( ( qde.data ( ).size ( ) & 1 ) != 0 ) c.negate ( ) ; qde.step ( c ) ; } return qde.data ( ) [ n ] ; }
18.010526
77
0.526885
[ "vector" ]
be4dcd4585593f3b5c8d4327c14f4c180135b860
1,033,703
cpp
C++
cisco-ios-xr/ydk/models/cisco_ios_xr/fragmented/Cisco_IOS_XR_pmengine_oper_12.cpp
CiscoDevNet/ydk-cpp
ef7d75970f2ef1154100e0f7b0a2ee823609b481
[ "ECL-2.0", "Apache-2.0" ]
17
2016-12-02T05:45:49.000Z
2022-02-10T19:32:54.000Z
cisco-ios-xr/ydk/models/cisco_ios_xr/fragmented/Cisco_IOS_XR_pmengine_oper_12.cpp
CiscoDevNet/ydk-cpp
ef7d75970f2ef1154100e0f7b0a2ee823609b481
[ "ECL-2.0", "Apache-2.0" ]
2
2017-03-27T15:22:38.000Z
2019-11-05T08:30:16.000Z
cisco-ios-xr/ydk/models/cisco_ios_xr/fragmented/Cisco_IOS_XR_pmengine_oper_12.cpp
CiscoDevNet/ydk-cpp
ef7d75970f2ef1154100e0f7b0a2ee823609b481
[ "ECL-2.0", "Apache-2.0" ]
11
2016-12-02T05:45:52.000Z
2019-11-07T08:28:17.000Z
#include <sstream> #include <iostream> #include <ydk/entity_util.hpp> #include "bundle_info.hpp" #include "generated_entity_lookup.hpp" #include "Cisco_IOS_XR_pmengine_oper_12.hpp" #include "Cisco_IOS_XR_pmengine_oper_13.hpp" using namespace ydk; namespace cisco_ios_xr { namespace Cisco_IOS_XR_pmengine_oper { PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InMibcrc::InMibcrc() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "in-mibcrc"; yang_parent_name = "macsec-minute15-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InMibcrc::~InMibcrc() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InMibcrc::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InMibcrc::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InMibcrc::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "in-mibcrc"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InMibcrc::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InMibcrc::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InMibcrc::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InMibcrc::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InMibcrc::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InMibcrc::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InErrorCollisions::InErrorCollisions() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "in-error-collisions"; yang_parent_name = "macsec-minute15-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InErrorCollisions::~InErrorCollisions() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InErrorCollisions::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InErrorCollisions::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InErrorCollisions::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "in-error-collisions"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InErrorCollisions::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InErrorCollisions::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InErrorCollisions::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InErrorCollisions::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InErrorCollisions::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InErrorCollisions::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InErrorSymbol::InErrorSymbol() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "in-error-symbol"; yang_parent_name = "macsec-minute15-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InErrorSymbol::~InErrorSymbol() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InErrorSymbol::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InErrorSymbol::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InErrorSymbol::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "in-error-symbol"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InErrorSymbol::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InErrorSymbol::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InErrorSymbol::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InErrorSymbol::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InErrorSymbol::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InErrorSymbol::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutGoodBytes::OutGoodBytes() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "out-good-bytes"; yang_parent_name = "macsec-minute15-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutGoodBytes::~OutGoodBytes() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutGoodBytes::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutGoodBytes::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutGoodBytes::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "out-good-bytes"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutGoodBytes::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutGoodBytes::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutGoodBytes::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutGoodBytes::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutGoodBytes::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutGoodBytes::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::Out8021qFrames::Out8021qFrames() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "out8021q-frames"; yang_parent_name = "macsec-minute15-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::Out8021qFrames::~Out8021qFrames() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::Out8021qFrames::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::Out8021qFrames::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::Out8021qFrames::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "out8021q-frames"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::Out8021qFrames::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::Out8021qFrames::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::Out8021qFrames::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::Out8021qFrames::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::Out8021qFrames::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::Out8021qFrames::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutPauseFrames::OutPauseFrames() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "out-pause-frames"; yang_parent_name = "macsec-minute15-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutPauseFrames::~OutPauseFrames() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutPauseFrames::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutPauseFrames::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutPauseFrames::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "out-pause-frames"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutPauseFrames::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutPauseFrames::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutPauseFrames::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutPauseFrames::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutPauseFrames::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutPauseFrames::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutPkts1519MaxOctets::OutPkts1519MaxOctets() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "out-pkts1519-max-octets"; yang_parent_name = "macsec-minute15-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutPkts1519MaxOctets::~OutPkts1519MaxOctets() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutPkts1519MaxOctets::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutPkts1519MaxOctets::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutPkts1519MaxOctets::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "out-pkts1519-max-octets"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutPkts1519MaxOctets::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutPkts1519MaxOctets::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutPkts1519MaxOctets::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutPkts1519MaxOctets::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutPkts1519MaxOctets::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutPkts1519MaxOctets::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutGoodPkts::OutGoodPkts() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "out-good-pkts"; yang_parent_name = "macsec-minute15-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutGoodPkts::~OutGoodPkts() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutGoodPkts::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutGoodPkts::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutGoodPkts::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "out-good-pkts"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutGoodPkts::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutGoodPkts::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutGoodPkts::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutGoodPkts::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutGoodPkts::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutGoodPkts::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutDropUnderrun::OutDropUnderrun() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "out-drop-underrun"; yang_parent_name = "macsec-minute15-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutDropUnderrun::~OutDropUnderrun() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutDropUnderrun::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutDropUnderrun::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutDropUnderrun::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "out-drop-underrun"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutDropUnderrun::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutDropUnderrun::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutDropUnderrun::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutDropUnderrun::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutDropUnderrun::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutDropUnderrun::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutDropAbort::OutDropAbort() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "out-drop-abort"; yang_parent_name = "macsec-minute15-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutDropAbort::~OutDropAbort() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutDropAbort::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutDropAbort::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutDropAbort::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "out-drop-abort"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutDropAbort::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutDropAbort::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutDropAbort::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutDropAbort::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutDropAbort::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutDropAbort::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutDropOther::OutDropOther() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "out-drop-other"; yang_parent_name = "macsec-minute15-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutDropOther::~OutDropOther() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutDropOther::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutDropOther::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutDropOther::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "out-drop-other"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutDropOther::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutDropOther::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutDropOther::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutDropOther::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutDropOther::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutDropOther::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutErrorOther::OutErrorOther() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "out-error-other"; yang_parent_name = "macsec-minute15-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutErrorOther::~OutErrorOther() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutErrorOther::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutErrorOther::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutErrorOther::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "out-error-other"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutErrorOther::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutErrorOther::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutErrorOther::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutErrorOther::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutErrorOther::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutErrorOther::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InErrorGiant::InErrorGiant() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "in-error-giant"; yang_parent_name = "macsec-minute15-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InErrorGiant::~InErrorGiant() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InErrorGiant::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InErrorGiant::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InErrorGiant::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "in-error-giant"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InErrorGiant::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InErrorGiant::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InErrorGiant::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InErrorGiant::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InErrorGiant::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InErrorGiant::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InErrorRunt::InErrorRunt() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "in-error-runt"; yang_parent_name = "macsec-minute15-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InErrorRunt::~InErrorRunt() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InErrorRunt::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InErrorRunt::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InErrorRunt::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "in-error-runt"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InErrorRunt::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InErrorRunt::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InErrorRunt::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InErrorRunt::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InErrorRunt::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InErrorRunt::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InErrorJabbers::InErrorJabbers() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "in-error-jabbers"; yang_parent_name = "macsec-minute15-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InErrorJabbers::~InErrorJabbers() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InErrorJabbers::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InErrorJabbers::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InErrorJabbers::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "in-error-jabbers"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InErrorJabbers::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InErrorJabbers::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InErrorJabbers::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InErrorJabbers::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InErrorJabbers::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InErrorJabbers::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InErrorFragments::InErrorFragments() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "in-error-fragments"; yang_parent_name = "macsec-minute15-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InErrorFragments::~InErrorFragments() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InErrorFragments::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InErrorFragments::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InErrorFragments::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "in-error-fragments"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InErrorFragments::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InErrorFragments::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InErrorFragments::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InErrorFragments::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InErrorFragments::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InErrorFragments::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InErrorOther::InErrorOther() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "in-error-other"; yang_parent_name = "macsec-minute15-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InErrorOther::~InErrorOther() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InErrorOther::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InErrorOther::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InErrorOther::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "in-error-other"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InErrorOther::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InErrorOther::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InErrorOther::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InErrorOther::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InErrorOther::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InErrorOther::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InPkt64Octet::InPkt64Octet() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "in-pkt64-octet"; yang_parent_name = "macsec-minute15-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InPkt64Octet::~InPkt64Octet() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InPkt64Octet::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InPkt64Octet::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InPkt64Octet::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "in-pkt64-octet"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InPkt64Octet::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InPkt64Octet::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InPkt64Octet::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InPkt64Octet::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InPkt64Octet::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InPkt64Octet::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InPkts65To127Octets::InPkts65To127Octets() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "in-pkts65-to127-octets"; yang_parent_name = "macsec-minute15-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InPkts65To127Octets::~InPkts65To127Octets() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InPkts65To127Octets::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InPkts65To127Octets::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InPkts65To127Octets::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "in-pkts65-to127-octets"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InPkts65To127Octets::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InPkts65To127Octets::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InPkts65To127Octets::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InPkts65To127Octets::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InPkts65To127Octets::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InPkts65To127Octets::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InPkts128To255Octets::InPkts128To255Octets() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "in-pkts128-to255-octets"; yang_parent_name = "macsec-minute15-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InPkts128To255Octets::~InPkts128To255Octets() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InPkts128To255Octets::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InPkts128To255Octets::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InPkts128To255Octets::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "in-pkts128-to255-octets"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InPkts128To255Octets::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InPkts128To255Octets::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InPkts128To255Octets::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InPkts128To255Octets::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InPkts128To255Octets::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InPkts128To255Octets::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InPkts256To511Octets::InPkts256To511Octets() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "in-pkts256-to511-octets"; yang_parent_name = "macsec-minute15-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InPkts256To511Octets::~InPkts256To511Octets() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InPkts256To511Octets::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InPkts256To511Octets::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InPkts256To511Octets::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "in-pkts256-to511-octets"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InPkts256To511Octets::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InPkts256To511Octets::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InPkts256To511Octets::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InPkts256To511Octets::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InPkts256To511Octets::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InPkts256To511Octets::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InPkts512To1023Octets::InPkts512To1023Octets() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "in-pkts512-to1023-octets"; yang_parent_name = "macsec-minute15-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InPkts512To1023Octets::~InPkts512To1023Octets() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InPkts512To1023Octets::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InPkts512To1023Octets::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InPkts512To1023Octets::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "in-pkts512-to1023-octets"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InPkts512To1023Octets::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InPkts512To1023Octets::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InPkts512To1023Octets::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InPkts512To1023Octets::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InPkts512To1023Octets::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InPkts512To1023Octets::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InPkts1024To1518Octets::InPkts1024To1518Octets() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "in-pkts1024-to1518-octets"; yang_parent_name = "macsec-minute15-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InPkts1024To1518Octets::~InPkts1024To1518Octets() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InPkts1024To1518Octets::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InPkts1024To1518Octets::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InPkts1024To1518Octets::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "in-pkts1024-to1518-octets"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InPkts1024To1518Octets::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InPkts1024To1518Octets::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InPkts1024To1518Octets::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InPkts1024To1518Octets::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InPkts1024To1518Octets::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::InPkts1024To1518Octets::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::Outpkt64octet::Outpkt64octet() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "outpkt64octet"; yang_parent_name = "macsec-minute15-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::Outpkt64octet::~Outpkt64octet() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::Outpkt64octet::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::Outpkt64octet::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::Outpkt64octet::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "outpkt64octet"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::Outpkt64octet::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::Outpkt64octet::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::Outpkt64octet::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::Outpkt64octet::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::Outpkt64octet::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::Outpkt64octet::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutPkts65127Octets::OutPkts65127Octets() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "out-pkts65127-octets"; yang_parent_name = "macsec-minute15-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutPkts65127Octets::~OutPkts65127Octets() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutPkts65127Octets::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutPkts65127Octets::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutPkts65127Octets::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "out-pkts65127-octets"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutPkts65127Octets::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutPkts65127Octets::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutPkts65127Octets::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutPkts65127Octets::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutPkts65127Octets::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutPkts65127Octets::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutPkts128255Octets::OutPkts128255Octets() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "out-pkts128255-octets"; yang_parent_name = "macsec-minute15-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutPkts128255Octets::~OutPkts128255Octets() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutPkts128255Octets::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutPkts128255Octets::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutPkts128255Octets::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "out-pkts128255-octets"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutPkts128255Octets::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutPkts128255Octets::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutPkts128255Octets::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutPkts128255Octets::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutPkts128255Octets::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutPkts128255Octets::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutPkts256511Octets::OutPkts256511Octets() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "out-pkts256511-octets"; yang_parent_name = "macsec-minute15-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutPkts256511Octets::~OutPkts256511Octets() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutPkts256511Octets::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutPkts256511Octets::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutPkts256511Octets::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "out-pkts256511-octets"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutPkts256511Octets::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutPkts256511Octets::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutPkts256511Octets::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutPkts256511Octets::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutPkts256511Octets::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutPkts256511Octets::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutPkts5121023Octets::OutPkts5121023Octets() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "out-pkts5121023-octets"; yang_parent_name = "macsec-minute15-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutPkts5121023Octets::~OutPkts5121023Octets() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutPkts5121023Octets::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutPkts5121023Octets::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutPkts5121023Octets::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "out-pkts5121023-octets"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutPkts5121023Octets::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutPkts5121023Octets::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutPkts5121023Octets::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutPkts5121023Octets::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutPkts5121023Octets::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutPkts5121023Octets::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutPkts10241518Octets::OutPkts10241518Octets() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "out-pkts10241518-octets"; yang_parent_name = "macsec-minute15-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutPkts10241518Octets::~OutPkts10241518Octets() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutPkts10241518Octets::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutPkts10241518Octets::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutPkts10241518Octets::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "out-pkts10241518-octets"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutPkts10241518Octets::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutPkts10241518Octets::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutPkts10241518Octets::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutPkts10241518Octets::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutPkts10241518Octets::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::OutPkts10241518Octets::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::RxUtil::RxUtil() : data{YType::str, "data"}, threshold{YType::str, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "rx-util"; yang_parent_name = "macsec-minute15-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::RxUtil::~RxUtil() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::RxUtil::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::RxUtil::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::RxUtil::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "rx-util"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::RxUtil::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::RxUtil::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::RxUtil::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::RxUtil::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::RxUtil::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::RxUtil::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::TxUtil::TxUtil() : data{YType::str, "data"}, threshold{YType::str, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "tx-util"; yang_parent_name = "macsec-minute15-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::TxUtil::~TxUtil() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::TxUtil::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::TxUtil::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::TxUtil::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "tx-util"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::TxUtil::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::TxUtil::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::TxUtil::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::TxUtil::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::TxUtil::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::TxUtil::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::TxUndersizedPkt::TxUndersizedPkt() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "tx-undersized-pkt"; yang_parent_name = "macsec-minute15-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::TxUndersizedPkt::~TxUndersizedPkt() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::TxUndersizedPkt::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::TxUndersizedPkt::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::TxUndersizedPkt::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "tx-undersized-pkt"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::TxUndersizedPkt::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::TxUndersizedPkt::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::TxUndersizedPkt::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::TxUndersizedPkt::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::TxUndersizedPkt::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::TxUndersizedPkt::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::TxOversizedPkt::TxOversizedPkt() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "tx-oversized-pkt"; yang_parent_name = "macsec-minute15-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::TxOversizedPkt::~TxOversizedPkt() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::TxOversizedPkt::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::TxOversizedPkt::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::TxOversizedPkt::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "tx-oversized-pkt"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::TxOversizedPkt::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::TxOversizedPkt::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::TxOversizedPkt::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::TxOversizedPkt::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::TxOversizedPkt::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::TxOversizedPkt::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::TxFragments::TxFragments() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "tx-fragments"; yang_parent_name = "macsec-minute15-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::TxFragments::~TxFragments() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::TxFragments::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::TxFragments::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::TxFragments::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "tx-fragments"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::TxFragments::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::TxFragments::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::TxFragments::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::TxFragments::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::TxFragments::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::TxFragments::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::TxJabber::TxJabber() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "tx-jabber"; yang_parent_name = "macsec-minute15-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::TxJabber::~TxJabber() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::TxJabber::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::TxJabber::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::TxJabber::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "tx-jabber"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::TxJabber::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::TxJabber::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::TxJabber::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::TxJabber::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::TxJabber::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::TxJabber::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::TxBadFcs::TxBadFcs() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "tx-bad-fcs"; yang_parent_name = "macsec-minute15-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::TxBadFcs::~TxBadFcs() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::TxBadFcs::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::TxBadFcs::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::TxBadFcs::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "tx-bad-fcs"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::TxBadFcs::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::TxBadFcs::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::TxBadFcs::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::TxBadFcs::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::TxBadFcs::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15EtherHistories::MacsecMinute15EtherHistory::MacsecMinute15EtherTimeLineInstances::MacsecMinute15EtherTimeLineInstance::TxBadFcs::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::MacsecMinute15secytxHistories() : macsec_minute15secytx_history(this, {"number"}) { yang_name = "macsec-minute15secytx-histories"; yang_parent_name = "macsec-minute15-history"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::~MacsecMinute15secytxHistories() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<macsec_minute15secytx_history.len(); index++) { if(macsec_minute15secytx_history[index]->has_data()) return true; } return false; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::has_operation() const { for (std::size_t index=0; index<macsec_minute15secytx_history.len(); index++) { if(macsec_minute15secytx_history[index]->has_operation()) return true; } return is_set(yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "macsec-minute15secytx-histories"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "macsec-minute15secytx-history") { auto ent_ = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::MacsecMinute15secytxHistory>(); ent_->parent = this; macsec_minute15secytx_history.append(ent_); return ent_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; count_ = 0; for (auto ent_ : macsec_minute15secytx_history.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 PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::set_filter(const std::string & value_path, YFilter yfilter) { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::has_leaf_or_child_of_name(const std::string & name) const { if(name == "macsec-minute15secytx-history") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::MacsecMinute15secytxHistory::MacsecMinute15secytxHistory() : number{YType::uint32, "number"} , macsec_minute15secytx_time_line_instances(std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::MacsecMinute15secytxHistory::MacsecMinute15secytxTimeLineInstances>()) { macsec_minute15secytx_time_line_instances->parent = this; yang_name = "macsec-minute15secytx-history"; yang_parent_name = "macsec-minute15secytx-histories"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::MacsecMinute15secytxHistory::~MacsecMinute15secytxHistory() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::MacsecMinute15secytxHistory::has_data() const { if (is_presence_container) return true; return number.is_set || (macsec_minute15secytx_time_line_instances != nullptr && macsec_minute15secytx_time_line_instances->has_data()); } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::MacsecMinute15secytxHistory::has_operation() const { return is_set(yfilter) || ydk::is_set(number.yfilter) || (macsec_minute15secytx_time_line_instances != nullptr && macsec_minute15secytx_time_line_instances->has_operation()); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::MacsecMinute15secytxHistory::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "macsec-minute15secytx-history"; ADD_KEY_TOKEN(number, "number"); return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::MacsecMinute15secytxHistory::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (number.is_set || is_set(number.yfilter)) leaf_name_data.push_back(number.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::MacsecMinute15secytxHistory::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "macsec-minute15secytx-time-line-instances") { if(macsec_minute15secytx_time_line_instances == nullptr) { macsec_minute15secytx_time_line_instances = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::MacsecMinute15secytxHistory::MacsecMinute15secytxTimeLineInstances>(); } return macsec_minute15secytx_time_line_instances; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::MacsecMinute15secytxHistory::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; if(macsec_minute15secytx_time_line_instances != nullptr) { _children["macsec-minute15secytx-time-line-instances"] = macsec_minute15secytx_time_line_instances; } return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::MacsecMinute15secytxHistory::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 == "number") { number = value; number.value_namespace = name_space; number.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::MacsecMinute15secytxHistory::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "number") { number.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::MacsecMinute15secytxHistory::has_leaf_or_child_of_name(const std::string & name) const { if(name == "macsec-minute15secytx-time-line-instances" || name == "number") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::MacsecMinute15secytxHistory::MacsecMinute15secytxTimeLineInstances::MacsecMinute15secytxTimeLineInstances() : macsec_minute15secytx_time_line_instance(this, {"number"}) { yang_name = "macsec-minute15secytx-time-line-instances"; yang_parent_name = "macsec-minute15secytx-history"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::MacsecMinute15secytxHistory::MacsecMinute15secytxTimeLineInstances::~MacsecMinute15secytxTimeLineInstances() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::MacsecMinute15secytxHistory::MacsecMinute15secytxTimeLineInstances::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<macsec_minute15secytx_time_line_instance.len(); index++) { if(macsec_minute15secytx_time_line_instance[index]->has_data()) return true; } return false; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::MacsecMinute15secytxHistory::MacsecMinute15secytxTimeLineInstances::has_operation() const { for (std::size_t index=0; index<macsec_minute15secytx_time_line_instance.len(); index++) { if(macsec_minute15secytx_time_line_instance[index]->has_operation()) return true; } return is_set(yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::MacsecMinute15secytxHistory::MacsecMinute15secytxTimeLineInstances::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "macsec-minute15secytx-time-line-instances"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::MacsecMinute15secytxHistory::MacsecMinute15secytxTimeLineInstances::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::MacsecMinute15secytxHistory::MacsecMinute15secytxTimeLineInstances::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "macsec-minute15secytx-time-line-instance") { auto ent_ = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::MacsecMinute15secytxHistory::MacsecMinute15secytxTimeLineInstances::MacsecMinute15secytxTimeLineInstance>(); ent_->parent = this; macsec_minute15secytx_time_line_instance.append(ent_); return ent_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::MacsecMinute15secytxHistory::MacsecMinute15secytxTimeLineInstances::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; count_ = 0; for (auto ent_ : macsec_minute15secytx_time_line_instance.entities()) { if(_children.find(ent_->get_segment_path()) == _children.end()) _children[ent_->get_segment_path()] = ent_; else _children[ent_->get_segment_path()+count_++] = ent_; } return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::MacsecMinute15secytxHistory::MacsecMinute15secytxTimeLineInstances::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::MacsecMinute15secytxHistory::MacsecMinute15secytxTimeLineInstances::set_filter(const std::string & value_path, YFilter yfilter) { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::MacsecMinute15secytxHistory::MacsecMinute15secytxTimeLineInstances::has_leaf_or_child_of_name(const std::string & name) const { if(name == "macsec-minute15secytx-time-line-instance") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::MacsecMinute15secytxHistory::MacsecMinute15secytxTimeLineInstances::MacsecMinute15secytxTimeLineInstance::MacsecMinute15secytxTimeLineInstance() : number{YType::uint32, "number"}, index_{YType::uint32, "index"}, valid{YType::boolean, "valid"}, timestamp{YType::str, "timestamp"}, last_clear_time{YType::str, "last-clear-time"}, last_clear15_min_time{YType::str, "last-clear15-min-time"}, last_clear30_sec_time{YType::str, "last-clear30-sec-time"}, last_clear24_hr_time{YType::str, "last-clear24-hr-time"}, sec30_support{YType::boolean, "sec30-support"}, sample_count{YType::uint64, "sample-count"} , out_pkts_protected(std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::MacsecMinute15secytxHistory::MacsecMinute15secytxTimeLineInstances::MacsecMinute15secytxTimeLineInstance::OutPktsProtected>()) , out_pkts_encrypted(std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::MacsecMinute15secytxHistory::MacsecMinute15secytxTimeLineInstances::MacsecMinute15secytxTimeLineInstance::OutPktsEncrypted>()) , out_octets_protected(std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::MacsecMinute15secytxHistory::MacsecMinute15secytxTimeLineInstances::MacsecMinute15secytxTimeLineInstance::OutOctetsProtected>()) , out_octets_encrypted(std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::MacsecMinute15secytxHistory::MacsecMinute15secytxTimeLineInstances::MacsecMinute15secytxTimeLineInstance::OutOctetsEncrypted>()) , out_pkts_too_long(std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::MacsecMinute15secytxHistory::MacsecMinute15secytxTimeLineInstances::MacsecMinute15secytxTimeLineInstance::OutPktsTooLong>()) { out_pkts_protected->parent = this; out_pkts_encrypted->parent = this; out_octets_protected->parent = this; out_octets_encrypted->parent = this; out_pkts_too_long->parent = this; yang_name = "macsec-minute15secytx-time-line-instance"; yang_parent_name = "macsec-minute15secytx-time-line-instances"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::MacsecMinute15secytxHistory::MacsecMinute15secytxTimeLineInstances::MacsecMinute15secytxTimeLineInstance::~MacsecMinute15secytxTimeLineInstance() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::MacsecMinute15secytxHistory::MacsecMinute15secytxTimeLineInstances::MacsecMinute15secytxTimeLineInstance::has_data() const { if (is_presence_container) return true; return number.is_set || index_.is_set || valid.is_set || timestamp.is_set || last_clear_time.is_set || last_clear15_min_time.is_set || last_clear30_sec_time.is_set || last_clear24_hr_time.is_set || sec30_support.is_set || sample_count.is_set || (out_pkts_protected != nullptr && out_pkts_protected->has_data()) || (out_pkts_encrypted != nullptr && out_pkts_encrypted->has_data()) || (out_octets_protected != nullptr && out_octets_protected->has_data()) || (out_octets_encrypted != nullptr && out_octets_encrypted->has_data()) || (out_pkts_too_long != nullptr && out_pkts_too_long->has_data()); } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::MacsecMinute15secytxHistory::MacsecMinute15secytxTimeLineInstances::MacsecMinute15secytxTimeLineInstance::has_operation() const { return is_set(yfilter) || ydk::is_set(number.yfilter) || ydk::is_set(index_.yfilter) || ydk::is_set(valid.yfilter) || ydk::is_set(timestamp.yfilter) || ydk::is_set(last_clear_time.yfilter) || ydk::is_set(last_clear15_min_time.yfilter) || ydk::is_set(last_clear30_sec_time.yfilter) || ydk::is_set(last_clear24_hr_time.yfilter) || ydk::is_set(sec30_support.yfilter) || ydk::is_set(sample_count.yfilter) || (out_pkts_protected != nullptr && out_pkts_protected->has_operation()) || (out_pkts_encrypted != nullptr && out_pkts_encrypted->has_operation()) || (out_octets_protected != nullptr && out_octets_protected->has_operation()) || (out_octets_encrypted != nullptr && out_octets_encrypted->has_operation()) || (out_pkts_too_long != nullptr && out_pkts_too_long->has_operation()); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::MacsecMinute15secytxHistory::MacsecMinute15secytxTimeLineInstances::MacsecMinute15secytxTimeLineInstance::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "macsec-minute15secytx-time-line-instance"; ADD_KEY_TOKEN(number, "number"); return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::MacsecMinute15secytxHistory::MacsecMinute15secytxTimeLineInstances::MacsecMinute15secytxTimeLineInstance::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (number.is_set || is_set(number.yfilter)) leaf_name_data.push_back(number.get_name_leafdata()); if (index_.is_set || is_set(index_.yfilter)) leaf_name_data.push_back(index_.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); if (timestamp.is_set || is_set(timestamp.yfilter)) leaf_name_data.push_back(timestamp.get_name_leafdata()); if (last_clear_time.is_set || is_set(last_clear_time.yfilter)) leaf_name_data.push_back(last_clear_time.get_name_leafdata()); if (last_clear15_min_time.is_set || is_set(last_clear15_min_time.yfilter)) leaf_name_data.push_back(last_clear15_min_time.get_name_leafdata()); if (last_clear30_sec_time.is_set || is_set(last_clear30_sec_time.yfilter)) leaf_name_data.push_back(last_clear30_sec_time.get_name_leafdata()); if (last_clear24_hr_time.is_set || is_set(last_clear24_hr_time.yfilter)) leaf_name_data.push_back(last_clear24_hr_time.get_name_leafdata()); if (sec30_support.is_set || is_set(sec30_support.yfilter)) leaf_name_data.push_back(sec30_support.get_name_leafdata()); if (sample_count.is_set || is_set(sample_count.yfilter)) leaf_name_data.push_back(sample_count.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::MacsecMinute15secytxHistory::MacsecMinute15secytxTimeLineInstances::MacsecMinute15secytxTimeLineInstance::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "out-pkts-protected") { if(out_pkts_protected == nullptr) { out_pkts_protected = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::MacsecMinute15secytxHistory::MacsecMinute15secytxTimeLineInstances::MacsecMinute15secytxTimeLineInstance::OutPktsProtected>(); } return out_pkts_protected; } if(child_yang_name == "out-pkts-encrypted") { if(out_pkts_encrypted == nullptr) { out_pkts_encrypted = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::MacsecMinute15secytxHistory::MacsecMinute15secytxTimeLineInstances::MacsecMinute15secytxTimeLineInstance::OutPktsEncrypted>(); } return out_pkts_encrypted; } if(child_yang_name == "out-octets-protected") { if(out_octets_protected == nullptr) { out_octets_protected = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::MacsecMinute15secytxHistory::MacsecMinute15secytxTimeLineInstances::MacsecMinute15secytxTimeLineInstance::OutOctetsProtected>(); } return out_octets_protected; } if(child_yang_name == "out-octets-encrypted") { if(out_octets_encrypted == nullptr) { out_octets_encrypted = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::MacsecMinute15secytxHistory::MacsecMinute15secytxTimeLineInstances::MacsecMinute15secytxTimeLineInstance::OutOctetsEncrypted>(); } return out_octets_encrypted; } if(child_yang_name == "out-pkts-too-long") { if(out_pkts_too_long == nullptr) { out_pkts_too_long = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::MacsecMinute15secytxHistory::MacsecMinute15secytxTimeLineInstances::MacsecMinute15secytxTimeLineInstance::OutPktsTooLong>(); } return out_pkts_too_long; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::MacsecMinute15secytxHistory::MacsecMinute15secytxTimeLineInstances::MacsecMinute15secytxTimeLineInstance::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; if(out_pkts_protected != nullptr) { _children["out-pkts-protected"] = out_pkts_protected; } if(out_pkts_encrypted != nullptr) { _children["out-pkts-encrypted"] = out_pkts_encrypted; } if(out_octets_protected != nullptr) { _children["out-octets-protected"] = out_octets_protected; } if(out_octets_encrypted != nullptr) { _children["out-octets-encrypted"] = out_octets_encrypted; } if(out_pkts_too_long != nullptr) { _children["out-pkts-too-long"] = out_pkts_too_long; } return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::MacsecMinute15secytxHistory::MacsecMinute15secytxTimeLineInstances::MacsecMinute15secytxTimeLineInstance::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 == "number") { number = value; number.value_namespace = name_space; number.value_namespace_prefix = name_space_prefix; } if(value_path == "index") { index_ = value; index_.value_namespace = name_space; index_.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } if(value_path == "timestamp") { timestamp = value; timestamp.value_namespace = name_space; timestamp.value_namespace_prefix = name_space_prefix; } if(value_path == "last-clear-time") { last_clear_time = value; last_clear_time.value_namespace = name_space; last_clear_time.value_namespace_prefix = name_space_prefix; } if(value_path == "last-clear15-min-time") { last_clear15_min_time = value; last_clear15_min_time.value_namespace = name_space; last_clear15_min_time.value_namespace_prefix = name_space_prefix; } if(value_path == "last-clear30-sec-time") { last_clear30_sec_time = value; last_clear30_sec_time.value_namespace = name_space; last_clear30_sec_time.value_namespace_prefix = name_space_prefix; } if(value_path == "last-clear24-hr-time") { last_clear24_hr_time = value; last_clear24_hr_time.value_namespace = name_space; last_clear24_hr_time.value_namespace_prefix = name_space_prefix; } if(value_path == "sec30-support") { sec30_support = value; sec30_support.value_namespace = name_space; sec30_support.value_namespace_prefix = name_space_prefix; } if(value_path == "sample-count") { sample_count = value; sample_count.value_namespace = name_space; sample_count.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::MacsecMinute15secytxHistory::MacsecMinute15secytxTimeLineInstances::MacsecMinute15secytxTimeLineInstance::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "number") { number.yfilter = yfilter; } if(value_path == "index") { index_.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } if(value_path == "timestamp") { timestamp.yfilter = yfilter; } if(value_path == "last-clear-time") { last_clear_time.yfilter = yfilter; } if(value_path == "last-clear15-min-time") { last_clear15_min_time.yfilter = yfilter; } if(value_path == "last-clear30-sec-time") { last_clear30_sec_time.yfilter = yfilter; } if(value_path == "last-clear24-hr-time") { last_clear24_hr_time.yfilter = yfilter; } if(value_path == "sec30-support") { sec30_support.yfilter = yfilter; } if(value_path == "sample-count") { sample_count.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::MacsecMinute15secytxHistory::MacsecMinute15secytxTimeLineInstances::MacsecMinute15secytxTimeLineInstance::has_leaf_or_child_of_name(const std::string & name) const { if(name == "out-pkts-protected" || name == "out-pkts-encrypted" || name == "out-octets-protected" || name == "out-octets-encrypted" || name == "out-pkts-too-long" || name == "number" || name == "index" || name == "valid" || name == "timestamp" || name == "last-clear-time" || name == "last-clear15-min-time" || name == "last-clear30-sec-time" || name == "last-clear24-hr-time" || name == "sec30-support" || name == "sample-count") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::MacsecMinute15secytxHistory::MacsecMinute15secytxTimeLineInstances::MacsecMinute15secytxTimeLineInstance::OutPktsProtected::OutPktsProtected() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "out-pkts-protected"; yang_parent_name = "macsec-minute15secytx-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::MacsecMinute15secytxHistory::MacsecMinute15secytxTimeLineInstances::MacsecMinute15secytxTimeLineInstance::OutPktsProtected::~OutPktsProtected() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::MacsecMinute15secytxHistory::MacsecMinute15secytxTimeLineInstances::MacsecMinute15secytxTimeLineInstance::OutPktsProtected::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::MacsecMinute15secytxHistory::MacsecMinute15secytxTimeLineInstances::MacsecMinute15secytxTimeLineInstance::OutPktsProtected::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::MacsecMinute15secytxHistory::MacsecMinute15secytxTimeLineInstances::MacsecMinute15secytxTimeLineInstance::OutPktsProtected::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "out-pkts-protected"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::MacsecMinute15secytxHistory::MacsecMinute15secytxTimeLineInstances::MacsecMinute15secytxTimeLineInstance::OutPktsProtected::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::MacsecMinute15secytxHistory::MacsecMinute15secytxTimeLineInstances::MacsecMinute15secytxTimeLineInstance::OutPktsProtected::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::MacsecMinute15secytxHistory::MacsecMinute15secytxTimeLineInstances::MacsecMinute15secytxTimeLineInstance::OutPktsProtected::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::MacsecMinute15secytxHistory::MacsecMinute15secytxTimeLineInstances::MacsecMinute15secytxTimeLineInstance::OutPktsProtected::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::MacsecMinute15secytxHistory::MacsecMinute15secytxTimeLineInstances::MacsecMinute15secytxTimeLineInstance::OutPktsProtected::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::MacsecMinute15secytxHistory::MacsecMinute15secytxTimeLineInstances::MacsecMinute15secytxTimeLineInstance::OutPktsProtected::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::MacsecMinute15secytxHistory::MacsecMinute15secytxTimeLineInstances::MacsecMinute15secytxTimeLineInstance::OutPktsEncrypted::OutPktsEncrypted() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "out-pkts-encrypted"; yang_parent_name = "macsec-minute15secytx-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::MacsecMinute15secytxHistory::MacsecMinute15secytxTimeLineInstances::MacsecMinute15secytxTimeLineInstance::OutPktsEncrypted::~OutPktsEncrypted() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::MacsecMinute15secytxHistory::MacsecMinute15secytxTimeLineInstances::MacsecMinute15secytxTimeLineInstance::OutPktsEncrypted::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::MacsecMinute15secytxHistory::MacsecMinute15secytxTimeLineInstances::MacsecMinute15secytxTimeLineInstance::OutPktsEncrypted::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::MacsecMinute15secytxHistory::MacsecMinute15secytxTimeLineInstances::MacsecMinute15secytxTimeLineInstance::OutPktsEncrypted::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "out-pkts-encrypted"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::MacsecMinute15secytxHistory::MacsecMinute15secytxTimeLineInstances::MacsecMinute15secytxTimeLineInstance::OutPktsEncrypted::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::MacsecMinute15secytxHistory::MacsecMinute15secytxTimeLineInstances::MacsecMinute15secytxTimeLineInstance::OutPktsEncrypted::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::MacsecMinute15secytxHistory::MacsecMinute15secytxTimeLineInstances::MacsecMinute15secytxTimeLineInstance::OutPktsEncrypted::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::MacsecMinute15secytxHistory::MacsecMinute15secytxTimeLineInstances::MacsecMinute15secytxTimeLineInstance::OutPktsEncrypted::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::MacsecMinute15secytxHistory::MacsecMinute15secytxTimeLineInstances::MacsecMinute15secytxTimeLineInstance::OutPktsEncrypted::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::MacsecMinute15secytxHistory::MacsecMinute15secytxTimeLineInstances::MacsecMinute15secytxTimeLineInstance::OutPktsEncrypted::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::MacsecMinute15secytxHistory::MacsecMinute15secytxTimeLineInstances::MacsecMinute15secytxTimeLineInstance::OutOctetsProtected::OutOctetsProtected() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "out-octets-protected"; yang_parent_name = "macsec-minute15secytx-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::MacsecMinute15secytxHistory::MacsecMinute15secytxTimeLineInstances::MacsecMinute15secytxTimeLineInstance::OutOctetsProtected::~OutOctetsProtected() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::MacsecMinute15secytxHistory::MacsecMinute15secytxTimeLineInstances::MacsecMinute15secytxTimeLineInstance::OutOctetsProtected::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::MacsecMinute15secytxHistory::MacsecMinute15secytxTimeLineInstances::MacsecMinute15secytxTimeLineInstance::OutOctetsProtected::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::MacsecMinute15secytxHistory::MacsecMinute15secytxTimeLineInstances::MacsecMinute15secytxTimeLineInstance::OutOctetsProtected::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "out-octets-protected"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::MacsecMinute15secytxHistory::MacsecMinute15secytxTimeLineInstances::MacsecMinute15secytxTimeLineInstance::OutOctetsProtected::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::MacsecMinute15secytxHistory::MacsecMinute15secytxTimeLineInstances::MacsecMinute15secytxTimeLineInstance::OutOctetsProtected::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::MacsecMinute15secytxHistory::MacsecMinute15secytxTimeLineInstances::MacsecMinute15secytxTimeLineInstance::OutOctetsProtected::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::MacsecMinute15secytxHistory::MacsecMinute15secytxTimeLineInstances::MacsecMinute15secytxTimeLineInstance::OutOctetsProtected::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::MacsecMinute15secytxHistory::MacsecMinute15secytxTimeLineInstances::MacsecMinute15secytxTimeLineInstance::OutOctetsProtected::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::MacsecMinute15secytxHistory::MacsecMinute15secytxTimeLineInstances::MacsecMinute15secytxTimeLineInstance::OutOctetsProtected::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::MacsecMinute15secytxHistory::MacsecMinute15secytxTimeLineInstances::MacsecMinute15secytxTimeLineInstance::OutOctetsEncrypted::OutOctetsEncrypted() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "out-octets-encrypted"; yang_parent_name = "macsec-minute15secytx-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::MacsecMinute15secytxHistory::MacsecMinute15secytxTimeLineInstances::MacsecMinute15secytxTimeLineInstance::OutOctetsEncrypted::~OutOctetsEncrypted() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::MacsecMinute15secytxHistory::MacsecMinute15secytxTimeLineInstances::MacsecMinute15secytxTimeLineInstance::OutOctetsEncrypted::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::MacsecMinute15secytxHistory::MacsecMinute15secytxTimeLineInstances::MacsecMinute15secytxTimeLineInstance::OutOctetsEncrypted::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::MacsecMinute15secytxHistory::MacsecMinute15secytxTimeLineInstances::MacsecMinute15secytxTimeLineInstance::OutOctetsEncrypted::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "out-octets-encrypted"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::MacsecMinute15secytxHistory::MacsecMinute15secytxTimeLineInstances::MacsecMinute15secytxTimeLineInstance::OutOctetsEncrypted::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::MacsecMinute15secytxHistory::MacsecMinute15secytxTimeLineInstances::MacsecMinute15secytxTimeLineInstance::OutOctetsEncrypted::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::MacsecMinute15secytxHistory::MacsecMinute15secytxTimeLineInstances::MacsecMinute15secytxTimeLineInstance::OutOctetsEncrypted::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::MacsecMinute15secytxHistory::MacsecMinute15secytxTimeLineInstances::MacsecMinute15secytxTimeLineInstance::OutOctetsEncrypted::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::MacsecMinute15secytxHistory::MacsecMinute15secytxTimeLineInstances::MacsecMinute15secytxTimeLineInstance::OutOctetsEncrypted::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::MacsecMinute15secytxHistory::MacsecMinute15secytxTimeLineInstances::MacsecMinute15secytxTimeLineInstance::OutOctetsEncrypted::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::MacsecMinute15secytxHistory::MacsecMinute15secytxTimeLineInstances::MacsecMinute15secytxTimeLineInstance::OutPktsTooLong::OutPktsTooLong() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "out-pkts-too-long"; yang_parent_name = "macsec-minute15secytx-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::MacsecMinute15secytxHistory::MacsecMinute15secytxTimeLineInstances::MacsecMinute15secytxTimeLineInstance::OutPktsTooLong::~OutPktsTooLong() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::MacsecMinute15secytxHistory::MacsecMinute15secytxTimeLineInstances::MacsecMinute15secytxTimeLineInstance::OutPktsTooLong::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::MacsecMinute15secytxHistory::MacsecMinute15secytxTimeLineInstances::MacsecMinute15secytxTimeLineInstance::OutPktsTooLong::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::MacsecMinute15secytxHistory::MacsecMinute15secytxTimeLineInstances::MacsecMinute15secytxTimeLineInstance::OutPktsTooLong::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "out-pkts-too-long"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::MacsecMinute15secytxHistory::MacsecMinute15secytxTimeLineInstances::MacsecMinute15secytxTimeLineInstance::OutPktsTooLong::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::MacsecMinute15secytxHistory::MacsecMinute15secytxTimeLineInstances::MacsecMinute15secytxTimeLineInstance::OutPktsTooLong::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::MacsecMinute15secytxHistory::MacsecMinute15secytxTimeLineInstances::MacsecMinute15secytxTimeLineInstance::OutPktsTooLong::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::MacsecMinute15secytxHistory::MacsecMinute15secytxTimeLineInstances::MacsecMinute15secytxTimeLineInstance::OutPktsTooLong::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::MacsecMinute15secytxHistory::MacsecMinute15secytxTimeLineInstances::MacsecMinute15secytxTimeLineInstance::OutPktsTooLong::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secytxHistories::MacsecMinute15secytxHistory::MacsecMinute15secytxTimeLineInstances::MacsecMinute15secytxTimeLineInstance::OutPktsTooLong::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistories() : macsec_minute15secyif_history(this, {"number"}) { yang_name = "macsec-minute15secyif-histories"; yang_parent_name = "macsec-minute15-history"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::~MacsecMinute15secyifHistories() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<macsec_minute15secyif_history.len(); index++) { if(macsec_minute15secyif_history[index]->has_data()) return true; } return false; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::has_operation() const { for (std::size_t index=0; index<macsec_minute15secyif_history.len(); index++) { if(macsec_minute15secyif_history[index]->has_operation()) return true; } return is_set(yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "macsec-minute15secyif-histories"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "macsec-minute15secyif-history") { auto ent_ = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory>(); ent_->parent = this; macsec_minute15secyif_history.append(ent_); return ent_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; count_ = 0; for (auto ent_ : macsec_minute15secyif_history.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 PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::set_filter(const std::string & value_path, YFilter yfilter) { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::has_leaf_or_child_of_name(const std::string & name) const { if(name == "macsec-minute15secyif-history") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifHistory() : number{YType::uint32, "number"} , macsec_minute15secyif_time_line_instances(std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances>()) { macsec_minute15secyif_time_line_instances->parent = this; yang_name = "macsec-minute15secyif-history"; yang_parent_name = "macsec-minute15secyif-histories"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::~MacsecMinute15secyifHistory() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::has_data() const { if (is_presence_container) return true; return number.is_set || (macsec_minute15secyif_time_line_instances != nullptr && macsec_minute15secyif_time_line_instances->has_data()); } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::has_operation() const { return is_set(yfilter) || ydk::is_set(number.yfilter) || (macsec_minute15secyif_time_line_instances != nullptr && macsec_minute15secyif_time_line_instances->has_operation()); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "macsec-minute15secyif-history"; ADD_KEY_TOKEN(number, "number"); return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (number.is_set || is_set(number.yfilter)) leaf_name_data.push_back(number.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "macsec-minute15secyif-time-line-instances") { if(macsec_minute15secyif_time_line_instances == nullptr) { macsec_minute15secyif_time_line_instances = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances>(); } return macsec_minute15secyif_time_line_instances; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; if(macsec_minute15secyif_time_line_instances != nullptr) { _children["macsec-minute15secyif-time-line-instances"] = macsec_minute15secyif_time_line_instances; } return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::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 == "number") { number = value; number.value_namespace = name_space; number.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "number") { number.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::has_leaf_or_child_of_name(const std::string & name) const { if(name == "macsec-minute15secyif-time-line-instances" || name == "number") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstances() : macsec_minute15secyif_time_line_instance(this, {"number"}) { yang_name = "macsec-minute15secyif-time-line-instances"; yang_parent_name = "macsec-minute15secyif-history"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::~MacsecMinute15secyifTimeLineInstances() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<macsec_minute15secyif_time_line_instance.len(); index++) { if(macsec_minute15secyif_time_line_instance[index]->has_data()) return true; } return false; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::has_operation() const { for (std::size_t index=0; index<macsec_minute15secyif_time_line_instance.len(); index++) { if(macsec_minute15secyif_time_line_instance[index]->has_operation()) return true; } return is_set(yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "macsec-minute15secyif-time-line-instances"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "macsec-minute15secyif-time-line-instance") { auto ent_ = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance>(); ent_->parent = this; macsec_minute15secyif_time_line_instance.append(ent_); return ent_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; count_ = 0; for (auto ent_ : macsec_minute15secyif_time_line_instance.entities()) { if(_children.find(ent_->get_segment_path()) == _children.end()) _children[ent_->get_segment_path()] = ent_; else _children[ent_->get_segment_path()+count_++] = ent_; } return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::set_filter(const std::string & value_path, YFilter yfilter) { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::has_leaf_or_child_of_name(const std::string & name) const { if(name == "macsec-minute15secyif-time-line-instance") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::MacsecMinute15secyifTimeLineInstance() : number{YType::uint32, "number"}, index_{YType::uint32, "index"}, valid{YType::boolean, "valid"}, timestamp{YType::str, "timestamp"}, last_clear_time{YType::str, "last-clear-time"}, last_clear15_min_time{YType::str, "last-clear15-min-time"}, last_clear30_sec_time{YType::str, "last-clear30-sec-time"}, last_clear24_hr_time{YType::str, "last-clear24-hr-time"}, sec30_support{YType::boolean, "sec30-support"}, sample_count{YType::uint64, "sample-count"} , in_pkts_untagged(std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::InPktsUntagged>()) , in_pkts_no_tag(std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::InPktsNoTag>()) , in_pkts_bad_tag(std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::InPktsBadTag>()) , in_pkts_unknown_sci(std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::InPktsUnknownSci>()) , in_pkts_no_sci(std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::InPktsNoSci>()) , in_pkts_overrun(std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::InPktsOverrun>()) , in_octets_validated(std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::InOctetsValidated>()) , in_octets_decrypted(std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::InOctetsDecrypted>()) , out_pkts_untagged(std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::OutPktsUntagged>()) , out_pkts_too_long(std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::OutPktsTooLong>()) , out_octets_protected(std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::OutOctetsProtected>()) , out_octets_encrypted(std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::OutOctetsEncrypted>()) { in_pkts_untagged->parent = this; in_pkts_no_tag->parent = this; in_pkts_bad_tag->parent = this; in_pkts_unknown_sci->parent = this; in_pkts_no_sci->parent = this; in_pkts_overrun->parent = this; in_octets_validated->parent = this; in_octets_decrypted->parent = this; out_pkts_untagged->parent = this; out_pkts_too_long->parent = this; out_octets_protected->parent = this; out_octets_encrypted->parent = this; yang_name = "macsec-minute15secyif-time-line-instance"; yang_parent_name = "macsec-minute15secyif-time-line-instances"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::~MacsecMinute15secyifTimeLineInstance() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::has_data() const { if (is_presence_container) return true; return number.is_set || index_.is_set || valid.is_set || timestamp.is_set || last_clear_time.is_set || last_clear15_min_time.is_set || last_clear30_sec_time.is_set || last_clear24_hr_time.is_set || sec30_support.is_set || sample_count.is_set || (in_pkts_untagged != nullptr && in_pkts_untagged->has_data()) || (in_pkts_no_tag != nullptr && in_pkts_no_tag->has_data()) || (in_pkts_bad_tag != nullptr && in_pkts_bad_tag->has_data()) || (in_pkts_unknown_sci != nullptr && in_pkts_unknown_sci->has_data()) || (in_pkts_no_sci != nullptr && in_pkts_no_sci->has_data()) || (in_pkts_overrun != nullptr && in_pkts_overrun->has_data()) || (in_octets_validated != nullptr && in_octets_validated->has_data()) || (in_octets_decrypted != nullptr && in_octets_decrypted->has_data()) || (out_pkts_untagged != nullptr && out_pkts_untagged->has_data()) || (out_pkts_too_long != nullptr && out_pkts_too_long->has_data()) || (out_octets_protected != nullptr && out_octets_protected->has_data()) || (out_octets_encrypted != nullptr && out_octets_encrypted->has_data()); } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::has_operation() const { return is_set(yfilter) || ydk::is_set(number.yfilter) || ydk::is_set(index_.yfilter) || ydk::is_set(valid.yfilter) || ydk::is_set(timestamp.yfilter) || ydk::is_set(last_clear_time.yfilter) || ydk::is_set(last_clear15_min_time.yfilter) || ydk::is_set(last_clear30_sec_time.yfilter) || ydk::is_set(last_clear24_hr_time.yfilter) || ydk::is_set(sec30_support.yfilter) || ydk::is_set(sample_count.yfilter) || (in_pkts_untagged != nullptr && in_pkts_untagged->has_operation()) || (in_pkts_no_tag != nullptr && in_pkts_no_tag->has_operation()) || (in_pkts_bad_tag != nullptr && in_pkts_bad_tag->has_operation()) || (in_pkts_unknown_sci != nullptr && in_pkts_unknown_sci->has_operation()) || (in_pkts_no_sci != nullptr && in_pkts_no_sci->has_operation()) || (in_pkts_overrun != nullptr && in_pkts_overrun->has_operation()) || (in_octets_validated != nullptr && in_octets_validated->has_operation()) || (in_octets_decrypted != nullptr && in_octets_decrypted->has_operation()) || (out_pkts_untagged != nullptr && out_pkts_untagged->has_operation()) || (out_pkts_too_long != nullptr && out_pkts_too_long->has_operation()) || (out_octets_protected != nullptr && out_octets_protected->has_operation()) || (out_octets_encrypted != nullptr && out_octets_encrypted->has_operation()); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "macsec-minute15secyif-time-line-instance"; ADD_KEY_TOKEN(number, "number"); return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (number.is_set || is_set(number.yfilter)) leaf_name_data.push_back(number.get_name_leafdata()); if (index_.is_set || is_set(index_.yfilter)) leaf_name_data.push_back(index_.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); if (timestamp.is_set || is_set(timestamp.yfilter)) leaf_name_data.push_back(timestamp.get_name_leafdata()); if (last_clear_time.is_set || is_set(last_clear_time.yfilter)) leaf_name_data.push_back(last_clear_time.get_name_leafdata()); if (last_clear15_min_time.is_set || is_set(last_clear15_min_time.yfilter)) leaf_name_data.push_back(last_clear15_min_time.get_name_leafdata()); if (last_clear30_sec_time.is_set || is_set(last_clear30_sec_time.yfilter)) leaf_name_data.push_back(last_clear30_sec_time.get_name_leafdata()); if (last_clear24_hr_time.is_set || is_set(last_clear24_hr_time.yfilter)) leaf_name_data.push_back(last_clear24_hr_time.get_name_leafdata()); if (sec30_support.is_set || is_set(sec30_support.yfilter)) leaf_name_data.push_back(sec30_support.get_name_leafdata()); if (sample_count.is_set || is_set(sample_count.yfilter)) leaf_name_data.push_back(sample_count.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "in-pkts-untagged") { if(in_pkts_untagged == nullptr) { in_pkts_untagged = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::InPktsUntagged>(); } return in_pkts_untagged; } if(child_yang_name == "in-pkts-no-tag") { if(in_pkts_no_tag == nullptr) { in_pkts_no_tag = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::InPktsNoTag>(); } return in_pkts_no_tag; } if(child_yang_name == "in-pkts-bad-tag") { if(in_pkts_bad_tag == nullptr) { in_pkts_bad_tag = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::InPktsBadTag>(); } return in_pkts_bad_tag; } if(child_yang_name == "in-pkts-unknown-sci") { if(in_pkts_unknown_sci == nullptr) { in_pkts_unknown_sci = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::InPktsUnknownSci>(); } return in_pkts_unknown_sci; } if(child_yang_name == "in-pkts-no-sci") { if(in_pkts_no_sci == nullptr) { in_pkts_no_sci = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::InPktsNoSci>(); } return in_pkts_no_sci; } if(child_yang_name == "in-pkts-overrun") { if(in_pkts_overrun == nullptr) { in_pkts_overrun = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::InPktsOverrun>(); } return in_pkts_overrun; } if(child_yang_name == "in-octets-validated") { if(in_octets_validated == nullptr) { in_octets_validated = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::InOctetsValidated>(); } return in_octets_validated; } if(child_yang_name == "in-octets-decrypted") { if(in_octets_decrypted == nullptr) { in_octets_decrypted = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::InOctetsDecrypted>(); } return in_octets_decrypted; } if(child_yang_name == "out-pkts-untagged") { if(out_pkts_untagged == nullptr) { out_pkts_untagged = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::OutPktsUntagged>(); } return out_pkts_untagged; } if(child_yang_name == "out-pkts-too-long") { if(out_pkts_too_long == nullptr) { out_pkts_too_long = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::OutPktsTooLong>(); } return out_pkts_too_long; } if(child_yang_name == "out-octets-protected") { if(out_octets_protected == nullptr) { out_octets_protected = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::OutOctetsProtected>(); } return out_octets_protected; } if(child_yang_name == "out-octets-encrypted") { if(out_octets_encrypted == nullptr) { out_octets_encrypted = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::OutOctetsEncrypted>(); } return out_octets_encrypted; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; if(in_pkts_untagged != nullptr) { _children["in-pkts-untagged"] = in_pkts_untagged; } if(in_pkts_no_tag != nullptr) { _children["in-pkts-no-tag"] = in_pkts_no_tag; } if(in_pkts_bad_tag != nullptr) { _children["in-pkts-bad-tag"] = in_pkts_bad_tag; } if(in_pkts_unknown_sci != nullptr) { _children["in-pkts-unknown-sci"] = in_pkts_unknown_sci; } if(in_pkts_no_sci != nullptr) { _children["in-pkts-no-sci"] = in_pkts_no_sci; } if(in_pkts_overrun != nullptr) { _children["in-pkts-overrun"] = in_pkts_overrun; } if(in_octets_validated != nullptr) { _children["in-octets-validated"] = in_octets_validated; } if(in_octets_decrypted != nullptr) { _children["in-octets-decrypted"] = in_octets_decrypted; } if(out_pkts_untagged != nullptr) { _children["out-pkts-untagged"] = out_pkts_untagged; } if(out_pkts_too_long != nullptr) { _children["out-pkts-too-long"] = out_pkts_too_long; } if(out_octets_protected != nullptr) { _children["out-octets-protected"] = out_octets_protected; } if(out_octets_encrypted != nullptr) { _children["out-octets-encrypted"] = out_octets_encrypted; } return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::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 == "number") { number = value; number.value_namespace = name_space; number.value_namespace_prefix = name_space_prefix; } if(value_path == "index") { index_ = value; index_.value_namespace = name_space; index_.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } if(value_path == "timestamp") { timestamp = value; timestamp.value_namespace = name_space; timestamp.value_namespace_prefix = name_space_prefix; } if(value_path == "last-clear-time") { last_clear_time = value; last_clear_time.value_namespace = name_space; last_clear_time.value_namespace_prefix = name_space_prefix; } if(value_path == "last-clear15-min-time") { last_clear15_min_time = value; last_clear15_min_time.value_namespace = name_space; last_clear15_min_time.value_namespace_prefix = name_space_prefix; } if(value_path == "last-clear30-sec-time") { last_clear30_sec_time = value; last_clear30_sec_time.value_namespace = name_space; last_clear30_sec_time.value_namespace_prefix = name_space_prefix; } if(value_path == "last-clear24-hr-time") { last_clear24_hr_time = value; last_clear24_hr_time.value_namespace = name_space; last_clear24_hr_time.value_namespace_prefix = name_space_prefix; } if(value_path == "sec30-support") { sec30_support = value; sec30_support.value_namespace = name_space; sec30_support.value_namespace_prefix = name_space_prefix; } if(value_path == "sample-count") { sample_count = value; sample_count.value_namespace = name_space; sample_count.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "number") { number.yfilter = yfilter; } if(value_path == "index") { index_.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } if(value_path == "timestamp") { timestamp.yfilter = yfilter; } if(value_path == "last-clear-time") { last_clear_time.yfilter = yfilter; } if(value_path == "last-clear15-min-time") { last_clear15_min_time.yfilter = yfilter; } if(value_path == "last-clear30-sec-time") { last_clear30_sec_time.yfilter = yfilter; } if(value_path == "last-clear24-hr-time") { last_clear24_hr_time.yfilter = yfilter; } if(value_path == "sec30-support") { sec30_support.yfilter = yfilter; } if(value_path == "sample-count") { sample_count.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::has_leaf_or_child_of_name(const std::string & name) const { if(name == "in-pkts-untagged" || name == "in-pkts-no-tag" || name == "in-pkts-bad-tag" || name == "in-pkts-unknown-sci" || name == "in-pkts-no-sci" || name == "in-pkts-overrun" || name == "in-octets-validated" || name == "in-octets-decrypted" || name == "out-pkts-untagged" || name == "out-pkts-too-long" || name == "out-octets-protected" || name == "out-octets-encrypted" || name == "number" || name == "index" || name == "valid" || name == "timestamp" || name == "last-clear-time" || name == "last-clear15-min-time" || name == "last-clear30-sec-time" || name == "last-clear24-hr-time" || name == "sec30-support" || name == "sample-count") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::InPktsUntagged::InPktsUntagged() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "in-pkts-untagged"; yang_parent_name = "macsec-minute15secyif-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::InPktsUntagged::~InPktsUntagged() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::InPktsUntagged::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::InPktsUntagged::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::InPktsUntagged::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "in-pkts-untagged"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::InPktsUntagged::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::InPktsUntagged::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::InPktsUntagged::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::InPktsUntagged::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::InPktsUntagged::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::InPktsUntagged::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::InPktsNoTag::InPktsNoTag() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "in-pkts-no-tag"; yang_parent_name = "macsec-minute15secyif-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::InPktsNoTag::~InPktsNoTag() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::InPktsNoTag::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::InPktsNoTag::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::InPktsNoTag::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "in-pkts-no-tag"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::InPktsNoTag::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::InPktsNoTag::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::InPktsNoTag::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::InPktsNoTag::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::InPktsNoTag::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::InPktsNoTag::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::InPktsBadTag::InPktsBadTag() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "in-pkts-bad-tag"; yang_parent_name = "macsec-minute15secyif-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::InPktsBadTag::~InPktsBadTag() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::InPktsBadTag::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::InPktsBadTag::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::InPktsBadTag::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "in-pkts-bad-tag"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::InPktsBadTag::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::InPktsBadTag::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::InPktsBadTag::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::InPktsBadTag::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::InPktsBadTag::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::InPktsBadTag::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::InPktsUnknownSci::InPktsUnknownSci() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "in-pkts-unknown-sci"; yang_parent_name = "macsec-minute15secyif-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::InPktsUnknownSci::~InPktsUnknownSci() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::InPktsUnknownSci::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::InPktsUnknownSci::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::InPktsUnknownSci::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "in-pkts-unknown-sci"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::InPktsUnknownSci::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::InPktsUnknownSci::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::InPktsUnknownSci::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::InPktsUnknownSci::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::InPktsUnknownSci::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::InPktsUnknownSci::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::InPktsNoSci::InPktsNoSci() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "in-pkts-no-sci"; yang_parent_name = "macsec-minute15secyif-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::InPktsNoSci::~InPktsNoSci() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::InPktsNoSci::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::InPktsNoSci::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::InPktsNoSci::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "in-pkts-no-sci"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::InPktsNoSci::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::InPktsNoSci::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::InPktsNoSci::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::InPktsNoSci::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::InPktsNoSci::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::InPktsNoSci::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::InPktsOverrun::InPktsOverrun() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "in-pkts-overrun"; yang_parent_name = "macsec-minute15secyif-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::InPktsOverrun::~InPktsOverrun() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::InPktsOverrun::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::InPktsOverrun::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::InPktsOverrun::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "in-pkts-overrun"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::InPktsOverrun::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::InPktsOverrun::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::InPktsOverrun::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::InPktsOverrun::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::InPktsOverrun::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::InPktsOverrun::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::InOctetsValidated::InOctetsValidated() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "in-octets-validated"; yang_parent_name = "macsec-minute15secyif-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::InOctetsValidated::~InOctetsValidated() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::InOctetsValidated::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::InOctetsValidated::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::InOctetsValidated::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "in-octets-validated"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::InOctetsValidated::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::InOctetsValidated::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::InOctetsValidated::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::InOctetsValidated::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::InOctetsValidated::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::InOctetsValidated::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::InOctetsDecrypted::InOctetsDecrypted() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "in-octets-decrypted"; yang_parent_name = "macsec-minute15secyif-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::InOctetsDecrypted::~InOctetsDecrypted() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::InOctetsDecrypted::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::InOctetsDecrypted::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::InOctetsDecrypted::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "in-octets-decrypted"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::InOctetsDecrypted::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::InOctetsDecrypted::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::InOctetsDecrypted::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::InOctetsDecrypted::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::InOctetsDecrypted::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::InOctetsDecrypted::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::OutPktsUntagged::OutPktsUntagged() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "out-pkts-untagged"; yang_parent_name = "macsec-minute15secyif-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::OutPktsUntagged::~OutPktsUntagged() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::OutPktsUntagged::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::OutPktsUntagged::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::OutPktsUntagged::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "out-pkts-untagged"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::OutPktsUntagged::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::OutPktsUntagged::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::OutPktsUntagged::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::OutPktsUntagged::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::OutPktsUntagged::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::OutPktsUntagged::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::OutPktsTooLong::OutPktsTooLong() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "out-pkts-too-long"; yang_parent_name = "macsec-minute15secyif-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::OutPktsTooLong::~OutPktsTooLong() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::OutPktsTooLong::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::OutPktsTooLong::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::OutPktsTooLong::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "out-pkts-too-long"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::OutPktsTooLong::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::OutPktsTooLong::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::OutPktsTooLong::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::OutPktsTooLong::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::OutPktsTooLong::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::OutPktsTooLong::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::OutOctetsProtected::OutOctetsProtected() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "out-octets-protected"; yang_parent_name = "macsec-minute15secyif-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::OutOctetsProtected::~OutOctetsProtected() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::OutOctetsProtected::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::OutOctetsProtected::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::OutOctetsProtected::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "out-octets-protected"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::OutOctetsProtected::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::OutOctetsProtected::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::OutOctetsProtected::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::OutOctetsProtected::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::OutOctetsProtected::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::OutOctetsProtected::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::OutOctetsEncrypted::OutOctetsEncrypted() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "out-octets-encrypted"; yang_parent_name = "macsec-minute15secyif-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::OutOctetsEncrypted::~OutOctetsEncrypted() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::OutOctetsEncrypted::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::OutOctetsEncrypted::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::OutOctetsEncrypted::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "out-octets-encrypted"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::OutOctetsEncrypted::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::OutOctetsEncrypted::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::OutOctetsEncrypted::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::OutOctetsEncrypted::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::OutOctetsEncrypted::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecMinute15History::MacsecMinute15secyifHistories::MacsecMinute15secyifHistory::MacsecMinute15secyifTimeLineInstances::MacsecMinute15secyifTimeLineInstance::OutOctetsEncrypted::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24History() : macsec_hour24_ether_histories(std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories>()) , macsec_hour24secytx_histories(std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories>()) , macsec_hour24secyif_histories(std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secyifHistories>()) , macsec_hour24secyrx_histories(std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secyrxHistories>()) { macsec_hour24_ether_histories->parent = this; macsec_hour24secytx_histories->parent = this; macsec_hour24secyif_histories->parent = this; macsec_hour24secyrx_histories->parent = this; yang_name = "macsec-hour24-history"; yang_parent_name = "macsec-port-history"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::~MacsecHour24History() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::has_data() const { if (is_presence_container) return true; return (macsec_hour24_ether_histories != nullptr && macsec_hour24_ether_histories->has_data()) || (macsec_hour24secytx_histories != nullptr && macsec_hour24secytx_histories->has_data()) || (macsec_hour24secyif_histories != nullptr && macsec_hour24secyif_histories->has_data()) || (macsec_hour24secyrx_histories != nullptr && macsec_hour24secyrx_histories->has_data()); } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::has_operation() const { return is_set(yfilter) || (macsec_hour24_ether_histories != nullptr && macsec_hour24_ether_histories->has_operation()) || (macsec_hour24secytx_histories != nullptr && macsec_hour24secytx_histories->has_operation()) || (macsec_hour24secyif_histories != nullptr && macsec_hour24secyif_histories->has_operation()) || (macsec_hour24secyrx_histories != nullptr && macsec_hour24secyrx_histories->has_operation()); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "macsec-hour24-history"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "macsec-hour24-ether-histories") { if(macsec_hour24_ether_histories == nullptr) { macsec_hour24_ether_histories = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories>(); } return macsec_hour24_ether_histories; } if(child_yang_name == "macsec-hour24secytx-histories") { if(macsec_hour24secytx_histories == nullptr) { macsec_hour24secytx_histories = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories>(); } return macsec_hour24secytx_histories; } if(child_yang_name == "macsec-hour24secyif-histories") { if(macsec_hour24secyif_histories == nullptr) { macsec_hour24secyif_histories = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secyifHistories>(); } return macsec_hour24secyif_histories; } if(child_yang_name == "macsec-hour24secyrx-histories") { if(macsec_hour24secyrx_histories == nullptr) { macsec_hour24secyrx_histories = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secyrxHistories>(); } return macsec_hour24secyrx_histories; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; if(macsec_hour24_ether_histories != nullptr) { _children["macsec-hour24-ether-histories"] = macsec_hour24_ether_histories; } if(macsec_hour24secytx_histories != nullptr) { _children["macsec-hour24secytx-histories"] = macsec_hour24secytx_histories; } if(macsec_hour24secyif_histories != nullptr) { _children["macsec-hour24secyif-histories"] = macsec_hour24secyif_histories; } if(macsec_hour24secyrx_histories != nullptr) { _children["macsec-hour24secyrx-histories"] = macsec_hour24secyrx_histories; } return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::set_filter(const std::string & value_path, YFilter yfilter) { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::has_leaf_or_child_of_name(const std::string & name) const { if(name == "macsec-hour24-ether-histories" || name == "macsec-hour24secytx-histories" || name == "macsec-hour24secyif-histories" || name == "macsec-hour24secyrx-histories") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistories() : macsec_hour24_ether_history(this, {"number"}) { yang_name = "macsec-hour24-ether-histories"; yang_parent_name = "macsec-hour24-history"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::~MacsecHour24EtherHistories() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<macsec_hour24_ether_history.len(); index++) { if(macsec_hour24_ether_history[index]->has_data()) return true; } return false; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::has_operation() const { for (std::size_t index=0; index<macsec_hour24_ether_history.len(); index++) { if(macsec_hour24_ether_history[index]->has_operation()) return true; } return is_set(yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "macsec-hour24-ether-histories"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "macsec-hour24-ether-history") { auto ent_ = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory>(); ent_->parent = this; macsec_hour24_ether_history.append(ent_); return ent_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; count_ = 0; for (auto ent_ : macsec_hour24_ether_history.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 PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::set_filter(const std::string & value_path, YFilter yfilter) { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::has_leaf_or_child_of_name(const std::string & name) const { if(name == "macsec-hour24-ether-history") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherHistory() : number{YType::uint32, "number"} , macsec_hour24_ether_time_line_instances(std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances>()) { macsec_hour24_ether_time_line_instances->parent = this; yang_name = "macsec-hour24-ether-history"; yang_parent_name = "macsec-hour24-ether-histories"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::~MacsecHour24EtherHistory() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::has_data() const { if (is_presence_container) return true; return number.is_set || (macsec_hour24_ether_time_line_instances != nullptr && macsec_hour24_ether_time_line_instances->has_data()); } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::has_operation() const { return is_set(yfilter) || ydk::is_set(number.yfilter) || (macsec_hour24_ether_time_line_instances != nullptr && macsec_hour24_ether_time_line_instances->has_operation()); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "macsec-hour24-ether-history"; ADD_KEY_TOKEN(number, "number"); return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (number.is_set || is_set(number.yfilter)) leaf_name_data.push_back(number.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "macsec-hour24-ether-time-line-instances") { if(macsec_hour24_ether_time_line_instances == nullptr) { macsec_hour24_ether_time_line_instances = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances>(); } return macsec_hour24_ether_time_line_instances; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; if(macsec_hour24_ether_time_line_instances != nullptr) { _children["macsec-hour24-ether-time-line-instances"] = macsec_hour24_ether_time_line_instances; } return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::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 == "number") { number = value; number.value_namespace = name_space; number.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "number") { number.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::has_leaf_or_child_of_name(const std::string & name) const { if(name == "macsec-hour24-ether-time-line-instances" || name == "number") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstances() : macsec_hour24_ether_time_line_instance(this, {"number"}) { yang_name = "macsec-hour24-ether-time-line-instances"; yang_parent_name = "macsec-hour24-ether-history"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::~MacsecHour24EtherTimeLineInstances() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<macsec_hour24_ether_time_line_instance.len(); index++) { if(macsec_hour24_ether_time_line_instance[index]->has_data()) return true; } return false; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::has_operation() const { for (std::size_t index=0; index<macsec_hour24_ether_time_line_instance.len(); index++) { if(macsec_hour24_ether_time_line_instance[index]->has_operation()) return true; } return is_set(yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "macsec-hour24-ether-time-line-instances"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "macsec-hour24-ether-time-line-instance") { auto ent_ = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance>(); ent_->parent = this; macsec_hour24_ether_time_line_instance.append(ent_); return ent_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; count_ = 0; for (auto ent_ : macsec_hour24_ether_time_line_instance.entities()) { if(_children.find(ent_->get_segment_path()) == _children.end()) _children[ent_->get_segment_path()] = ent_; else _children[ent_->get_segment_path()+count_++] = ent_; } return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::set_filter(const std::string & value_path, YFilter yfilter) { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::has_leaf_or_child_of_name(const std::string & name) const { if(name == "macsec-hour24-ether-time-line-instance") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::MacsecHour24EtherTimeLineInstance() : number{YType::uint32, "number"}, index_{YType::uint32, "index"}, valid{YType::boolean, "valid"}, timestamp{YType::str, "timestamp"}, last_clear_time{YType::str, "last-clear-time"}, last_clear30_sec_time{YType::str, "last-clear30-sec-time"}, last_clear15_min_time{YType::str, "last-clear15-min-time"}, last_clear24_hr_time{YType::str, "last-clear24-hr-time"}, sec30_support{YType::boolean, "sec30-support"} , rx_pkt(std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::RxPkt>()) , stat_pkt(std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::StatPkt>()) , octet_stat(std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OctetStat>()) , oversize_pkt_stat(std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OversizePktStat>()) , fcs_errors_stat(std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::FcsErrorsStat>()) , long_frames_stat(std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::LongFramesStat>()) , jabber_stat(std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::JabberStat>()) , ether64_octets(std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::Ether64Octets>()) , ether65127_octet(std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::Ether65127Octet>()) , ether128255_octet(std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::Ether128255Octet>()) , ether256511_octet(std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::Ether256511Octet>()) , ether5121023_octet(std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::Ether5121023Octet>()) , ether10241518_octet(std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::Ether10241518Octet>()) , in_ucast_pkt(std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InUcastPkt>()) , in_mcast_pkt(std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InMcastPkt>()) , in_bcast_pkt(std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InBcastPkt>()) , out_ucast_pkt(std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutUcastPkt>()) , out_bcast_pkt(std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutBcastPkt>()) , out_mcast_pkt(std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutMcastPkt>()) , tx_pkt(std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::TxPkt>()) , if_in_errors(std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::IfInErrors>()) , if_in_octets(std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::IfInOctets>()) , ether_stat_multicast_pkt(std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::EtherStatMulticastPkt>()) , ether_stat_broadcast_pkt(std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::EtherStatBroadcastPkt>()) , ether_stat_undersized_pkt(std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::EtherStatUndersizedPkt>()) , out_octets(std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutOctets>()) , in_pause_frame(std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InPauseFrame>()) , in_good_bytes(std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InGoodBytes>()) , in8021q_frames(std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::In8021qFrames>()) , in_pkts1519_max_octets(std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InPkts1519MaxOctets>()) , in_good_pkts(std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InGoodPkts>()) , in_drop_overrun(std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InDropOverrun>()) , in_drop_abort(std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InDropAbort>()) , in_drop_invalid_vlan(std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InDropInvalidVlan>()) , in_drop_invalid_dmac(std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InDropInvalidDmac>()) , in_drop_invalid_encap(std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InDropInvalidEncap>()) , in_drop_other(std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InDropOther>()) , in_mib_giant(std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InMibGiant>()) , in_mib_jabber(std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InMibJabber>()) , in_mibcrc(std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InMibcrc>()) , in_error_collisions(std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InErrorCollisions>()) , in_error_symbol(std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InErrorSymbol>()) , out_good_bytes(std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutGoodBytes>()) , out8021q_frames(std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::Out8021qFrames>()) , out_pause_frames(std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutPauseFrames>()) , out_pkts1519_max_octets(std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutPkts1519MaxOctets>()) , out_good_pkts(std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutGoodPkts>()) , out_drop_underrun(std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutDropUnderrun>()) , out_drop_abort(std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutDropAbort>()) , out_drop_other(std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutDropOther>()) , out_error_other(std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutErrorOther>()) , in_error_giant(std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InErrorGiant>()) , in_error_runt(std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InErrorRunt>()) , in_error_jabbers(std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InErrorJabbers>()) , in_error_fragments(std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InErrorFragments>()) , in_error_other(std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InErrorOther>()) , in_pkt64_octet(std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InPkt64Octet>()) , in_pkts65_to127_octets(std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InPkts65To127Octets>()) , in_pkts128_to255_octets(std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InPkts128To255Octets>()) , in_pkts256_to511_octets(std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InPkts256To511Octets>()) , in_pkts512_to1023_octets(std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InPkts512To1023Octets>()) , in_pkts1024_to1518_octets(std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InPkts1024To1518Octets>()) , outpkt64octet(std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::Outpkt64octet>()) , out_pkts65127_octets(std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutPkts65127Octets>()) , out_pkts128255_octets(std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutPkts128255Octets>()) , out_pkts256511_octets(std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutPkts256511Octets>()) , out_pkts5121023_octets(std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutPkts5121023Octets>()) , out_pkts10241518_octets(std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutPkts10241518Octets>()) , rx_util(std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::RxUtil>()) , tx_util(std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::TxUtil>()) , tx_undersized_pkt(std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::TxUndersizedPkt>()) , tx_oversized_pkt(std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::TxOversizedPkt>()) , tx_fragments(std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::TxFragments>()) , tx_jabber(std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::TxJabber>()) , tx_bad_fcs(std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::TxBadFcs>()) { rx_pkt->parent = this; stat_pkt->parent = this; octet_stat->parent = this; oversize_pkt_stat->parent = this; fcs_errors_stat->parent = this; long_frames_stat->parent = this; jabber_stat->parent = this; ether64_octets->parent = this; ether65127_octet->parent = this; ether128255_octet->parent = this; ether256511_octet->parent = this; ether5121023_octet->parent = this; ether10241518_octet->parent = this; in_ucast_pkt->parent = this; in_mcast_pkt->parent = this; in_bcast_pkt->parent = this; out_ucast_pkt->parent = this; out_bcast_pkt->parent = this; out_mcast_pkt->parent = this; tx_pkt->parent = this; if_in_errors->parent = this; if_in_octets->parent = this; ether_stat_multicast_pkt->parent = this; ether_stat_broadcast_pkt->parent = this; ether_stat_undersized_pkt->parent = this; out_octets->parent = this; in_pause_frame->parent = this; in_good_bytes->parent = this; in8021q_frames->parent = this; in_pkts1519_max_octets->parent = this; in_good_pkts->parent = this; in_drop_overrun->parent = this; in_drop_abort->parent = this; in_drop_invalid_vlan->parent = this; in_drop_invalid_dmac->parent = this; in_drop_invalid_encap->parent = this; in_drop_other->parent = this; in_mib_giant->parent = this; in_mib_jabber->parent = this; in_mibcrc->parent = this; in_error_collisions->parent = this; in_error_symbol->parent = this; out_good_bytes->parent = this; out8021q_frames->parent = this; out_pause_frames->parent = this; out_pkts1519_max_octets->parent = this; out_good_pkts->parent = this; out_drop_underrun->parent = this; out_drop_abort->parent = this; out_drop_other->parent = this; out_error_other->parent = this; in_error_giant->parent = this; in_error_runt->parent = this; in_error_jabbers->parent = this; in_error_fragments->parent = this; in_error_other->parent = this; in_pkt64_octet->parent = this; in_pkts65_to127_octets->parent = this; in_pkts128_to255_octets->parent = this; in_pkts256_to511_octets->parent = this; in_pkts512_to1023_octets->parent = this; in_pkts1024_to1518_octets->parent = this; outpkt64octet->parent = this; out_pkts65127_octets->parent = this; out_pkts128255_octets->parent = this; out_pkts256511_octets->parent = this; out_pkts5121023_octets->parent = this; out_pkts10241518_octets->parent = this; rx_util->parent = this; tx_util->parent = this; tx_undersized_pkt->parent = this; tx_oversized_pkt->parent = this; tx_fragments->parent = this; tx_jabber->parent = this; tx_bad_fcs->parent = this; yang_name = "macsec-hour24-ether-time-line-instance"; yang_parent_name = "macsec-hour24-ether-time-line-instances"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::~MacsecHour24EtherTimeLineInstance() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::has_data() const { if (is_presence_container) return true; return number.is_set || index_.is_set || valid.is_set || timestamp.is_set || last_clear_time.is_set || last_clear30_sec_time.is_set || last_clear15_min_time.is_set || last_clear24_hr_time.is_set || sec30_support.is_set || (rx_pkt != nullptr && rx_pkt->has_data()) || (stat_pkt != nullptr && stat_pkt->has_data()) || (octet_stat != nullptr && octet_stat->has_data()) || (oversize_pkt_stat != nullptr && oversize_pkt_stat->has_data()) || (fcs_errors_stat != nullptr && fcs_errors_stat->has_data()) || (long_frames_stat != nullptr && long_frames_stat->has_data()) || (jabber_stat != nullptr && jabber_stat->has_data()) || (ether64_octets != nullptr && ether64_octets->has_data()) || (ether65127_octet != nullptr && ether65127_octet->has_data()) || (ether128255_octet != nullptr && ether128255_octet->has_data()) || (ether256511_octet != nullptr && ether256511_octet->has_data()) || (ether5121023_octet != nullptr && ether5121023_octet->has_data()) || (ether10241518_octet != nullptr && ether10241518_octet->has_data()) || (in_ucast_pkt != nullptr && in_ucast_pkt->has_data()) || (in_mcast_pkt != nullptr && in_mcast_pkt->has_data()) || (in_bcast_pkt != nullptr && in_bcast_pkt->has_data()) || (out_ucast_pkt != nullptr && out_ucast_pkt->has_data()) || (out_bcast_pkt != nullptr && out_bcast_pkt->has_data()) || (out_mcast_pkt != nullptr && out_mcast_pkt->has_data()) || (tx_pkt != nullptr && tx_pkt->has_data()) || (if_in_errors != nullptr && if_in_errors->has_data()) || (if_in_octets != nullptr && if_in_octets->has_data()) || (ether_stat_multicast_pkt != nullptr && ether_stat_multicast_pkt->has_data()) || (ether_stat_broadcast_pkt != nullptr && ether_stat_broadcast_pkt->has_data()) || (ether_stat_undersized_pkt != nullptr && ether_stat_undersized_pkt->has_data()) || (out_octets != nullptr && out_octets->has_data()) || (in_pause_frame != nullptr && in_pause_frame->has_data()) || (in_good_bytes != nullptr && in_good_bytes->has_data()) || (in8021q_frames != nullptr && in8021q_frames->has_data()) || (in_pkts1519_max_octets != nullptr && in_pkts1519_max_octets->has_data()) || (in_good_pkts != nullptr && in_good_pkts->has_data()) || (in_drop_overrun != nullptr && in_drop_overrun->has_data()) || (in_drop_abort != nullptr && in_drop_abort->has_data()) || (in_drop_invalid_vlan != nullptr && in_drop_invalid_vlan->has_data()) || (in_drop_invalid_dmac != nullptr && in_drop_invalid_dmac->has_data()) || (in_drop_invalid_encap != nullptr && in_drop_invalid_encap->has_data()) || (in_drop_other != nullptr && in_drop_other->has_data()) || (in_mib_giant != nullptr && in_mib_giant->has_data()) || (in_mib_jabber != nullptr && in_mib_jabber->has_data()) || (in_mibcrc != nullptr && in_mibcrc->has_data()) || (in_error_collisions != nullptr && in_error_collisions->has_data()) || (in_error_symbol != nullptr && in_error_symbol->has_data()) || (out_good_bytes != nullptr && out_good_bytes->has_data()) || (out8021q_frames != nullptr && out8021q_frames->has_data()) || (out_pause_frames != nullptr && out_pause_frames->has_data()) || (out_pkts1519_max_octets != nullptr && out_pkts1519_max_octets->has_data()) || (out_good_pkts != nullptr && out_good_pkts->has_data()) || (out_drop_underrun != nullptr && out_drop_underrun->has_data()) || (out_drop_abort != nullptr && out_drop_abort->has_data()) || (out_drop_other != nullptr && out_drop_other->has_data()) || (out_error_other != nullptr && out_error_other->has_data()) || (in_error_giant != nullptr && in_error_giant->has_data()) || (in_error_runt != nullptr && in_error_runt->has_data()) || (in_error_jabbers != nullptr && in_error_jabbers->has_data()) || (in_error_fragments != nullptr && in_error_fragments->has_data()) || (in_error_other != nullptr && in_error_other->has_data()) || (in_pkt64_octet != nullptr && in_pkt64_octet->has_data()) || (in_pkts65_to127_octets != nullptr && in_pkts65_to127_octets->has_data()) || (in_pkts128_to255_octets != nullptr && in_pkts128_to255_octets->has_data()) || (in_pkts256_to511_octets != nullptr && in_pkts256_to511_octets->has_data()) || (in_pkts512_to1023_octets != nullptr && in_pkts512_to1023_octets->has_data()) || (in_pkts1024_to1518_octets != nullptr && in_pkts1024_to1518_octets->has_data()) || (outpkt64octet != nullptr && outpkt64octet->has_data()) || (out_pkts65127_octets != nullptr && out_pkts65127_octets->has_data()) || (out_pkts128255_octets != nullptr && out_pkts128255_octets->has_data()) || (out_pkts256511_octets != nullptr && out_pkts256511_octets->has_data()) || (out_pkts5121023_octets != nullptr && out_pkts5121023_octets->has_data()) || (out_pkts10241518_octets != nullptr && out_pkts10241518_octets->has_data()) || (rx_util != nullptr && rx_util->has_data()) || (tx_util != nullptr && tx_util->has_data()) || (tx_undersized_pkt != nullptr && tx_undersized_pkt->has_data()) || (tx_oversized_pkt != nullptr && tx_oversized_pkt->has_data()) || (tx_fragments != nullptr && tx_fragments->has_data()) || (tx_jabber != nullptr && tx_jabber->has_data()) || (tx_bad_fcs != nullptr && tx_bad_fcs->has_data()); } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::has_operation() const { return is_set(yfilter) || ydk::is_set(number.yfilter) || ydk::is_set(index_.yfilter) || ydk::is_set(valid.yfilter) || ydk::is_set(timestamp.yfilter) || ydk::is_set(last_clear_time.yfilter) || ydk::is_set(last_clear30_sec_time.yfilter) || ydk::is_set(last_clear15_min_time.yfilter) || ydk::is_set(last_clear24_hr_time.yfilter) || ydk::is_set(sec30_support.yfilter) || (rx_pkt != nullptr && rx_pkt->has_operation()) || (stat_pkt != nullptr && stat_pkt->has_operation()) || (octet_stat != nullptr && octet_stat->has_operation()) || (oversize_pkt_stat != nullptr && oversize_pkt_stat->has_operation()) || (fcs_errors_stat != nullptr && fcs_errors_stat->has_operation()) || (long_frames_stat != nullptr && long_frames_stat->has_operation()) || (jabber_stat != nullptr && jabber_stat->has_operation()) || (ether64_octets != nullptr && ether64_octets->has_operation()) || (ether65127_octet != nullptr && ether65127_octet->has_operation()) || (ether128255_octet != nullptr && ether128255_octet->has_operation()) || (ether256511_octet != nullptr && ether256511_octet->has_operation()) || (ether5121023_octet != nullptr && ether5121023_octet->has_operation()) || (ether10241518_octet != nullptr && ether10241518_octet->has_operation()) || (in_ucast_pkt != nullptr && in_ucast_pkt->has_operation()) || (in_mcast_pkt != nullptr && in_mcast_pkt->has_operation()) || (in_bcast_pkt != nullptr && in_bcast_pkt->has_operation()) || (out_ucast_pkt != nullptr && out_ucast_pkt->has_operation()) || (out_bcast_pkt != nullptr && out_bcast_pkt->has_operation()) || (out_mcast_pkt != nullptr && out_mcast_pkt->has_operation()) || (tx_pkt != nullptr && tx_pkt->has_operation()) || (if_in_errors != nullptr && if_in_errors->has_operation()) || (if_in_octets != nullptr && if_in_octets->has_operation()) || (ether_stat_multicast_pkt != nullptr && ether_stat_multicast_pkt->has_operation()) || (ether_stat_broadcast_pkt != nullptr && ether_stat_broadcast_pkt->has_operation()) || (ether_stat_undersized_pkt != nullptr && ether_stat_undersized_pkt->has_operation()) || (out_octets != nullptr && out_octets->has_operation()) || (in_pause_frame != nullptr && in_pause_frame->has_operation()) || (in_good_bytes != nullptr && in_good_bytes->has_operation()) || (in8021q_frames != nullptr && in8021q_frames->has_operation()) || (in_pkts1519_max_octets != nullptr && in_pkts1519_max_octets->has_operation()) || (in_good_pkts != nullptr && in_good_pkts->has_operation()) || (in_drop_overrun != nullptr && in_drop_overrun->has_operation()) || (in_drop_abort != nullptr && in_drop_abort->has_operation()) || (in_drop_invalid_vlan != nullptr && in_drop_invalid_vlan->has_operation()) || (in_drop_invalid_dmac != nullptr && in_drop_invalid_dmac->has_operation()) || (in_drop_invalid_encap != nullptr && in_drop_invalid_encap->has_operation()) || (in_drop_other != nullptr && in_drop_other->has_operation()) || (in_mib_giant != nullptr && in_mib_giant->has_operation()) || (in_mib_jabber != nullptr && in_mib_jabber->has_operation()) || (in_mibcrc != nullptr && in_mibcrc->has_operation()) || (in_error_collisions != nullptr && in_error_collisions->has_operation()) || (in_error_symbol != nullptr && in_error_symbol->has_operation()) || (out_good_bytes != nullptr && out_good_bytes->has_operation()) || (out8021q_frames != nullptr && out8021q_frames->has_operation()) || (out_pause_frames != nullptr && out_pause_frames->has_operation()) || (out_pkts1519_max_octets != nullptr && out_pkts1519_max_octets->has_operation()) || (out_good_pkts != nullptr && out_good_pkts->has_operation()) || (out_drop_underrun != nullptr && out_drop_underrun->has_operation()) || (out_drop_abort != nullptr && out_drop_abort->has_operation()) || (out_drop_other != nullptr && out_drop_other->has_operation()) || (out_error_other != nullptr && out_error_other->has_operation()) || (in_error_giant != nullptr && in_error_giant->has_operation()) || (in_error_runt != nullptr && in_error_runt->has_operation()) || (in_error_jabbers != nullptr && in_error_jabbers->has_operation()) || (in_error_fragments != nullptr && in_error_fragments->has_operation()) || (in_error_other != nullptr && in_error_other->has_operation()) || (in_pkt64_octet != nullptr && in_pkt64_octet->has_operation()) || (in_pkts65_to127_octets != nullptr && in_pkts65_to127_octets->has_operation()) || (in_pkts128_to255_octets != nullptr && in_pkts128_to255_octets->has_operation()) || (in_pkts256_to511_octets != nullptr && in_pkts256_to511_octets->has_operation()) || (in_pkts512_to1023_octets != nullptr && in_pkts512_to1023_octets->has_operation()) || (in_pkts1024_to1518_octets != nullptr && in_pkts1024_to1518_octets->has_operation()) || (outpkt64octet != nullptr && outpkt64octet->has_operation()) || (out_pkts65127_octets != nullptr && out_pkts65127_octets->has_operation()) || (out_pkts128255_octets != nullptr && out_pkts128255_octets->has_operation()) || (out_pkts256511_octets != nullptr && out_pkts256511_octets->has_operation()) || (out_pkts5121023_octets != nullptr && out_pkts5121023_octets->has_operation()) || (out_pkts10241518_octets != nullptr && out_pkts10241518_octets->has_operation()) || (rx_util != nullptr && rx_util->has_operation()) || (tx_util != nullptr && tx_util->has_operation()) || (tx_undersized_pkt != nullptr && tx_undersized_pkt->has_operation()) || (tx_oversized_pkt != nullptr && tx_oversized_pkt->has_operation()) || (tx_fragments != nullptr && tx_fragments->has_operation()) || (tx_jabber != nullptr && tx_jabber->has_operation()) || (tx_bad_fcs != nullptr && tx_bad_fcs->has_operation()); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "macsec-hour24-ether-time-line-instance"; ADD_KEY_TOKEN(number, "number"); return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (number.is_set || is_set(number.yfilter)) leaf_name_data.push_back(number.get_name_leafdata()); if (index_.is_set || is_set(index_.yfilter)) leaf_name_data.push_back(index_.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); if (timestamp.is_set || is_set(timestamp.yfilter)) leaf_name_data.push_back(timestamp.get_name_leafdata()); if (last_clear_time.is_set || is_set(last_clear_time.yfilter)) leaf_name_data.push_back(last_clear_time.get_name_leafdata()); if (last_clear30_sec_time.is_set || is_set(last_clear30_sec_time.yfilter)) leaf_name_data.push_back(last_clear30_sec_time.get_name_leafdata()); if (last_clear15_min_time.is_set || is_set(last_clear15_min_time.yfilter)) leaf_name_data.push_back(last_clear15_min_time.get_name_leafdata()); if (last_clear24_hr_time.is_set || is_set(last_clear24_hr_time.yfilter)) leaf_name_data.push_back(last_clear24_hr_time.get_name_leafdata()); if (sec30_support.is_set || is_set(sec30_support.yfilter)) leaf_name_data.push_back(sec30_support.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "rx-pkt") { if(rx_pkt == nullptr) { rx_pkt = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::RxPkt>(); } return rx_pkt; } if(child_yang_name == "stat-pkt") { if(stat_pkt == nullptr) { stat_pkt = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::StatPkt>(); } return stat_pkt; } if(child_yang_name == "octet-stat") { if(octet_stat == nullptr) { octet_stat = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OctetStat>(); } return octet_stat; } if(child_yang_name == "oversize-pkt-stat") { if(oversize_pkt_stat == nullptr) { oversize_pkt_stat = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OversizePktStat>(); } return oversize_pkt_stat; } if(child_yang_name == "fcs-errors-stat") { if(fcs_errors_stat == nullptr) { fcs_errors_stat = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::FcsErrorsStat>(); } return fcs_errors_stat; } if(child_yang_name == "long-frames-stat") { if(long_frames_stat == nullptr) { long_frames_stat = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::LongFramesStat>(); } return long_frames_stat; } if(child_yang_name == "jabber-stat") { if(jabber_stat == nullptr) { jabber_stat = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::JabberStat>(); } return jabber_stat; } if(child_yang_name == "ether64-octets") { if(ether64_octets == nullptr) { ether64_octets = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::Ether64Octets>(); } return ether64_octets; } if(child_yang_name == "ether65127-octet") { if(ether65127_octet == nullptr) { ether65127_octet = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::Ether65127Octet>(); } return ether65127_octet; } if(child_yang_name == "ether128255-octet") { if(ether128255_octet == nullptr) { ether128255_octet = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::Ether128255Octet>(); } return ether128255_octet; } if(child_yang_name == "ether256511-octet") { if(ether256511_octet == nullptr) { ether256511_octet = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::Ether256511Octet>(); } return ether256511_octet; } if(child_yang_name == "ether5121023-octet") { if(ether5121023_octet == nullptr) { ether5121023_octet = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::Ether5121023Octet>(); } return ether5121023_octet; } if(child_yang_name == "ether10241518-octet") { if(ether10241518_octet == nullptr) { ether10241518_octet = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::Ether10241518Octet>(); } return ether10241518_octet; } if(child_yang_name == "in-ucast-pkt") { if(in_ucast_pkt == nullptr) { in_ucast_pkt = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InUcastPkt>(); } return in_ucast_pkt; } if(child_yang_name == "in-mcast-pkt") { if(in_mcast_pkt == nullptr) { in_mcast_pkt = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InMcastPkt>(); } return in_mcast_pkt; } if(child_yang_name == "in-bcast-pkt") { if(in_bcast_pkt == nullptr) { in_bcast_pkt = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InBcastPkt>(); } return in_bcast_pkt; } if(child_yang_name == "out-ucast-pkt") { if(out_ucast_pkt == nullptr) { out_ucast_pkt = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutUcastPkt>(); } return out_ucast_pkt; } if(child_yang_name == "out-bcast-pkt") { if(out_bcast_pkt == nullptr) { out_bcast_pkt = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutBcastPkt>(); } return out_bcast_pkt; } if(child_yang_name == "out-mcast-pkt") { if(out_mcast_pkt == nullptr) { out_mcast_pkt = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutMcastPkt>(); } return out_mcast_pkt; } if(child_yang_name == "tx-pkt") { if(tx_pkt == nullptr) { tx_pkt = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::TxPkt>(); } return tx_pkt; } if(child_yang_name == "if-in-errors") { if(if_in_errors == nullptr) { if_in_errors = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::IfInErrors>(); } return if_in_errors; } if(child_yang_name == "if-in-octets") { if(if_in_octets == nullptr) { if_in_octets = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::IfInOctets>(); } return if_in_octets; } if(child_yang_name == "ether-stat-multicast-pkt") { if(ether_stat_multicast_pkt == nullptr) { ether_stat_multicast_pkt = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::EtherStatMulticastPkt>(); } return ether_stat_multicast_pkt; } if(child_yang_name == "ether-stat-broadcast-pkt") { if(ether_stat_broadcast_pkt == nullptr) { ether_stat_broadcast_pkt = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::EtherStatBroadcastPkt>(); } return ether_stat_broadcast_pkt; } if(child_yang_name == "ether-stat-undersized-pkt") { if(ether_stat_undersized_pkt == nullptr) { ether_stat_undersized_pkt = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::EtherStatUndersizedPkt>(); } return ether_stat_undersized_pkt; } if(child_yang_name == "out-octets") { if(out_octets == nullptr) { out_octets = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutOctets>(); } return out_octets; } if(child_yang_name == "in-pause-frame") { if(in_pause_frame == nullptr) { in_pause_frame = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InPauseFrame>(); } return in_pause_frame; } if(child_yang_name == "in-good-bytes") { if(in_good_bytes == nullptr) { in_good_bytes = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InGoodBytes>(); } return in_good_bytes; } if(child_yang_name == "in8021q-frames") { if(in8021q_frames == nullptr) { in8021q_frames = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::In8021qFrames>(); } return in8021q_frames; } if(child_yang_name == "in-pkts1519-max-octets") { if(in_pkts1519_max_octets == nullptr) { in_pkts1519_max_octets = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InPkts1519MaxOctets>(); } return in_pkts1519_max_octets; } if(child_yang_name == "in-good-pkts") { if(in_good_pkts == nullptr) { in_good_pkts = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InGoodPkts>(); } return in_good_pkts; } if(child_yang_name == "in-drop-overrun") { if(in_drop_overrun == nullptr) { in_drop_overrun = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InDropOverrun>(); } return in_drop_overrun; } if(child_yang_name == "in-drop-abort") { if(in_drop_abort == nullptr) { in_drop_abort = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InDropAbort>(); } return in_drop_abort; } if(child_yang_name == "in-drop-invalid-vlan") { if(in_drop_invalid_vlan == nullptr) { in_drop_invalid_vlan = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InDropInvalidVlan>(); } return in_drop_invalid_vlan; } if(child_yang_name == "in-drop-invalid-dmac") { if(in_drop_invalid_dmac == nullptr) { in_drop_invalid_dmac = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InDropInvalidDmac>(); } return in_drop_invalid_dmac; } if(child_yang_name == "in-drop-invalid-encap") { if(in_drop_invalid_encap == nullptr) { in_drop_invalid_encap = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InDropInvalidEncap>(); } return in_drop_invalid_encap; } if(child_yang_name == "in-drop-other") { if(in_drop_other == nullptr) { in_drop_other = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InDropOther>(); } return in_drop_other; } if(child_yang_name == "in-mib-giant") { if(in_mib_giant == nullptr) { in_mib_giant = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InMibGiant>(); } return in_mib_giant; } if(child_yang_name == "in-mib-jabber") { if(in_mib_jabber == nullptr) { in_mib_jabber = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InMibJabber>(); } return in_mib_jabber; } if(child_yang_name == "in-mibcrc") { if(in_mibcrc == nullptr) { in_mibcrc = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InMibcrc>(); } return in_mibcrc; } if(child_yang_name == "in-error-collisions") { if(in_error_collisions == nullptr) { in_error_collisions = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InErrorCollisions>(); } return in_error_collisions; } if(child_yang_name == "in-error-symbol") { if(in_error_symbol == nullptr) { in_error_symbol = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InErrorSymbol>(); } return in_error_symbol; } if(child_yang_name == "out-good-bytes") { if(out_good_bytes == nullptr) { out_good_bytes = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutGoodBytes>(); } return out_good_bytes; } if(child_yang_name == "out8021q-frames") { if(out8021q_frames == nullptr) { out8021q_frames = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::Out8021qFrames>(); } return out8021q_frames; } if(child_yang_name == "out-pause-frames") { if(out_pause_frames == nullptr) { out_pause_frames = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutPauseFrames>(); } return out_pause_frames; } if(child_yang_name == "out-pkts1519-max-octets") { if(out_pkts1519_max_octets == nullptr) { out_pkts1519_max_octets = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutPkts1519MaxOctets>(); } return out_pkts1519_max_octets; } if(child_yang_name == "out-good-pkts") { if(out_good_pkts == nullptr) { out_good_pkts = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutGoodPkts>(); } return out_good_pkts; } if(child_yang_name == "out-drop-underrun") { if(out_drop_underrun == nullptr) { out_drop_underrun = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutDropUnderrun>(); } return out_drop_underrun; } if(child_yang_name == "out-drop-abort") { if(out_drop_abort == nullptr) { out_drop_abort = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutDropAbort>(); } return out_drop_abort; } if(child_yang_name == "out-drop-other") { if(out_drop_other == nullptr) { out_drop_other = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutDropOther>(); } return out_drop_other; } if(child_yang_name == "out-error-other") { if(out_error_other == nullptr) { out_error_other = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutErrorOther>(); } return out_error_other; } if(child_yang_name == "in-error-giant") { if(in_error_giant == nullptr) { in_error_giant = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InErrorGiant>(); } return in_error_giant; } if(child_yang_name == "in-error-runt") { if(in_error_runt == nullptr) { in_error_runt = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InErrorRunt>(); } return in_error_runt; } if(child_yang_name == "in-error-jabbers") { if(in_error_jabbers == nullptr) { in_error_jabbers = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InErrorJabbers>(); } return in_error_jabbers; } if(child_yang_name == "in-error-fragments") { if(in_error_fragments == nullptr) { in_error_fragments = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InErrorFragments>(); } return in_error_fragments; } if(child_yang_name == "in-error-other") { if(in_error_other == nullptr) { in_error_other = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InErrorOther>(); } return in_error_other; } if(child_yang_name == "in-pkt64-octet") { if(in_pkt64_octet == nullptr) { in_pkt64_octet = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InPkt64Octet>(); } return in_pkt64_octet; } if(child_yang_name == "in-pkts65-to127-octets") { if(in_pkts65_to127_octets == nullptr) { in_pkts65_to127_octets = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InPkts65To127Octets>(); } return in_pkts65_to127_octets; } if(child_yang_name == "in-pkts128-to255-octets") { if(in_pkts128_to255_octets == nullptr) { in_pkts128_to255_octets = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InPkts128To255Octets>(); } return in_pkts128_to255_octets; } if(child_yang_name == "in-pkts256-to511-octets") { if(in_pkts256_to511_octets == nullptr) { in_pkts256_to511_octets = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InPkts256To511Octets>(); } return in_pkts256_to511_octets; } if(child_yang_name == "in-pkts512-to1023-octets") { if(in_pkts512_to1023_octets == nullptr) { in_pkts512_to1023_octets = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InPkts512To1023Octets>(); } return in_pkts512_to1023_octets; } if(child_yang_name == "in-pkts1024-to1518-octets") { if(in_pkts1024_to1518_octets == nullptr) { in_pkts1024_to1518_octets = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InPkts1024To1518Octets>(); } return in_pkts1024_to1518_octets; } if(child_yang_name == "outpkt64octet") { if(outpkt64octet == nullptr) { outpkt64octet = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::Outpkt64octet>(); } return outpkt64octet; } if(child_yang_name == "out-pkts65127-octets") { if(out_pkts65127_octets == nullptr) { out_pkts65127_octets = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutPkts65127Octets>(); } return out_pkts65127_octets; } if(child_yang_name == "out-pkts128255-octets") { if(out_pkts128255_octets == nullptr) { out_pkts128255_octets = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutPkts128255Octets>(); } return out_pkts128255_octets; } if(child_yang_name == "out-pkts256511-octets") { if(out_pkts256511_octets == nullptr) { out_pkts256511_octets = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutPkts256511Octets>(); } return out_pkts256511_octets; } if(child_yang_name == "out-pkts5121023-octets") { if(out_pkts5121023_octets == nullptr) { out_pkts5121023_octets = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutPkts5121023Octets>(); } return out_pkts5121023_octets; } if(child_yang_name == "out-pkts10241518-octets") { if(out_pkts10241518_octets == nullptr) { out_pkts10241518_octets = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutPkts10241518Octets>(); } return out_pkts10241518_octets; } if(child_yang_name == "rx-util") { if(rx_util == nullptr) { rx_util = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::RxUtil>(); } return rx_util; } if(child_yang_name == "tx-util") { if(tx_util == nullptr) { tx_util = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::TxUtil>(); } return tx_util; } if(child_yang_name == "tx-undersized-pkt") { if(tx_undersized_pkt == nullptr) { tx_undersized_pkt = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::TxUndersizedPkt>(); } return tx_undersized_pkt; } if(child_yang_name == "tx-oversized-pkt") { if(tx_oversized_pkt == nullptr) { tx_oversized_pkt = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::TxOversizedPkt>(); } return tx_oversized_pkt; } if(child_yang_name == "tx-fragments") { if(tx_fragments == nullptr) { tx_fragments = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::TxFragments>(); } return tx_fragments; } if(child_yang_name == "tx-jabber") { if(tx_jabber == nullptr) { tx_jabber = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::TxJabber>(); } return tx_jabber; } if(child_yang_name == "tx-bad-fcs") { if(tx_bad_fcs == nullptr) { tx_bad_fcs = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::TxBadFcs>(); } return tx_bad_fcs; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; if(rx_pkt != nullptr) { _children["rx-pkt"] = rx_pkt; } if(stat_pkt != nullptr) { _children["stat-pkt"] = stat_pkt; } if(octet_stat != nullptr) { _children["octet-stat"] = octet_stat; } if(oversize_pkt_stat != nullptr) { _children["oversize-pkt-stat"] = oversize_pkt_stat; } if(fcs_errors_stat != nullptr) { _children["fcs-errors-stat"] = fcs_errors_stat; } if(long_frames_stat != nullptr) { _children["long-frames-stat"] = long_frames_stat; } if(jabber_stat != nullptr) { _children["jabber-stat"] = jabber_stat; } if(ether64_octets != nullptr) { _children["ether64-octets"] = ether64_octets; } if(ether65127_octet != nullptr) { _children["ether65127-octet"] = ether65127_octet; } if(ether128255_octet != nullptr) { _children["ether128255-octet"] = ether128255_octet; } if(ether256511_octet != nullptr) { _children["ether256511-octet"] = ether256511_octet; } if(ether5121023_octet != nullptr) { _children["ether5121023-octet"] = ether5121023_octet; } if(ether10241518_octet != nullptr) { _children["ether10241518-octet"] = ether10241518_octet; } if(in_ucast_pkt != nullptr) { _children["in-ucast-pkt"] = in_ucast_pkt; } if(in_mcast_pkt != nullptr) { _children["in-mcast-pkt"] = in_mcast_pkt; } if(in_bcast_pkt != nullptr) { _children["in-bcast-pkt"] = in_bcast_pkt; } if(out_ucast_pkt != nullptr) { _children["out-ucast-pkt"] = out_ucast_pkt; } if(out_bcast_pkt != nullptr) { _children["out-bcast-pkt"] = out_bcast_pkt; } if(out_mcast_pkt != nullptr) { _children["out-mcast-pkt"] = out_mcast_pkt; } if(tx_pkt != nullptr) { _children["tx-pkt"] = tx_pkt; } if(if_in_errors != nullptr) { _children["if-in-errors"] = if_in_errors; } if(if_in_octets != nullptr) { _children["if-in-octets"] = if_in_octets; } if(ether_stat_multicast_pkt != nullptr) { _children["ether-stat-multicast-pkt"] = ether_stat_multicast_pkt; } if(ether_stat_broadcast_pkt != nullptr) { _children["ether-stat-broadcast-pkt"] = ether_stat_broadcast_pkt; } if(ether_stat_undersized_pkt != nullptr) { _children["ether-stat-undersized-pkt"] = ether_stat_undersized_pkt; } if(out_octets != nullptr) { _children["out-octets"] = out_octets; } if(in_pause_frame != nullptr) { _children["in-pause-frame"] = in_pause_frame; } if(in_good_bytes != nullptr) { _children["in-good-bytes"] = in_good_bytes; } if(in8021q_frames != nullptr) { _children["in8021q-frames"] = in8021q_frames; } if(in_pkts1519_max_octets != nullptr) { _children["in-pkts1519-max-octets"] = in_pkts1519_max_octets; } if(in_good_pkts != nullptr) { _children["in-good-pkts"] = in_good_pkts; } if(in_drop_overrun != nullptr) { _children["in-drop-overrun"] = in_drop_overrun; } if(in_drop_abort != nullptr) { _children["in-drop-abort"] = in_drop_abort; } if(in_drop_invalid_vlan != nullptr) { _children["in-drop-invalid-vlan"] = in_drop_invalid_vlan; } if(in_drop_invalid_dmac != nullptr) { _children["in-drop-invalid-dmac"] = in_drop_invalid_dmac; } if(in_drop_invalid_encap != nullptr) { _children["in-drop-invalid-encap"] = in_drop_invalid_encap; } if(in_drop_other != nullptr) { _children["in-drop-other"] = in_drop_other; } if(in_mib_giant != nullptr) { _children["in-mib-giant"] = in_mib_giant; } if(in_mib_jabber != nullptr) { _children["in-mib-jabber"] = in_mib_jabber; } if(in_mibcrc != nullptr) { _children["in-mibcrc"] = in_mibcrc; } if(in_error_collisions != nullptr) { _children["in-error-collisions"] = in_error_collisions; } if(in_error_symbol != nullptr) { _children["in-error-symbol"] = in_error_symbol; } if(out_good_bytes != nullptr) { _children["out-good-bytes"] = out_good_bytes; } if(out8021q_frames != nullptr) { _children["out8021q-frames"] = out8021q_frames; } if(out_pause_frames != nullptr) { _children["out-pause-frames"] = out_pause_frames; } if(out_pkts1519_max_octets != nullptr) { _children["out-pkts1519-max-octets"] = out_pkts1519_max_octets; } if(out_good_pkts != nullptr) { _children["out-good-pkts"] = out_good_pkts; } if(out_drop_underrun != nullptr) { _children["out-drop-underrun"] = out_drop_underrun; } if(out_drop_abort != nullptr) { _children["out-drop-abort"] = out_drop_abort; } if(out_drop_other != nullptr) { _children["out-drop-other"] = out_drop_other; } if(out_error_other != nullptr) { _children["out-error-other"] = out_error_other; } if(in_error_giant != nullptr) { _children["in-error-giant"] = in_error_giant; } if(in_error_runt != nullptr) { _children["in-error-runt"] = in_error_runt; } if(in_error_jabbers != nullptr) { _children["in-error-jabbers"] = in_error_jabbers; } if(in_error_fragments != nullptr) { _children["in-error-fragments"] = in_error_fragments; } if(in_error_other != nullptr) { _children["in-error-other"] = in_error_other; } if(in_pkt64_octet != nullptr) { _children["in-pkt64-octet"] = in_pkt64_octet; } if(in_pkts65_to127_octets != nullptr) { _children["in-pkts65-to127-octets"] = in_pkts65_to127_octets; } if(in_pkts128_to255_octets != nullptr) { _children["in-pkts128-to255-octets"] = in_pkts128_to255_octets; } if(in_pkts256_to511_octets != nullptr) { _children["in-pkts256-to511-octets"] = in_pkts256_to511_octets; } if(in_pkts512_to1023_octets != nullptr) { _children["in-pkts512-to1023-octets"] = in_pkts512_to1023_octets; } if(in_pkts1024_to1518_octets != nullptr) { _children["in-pkts1024-to1518-octets"] = in_pkts1024_to1518_octets; } if(outpkt64octet != nullptr) { _children["outpkt64octet"] = outpkt64octet; } if(out_pkts65127_octets != nullptr) { _children["out-pkts65127-octets"] = out_pkts65127_octets; } if(out_pkts128255_octets != nullptr) { _children["out-pkts128255-octets"] = out_pkts128255_octets; } if(out_pkts256511_octets != nullptr) { _children["out-pkts256511-octets"] = out_pkts256511_octets; } if(out_pkts5121023_octets != nullptr) { _children["out-pkts5121023-octets"] = out_pkts5121023_octets; } if(out_pkts10241518_octets != nullptr) { _children["out-pkts10241518-octets"] = out_pkts10241518_octets; } if(rx_util != nullptr) { _children["rx-util"] = rx_util; } if(tx_util != nullptr) { _children["tx-util"] = tx_util; } if(tx_undersized_pkt != nullptr) { _children["tx-undersized-pkt"] = tx_undersized_pkt; } if(tx_oversized_pkt != nullptr) { _children["tx-oversized-pkt"] = tx_oversized_pkt; } if(tx_fragments != nullptr) { _children["tx-fragments"] = tx_fragments; } if(tx_jabber != nullptr) { _children["tx-jabber"] = tx_jabber; } if(tx_bad_fcs != nullptr) { _children["tx-bad-fcs"] = tx_bad_fcs; } return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::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 == "number") { number = value; number.value_namespace = name_space; number.value_namespace_prefix = name_space_prefix; } if(value_path == "index") { index_ = value; index_.value_namespace = name_space; index_.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } if(value_path == "timestamp") { timestamp = value; timestamp.value_namespace = name_space; timestamp.value_namespace_prefix = name_space_prefix; } if(value_path == "last-clear-time") { last_clear_time = value; last_clear_time.value_namespace = name_space; last_clear_time.value_namespace_prefix = name_space_prefix; } if(value_path == "last-clear30-sec-time") { last_clear30_sec_time = value; last_clear30_sec_time.value_namespace = name_space; last_clear30_sec_time.value_namespace_prefix = name_space_prefix; } if(value_path == "last-clear15-min-time") { last_clear15_min_time = value; last_clear15_min_time.value_namespace = name_space; last_clear15_min_time.value_namespace_prefix = name_space_prefix; } if(value_path == "last-clear24-hr-time") { last_clear24_hr_time = value; last_clear24_hr_time.value_namespace = name_space; last_clear24_hr_time.value_namespace_prefix = name_space_prefix; } if(value_path == "sec30-support") { sec30_support = value; sec30_support.value_namespace = name_space; sec30_support.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "number") { number.yfilter = yfilter; } if(value_path == "index") { index_.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } if(value_path == "timestamp") { timestamp.yfilter = yfilter; } if(value_path == "last-clear-time") { last_clear_time.yfilter = yfilter; } if(value_path == "last-clear30-sec-time") { last_clear30_sec_time.yfilter = yfilter; } if(value_path == "last-clear15-min-time") { last_clear15_min_time.yfilter = yfilter; } if(value_path == "last-clear24-hr-time") { last_clear24_hr_time.yfilter = yfilter; } if(value_path == "sec30-support") { sec30_support.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::has_leaf_or_child_of_name(const std::string & name) const { if(name == "rx-pkt" || name == "stat-pkt" || name == "octet-stat" || name == "oversize-pkt-stat" || name == "fcs-errors-stat" || name == "long-frames-stat" || name == "jabber-stat" || name == "ether64-octets" || name == "ether65127-octet" || name == "ether128255-octet" || name == "ether256511-octet" || name == "ether5121023-octet" || name == "ether10241518-octet" || name == "in-ucast-pkt" || name == "in-mcast-pkt" || name == "in-bcast-pkt" || name == "out-ucast-pkt" || name == "out-bcast-pkt" || name == "out-mcast-pkt" || name == "tx-pkt" || name == "if-in-errors" || name == "if-in-octets" || name == "ether-stat-multicast-pkt" || name == "ether-stat-broadcast-pkt" || name == "ether-stat-undersized-pkt" || name == "out-octets" || name == "in-pause-frame" || name == "in-good-bytes" || name == "in8021q-frames" || name == "in-pkts1519-max-octets" || name == "in-good-pkts" || name == "in-drop-overrun" || name == "in-drop-abort" || name == "in-drop-invalid-vlan" || name == "in-drop-invalid-dmac" || name == "in-drop-invalid-encap" || name == "in-drop-other" || name == "in-mib-giant" || name == "in-mib-jabber" || name == "in-mibcrc" || name == "in-error-collisions" || name == "in-error-symbol" || name == "out-good-bytes" || name == "out8021q-frames" || name == "out-pause-frames" || name == "out-pkts1519-max-octets" || name == "out-good-pkts" || name == "out-drop-underrun" || name == "out-drop-abort" || name == "out-drop-other" || name == "out-error-other" || name == "in-error-giant" || name == "in-error-runt" || name == "in-error-jabbers" || name == "in-error-fragments" || name == "in-error-other" || name == "in-pkt64-octet" || name == "in-pkts65-to127-octets" || name == "in-pkts128-to255-octets" || name == "in-pkts256-to511-octets" || name == "in-pkts512-to1023-octets" || name == "in-pkts1024-to1518-octets" || name == "outpkt64octet" || name == "out-pkts65127-octets" || name == "out-pkts128255-octets" || name == "out-pkts256511-octets" || name == "out-pkts5121023-octets" || name == "out-pkts10241518-octets" || name == "rx-util" || name == "tx-util" || name == "tx-undersized-pkt" || name == "tx-oversized-pkt" || name == "tx-fragments" || name == "tx-jabber" || name == "tx-bad-fcs" || name == "number" || name == "index" || name == "valid" || name == "timestamp" || name == "last-clear-time" || name == "last-clear30-sec-time" || name == "last-clear15-min-time" || name == "last-clear24-hr-time" || name == "sec30-support") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::RxPkt::RxPkt() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "rx-pkt"; yang_parent_name = "macsec-hour24-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::RxPkt::~RxPkt() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::RxPkt::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::RxPkt::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::RxPkt::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "rx-pkt"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::RxPkt::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::RxPkt::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::RxPkt::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::RxPkt::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::RxPkt::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::RxPkt::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::StatPkt::StatPkt() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "stat-pkt"; yang_parent_name = "macsec-hour24-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::StatPkt::~StatPkt() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::StatPkt::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::StatPkt::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::StatPkt::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "stat-pkt"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::StatPkt::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::StatPkt::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::StatPkt::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::StatPkt::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::StatPkt::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::StatPkt::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OctetStat::OctetStat() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "octet-stat"; yang_parent_name = "macsec-hour24-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OctetStat::~OctetStat() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OctetStat::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OctetStat::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OctetStat::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "octet-stat"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OctetStat::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OctetStat::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OctetStat::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OctetStat::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OctetStat::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OctetStat::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OversizePktStat::OversizePktStat() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "oversize-pkt-stat"; yang_parent_name = "macsec-hour24-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OversizePktStat::~OversizePktStat() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OversizePktStat::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OversizePktStat::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OversizePktStat::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "oversize-pkt-stat"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OversizePktStat::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OversizePktStat::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OversizePktStat::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OversizePktStat::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OversizePktStat::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OversizePktStat::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::FcsErrorsStat::FcsErrorsStat() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "fcs-errors-stat"; yang_parent_name = "macsec-hour24-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::FcsErrorsStat::~FcsErrorsStat() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::FcsErrorsStat::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::FcsErrorsStat::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::FcsErrorsStat::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "fcs-errors-stat"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::FcsErrorsStat::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::FcsErrorsStat::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::FcsErrorsStat::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::FcsErrorsStat::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::FcsErrorsStat::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::FcsErrorsStat::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::LongFramesStat::LongFramesStat() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "long-frames-stat"; yang_parent_name = "macsec-hour24-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::LongFramesStat::~LongFramesStat() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::LongFramesStat::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::LongFramesStat::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::LongFramesStat::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "long-frames-stat"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::LongFramesStat::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::LongFramesStat::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::LongFramesStat::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::LongFramesStat::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::LongFramesStat::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::LongFramesStat::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::JabberStat::JabberStat() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "jabber-stat"; yang_parent_name = "macsec-hour24-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::JabberStat::~JabberStat() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::JabberStat::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::JabberStat::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::JabberStat::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "jabber-stat"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::JabberStat::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::JabberStat::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::JabberStat::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::JabberStat::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::JabberStat::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::JabberStat::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::Ether64Octets::Ether64Octets() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "ether64-octets"; yang_parent_name = "macsec-hour24-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::Ether64Octets::~Ether64Octets() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::Ether64Octets::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::Ether64Octets::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::Ether64Octets::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "ether64-octets"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::Ether64Octets::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::Ether64Octets::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::Ether64Octets::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::Ether64Octets::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::Ether64Octets::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::Ether64Octets::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::Ether65127Octet::Ether65127Octet() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "ether65127-octet"; yang_parent_name = "macsec-hour24-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::Ether65127Octet::~Ether65127Octet() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::Ether65127Octet::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::Ether65127Octet::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::Ether65127Octet::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "ether65127-octet"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::Ether65127Octet::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::Ether65127Octet::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::Ether65127Octet::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::Ether65127Octet::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::Ether65127Octet::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::Ether65127Octet::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::Ether128255Octet::Ether128255Octet() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "ether128255-octet"; yang_parent_name = "macsec-hour24-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::Ether128255Octet::~Ether128255Octet() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::Ether128255Octet::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::Ether128255Octet::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::Ether128255Octet::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "ether128255-octet"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::Ether128255Octet::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::Ether128255Octet::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::Ether128255Octet::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::Ether128255Octet::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::Ether128255Octet::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::Ether128255Octet::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::Ether256511Octet::Ether256511Octet() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "ether256511-octet"; yang_parent_name = "macsec-hour24-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::Ether256511Octet::~Ether256511Octet() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::Ether256511Octet::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::Ether256511Octet::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::Ether256511Octet::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "ether256511-octet"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::Ether256511Octet::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::Ether256511Octet::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::Ether256511Octet::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::Ether256511Octet::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::Ether256511Octet::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::Ether256511Octet::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::Ether5121023Octet::Ether5121023Octet() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "ether5121023-octet"; yang_parent_name = "macsec-hour24-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::Ether5121023Octet::~Ether5121023Octet() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::Ether5121023Octet::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::Ether5121023Octet::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::Ether5121023Octet::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "ether5121023-octet"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::Ether5121023Octet::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::Ether5121023Octet::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::Ether5121023Octet::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::Ether5121023Octet::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::Ether5121023Octet::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::Ether5121023Octet::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::Ether10241518Octet::Ether10241518Octet() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "ether10241518-octet"; yang_parent_name = "macsec-hour24-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::Ether10241518Octet::~Ether10241518Octet() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::Ether10241518Octet::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::Ether10241518Octet::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::Ether10241518Octet::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "ether10241518-octet"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::Ether10241518Octet::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::Ether10241518Octet::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::Ether10241518Octet::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::Ether10241518Octet::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::Ether10241518Octet::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::Ether10241518Octet::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InUcastPkt::InUcastPkt() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "in-ucast-pkt"; yang_parent_name = "macsec-hour24-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InUcastPkt::~InUcastPkt() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InUcastPkt::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InUcastPkt::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InUcastPkt::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "in-ucast-pkt"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InUcastPkt::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InUcastPkt::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InUcastPkt::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InUcastPkt::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InUcastPkt::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InUcastPkt::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InMcastPkt::InMcastPkt() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "in-mcast-pkt"; yang_parent_name = "macsec-hour24-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InMcastPkt::~InMcastPkt() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InMcastPkt::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InMcastPkt::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InMcastPkt::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "in-mcast-pkt"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InMcastPkt::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InMcastPkt::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InMcastPkt::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InMcastPkt::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InMcastPkt::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InMcastPkt::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InBcastPkt::InBcastPkt() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "in-bcast-pkt"; yang_parent_name = "macsec-hour24-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InBcastPkt::~InBcastPkt() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InBcastPkt::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InBcastPkt::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InBcastPkt::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "in-bcast-pkt"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InBcastPkt::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InBcastPkt::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InBcastPkt::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InBcastPkt::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InBcastPkt::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InBcastPkt::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutUcastPkt::OutUcastPkt() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "out-ucast-pkt"; yang_parent_name = "macsec-hour24-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutUcastPkt::~OutUcastPkt() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutUcastPkt::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutUcastPkt::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutUcastPkt::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "out-ucast-pkt"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutUcastPkt::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutUcastPkt::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutUcastPkt::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutUcastPkt::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutUcastPkt::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutUcastPkt::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutBcastPkt::OutBcastPkt() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "out-bcast-pkt"; yang_parent_name = "macsec-hour24-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutBcastPkt::~OutBcastPkt() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutBcastPkt::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutBcastPkt::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutBcastPkt::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "out-bcast-pkt"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutBcastPkt::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutBcastPkt::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutBcastPkt::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutBcastPkt::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutBcastPkt::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutBcastPkt::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutMcastPkt::OutMcastPkt() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "out-mcast-pkt"; yang_parent_name = "macsec-hour24-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutMcastPkt::~OutMcastPkt() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutMcastPkt::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutMcastPkt::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutMcastPkt::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "out-mcast-pkt"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutMcastPkt::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutMcastPkt::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutMcastPkt::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutMcastPkt::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutMcastPkt::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutMcastPkt::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::TxPkt::TxPkt() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "tx-pkt"; yang_parent_name = "macsec-hour24-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::TxPkt::~TxPkt() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::TxPkt::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::TxPkt::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::TxPkt::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "tx-pkt"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::TxPkt::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::TxPkt::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::TxPkt::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::TxPkt::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::TxPkt::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::TxPkt::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::IfInErrors::IfInErrors() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "if-in-errors"; yang_parent_name = "macsec-hour24-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::IfInErrors::~IfInErrors() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::IfInErrors::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::IfInErrors::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::IfInErrors::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "if-in-errors"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::IfInErrors::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::IfInErrors::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::IfInErrors::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::IfInErrors::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::IfInErrors::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::IfInErrors::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::IfInOctets::IfInOctets() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "if-in-octets"; yang_parent_name = "macsec-hour24-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::IfInOctets::~IfInOctets() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::IfInOctets::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::IfInOctets::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::IfInOctets::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "if-in-octets"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::IfInOctets::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::IfInOctets::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::IfInOctets::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::IfInOctets::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::IfInOctets::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::IfInOctets::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::EtherStatMulticastPkt::EtherStatMulticastPkt() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "ether-stat-multicast-pkt"; yang_parent_name = "macsec-hour24-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::EtherStatMulticastPkt::~EtherStatMulticastPkt() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::EtherStatMulticastPkt::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::EtherStatMulticastPkt::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::EtherStatMulticastPkt::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "ether-stat-multicast-pkt"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::EtherStatMulticastPkt::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::EtherStatMulticastPkt::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::EtherStatMulticastPkt::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::EtherStatMulticastPkt::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::EtherStatMulticastPkt::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::EtherStatMulticastPkt::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::EtherStatBroadcastPkt::EtherStatBroadcastPkt() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "ether-stat-broadcast-pkt"; yang_parent_name = "macsec-hour24-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::EtherStatBroadcastPkt::~EtherStatBroadcastPkt() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::EtherStatBroadcastPkt::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::EtherStatBroadcastPkt::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::EtherStatBroadcastPkt::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "ether-stat-broadcast-pkt"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::EtherStatBroadcastPkt::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::EtherStatBroadcastPkt::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::EtherStatBroadcastPkt::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::EtherStatBroadcastPkt::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::EtherStatBroadcastPkt::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::EtherStatBroadcastPkt::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::EtherStatUndersizedPkt::EtherStatUndersizedPkt() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "ether-stat-undersized-pkt"; yang_parent_name = "macsec-hour24-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::EtherStatUndersizedPkt::~EtherStatUndersizedPkt() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::EtherStatUndersizedPkt::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::EtherStatUndersizedPkt::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::EtherStatUndersizedPkt::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "ether-stat-undersized-pkt"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::EtherStatUndersizedPkt::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::EtherStatUndersizedPkt::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::EtherStatUndersizedPkt::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::EtherStatUndersizedPkt::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::EtherStatUndersizedPkt::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::EtherStatUndersizedPkt::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutOctets::OutOctets() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "out-octets"; yang_parent_name = "macsec-hour24-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutOctets::~OutOctets() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutOctets::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutOctets::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutOctets::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "out-octets"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutOctets::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutOctets::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutOctets::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutOctets::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutOctets::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutOctets::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InPauseFrame::InPauseFrame() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "in-pause-frame"; yang_parent_name = "macsec-hour24-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InPauseFrame::~InPauseFrame() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InPauseFrame::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InPauseFrame::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InPauseFrame::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "in-pause-frame"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InPauseFrame::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InPauseFrame::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InPauseFrame::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InPauseFrame::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InPauseFrame::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InPauseFrame::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InGoodBytes::InGoodBytes() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "in-good-bytes"; yang_parent_name = "macsec-hour24-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InGoodBytes::~InGoodBytes() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InGoodBytes::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InGoodBytes::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InGoodBytes::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "in-good-bytes"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InGoodBytes::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InGoodBytes::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InGoodBytes::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InGoodBytes::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InGoodBytes::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InGoodBytes::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::In8021qFrames::In8021qFrames() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "in8021q-frames"; yang_parent_name = "macsec-hour24-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::In8021qFrames::~In8021qFrames() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::In8021qFrames::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::In8021qFrames::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::In8021qFrames::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "in8021q-frames"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::In8021qFrames::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::In8021qFrames::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::In8021qFrames::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::In8021qFrames::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::In8021qFrames::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::In8021qFrames::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InPkts1519MaxOctets::InPkts1519MaxOctets() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "in-pkts1519-max-octets"; yang_parent_name = "macsec-hour24-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InPkts1519MaxOctets::~InPkts1519MaxOctets() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InPkts1519MaxOctets::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InPkts1519MaxOctets::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InPkts1519MaxOctets::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "in-pkts1519-max-octets"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InPkts1519MaxOctets::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InPkts1519MaxOctets::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InPkts1519MaxOctets::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InPkts1519MaxOctets::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InPkts1519MaxOctets::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InPkts1519MaxOctets::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InGoodPkts::InGoodPkts() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "in-good-pkts"; yang_parent_name = "macsec-hour24-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InGoodPkts::~InGoodPkts() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InGoodPkts::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InGoodPkts::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InGoodPkts::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "in-good-pkts"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InGoodPkts::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InGoodPkts::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InGoodPkts::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InGoodPkts::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InGoodPkts::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InGoodPkts::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InDropOverrun::InDropOverrun() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "in-drop-overrun"; yang_parent_name = "macsec-hour24-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InDropOverrun::~InDropOverrun() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InDropOverrun::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InDropOverrun::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InDropOverrun::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "in-drop-overrun"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InDropOverrun::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InDropOverrun::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InDropOverrun::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InDropOverrun::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InDropOverrun::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InDropOverrun::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InDropAbort::InDropAbort() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "in-drop-abort"; yang_parent_name = "macsec-hour24-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InDropAbort::~InDropAbort() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InDropAbort::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InDropAbort::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InDropAbort::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "in-drop-abort"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InDropAbort::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InDropAbort::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InDropAbort::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InDropAbort::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InDropAbort::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InDropAbort::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InDropInvalidVlan::InDropInvalidVlan() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "in-drop-invalid-vlan"; yang_parent_name = "macsec-hour24-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InDropInvalidVlan::~InDropInvalidVlan() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InDropInvalidVlan::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InDropInvalidVlan::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InDropInvalidVlan::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "in-drop-invalid-vlan"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InDropInvalidVlan::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InDropInvalidVlan::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InDropInvalidVlan::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InDropInvalidVlan::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InDropInvalidVlan::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InDropInvalidVlan::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InDropInvalidDmac::InDropInvalidDmac() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "in-drop-invalid-dmac"; yang_parent_name = "macsec-hour24-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InDropInvalidDmac::~InDropInvalidDmac() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InDropInvalidDmac::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InDropInvalidDmac::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InDropInvalidDmac::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "in-drop-invalid-dmac"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InDropInvalidDmac::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InDropInvalidDmac::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InDropInvalidDmac::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InDropInvalidDmac::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InDropInvalidDmac::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InDropInvalidDmac::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InDropInvalidEncap::InDropInvalidEncap() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "in-drop-invalid-encap"; yang_parent_name = "macsec-hour24-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InDropInvalidEncap::~InDropInvalidEncap() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InDropInvalidEncap::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InDropInvalidEncap::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InDropInvalidEncap::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "in-drop-invalid-encap"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InDropInvalidEncap::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InDropInvalidEncap::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InDropInvalidEncap::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InDropInvalidEncap::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InDropInvalidEncap::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InDropInvalidEncap::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InDropOther::InDropOther() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "in-drop-other"; yang_parent_name = "macsec-hour24-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InDropOther::~InDropOther() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InDropOther::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InDropOther::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InDropOther::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "in-drop-other"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InDropOther::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InDropOther::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InDropOther::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InDropOther::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InDropOther::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InDropOther::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InMibGiant::InMibGiant() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "in-mib-giant"; yang_parent_name = "macsec-hour24-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InMibGiant::~InMibGiant() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InMibGiant::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InMibGiant::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InMibGiant::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "in-mib-giant"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InMibGiant::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InMibGiant::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InMibGiant::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InMibGiant::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InMibGiant::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InMibGiant::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InMibJabber::InMibJabber() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "in-mib-jabber"; yang_parent_name = "macsec-hour24-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InMibJabber::~InMibJabber() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InMibJabber::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InMibJabber::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InMibJabber::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "in-mib-jabber"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InMibJabber::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InMibJabber::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InMibJabber::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InMibJabber::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InMibJabber::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InMibJabber::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InMibcrc::InMibcrc() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "in-mibcrc"; yang_parent_name = "macsec-hour24-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InMibcrc::~InMibcrc() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InMibcrc::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InMibcrc::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InMibcrc::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "in-mibcrc"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InMibcrc::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InMibcrc::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InMibcrc::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InMibcrc::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InMibcrc::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InMibcrc::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InErrorCollisions::InErrorCollisions() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "in-error-collisions"; yang_parent_name = "macsec-hour24-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InErrorCollisions::~InErrorCollisions() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InErrorCollisions::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InErrorCollisions::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InErrorCollisions::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "in-error-collisions"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InErrorCollisions::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InErrorCollisions::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InErrorCollisions::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InErrorCollisions::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InErrorCollisions::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InErrorCollisions::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InErrorSymbol::InErrorSymbol() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "in-error-symbol"; yang_parent_name = "macsec-hour24-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InErrorSymbol::~InErrorSymbol() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InErrorSymbol::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InErrorSymbol::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InErrorSymbol::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "in-error-symbol"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InErrorSymbol::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InErrorSymbol::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InErrorSymbol::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InErrorSymbol::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InErrorSymbol::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InErrorSymbol::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutGoodBytes::OutGoodBytes() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "out-good-bytes"; yang_parent_name = "macsec-hour24-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutGoodBytes::~OutGoodBytes() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutGoodBytes::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutGoodBytes::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutGoodBytes::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "out-good-bytes"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutGoodBytes::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutGoodBytes::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutGoodBytes::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutGoodBytes::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutGoodBytes::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutGoodBytes::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::Out8021qFrames::Out8021qFrames() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "out8021q-frames"; yang_parent_name = "macsec-hour24-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::Out8021qFrames::~Out8021qFrames() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::Out8021qFrames::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::Out8021qFrames::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::Out8021qFrames::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "out8021q-frames"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::Out8021qFrames::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::Out8021qFrames::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::Out8021qFrames::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::Out8021qFrames::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::Out8021qFrames::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::Out8021qFrames::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutPauseFrames::OutPauseFrames() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "out-pause-frames"; yang_parent_name = "macsec-hour24-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutPauseFrames::~OutPauseFrames() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutPauseFrames::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutPauseFrames::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutPauseFrames::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "out-pause-frames"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutPauseFrames::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutPauseFrames::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutPauseFrames::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutPauseFrames::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutPauseFrames::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutPauseFrames::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutPkts1519MaxOctets::OutPkts1519MaxOctets() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "out-pkts1519-max-octets"; yang_parent_name = "macsec-hour24-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutPkts1519MaxOctets::~OutPkts1519MaxOctets() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutPkts1519MaxOctets::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutPkts1519MaxOctets::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutPkts1519MaxOctets::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "out-pkts1519-max-octets"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutPkts1519MaxOctets::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutPkts1519MaxOctets::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutPkts1519MaxOctets::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutPkts1519MaxOctets::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutPkts1519MaxOctets::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutPkts1519MaxOctets::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutGoodPkts::OutGoodPkts() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "out-good-pkts"; yang_parent_name = "macsec-hour24-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutGoodPkts::~OutGoodPkts() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutGoodPkts::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutGoodPkts::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutGoodPkts::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "out-good-pkts"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutGoodPkts::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutGoodPkts::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutGoodPkts::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutGoodPkts::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutGoodPkts::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutGoodPkts::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutDropUnderrun::OutDropUnderrun() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "out-drop-underrun"; yang_parent_name = "macsec-hour24-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutDropUnderrun::~OutDropUnderrun() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutDropUnderrun::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutDropUnderrun::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutDropUnderrun::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "out-drop-underrun"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutDropUnderrun::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutDropUnderrun::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutDropUnderrun::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutDropUnderrun::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutDropUnderrun::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutDropUnderrun::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutDropAbort::OutDropAbort() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "out-drop-abort"; yang_parent_name = "macsec-hour24-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutDropAbort::~OutDropAbort() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutDropAbort::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutDropAbort::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutDropAbort::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "out-drop-abort"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutDropAbort::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutDropAbort::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutDropAbort::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutDropAbort::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutDropAbort::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutDropAbort::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutDropOther::OutDropOther() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "out-drop-other"; yang_parent_name = "macsec-hour24-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutDropOther::~OutDropOther() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutDropOther::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutDropOther::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutDropOther::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "out-drop-other"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutDropOther::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutDropOther::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutDropOther::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutDropOther::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutDropOther::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutDropOther::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutErrorOther::OutErrorOther() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "out-error-other"; yang_parent_name = "macsec-hour24-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutErrorOther::~OutErrorOther() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutErrorOther::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutErrorOther::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutErrorOther::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "out-error-other"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutErrorOther::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutErrorOther::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutErrorOther::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutErrorOther::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutErrorOther::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutErrorOther::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InErrorGiant::InErrorGiant() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "in-error-giant"; yang_parent_name = "macsec-hour24-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InErrorGiant::~InErrorGiant() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InErrorGiant::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InErrorGiant::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InErrorGiant::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "in-error-giant"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InErrorGiant::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InErrorGiant::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InErrorGiant::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InErrorGiant::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InErrorGiant::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InErrorGiant::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InErrorRunt::InErrorRunt() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "in-error-runt"; yang_parent_name = "macsec-hour24-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InErrorRunt::~InErrorRunt() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InErrorRunt::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InErrorRunt::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InErrorRunt::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "in-error-runt"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InErrorRunt::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InErrorRunt::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InErrorRunt::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InErrorRunt::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InErrorRunt::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InErrorRunt::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InErrorJabbers::InErrorJabbers() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "in-error-jabbers"; yang_parent_name = "macsec-hour24-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InErrorJabbers::~InErrorJabbers() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InErrorJabbers::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InErrorJabbers::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InErrorJabbers::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "in-error-jabbers"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InErrorJabbers::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InErrorJabbers::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InErrorJabbers::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InErrorJabbers::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InErrorJabbers::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InErrorJabbers::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InErrorFragments::InErrorFragments() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "in-error-fragments"; yang_parent_name = "macsec-hour24-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InErrorFragments::~InErrorFragments() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InErrorFragments::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InErrorFragments::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InErrorFragments::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "in-error-fragments"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InErrorFragments::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InErrorFragments::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InErrorFragments::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InErrorFragments::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InErrorFragments::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InErrorFragments::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InErrorOther::InErrorOther() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "in-error-other"; yang_parent_name = "macsec-hour24-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InErrorOther::~InErrorOther() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InErrorOther::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InErrorOther::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InErrorOther::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "in-error-other"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InErrorOther::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InErrorOther::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InErrorOther::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InErrorOther::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InErrorOther::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InErrorOther::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InPkt64Octet::InPkt64Octet() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "in-pkt64-octet"; yang_parent_name = "macsec-hour24-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InPkt64Octet::~InPkt64Octet() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InPkt64Octet::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InPkt64Octet::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InPkt64Octet::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "in-pkt64-octet"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InPkt64Octet::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InPkt64Octet::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InPkt64Octet::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InPkt64Octet::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InPkt64Octet::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InPkt64Octet::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InPkts65To127Octets::InPkts65To127Octets() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "in-pkts65-to127-octets"; yang_parent_name = "macsec-hour24-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InPkts65To127Octets::~InPkts65To127Octets() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InPkts65To127Octets::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InPkts65To127Octets::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InPkts65To127Octets::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "in-pkts65-to127-octets"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InPkts65To127Octets::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InPkts65To127Octets::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InPkts65To127Octets::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InPkts65To127Octets::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InPkts65To127Octets::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InPkts65To127Octets::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InPkts128To255Octets::InPkts128To255Octets() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "in-pkts128-to255-octets"; yang_parent_name = "macsec-hour24-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InPkts128To255Octets::~InPkts128To255Octets() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InPkts128To255Octets::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InPkts128To255Octets::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InPkts128To255Octets::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "in-pkts128-to255-octets"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InPkts128To255Octets::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InPkts128To255Octets::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InPkts128To255Octets::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InPkts128To255Octets::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InPkts128To255Octets::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InPkts128To255Octets::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InPkts256To511Octets::InPkts256To511Octets() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "in-pkts256-to511-octets"; yang_parent_name = "macsec-hour24-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InPkts256To511Octets::~InPkts256To511Octets() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InPkts256To511Octets::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InPkts256To511Octets::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InPkts256To511Octets::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "in-pkts256-to511-octets"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InPkts256To511Octets::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InPkts256To511Octets::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InPkts256To511Octets::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InPkts256To511Octets::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InPkts256To511Octets::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InPkts256To511Octets::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InPkts512To1023Octets::InPkts512To1023Octets() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "in-pkts512-to1023-octets"; yang_parent_name = "macsec-hour24-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InPkts512To1023Octets::~InPkts512To1023Octets() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InPkts512To1023Octets::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InPkts512To1023Octets::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InPkts512To1023Octets::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "in-pkts512-to1023-octets"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InPkts512To1023Octets::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InPkts512To1023Octets::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InPkts512To1023Octets::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InPkts512To1023Octets::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InPkts512To1023Octets::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InPkts512To1023Octets::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InPkts1024To1518Octets::InPkts1024To1518Octets() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "in-pkts1024-to1518-octets"; yang_parent_name = "macsec-hour24-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InPkts1024To1518Octets::~InPkts1024To1518Octets() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InPkts1024To1518Octets::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InPkts1024To1518Octets::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InPkts1024To1518Octets::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "in-pkts1024-to1518-octets"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InPkts1024To1518Octets::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InPkts1024To1518Octets::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InPkts1024To1518Octets::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InPkts1024To1518Octets::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InPkts1024To1518Octets::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::InPkts1024To1518Octets::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::Outpkt64octet::Outpkt64octet() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "outpkt64octet"; yang_parent_name = "macsec-hour24-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::Outpkt64octet::~Outpkt64octet() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::Outpkt64octet::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::Outpkt64octet::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::Outpkt64octet::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "outpkt64octet"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::Outpkt64octet::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::Outpkt64octet::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::Outpkt64octet::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::Outpkt64octet::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::Outpkt64octet::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::Outpkt64octet::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutPkts65127Octets::OutPkts65127Octets() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "out-pkts65127-octets"; yang_parent_name = "macsec-hour24-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutPkts65127Octets::~OutPkts65127Octets() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutPkts65127Octets::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutPkts65127Octets::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutPkts65127Octets::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "out-pkts65127-octets"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutPkts65127Octets::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutPkts65127Octets::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutPkts65127Octets::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutPkts65127Octets::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutPkts65127Octets::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutPkts65127Octets::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutPkts128255Octets::OutPkts128255Octets() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "out-pkts128255-octets"; yang_parent_name = "macsec-hour24-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutPkts128255Octets::~OutPkts128255Octets() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutPkts128255Octets::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutPkts128255Octets::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutPkts128255Octets::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "out-pkts128255-octets"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutPkts128255Octets::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutPkts128255Octets::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutPkts128255Octets::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutPkts128255Octets::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutPkts128255Octets::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutPkts128255Octets::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutPkts256511Octets::OutPkts256511Octets() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "out-pkts256511-octets"; yang_parent_name = "macsec-hour24-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutPkts256511Octets::~OutPkts256511Octets() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutPkts256511Octets::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutPkts256511Octets::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutPkts256511Octets::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "out-pkts256511-octets"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutPkts256511Octets::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutPkts256511Octets::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutPkts256511Octets::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutPkts256511Octets::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutPkts256511Octets::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutPkts256511Octets::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutPkts5121023Octets::OutPkts5121023Octets() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "out-pkts5121023-octets"; yang_parent_name = "macsec-hour24-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutPkts5121023Octets::~OutPkts5121023Octets() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutPkts5121023Octets::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutPkts5121023Octets::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutPkts5121023Octets::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "out-pkts5121023-octets"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutPkts5121023Octets::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutPkts5121023Octets::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutPkts5121023Octets::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutPkts5121023Octets::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutPkts5121023Octets::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutPkts5121023Octets::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutPkts10241518Octets::OutPkts10241518Octets() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "out-pkts10241518-octets"; yang_parent_name = "macsec-hour24-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutPkts10241518Octets::~OutPkts10241518Octets() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutPkts10241518Octets::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutPkts10241518Octets::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutPkts10241518Octets::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "out-pkts10241518-octets"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutPkts10241518Octets::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutPkts10241518Octets::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutPkts10241518Octets::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutPkts10241518Octets::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutPkts10241518Octets::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::OutPkts10241518Octets::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::RxUtil::RxUtil() : data{YType::str, "data"}, threshold{YType::str, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "rx-util"; yang_parent_name = "macsec-hour24-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::RxUtil::~RxUtil() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::RxUtil::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::RxUtil::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::RxUtil::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "rx-util"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::RxUtil::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::RxUtil::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::RxUtil::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::RxUtil::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::RxUtil::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::RxUtil::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::TxUtil::TxUtil() : data{YType::str, "data"}, threshold{YType::str, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "tx-util"; yang_parent_name = "macsec-hour24-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::TxUtil::~TxUtil() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::TxUtil::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::TxUtil::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::TxUtil::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "tx-util"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::TxUtil::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::TxUtil::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::TxUtil::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::TxUtil::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::TxUtil::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::TxUtil::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::TxUndersizedPkt::TxUndersizedPkt() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "tx-undersized-pkt"; yang_parent_name = "macsec-hour24-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::TxUndersizedPkt::~TxUndersizedPkt() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::TxUndersizedPkt::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::TxUndersizedPkt::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::TxUndersizedPkt::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "tx-undersized-pkt"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::TxUndersizedPkt::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::TxUndersizedPkt::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::TxUndersizedPkt::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::TxUndersizedPkt::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::TxUndersizedPkt::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::TxUndersizedPkt::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::TxOversizedPkt::TxOversizedPkt() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "tx-oversized-pkt"; yang_parent_name = "macsec-hour24-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::TxOversizedPkt::~TxOversizedPkt() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::TxOversizedPkt::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::TxOversizedPkt::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::TxOversizedPkt::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "tx-oversized-pkt"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::TxOversizedPkt::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::TxOversizedPkt::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::TxOversizedPkt::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::TxOversizedPkt::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::TxOversizedPkt::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::TxOversizedPkt::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::TxFragments::TxFragments() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "tx-fragments"; yang_parent_name = "macsec-hour24-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::TxFragments::~TxFragments() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::TxFragments::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::TxFragments::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::TxFragments::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "tx-fragments"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::TxFragments::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::TxFragments::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::TxFragments::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::TxFragments::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::TxFragments::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::TxFragments::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::TxJabber::TxJabber() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "tx-jabber"; yang_parent_name = "macsec-hour24-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::TxJabber::~TxJabber() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::TxJabber::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::TxJabber::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::TxJabber::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "tx-jabber"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::TxJabber::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::TxJabber::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::TxJabber::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::TxJabber::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::TxJabber::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::TxJabber::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::TxBadFcs::TxBadFcs() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "tx-bad-fcs"; yang_parent_name = "macsec-hour24-ether-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::TxBadFcs::~TxBadFcs() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::TxBadFcs::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::TxBadFcs::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::TxBadFcs::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "tx-bad-fcs"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::TxBadFcs::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::TxBadFcs::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::TxBadFcs::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::TxBadFcs::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::TxBadFcs::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24EtherHistories::MacsecHour24EtherHistory::MacsecHour24EtherTimeLineInstances::MacsecHour24EtherTimeLineInstance::TxBadFcs::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::MacsecHour24secytxHistories() : macsec_hour24secytx_history(this, {"number"}) { yang_name = "macsec-hour24secytx-histories"; yang_parent_name = "macsec-hour24-history"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::~MacsecHour24secytxHistories() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<macsec_hour24secytx_history.len(); index++) { if(macsec_hour24secytx_history[index]->has_data()) return true; } return false; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::has_operation() const { for (std::size_t index=0; index<macsec_hour24secytx_history.len(); index++) { if(macsec_hour24secytx_history[index]->has_operation()) return true; } return is_set(yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "macsec-hour24secytx-histories"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "macsec-hour24secytx-history") { auto ent_ = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::MacsecHour24secytxHistory>(); ent_->parent = this; macsec_hour24secytx_history.append(ent_); return ent_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; count_ = 0; for (auto ent_ : macsec_hour24secytx_history.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 PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::set_filter(const std::string & value_path, YFilter yfilter) { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::has_leaf_or_child_of_name(const std::string & name) const { if(name == "macsec-hour24secytx-history") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::MacsecHour24secytxHistory::MacsecHour24secytxHistory() : number{YType::uint32, "number"} , macsec_hour24secytx_time_line_instances(std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::MacsecHour24secytxHistory::MacsecHour24secytxTimeLineInstances>()) { macsec_hour24secytx_time_line_instances->parent = this; yang_name = "macsec-hour24secytx-history"; yang_parent_name = "macsec-hour24secytx-histories"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::MacsecHour24secytxHistory::~MacsecHour24secytxHistory() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::MacsecHour24secytxHistory::has_data() const { if (is_presence_container) return true; return number.is_set || (macsec_hour24secytx_time_line_instances != nullptr && macsec_hour24secytx_time_line_instances->has_data()); } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::MacsecHour24secytxHistory::has_operation() const { return is_set(yfilter) || ydk::is_set(number.yfilter) || (macsec_hour24secytx_time_line_instances != nullptr && macsec_hour24secytx_time_line_instances->has_operation()); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::MacsecHour24secytxHistory::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "macsec-hour24secytx-history"; ADD_KEY_TOKEN(number, "number"); return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::MacsecHour24secytxHistory::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (number.is_set || is_set(number.yfilter)) leaf_name_data.push_back(number.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::MacsecHour24secytxHistory::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "macsec-hour24secytx-time-line-instances") { if(macsec_hour24secytx_time_line_instances == nullptr) { macsec_hour24secytx_time_line_instances = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::MacsecHour24secytxHistory::MacsecHour24secytxTimeLineInstances>(); } return macsec_hour24secytx_time_line_instances; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::MacsecHour24secytxHistory::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; if(macsec_hour24secytx_time_line_instances != nullptr) { _children["macsec-hour24secytx-time-line-instances"] = macsec_hour24secytx_time_line_instances; } return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::MacsecHour24secytxHistory::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 == "number") { number = value; number.value_namespace = name_space; number.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::MacsecHour24secytxHistory::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "number") { number.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::MacsecHour24secytxHistory::has_leaf_or_child_of_name(const std::string & name) const { if(name == "macsec-hour24secytx-time-line-instances" || name == "number") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::MacsecHour24secytxHistory::MacsecHour24secytxTimeLineInstances::MacsecHour24secytxTimeLineInstances() : macsec_hour24secytx_time_line_instance(this, {"number"}) { yang_name = "macsec-hour24secytx-time-line-instances"; yang_parent_name = "macsec-hour24secytx-history"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::MacsecHour24secytxHistory::MacsecHour24secytxTimeLineInstances::~MacsecHour24secytxTimeLineInstances() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::MacsecHour24secytxHistory::MacsecHour24secytxTimeLineInstances::has_data() const { if (is_presence_container) return true; for (std::size_t index=0; index<macsec_hour24secytx_time_line_instance.len(); index++) { if(macsec_hour24secytx_time_line_instance[index]->has_data()) return true; } return false; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::MacsecHour24secytxHistory::MacsecHour24secytxTimeLineInstances::has_operation() const { for (std::size_t index=0; index<macsec_hour24secytx_time_line_instance.len(); index++) { if(macsec_hour24secytx_time_line_instance[index]->has_operation()) return true; } return is_set(yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::MacsecHour24secytxHistory::MacsecHour24secytxTimeLineInstances::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "macsec-hour24secytx-time-line-instances"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::MacsecHour24secytxHistory::MacsecHour24secytxTimeLineInstances::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::MacsecHour24secytxHistory::MacsecHour24secytxTimeLineInstances::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "macsec-hour24secytx-time-line-instance") { auto ent_ = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::MacsecHour24secytxHistory::MacsecHour24secytxTimeLineInstances::MacsecHour24secytxTimeLineInstance>(); ent_->parent = this; macsec_hour24secytx_time_line_instance.append(ent_); return ent_; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::MacsecHour24secytxHistory::MacsecHour24secytxTimeLineInstances::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; count_ = 0; for (auto ent_ : macsec_hour24secytx_time_line_instance.entities()) { if(_children.find(ent_->get_segment_path()) == _children.end()) _children[ent_->get_segment_path()] = ent_; else _children[ent_->get_segment_path()+count_++] = ent_; } return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::MacsecHour24secytxHistory::MacsecHour24secytxTimeLineInstances::set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) { } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::MacsecHour24secytxHistory::MacsecHour24secytxTimeLineInstances::set_filter(const std::string & value_path, YFilter yfilter) { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::MacsecHour24secytxHistory::MacsecHour24secytxTimeLineInstances::has_leaf_or_child_of_name(const std::string & name) const { if(name == "macsec-hour24secytx-time-line-instance") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::MacsecHour24secytxHistory::MacsecHour24secytxTimeLineInstances::MacsecHour24secytxTimeLineInstance::MacsecHour24secytxTimeLineInstance() : number{YType::uint32, "number"}, index_{YType::uint32, "index"}, valid{YType::boolean, "valid"}, timestamp{YType::str, "timestamp"}, last_clear_time{YType::str, "last-clear-time"}, last_clear15_min_time{YType::str, "last-clear15-min-time"}, last_clear30_sec_time{YType::str, "last-clear30-sec-time"}, last_clear24_hr_time{YType::str, "last-clear24-hr-time"}, sec30_support{YType::boolean, "sec30-support"}, sample_count{YType::uint64, "sample-count"} , out_pkts_protected(std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::MacsecHour24secytxHistory::MacsecHour24secytxTimeLineInstances::MacsecHour24secytxTimeLineInstance::OutPktsProtected>()) , out_pkts_encrypted(std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::MacsecHour24secytxHistory::MacsecHour24secytxTimeLineInstances::MacsecHour24secytxTimeLineInstance::OutPktsEncrypted>()) , out_octets_protected(std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::MacsecHour24secytxHistory::MacsecHour24secytxTimeLineInstances::MacsecHour24secytxTimeLineInstance::OutOctetsProtected>()) , out_octets_encrypted(std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::MacsecHour24secytxHistory::MacsecHour24secytxTimeLineInstances::MacsecHour24secytxTimeLineInstance::OutOctetsEncrypted>()) , out_pkts_too_long(std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::MacsecHour24secytxHistory::MacsecHour24secytxTimeLineInstances::MacsecHour24secytxTimeLineInstance::OutPktsTooLong>()) { out_pkts_protected->parent = this; out_pkts_encrypted->parent = this; out_octets_protected->parent = this; out_octets_encrypted->parent = this; out_pkts_too_long->parent = this; yang_name = "macsec-hour24secytx-time-line-instance"; yang_parent_name = "macsec-hour24secytx-time-line-instances"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::MacsecHour24secytxHistory::MacsecHour24secytxTimeLineInstances::MacsecHour24secytxTimeLineInstance::~MacsecHour24secytxTimeLineInstance() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::MacsecHour24secytxHistory::MacsecHour24secytxTimeLineInstances::MacsecHour24secytxTimeLineInstance::has_data() const { if (is_presence_container) return true; return number.is_set || index_.is_set || valid.is_set || timestamp.is_set || last_clear_time.is_set || last_clear15_min_time.is_set || last_clear30_sec_time.is_set || last_clear24_hr_time.is_set || sec30_support.is_set || sample_count.is_set || (out_pkts_protected != nullptr && out_pkts_protected->has_data()) || (out_pkts_encrypted != nullptr && out_pkts_encrypted->has_data()) || (out_octets_protected != nullptr && out_octets_protected->has_data()) || (out_octets_encrypted != nullptr && out_octets_encrypted->has_data()) || (out_pkts_too_long != nullptr && out_pkts_too_long->has_data()); } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::MacsecHour24secytxHistory::MacsecHour24secytxTimeLineInstances::MacsecHour24secytxTimeLineInstance::has_operation() const { return is_set(yfilter) || ydk::is_set(number.yfilter) || ydk::is_set(index_.yfilter) || ydk::is_set(valid.yfilter) || ydk::is_set(timestamp.yfilter) || ydk::is_set(last_clear_time.yfilter) || ydk::is_set(last_clear15_min_time.yfilter) || ydk::is_set(last_clear30_sec_time.yfilter) || ydk::is_set(last_clear24_hr_time.yfilter) || ydk::is_set(sec30_support.yfilter) || ydk::is_set(sample_count.yfilter) || (out_pkts_protected != nullptr && out_pkts_protected->has_operation()) || (out_pkts_encrypted != nullptr && out_pkts_encrypted->has_operation()) || (out_octets_protected != nullptr && out_octets_protected->has_operation()) || (out_octets_encrypted != nullptr && out_octets_encrypted->has_operation()) || (out_pkts_too_long != nullptr && out_pkts_too_long->has_operation()); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::MacsecHour24secytxHistory::MacsecHour24secytxTimeLineInstances::MacsecHour24secytxTimeLineInstance::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "macsec-hour24secytx-time-line-instance"; ADD_KEY_TOKEN(number, "number"); return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::MacsecHour24secytxHistory::MacsecHour24secytxTimeLineInstances::MacsecHour24secytxTimeLineInstance::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (number.is_set || is_set(number.yfilter)) leaf_name_data.push_back(number.get_name_leafdata()); if (index_.is_set || is_set(index_.yfilter)) leaf_name_data.push_back(index_.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); if (timestamp.is_set || is_set(timestamp.yfilter)) leaf_name_data.push_back(timestamp.get_name_leafdata()); if (last_clear_time.is_set || is_set(last_clear_time.yfilter)) leaf_name_data.push_back(last_clear_time.get_name_leafdata()); if (last_clear15_min_time.is_set || is_set(last_clear15_min_time.yfilter)) leaf_name_data.push_back(last_clear15_min_time.get_name_leafdata()); if (last_clear30_sec_time.is_set || is_set(last_clear30_sec_time.yfilter)) leaf_name_data.push_back(last_clear30_sec_time.get_name_leafdata()); if (last_clear24_hr_time.is_set || is_set(last_clear24_hr_time.yfilter)) leaf_name_data.push_back(last_clear24_hr_time.get_name_leafdata()); if (sec30_support.is_set || is_set(sec30_support.yfilter)) leaf_name_data.push_back(sec30_support.get_name_leafdata()); if (sample_count.is_set || is_set(sample_count.yfilter)) leaf_name_data.push_back(sample_count.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::MacsecHour24secytxHistory::MacsecHour24secytxTimeLineInstances::MacsecHour24secytxTimeLineInstance::get_child_by_name(const std::string & child_yang_name, const std::string & segment_path) { if(child_yang_name == "out-pkts-protected") { if(out_pkts_protected == nullptr) { out_pkts_protected = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::MacsecHour24secytxHistory::MacsecHour24secytxTimeLineInstances::MacsecHour24secytxTimeLineInstance::OutPktsProtected>(); } return out_pkts_protected; } if(child_yang_name == "out-pkts-encrypted") { if(out_pkts_encrypted == nullptr) { out_pkts_encrypted = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::MacsecHour24secytxHistory::MacsecHour24secytxTimeLineInstances::MacsecHour24secytxTimeLineInstance::OutPktsEncrypted>(); } return out_pkts_encrypted; } if(child_yang_name == "out-octets-protected") { if(out_octets_protected == nullptr) { out_octets_protected = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::MacsecHour24secytxHistory::MacsecHour24secytxTimeLineInstances::MacsecHour24secytxTimeLineInstance::OutOctetsProtected>(); } return out_octets_protected; } if(child_yang_name == "out-octets-encrypted") { if(out_octets_encrypted == nullptr) { out_octets_encrypted = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::MacsecHour24secytxHistory::MacsecHour24secytxTimeLineInstances::MacsecHour24secytxTimeLineInstance::OutOctetsEncrypted>(); } return out_octets_encrypted; } if(child_yang_name == "out-pkts-too-long") { if(out_pkts_too_long == nullptr) { out_pkts_too_long = std::make_shared<PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::MacsecHour24secytxHistory::MacsecHour24secytxTimeLineInstances::MacsecHour24secytxTimeLineInstance::OutPktsTooLong>(); } return out_pkts_too_long; } return nullptr; } std::map<std::string, std::shared_ptr<ydk::Entity>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::MacsecHour24secytxHistory::MacsecHour24secytxTimeLineInstances::MacsecHour24secytxTimeLineInstance::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; if(out_pkts_protected != nullptr) { _children["out-pkts-protected"] = out_pkts_protected; } if(out_pkts_encrypted != nullptr) { _children["out-pkts-encrypted"] = out_pkts_encrypted; } if(out_octets_protected != nullptr) { _children["out-octets-protected"] = out_octets_protected; } if(out_octets_encrypted != nullptr) { _children["out-octets-encrypted"] = out_octets_encrypted; } if(out_pkts_too_long != nullptr) { _children["out-pkts-too-long"] = out_pkts_too_long; } return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::MacsecHour24secytxHistory::MacsecHour24secytxTimeLineInstances::MacsecHour24secytxTimeLineInstance::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 == "number") { number = value; number.value_namespace = name_space; number.value_namespace_prefix = name_space_prefix; } if(value_path == "index") { index_ = value; index_.value_namespace = name_space; index_.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } if(value_path == "timestamp") { timestamp = value; timestamp.value_namespace = name_space; timestamp.value_namespace_prefix = name_space_prefix; } if(value_path == "last-clear-time") { last_clear_time = value; last_clear_time.value_namespace = name_space; last_clear_time.value_namespace_prefix = name_space_prefix; } if(value_path == "last-clear15-min-time") { last_clear15_min_time = value; last_clear15_min_time.value_namespace = name_space; last_clear15_min_time.value_namespace_prefix = name_space_prefix; } if(value_path == "last-clear30-sec-time") { last_clear30_sec_time = value; last_clear30_sec_time.value_namespace = name_space; last_clear30_sec_time.value_namespace_prefix = name_space_prefix; } if(value_path == "last-clear24-hr-time") { last_clear24_hr_time = value; last_clear24_hr_time.value_namespace = name_space; last_clear24_hr_time.value_namespace_prefix = name_space_prefix; } if(value_path == "sec30-support") { sec30_support = value; sec30_support.value_namespace = name_space; sec30_support.value_namespace_prefix = name_space_prefix; } if(value_path == "sample-count") { sample_count = value; sample_count.value_namespace = name_space; sample_count.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::MacsecHour24secytxHistory::MacsecHour24secytxTimeLineInstances::MacsecHour24secytxTimeLineInstance::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "number") { number.yfilter = yfilter; } if(value_path == "index") { index_.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } if(value_path == "timestamp") { timestamp.yfilter = yfilter; } if(value_path == "last-clear-time") { last_clear_time.yfilter = yfilter; } if(value_path == "last-clear15-min-time") { last_clear15_min_time.yfilter = yfilter; } if(value_path == "last-clear30-sec-time") { last_clear30_sec_time.yfilter = yfilter; } if(value_path == "last-clear24-hr-time") { last_clear24_hr_time.yfilter = yfilter; } if(value_path == "sec30-support") { sec30_support.yfilter = yfilter; } if(value_path == "sample-count") { sample_count.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::MacsecHour24secytxHistory::MacsecHour24secytxTimeLineInstances::MacsecHour24secytxTimeLineInstance::has_leaf_or_child_of_name(const std::string & name) const { if(name == "out-pkts-protected" || name == "out-pkts-encrypted" || name == "out-octets-protected" || name == "out-octets-encrypted" || name == "out-pkts-too-long" || name == "number" || name == "index" || name == "valid" || name == "timestamp" || name == "last-clear-time" || name == "last-clear15-min-time" || name == "last-clear30-sec-time" || name == "last-clear24-hr-time" || name == "sec30-support" || name == "sample-count") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::MacsecHour24secytxHistory::MacsecHour24secytxTimeLineInstances::MacsecHour24secytxTimeLineInstance::OutPktsProtected::OutPktsProtected() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "out-pkts-protected"; yang_parent_name = "macsec-hour24secytx-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::MacsecHour24secytxHistory::MacsecHour24secytxTimeLineInstances::MacsecHour24secytxTimeLineInstance::OutPktsProtected::~OutPktsProtected() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::MacsecHour24secytxHistory::MacsecHour24secytxTimeLineInstances::MacsecHour24secytxTimeLineInstance::OutPktsProtected::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::MacsecHour24secytxHistory::MacsecHour24secytxTimeLineInstances::MacsecHour24secytxTimeLineInstance::OutPktsProtected::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::MacsecHour24secytxHistory::MacsecHour24secytxTimeLineInstances::MacsecHour24secytxTimeLineInstance::OutPktsProtected::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "out-pkts-protected"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::MacsecHour24secytxHistory::MacsecHour24secytxTimeLineInstances::MacsecHour24secytxTimeLineInstance::OutPktsProtected::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::MacsecHour24secytxHistory::MacsecHour24secytxTimeLineInstances::MacsecHour24secytxTimeLineInstance::OutPktsProtected::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::MacsecHour24secytxHistory::MacsecHour24secytxTimeLineInstances::MacsecHour24secytxTimeLineInstance::OutPktsProtected::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::MacsecHour24secytxHistory::MacsecHour24secytxTimeLineInstances::MacsecHour24secytxTimeLineInstance::OutPktsProtected::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::MacsecHour24secytxHistory::MacsecHour24secytxTimeLineInstances::MacsecHour24secytxTimeLineInstance::OutPktsProtected::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::MacsecHour24secytxHistory::MacsecHour24secytxTimeLineInstances::MacsecHour24secytxTimeLineInstance::OutPktsProtected::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::MacsecHour24secytxHistory::MacsecHour24secytxTimeLineInstances::MacsecHour24secytxTimeLineInstance::OutPktsEncrypted::OutPktsEncrypted() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "out-pkts-encrypted"; yang_parent_name = "macsec-hour24secytx-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::MacsecHour24secytxHistory::MacsecHour24secytxTimeLineInstances::MacsecHour24secytxTimeLineInstance::OutPktsEncrypted::~OutPktsEncrypted() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::MacsecHour24secytxHistory::MacsecHour24secytxTimeLineInstances::MacsecHour24secytxTimeLineInstance::OutPktsEncrypted::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::MacsecHour24secytxHistory::MacsecHour24secytxTimeLineInstances::MacsecHour24secytxTimeLineInstance::OutPktsEncrypted::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::MacsecHour24secytxHistory::MacsecHour24secytxTimeLineInstances::MacsecHour24secytxTimeLineInstance::OutPktsEncrypted::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "out-pkts-encrypted"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::MacsecHour24secytxHistory::MacsecHour24secytxTimeLineInstances::MacsecHour24secytxTimeLineInstance::OutPktsEncrypted::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::MacsecHour24secytxHistory::MacsecHour24secytxTimeLineInstances::MacsecHour24secytxTimeLineInstance::OutPktsEncrypted::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::MacsecHour24secytxHistory::MacsecHour24secytxTimeLineInstances::MacsecHour24secytxTimeLineInstance::OutPktsEncrypted::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::MacsecHour24secytxHistory::MacsecHour24secytxTimeLineInstances::MacsecHour24secytxTimeLineInstance::OutPktsEncrypted::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::MacsecHour24secytxHistory::MacsecHour24secytxTimeLineInstances::MacsecHour24secytxTimeLineInstance::OutPktsEncrypted::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::MacsecHour24secytxHistory::MacsecHour24secytxTimeLineInstances::MacsecHour24secytxTimeLineInstance::OutPktsEncrypted::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::MacsecHour24secytxHistory::MacsecHour24secytxTimeLineInstances::MacsecHour24secytxTimeLineInstance::OutOctetsProtected::OutOctetsProtected() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "out-octets-protected"; yang_parent_name = "macsec-hour24secytx-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::MacsecHour24secytxHistory::MacsecHour24secytxTimeLineInstances::MacsecHour24secytxTimeLineInstance::OutOctetsProtected::~OutOctetsProtected() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::MacsecHour24secytxHistory::MacsecHour24secytxTimeLineInstances::MacsecHour24secytxTimeLineInstance::OutOctetsProtected::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::MacsecHour24secytxHistory::MacsecHour24secytxTimeLineInstances::MacsecHour24secytxTimeLineInstance::OutOctetsProtected::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::MacsecHour24secytxHistory::MacsecHour24secytxTimeLineInstances::MacsecHour24secytxTimeLineInstance::OutOctetsProtected::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "out-octets-protected"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::MacsecHour24secytxHistory::MacsecHour24secytxTimeLineInstances::MacsecHour24secytxTimeLineInstance::OutOctetsProtected::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::MacsecHour24secytxHistory::MacsecHour24secytxTimeLineInstances::MacsecHour24secytxTimeLineInstance::OutOctetsProtected::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::MacsecHour24secytxHistory::MacsecHour24secytxTimeLineInstances::MacsecHour24secytxTimeLineInstance::OutOctetsProtected::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::MacsecHour24secytxHistory::MacsecHour24secytxTimeLineInstances::MacsecHour24secytxTimeLineInstance::OutOctetsProtected::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::MacsecHour24secytxHistory::MacsecHour24secytxTimeLineInstances::MacsecHour24secytxTimeLineInstance::OutOctetsProtected::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::MacsecHour24secytxHistory::MacsecHour24secytxTimeLineInstances::MacsecHour24secytxTimeLineInstance::OutOctetsProtected::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::MacsecHour24secytxHistory::MacsecHour24secytxTimeLineInstances::MacsecHour24secytxTimeLineInstance::OutOctetsEncrypted::OutOctetsEncrypted() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "out-octets-encrypted"; yang_parent_name = "macsec-hour24secytx-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::MacsecHour24secytxHistory::MacsecHour24secytxTimeLineInstances::MacsecHour24secytxTimeLineInstance::OutOctetsEncrypted::~OutOctetsEncrypted() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::MacsecHour24secytxHistory::MacsecHour24secytxTimeLineInstances::MacsecHour24secytxTimeLineInstance::OutOctetsEncrypted::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::MacsecHour24secytxHistory::MacsecHour24secytxTimeLineInstances::MacsecHour24secytxTimeLineInstance::OutOctetsEncrypted::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::MacsecHour24secytxHistory::MacsecHour24secytxTimeLineInstances::MacsecHour24secytxTimeLineInstance::OutOctetsEncrypted::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "out-octets-encrypted"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::MacsecHour24secytxHistory::MacsecHour24secytxTimeLineInstances::MacsecHour24secytxTimeLineInstance::OutOctetsEncrypted::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::MacsecHour24secytxHistory::MacsecHour24secytxTimeLineInstances::MacsecHour24secytxTimeLineInstance::OutOctetsEncrypted::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::MacsecHour24secytxHistory::MacsecHour24secytxTimeLineInstances::MacsecHour24secytxTimeLineInstance::OutOctetsEncrypted::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::MacsecHour24secytxHistory::MacsecHour24secytxTimeLineInstances::MacsecHour24secytxTimeLineInstance::OutOctetsEncrypted::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::MacsecHour24secytxHistory::MacsecHour24secytxTimeLineInstances::MacsecHour24secytxTimeLineInstance::OutOctetsEncrypted::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::MacsecHour24secytxHistory::MacsecHour24secytxTimeLineInstances::MacsecHour24secytxTimeLineInstance::OutOctetsEncrypted::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::MacsecHour24secytxHistory::MacsecHour24secytxTimeLineInstances::MacsecHour24secytxTimeLineInstance::OutPktsTooLong::OutPktsTooLong() : data{YType::uint64, "data"}, threshold{YType::uint64, "threshold"}, tca_report{YType::boolean, "tca-report"}, valid{YType::boolean, "valid"} { yang_name = "out-pkts-too-long"; yang_parent_name = "macsec-hour24secytx-time-line-instance"; is_top_level_class = false; has_list_ancestor = true; } PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::MacsecHour24secytxHistory::MacsecHour24secytxTimeLineInstances::MacsecHour24secytxTimeLineInstance::OutPktsTooLong::~OutPktsTooLong() { } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::MacsecHour24secytxHistory::MacsecHour24secytxTimeLineInstances::MacsecHour24secytxTimeLineInstance::OutPktsTooLong::has_data() const { if (is_presence_container) return true; return data.is_set || threshold.is_set || tca_report.is_set || valid.is_set; } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::MacsecHour24secytxHistory::MacsecHour24secytxTimeLineInstances::MacsecHour24secytxTimeLineInstance::OutPktsTooLong::has_operation() const { return is_set(yfilter) || ydk::is_set(data.yfilter) || ydk::is_set(threshold.yfilter) || ydk::is_set(tca_report.yfilter) || ydk::is_set(valid.yfilter); } std::string PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::MacsecHour24secytxHistory::MacsecHour24secytxTimeLineInstances::MacsecHour24secytxTimeLineInstance::OutPktsTooLong::get_segment_path() const { std::ostringstream path_buffer; path_buffer << "out-pkts-too-long"; return path_buffer.str(); } std::vector<std::pair<std::string, LeafData> > PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::MacsecHour24secytxHistory::MacsecHour24secytxTimeLineInstances::MacsecHour24secytxTimeLineInstance::OutPktsTooLong::get_name_leaf_data() const { std::vector<std::pair<std::string, LeafData> > leaf_name_data {}; if (data.is_set || is_set(data.yfilter)) leaf_name_data.push_back(data.get_name_leafdata()); if (threshold.is_set || is_set(threshold.yfilter)) leaf_name_data.push_back(threshold.get_name_leafdata()); if (tca_report.is_set || is_set(tca_report.yfilter)) leaf_name_data.push_back(tca_report.get_name_leafdata()); if (valid.is_set || is_set(valid.yfilter)) leaf_name_data.push_back(valid.get_name_leafdata()); return leaf_name_data; } std::shared_ptr<ydk::Entity> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::MacsecHour24secytxHistory::MacsecHour24secytxTimeLineInstances::MacsecHour24secytxTimeLineInstance::OutPktsTooLong::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>> PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::MacsecHour24secytxHistory::MacsecHour24secytxTimeLineInstances::MacsecHour24secytxTimeLineInstance::OutPktsTooLong::get_children() const { std::map<std::string, std::shared_ptr<ydk::Entity>> _children{}; char count_=0; return _children; } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::MacsecHour24secytxHistory::MacsecHour24secytxTimeLineInstances::MacsecHour24secytxTimeLineInstance::OutPktsTooLong::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 == "data") { data = value; data.value_namespace = name_space; data.value_namespace_prefix = name_space_prefix; } if(value_path == "threshold") { threshold = value; threshold.value_namespace = name_space; threshold.value_namespace_prefix = name_space_prefix; } if(value_path == "tca-report") { tca_report = value; tca_report.value_namespace = name_space; tca_report.value_namespace_prefix = name_space_prefix; } if(value_path == "valid") { valid = value; valid.value_namespace = name_space; valid.value_namespace_prefix = name_space_prefix; } } void PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::MacsecHour24secytxHistory::MacsecHour24secytxTimeLineInstances::MacsecHour24secytxTimeLineInstance::OutPktsTooLong::set_filter(const std::string & value_path, YFilter yfilter) { if(value_path == "data") { data.yfilter = yfilter; } if(value_path == "threshold") { threshold.yfilter = yfilter; } if(value_path == "tca-report") { tca_report.yfilter = yfilter; } if(value_path == "valid") { valid.yfilter = yfilter; } } bool PerformanceManagementHistory::Global::Periodic::MacsecHistory::MacsecPortHistories::MacsecPortHistory::MacsecHour24History::MacsecHour24secytxHistories::MacsecHour24secytxHistory::MacsecHour24secytxTimeLineInstances::MacsecHour24secytxTimeLineInstance::OutPktsTooLong::has_leaf_or_child_of_name(const std::string & name) const { if(name == "data" || name == "threshold" || name == "tca-report" || name == "valid") return true; return false; } } }
52.188772
2,457
0.781001
[ "vector" ]
be51d3917ca577d99a6d449307d8ac97e8962203
845
cpp
C++
ABC/ABC079/B.cpp
rajyan/AtCoder
2c1187994016d4c19b95489d2f2d2c0eab43dd8e
[ "MIT" ]
1
2021-06-01T17:13:44.000Z
2021-06-01T17:13:44.000Z
ABC/ABC079/B.cpp
rajyan/AtCoder
2c1187994016d4c19b95489d2f2d2c0eab43dd8e
[ "MIT" ]
null
null
null
ABC/ABC079/B.cpp
rajyan/AtCoder
2c1187994016d4c19b95489d2f2d2c0eab43dd8e
[ "MIT" ]
null
null
null
//#include <cstdio> //#include <cmath> //#include <iostream> //#include <sstream> //#include <string> //#include <vector> //#include <map> //#include <queue> //#include <algorithm> // //#ifdef _DEBUG //#define DMP(x) cerr << #x << ": " << x << "\n" //#else //#define DMP(x) ((void)0) //#endif // //const int MOD = 1000000007, INF = 1111111111; //using namespace std; //typedef long long lint; // //int main() { // // cin.tie(nullptr); // ios::sync_with_stdio(false); // // int N; // cin >> N; // // vector<lint> memo(100); // memo[0] = 2; // memo[1] = 1; // // auto Lucas = [&](auto &&f, int n) -> lint { // // if (n < 2) return memo[n]; // if (!memo[n - 1]) memo[n - 1] = f(f, n - 1); // if (!memo[n - 2]) memo[n - 2] = f(f, n - 2); // return memo[n - 1] + memo[n - 2]; // // }; // // cout << Lucas(Lucas, N) << "\n"; // // return 0; //}
18.777778
48
0.513609
[ "vector" ]
be53bfddd37bd45e55b7dff9d18bdd48888bd18e
680
cc
C++
hw2/lib/triangle.cc
mrinaldhillon/oop-cpp
b2c1b766f8856390dbeeef484367dea14ff6cf78
[ "MIT" ]
null
null
null
hw2/lib/triangle.cc
mrinaldhillon/oop-cpp
b2c1b766f8856390dbeeef484367dea14ff6cf78
[ "MIT" ]
null
null
null
hw2/lib/triangle.cc
mrinaldhillon/oop-cpp
b2c1b766f8856390dbeeef484367dea14ff6cf78
[ "MIT" ]
null
null
null
#include "lib/triangle.h" #include <math.h> #include <memory> #include <string> #include <vector> #include "lib/point.h" // Should <memory> be included here since it has already been included in header using namespace std; Triangle::Triangle(Point a, Point b, Point c) { a_ = a; b_ = b; c_ = c; } const std::vector<Point> Triangle::GetPoints() const { return vector<Point>{a_, b_, c_}; } double Triangle::GetArea() const { double ab = a_.Distance(b_); double bc = b_.Distance(c_); double ac = a_.Distance(c_); double s = (ab + bc + ac) / 2.0; return sqrt(s * (s - ab) * (s - bc) * (s - ac)); } const std::string& Triangle::GetType() const { return type_; }
22.666667
80
0.645588
[ "vector" ]
be541fc976712e2b82256d7e21135715edd52995
2,987
cpp
C++
aws-cpp-sdk-support/source/model/TrustedAdvisorResourcesSummary.cpp
woohoou/aws-sdk-cpp
a42835a8aad2eac1e334d899a3fbfedcaa341d51
[ "Apache-2.0" ]
1
2020-07-16T19:03:13.000Z
2020-07-16T19:03:13.000Z
aws-cpp-sdk-support/source/model/TrustedAdvisorResourcesSummary.cpp
woohoou/aws-sdk-cpp
a42835a8aad2eac1e334d899a3fbfedcaa341d51
[ "Apache-2.0" ]
18
2018-05-15T16:41:07.000Z
2018-05-21T00:46:30.000Z
aws-cpp-sdk-support/source/model/TrustedAdvisorResourcesSummary.cpp
woohoou/aws-sdk-cpp
a42835a8aad2eac1e334d899a3fbfedcaa341d51
[ "Apache-2.0" ]
1
2019-10-31T11:19:50.000Z
2019-10-31T11:19:50.000Z
/* * Copyright 2010-2017 Amazon.com, Inc. or its affiliates. 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. * A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file 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 <aws/support/model/TrustedAdvisorResourcesSummary.h> #include <aws/core/utils/json/JsonSerializer.h> #include <utility> using namespace Aws::Utils::Json; using namespace Aws::Utils; namespace Aws { namespace Support { namespace Model { TrustedAdvisorResourcesSummary::TrustedAdvisorResourcesSummary() : m_resourcesProcessed(0), m_resourcesProcessedHasBeenSet(false), m_resourcesFlagged(0), m_resourcesFlaggedHasBeenSet(false), m_resourcesIgnored(0), m_resourcesIgnoredHasBeenSet(false), m_resourcesSuppressed(0), m_resourcesSuppressedHasBeenSet(false) { } TrustedAdvisorResourcesSummary::TrustedAdvisorResourcesSummary(const JsonValue& jsonValue) : m_resourcesProcessed(0), m_resourcesProcessedHasBeenSet(false), m_resourcesFlagged(0), m_resourcesFlaggedHasBeenSet(false), m_resourcesIgnored(0), m_resourcesIgnoredHasBeenSet(false), m_resourcesSuppressed(0), m_resourcesSuppressedHasBeenSet(false) { *this = jsonValue; } TrustedAdvisorResourcesSummary& TrustedAdvisorResourcesSummary::operator =(const JsonValue& jsonValue) { if(jsonValue.ValueExists("resourcesProcessed")) { m_resourcesProcessed = jsonValue.GetInt64("resourcesProcessed"); m_resourcesProcessedHasBeenSet = true; } if(jsonValue.ValueExists("resourcesFlagged")) { m_resourcesFlagged = jsonValue.GetInt64("resourcesFlagged"); m_resourcesFlaggedHasBeenSet = true; } if(jsonValue.ValueExists("resourcesIgnored")) { m_resourcesIgnored = jsonValue.GetInt64("resourcesIgnored"); m_resourcesIgnoredHasBeenSet = true; } if(jsonValue.ValueExists("resourcesSuppressed")) { m_resourcesSuppressed = jsonValue.GetInt64("resourcesSuppressed"); m_resourcesSuppressedHasBeenSet = true; } return *this; } JsonValue TrustedAdvisorResourcesSummary::Jsonize() const { JsonValue payload; if(m_resourcesProcessedHasBeenSet) { payload.WithInt64("resourcesProcessed", m_resourcesProcessed); } if(m_resourcesFlaggedHasBeenSet) { payload.WithInt64("resourcesFlagged", m_resourcesFlagged); } if(m_resourcesIgnoredHasBeenSet) { payload.WithInt64("resourcesIgnored", m_resourcesIgnored); } if(m_resourcesSuppressedHasBeenSet) { payload.WithInt64("resourcesSuppressed", m_resourcesSuppressed); } return payload; } } // namespace Model } // namespace Support } // namespace Aws
24.284553
102
0.762638
[ "model" ]
be5453c08e1532f4e570cdab81fadcc5df0f81ad
20,856
hpp
C++
include/cilantro/registration/icp_common_instances.hpp
baoyufuyou/cilantro
d9e9bacbd4b703e1c96b2b610c4173efd9095b05
[ "MIT" ]
2
2020-10-14T15:49:29.000Z
2021-06-15T05:52:36.000Z
include/cilantro/registration/icp_common_instances.hpp
baoyufuyou/cilantro
d9e9bacbd4b703e1c96b2b610c4173efd9095b05
[ "MIT" ]
null
null
null
include/cilantro/registration/icp_common_instances.hpp
baoyufuyou/cilantro
d9e9bacbd4b703e1c96b2b610c4173efd9095b05
[ "MIT" ]
null
null
null
#pragma once #include <cilantro/correspondence_search/common_transformable_feature_adaptors.hpp> #include <cilantro/correspondence_search/correspondence_search_kd_tree.hpp> #include <cilantro/correspondence_search/correspondence_search_projective.hpp> #include <cilantro/registration/icp_single_transform_point_to_point_metric.hpp> #include <cilantro/registration/icp_single_transform_combined_metric.hpp> #include <cilantro/registration/icp_warp_field_combined_metric_dense.hpp> #include <cilantro/registration/icp_warp_field_combined_metric_sparse.hpp> namespace cilantro { namespace internal { template <class TransformT, class CorrSearchT> using DefaultPointToPointMetricICP = PointToPointMetricSingleTransformICP<TransformT,CorrSearchT>; template <class TransformT, class CorrSearchT> class DefaultPointToPointMetricICPEntities { public: EIGEN_MAKE_ALIGNED_OPERATOR_NEW DefaultPointToPointMetricICPEntities(const ConstVectorSetMatrixMap<typename TransformT::Scalar,TransformT::Dim> &dst_points, const ConstVectorSetMatrixMap<typename TransformT::Scalar,TransformT::Dim> &src_points) : dst_feat_(dst_points), src_feat_(src_points), corr_search_(dst_feat_, src_feat_, corr_dist_evaluator_) {} protected: PointFeaturesAdaptor<typename TransformT::Scalar,TransformT::Dim> dst_feat_; PointFeaturesAdaptor<typename TransformT::Scalar,TransformT::Dim> src_feat_; DistanceEvaluator<typename TransformT::Scalar,typename TransformT::Scalar> corr_dist_evaluator_; CorrSearchT corr_search_; }; template <class TransformT, class CorrSearchT> class SimplePointToPointMetricICPWrapper : private DefaultPointToPointMetricICPEntities<TransformT,CorrSearchT>, public DefaultPointToPointMetricICP<TransformT,CorrSearchT> { public: EIGEN_MAKE_ALIGNED_OPERATOR_NEW SimplePointToPointMetricICPWrapper(const ConstVectorSetMatrixMap<typename TransformT::Scalar,TransformT::Dim> &dst_points, const ConstVectorSetMatrixMap<typename TransformT::Scalar,TransformT::Dim> &src_points) : DefaultPointToPointMetricICPEntities<TransformT,CorrSearchT>(dst_points, src_points), DefaultPointToPointMetricICP<TransformT,CorrSearchT>(dst_points, src_points, this->corr_search_) {} }; template <class TransformT, class CorrSearchT> using DefaultCombinedMetricICP = CombinedMetricSingleTransformICP<TransformT,CorrSearchT,UnityWeightEvaluator<typename TransformT::Scalar,typename TransformT::Scalar>,UnityWeightEvaluator<typename TransformT::Scalar,typename TransformT::Scalar>>; template <class TransformT, class CorrSearchT> class DefaultCombinedMetricICPEntities { public: EIGEN_MAKE_ALIGNED_OPERATOR_NEW DefaultCombinedMetricICPEntities(const ConstVectorSetMatrixMap<typename TransformT::Scalar,TransformT::Dim> &dst_points, const ConstVectorSetMatrixMap<typename TransformT::Scalar,TransformT::Dim> &src_points) : dst_feat_(dst_points), src_feat_(src_points), corr_search_(dst_feat_, src_feat_, corr_dist_evaluator_) {} protected: PointFeaturesAdaptor<typename TransformT::Scalar,TransformT::Dim> dst_feat_; PointFeaturesAdaptor<typename TransformT::Scalar,TransformT::Dim> src_feat_; DistanceEvaluator<typename TransformT::Scalar,typename TransformT::Scalar> corr_dist_evaluator_; CorrSearchT corr_search_; UnityWeightEvaluator<typename TransformT::Scalar,typename TransformT::Scalar> point_corr_weight_eval_; UnityWeightEvaluator<typename TransformT::Scalar,typename TransformT::Scalar> plane_corr_weight_eval_; }; template <class TransformT, class CorrSearchT> class SimpleCombinedMetricICPWrapper : private DefaultCombinedMetricICPEntities<TransformT,CorrSearchT>, public DefaultCombinedMetricICP<TransformT,CorrSearchT> { public: EIGEN_MAKE_ALIGNED_OPERATOR_NEW SimpleCombinedMetricICPWrapper(const ConstVectorSetMatrixMap<typename TransformT::Scalar,TransformT::Dim> &dst_points, const ConstVectorSetMatrixMap<typename TransformT::Scalar,TransformT::Dim> &dst_normals, const ConstVectorSetMatrixMap<typename TransformT::Scalar,TransformT::Dim> &src_points) : DefaultCombinedMetricICPEntities<TransformT,CorrSearchT>(dst_points, src_points), DefaultCombinedMetricICP<TransformT,CorrSearchT>(dst_points, dst_normals, src_points, this->corr_search_, this->point_corr_weight_eval_, this->plane_corr_weight_eval_) {} SimpleCombinedMetricICPWrapper(const ConstVectorSetMatrixMap<typename TransformT::Scalar,TransformT::Dim> &dst_points, const ConstVectorSetMatrixMap<typename TransformT::Scalar,TransformT::Dim> &dst_normals, const ConstVectorSetMatrixMap<typename TransformT::Scalar,TransformT::Dim> &src_points, const ConstVectorSetMatrixMap<typename TransformT::Scalar,TransformT::Dim> &src_normals) : DefaultCombinedMetricICPEntities<TransformT,CorrSearchT>(dst_points, src_points), DefaultCombinedMetricICP<TransformT,CorrSearchT>(dst_points, dst_normals, src_points, src_normals, this->corr_search_, this->point_corr_weight_eval_, this->plane_corr_weight_eval_) {} }; template <class TransformT, class CorrSearchT> using DefaultCombinedMetricDenseWarpFieldICP = CombinedMetricDenseWarpFieldICP<TransformT,CorrSearchT,NeighborhoodSet<typename TransformT::Scalar>,UnityWeightEvaluator<typename TransformT::Scalar,typename TransformT::Scalar>,UnityWeightEvaluator<typename TransformT::Scalar,typename TransformT::Scalar>,RBFKernelWeightEvaluator<typename TransformT::Scalar,typename TransformT::Scalar,true>>; template <class TransformT, class CorrSearchT> class DefaultCombinedMetricDenseWarpFieldICPEntities { public: EIGEN_MAKE_ALIGNED_OPERATOR_NEW DefaultCombinedMetricDenseWarpFieldICPEntities(const ConstVectorSetMatrixMap<typename TransformT::Scalar,TransformT::Dim> &dst_points, const ConstVectorSetMatrixMap<typename TransformT::Scalar,TransformT::Dim> &src_points) : dst_feat_(dst_points), src_feat_(src_points), corr_search_(dst_feat_, src_feat_, corr_dist_evaluator_) {} protected: PointFeaturesAdaptor<typename TransformT::Scalar,TransformT::Dim> dst_feat_; PointFeaturesAdaptor<typename TransformT::Scalar,TransformT::Dim> src_feat_; DistanceEvaluator<typename TransformT::Scalar,typename TransformT::Scalar> corr_dist_evaluator_; CorrSearchT corr_search_; UnityWeightEvaluator<typename TransformT::Scalar,typename TransformT::Scalar> point_corr_weight_eval_; UnityWeightEvaluator<typename TransformT::Scalar,typename TransformT::Scalar> plane_corr_weight_eval_; RBFKernelWeightEvaluator<typename TransformT::Scalar,typename TransformT::Scalar,true> reg_weight_eval_; }; template <class TransformT, class CorrSearchT> class SimpleCombinedMetricDenseWarpFieldICPWrapper : private DefaultCombinedMetricDenseWarpFieldICPEntities<TransformT,CorrSearchT>, public DefaultCombinedMetricDenseWarpFieldICP<TransformT,CorrSearchT> { public: EIGEN_MAKE_ALIGNED_OPERATOR_NEW SimpleCombinedMetricDenseWarpFieldICPWrapper(const ConstVectorSetMatrixMap<typename TransformT::Scalar,TransformT::Dim> &dst_points, const ConstVectorSetMatrixMap<typename TransformT::Scalar,TransformT::Dim> &dst_normals, const ConstVectorSetMatrixMap<typename TransformT::Scalar,TransformT::Dim> &src_points, const std::vector<NeighborSet<typename TransformT::Scalar>> &regularization_neighborhoods) : DefaultCombinedMetricDenseWarpFieldICPEntities<TransformT,CorrSearchT>(dst_points, src_points), DefaultCombinedMetricDenseWarpFieldICP<TransformT,CorrSearchT>(dst_points, dst_normals, src_points, this->corr_search_, regularization_neighborhoods, this->point_corr_weight_eval_, this->plane_corr_weight_eval_, this->reg_weight_eval_) {} }; template <class TransformT, class CorrSearchT> using DefaultCombinedMetricSparseWarpFieldICP = CombinedMetricSparseWarpFieldICP<TransformT,CorrSearchT,NeighborhoodSet<typename TransformT::Scalar>,NeighborhoodSet<typename TransformT::Scalar>,UnityWeightEvaluator<typename TransformT::Scalar,typename TransformT::Scalar>,UnityWeightEvaluator<typename TransformT::Scalar,typename TransformT::Scalar>,RBFKernelWeightEvaluator<typename TransformT::Scalar,typename TransformT::Scalar,true>,RBFKernelWeightEvaluator<typename TransformT::Scalar,typename TransformT::Scalar,true>>; template <class TransformT, class CorrSearchT> class DefaultCombinedMetricSparseWarpFieldICPEntities { public: EIGEN_MAKE_ALIGNED_OPERATOR_NEW DefaultCombinedMetricSparseWarpFieldICPEntities(const ConstVectorSetMatrixMap<typename TransformT::Scalar,TransformT::Dim> &dst_points, const ConstVectorSetMatrixMap<typename TransformT::Scalar,TransformT::Dim> &src_points) : dst_feat_(dst_points), src_feat_(src_points), corr_search_(dst_feat_, src_feat_, corr_dist_evaluator_) {} protected: PointFeaturesAdaptor<typename TransformT::Scalar,TransformT::Dim> dst_feat_; PointFeaturesAdaptor<typename TransformT::Scalar,TransformT::Dim> src_feat_; DistanceEvaluator<typename TransformT::Scalar,typename TransformT::Scalar> corr_dist_evaluator_; CorrSearchT corr_search_; UnityWeightEvaluator<typename TransformT::Scalar,typename TransformT::Scalar> point_corr_weight_eval_; UnityWeightEvaluator<typename TransformT::Scalar,typename TransformT::Scalar> plane_corr_weight_eval_; RBFKernelWeightEvaluator<typename TransformT::Scalar,typename TransformT::Scalar,true> control_weight_eval_; RBFKernelWeightEvaluator<typename TransformT::Scalar,typename TransformT::Scalar,true> reg_weight_eval_; }; template <class TransformT, class CorrSearchT> class SimpleCombinedMetricSparseWarpFieldICPWrapper : private DefaultCombinedMetricSparseWarpFieldICPEntities<TransformT,CorrSearchT>, public DefaultCombinedMetricSparseWarpFieldICP<TransformT,CorrSearchT> { public: EIGEN_MAKE_ALIGNED_OPERATOR_NEW SimpleCombinedMetricSparseWarpFieldICPWrapper(const ConstVectorSetMatrixMap<typename TransformT::Scalar,TransformT::Dim> &dst_points, const ConstVectorSetMatrixMap<typename TransformT::Scalar,TransformT::Dim> &dst_normals, const ConstVectorSetMatrixMap<typename TransformT::Scalar,TransformT::Dim> &src_points, const std::vector<NeighborSet<typename TransformT::Scalar>> &src_to_control_neighborhoods, size_t num_control_nodes, const std::vector<NeighborSet<typename TransformT::Scalar>> &control_regularization_neighborhoods) : DefaultCombinedMetricSparseWarpFieldICPEntities<TransformT,CorrSearchT>(dst_points, src_points), DefaultCombinedMetricSparseWarpFieldICP<TransformT,CorrSearchT>(dst_points, dst_normals, src_points, this->corr_search_, src_to_control_neighborhoods, num_control_nodes, control_regularization_neighborhoods, this->point_corr_weight_eval_, this->plane_corr_weight_eval_, this->control_weight_eval_, this->reg_weight_eval_) {} }; template <class TransformT> using DefaultKDTreeSearch = CorrespondenceSearchKDTree<PointFeaturesAdaptor<typename TransformT::Scalar,TransformT::Dim>,KDTreeDistanceAdaptors::L2,PointFeaturesAdaptor<typename TransformT::Scalar,TransformT::Dim>,DistanceEvaluator<typename TransformT::Scalar,typename TransformT::Scalar>>; template <class TransformT> using DefaultProjectiveSearch = CorrespondenceSearchProjective<typename TransformT::Scalar,PointFeaturesAdaptor<typename TransformT::Scalar,3>,DistanceEvaluator<typename TransformT::Scalar,typename TransformT::Scalar>>; } // namespace internal template <class TransformT> using SimplePointToPointMetricICP = internal::SimplePointToPointMetricICPWrapper<TransformT,internal::DefaultKDTreeSearch<TransformT>>; template <class TransformT> using SimplePointToPointMetricProjectiveICP = internal::SimplePointToPointMetricICPWrapper<TransformT,internal::DefaultProjectiveSearch<TransformT>>; template <class TransformT> using SimpleCombinedMetricICP = internal::SimpleCombinedMetricICPWrapper<TransformT,internal::DefaultKDTreeSearch<TransformT>>; template <class TransformT> using SimpleCombinedMetricProjectiveICP = internal::SimpleCombinedMetricICPWrapper<TransformT,internal::DefaultProjectiveSearch<TransformT>>; template <class TransformT> using SimpleCombinedMetricDenseWarpFieldICP = internal::SimpleCombinedMetricDenseWarpFieldICPWrapper<TransformT,internal::DefaultKDTreeSearch<TransformT>>; template <class TransformT> using SimpleCombinedMetricDenseWarpFieldProjectiveICP = internal::SimpleCombinedMetricDenseWarpFieldICPWrapper<TransformT,internal::DefaultProjectiveSearch<TransformT>>; template <class TransformT> using SimpleCombinedMetricSparseWarpFieldICP = internal::SimpleCombinedMetricSparseWarpFieldICPWrapper<TransformT,internal::DefaultKDTreeSearch<TransformT>>; template <class TransformT> using SimpleCombinedMetricSparseWarpFieldProjectiveICP = internal::SimpleCombinedMetricSparseWarpFieldICPWrapper<TransformT,internal::DefaultProjectiveSearch<TransformT>>; // Point to point typedef SimplePointToPointMetricICP<RigidTransform<float,2>> SimplePointToPointMetricRigidICP2f; typedef SimplePointToPointMetricICP<RigidTransform<double,2>> SimplePointToPointMetricRigidICP2d; typedef SimplePointToPointMetricICP<RigidTransform<float,3>> SimplePointToPointMetricRigidICP3f; typedef SimplePointToPointMetricICP<RigidTransform<double,3>> SimplePointToPointMetricRigidICP3d; typedef SimplePointToPointMetricICP<AffineTransform<float,2>> SimplePointToPointMetricAffineICP2f; typedef SimplePointToPointMetricICP<AffineTransform<double,2>> SimplePointToPointMetricAffineICP2d; typedef SimplePointToPointMetricICP<AffineTransform<float,3>> SimplePointToPointMetricAffineICP3f; typedef SimplePointToPointMetricICP<AffineTransform<double,3>> SimplePointToPointMetricAffineICP3d; typedef SimplePointToPointMetricProjectiveICP<RigidTransform<float,3>> SimplePointToPointMetricRigidProjectiveICP3f; typedef SimplePointToPointMetricProjectiveICP<RigidTransform<double,3>> SimplePointToPointMetricRigidProjectiveICP3d; typedef SimplePointToPointMetricProjectiveICP<AffineTransform<float,3>> SimplePointToPointMetricAffineProjectiveICP3f; typedef SimplePointToPointMetricProjectiveICP<AffineTransform<double,3>> SimplePointToPointMetricAffineProjectiveICP3d; // Combined metric typedef SimpleCombinedMetricICP<RigidTransform<float,2>> SimpleCombinedMetricRigidICP2f; typedef SimpleCombinedMetricICP<RigidTransform<double,2>> SimpleCombinedMetricRigidICP2d; typedef SimpleCombinedMetricICP<RigidTransform<float,3>> SimpleCombinedMetricRigidICP3f; typedef SimpleCombinedMetricICP<RigidTransform<double,3>> SimpleCombinedMetricRigidICP3d; typedef SimpleCombinedMetricICP<AffineTransform<float,2>> SimpleCombinedMetricAffineICP2f; typedef SimpleCombinedMetricICP<AffineTransform<double,2>> SimpleCombinedMetricAffineICP2d; typedef SimpleCombinedMetricICP<AffineTransform<float,3>> SimpleCombinedMetricAffineICP3f; typedef SimpleCombinedMetricICP<AffineTransform<double,3>> SimpleCombinedMetricAffineICP3d; typedef SimpleCombinedMetricProjectiveICP<RigidTransform<float,3>> SimpleCombinedMetricRigidProjectiveICP3f; typedef SimpleCombinedMetricProjectiveICP<RigidTransform<double,3>> SimpleCombinedMetricRigidProjectiveICP3d; typedef SimpleCombinedMetricProjectiveICP<AffineTransform<float,3>> SimpleCombinedMetricAffineProjectiveICP3f; typedef SimpleCombinedMetricProjectiveICP<AffineTransform<double,3>> SimpleCombinedMetricAffineProjectiveICP3d; // Dense warp field typedef SimpleCombinedMetricDenseWarpFieldICP<RigidTransform<float,2>> SimpleCombinedMetricDenseRigidWarpFieldICP2f; typedef SimpleCombinedMetricDenseWarpFieldICP<RigidTransform<double,2>> SimpleCombinedMetricDenseRigidWarpFieldICP2d; typedef SimpleCombinedMetricDenseWarpFieldICP<RigidTransform<float,3>> SimpleCombinedMetricDenseRigidWarpFieldICP3f; typedef SimpleCombinedMetricDenseWarpFieldICP<RigidTransform<double,3>> SimpleCombinedMetricDenseRigidWarpFieldICP3d; typedef SimpleCombinedMetricDenseWarpFieldICP<AffineTransform<float,2>> SimpleCombinedMetricDenseAffineWarpFieldICP2f; typedef SimpleCombinedMetricDenseWarpFieldICP<AffineTransform<double,2>> SimpleCombinedMetricDenseAffineWarpFieldICP2d; typedef SimpleCombinedMetricDenseWarpFieldICP<AffineTransform<float,3>> SimpleCombinedMetricDenseAffineWarpFieldICP3f; typedef SimpleCombinedMetricDenseWarpFieldICP<AffineTransform<double,3>> SimpleCombinedMetricDenseAffineWarpFieldICP3d; typedef SimpleCombinedMetricDenseWarpFieldProjectiveICP<RigidTransform<float,3>> SimpleCombinedMetricDenseRigidWarpFieldProjectiveICP3f; typedef SimpleCombinedMetricDenseWarpFieldProjectiveICP<RigidTransform<double,3>> SimpleCombinedMetricDenseRigidWarpFieldProjectiveICP3d; typedef SimpleCombinedMetricDenseWarpFieldProjectiveICP<AffineTransform<float,3>> SimpleCombinedMetricDenseAffineWarpFieldProjectiveICP3f; typedef SimpleCombinedMetricDenseWarpFieldProjectiveICP<AffineTransform<double,3>> SimpleCombinedMetricDenseAffineWarpFieldProjectiveICP3d; // Sparse warp field typedef SimpleCombinedMetricSparseWarpFieldICP<RigidTransform<float,2>> SimpleCombinedMetricSparseRigidWarpFieldICP2f; typedef SimpleCombinedMetricSparseWarpFieldICP<RigidTransform<double,2>> SimpleCombinedMetricSparseRigidWarpFieldICP2d; typedef SimpleCombinedMetricSparseWarpFieldICP<RigidTransform<float,3>> SimpleCombinedMetricSparseRigidWarpFieldICP3f; typedef SimpleCombinedMetricSparseWarpFieldICP<RigidTransform<double,3>> SimpleCombinedMetricSparseRigidWarpFieldICP3d; typedef SimpleCombinedMetricSparseWarpFieldICP<AffineTransform<float,2>> SimpleCombinedMetricSparseAffineWarpFieldICP2f; typedef SimpleCombinedMetricSparseWarpFieldICP<AffineTransform<double,2>> SimpleCombinedMetricSparseAffineWarpFieldICP2d; typedef SimpleCombinedMetricSparseWarpFieldICP<AffineTransform<float,3>> SimpleCombinedMetricSparseAffineWarpFieldICP3f; typedef SimpleCombinedMetricSparseWarpFieldICP<AffineTransform<double,3>> SimpleCombinedMetricSparseAffineWarpFieldICP3d; typedef SimpleCombinedMetricSparseWarpFieldProjectiveICP<RigidTransform<float,3>> SimpleCombinedMetricSparseRigidWarpFieldProjectiveICP3f; typedef SimpleCombinedMetricSparseWarpFieldProjectiveICP<RigidTransform<double,3>> SimpleCombinedMetricSparseRigidWarpFieldProjectiveICP3d; typedef SimpleCombinedMetricSparseWarpFieldProjectiveICP<AffineTransform<float,3>> SimpleCombinedMetricSparseAffineWarpFieldProjectiveICP3f; typedef SimpleCombinedMetricSparseWarpFieldProjectiveICP<AffineTransform<double,3>> SimpleCombinedMetricSparseAffineWarpFieldProjectiveICP3d; }
75.84
533
0.763713
[ "vector" ]
be5b7afedd6b13b535c5a18b56709aa247900a0e
28,232
cxx
C++
Modules/Visualization/MonteverdiCore/src/mvdVectorImageModel.cxx
kikislater/OTB
8271c62b5891d3da9cb2e9ba3a2706a26de8c323
[ "Apache-2.0" ]
1
2019-09-12T00:53:05.000Z
2019-09-12T00:53:05.000Z
Modules/Visualization/MonteverdiCore/src/mvdVectorImageModel.cxx
ThomasWangWeiHong/OTB
569686e40f0ae146e726bd3cfd253e67ec2b4533
[ "Apache-2.0" ]
null
null
null
Modules/Visualization/MonteverdiCore/src/mvdVectorImageModel.cxx
ThomasWangWeiHong/OTB
569686e40f0ae146e726bd3cfd253e67ec2b4533
[ "Apache-2.0" ]
null
null
null
/* * Copyright (C) 2005-2019 Centre National d'Etudes Spatiales (CNES) * * This file is part of Orfeo Toolbox * * https://www.orfeo-toolbox.org/ * * 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 "mvdVectorImageModel.h" /*****************************************************************************/ /* INCLUDE SECTION */ // // Qt includes (sorted by alphabetic order) //// Must be included before system/custom includes. // // System includes (sorted by alphabetic order) // // ITK includes (sorted by alphabetic order) #include "itkImageRegionConstIteratorWithIndex.h" #include "itksys/SystemTools.hxx" #include "vnl/vnl_random.h" // // OTB includes (sorted by alphabetic order) #include "otbConfigure.h" #include "otbGDALDriverManagerWrapper.h" #include "otbStandardOneLineFilterWatcher.h" #include "otbSpatialReference.h" #include "otbCoordinateToName.h" #include "otbDEMHandler.h" #include "otbGroundSpacingImageFunction.h" // // Monteverdi includes (sorted by alphabetic order) #include "mvdAlgorithm.h" #include "mvdQuicklookModel.h" #include "mvdSystemError.h" namespace mvd { /* TRANSLATOR mvd::VectorImageModel Necessary for lupdate to be aware of C++ namespaces. Context comment for translator. */ const unsigned int VectorImageModel::DEFAULT_LOD_SIZE = 512; /*****************************************************************************/ /* CLASS IMPLEMENTATION SECTION */ /*****************************************************************************/ VectorImageModel ::VectorImageModel( QObject* p ) : AbstractImageModel( p ), FilenameInterface(), m_Image(), m_ImageFileReader(), m_Settings(), m_LodCount( -1 ), m_ToWgs84() { } /*****************************************************************************/ VectorImageModel ::~VectorImageModel() { } /*****************************************************************************/ void VectorImageModel ::SetFilename( const QString& filename , int w, int h) { setObjectName( filename ); SetName( QFileInfo( filename ).fileName() ); // 1. store the input filename FilenameInterface::SetFilename( filename ); // Get the largest possible region of the image m_ImageFileReader = DefaultImageFileReaderType::New(); // qDebug() // << this << "\n" // << "\tQString:" << GetFilename(); // std::cout // << "\tstd::string: " << QFile::encodeName( GetFilename() ).constData() // << std::endl; m_ImageFileReader->SetFileName(GetFilename().toStdString()); m_ImageFileReader->GetOutput()->UpdateOutputInformation(); // Retrieve the list of Lod from file m_LodCount = m_ImageFileReader->GetOverviewsCount(); // Remember native largest region. m_NativeLargestRegion = m_ImageFileReader->GetOutput()->GetLargestPossibleRegion(); // Remember native spacing m_NativeSpacing = m_ImageFileReader->GetOutput()->GetSignedSpacing(); // qDebug() // << filename // << "\norigin:" // << m_ImageFileReader->GetOutput()->GetOrigin()[ 0 ] // << m_ImageFileReader->GetOutput()->GetOrigin()[ 1 ] // << "\nspacing:" << m_NativeSpacing[ 0 ] << m_NativeSpacing[ 1 ]; // Setup GenericRSTransform m_ToWgs84 = otb::GenericRSTransform<>::New(); m_ToWgs84->SetInputDictionary(m_ImageFileReader->GetOutput()->GetMetaDataDictionary()); m_ToWgs84->SetOutputProjectionRef(otb::SpatialReference::FromWGS84().ToWkt()); m_ToWgs84->InstantiateTransform(); //Compute estimated spacing here //m_EstimatedGroundSpacing m_EstimatedGroundSpacing = m_NativeSpacing; typedef otb::GroundSpacingImageFunction<VectorImageType> GroundSpacingImageType; GroundSpacingImageType::Pointer GroundSpacing = GroundSpacingImageType::New(); GroundSpacing->SetInputImage(m_ImageFileReader->GetOutput()); if (m_ToWgs84->IsUpToDate()) { if (m_ToWgs84->GetTransformAccuracy() != otb::Projection::UNKNOWN) { IndexType index; vnl_random rand; index[0] = static_cast<IndexType::IndexValueType>(rand.lrand32(0, m_ImageFileReader->GetOutput()->GetLargestPossibleRegion().GetSize()[0])); index[1] = static_cast<IndexType::IndexValueType>(rand.lrand32(0, m_ImageFileReader->GetOutput()->GetLargestPossibleRegion().GetSize()[1])); m_EstimatedGroundSpacing = GroundSpacing->EvaluateAtIndex(index); } } // // 2. Setup file-reader. SetupCurrentLodImage(w, h); } /*****************************************************************************/ void VectorImageModel ::EnsureValidImage( const QString& filename ) { try { DefaultImageFileReaderType::Pointer imageFileReader( DefaultImageFileReaderType::New() ); QString fname = filename; if (!filename.contains(QChar('?'))) { fname.append(QChar('?')); } imageFileReader->SetFileName(fname.append(QString("&skipgeom=true")).toStdString()); imageFileReader->GetOutput()->UpdateOutputInformation(); } catch( std::exception& exc ) { // TODO manage the message returned by OTB qWarning() << ToStdString( tr( "Exception caught when validating file '%1': ") .arg( filename ) ).c_str() << exc.what(); throw // std::runtime_error( SystemError( ToStdString( tr( "File '%1' cannot be read by OTB." ) .arg( filename ) ) ); } } /*****************************************************************************/ void VectorImageModel ::BuildGdalOverviews() { // Build overviews if necessary // bool hasOverviewsSupport = (m_ImageFileReader->GetOverviewsCount()>0); int nbOfAvailableOvw = m_ImageFileReader->GetOverviewsCount(); // TODO: this choice should be done by the user during the import of the file bool forceToCacheOvw = true; qDebug() << tr( "The ImageIO used to read this file supports overviews." ); if( nbOfAvailableOvw>0 ) { // qDebug() << tr("The file already has overviews!"); return; } // TODO MSD: how to manage case of JPEG2000 with no overviews ? : wait GDAL support OpenJPEG ... // The current file don't have overviews available qDebug() << tr( "The file doesn't have overviews." ); if( !forceToCacheOvw ) { // the user doesn't want to cache the overviews, GDAL will virtually compute the ovw on demand qWarning() << tr("Letting GDAL decimate the file on-the-fly !"); return; } // the user want to cache the overviews // qDebug() << tr("Caching of overviews."); typedef otb::GDALOverviewsBuilder FilterType; FilterType::Pointer filter = FilterType::New(); assert( m_LodCount!=static_cast< unsigned int >( -1 ) ); // m_ImageFileReader->GetAvailableResolutions(m_AvailableLod); std::string tempfilename( QFile::encodeName( GetFilename() ) ); filter->SetInputFileName(tempfilename); filter->SetResamplingMethod( otb::GDAL_RESAMPLING_AVERAGE ); filter->SetResolutionFactor(4); assert( m_ImageFileReader->GetOverviewsCount()==m_LodCount ); filter->SetNbResolutions( GetNbLod() > 1 ? GetNbLod() / 2 : 1 ); try { otb::StandardOneLineFilterWatcher<> watcher( filter, ToStdString( tr( "Overviews creation: " ) ) ); filter->Update(); std::cout << std::endl; } catch( std::exception& /*exc*/ ) { // The user can continue to use the file so we return a warning message // TODO MSD return the message to the log widget qWarning() << ToStdString( tr( "The overviews creation failed.\n" "Navigation in resolution will be slower." ) ).c_str(); // throw exc; } } /*****************************************************************************/ void VectorImageModel ::virtual_BuildModel( void* context ) { SetProperties( new ImageProperties() ); // Get build-context. assert( context!=NULL ); BuildContext* buildContext = static_cast< BuildContext* >( context ); // Build image overview. if( buildContext->IsBeingStored() ) BuildGdalOverviews(); // Get build-context settings. VectorImageSettings * const settings = static_cast< VectorImageSettings * >( buildContext->m_Settings ); // Fetch the no data flags if any otb::ImageMetadataInterfaceBase::ConstPointer metaData( GetMetaDataInterface() ); std::vector<double> values; std::vector<bool> flags; bool ret = metaData->GetNoDataFlags(flags,values); if(ret && !values.empty() && !flags.empty() && flags[0]) { GetProperties()->SetNoDataEnabled(true); GetProperties()->SetNoData(values[0]); } // // Step #1: Perform pre-process of AbstractModel::BuildModel() // pattern. // Store default display settings in the pre-process stage // i.e. before histogram is generated by the standard // AbstractImageModel::BuildModel(). if( settings==NULL ) InitializeColorSetupSettings(); // // Step #2: Perform standard AbstractModel::BuildModel() // pattern. Call parent virtual method. // The call to the parent BuildModel() method will, for example, // generate the histogram. AbstractImageModel::virtual_BuildModel( context ); // // Step #3: Post-process of the BuildModel() pattern. // Remember min/max pixel for color-dynamics once histogram has been // generated. if( settings==NULL ) InitializeColorDynamicsSettings(); else SetSettings( *settings ); // Remember image properties. if( buildContext->m_Properties!=NULL ) SetProperties( *buildContext->m_Properties ); // Apply settings to child QuicklookModel. ApplySettings(); } /*****************************************************************************/ void VectorImageModel ::InitializeColorSetupSettings() { // Remember meta-data interface. otb::ImageMetadataInterfaceBase::ConstPointer metaData( GetMetaDataInterface() ); // Ensure default display returns valid band indices (see OTB bug). assert( metaData->GetDefaultDisplay().size()==3 ); #if 0 assert( metaData->GetDefaultDisplay()[ 0 ] < m_Image->GetNumberOfComponentsPerPixel() ); assert( metaData->GetDefaultDisplay()[ 1 ] < m_Image->GetNumberOfComponentsPerPixel() ); assert( metaData->GetDefaultDisplay()[ 2 ] < m_Image->GetNumberOfComponentsPerPixel() ); #endif // Patch invalid band indices of default-display (see OTB bug). VectorImageSettings::ChannelVector rgb( metaData->GetDefaultDisplay() ); if( rgb[ 0 ]>=m_Image->GetNumberOfComponentsPerPixel() ) { rgb[ 0 ] = 0; } if( rgb[ 1 ]>=m_Image->GetNumberOfComponentsPerPixel() ) { rgb[ 1 ] = 0; } if( rgb[ 2 ]>=m_Image->GetNumberOfComponentsPerPixel() ) { rgb[ 2 ] = 0; } // Store default display settings. GetSettings().SetRgbChannels( rgb ); // Store default grayscale-mode. if( m_Image->GetNumberOfComponentsPerPixel()<3 ) { GetSettings().SetGrayscaleActivated( true ); GetSettings().SetGrayChannel( rgb[ 0 ] ); } } /*****************************************************************************/ void VectorImageModel ::InitializeColorDynamicsSettings() { // Get the histogram-model. HistogramModel* histogramModel = GetHistogramModel(); assert( histogramModel!=NULL ); // Remember min/max pixels. DefaultImageType::PixelType min( histogramModel->GetMinPixel() ); DefaultImageType::PixelType max( histogramModel->GetMaxPixel() ); CountType begin = -1; CountType end = -1; mvd::RgbwBounds( begin, end, RGBW_CHANNEL_ALL ); // Store min/max intensities of default-display channels. for( CountType i=begin; i<end; ++i ) { RgbwChannel channel = static_cast< RgbwChannel >( i ); VectorImageSettings::ChannelVector::value_type band = GetSettings().GetRgbwChannel( channel ); bool isInvalid = !histogramModel->IsValid() /* || histogramModel->IsMonoValue() */; GetSettings().SetLowIntensity( channel, isInvalid ? min[ band ] : histogramModel->Quantile( band , 0.02, BOUND_LOWER ) ); GetSettings().SetHighIntensity( channel, isInvalid ? max[ band ] : histogramModel->Quantile( band , 0.02, BOUND_UPPER ) ); } } /*****************************************************************************/ CountType VectorImageModel::ComputeBestLod( int width, int height ) const { if( width<=0 || height<=0 ) return 0; ImageRegionType nativeLargestRegion( GetNativeLargestRegion() ); double factorX = double( width ) / double( nativeLargestRegion.GetSize()[ 0 ] ); double factorY = double( height ) / double( nativeLargestRegion.GetSize()[ 1 ] ); double initialZoomFactor = std::min(factorX, factorY); // Compute the best lod from the initialZoomFactor return ComputeBestLod( initialZoomFactor ); } /*****************************************************************************/ unsigned int VectorImageModel::ComputeBestLod( double zoomFactor ) const { return this->Closest( static_cast< int >( (1 / zoomFactor + 0.5) ), m_LodCount ); } /*****************************************************************************/ unsigned int VectorImageModel::Closest( double invZoomfactor, unsigned int lodCount ) { double minDist = 50000.; unsigned int closest = 0; // Compute the diff and keep the index that minimize the distance for (unsigned int idx = 0; idx < lodCount; idx++) { double diff = std::abs( static_cast< double >( 1 << idx ) - invZoomfactor ); if( diff < minDist ) { minDist = diff; closest = idx; } } return closest; } /*****************************************************************************/ void VectorImageModel ::SetupCurrentLodImage( int width, int height ) { CountType bestInitialLod = 0; // Compute the initial zoom factor and the best LOD. if( width>0 && height>0 ) { ImageRegionType nativeLargestRegion( GetNativeLargestRegion() ); double factorX = double( width ) / double( nativeLargestRegion.GetSize()[ 0 ] ); double factorY = double( height ) / double( nativeLargestRegion.GetSize()[ 1 ] ); double initialZoomFactor = std::min(factorX, factorY); // Compute the best lod from the initialZoomFactor bestInitialLod = ComputeBestLod(initialZoomFactor); } this->SetCurrentLod( bestInitialLod ); } /*****************************************************************************/ CountType VectorImageModel ::GetNbLod() const { return m_LodCount; } /*****************************************************************************/ void VectorImageModel ::virtual_SetCurrentLod( CountType lod ) { // new filename if lod is not 0 QString lodFilename( GetFilename() ); // If model is a multi-resolution image. if (lodFilename.count(QChar('?')) == 0) { // the filename is not an extended filename yet lodFilename.append( QChar('?') ); } lodFilename.append( QString( "&resol=%1" ).arg( lod ) ); // Update m_ImageFileReader m_ImageFileReader->SetFileName( QFile::encodeName( lodFilename ).constData() ); m_ImageFileReader->GetOutput()->UpdateOutputInformation(); // (Always) Update m_Image reference. m_Image = m_ImageFileReader->GetOutput(); } /*****************************************************************************/ void VectorImageModel ::virtual_RefreshHistogram() { assert( GetProperties()!=NULL ); RefreshHistogram( NULL ); } /*****************************************************************************/ ImageBaseType::ConstPointer VectorImageModel ::ToImageBase() const { return ImageBaseType::ConstPointer( m_Image ); } /*****************************************************************************/ ImageBaseType::Pointer VectorImageModel ::ToImageBase() { return ImageBaseType::Pointer( m_Image ); } /*****************************************************************************/ std::string VectorImageModel ::GetCenterPixelPlaceName() { // center index IndexType centerIndex; centerIndex[0] = GetNativeLargestRegion().GetIndex()[0] + GetNativeLargestRegion().GetSize(0)/2; centerIndex[1] = GetNativeLargestRegion().GetIndex()[1] + GetNativeLargestRegion().GetSize(1)/2; // // Compute the physical coordinates of the center pixel PointType centerPoint; centerPoint[0] = (centerIndex[0] * GetNativeSpacing()[0] ) + GetOrigin()[0]; centerPoint[1] = (centerIndex[1] * GetNativeSpacing()[1] ) + GetOrigin()[1]; // lat / long PointType wgs84; wgs84 = GetGenericRSTransform()->TransformPoint(centerPoint); // get placename otb::CoordinateToName::Pointer coordinateToName = otb::CoordinateToName::New(); coordinateToName->SetLonLat(wgs84); coordinateToName->Evaluate(); // get the placename - Country (if any) std::ostringstream oss; std::string placeName = coordinateToName->GetPlaceName(); std::string countryName = coordinateToName->GetCountryName(); if (placeName != "") oss << placeName; if (countryName != "") oss << " - "<< countryName; return oss.str(); } /*****************************************************************************/ bool VectorImageModel ::IsModified() const { return GetSettings().IsModified() || ( GetProperties()!=NULL && GetProperties()->IsModified() ); } /*****************************************************************************/ void VectorImageModel ::ClearModified() { GetSettings().ClearModified(); if( GetProperties()!=NULL ) GetProperties()->ClearModified(); // TODO: Remove temporary hack (Quicklook modified flag). QuicklookModel* quicklookModel = GetQuicklookModel(); // If image-model is not quicklook-model. if( quicklookModel!=NULL ) quicklookModel->ClearModified(); } /*****************************************************************************/ void VectorImageModel ::ApplySettings() { // qDebug() << this << "::ApplySettings()"; // TODO: Remove temporary hack (Quicklook rendering settings). QuicklookModel* quicklookModel = GetQuicklookModel(); // If image-model is not quicklook-model. if( quicklookModel!=NULL ) { // Update quicklook rendering-settings. quicklookModel->SetSettings( GetSettings() ); quicklookModel->ApplySettings(); } } /*****************************************************************************/ std::string VectorImageModel ::virtual_GetWkt() const { assert( !m_Image.IsNull() ); return m_Image->GetProjectionRef(); } /*****************************************************************************/ bool VectorImageModel ::virtual_HasKwl() const { assert( !m_Image.IsNull() ); return m_Image->GetImageKeywordlist().GetSize()>0; } /*****************************************************************************/ void VectorImageModel ::virtual_ToWgs84( const PointType & physical, PointType & wgs84, double & alt ) const { assert( !m_ToWgs84.IsNull() ); assert( m_ToWgs84->IsUpToDate() ); wgs84 = m_ToWgs84->TransformPoint( physical ); alt = otb::DEMHandler::Instance()->GetHeightAboveEllipsoid( wgs84[ 0 ], wgs84[ 1 ] ); } /*****************************************************************************/ /* SLOTS */ /*****************************************************************************/ void VectorImageModel ::OnModelUpdated() { // qDebug() << this << "::OnModelUpdated()"; // Apply settings to rendering pipeline. ApplySettings(); // Emit settings update to notify display refresh. emit SettingsUpdated( this ); // Emit properties update. emit PropertiesUpdated( this ); } /*****************************************************************************/ void VectorImageModel ::OnPhysicalCursorPositionChanged( const QPoint &, const PointType &, const PointType & point, const DefaultImageType::PixelType& pixel ) { // Pixel is read from otb::GlImageActor (inside ImageViewRender) // which does only components contain red, green and blue channel components. // Only read, green and blue channel related component are // present. #define USE_RGB_CHANNELS_LIMIT 1 // stream to fill std::ostringstream ossPhysicalX; std::ostringstream ossPhysicalY; std::ostringstream ossGeographicLong; std::ostringstream ossGeographicLat; std::ostringstream ossGeographicElevation; std::ostringstream ossRadio; // emitted current pixel QStringList bandNames; #if USE_RGB_CHANNELS_LIMIT QStringList stringList; #endif //emitted current geography StringVector geoVector; QStringList geoList; //emitted current geography StringVector cartoVector; QStringList cartoList; SpacingType nativeSpacing( GetNativeSpacing() ); // physical coordinates to index (at resol 0) IndexType currentIndex; currentIndex[ 0 ] = static_cast< unsigned int >( ( point[ 0 ] - GetOrigin()[ 0 ] ) / nativeSpacing[ 0 ] ); currentIndex[ 1 ] = static_cast< unsigned int >( ( point[ 1 ] - GetOrigin()[ 1 ] ) / nativeSpacing[ 1 ] ); bool isInsideNativeLargestRegion = GetNativeLargestRegion().IsInside( currentIndex ); emit CurrentIndexUpdated( currentIndex, isInsideNativeLargestRegion ); // // Display the radiometry of the displayed channels VectorImageSettings::ChannelVector rgb; GetSettings().GetSmartChannels( rgb ); // show the current pixel description only if the mouse cursor is // under the image if( isInsideNativeLargestRegion || 1 ) { // // get the physical coordinates if (!ToImage()->GetProjectionRef().empty()) { cartoVector.push_back(ToStdString(tr("Cartographic"))); } else { //No cartographic info available cartoVector.push_back(ToStdString(tr("Physical"))); } ossPhysicalX << point[ 0 ]; ossPhysicalY << point[ 1 ]; cartoVector.push_back(ossPhysicalX.str()); cartoVector.push_back(ossPhysicalY.str()); // index in current Lod image IndexType currentLodIndex; currentLodIndex[0] = (point[ 0 ] - ToImage()->GetOrigin()[0]) / ToImage()->GetSignedSpacing()[0]; currentLodIndex[1] = (point[ 1 ] - ToImage()->GetOrigin()[1]) / ToImage()->GetSignedSpacing()[1]; // // get the LatLong if (!ToImage()->GetProjectionRef().empty()) { geoVector.push_back(ToStdString(tr("Geographic(exact)"))); } else if (ToImage()->GetImageKeywordlist().GetSize() != 0) { geoVector.push_back(ToStdString(tr("Geographic(sensor model)"))); } else { geoVector.push_back(ToStdString(tr("No geoinfo"))); } if( ToImage()->GetLargestPossibleRegion().IsInside(currentLodIndex) || 1 ) { // TODO : Is there a better method to detect no geoinfo available ? if (!ToImage()->GetProjectionRef().empty() || ToImage()->GetImageKeywordlist().GetSize() != 0) { assert( !m_ToWgs84.IsNull() ); PointType wgs84; wgs84 = m_ToWgs84->TransformPoint( point ); ossGeographicLong.precision(6); ossGeographicLat.precision(6); ossGeographicLong << std::fixed << wgs84[0]; ossGeographicLat << std::fixed << wgs84[1]; geoVector.push_back(ossGeographicLong.str()); geoVector.push_back(ossGeographicLat.str()); double elev = otb::DEMHandler::Instance()->GetHeightAboveEllipsoid(wgs84[0],wgs84[1]); if(elev > -32768) { ossGeographicElevation << elev; geoVector.push_back(ossGeographicElevation.str()); } else geoVector.push_back( "" ); } else { //No geoinfo available geoVector.push_back(""); geoVector.push_back(""); geoVector.push_back(""); } } /* else { //handle here the case of QL information display. It //displays geographic info when the user is scrolling over the QL // // compute the current ql index if (!ToImage()->GetProjectionRef().empty() || ToImage()->GetImageKeywordlist().GetSize() != 0) { currentLodIndex[0] = (Xpc - GetQuicklookModel()->ToImage()->GetOrigin()[0]) / GetQuicklookModel()->ToImage()->GetSpacing()[0]; currentLodIndex[1] = (Ypc - GetQuicklookModel()->ToImage()->GetOrigin()[1]) / GetQuicklookModel()->ToImage()->GetSpacing()[1]; PointType wgs84; PointType currentLodPoint; GetQuicklookModel()->ToImage()->TransformIndexToPhysicalPoint(currentLodIndex, currentLodPoint); wgs84 = GetGenericRSTransform()->TransformPoint(currentLodPoint); ossGeographicLong.precision(6); ossGeographicLat.precision(6); ossGeographicLong << std::fixed << wgs84[0]; ossGeographicLat << std::fixed << wgs84[1]; //Update geovector with location over QL index geoVector.push_back(ossGeographicLong.str()); geoVector.push_back(ossGeographicLat.str()); double elev = otb::DEMHandler::Instance()->GetHeightAboveEllipsoid(wgs84[0],wgs84[1]); if(elev > -32768) { ossGeographicElevation << elev; geoVector.push_back(ossGeographicElevation.str()); } } else { //No geoinfo available geoVector.push_back(""); geoVector.push_back(""); geoVector.push_back(""); } } */ cartoList = ToQStringList( cartoVector ); geoList = ToQStringList( geoVector ); if( true /* ToImage()->GetBufferedRegion().IsInside(currentLodIndex) */ ) { /* // // get the pixel at current index currentPixel = ToImage()->GetPixel(currentLodIndex); */ ossRadio << ToStdString( tr( "Radiometry: [ " ) ); #if USE_RGB_CHANNELS_LIMIT for( unsigned int i=0; i<pixel.GetSize(); ++i ) ossRadio << pixel.GetElement( i ) << " "; #else for (unsigned int idx = 0; idx < rgb.size(); idx++) { ossRadio << pixel.GetElement(rgb[idx]) << " "; } #endif ossRadio << "]"; // qDebug() << ossRadio.str().c_str(); } /* else { // // compute the current ql index currentLodIndex[0] = (Xpc - GetQuicklookModel()->ToImage()->GetOrigin()[0]) / GetQuicklookModel()->ToImage()->GetSpacing()[0]; currentLodIndex[1] = (Ypc - GetQuicklookModel()->ToImage()->GetOrigin()[1]) / GetQuicklookModel()->ToImage()->GetSpacing()[1]; // // Get the radiometry form the Ql if ( GetQuicklookModel()->ToImage()->GetBufferedRegion().IsInside(currentLodIndex) ) { currentPixel = GetQuicklookModel()->ToImage()->GetPixel(currentLodIndex); ossRadio <<"Ql [ "; for (unsigned int idx = 0; idx < rgb.size(); idx++) { ossRadio <<currentPixel.GetElement(rgb[idx]) << " "; } ossRadio <<"]"; } } */ } // update band name for the current position bandNames = GetBandNames( true ); // qDebug() << bandNames; #if USE_RGB_CHANNELS_LIMIT stringList << bandNames.at( rgb[ RGBW_CHANNEL_RED ] ) << bandNames.at( rgb[ RGBW_CHANNEL_GREEN ] ) << bandNames.at( rgb[ RGBW_CHANNEL_BLUE ] ); // qDebug() << "Bands:" << stringList; #endif // update the status bar emit CurrentPhysicalUpdated( cartoList ); emit CurrentGeographicUpdated( geoList ); emit CurrentRadioUpdated( ToQString( ossRadio.str().c_str() ) ); #if USE_RGB_CHANNELS_LIMIT emit CurrentPixelValueUpdated( pixel, stringList ); #else emit CurrentPixelValueUpdated( pixel, bandNames ); #endif } } // end namespace 'mvd'
28.175649
146
0.609131
[ "vector", "model" ]
be5c8daea8a05a65ffb68a3b4a769794411a9e68
275
cpp
C++
old/Codeforces/337/A.cpp
not522/Competitive-Programming
be4a7d25caf5acbb70783b12899474a56c34dedb
[ "Unlicense" ]
7
2018-04-14T14:55:51.000Z
2022-01-31T10:49:49.000Z
old/Codeforces/337/A.cpp
not522/Competitive-Programming
be4a7d25caf5acbb70783b12899474a56c34dedb
[ "Unlicense" ]
5
2018-04-14T14:28:49.000Z
2019-05-11T02:22:10.000Z
old/Codeforces/337/A.cpp
not522/Competitive-Programming
be4a7d25caf5acbb70783b12899474a56c34dedb
[ "Unlicense" ]
null
null
null
#include "template.hpp" int main() { int n, m, res = numeric_limits<int>::max(); cin >> n >> m; vector<int> f(m); for (int& i : f) cin >> i; sort(f.begin(), f.end()); for (int i = 0; i <= m - n; ++i) res = min(res, f[i + n - 1] - f[i]); cout << res << endl; }
22.916667
71
0.483636
[ "vector" ]
415abc08003a4edfd8cd54148c7bbe58befef51e
5,263
hpp
C++
src/nnfusion/frontend/onnx_import/core/tensor.hpp
lynex/nnfusion
6332697c71b6614ca6f04c0dac8614636882630d
[ "MIT" ]
639
2020-09-05T10:00:59.000Z
2022-03-30T08:42:39.000Z
src/nnfusion/frontend/onnx_import/core/tensor.hpp
QPC-database/nnfusion
99ada47c50f355ca278001f11bc752d1c7abcee2
[ "MIT" ]
252
2020-09-09T05:35:36.000Z
2022-03-29T04:58:41.000Z
src/nnfusion/frontend/onnx_import/core/tensor.hpp
QPC-database/nnfusion
99ada47c50f355ca278001f11bc752d1c7abcee2
[ "MIT" ]
104
2020-09-05T10:01:08.000Z
2022-03-23T10:59:13.000Z
//***************************************************************************** // Copyright 2017-2020 Intel Corporation // // 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. //***************************************************************************** //---------------------------------------------------------------------------------------------- // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. //---------------------------------------------------------------------------------------------- #pragma once #include "../util/util.hpp" namespace nnfusion { namespace frontend { namespace onnx_import { class Tensor { public: Tensor() = delete; explicit Tensor(const onnx::TensorProto& tensor) : m_tensor_proto{&tensor} , m_shape{std::begin(tensor.dims()), std::end(tensor.dims())} { } Tensor(const Tensor&) = default; Tensor(Tensor&&) = default; Tensor& operator=(const Tensor&) = delete; Tensor& operator=(Tensor&&) = delete; const Shape& get_shape() const { return m_shape; } template <typename T> std::vector<T> get_data() const { NNFUSION_CHECK(!m_tensor_proto->has_segment()) << "loading tensor segments not supported."; return detail::get_data<T>(*m_tensor_proto); } const std::string& get_name() const { NNFUSION_CHECK(m_tensor_proto->has_name()) << "tensor has no name specified."; return m_tensor_proto->name(); } const element::Type& get_ng_type() const { NNFUSION_CHECK(m_tensor_proto->has_data_type()) << "tensor has no data type specified."; switch (m_tensor_proto->data_type()) { case onnx::TensorProto_DataType::TensorProto_DataType_BOOL: return element::boolean; case onnx::TensorProto_DataType::TensorProto_DataType_FLOAT: case onnx::TensorProto_DataType::TensorProto_DataType_FLOAT16: return element::f32; case onnx::TensorProto_DataType::TensorProto_DataType_DOUBLE: return element::f64; case onnx::TensorProto_DataType::TensorProto_DataType_INT8: return element::i8; case onnx::TensorProto_DataType::TensorProto_DataType_INT16: return element::i16; case onnx::TensorProto_DataType::TensorProto_DataType_INT32: return element::i32; case onnx::TensorProto_DataType::TensorProto_DataType_INT64: return element::i64; case onnx::TensorProto_DataType::TensorProto_DataType_UINT8: return element::u8; case onnx::TensorProto_DataType::TensorProto_DataType_UINT16: return element::u16; case onnx::TensorProto_DataType::TensorProto_DataType_UINT32: return element::u32; case onnx::TensorProto_DataType::TensorProto_DataType_UINT64: return element::u64; case onnx::TensorProto_DataType::TensorProto_DataType_UNDEFINED: NNFUSION_CHECK_FAIL() << "data type is not defined"; break; default: NNFUSION_CHECK_FAIL() << "unsupported data type: " << onnx::TensorProto_DataType_Name( onnx::TensorProto_DataType(m_tensor_proto->data_type())); break; } } operator onnx::TensorProto_DataType() const { return onnx::TensorProto_DataType(m_tensor_proto->data_type()); } private: const onnx::TensorProto* m_tensor_proto; Shape m_shape; }; inline std::ostream& operator<<(std::ostream& outs, const Tensor& tensor) { return (outs << "<Tensor: " << tensor.get_name() << ">"); } } // namespace onnx_import } // namespace frontend } // namespace nnfuison
43.139344
100
0.503325
[ "shape", "vector" ]
4161417bc6ed0b0c47d9b0cad7490495a1eec02c
27,274
cpp
C++
toonz/sources/toonz/cleanuppreview.cpp
morevnaproject-org/opentoonz
3335715599092c3f173c2ffd015f09b1a0b3cb91
[ "BSD-3-Clause" ]
36
2020-05-18T22:26:35.000Z
2022-02-19T00:09:25.000Z
toonz/sources/toonz/cleanuppreview.cpp
morevnaproject-org/opentoonz
3335715599092c3f173c2ffd015f09b1a0b3cb91
[ "BSD-3-Clause" ]
16
2020-05-14T17:51:08.000Z
2022-02-11T01:49:38.000Z
toonz/sources/toonz/cleanuppreview.cpp
morevnaproject-org/opentoonz
3335715599092c3f173c2ffd015f09b1a0b3cb91
[ "BSD-3-Clause" ]
8
2020-06-12T17:01:20.000Z
2021-09-15T07:03:12.000Z
// TnzCore #include "timagecache.h" #include "tcurveutil.h" // ToonzLib #include "toonz/stage2.h" #include "toonz/txshsimplelevel.h" #include "toonz/txshlevelhandle.h" #include "toonz/tcleanupper.h" #include "toonz/palettecontroller.h" #include "toonz/tpalettehandle.h" #include "toonz/observer.h" #include "toonz/imagemanager.h" #include "toonz/tscenehandle.h" // TnzTools includes #include "tools/toolutils.h" #include "tools/toolhandle.h" #include "tools/toolcommandids.h" // TnzQt includes #include "toonzqt/cursors.h" #include "toonzqt/icongenerator.h" #include "historytypes.h" // Toonz includes #include "tapp.h" #include "cleanupsettingsmodel.h" // Qt includes #include <QTimer> #include "cleanuppreview.h" // TODO: Avoid rebuilding the preview as long as parameters are untouched. Use a // flag associated to // each frame so we know when frames need to be rebuilt //********************************************************************************** // Local namespace stuff //********************************************************************************** namespace { PreviewToggleCommand previewToggle; CameraTestToggleCommand cameraTestToggle; } // namespace //********************************************************************************** // PreviewToggleCommand implementation //********************************************************************************** PreviewToggleCommand::PreviewToggleCommand() : MenuItemHandler("MI_CleanupPreview") { // Setup the processing timer. The timer is needed to prevent (or rather, // cumulate) // short-lived parameter changes to trigger any preview processing. m_timer.setSingleShot(true); m_timer.setInterval(500); } //-------------------------------------------------------------------------- void PreviewToggleCommand::execute() { CleanupPreviewCheck *pc = CleanupPreviewCheck::instance(); if (pc->isEnabled()) enable(); else disable(); } //-------------------------------------------------------------------------- void PreviewToggleCommand::enable() { // Cleanup Preview and Camera Test are exclusive. In case, disable the latter. // NOTE: This is done *before* attaching, since attach may invoke a preview // rebuild. CameraTestCheck *tc = CameraTestCheck::instance(); tc->setIsEnabled(false); // Attach to the model CleanupSettingsModel *model = CleanupSettingsModel::instance(); model->attach(CleanupSettingsModel::LISTENER | CleanupSettingsModel::PREVIEWER); // Connect signals bool ret = true; ret = ret && connect(model, SIGNAL(previewDataChanged()), this, SLOT(onPreviewDataChanged())); ret = ret && connect(model, SIGNAL(modelChanged(bool)), this, SLOT(onModelChanged(bool))); ret = ret && connect(&m_timer, SIGNAL(timeout()), this, SLOT(postProcess())); TPaletteHandle *ph = TApp::instance()->getPaletteController()->getCurrentCleanupPalette(); ret = ret && connect(ph, SIGNAL(colorStyleChanged(bool)), &m_timer, SLOT(start())); ret = ret && connect(ph, SIGNAL(paletteChanged()), &m_timer, SLOT(start())); assert(ret); onPreviewDataChanged(); // in preview cleanup mode, tools are forbidden! Reverting to hand... TApp::instance()->getCurrentTool()->setTool(T_Hand); } //-------------------------------------------------------------------------- void PreviewToggleCommand::disable() { CleanupSettingsModel *model = CleanupSettingsModel::instance(); model->detach(CleanupSettingsModel::LISTENER | CleanupSettingsModel::PREVIEWER); bool ret = true; ret = ret && disconnect(model, SIGNAL(previewDataChanged()), this, SLOT(onPreviewDataChanged())); ret = ret && disconnect(model, SIGNAL(modelChanged(bool)), this, SLOT(onModelChanged(bool))); ret = ret && disconnect(&m_timer, SIGNAL(timeout()), this, SLOT(postProcess())); // Cleanup palette changes all falls under post-processing stuff. And do not // involve the model. TPaletteHandle *ph = TApp::instance()->getPaletteController()->getCurrentCleanupPalette(); ret = ret && disconnect(ph, SIGNAL(colorStyleChanged(bool)), &m_timer, SLOT(start())); ret = ret && disconnect(ph, SIGNAL(paletteChanged()), &m_timer, SLOT(start())); assert(ret); clean(); TApp::instance()->getCurrentLevel()->notifyLevelChange(); } //-------------------------------------------------------------------------- void PreviewToggleCommand::onPreviewDataChanged() { CleanupSettingsModel *model = CleanupSettingsModel::instance(); // Retrieve level under cleanup TXshSimpleLevel *sl; TFrameId fid; model->getCleanupFrame(sl, fid); // In case the level changes, release all previously previewed images if (m_sl.getPointer() != sl) clean(); m_sl = sl; if (sl) { if (!(sl->getFrameStatus(fid) & TXshSimpleLevel::CleanupPreview)) { // The frame was not yet cleanup-previewed. Update its status then. m_fids.push_back(fid); sl->setFrameStatus( fid, sl->getFrameStatus(fid) | TXshSimpleLevel::CleanupPreview); } postProcess(); } } //-------------------------------------------------------------------------- void PreviewToggleCommand::onModelChanged(bool needsPostProcess) { if (needsPostProcess) m_timer.start(); } //-------------------------------------------------------------------------- void PreviewToggleCommand::postProcess() { TApp *app = TApp::instance(); CleanupSettingsModel *model = CleanupSettingsModel::instance(); TXshSimpleLevel *sl; TFrameId fid; model->getCleanupFrame(sl, fid); assert(sl); if (!sl) return; // Retrieve transformed image TRasterImageP transformed; { TRasterImageP original; TAffine transform; model->getPreviewData(original, transformed, transform); if (!transformed) return; } // Perform post-processing TRasterImageP preview( TCleanupper::instance()->processColors(transformed->getRaster())); TPointD dpi; transformed->getDpi(dpi.x, dpi.y); preview->setDpi(dpi.x, dpi.y); transformed = TRasterImageP(); // Substitute current frame image with previewed one sl->setFrame(fid, preview); TApp::instance()->getCurrentLevel()->notifyLevelChange(); } //-------------------------------------------------------------------------- void PreviewToggleCommand::clean() { // Release all previewed images if (m_sl) { int i, fidsCount = m_fids.size(); for (i = 0; i < fidsCount; ++i) { const TFrameId &fid = m_fids[i]; int status = m_sl->getFrameStatus(fid); if (status & TXshSimpleLevel::CleanupPreview) { // Preview images are not just invalidated, but *unbound* from the IM. // This is currently done hard here - should be skipped to m_sl, // though... ImageManager *im = ImageManager::instance(); im->unbind(m_sl->getImageId(fid, TXshSimpleLevel::CleanupPreview)); IconGenerator::instance()->remove(m_sl.getPointer(), fid); m_sl->setFrameStatus(fid, status & ~TXshSimpleLevel::CleanupPreview); } } } m_sl = TXshSimpleLevelP(); m_fids.clear(); } //********************************************************************************** // CameraTestToggleCommand implementation //********************************************************************************** CameraTestToggleCommand::CameraTestToggleCommand() : MenuItemHandler("MI_CameraTest"), m_oldTool(0) { m_timer.setSingleShot(true); m_timer.setInterval(500); } //-------------------------------------------------------------------------- void CameraTestToggleCommand::execute() { CameraTestCheck *tc = CameraTestCheck::instance(); if (tc->isEnabled()) enable(); else disable(); } //-------------------------------------------------------------------------- void CameraTestToggleCommand::enable() { /*---既に現在のツールがCameraTestになっている場合はreturn---*/ m_oldTool = TApp::instance()->getCurrentTool()->getTool(); if (m_oldTool->getName().compare("T_CameraTest") == 0) { CameraTestCheck::instance()->setIsEnabled(true); disable(); return; } // Cleanup Preview and Camera Test are exclusive. In case, disable the latter. // NOTE: This is done *before* attaching, since attach may invoke a preview // rebuild. CleanupPreviewCheck *pc = CleanupPreviewCheck::instance(); pc->setIsEnabled(false); // Attach to the model CleanupSettingsModel *model = CleanupSettingsModel::instance(); model->attach( CleanupSettingsModel::LISTENER | CleanupSettingsModel::CAMERATEST, false); // Connect signals bool ret = true; ret = ret && connect(model, SIGNAL(previewDataChanged()), this, SLOT(onPreviewDataChanged())); assert(ret); onPreviewDataChanged(); TApp::instance()->getCurrentTool()->setTool("T_CameraTest"); } //-------------------------------------------------------------------------- void CameraTestToggleCommand::disable() { CleanupSettingsModel *model = CleanupSettingsModel::instance(); model->detach(CleanupSettingsModel::LISTENER | CleanupSettingsModel::CAMERATEST); bool ret = true; ret = ret && disconnect(model, SIGNAL(previewDataChanged()), this, SLOT(onPreviewDataChanged())); assert(ret); clean(); TApp::instance()->getCurrentLevel()->notifyLevelChange(); TApp::instance()->getCurrentTool()->setTool( QString::fromStdString(m_oldTool->getName())); m_oldTool = 0; } //-------------------------------------------------------------------------- void CameraTestToggleCommand::onPreviewDataChanged() { CleanupSettingsModel *model = CleanupSettingsModel::instance(); // Retrieve level under cleanup TXshSimpleLevel *sl; TFrameId fid; model->getCleanupFrame(sl, fid); // In case the level changes, release all previously previewed images if (m_sl.getPointer() != sl) clean(); m_sl = sl; if (sl) { if (!(sl->getFrameStatus(fid) & TXshSimpleLevel::CleanupPreview)) { m_fids.push_back(fid); sl->setFrameStatus( fid, sl->getFrameStatus(fid) | TXshSimpleLevel::CleanupPreview); } postProcess(); } } //-------------------------------------------------------------------------- void CameraTestToggleCommand::postProcess() { TApp *app = TApp::instance(); CleanupSettingsModel *model = CleanupSettingsModel::instance(); TXshSimpleLevel *sl; TFrameId fid; model->getCleanupFrame(sl, fid); assert(sl); if (!sl) return; // Retrieve transformed image TRasterImageP transformed; { TRasterImageP original; model->getCameraTestData(original, transformed); } // Substitute current frame image with previewed one sl->setFrame(fid, transformed); TApp::instance()->getCurrentLevel()->notifyLevelChange(); } //-------------------------------------------------------------------------- void CameraTestToggleCommand::clean() { // Release all previewed images if (m_sl) { int i, fidsCount = m_fids.size(); for (i = 0; i < fidsCount; ++i) { const TFrameId &fid = m_fids[i]; int status = m_sl->getFrameStatus(fid); if (status & TXshSimpleLevel::CleanupPreview) { ImageManager *im = ImageManager::instance(); im->unbind(m_sl->getImageId(fid, TXshSimpleLevel::CleanupPreview)); IconGenerator::instance()->remove(m_sl.getPointer(), fid); m_sl->setFrameStatus(fid, status & ~TXshSimpleLevel::CleanupPreview); } } } m_sl = TXshSimpleLevelP(); m_fids.clear(); } //============================================================================= /*! CameraTestのドラッグ移動のUndo */ class UndoCameraTestMove final : public TUndo { TPointD m_before, m_after; CleanupParameters *m_cp; public: UndoCameraTestMove(const TPointD &before, const TPointD &after, CleanupParameters *cp) : m_before(before), m_after(after), m_cp(cp) {} void onChange() const { CleanupSettingsModel::instance()->commitChanges(); TApp::instance()->getCurrentTool()->getTool()->invalidate(); } void undo() const override { /*--- 既にCleanupSettingsを移動していたらreturn ---*/ CleanupParameters *cp = CleanupSettingsModel::instance()->getCurrentParameters(); if (cp != m_cp) return; m_cp->m_offx = m_before.x; m_cp->m_offy = m_before.y; onChange(); } void redo() const override { /*--- 既にCleanupSettingsを移動していたらreturn ---*/ CleanupParameters *cp = CleanupSettingsModel::instance()->getCurrentParameters(); if (cp != m_cp) return; m_cp->m_offx = m_after.x; m_cp->m_offy = m_after.y; onChange(); } int getSize() const override { return sizeof(*this); } QString getHistoryString() override { return QObject::tr("Move Cleanup Camera"); } int getHistoryType() override { return HistoryType::EditTool_Move; } }; //============================================================================= /*! CameraTestのサイズ変更のUndo */ class UndoCameraTestScale final : public TUndo { TDimension m_resBefore, m_resAfter; TDimensionD m_sizeBefore, m_sizeAfter; CleanupParameters *m_cp; public: UndoCameraTestScale(const TDimension &resBefore, const TDimensionD &sizeBefore, const TDimension &resAfter, const TDimensionD &sizeAfter, CleanupParameters *cp) : m_resBefore(resBefore) , m_sizeBefore(sizeBefore) , m_resAfter(resAfter) , m_sizeAfter(sizeAfter) , m_cp(cp) {} void onChange() const { CleanupSettingsModel::instance()->commitChanges(); TApp::instance()->getCurrentTool()->getTool()->invalidate(); } void undo() const override { /*--- 既にCleanupSettingsを移動していたらreturn ---*/ CleanupParameters *cp = CleanupSettingsModel::instance()->getCurrentParameters(); if (cp != m_cp) return; m_cp->m_camera.setSize(m_sizeBefore, false, false); m_cp->m_camera.setRes(m_resBefore); onChange(); } void redo() const override { /*--- 既にCleanupSettingsを移動していたらreturn ---*/ CleanupParameters *cp = CleanupSettingsModel::instance()->getCurrentParameters(); if (cp != m_cp) return; m_cp->m_camera.setSize(m_sizeAfter, false, false); m_cp->m_camera.setRes(m_resAfter); onChange(); } int getSize() const override { return sizeof(*this); } QString getHistoryString() override { return QObject::tr("Scale Cleanup Camera"); } int getHistoryType() override { return HistoryType::EditTool_Move; } }; //********************************************************************************** // CameraTestTool definition //********************************************************************************** class CameraTestTool final : public TTool { TPointD m_lastPos; bool m_dragged; int m_scaling; enum { eNoScale, e00, e01, e10, e11, eM0, e1M, eM1, e0M }; /*--- +ShiftドラッグでX、Y軸平行移動機能のため ---*/ TPointD m_firstPos; TPointD m_firstCameraOffset; // for scaling undo TDimension m_firstRes; TDimensionD m_firstSize; public: CameraTestTool(); void draw() override; void mouseMove(const TPointD &p, const TMouseEvent &e) override; void leftButtonDown(const TPointD &pos, const TMouseEvent &e) override; void leftButtonDrag(const TPointD &pos, const TMouseEvent &e) override; void leftButtonUp(const TPointD &pos, const TMouseEvent &) override; ToolType getToolType() const override { return TTool::GenericTool; } int getCursorId() const override; private: void drawCleanupCamera(double pixelSize); void drawClosestFieldCamera(double pixelSize); } cameraTestTool; //========================================================================== CameraTestTool::CameraTestTool() : TTool("T_CameraTest") , m_lastPos(-1, -1) , m_dragged(false) , m_scaling(eNoScale) , m_firstRes(0, 0) , m_firstSize(0, 0) { bind(TTool::AllTargets); // Deals with tool deactivation internally } //-------------------------------------------------------------------------- void CameraTestTool::drawCleanupCamera(double pixelSize) { CleanupParameters *cp = CleanupSettingsModel::instance()->getCurrentParameters(); TRectD rect = cp->m_camera.getStageRect(); glColor3d(1.0, 0.0, 0.0); glLineStipple(1, 0xFFFF); glEnable(GL_LINE_STIPPLE); // box glBegin(GL_LINE_STRIP); glVertex2d(rect.x0, rect.y0); glVertex2d(rect.x0, rect.y1 - pixelSize); glVertex2d(rect.x1 - pixelSize, rect.y1 - pixelSize); glVertex2d(rect.x1 - pixelSize, rect.y0); glVertex2d(rect.x0, rect.y0); glEnd(); // central cross double dx = 0.05 * rect.getP00().x; double dy = 0.05 * rect.getP00().y; tglDrawSegment(TPointD(-dx, -dy), TPointD(dx, dy)); tglDrawSegment(TPointD(-dx, dy), TPointD(dx, -dy)); glDisable(GL_LINE_STIPPLE); // camera name TPointD pos = rect.getP01() + TPointD(0, 4); glPushMatrix(); glTranslated(pos.x, pos.y, 0); glScaled(2, 2, 2); tglDrawText(TPointD(), "Cleanup Camera"); glPopMatrix(); } //-------------------------------------------------------------------------- void CameraTestTool::drawClosestFieldCamera(double pixelSize) { CleanupParameters *cp = CleanupSettingsModel::instance()->getCurrentParameters(); double zoom = cp->m_closestField / cp->m_camera.getSize().lx; if (areAlmostEqual(zoom, 1.0, 1e-2)) return; TRectD rect(cp->m_camera.getStageRect()); rect = rect.enlarge((zoom - 1) * (rect.x1 - rect.x0 + 1) / 2.0, (zoom - 1) * (rect.y1 - rect.y0 + 1) / 2.0); glColor3d(0.0, 0.0, 1.0); glLineStipple(1, 0xFFFF); glEnable(GL_LINE_STIPPLE); // box glBegin(GL_LINE_STRIP); glVertex2d(rect.x0, rect.y0); glVertex2d(rect.x0, rect.y1 - pixelSize); glVertex2d(rect.x1 - pixelSize, rect.y1 - pixelSize); glVertex2d(rect.x1 - pixelSize, rect.y0); glVertex2d(rect.x0, rect.y0); glEnd(); glDisable(GL_LINE_STIPPLE); // camera name TPointD pos = rect.getP01() + TPointD(0, 4); glPushMatrix(); glTranslated(pos.x, pos.y, 0); glScaled(2, 2, 2); tglDrawText(TPointD(), "Closest Field"); glPopMatrix(); } //-------------------------------------------------------------------------- void CameraTestTool::draw() { double pixelSize = getPixelSize(); glPushMatrix(); CleanupParameters *cp = CleanupSettingsModel::instance()->getCurrentParameters(); glTranslated(-0.5 * cp->m_offx * Stage::inch, -0.5 * cp->m_offy * Stage::inch, 0); drawCleanupCamera(pixelSize); // drawClosestFieldCamera(pixelSize); TRectD r(cp->m_camera.getStageRect()); TPointD size(10, 10); double pixelSize4 = 4.0 * pixelSize; tglColor(TPixel::Red); ToolUtils::drawSquare(r.getP00(), pixelSize4, TPixel::Red); ToolUtils::drawSquare(r.getP01(), pixelSize4, TPixel::Red); ToolUtils::drawSquare(r.getP10(), pixelSize4, TPixel::Red); ToolUtils::drawSquare(r.getP11(), pixelSize4, TPixel::Red); TPointD center(0.5 * (r.getP00() + r.getP11())); ToolUtils::drawSquare(TPointD(center.x, r.y0), pixelSize4, TPixel::Red); // draw M0 handle ToolUtils::drawSquare(TPointD(r.x1, center.y), pixelSize4, TPixel::Red); // draw 1M handle ToolUtils::drawSquare(TPointD(center.x, r.y1), pixelSize4, TPixel::Red); // draw M1 handle ToolUtils::drawSquare(TPointD(r.x0, center.y), pixelSize4, TPixel::Red); // draw 0M handle glPopMatrix(); } void CameraTestTool::mouseMove(const TPointD &p, const TMouseEvent &e) { if (m_lastPos.x != -1) // left mouse button is clicked { m_scaling = eNoScale; return; } CleanupParameters *cp = CleanupSettingsModel::instance()->getCurrentParameters(); double pixelSize = getPixelSize(); TPointD size(10 * pixelSize, 10 * pixelSize); TRectD r(cp->m_camera.getStageRect()); TPointD aux(Stage::inch * TPointD(0.5 * cp->m_offx, 0.5 * cp->m_offy)); r -= aux; double maxDist = 5 * pixelSize; if (TRectD(r.getP00() - size, r.getP00() + size).contains(p)) m_scaling = e00; else if (TRectD(r.getP01() - size, r.getP01() + size).contains(p)) m_scaling = e01; else if (TRectD(r.getP11() - size, r.getP11() + size).contains(p)) m_scaling = e11; else if (TRectD(r.getP10() - size, r.getP10() + size).contains(p)) m_scaling = e10; else if (isCloseToSegment(p, TSegment(r.getP00(), r.getP10()), maxDist)) m_scaling = eM0; else if (isCloseToSegment(p, TSegment(r.getP10(), r.getP11()), maxDist)) m_scaling = e1M; else if (isCloseToSegment(p, TSegment(r.getP11(), r.getP01()), maxDist)) m_scaling = eM1; else if (isCloseToSegment(p, TSegment(r.getP01(), r.getP00()), maxDist)) m_scaling = e0M; else m_scaling = eNoScale; } //-------------------------------------------------------------------------- void CameraTestTool::leftButtonDown(const TPointD &pos, const TMouseEvent &e) { m_firstPos = m_lastPos = pos; /*-- カメラオフセットの初期値の取得 --*/ CleanupParameters *cp = CleanupSettingsModel::instance()->getCurrentParameters(); if (m_scaling == eNoScale) m_firstCameraOffset = TPointD(cp->m_offx, cp->m_offy); /*-- サイズ変更のUndoのために値を格納 --*/ else { m_firstRes = cp->m_camera.getRes(); m_firstSize = cp->m_camera.getSize(); } // Limit commits to the sole interface updates. This is necessary since drags // would otherwise trigger full preview re-processings. CleanupSettingsModel::instance()->setCommitMask( CleanupSettingsModel::INTERFACE); } //-------------------------------------------------------------------------- void CameraTestTool::leftButtonDrag(const TPointD &pos, const TMouseEvent &e) { m_dragged = true; CleanupParameters *cp = CleanupSettingsModel::instance()->getCurrentParameters(); TPointD dp(pos - m_lastPos); if (m_scaling != eNoScale) { TDimensionD dim(cp->m_camera.getSize()); TPointD delta; // Mid-edge cases if (m_scaling == e1M) delta = TPointD(dp.x / Stage::inch, 0); else if (m_scaling == e0M) delta = TPointD(-dp.x / Stage::inch, 0); else if (m_scaling == eM1) delta = TPointD(0, dp.y / Stage::inch); else if (m_scaling == eM0) delta = TPointD(0, -dp.y / Stage::inch); else { // Corner cases if (e.isShiftPressed()) { // Free adjust if (m_scaling == e11) delta = TPointD(dp.x / Stage::inch, dp.y / Stage::inch); else if (m_scaling == e00) delta = TPointD(-dp.x / Stage::inch, -dp.y / Stage::inch); else if (m_scaling == e10) delta = TPointD(dp.x / Stage::inch, -dp.y / Stage::inch); else if (m_scaling == e01) delta = TPointD(-dp.x / Stage::inch, dp.y / Stage::inch); } else { // A/R conservative bool xMaximalDp = (fabs(dp.x) > fabs(dp.y)); if (m_scaling == e11) delta.x = (xMaximalDp ? dp.x : dp.y) / Stage::inch; else if (m_scaling == e00) delta.x = (xMaximalDp ? -dp.x : -dp.y) / Stage::inch; else if (m_scaling == e10) delta.x = (xMaximalDp ? dp.x : -dp.y) / Stage::inch; else if (m_scaling == e01) delta.x = (xMaximalDp ? -dp.x : dp.y) / Stage::inch; // Keep A/R delta.y = delta.x * dim.ly / dim.lx; } } TDimensionD newDim(dim.lx + 2.0 * delta.x, dim.ly + 2.0 * delta.y); if (newDim.lx < 2.0 || newDim.ly < 2.0) return; cp->m_camera.setSize(newDim, true, // Preserve DPI false); // A/R imposed above in corner cases } else { if (e.isShiftPressed()) { TPointD delta = pos - m_firstPos; cp->m_offx = m_firstCameraOffset.x; cp->m_offy = m_firstCameraOffset.y; if (fabs(delta.x) > fabs(delta.y)) { if (!cp->m_offx_lock) cp->m_offx += -delta.x * (2.0 / Stage::inch); } else { if (!cp->m_offy_lock) cp->m_offy += -delta.y * (2.0 / Stage::inch); } } else { if (!cp->m_offx_lock) cp->m_offx += -dp.x * (2.0 / Stage::inch); if (!cp->m_offy_lock) cp->m_offy += -dp.y * (2.0 / Stage::inch); } } m_lastPos = pos; CleanupSettingsModel::instance()->commitChanges(); invalidate(); } //-------------------------------------------------------------------------- void CameraTestTool::leftButtonUp(const TPointD &pos, const TMouseEvent &) { // Reset full commit status - invokes preview rebuild on its own. CleanupSettingsModel::instance()->setCommitMask( CleanupSettingsModel::FULLPROCESS); CleanupParameters *cp = CleanupSettingsModel::instance()->getCurrentParameters(); /*-- カメラ位置移動のUndo --*/ if (m_scaling == eNoScale) { /*-- 値が変わったらUndoを登録 --*/ if (m_firstCameraOffset.x != cp->m_offx || m_firstCameraOffset.y != cp->m_offy) { UndoCameraTestMove *undo = new UndoCameraTestMove( m_firstCameraOffset, TPointD(cp->m_offx, cp->m_offy), cp); TUndoManager::manager()->add(undo); } } /*-- サイズ変更のUndo --*/ else { if (m_firstSize.lx != cp->m_camera.getSize().lx || m_firstSize.ly != cp->m_camera.getSize().ly) { UndoCameraTestScale *undo = new UndoCameraTestScale( m_firstRes, m_firstSize, cp->m_camera.getRes(), cp->m_camera.getSize(), cp); TUndoManager::manager()->add(undo); } } m_firstPos = TPointD(-1, -1); m_firstCameraOffset = TPointD(0, 0); m_firstRes = TDimension(0, 0); m_firstSize = TDimensionD(0, 0); m_lastPos = TPointD(-1, -1); m_dragged = false; } //-------------------------------------------------------------------------- int CameraTestTool::getCursorId() const { switch (m_scaling) { case eNoScale: { CleanupParameters *cp = CleanupSettingsModel::instance()->getCurrentParameters(); if (cp->m_offx_lock && cp->m_offy_lock) return ToolCursor::DisableCursor; else if (cp->m_offx_lock) return ToolCursor::MoveNSCursor; else if (cp->m_offy_lock) return ToolCursor::MoveEWCursor; else return ToolCursor::MoveCursor; } case e11: case e00: return ToolCursor::ScaleCursor; case e10: case e01: return ToolCursor::ScaleInvCursor; case e1M: case e0M: return ToolCursor::ScaleHCursor; case eM1: case eM0: return ToolCursor::ScaleVCursor; default: assert(false); return 0; } } //============================================================================== // // OpacityCheckToggleCommand // //============================================================================== class OpacityCheckToggleCommand final : public MenuItemHandler { public: OpacityCheckToggleCommand() : MenuItemHandler("MI_OpacityCheck") {} void execute() override { CleanupSettingsModel *model = CleanupSettingsModel::instance(); CleanupParameters *params = model->getCurrentParameters(); params->m_transparencyCheckEnabled = !params->m_transparencyCheckEnabled; /*-- OpacityCheckのON/OFFでは、Dirtyフラグは変化させない --*/ bool dirty = params->getDirtyFlag(); model->commitChanges(); params->setDirtyFlag(dirty); } } OpacityCheckToggle;
30.748591
84
0.598189
[ "model", "transform" ]
416603c8dfa11b8dc219c8d964994b21c83d4f7e
3,610
hh
C++
TrackerGeom/inc/TrackerG4Info.hh
NamithaChitrazee/Offline-1
bcb6c74954f95dd48433d79a69d3ef3bdb99022e
[ "Apache-2.0" ]
null
null
null
TrackerGeom/inc/TrackerG4Info.hh
NamithaChitrazee/Offline-1
bcb6c74954f95dd48433d79a69d3ef3bdb99022e
[ "Apache-2.0" ]
null
null
null
TrackerGeom/inc/TrackerG4Info.hh
NamithaChitrazee/Offline-1
bcb6c74954f95dd48433d79a69d3ef3bdb99022e
[ "Apache-2.0" ]
null
null
null
#ifndef TrackerGeom_TrackerG4Info_hh #define TrackerGeom_TrackerG4Info_hh /// // Tracker geometry content specific to building the G4 model // Extracted from the original Tracker // #include "Offline/GeomPrimitives/inc/TubsParams.hh" #include "Offline/GeomPrimitives/inc/PlacedTubs.hh" #include "Offline/TrackerGeom/inc/PanelEB.hh" #include "Offline/TrackerGeom/inc/Manifold.hh" #include "Offline/TrackerGeom/inc/Support.hh" #include "Offline/TrackerGeom/inc/SupportModel.hh" #include "Offline/TrackerGeom/inc/SupportStructure.hh" namespace mu2e { class TrackerG4Info { friend class TrackerMaker; public: // electronics board const PanelEB& panelElectronicsBoard() const { return _panelEB;} const SupportModel& getSupportModel() const{ return _supportModel; } const Support& getSupportParams () const{ return _supportParams; } const SupportStructure& getSupportStructure() const{ return _supportStructure; } const TubsParams& getPlaneEnvelopeParams() const{ return _planeEnvelopeParams; } const TubsParams& getPanelEnvelopeParams() const{ return _panelEnvelopeParams; } const TubsParams& getInnerTrackerEnvelopeParams() const{ return _innerTrackerEnvelopeParams; } const PlacedTubs& mother() const{ return _mother; } std::string const& wallMaterialName() const{ return _wallMaterialName; } std::string const& wallCoreMaterialName() const{ return wallMaterialName(); } std::string const& wallOuterMetalMaterialName() const{ return _outerMetalMaterial; } std::string const& wallInnerMetal1MaterialName() const{ return _innerMetal1Material; } std::string const& wallInnerMetal2MaterialName() const{ return _innerMetal2Material; } std::string const& gasMaterialName() const{ return _gasMaterialName; } std::string const& wireMaterialName() const{ return _wireMaterialName; } std::string const& wireCoreMaterialName() const{ return wireMaterialName(); } std::string const& wirePlateMaterialName() const{ return _wirePlateMaterial; } std::string const& envelopeMaterial() const { return _envelopeMaterial; } double panelOffset() const { return _panelZOffset; } double z0() const { return _z0;} // in Mu2e coordinates private: std::string _wallMaterialName; std::string _outerMetalMaterial; std::string _innerMetal1Material; std::string _innerMetal2Material; std::string _gasMaterialName; std::string _wireMaterialName; std::string _wirePlateMaterial; std::string _envelopeMaterial; // Outer envelope that holds the new style support structure. PlacedTubs _mother; // The envelope that holds all of the planes in the tracker, // including the plane supports. TubsParams _innerTrackerEnvelopeParams; // The envelope that holds all of the pieces in one plane, including supports. TubsParams _planeEnvelopeParams; // Ditto for Panel TubsParams _panelEnvelopeParams; // Which level of detail is present in the model of the support structure? SupportModel _supportModel; // All supports are the same shape; only relevant for _supportModel=="simple" Support _supportParams; // A more detailed model of the supports; again each plane has identical supports. // only relevant for _supportModel == "detailedv0". SupportStructure _supportStructure; // Electronics board PanelEB _panelEB; double _panelZOffset; // introduced for version 5 // Position of the center of the tracker, in the Mu2e coordinate system. double _z0; }; } #endif
45.696203
98
0.742105
[ "geometry", "shape", "model" ]
4166129e358ece891e19fa0f3ddce0d5b7faea91
18,393
cc
C++
tests/unit/test_graph_mapper_tools.cc
isovic/raptor
171e0f1b94366f20250a00389400a2fcd267bcc6
[ "BSD-3-Clause-Clear" ]
60
2019-07-09T14:57:48.000Z
2022-03-29T06:53:39.000Z
tests/unit/test_graph_mapper_tools.cc
isovic/raptor
171e0f1b94366f20250a00389400a2fcd267bcc6
[ "BSD-3-Clause-Clear" ]
2
2019-05-28T01:59:50.000Z
2021-05-18T13:15:10.000Z
tests/unit/test_graph_mapper_tools.cc
isovic/raptor
171e0f1b94366f20250a00389400a2fcd267bcc6
[ "BSD-3-Clause-Clear" ]
4
2019-05-25T15:41:56.000Z
2019-07-10T11:44:22.000Z
#include <gtest/gtest.h> #include <tests/unit/test_graph_mapper.h> #include <raptor/graph_mapper.h> #include <graph/segment_graph_parser.h> #include <cstdint> #include <algorithm> #include <set> #include <vector> #include <log/log_tools.h> #include <containers/mapping_result/linear_mapping_result.h> #include <utility/range_tools.hpp> #include <raptor/mapper_tools.h> #include <containers/mapping_env.h> #include <graph/split_segment_graph.h> #include <raptor/graph_mapper_tools.h> namespace raptor { namespace unit { bool VERBOSE_DEBUG_QID_GM_TOOLS = false; std::vector<raptor::ChainPtr> WrapGroupTargetSeedHits( std::vector<std::pair<int32_t, mindex::SeedHitPacked>> seed_hits, // Copy. int32_t k, int32_t qid, int32_t qlen) { std::vector<raptor::ChainPtr> all_target_hits; // There is an "operator<" defined in the SeedHitPacked. std::sort(seed_hits.begin(), seed_hits.end()); std::vector<std::pair<size_t, size_t>> ranges = istl::FindRanges<std::pair<int32_t, mindex::SeedHitPacked>>(seed_hits, [](const std::pair<int32_t, mindex::SeedHitPacked>& a, const std::pair<int32_t, mindex::SeedHitPacked>& b) { return std::get<0>(a) == std::get<0>(b); }); for (const auto& range_pair: ranges) { size_t range_start = std::get<0>(range_pair); size_t range_end = std::get<1>(range_pair); if (range_end <= range_start) { continue; } const auto& seed_hit_first = std::get<1>(seed_hits[range_start]); int32_t t_id = seed_hit_first.TargetId(); bool t_rev = seed_hit_first.TargetRev(); int32_t t_len = 0; std::shared_ptr<raptor::MappingEnv> new_env = raptor::createMappingEnv( t_id, 0, t_len, t_rev, qid, qlen, false); auto single_target_hits = raptor::ChainPtr( new raptor::TargetHits<mindex::SeedHitPacked>(new_env)); for (size_t seed_id = range_start; seed_id < range_end; ++seed_id) { const auto& seed_hit = std::get<1>(seed_hits[seed_id]); // Sanity check that the test is well defined. The the t_id should be the same // for every member of the group. EXPECT_EQ(seed_hit.TargetId(), t_id); single_target_hits->hits().emplace_back(seed_hit); } single_target_hits->score(0); int32_t cov_bases_q = 0; int32_t cov_bases_t = 0; raptor::mapper::CalcHitCoverage(single_target_hits->hits(), k, 0, single_target_hits->hits().size(), cov_bases_q, cov_bases_t); single_target_hits->cov_bases_q(cov_bases_q); single_target_hits->cov_bases_t(cov_bases_t); all_target_hits.emplace_back(single_target_hits); } return all_target_hits; } /* * Aside from the graphs (SegmentGraph and SplitSegmentGraph), the * LinearMappingResult is the only input to GraphMapper. * It consists of a vector of anchors, and a vector of seed target hits, plus * the environment specification. * The only reason that the seed_hits are required for GraphMapper is so that * the anchors can be broken on graph in/out edges. * The reason why the GraphMapper accepts the SplitSegmentGraph instead of constructing * it is the speed, since the same SSG is used by all threads for all reads. * The reason why SegmentGraph is required is legacy code. Perhaps it can be * refactored in the future to drop it and simplify the interface. */ std::shared_ptr<raptor::LinearMappingResult> UtilCreateLinearMappingResult( mindex::IndexPtr index, int32_t k, const std::string& qname, int32_t qlen, int32_t qid, const std::vector<std::pair<int32_t, mindex::SeedHitPacked>>& seed_hits) { // Create an empty container. std::shared_ptr<raptor::LinearMappingResult> result = raptor::createMappingResult(qid, qlen, qname, index); // Take the plain flat list of seeds and group them by target. std::vector<raptor::ChainPtr> hits = raptor::unit::WrapGroupTargetSeedHits(seed_hits, k, qid, qlen); // Anchors will be formed automatically from hits. std::vector<std::shared_ptr<raptor::TargetAnchorType>> anchors = raptor::mapper::MakeAnchors(hits); // Set the linear mapping result. result->target_anchors(anchors); result->target_hits(hits); result->return_value(raptor::MapperReturnValueBase::OK); return result; } TEST(GraphMapperTools, BreakAnchors1) { /* * Empty input. */ std::string test_name("BreakAnchors1"); /// LogSystem::GetInstance().SetProgramVerboseLevelFromInt(9); // Define the test inputs. std::vector<std::vector<std::string>> nodes_str = { }; std::vector<std::vector<std::string>> edges_gfa2 = { }; raptor::SegmentGraphPtr seg_graph = WrapConstructSegmentGraph(test_name, nodes_str, edges_gfa2, VERBOSE_DEBUG_QID_GM_TOOLS); // raptor::SplitSegmentGraphPtr ssg = raptor::createSplitSegmentGraph(seg_graph); // Ther first element in pair is the target group, and the second is the MinimizerHit. std::vector<std::pair<int32_t, mindex::SeedHitPacked>> seed_hits { }; mindex::IndexPtr index = nullptr; int32_t k = 15; std::string qname("query1"); int32_t qlen = 1000; int32_t qid = 0; std::shared_ptr<raptor::LinearMappingResult> linear_mapping = UtilCreateLinearMappingResult( index, k, qname, qlen, qid, seed_hits); std::shared_ptr<raptor::LinearMappingResult> result_linear_mapping = raptor::graphmapper::BreakAnchors( seg_graph, linear_mapping, k); std::string result_str = result_linear_mapping->WriteAsCSV(','); std::string expected_str = ""; /// LogSystem::GetInstance().SetProgramVerboseLevelFromInt(0); ASSERT_EQ(result_str, expected_str); } TEST(GraphMapperTools, BreakAnchors2) { /* * Test with an empty graph and linear mapping. No anchors should be broken * and everything should be as is. */ std::string test_name("BreakAnchors2"); /// LogSystem::GetInstance().SetProgramVerboseLevelFromInt(9); // Define the test inputs. std::vector<std::vector<std::string>> nodes_str = { }; std::vector<std::vector<std::string>> edges_gfa2 = { }; raptor::SegmentGraphPtr seg_graph = WrapConstructSegmentGraph(test_name, nodes_str, edges_gfa2, VERBOSE_DEBUG_QID_GM_TOOLS); // raptor::SplitSegmentGraphPtr ssg = raptor::createSplitSegmentGraph(seg_graph); // Ther first element in pair is the target group, and the second is the MinimizerHit. std::vector<std::pair<int32_t, mindex::SeedHitPacked>> seed_hits { {0, {0,0,2,0,2}}, {0, {0,0,12,0,12}}, {0, {0,0,25,0,25}}, {0, {0,0,40,0,40}}, {0, {0,0,55,0,55}}, {0, {0,0,67,0,67}}, {0, {0,0,80,0,80}}, {0, {0,0,95,0,95}}, {0, {0,0,109,0,109}}, {0, {0,0,125,0,125}}, {0, {0,0,135,0,135}}, {0, {0,0,150,0,150}}, {0, {0,0,163,0,163}}, {0, {0,0,178,0,178}}, {0, {0,0,192,0,192}}, {0, {0,0,212,0,212}}, {0, {0,0,220,0,220}}, {0, {0,0,235,0,235}}, {0, {0,0,247,0,247}}, {0, {0,0,262,0,262}}, {0, {0,0,274,0,274}}, {0, {0,0,292,0,292}}, {0, {0,0,302,0,302}}, {0, {0,0,317,0,317}}, {0, {0,0,329,0,329}}, {0, {0,0,343,0,343}}, {0, {0,0,355,0,355}}, {0, {0,0,367,0,367}}, {0, {0,0,382,0,382}}, {0, {0,0,397,0,397}}, {0, {0,0,411,0,411}}, {0, {0,0,425,0,425}}, {0, {0,0,439,0,439}}, {0, {0,0,450,0,450}}, {0, {0,0,467,0,472}}, {0, {0,0,480,0,485}}, {0, {0,0,495,0,500}}, {0, {0,0,509,0,514}}, {0, {0,0,524,0,529}}, {0, {0,0,536,0,541}}, {0, {0,0,551,0,556}}, {0, {0,0,566,0,571}}, {0, {0,0,580,0,585}}, {0, {0,0,605,0,600}}, {0, {0,0,609,0,604}}, {0, {0,0,623,0,618}}, {0, {0,0,638,0,633}}, {0, {0,0,652,0,647}}, {0, {0,0,664,0,659}}, {0, {0,0,679,0,674}}, }; mindex::IndexPtr index = nullptr; int32_t k = 15; std::string qname("query1"); int32_t qlen = 1000; int32_t qid = 0; std::shared_ptr<raptor::LinearMappingResult> linear_mapping = UtilCreateLinearMappingResult( index, k, qname, qlen, qid, seed_hits); std::shared_ptr<raptor::LinearMappingResult> result_linear_mapping = raptor::graphmapper::BreakAnchors( seg_graph, linear_mapping, k); std::string result_str = result_linear_mapping->WriteAsCSV(','); std::string expected_str = // H (for hit), group_id, tid, trev, tpos, qmask, qpos "H,0,0,0,2,0,2\n" "H,0,0,0,12,0,12\n" "H,0,0,0,25,0,25\n" "H,0,0,0,40,0,40\n" "H,0,0,0,55,0,55\n" "H,0,0,0,67,0,67\n" "H,0,0,0,80,0,80\n" "H,0,0,0,95,0,95\n" "H,0,0,0,109,0,109\n" "H,0,0,0,125,0,125\n" "H,0,0,0,135,0,135\n" "H,0,0,0,150,0,150\n" "H,0,0,0,163,0,163\n" "H,0,0,0,178,0,178\n" "H,0,0,0,192,0,192\n" "H,0,0,0,212,0,212\n" "H,0,0,0,220,0,220\n" "H,0,0,0,235,0,235\n" "H,0,0,0,247,0,247\n" "H,0,0,0,262,0,262\n" "H,0,0,0,274,0,274\n" "H,0,0,0,292,0,292\n" "H,0,0,0,302,0,302\n" "H,0,0,0,317,0,317\n" "H,0,0,0,329,0,329\n" "H,0,0,0,343,0,343\n" "H,0,0,0,355,0,355\n" "H,0,0,0,367,0,367\n" "H,0,0,0,382,0,382\n" "H,0,0,0,397,0,397\n" "H,0,0,0,411,0,411\n" "H,0,0,0,425,0,425\n" "H,0,0,0,439,0,439\n" "H,0,0,0,450,0,450\n" "H,0,0,0,467,0,472\n" "H,0,0,0,480,0,485\n" "H,0,0,0,495,0,500\n" "H,0,0,0,509,0,514\n" "H,0,0,0,524,0,529\n" "H,0,0,0,536,0,541\n" "H,0,0,0,551,0,556\n" "H,0,0,0,566,0,571\n" "H,0,0,0,580,0,585\n" "H,0,0,0,605,0,600\n" "H,0,0,0,609,0,604\n" "H,0,0,0,623,0,618\n" "H,0,0,0,638,0,633\n" "H,0,0,0,652,0,647\n" "H,0,0,0,664,0,659\n" "H,0,0,0,679,0,674\n" // A (for anchor), group_id, qid, tid, score, num_seeds, qrev, qstart, qend, qlen, trev, tstart, tend, tlen, cov_bases_q, cov_bases_t, num_seeds "A,0,0,0,671,50,0,2,675,1000,0,2,680,0,671,671,50\n" ; /// LogSystem::GetInstance().SetProgramVerboseLevelFromInt(0); ASSERT_EQ(result_str, expected_str); } TEST(GraphMapperTools, BreakAnchors3) { /* * Test on a more complicated graph with indels, SNPs and multiple * edges stemming out of the same nodes. */ std::string test_name("BreakAnchors3"); /// LogSystem::GetInstance().SetProgramVerboseLevelFromInt(9); // Define the test inputs. std::vector<std::vector<std::string>> nodes_str = { {"ref1", "695", "0"}, {"snp1", "1", "1"}, {"snp2", "1", "2"}, {"snp3", "1", "3"}, {"sv1", "5", "4"}, {"sv2", "10", "5"}, }; std::vector<std::vector<std::string>> edges_gfa2 = { {"E", "E1-in", "ref1+", "snp1+", "124", "124", "0", "0", "*"}, {"E", "E1-out", "snp1+", "ref1+", "1$", "1$", "125", "125", "*"}, {"E", "E2-in", "ref1+", "snp2+", "211", "211", "0", "0", "*"}, {"E", "E2-out", "snp2+", "ref1+", "1$", "1$", "212", "212", "*"}, {"E", "E3-in", "ref1+", "snp3+", "291", "291", "0", "0", "*"}, {"E", "E3-out", "snp3+", "ref1+", "1$", "1$", "292", "292", "*"}, {"E", "E4-sv1-in", "ref1+", "sv1+", "464", "464", "0", "0", "*"}, {"E", "E4-sv1-out", "sv1+", "ref1+", "5$", "5$", "464", "464", "*"}, {"E", "E5-sv2", "ref1+", "ref1+", "596", "596", "605", "605", "*"}, {"E", "E6", "ref1+", "ref1+", "464", "464", "596", "596", "*"}, // An edge to induce multiple forking at coords 464 and 596. }; raptor::SegmentGraphPtr seg_graph = WrapConstructSegmentGraph(test_name, nodes_str, edges_gfa2, VERBOSE_DEBUG_QID_GM_TOOLS); // raptor::SplitSegmentGraphPtr ssg = raptor::createSplitSegmentGraph(seg_graph); // std::cerr << "Testing JSON output, seg_graph:\n" << seg_graph->ToJSON() << "\n"; // std::cerr << "Testing JSON output, ssg:\n" << ssg->ToJSON() << "\n"; // Ther first element in pair is the target group, and the second is the MinimizerHit. std::vector<std::pair<int32_t, mindex::SeedHitPacked>> seed_hits { {0, {0,0,2,0,2}}, {0, {0,0,12,0,12}}, {0, {0,0,25,0,25}}, {0, {0,0,40,0,40}}, {0, {0,0,55,0,55}}, {0, {0,0,67,0,67}}, {0, {0,0,80,0,80}}, {0, {0,0,95,0,95}}, {0, {0,0,109,0,109}}, {0, {0,0,125,0,125}}, {0, {0,0,135,0,135}}, {0, {0,0,150,0,150}}, {0, {0,0,163,0,163}}, {0, {0,0,178,0,178}}, {0, {0,0,192,0,192}}, {0, {0,0,212,0,212}}, {0, {0,0,220,0,220}}, {0, {0,0,235,0,235}}, {0, {0,0,247,0,247}}, {0, {0,0,262,0,262}}, {0, {0,0,274,0,274}}, {0, {0,0,292,0,292}}, {0, {0,0,302,0,302}}, {0, {0,0,317,0,317}}, {0, {0,0,329,0,329}}, {0, {0,0,343,0,343}}, {0, {0,0,355,0,355}}, {0, {0,0,367,0,367}}, {0, {0,0,382,0,382}}, {0, {0,0,397,0,397}}, {0, {0,0,411,0,411}}, {0, {0,0,425,0,425}}, {0, {0,0,439,0,439}}, {0, {0,0,450,0,450}}, {0, {0,0,467,0,472}}, {0, {0,0,480,0,485}}, {0, {0,0,495,0,500}}, {0, {0,0,509,0,514}}, {0, {0,0,524,0,529}}, {0, {0,0,536,0,541}}, {0, {0,0,551,0,556}}, {0, {0,0,566,0,571}}, {0, {0,0,580,0,585}}, {0, {0,0,605,0,600}}, {0, {0,0,609,0,604}}, {0, {0,0,623,0,618}}, {0, {0,0,638,0,633}}, {0, {0,0,652,0,647}}, {0, {0,0,664,0,659}}, {0, {0,0,679,0,674}}, }; mindex::IndexPtr index = nullptr; int32_t k = 15; std::string qname("query1"); int32_t qlen = 1000; int32_t qid = 0; std::shared_ptr<raptor::LinearMappingResult> linear_mapping = UtilCreateLinearMappingResult( index, k, qname, qlen, qid, seed_hits); std::shared_ptr<raptor::LinearMappingResult> result_linear_mapping = raptor::graphmapper::BreakAnchors( seg_graph, linear_mapping, k); // std::cerr << result_linear_mapping->WriteAsCSV(',') << "\n"; std::string result_str = result_linear_mapping->WriteAsCSV(','); std::string expected_str = // H (for hit), group_id, tid, trev, tpos, qmask, qpos "H,0,0,0,2,0,2\n" "H,0,0,0,12,0,12\n" "H,0,0,0,25,0,25\n" "H,0,0,0,40,0,40\n" "H,0,0,0,55,0,55\n" "H,0,0,0,67,0,67\n" "H,0,0,0,80,0,80\n" "H,0,0,0,95,0,95\n" "H,0,0,0,109,0,109\n" "H,1,0,0,125,0,125\n" "H,1,0,0,135,0,135\n" "H,1,0,0,150,0,150\n" "H,1,0,0,163,0,163\n" "H,1,0,0,178,0,178\n" "H,1,0,0,192,0,192\n" "H,2,0,0,212,0,212\n" "H,2,0,0,220,0,220\n" "H,2,0,0,235,0,235\n" "H,2,0,0,247,0,247\n" "H,2,0,0,262,0,262\n" "H,2,0,0,274,0,274\n" "H,3,0,0,292,0,292\n" "H,3,0,0,302,0,302\n" "H,3,0,0,317,0,317\n" "H,3,0,0,329,0,329\n" "H,3,0,0,343,0,343\n" "H,3,0,0,355,0,355\n" "H,3,0,0,367,0,367\n" "H,3,0,0,382,0,382\n" "H,3,0,0,397,0,397\n" "H,3,0,0,411,0,411\n" "H,3,0,0,425,0,425\n" "H,3,0,0,439,0,439\n" "H,3,0,0,450,0,450\n" "H,4,0,0,467,0,472\n" "H,4,0,0,480,0,485\n" "H,4,0,0,495,0,500\n" "H,4,0,0,509,0,514\n" "H,4,0,0,524,0,529\n" "H,4,0,0,536,0,541\n" "H,4,0,0,551,0,556\n" "H,4,0,0,566,0,571\n" "H,4,0,0,580,0,585\n" "H,5,0,0,605,0,600\n" "H,5,0,0,609,0,604\n" "H,5,0,0,623,0,618\n" "H,5,0,0,638,0,633\n" "H,5,0,0,652,0,647\n" "H,5,0,0,664,0,659\n" "H,5,0,0,679,0,674\n" // A (for anchor), group_id, qid, tid, score, num_seeds, qrev, qstart, qend, qlen, trev, tstart, tend, tlen, cov_bases_q, cov_bases_t, num_seeds "A,0,0,0,122,9,0,2,110,1000,0,2,110,0,122,122,9\n" "A,0,0,0,82,6,0,125,193,1000,0,125,193,0,82,82,6\n" "A,0,0,0,77,6,0,212,275,1000,0,212,275,0,77,77,6\n" "A,0,0,0,173,13,0,292,451,1000,0,292,451,0,173,173,13\n" "A,0,0,0,128,9,0,472,586,1000,0,467,581,0,128,128,9\n" "A,0,0,0,89,7,0,600,675,1000,0,605,680,0,89,89,7\n" ; /// LogSystem::GetInstance().SetProgramVerboseLevelFromInt(0); ASSERT_EQ(result_str, expected_str); } } }
37.923711
156
0.49807
[ "vector" ]
416703a7c07f0b870b290abec84817a9af5d8451
1,498
cpp
C++
aws-cpp-sdk-storagegateway/source/model/ListVolumeRecoveryPointsResult.cpp
Neusoft-Technology-Solutions/aws-sdk-cpp
88c041828b0dbee18a297c3cfe98c5ecd0706d0b
[ "Apache-2.0" ]
1
2022-02-10T08:06:54.000Z
2022-02-10T08:06:54.000Z
aws-cpp-sdk-storagegateway/source/model/ListVolumeRecoveryPointsResult.cpp
Neusoft-Technology-Solutions/aws-sdk-cpp
88c041828b0dbee18a297c3cfe98c5ecd0706d0b
[ "Apache-2.0" ]
1
2022-01-03T23:59:37.000Z
2022-01-03T23:59:37.000Z
aws-cpp-sdk-storagegateway/source/model/ListVolumeRecoveryPointsResult.cpp
ravindra-wagh/aws-sdk-cpp
7d5ff01b3c3b872f31ca98fb4ce868cd01e97696
[ "Apache-2.0" ]
1
2021-11-09T11:58:03.000Z
2021-11-09T11:58:03.000Z
/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #include <aws/storagegateway/model/ListVolumeRecoveryPointsResult.h> #include <aws/core/utils/json/JsonSerializer.h> #include <aws/core/AmazonWebServiceResult.h> #include <aws/core/utils/StringUtils.h> #include <aws/core/utils/UnreferencedParam.h> #include <utility> using namespace Aws::StorageGateway::Model; using namespace Aws::Utils::Json; using namespace Aws::Utils; using namespace Aws; ListVolumeRecoveryPointsResult::ListVolumeRecoveryPointsResult() { } ListVolumeRecoveryPointsResult::ListVolumeRecoveryPointsResult(const Aws::AmazonWebServiceResult<JsonValue>& result) { *this = result; } ListVolumeRecoveryPointsResult& ListVolumeRecoveryPointsResult::operator =(const Aws::AmazonWebServiceResult<JsonValue>& result) { JsonView jsonValue = result.GetPayload().View(); if(jsonValue.ValueExists("GatewayARN")) { m_gatewayARN = jsonValue.GetString("GatewayARN"); } if(jsonValue.ValueExists("VolumeRecoveryPointInfos")) { Array<JsonView> volumeRecoveryPointInfosJsonList = jsonValue.GetArray("VolumeRecoveryPointInfos"); for(unsigned volumeRecoveryPointInfosIndex = 0; volumeRecoveryPointInfosIndex < volumeRecoveryPointInfosJsonList.GetLength(); ++volumeRecoveryPointInfosIndex) { m_volumeRecoveryPointInfos.push_back(volumeRecoveryPointInfosJsonList[volumeRecoveryPointInfosIndex].AsObject()); } } return *this; }
29.96
162
0.78972
[ "model" ]
4167837069147e47d14dd49cb76e0b6bee45fd14
50,459
cpp
C++
3rdparty/webkit/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.cpp
mchiasson/PhaserNative
f867454602c395484bf730a7c43b9c586c102ac2
[ "MIT" ]
null
null
null
3rdparty/webkit/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.cpp
mchiasson/PhaserNative
f867454602c395484bf730a7c43b9c586c102ac2
[ "MIT" ]
null
null
null
3rdparty/webkit/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.cpp
mchiasson/PhaserNative
f867454602c395484bf730a7c43b9c586c102ac2
[ "MIT" ]
1
2019-01-25T13:55:25.000Z
2019-01-25T13:55:25.000Z
/* * Copyright (C) 2016-2018 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS 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 APPLE INC. OR ITS CONTRIBUTORS * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ #include "config.h" #include "WebResourceLoadStatisticsStore.h" #include "Logging.h" #include "PluginProcessManager.h" #include "PluginProcessProxy.h" #include "WebProcessMessages.h" #include "WebProcessProxy.h" #include "WebResourceLoadStatisticsStoreMessages.h" #include "WebResourceLoadStatisticsTelemetry.h" #include "WebsiteDataFetchOption.h" #include "WebsiteDataStore.h" #include <WebCore/KeyedCoding.h> #include <WebCore/ResourceLoadStatistics.h> #include <wtf/CrossThreadCopier.h> #include <wtf/DateMath.h> #include <wtf/MathExtras.h> #include <wtf/NeverDestroyed.h> namespace WebKit { using namespace WebCore; constexpr unsigned operatingDatesWindow { 30 }; constexpr unsigned statisticsModelVersion { 11 }; constexpr unsigned maxImportance { 3 }; constexpr unsigned maxNumberOfRecursiveCallsInRedirectTraceBack { 50 }; template<typename T> static inline String isolatedPrimaryDomain(const T& value) { return ResourceLoadStatistics::primaryDomain(value).isolatedCopy(); } const OptionSet<WebsiteDataType>& WebResourceLoadStatisticsStore::monitoredDataTypes() { static NeverDestroyed<OptionSet<WebsiteDataType>> dataTypes(std::initializer_list<WebsiteDataType>({ WebsiteDataType::Cookies, WebsiteDataType::DOMCache, WebsiteDataType::IndexedDBDatabases, WebsiteDataType::LocalStorage, WebsiteDataType::MediaKeys, WebsiteDataType::OfflineWebApplicationCache, #if ENABLE(NETSCAPE_PLUGIN_API) WebsiteDataType::PlugInData, #endif WebsiteDataType::SearchFieldRecentSearches, WebsiteDataType::SessionStorage, #if ENABLE(SERVICE_WORKER) WebsiteDataType::ServiceWorkerRegistrations, #endif WebsiteDataType::WebSQLDatabases, })); ASSERT(RunLoop::isMain()); return dataTypes; } class OperatingDate { public: OperatingDate() = default; static OperatingDate fromWallTime(WallTime time) { double ms = time.secondsSinceEpoch().milliseconds(); int year = msToYear(ms); int yearDay = dayInYear(ms, year); int month = monthFromDayInYear(yearDay, isLeapYear(year)); int monthDay = dayInMonthFromDayInYear(yearDay, isLeapYear(year)); return OperatingDate { year, month, monthDay }; } static OperatingDate today() { return OperatingDate::fromWallTime(WallTime::now()); } Seconds secondsSinceEpoch() const { return Seconds { dateToDaysFrom1970(m_year, m_month, m_monthDay) * secondsPerDay }; } bool operator==(const OperatingDate& other) const { return m_monthDay == other.m_monthDay && m_month == other.m_month && m_year == other.m_year; } bool operator<(const OperatingDate& other) const { return secondsSinceEpoch() < other.secondsSinceEpoch(); } bool operator<=(const OperatingDate& other) const { return secondsSinceEpoch() <= other.secondsSinceEpoch(); } private: OperatingDate(int year, int month, int monthDay) : m_year(year) , m_month(month) , m_monthDay(monthDay) { } int m_year { 0 }; int m_month { 0 }; // [0, 11]. int m_monthDay { 0 }; // [1, 31]. }; static Vector<OperatingDate> mergeOperatingDates(const Vector<OperatingDate>& existingDates, Vector<OperatingDate>&& newDates) { if (existingDates.isEmpty()) return WTFMove(newDates); Vector<OperatingDate> mergedDates(existingDates.size() + newDates.size()); // Merge the two sorted vectors of dates. std::merge(existingDates.begin(), existingDates.end(), newDates.begin(), newDates.end(), mergedDates.begin()); // Remove duplicate dates. removeRepeatedElements(mergedDates); // Drop old dates until the Vector size reaches operatingDatesWindow. while (mergedDates.size() > operatingDatesWindow) mergedDates.remove(0); return mergedDates; } WebResourceLoadStatisticsStore::WebResourceLoadStatisticsStore(const String& resourceLoadStatisticsDirectory, Function<void(const String&)>&& testingCallback, bool isEphemeral, UpdatePrevalentDomainsToPartitionOrBlockCookiesHandler&& updatePrevalentDomainsToPartitionOrBlockCookiesHandler, HasStorageAccessForFrameHandler&& hasStorageAccessForFrameHandler, GrantStorageAccessForFrameHandler&& grantStorageAccessForFrameHandler, RemovePrevalentDomainsHandler&& removeDomainsHandler) : m_statisticsQueue(WorkQueue::create("WebResourceLoadStatisticsStore Process Data Queue", WorkQueue::Type::Serial, WorkQueue::QOS::Utility)) , m_persistentStorage(*this, resourceLoadStatisticsDirectory, isEphemeral ? ResourceLoadStatisticsPersistentStorage::IsReadOnly::Yes : ResourceLoadStatisticsPersistentStorage::IsReadOnly::No) , m_updatePrevalentDomainsToPartitionOrBlockCookiesHandler(WTFMove(updatePrevalentDomainsToPartitionOrBlockCookiesHandler)) , m_hasStorageAccessForFrameHandler(WTFMove(hasStorageAccessForFrameHandler)) , m_grantStorageAccessForFrameHandler(WTFMove(grantStorageAccessForFrameHandler)) , m_removeDomainsHandler(WTFMove(removeDomainsHandler)) , m_dailyTasksTimer(RunLoop::main(), this, &WebResourceLoadStatisticsStore::performDailyTasks) , m_statisticsTestingCallback(WTFMove(testingCallback)) { ASSERT(RunLoop::isMain()); #if PLATFORM(COCOA) registerUserDefaultsIfNeeded(); #endif m_statisticsQueue->dispatch([this, protectedThis = makeRef(*this)] { m_persistentStorage.initialize(); includeTodayAsOperatingDateIfNecessary(); }); m_statisticsQueue->dispatchAfter(5_s, [this, protectedThis = makeRef(*this)] { if (m_parameters.shouldSubmitTelemetry) WebResourceLoadStatisticsTelemetry::calculateAndSubmit(*this); }); m_dailyTasksTimer.startRepeating(24_h); } WebResourceLoadStatisticsStore::~WebResourceLoadStatisticsStore() { m_persistentStorage.finishAllPendingWorkSynchronously(); } void WebResourceLoadStatisticsStore::removeDataRecords(CompletionHandler<void()>&& callback) { ASSERT(!RunLoop::isMain()); if (!shouldRemoveDataRecords()) { callback(); return; } #if ENABLE(NETSCAPE_PLUGIN_API) m_activePluginTokens.clear(); for (auto plugin : PluginProcessManager::singleton().pluginProcesses()) m_activePluginTokens.add(plugin->pluginProcessToken()); #endif auto prevalentResourceDomains = topPrivatelyControlledDomainsToRemoveWebsiteDataFor(); if (prevalentResourceDomains.isEmpty()) { callback(); return; } setDataRecordsBeingRemoved(true); RunLoop::main().dispatch([prevalentResourceDomains = crossThreadCopy(prevalentResourceDomains), callback = WTFMove(callback), this, protectedThis = makeRef(*this)] () mutable { WebProcessProxy::deleteWebsiteDataForTopPrivatelyControlledDomainsInAllPersistentDataStores(WebResourceLoadStatisticsStore::monitoredDataTypes(), WTFMove(prevalentResourceDomains), m_parameters.shouldNotifyPagesWhenDataRecordsWereScanned, [callback = WTFMove(callback), this, protectedThis = WTFMove(protectedThis)](const HashSet<String>& domainsWithDeletedWebsiteData) mutable { m_statisticsQueue->dispatch([topDomains = crossThreadCopy(domainsWithDeletedWebsiteData), callback = WTFMove(callback), this, protectedThis = WTFMove(protectedThis)] () mutable { for (auto& prevalentResourceDomain : topDomains) { auto& statistic = ensureResourceStatisticsForPrimaryDomain(prevalentResourceDomain); ++statistic.dataRecordsRemoved; } setDataRecordsBeingRemoved(false); callback(); }); }); }); } void WebResourceLoadStatisticsStore::scheduleStatisticsAndDataRecordsProcessing() { ASSERT(RunLoop::isMain()); m_statisticsQueue->dispatch([this, protectedThis = makeRef(*this)] { processStatisticsAndDataRecords(); }); } unsigned WebResourceLoadStatisticsStore::recursivelyGetAllDomainsThatHaveRedirectedToThisDomain(const WebCore::ResourceLoadStatistics& resourceStatistic, HashSet<String>& domainsThatHaveRedirectedTo, unsigned numberOfRecursiveCalls) { if (numberOfRecursiveCalls >= maxNumberOfRecursiveCallsInRedirectTraceBack) { ASSERT_NOT_REACHED(); WTFLogAlways("Hit %u recursive calls in redirect backtrace. Returning early.", maxNumberOfRecursiveCallsInRedirectTraceBack); return numberOfRecursiveCalls; } numberOfRecursiveCalls++; for (auto& subresourceUniqueRedirectFromDomain : resourceStatistic.subresourceUniqueRedirectsFrom.values()) { auto mapEntry = m_resourceStatisticsMap.find(subresourceUniqueRedirectFromDomain); if (mapEntry == m_resourceStatisticsMap.end() || mapEntry->value.isPrevalentResource) continue; if (domainsThatHaveRedirectedTo.add(mapEntry->value.highLevelDomain).isNewEntry) numberOfRecursiveCalls = recursivelyGetAllDomainsThatHaveRedirectedToThisDomain(mapEntry->value, domainsThatHaveRedirectedTo, numberOfRecursiveCalls); } for (auto& topFrameUniqueRedirectFromDomain : resourceStatistic.topFrameUniqueRedirectsFrom.values()) { auto mapEntry = m_resourceStatisticsMap.find(topFrameUniqueRedirectFromDomain); if (mapEntry == m_resourceStatisticsMap.end() || mapEntry->value.isPrevalentResource) continue; if (domainsThatHaveRedirectedTo.add(mapEntry->value.highLevelDomain).isNewEntry) numberOfRecursiveCalls = recursivelyGetAllDomainsThatHaveRedirectedToThisDomain(mapEntry->value, domainsThatHaveRedirectedTo, numberOfRecursiveCalls); } return numberOfRecursiveCalls; } void WebResourceLoadStatisticsStore::processStatisticsAndDataRecords() { ASSERT(!RunLoop::isMain()); if (m_parameters.shouldClassifyResourcesBeforeDataRecordsRemoval) { for (auto& resourceStatistic : m_resourceStatisticsMap.values()) { if (!resourceStatistic.isPrevalentResource && m_resourceLoadStatisticsClassifier.hasPrevalentResourceCharacteristics(resourceStatistic)) setPrevalentResource(resourceStatistic); } } if (m_parameters.shouldNotifyPagesWhenDataRecordsWereScanned) { removeDataRecords([this, protectedThis = makeRef(*this)] { ASSERT(!RunLoop::isMain()); pruneStatisticsIfNeeded(); m_persistentStorage.scheduleOrWriteMemoryStore(ResourceLoadStatisticsPersistentStorage::ForceImmediateWrite::No); RunLoop::main().dispatch([] { WebProcessProxy::notifyPageStatisticsAndDataRecordsProcessed(); }); }); } else { removeDataRecords([this, protectedThis = makeRef(*this)] { ASSERT(!RunLoop::isMain()); pruneStatisticsIfNeeded(); m_persistentStorage.scheduleOrWriteMemoryStore(ResourceLoadStatisticsPersistentStorage::ForceImmediateWrite::No); }); } } void WebResourceLoadStatisticsStore::resourceLoadStatisticsUpdated(Vector<WebCore::ResourceLoadStatistics>&& origins) { ASSERT(!RunLoop::isMain()); mergeStatistics(WTFMove(origins)); // Fire before processing statistics to propagate user interaction as fast as possible to the network process. updateCookiePartitioning([]() { }); processStatisticsAndDataRecords(); } void WebResourceLoadStatisticsStore::hasStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, WTF::CompletionHandler<void (bool)>&& callback) { ASSERT(subFrameHost != topFrameHost); ASSERT(RunLoop::isMain()); m_statisticsQueue->dispatch([this, protectedThis = makeRef(*this), subFramePrimaryDomain = isolatedPrimaryDomain(subFrameHost), topFramePrimaryDomain = isolatedPrimaryDomain(topFrameHost), frameID, pageID, callback = WTFMove(callback)] () mutable { auto& subFrameStatistic = ensureResourceStatisticsForPrimaryDomain(subFramePrimaryDomain); if (shouldBlockCookies(subFrameStatistic)) { callback(false); return; } if (!shouldPartitionCookies(subFrameStatistic)) { callback(true); return; } m_hasStorageAccessForFrameHandler(subFramePrimaryDomain, topFramePrimaryDomain, frameID, pageID, WTFMove(callback)); }); } void WebResourceLoadStatisticsStore::requestStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, WTF::CompletionHandler<void (bool)>&& callback) { ASSERT(subFrameHost != topFrameHost); ASSERT(RunLoop::isMain()); auto subFramePrimaryDomain = isolatedPrimaryDomain(subFrameHost); auto topFramePrimaryDomain = isolatedPrimaryDomain(topFrameHost); if (subFramePrimaryDomain == topFramePrimaryDomain) { callback(true); return; } m_statisticsQueue->dispatch([this, protectedThis = makeRef(*this), subFramePrimaryDomain = crossThreadCopy(subFramePrimaryDomain), topFramePrimaryDomain = crossThreadCopy(topFramePrimaryDomain), frameID, pageID, callback = WTFMove(callback)] () mutable { auto& subFrameStatistic = ensureResourceStatisticsForPrimaryDomain(subFramePrimaryDomain); if (shouldBlockCookies(subFrameStatistic)) { callback(false); return; } if (!shouldPartitionCookies(subFrameStatistic)) { callback(true); return; } subFrameStatistic.timesAccessedAsFirstPartyDueToStorageAccessAPI++; m_grantStorageAccessForFrameHandler(subFramePrimaryDomain, topFramePrimaryDomain, frameID, pageID, WTFMove(callback)); }); } void WebResourceLoadStatisticsStore::grandfatherExistingWebsiteData(CompletionHandler<void()>&& callback) { ASSERT(!RunLoop::isMain()); RunLoop::main().dispatch([this, protectedThis = makeRef(*this), callback = WTFMove(callback)] () mutable { // FIXME: This method being a static call on WebProcessProxy is wrong. // It should be on the data store that this object belongs to. WebProcessProxy::topPrivatelyControlledDomainsWithWebsiteData(WebResourceLoadStatisticsStore::monitoredDataTypes(), m_parameters.shouldNotifyPagesWhenDataRecordsWereScanned, [this, protectedThis = WTFMove(protectedThis), callback = WTFMove(callback)] (HashSet<String>&& topPrivatelyControlledDomainsWithWebsiteData) mutable { m_statisticsQueue->dispatch([this, protectedThis = WTFMove(protectedThis), topDomains = crossThreadCopy(topPrivatelyControlledDomainsWithWebsiteData), callback = WTFMove(callback)] () mutable { for (auto& topPrivatelyControlledDomain : topDomains) { auto& statistic = ensureResourceStatisticsForPrimaryDomain(topPrivatelyControlledDomain); statistic.grandfathered = true; } m_endOfGrandfatheringTimestamp = WallTime::now() + m_parameters.grandfatheringTime; m_persistentStorage.scheduleOrWriteMemoryStore(ResourceLoadStatisticsPersistentStorage::ForceImmediateWrite::Yes); callback(); logTestingEvent(ASCIILiteral("Grandfathered")); }); }); }); } void WebResourceLoadStatisticsStore::processWillOpenConnection(WebProcessProxy&, IPC::Connection& connection) { connection.addWorkQueueMessageReceiver(Messages::WebResourceLoadStatisticsStore::messageReceiverName(), m_statisticsQueue.get(), this); } void WebResourceLoadStatisticsStore::processDidCloseConnection(WebProcessProxy&, IPC::Connection& connection) { connection.removeWorkQueueMessageReceiver(Messages::WebResourceLoadStatisticsStore::messageReceiverName()); } void WebResourceLoadStatisticsStore::applicationWillTerminate() { m_persistentStorage.finishAllPendingWorkSynchronously(); } void WebResourceLoadStatisticsStore::performDailyTasks() { ASSERT(RunLoop::isMain()); m_statisticsQueue->dispatch([this, protectedThis = makeRef(*this)] { includeTodayAsOperatingDateIfNecessary(); }); if (m_parameters.shouldSubmitTelemetry) submitTelemetry(); } void WebResourceLoadStatisticsStore::submitTelemetry() { ASSERT(RunLoop::isMain()); m_statisticsQueue->dispatch([this, protectedThis = makeRef(*this)] { WebResourceLoadStatisticsTelemetry::calculateAndSubmit(*this); }); } void WebResourceLoadStatisticsStore::setResourceLoadStatisticsDebugMode(bool enable) { if (enable) setTimeToLiveCookiePartitionFree(30_s); else resetParametersToDefaultValues(); } void WebResourceLoadStatisticsStore::logUserInteraction(const URL& url) { if (url.isBlankURL() || url.isEmpty()) return; m_statisticsQueue->dispatch([this, protectedThis = makeRef(*this), primaryDomain = isolatedPrimaryDomain(url)] { auto& statistics = ensureResourceStatisticsForPrimaryDomain(primaryDomain); statistics.hadUserInteraction = true; statistics.mostRecentUserInteractionTime = WallTime::now(); if (statistics.isMarkedForCookiePartitioning || statistics.isMarkedForCookieBlocking) updateCookiePartitioningForDomains({ }, { }, { primaryDomain }, ShouldClearFirst::No, []() { }); }); } void WebResourceLoadStatisticsStore::logNonRecentUserInteraction(const URL& url) { if (url.isBlankURL() || url.isEmpty()) return; m_statisticsQueue->dispatch([this, protectedThis = makeRef(*this), primaryDomain = isolatedPrimaryDomain(url)] { auto& statistics = ensureResourceStatisticsForPrimaryDomain(primaryDomain); statistics.hadUserInteraction = true; statistics.mostRecentUserInteractionTime = WallTime::now() - (m_parameters.timeToLiveCookiePartitionFree + Seconds::fromHours(1)); updateCookiePartitioningForDomains({ primaryDomain }, { }, { }, ShouldClearFirst::No, []() { }); }); } void WebResourceLoadStatisticsStore::clearUserInteraction(const URL& url) { if (url.isBlankURL() || url.isEmpty()) return; m_statisticsQueue->dispatch([this, protectedThis = makeRef(*this), primaryDomain = isolatedPrimaryDomain(url)] { auto& statistics = ensureResourceStatisticsForPrimaryDomain(primaryDomain); statistics.hadUserInteraction = false; statistics.mostRecentUserInteractionTime = { }; }); } void WebResourceLoadStatisticsStore::hasHadUserInteraction(const URL& url, WTF::Function<void (bool)>&& completionHandler) { if (url.isBlankURL() || url.isEmpty()) { completionHandler(false); return; } m_statisticsQueue->dispatch([this, protectedThis = makeRef(*this), primaryDomain = isolatedPrimaryDomain(url), completionHandler = WTFMove(completionHandler)] () mutable { auto mapEntry = m_resourceStatisticsMap.find(primaryDomain); bool hadUserInteraction = mapEntry == m_resourceStatisticsMap.end() ? false: hasHadUnexpiredRecentUserInteraction(mapEntry->value); RunLoop::main().dispatch([hadUserInteraction, completionHandler = WTFMove(completionHandler)] { completionHandler(hadUserInteraction); }); }); } void WebResourceLoadStatisticsStore::setLastSeen(const URL& url, Seconds seconds) { if (url.isBlankURL() || url.isEmpty()) return; m_statisticsQueue->dispatch([this, protectedThis = makeRef(*this), primaryDomain = isolatedPrimaryDomain(url), seconds] { auto& statistics = ensureResourceStatisticsForPrimaryDomain(primaryDomain); statistics.lastSeen = WallTime::fromRawSeconds(seconds.seconds()); }); } void WebResourceLoadStatisticsStore::setPrevalentResource(const URL& url) { if (url.isBlankURL() || url.isEmpty()) return; m_statisticsQueue->dispatch([this, protectedThis = makeRef(*this), primaryDomain = isolatedPrimaryDomain(url)] { auto& resourceStatistic = ensureResourceStatisticsForPrimaryDomain(primaryDomain); setPrevalentResource(resourceStatistic); }); } void WebResourceLoadStatisticsStore::setPrevalentResource(WebCore::ResourceLoadStatistics& resourceStatistic) { ASSERT(!RunLoop::isMain()); resourceStatistic.isPrevalentResource = true; HashSet<String> domainsThatHaveRedirectedTo; recursivelyGetAllDomainsThatHaveRedirectedToThisDomain(resourceStatistic, domainsThatHaveRedirectedTo, 0); for (auto& domain : domainsThatHaveRedirectedTo) { auto mapEntry = m_resourceStatisticsMap.find(domain); if (mapEntry == m_resourceStatisticsMap.end()) continue; ASSERT(!mapEntry->value.isPrevalentResource); mapEntry->value.isPrevalentResource = true; } } void WebResourceLoadStatisticsStore::isPrevalentResource(const URL& url, WTF::Function<void (bool)>&& completionHandler) { if (url.isBlankURL() || url.isEmpty()) { completionHandler(false); return; } m_statisticsQueue->dispatch([this, protectedThis = makeRef(*this), primaryDomain = isolatedPrimaryDomain(url), completionHandler = WTFMove(completionHandler)] () mutable { auto mapEntry = m_resourceStatisticsMap.find(primaryDomain); bool isPrevalentResource = mapEntry == m_resourceStatisticsMap.end() ? false : mapEntry->value.isPrevalentResource; RunLoop::main().dispatch([isPrevalentResource, completionHandler = WTFMove(completionHandler)] { completionHandler(isPrevalentResource); }); }); } void WebResourceLoadStatisticsStore::isRegisteredAsSubFrameUnder(const URL& subFrame, const URL& topFrame, WTF::Function<void (bool)>&& completionHandler) { m_statisticsQueue->dispatch([this, protectedThis = makeRef(*this), subFramePrimaryDomain = isolatedPrimaryDomain(subFrame), topFramePrimaryDomain = isolatedPrimaryDomain(topFrame), completionHandler = WTFMove(completionHandler)] () mutable { auto mapEntry = m_resourceStatisticsMap.find(subFramePrimaryDomain); bool isRegisteredAsSubFrameUnder = mapEntry == m_resourceStatisticsMap.end() ? false : mapEntry->value.subframeUnderTopFrameOrigins.contains(topFramePrimaryDomain); RunLoop::main().dispatch([isRegisteredAsSubFrameUnder, completionHandler = WTFMove(completionHandler)] { completionHandler(isRegisteredAsSubFrameUnder); }); }); } void WebResourceLoadStatisticsStore::isRegisteredAsRedirectingTo(const URL& hostRedirectedFrom, const URL& hostRedirectedTo, WTF::Function<void (bool)>&& completionHandler) { m_statisticsQueue->dispatch([this, protectedThis = makeRef(*this), hostRedirectedFromPrimaryDomain = isolatedPrimaryDomain(hostRedirectedFrom), hostRedirectedToPrimaryDomain = isolatedPrimaryDomain(hostRedirectedTo), completionHandler = WTFMove(completionHandler)] () mutable { auto mapEntry = m_resourceStatisticsMap.find(hostRedirectedFromPrimaryDomain); bool isRegisteredAsRedirectingTo = mapEntry == m_resourceStatisticsMap.end() ? false : mapEntry->value.subresourceUniqueRedirectsTo.contains(hostRedirectedToPrimaryDomain); RunLoop::main().dispatch([isRegisteredAsRedirectingTo, completionHandler = WTFMove(completionHandler)] { completionHandler(isRegisteredAsRedirectingTo); }); }); } void WebResourceLoadStatisticsStore::clearPrevalentResource(const URL& url) { if (url.isBlankURL() || url.isEmpty()) return; m_statisticsQueue->dispatch([this, protectedThis = makeRef(*this), primaryDomain = isolatedPrimaryDomain(url)] { auto& statistics = ensureResourceStatisticsForPrimaryDomain(primaryDomain); statistics.isPrevalentResource = false; }); } void WebResourceLoadStatisticsStore::setGrandfathered(const URL& url, bool value) { if (url.isBlankURL() || url.isEmpty()) return; m_statisticsQueue->dispatch([this, protectedThis = makeRef(*this), primaryDomain = isolatedPrimaryDomain(url), value] { auto& statistics = ensureResourceStatisticsForPrimaryDomain(primaryDomain); statistics.grandfathered = value; }); } void WebResourceLoadStatisticsStore::isGrandfathered(const URL& url, WTF::Function<void (bool)>&& completionHandler) { if (url.isBlankURL() || url.isEmpty()) { completionHandler(false); return; } m_statisticsQueue->dispatch([this, protectedThis = makeRef(*this), completionHandler = WTFMove(completionHandler), primaryDomain = isolatedPrimaryDomain(url)] () mutable { auto mapEntry = m_resourceStatisticsMap.find(primaryDomain); bool isGrandFathered = mapEntry == m_resourceStatisticsMap.end() ? false : mapEntry->value.grandfathered; RunLoop::main().dispatch([isGrandFathered, completionHandler = WTFMove(completionHandler)] { completionHandler(isGrandFathered); }); }); } void WebResourceLoadStatisticsStore::setSubframeUnderTopFrameOrigin(const URL& subframe, const URL& topFrame) { if (subframe.isBlankURL() || subframe.isEmpty() || topFrame.isBlankURL() || topFrame.isEmpty()) return; m_statisticsQueue->dispatch([this, protectedThis = makeRef(*this), primaryTopFrameDomain = isolatedPrimaryDomain(topFrame), primarySubFrameDomain = isolatedPrimaryDomain(subframe)] { auto& statistics = ensureResourceStatisticsForPrimaryDomain(primarySubFrameDomain); statistics.subframeUnderTopFrameOrigins.add(primaryTopFrameDomain); // For consistency, make sure we also have a statistics entry for the top frame domain. ensureResourceStatisticsForPrimaryDomain(primaryTopFrameDomain); }); } void WebResourceLoadStatisticsStore::setSubresourceUnderTopFrameOrigin(const URL& subresource, const URL& topFrame) { if (subresource.isBlankURL() || subresource.isEmpty() || topFrame.isBlankURL() || topFrame.isEmpty()) return; m_statisticsQueue->dispatch([this, protectedThis = makeRef(*this), primaryTopFrameDomain = isolatedPrimaryDomain(topFrame), primarySubresourceDomain = isolatedPrimaryDomain(subresource)] { auto& statistics = ensureResourceStatisticsForPrimaryDomain(primarySubresourceDomain); statistics.subresourceUnderTopFrameOrigins.add(primaryTopFrameDomain); // For consistency, make sure we also have a statistics entry for the top frame domain. ensureResourceStatisticsForPrimaryDomain(primaryTopFrameDomain); }); } void WebResourceLoadStatisticsStore::setSubresourceUniqueRedirectTo(const URL& subresource, const URL& hostNameRedirectedTo) { if (subresource.isBlankURL() || subresource.isEmpty() || hostNameRedirectedTo.isBlankURL() || hostNameRedirectedTo.isEmpty()) return; m_statisticsQueue->dispatch([this, protectedThis = makeRef(*this), primaryRedirectDomain = isolatedPrimaryDomain(hostNameRedirectedTo), primarySubresourceDomain = isolatedPrimaryDomain(subresource)] { auto& statistics = ensureResourceStatisticsForPrimaryDomain(primarySubresourceDomain); statistics.subresourceUniqueRedirectsTo.add(primaryRedirectDomain); // For consistency, make sure we also have a statistics entry for the redirect domain. ensureResourceStatisticsForPrimaryDomain(primaryRedirectDomain); }); } void WebResourceLoadStatisticsStore::setSubresourceUniqueRedirectFrom(const URL& subresource, const URL& hostNameRedirectedFrom) { if (subresource.isBlankURL() || subresource.isEmpty() || hostNameRedirectedFrom.isBlankURL() || hostNameRedirectedFrom.isEmpty()) return; m_statisticsQueue->dispatch([this, protectedThis = makeRef(*this), primaryRedirectDomain = isolatedPrimaryDomain(hostNameRedirectedFrom), primarySubresourceDomain = isolatedPrimaryDomain(subresource)] { auto& statistics = ensureResourceStatisticsForPrimaryDomain(primarySubresourceDomain); statistics.subresourceUniqueRedirectsFrom.add(primaryRedirectDomain); // For consistency, make sure we also have a statistics entry for the redirect domain. ensureResourceStatisticsForPrimaryDomain(primaryRedirectDomain); }); } void WebResourceLoadStatisticsStore::setTopFrameUniqueRedirectTo(const URL& topFrameHostName, const URL& hostNameRedirectedTo) { if (topFrameHostName.isBlankURL() || topFrameHostName.isEmpty() || hostNameRedirectedTo.isBlankURL() || hostNameRedirectedTo.isEmpty()) return; m_statisticsQueue->dispatch([this, protectedThis = makeRef(*this), primaryRedirectDomain = isolatedPrimaryDomain(hostNameRedirectedTo), topFramePrimaryDomain = isolatedPrimaryDomain(topFrameHostName)] { auto& statistics = ensureResourceStatisticsForPrimaryDomain(topFramePrimaryDomain); statistics.topFrameUniqueRedirectsTo.add(primaryRedirectDomain); // For consistency, make sure we also have a statistics entry for the redirect domain. ensureResourceStatisticsForPrimaryDomain(primaryRedirectDomain); }); } void WebResourceLoadStatisticsStore::setTopFrameUniqueRedirectFrom(const URL& topFrameHostName, const URL& hostNameRedirectedFrom) { if (topFrameHostName.isBlankURL() || topFrameHostName.isEmpty() || hostNameRedirectedFrom.isBlankURL() || hostNameRedirectedFrom.isEmpty()) return; m_statisticsQueue->dispatch([this, protectedThis = makeRef(*this), primaryRedirectDomain = isolatedPrimaryDomain(hostNameRedirectedFrom), topFramePrimaryDomain = isolatedPrimaryDomain(topFrameHostName)] { auto& statistics = ensureResourceStatisticsForPrimaryDomain(topFramePrimaryDomain); statistics.topFrameUniqueRedirectsFrom.add(primaryRedirectDomain); // For consistency, make sure we also have a statistics entry for the redirect domain. ensureResourceStatisticsForPrimaryDomain(primaryRedirectDomain); }); } void WebResourceLoadStatisticsStore::scheduleCookiePartitioningUpdate(CompletionHandler<void()>&& callback) { // Helper function used by testing system. Should only be called from the main thread. ASSERT(RunLoop::isMain()); m_statisticsQueue->dispatch([this, protectedThis = makeRef(*this), callback = WTFMove(callback)] () mutable { updateCookiePartitioning(WTFMove(callback)); }); } void WebResourceLoadStatisticsStore::scheduleCookiePartitioningUpdateForDomains(const Vector<String>& domainsToPartition, const Vector<String>& domainsToBlock, const Vector<String>& domainsToNeitherPartitionNorBlock, ShouldClearFirst shouldClearFirst, CompletionHandler<void()>&& callback) { // Helper function used by testing system. Should only be called from the main thread. ASSERT(RunLoop::isMain()); m_statisticsQueue->dispatch([this, protectedThis = makeRef(*this), domainsToPartition = crossThreadCopy(domainsToPartition), domainsToBlock = crossThreadCopy(domainsToBlock), domainsToNeitherPartitionNorBlock = crossThreadCopy(domainsToNeitherPartitionNorBlock), shouldClearFirst, callback = WTFMove(callback)] () mutable { updateCookiePartitioningForDomains(domainsToPartition, domainsToBlock, domainsToNeitherPartitionNorBlock, shouldClearFirst, WTFMove(callback)); }); } void WebResourceLoadStatisticsStore::scheduleClearPartitioningStateForDomains(const Vector<String>& domains, CompletionHandler<void()>&& callback) { // Helper function used by testing system. Should only be called from the main thread. ASSERT(RunLoop::isMain()); m_statisticsQueue->dispatch([this, protectedThis = makeRef(*this), domains = crossThreadCopy(domains), callback = WTFMove(callback)] () mutable { clearPartitioningStateForDomains(domains, WTFMove(callback)); }); } #if HAVE(CFNETWORK_STORAGE_PARTITIONING) void WebResourceLoadStatisticsStore::scheduleCookiePartitioningStateReset() { m_statisticsQueue->dispatch([this, protectedThis = makeRef(*this)] { resetCookiePartitioningState(); }); } #endif void WebResourceLoadStatisticsStore::scheduleClearInMemory() { ASSERT(RunLoop::isMain()); m_statisticsQueue->dispatch([this, protectedThis = makeRef(*this)] { clearInMemory(); }); } void WebResourceLoadStatisticsStore::scheduleClearInMemoryAndPersistent(ShouldGrandfather shouldGrandfather, CompletionHandler<void()>&& callback) { ASSERT(RunLoop::isMain()); m_statisticsQueue->dispatch([this, protectedThis = makeRef(*this), shouldGrandfather, callback = WTFMove(callback)] () mutable { clearInMemory(); m_persistentStorage.clear(); if (shouldGrandfather == ShouldGrandfather::Yes) grandfatherExistingWebsiteData([protectedThis = makeRef(*this), callback = WTFMove(callback)]() { callback(); }); else { callback(); } }); } void WebResourceLoadStatisticsStore::scheduleClearInMemoryAndPersistent(WallTime modifiedSince, ShouldGrandfather shouldGrandfather, CompletionHandler<void()>&& callback) { // For now, be conservative and clear everything regardless of modifiedSince. UNUSED_PARAM(modifiedSince); scheduleClearInMemoryAndPersistent(shouldGrandfather, WTFMove(callback)); } void WebResourceLoadStatisticsStore::setTimeToLiveUserInteraction(Seconds seconds) { ASSERT(seconds >= 0_s); m_parameters.timeToLiveUserInteraction = seconds; } void WebResourceLoadStatisticsStore::setTimeToLiveCookiePartitionFree(Seconds seconds) { ASSERT(seconds >= 0_s); m_parameters.timeToLiveCookiePartitionFree = seconds; } void WebResourceLoadStatisticsStore::setMinimumTimeBetweenDataRecordsRemoval(Seconds seconds) { ASSERT(seconds >= 0_s); m_parameters.minimumTimeBetweenDataRecordsRemoval = seconds; } void WebResourceLoadStatisticsStore::setGrandfatheringTime(Seconds seconds) { ASSERT(seconds >= 0_s); m_parameters.grandfatheringTime = seconds; } bool WebResourceLoadStatisticsStore::shouldRemoveDataRecords() const { ASSERT(!RunLoop::isMain()); if (m_dataRecordsBeingRemoved) return false; #if ENABLE(NETSCAPE_PLUGIN_API) for (auto plugin : PluginProcessManager::singleton().pluginProcesses()) { if (!m_activePluginTokens.contains(plugin->pluginProcessToken())) return true; } #endif return !m_lastTimeDataRecordsWereRemoved || MonotonicTime::now() >= (m_lastTimeDataRecordsWereRemoved + m_parameters.minimumTimeBetweenDataRecordsRemoval); } void WebResourceLoadStatisticsStore::setDataRecordsBeingRemoved(bool value) { ASSERT(!RunLoop::isMain()); m_dataRecordsBeingRemoved = value; if (m_dataRecordsBeingRemoved) m_lastTimeDataRecordsWereRemoved = MonotonicTime::now(); } ResourceLoadStatistics& WebResourceLoadStatisticsStore::ensureResourceStatisticsForPrimaryDomain(const String& primaryDomain) { ASSERT(!RunLoop::isMain()); return m_resourceStatisticsMap.ensure(primaryDomain, [&primaryDomain] { return ResourceLoadStatistics(primaryDomain); }).iterator->value; } std::unique_ptr<KeyedEncoder> WebResourceLoadStatisticsStore::createEncoderFromData() const { ASSERT(!RunLoop::isMain()); auto encoder = KeyedEncoder::encoder(); encoder->encodeUInt32("version", statisticsModelVersion); encoder->encodeDouble("endOfGrandfatheringTimestamp", m_endOfGrandfatheringTimestamp.secondsSinceEpoch().value()); encoder->encodeObjects("browsingStatistics", m_resourceStatisticsMap.begin(), m_resourceStatisticsMap.end(), [](KeyedEncoder& encoderInner, const auto& origin) { origin.value.encode(encoderInner); }); encoder->encodeObjects("operatingDates", m_operatingDates.begin(), m_operatingDates.end(), [](KeyedEncoder& encoderInner, OperatingDate date) { encoderInner.encodeDouble("date", date.secondsSinceEpoch().value()); }); return encoder; } void WebResourceLoadStatisticsStore::mergeWithDataFromDecoder(KeyedDecoder& decoder) { ASSERT(!RunLoop::isMain()); unsigned versionOnDisk; if (!decoder.decodeUInt32("version", versionOnDisk)) return; if (versionOnDisk != statisticsModelVersion) return; double endOfGrandfatheringTimestamp; if (decoder.decodeDouble("endOfGrandfatheringTimestamp", endOfGrandfatheringTimestamp)) m_endOfGrandfatheringTimestamp = WallTime::fromRawSeconds(endOfGrandfatheringTimestamp); else m_endOfGrandfatheringTimestamp = { }; Vector<ResourceLoadStatistics> loadedStatistics; bool succeeded = decoder.decodeObjects("browsingStatistics", loadedStatistics, [](KeyedDecoder& decoderInner, ResourceLoadStatistics& statistics) { return statistics.decode(decoderInner); }); if (!succeeded) return; mergeStatistics(WTFMove(loadedStatistics)); updateCookiePartitioning([]() { }); Vector<OperatingDate> operatingDates; succeeded = decoder.decodeObjects("operatingDates", operatingDates, [](KeyedDecoder& decoder, OperatingDate& date) { double value; if (!decoder.decodeDouble("date", value)) return false; date = OperatingDate::fromWallTime(WallTime::fromRawSeconds(value)); return true; }); if (!succeeded) return; m_operatingDates = mergeOperatingDates(m_operatingDates, WTFMove(operatingDates)); } void WebResourceLoadStatisticsStore::clearInMemory() { ASSERT(!RunLoop::isMain()); m_resourceStatisticsMap.clear(); m_operatingDates.clear(); updateCookiePartitioningForDomains({ }, { }, { }, ShouldClearFirst::Yes, []() { }); } bool WebResourceLoadStatisticsStore::wasAccessedAsFirstPartyDueToUserInteraction(const ResourceLoadStatistics& current, const ResourceLoadStatistics& updated) { if (!current.hadUserInteraction && !updated.hadUserInteraction) return false; auto mostRecentUserInteractionTime = std::max(current.mostRecentUserInteractionTime, updated.mostRecentUserInteractionTime); return updated.lastSeen <= mostRecentUserInteractionTime + m_parameters.timeToLiveCookiePartitionFree; } void WebResourceLoadStatisticsStore::mergeStatistics(Vector<ResourceLoadStatistics>&& statistics) { ASSERT(!RunLoop::isMain()); for (auto& statistic : statistics) { auto result = m_resourceStatisticsMap.ensure(statistic.highLevelDomain, [&statistic] { return WTFMove(statistic); }); if (!result.isNewEntry) { if (wasAccessedAsFirstPartyDueToUserInteraction(result.iterator->value, statistic)) result.iterator->value.timesAccessedAsFirstPartyDueToUserInteraction++; result.iterator->value.merge(statistic); } } } bool WebResourceLoadStatisticsStore::shouldPartitionCookies(const ResourceLoadStatistics& statistic) const { return statistic.isPrevalentResource && statistic.hadUserInteraction && WallTime::now() > statistic.mostRecentUserInteractionTime + m_parameters.timeToLiveCookiePartitionFree; } bool WebResourceLoadStatisticsStore::shouldBlockCookies(const ResourceLoadStatistics& statistic) const { return statistic.isPrevalentResource && !statistic.hadUserInteraction; } void WebResourceLoadStatisticsStore::updateCookiePartitioning(CompletionHandler<void()>&& callback) { ASSERT(!RunLoop::isMain()); Vector<String> domainsToPartition; Vector<String> domainsToBlock; Vector<String> domainsToNeitherPartitionNorBlock; for (auto& resourceStatistic : m_resourceStatisticsMap.values()) { bool shouldPartition = shouldPartitionCookies(resourceStatistic); bool shouldBlock = shouldBlockCookies(resourceStatistic); if (shouldPartition && !resourceStatistic.isMarkedForCookiePartitioning) { domainsToPartition.append(resourceStatistic.highLevelDomain); resourceStatistic.isMarkedForCookiePartitioning = true; } else if (shouldBlock && !resourceStatistic.isMarkedForCookieBlocking) { domainsToBlock.append(resourceStatistic.highLevelDomain); resourceStatistic.isMarkedForCookieBlocking = true; } else if (!shouldPartition && !shouldBlock && resourceStatistic.isPrevalentResource) { domainsToNeitherPartitionNorBlock.append(resourceStatistic.highLevelDomain); resourceStatistic.isMarkedForCookiePartitioning = false; resourceStatistic.isMarkedForCookieBlocking = false; } } if (domainsToPartition.isEmpty() && domainsToBlock.isEmpty() && domainsToNeitherPartitionNorBlock.isEmpty()) { callback(); return; } RunLoop::main().dispatch([this, protectedThis = makeRef(*this), domainsToPartition = crossThreadCopy(domainsToPartition), domainsToBlock = crossThreadCopy(domainsToBlock), domainsToNeitherPartitionNorBlock = crossThreadCopy(domainsToNeitherPartitionNorBlock), callback = WTFMove(callback)] () { m_updatePrevalentDomainsToPartitionOrBlockCookiesHandler(domainsToPartition, domainsToBlock, domainsToNeitherPartitionNorBlock, ShouldClearFirst::No); callback(); }); } void WebResourceLoadStatisticsStore::updateCookiePartitioningForDomains(const Vector<String>& domainsToPartition, const Vector<String>& domainsToBlock, const Vector<String>& domainsToNeitherPartitionNorBlock, ShouldClearFirst shouldClearFirst, CompletionHandler<void()>&& callback) { ASSERT(!RunLoop::isMain()); if (domainsToPartition.isEmpty() && domainsToBlock.isEmpty() && domainsToNeitherPartitionNorBlock.isEmpty() && shouldClearFirst == ShouldClearFirst::No) { callback(); return; } RunLoop::main().dispatch([this, shouldClearFirst, protectedThis = makeRef(*this), domainsToPartition = crossThreadCopy(domainsToPartition), domainsToBlock = crossThreadCopy(domainsToBlock), domainsToNeitherPartitionNorBlock = crossThreadCopy(domainsToNeitherPartitionNorBlock)] () { m_updatePrevalentDomainsToPartitionOrBlockCookiesHandler(domainsToPartition, domainsToBlock, domainsToNeitherPartitionNorBlock, shouldClearFirst); }); if (shouldClearFirst == ShouldClearFirst::Yes) resetCookiePartitioningState(); else { for (auto& domain : domainsToNeitherPartitionNorBlock) { auto& statistic = ensureResourceStatisticsForPrimaryDomain(domain); statistic.isMarkedForCookiePartitioning = false; statistic.isMarkedForCookieBlocking = false; } } for (auto& domain : domainsToPartition) ensureResourceStatisticsForPrimaryDomain(domain).isMarkedForCookiePartitioning = true; for (auto& domain : domainsToBlock) ensureResourceStatisticsForPrimaryDomain(domain).isMarkedForCookieBlocking = true; callback(); } void WebResourceLoadStatisticsStore::clearPartitioningStateForDomains(const Vector<String>& domains, CompletionHandler<void()>&& callback) { ASSERT(!RunLoop::isMain()); if (domains.isEmpty()) { callback(); return; } RunLoop::main().dispatch([this, protectedThis = makeRef(*this), domains = crossThreadCopy(domains)] () { m_removeDomainsHandler(domains); }); for (auto& domain : domains) { auto& statistic = ensureResourceStatisticsForPrimaryDomain(domain); statistic.isMarkedForCookiePartitioning = false; statistic.isMarkedForCookieBlocking = false; } callback(); } void WebResourceLoadStatisticsStore::resetCookiePartitioningState() { ASSERT(!RunLoop::isMain()); for (auto& resourceStatistic : m_resourceStatisticsMap.values()) { resourceStatistic.isMarkedForCookiePartitioning = false; resourceStatistic.isMarkedForCookieBlocking = false; } } void WebResourceLoadStatisticsStore::processStatistics(const WTF::Function<void (const ResourceLoadStatistics&)>& processFunction) const { ASSERT(!RunLoop::isMain()); for (auto& resourceStatistic : m_resourceStatisticsMap.values()) processFunction(resourceStatistic); } bool WebResourceLoadStatisticsStore::hasHadUnexpiredRecentUserInteraction(ResourceLoadStatistics& resourceStatistic) const { if (resourceStatistic.hadUserInteraction && hasStatisticsExpired(resourceStatistic)) { // Drop privacy sensitive data because we no longer need it. // Set timestamp to 0 so that statistics merge will know // it has been reset as opposed to its default -1. resourceStatistic.mostRecentUserInteractionTime = { }; resourceStatistic.hadUserInteraction = false; } return resourceStatistic.hadUserInteraction; } Vector<String> WebResourceLoadStatisticsStore::topPrivatelyControlledDomainsToRemoveWebsiteDataFor() { ASSERT(!RunLoop::isMain()); bool shouldCheckForGrandfathering = m_endOfGrandfatheringTimestamp > WallTime::now(); bool shouldClearGrandfathering = !shouldCheckForGrandfathering && m_endOfGrandfatheringTimestamp; if (shouldClearGrandfathering) m_endOfGrandfatheringTimestamp = { }; Vector<String> prevalentResources; for (auto& statistic : m_resourceStatisticsMap.values()) { if (statistic.isPrevalentResource && !hasHadUnexpiredRecentUserInteraction(statistic) && (!shouldCheckForGrandfathering || !statistic.grandfathered)) prevalentResources.append(statistic.highLevelDomain); if (shouldClearGrandfathering && statistic.grandfathered) statistic.grandfathered = false; } return prevalentResources; } void WebResourceLoadStatisticsStore::includeTodayAsOperatingDateIfNecessary() { ASSERT(!RunLoop::isMain()); auto today = OperatingDate::today(); if (!m_operatingDates.isEmpty() && today <= m_operatingDates.last()) return; while (m_operatingDates.size() >= operatingDatesWindow) m_operatingDates.remove(0); m_operatingDates.append(today); } bool WebResourceLoadStatisticsStore::hasStatisticsExpired(const ResourceLoadStatistics& resourceStatistic) const { if (m_operatingDates.size() >= operatingDatesWindow) { if (OperatingDate::fromWallTime(resourceStatistic.mostRecentUserInteractionTime) < m_operatingDates.first()) return true; } // If we don't meet the real criteria for an expired statistic, check the user setting for a tighter restriction (mainly for testing). if (m_parameters.timeToLiveUserInteraction) { if (WallTime::now() > resourceStatistic.mostRecentUserInteractionTime + m_parameters.timeToLiveUserInteraction.value()) return true; } return false; } void WebResourceLoadStatisticsStore::setMaxStatisticsEntries(size_t maximumEntryCount) { m_parameters.maxStatisticsEntries = maximumEntryCount; } void WebResourceLoadStatisticsStore::setPruneEntriesDownTo(size_t pruneTargetCount) { m_parameters.pruneEntriesDownTo = pruneTargetCount; } struct StatisticsLastSeen { String topPrivatelyOwnedDomain; WallTime lastSeen; }; static void pruneResources(HashMap<String, WebCore::ResourceLoadStatistics>& statisticsMap, Vector<StatisticsLastSeen>& statisticsToPrune, size_t& numberOfEntriesToPrune) { if (statisticsToPrune.size() > numberOfEntriesToPrune) { std::sort(statisticsToPrune.begin(), statisticsToPrune.end(), [](const StatisticsLastSeen& a, const StatisticsLastSeen& b) { return a.lastSeen < b.lastSeen; }); } for (size_t i = 0, end = std::min(numberOfEntriesToPrune, statisticsToPrune.size()); i != end; ++i, --numberOfEntriesToPrune) statisticsMap.remove(statisticsToPrune[i].topPrivatelyOwnedDomain); } static unsigned computeImportance(const ResourceLoadStatistics& resourceStatistic) { unsigned importance = maxImportance; if (!resourceStatistic.isPrevalentResource) importance -= 1; if (!resourceStatistic.hadUserInteraction) importance -= 2; return importance; } void WebResourceLoadStatisticsStore::pruneStatisticsIfNeeded() { ASSERT(!RunLoop::isMain()); if (m_resourceStatisticsMap.size() <= m_parameters.maxStatisticsEntries) return; ASSERT(m_parameters.pruneEntriesDownTo <= m_parameters.maxStatisticsEntries); size_t numberOfEntriesLeftToPrune = m_resourceStatisticsMap.size() - m_parameters.pruneEntriesDownTo; ASSERT(numberOfEntriesLeftToPrune); Vector<StatisticsLastSeen> resourcesToPrunePerImportance[maxImportance + 1]; for (auto& resourceStatistic : m_resourceStatisticsMap.values()) resourcesToPrunePerImportance[computeImportance(resourceStatistic)].append({ resourceStatistic.highLevelDomain, resourceStatistic.lastSeen }); for (unsigned importance = 0; numberOfEntriesLeftToPrune && importance <= maxImportance; ++importance) pruneResources(m_resourceStatisticsMap, resourcesToPrunePerImportance[importance], numberOfEntriesLeftToPrune); ASSERT(!numberOfEntriesLeftToPrune); } void WebResourceLoadStatisticsStore::resetParametersToDefaultValues() { m_parameters = { }; } void WebResourceLoadStatisticsStore::logTestingEvent(const String& event) { if (!m_statisticsTestingCallback) return; if (RunLoop::isMain()) m_statisticsTestingCallback(event); else { RunLoop::main().dispatch([this, protectedThis = makeRef(*this), event = event.isolatedCopy()] { if (m_statisticsTestingCallback) m_statisticsTestingCallback(event); }); } } } // namespace WebKit
43.953833
481
0.748588
[ "object", "vector" ]
41682cb1fc1e53a5fc7ad31a7e4a4752ad9ef126
11,943
cpp
C++
src/services/hardwareFileSystem/system.cpp
patrick-lafferty/saturn
6dc36adb42ad9b647704dd19247423a522eeb551
[ "BSD-3-Clause" ]
26
2018-03-19T15:59:46.000Z
2021-08-06T16:13:16.000Z
src/services/hardwareFileSystem/system.cpp
patrick-lafferty/saturn
6dc36adb42ad9b647704dd19247423a522eeb551
[ "BSD-3-Clause" ]
34
2018-01-21T17:43:29.000Z
2020-06-27T02:00:53.000Z
src/services/hardwareFileSystem/system.cpp
patrick-lafferty/saturn
6dc36adb42ad9b647704dd19247423a522eeb551
[ "BSD-3-Clause" ]
3
2019-12-08T22:26:35.000Z
2021-06-25T17:05:57.000Z
/* Copyright (c) 2017, Patrick Lafferty All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "system.h" #include <services.h> #include <system_calls.h> #include <services/virtualFileSystem/virtualFileSystem.h> #include <vector> #include <saturn/parsing.h> #include "cpu/cpu.h" #include "pci/pci.h" #include "timer/timer.h" #include "ps2/mouse.h" #include <kernel/arch/i386/cpu/tsc.h> #include <saturn/wait.h> #include <services/ps2/ps2.h> using namespace VirtualFileSystem; using namespace Vostok; namespace HardwareFileSystem { void registerService() { MountRequest request; const char* path = "/system/hardware"; memcpy(request.path, path, strlen(path) + 1); request.serviceType = Kernel::ServiceType::VFS; request.cacheable = false; request.writeable = true; send(IPC::RecipientType::ServiceName, &request); } struct NamedObject { char name[20]; HardwareObject* instance; }; bool findObject(std::vector<NamedObject>& objects, std::string_view name, Object** found) { for (auto& object : objects) { if (name.compare(object.name) == 0) { *found = object.instance; return true; } } return false; } void handleOpenRequest(OpenRequest& request, std::vector<NamedObject> objects, std::vector<FileDescriptor>& openDescriptors) { bool failed {true}; OpenResult result; result.requestId = request.requestId; result.serviceType = Kernel::ServiceType::VFS; result.type = FileDescriptorType::Vostok; auto addDescriptor = [&](auto instance, auto id, auto type) { failed = false; result.success = true; openDescriptors.push_back({instance, {static_cast<uint32_t>(id)}, type}); result.fileDescriptor = openDescriptors.size() - 1; }; auto tryOpenObject = [&](auto object, auto name) { auto functionId = object->getFunction(name); if (functionId >= 0) { addDescriptor(object, functionId, DescriptorType::Function); return true; } else { auto propertyId = object->getProperty(name); if (propertyId >= 0) { addDescriptor(object, propertyId, DescriptorType::Property); return true; } } return false; }; auto words = split({request.path, strlen(request.path)}, '/'); if (words.size() > 0) { Object* object; auto found = findObject(objects, words[0], &object); if (found) { uint32_t lastObjectWord {0}; for (auto i = 1u; i < words.size(); i++) { auto nestedObject = object->getNestedObject(words[i]); if (nestedObject != nullptr) { object = nestedObject; lastObjectWord = i; } } if (!tryOpenObject(object, words[words.size() - 1])) { if (lastObjectWord == (words.size() - 1)) { addDescriptor(object, 0, DescriptorType::Object); } } } } else { //its the hardware toplevel addDescriptor(nullptr, 0, DescriptorType::Object); } if (failed) { result.success = false; } send(IPC::RecipientType::ServiceName, &result); } HardwareObject* createObject(std::string_view name) { if (name.compare("cpu") == 0) { return new CPUObject(); } else if (name.compare("pci") == 0) { return new PCI::Object(); } else if (name.compare("timer") == 0) { return new Timer::TimerObject(); } else if (name.compare("mouse") == 0) { return new PS2::MouseObject(); } return nullptr; } void handleCreateRequest(CreateRequest& request, std::vector<NamedObject>& objects) { bool failed {true}; CreateResult result; result.requestId = request.requestId; result.serviceType = Kernel::ServiceType::VFS; auto words = split({request.path, strlen(request.path)}, '/'); /* when the VFS forwards this request, it strips off /system/hardware, leaving / and the path for example /cpu, /pci */ if (words.size() == 1) { bool alreadyExists {false}; for (auto& object : objects) { if (words[0].compare(object.name) == 0) { alreadyExists = true; break; } } if (!alreadyExists) { auto object = createObject(words[0]); if (object != nullptr) { objects.push_back({}); auto& namedObject = objects[objects.size() - 1]; words[0].copy(namedObject.name, words[0].length()); namedObject.instance = object; failed = false; result.success = true; } } } else { //TODO: its a subobject } if (failed) { result.success = false; } send(IPC::RecipientType::ServiceName, &result); } void handleReadRequest(ReadRequest& request, std::vector<NamedObject>& objects, std::vector<FileDescriptor>& openDescriptors) { auto& descriptor = openDescriptors[request.fileDescriptor]; if (descriptor.type == DescriptorType::Object) { if (descriptor.instance == nullptr) { ReadResult result; result.requestId = request.requestId; result.success = true; ArgBuffer args{result.buffer, sizeof(result.buffer)}; args.writeType(ArgTypes::Property); //its the main /system/hardware thing, return a list of all objects for (auto& object : objects) { args.writeValueWithType(object.name, ArgTypes::Cstring); } args.writeType(ArgTypes::EndArg); result.recipientId = request.senderTaskId; send(IPC::RecipientType::TaskId, &result); } else { //its a hardware object, return a summary of it descriptor.read(request.senderTaskId, request.requestId); } } else { descriptor.read(request.senderTaskId, request.requestId); } } void handleWriteRequest(WriteRequest& request, std::vector<FileDescriptor>& openDescriptors) { ArgBuffer args{request.buffer, sizeof(request.buffer)}; openDescriptors[request.fileDescriptor].write(request.senderTaskId, request.requestId, args); } void handleCloseRequest(CloseRequest& /*request*/, std::vector<FileDescriptor>& /*openDescriptors*/) { //TODO: this is broken //openDescriptors.erase(&openDescriptors[request.fileDescriptor]); } void messageLoop() { std::vector<NamedObject> objects; std::vector<FileDescriptor> openDescriptors; while (true) { IPC::MaximumMessageBuffer buffer; receive(&buffer); switch (buffer.messageNamespace) { case IPC::MessageNamespace::VFS: { switch (static_cast<MessageId>(buffer.messageId)) { case MessageId::OpenRequest: { auto request = IPC::extractMessage<OpenRequest>(buffer); handleOpenRequest(request, objects, openDescriptors); break; } case MessageId::CreateRequest: { auto request = IPC::extractMessage<CreateRequest>(buffer); handleCreateRequest(request, objects); break; } case MessageId::ReadRequest: { auto request = IPC::extractMessage<ReadRequest>(buffer); handleReadRequest(request, objects, openDescriptors); break; } case MessageId::WriteRequest: { auto request = IPC::extractMessage<WriteRequest>(buffer); handleWriteRequest(request, openDescriptors); break; } case MessageId::CloseRequest: { auto request = IPC::extractMessage<CloseRequest>(buffer); handleCloseRequest(request, openDescriptors); break; } default: break; } break; } default: break; } } } void service() { waitForServiceRegistered(Kernel::ServiceType::VFS); registerService(); messageLoop(); } void detectHardware() { waitForServiceRegistered(Kernel::ServiceType::VFS); Saturn::Event::waitForMount("/system/hardware"); detectCPU(); ::PS2::initializeController(); ::PS2::identifyDevices(); while (!Timer::createTimerObject()) { sleep(10); } auto openResult = openSynchronous("/system/hardware/timer/tsc/ticksPerSecond"); auto readResult = readSynchronous(openResult.fileDescriptor, 0); Vostok::ArgBuffer args{readResult.buffer, sizeof(readResult.buffer)}; args.readType(); uint32_t ticksPerSecond {0}; while (ticksPerSecond == 0) { ticksPerSecond = TSC::getTicksPerSecond(); if (ticksPerSecond == 0) { sleep(10); } } args.writeValueWithType(ticksPerSecond, Vostok::ArgTypes::Uint64); writeSynchronous(openResult.fileDescriptor, readResult.buffer, sizeof(readResult.buffer)); close(openResult.fileDescriptor); receiveAndIgnore(); } }
34.819242
131
0.558486
[ "object", "vector" ]
416e127a7dc38d2cf6a93e1d2a71bd8f4bdfdd51
6,088
cpp
C++
src/apps/haikudepot/server/ServerRepositoryDataUpdateProcess.cpp
Kirishikesan/haiku
835565c55830f2dab01e6e332cc7e2d9c015b51e
[ "MIT" ]
1,338
2015-01-03T20:06:56.000Z
2022-03-26T13:49:54.000Z
src/apps/haikudepot/server/ServerRepositoryDataUpdateProcess.cpp
Kirishikesan/haiku
835565c55830f2dab01e6e332cc7e2d9c015b51e
[ "MIT" ]
15
2015-01-17T22:19:32.000Z
2021-12-20T12:35:00.000Z
src/apps/haikudepot/server/ServerRepositoryDataUpdateProcess.cpp
Kirishikesan/haiku
835565c55830f2dab01e6e332cc7e2d9c015b51e
[ "MIT" ]
350
2015-01-08T14:15:27.000Z
2022-03-21T18:14:35.000Z
/* * Copyright 2017-2020, Andrew Lindesay <apl@lindesay.co.nz>. * All rights reserved. Distributed under the terms of the MIT License. */ #include "ServerRepositoryDataUpdateProcess.h" #include <stdio.h> #include <sys/stat.h> #include <time.h> #include <AutoDeleter.h> #include <Autolock.h> #include <Catalog.h> #include <FileIO.h> #include <Url.h> #include "DumpExportRepository.h" #include "DumpExportRepositoryJsonListener.h" #include "DumpExportRepositorySource.h" #include "PackageInfo.h" #include "ServerSettings.h" #include "StorageUtils.h" #include "Logger.h" #undef B_TRANSLATION_CONTEXT #define B_TRANSLATION_CONTEXT "ServerRepositoryDataUpdateProcess" /*! This repository listener (not at the JSON level) is feeding in the repositories as they are parsed and processing them. Processing includes finding the matching depot record and coupling the data from the server with the data about the depot. */ class DepotMatchingRepositoryListener : public DumpExportRepositoryListener { public: DepotMatchingRepositoryListener(Model* model, Stoppable* stoppable); virtual ~DepotMatchingRepositoryListener(); virtual bool Handle(DumpExportRepository* item); void Handle(DumpExportRepository* repository, DumpExportRepositorySource* repositorySource); void Handle(const BString& identifier, DumpExportRepository* repository, DumpExportRepositorySource* repositorySource); virtual void Complete(); private: void _SetupRepositoryData( DepotInfoRef& depot, DumpExportRepository* repository, DumpExportRepositorySource* repositorySource); private: Model* fModel; Stoppable* fStoppable; }; DepotMatchingRepositoryListener::DepotMatchingRepositoryListener( Model* model, Stoppable* stoppable) : fModel(model), fStoppable(stoppable) { } DepotMatchingRepositoryListener::~DepotMatchingRepositoryListener() { } void DepotMatchingRepositoryListener::_SetupRepositoryData(DepotInfoRef& depot, DumpExportRepository* repository, DumpExportRepositorySource* repositorySource) { BString* repositoryCode = repository->Code(); BString* repositorySourceCode = repositorySource->Code(); depot->SetWebAppRepositoryCode(*repositoryCode); depot->SetWebAppRepositorySourceCode(*repositorySourceCode); if (Logger::IsDebugEnabled()) { HDDEBUG("[DepotMatchingRepositoryListener] associated depot [%s] (%s) " "with server repository source [%s] (%s)", depot->Name().String(), depot->URL().String(), repositorySourceCode->String(), repositorySource->Identifier()->String()); } else { HDINFO("[DepotMatchingRepositoryListener] associated depot [%s] with " "server repository source [%s]", depot->Name().String(), repositorySourceCode->String()); } } void DepotMatchingRepositoryListener::Handle(const BString& identifier, DumpExportRepository* repository, DumpExportRepositorySource* repositorySource) { if (!identifier.IsEmpty()) { AutoLocker<BLocker> locker(fModel->Lock()); for (int32 i = 0; i < fModel->CountDepots(); i++) { DepotInfoRef depot = fModel->DepotAtIndex(i); BString depotUrl = depot->URL(); if (identifier == depotUrl) _SetupRepositoryData(depot, repository, repositorySource); } } } void DepotMatchingRepositoryListener::Handle(DumpExportRepository* repository, DumpExportRepositorySource* repositorySource) { if (!repositorySource->IdentifierIsNull()) Handle(*(repositorySource->Identifier()), repository, repositorySource); // there may be additional identifiers for the remote repository and // these should also be taken into consideration. for(int32 i = 0; i < repositorySource->CountExtraIdentifiers(); i++) { Handle(*(repositorySource->ExtraIdentifiersItemAt(i)), repository, repositorySource); } } bool DepotMatchingRepositoryListener::Handle(DumpExportRepository* repository) { int32 i; for (i = 0; i < repository->CountRepositorySources(); i++) Handle(repository, repository->RepositorySourcesItemAt(i)); return !fStoppable->WasStopped(); } void DepotMatchingRepositoryListener::Complete() { } ServerRepositoryDataUpdateProcess::ServerRepositoryDataUpdateProcess( Model* model, uint32 serverProcessOptions) : AbstractSingleFileServerProcess(serverProcessOptions), fModel(model) { } ServerRepositoryDataUpdateProcess::~ServerRepositoryDataUpdateProcess() { } const char* ServerRepositoryDataUpdateProcess::Name() const { return "ServerRepositoryDataUpdateProcess"; } const char* ServerRepositoryDataUpdateProcess::Description() const { return B_TRANSLATE("Synchronizing meta-data about repositories"); } BString ServerRepositoryDataUpdateProcess::UrlPathComponent() { BString result; AutoLocker<BLocker> locker(fModel->Lock()); result.SetToFormat("/__repository/all-%s.json.gz", fModel->Language()->PreferredLanguage()->Code()); return result; } status_t ServerRepositoryDataUpdateProcess::GetLocalPath(BPath& path) const { AutoLocker<BLocker> locker(fModel->Lock()); return fModel->DumpExportRepositoryDataPath(path); } status_t ServerRepositoryDataUpdateProcess::ProcessLocalData() { DepotMatchingRepositoryListener* itemListener = new DepotMatchingRepositoryListener(fModel, this); ObjectDeleter<DepotMatchingRepositoryListener> itemListenerDeleter(itemListener); BulkContainerDumpExportRepositoryJsonListener* listener = new BulkContainerDumpExportRepositoryJsonListener(itemListener); ObjectDeleter<BulkContainerDumpExportRepositoryJsonListener> listenerDeleter(listener); BPath localPath; status_t result = GetLocalPath(localPath); if (result != B_OK) return result; result = ParseJsonFromFileWithListener(listener, localPath); if (result != B_OK) return result; return listener->ErrorStatus(); } status_t ServerRepositoryDataUpdateProcess::GetStandardMetaDataPath(BPath& path) const { return GetLocalPath(path); } void ServerRepositoryDataUpdateProcess::GetStandardMetaDataJsonPath( BString& jsonPath) const { jsonPath.SetTo("$.info"); }
24.449799
77
0.767247
[ "model" ]
4175e763e21572c17f0e5c17d053f181c7b3b8df
20,131
cpp
C++
src/multicast/MulticastComponent.cpp
cd606/tm_transport
58a338a7a90608703ab6a13092be75bcc5e8ea2e
[ "Apache-2.0" ]
1
2020-05-22T08:47:03.000Z
2020-05-22T08:47:03.000Z
src/multicast/MulticastComponent.cpp
cd606/tm_transport
58a338a7a90608703ab6a13092be75bcc5e8ea2e
[ "Apache-2.0" ]
null
null
null
src/multicast/MulticastComponent.cpp
cd606/tm_transport
58a338a7a90608703ab6a13092be75bcc5e8ea2e
[ "Apache-2.0" ]
null
null
null
#include <thread> #include <mutex> #include <cstring> #include <unordered_map> #include <boost/asio.hpp> #include <boost/bind/bind.hpp> #include <tm_kit/transport/multicast/MulticastComponent.hpp> namespace dev { namespace cd606 { namespace tm { namespace transport { namespace multicast { enum class MulticastComponentTopicEncodingChoice { CBOR , BinaryAdHoc }; MulticastComponentTopicEncodingChoice parseEncodingChoice(std::string const &s) { if (s == "binary" || s == "binary-adhoc") { return MulticastComponentTopicEncodingChoice::BinaryAdHoc; } else { return MulticastComponentTopicEncodingChoice::CBOR; } } class MulticastComponentImpl { private: class OneMulticastSubscription { private: MulticastComponentTopicEncodingChoice encodingChoice_; ConnectionLocator locator_; boost::asio::ip::udp::socket sock_; boost::asio::ip::udp::endpoint senderPoint_; boost::asio::ip::address mcastAddr_; std::array<char, 16*1024*1024> buffer_; struct ClientCB { uint32_t id; std::function<void(basic::ByteDataWithTopic &&)> cb; std::optional<WireToUserHook> hook; }; std::vector<ClientCB> noFilterClients_; std::vector<std::tuple<std::string, ClientCB>> stringMatchClients_; std::vector<std::tuple<std::regex, ClientCB>> regexMatchClients_; std::optional<std::thread::native_handle_type> thHandle_; std::mutex mutex_; std::atomic<bool> running_; inline void callClient(ClientCB const &c, basic::ByteDataWithTopic &&d) { if (c.hook) { auto b = (c.hook->hook)(basic::ByteDataView {std::string_view(d.content)}); if (b) { c.cb({std::move(d.topic), std::move(b->content)}); } } else { c.cb(std::move(d)); } } void handleReceive(boost::system::error_code const &err, size_t bytesReceived) { if (!running_) { return; } if (!err) { std::optional<std::tuple<basic::ByteDataWithTopic, std::size_t>> parseRes; if (encodingChoice_ == MulticastComponentTopicEncodingChoice::CBOR) { parseRes = basic::bytedata_utils::RunCBORDeserializer<basic::ByteDataWithTopic>::apply(std::string_view {buffer_.data(), bytesReceived}, 0); } else { if (bytesReceived < sizeof(uint32_t)) { parseRes = std::nullopt; } else { uint32_t topicLen; std::memcpy(&topicLen, buffer_.data(), sizeof(uint32_t)); if (bytesReceived < topicLen+sizeof(uint32_t)) { parseRes = std::nullopt; } else { basic::ByteDataWithTopic res; res.topic.resize(topicLen); std::memcpy(res.topic.data(), buffer_.data()+sizeof(uint32_t), topicLen); res.content.resize(bytesReceived-sizeof(uint32_t)-topicLen); std::memcpy(res.content.data(), buffer_.data()+sizeof(uint32_t)+topicLen, bytesReceived-sizeof(uint32_t)-topicLen); parseRes = std::tuple<basic::ByteDataWithTopic, std::size_t> { std::move(res) , bytesReceived }; } } } if (parseRes && std::get<1>(*parseRes) == bytesReceived) { basic::ByteDataWithTopic data = std::move(std::get<0>(*parseRes)); std::lock_guard<std::mutex> _(mutex_); for (auto const &f : noFilterClients_) { callClient(f, std::move(data)); } for (auto const &f : stringMatchClients_) { if (data.topic == std::get<0>(f)) { callClient(std::get<1>(f), std::move(data)); } } for (auto const &f : regexMatchClients_) { if (std::regex_match(data.topic, std::get<0>(f))) { callClient(std::get<1>(f), std::move(data)); } } } sock_.async_receive_from( boost::asio::buffer(buffer_.data(), buffer_.size()) , senderPoint_ , boost::bind(&OneMulticastSubscription::handleReceive , this , boost::asio::placeholders::error , boost::asio::placeholders::bytes_transferred) ); } } public: OneMulticastSubscription(MulticastComponentTopicEncodingChoice encodingChoice, boost::asio::io_service *service, ConnectionLocator const &locator) : encodingChoice_(encodingChoice), locator_(locator), sock_(*service), senderPoint_(), mcastAddr_(), buffer_() , noFilterClients_(), stringMatchClients_(), regexMatchClients_() , thHandle_() , mutex_(), running_(true) { boost::asio::ip::udp::resolver resolver(*service); { boost::asio::ip::udp::resolver::query query("0.0.0.0", std::to_string(locator.port())); boost::asio::ip::udp::endpoint listenPoint = resolver.resolve(query)->endpoint(); sock_.open(listenPoint.protocol()); sock_.set_option(boost::asio::ip::udp::socket::reuse_address(true)); sock_.set_option(boost::asio::ip::udp::socket::receive_buffer_size(16*1024*1024)); sock_.bind(listenPoint); } { boost::asio::ip::udp::resolver::query query(locator.host(), std::to_string(locator.port())); mcastAddr_ = resolver.resolve(query)->endpoint().address(); sock_.set_option(boost::asio::ip::multicast::join_group( mcastAddr_ )); } sock_.async_receive_from( boost::asio::buffer(buffer_.data(), buffer_.size()) , senderPoint_ , boost::bind(&OneMulticastSubscription::handleReceive , this , boost::asio::placeholders::error , boost::asio::placeholders::bytes_transferred) ); } ~OneMulticastSubscription() { running_ = false; sock_.close(); } ConnectionLocator const &locator() const { return locator_; } void addSubscription( uint32_t id , std::variant<MulticastComponent::NoTopicSelection, std::string, std::regex> const &topic , std::function<void(basic::ByteDataWithTopic &&)> handler , std::optional<WireToUserHook> wireToUserHook ) { std::lock_guard<std::mutex> _(mutex_); switch (topic.index()) { case 0: noFilterClients_.push_back({id, handler, wireToUserHook}); break; case 1: stringMatchClients_.push_back({std::get<std::string>(topic), {id, handler, wireToUserHook}}); break; case 2: regexMatchClients_.push_back({std::get<std::regex>(topic), {id, handler, wireToUserHook}}); break; default: break; } } void removeSubscription(uint32_t id) { std::lock_guard<std::mutex> _(mutex_); noFilterClients_.erase( std::remove_if( noFilterClients_.begin() , noFilterClients_.end() , [id](auto const &x) { return x.id == id; }) , noFilterClients_.end() ); stringMatchClients_.erase( std::remove_if( stringMatchClients_.begin() , stringMatchClients_.end() , [id](auto const &x) { return std::get<1>(x).id == id; }) , stringMatchClients_.end() ); regexMatchClients_.erase( std::remove_if( regexMatchClients_.begin() , regexMatchClients_.end() , [id](auto const &x) { return std::get<1>(x).id == id; }) , regexMatchClients_.end() ); } bool checkWhetherNeedsToStop() { std::lock_guard<std::mutex> _(mutex_); if (noFilterClients_.empty() && stringMatchClients_.empty() && regexMatchClients_.empty()) { running_ = false; sock_.set_option(boost::asio::ip::multicast::leave_group( mcastAddr_ )); return true; } else { return false; } } void setThreadHandle(std::thread::native_handle_type h) { std::lock_guard<std::mutex> _(mutex_); thHandle_ = h; } std::optional<std::thread::native_handle_type> getThreadHandle() { std::lock_guard<std::mutex> _(mutex_); return thHandle_; } }; std::unordered_map<ConnectionLocator, std::unique_ptr<OneMulticastSubscription>> subscriptions_; class OneMulticastSender { private: MulticastComponentTopicEncodingChoice encodingChoice_; boost::asio::ip::udp::socket sock_; boost::asio::ip::udp::endpoint destination_; std::mutex mutex_; int ttl_; void handleSend(boost::system::error_code const &) { } public: OneMulticastSender(MulticastComponentTopicEncodingChoice encodingChoice, boost::asio::io_service *service, ConnectionLocator const &locator) : encodingChoice_(encodingChoice), sock_(*service), destination_(), mutex_(), ttl_(0) { boost::asio::ip::udp::resolver resolver(*service); boost::asio::ip::udp::resolver::query query(locator.host(), std::to_string(locator.port())); destination_ = resolver.resolve(query)->endpoint(); sock_.open(destination_.protocol()); sock_.set_option(boost::asio::ip::udp::socket::reuse_address(true)); sock_.set_option(boost::asio::ip::udp::socket::send_buffer_size(16*1024*1024)); } ~OneMulticastSender() { sock_.close(); } void publish(basic::ByteDataWithTopic &&data, int ttl) { std::string v; if (encodingChoice_ == MulticastComponentTopicEncodingChoice::CBOR) { v = basic::bytedata_utils::RunCBORSerializer<basic::ByteDataWithTopic>::apply(data); } else { v.resize(sizeof(uint32_t)+data.topic.length()+data.content.length()); char *p = v.data(); uint32_t topicLen = (uint32_t) (data.topic.length()); std::memcpy(p, &topicLen, sizeof(uint32_t)); std::memcpy(p+sizeof(uint32_t), data.topic.data(), topicLen); std::memcpy(p+sizeof(uint32_t)+topicLen, data.content.data(), data.content.length()); } std::lock_guard<std::mutex> _(mutex_); if (ttl != ttl_) { sock_.set_option(boost::asio::ip::multicast::hops(ttl)); ttl_ = ttl; } sock_.async_send_to( boost::asio::buffer(reinterpret_cast<const char *>(v.data()), v.size()) , destination_ , boost::bind(&OneMulticastSender::handleSend, this, boost::asio::placeholders::error) ); } }; std::unordered_map<ConnectionLocator, std::unique_ptr<OneMulticastSender>> senders_; boost::asio::io_service senderService_; std::thread senderThread_; std::mutex mutex_; bool senderThreadStarted_; uint32_t counter_; std::unordered_map<uint32_t, OneMulticastSubscription *> idToSubscriptionMap_; std::mutex idMutex_; OneMulticastSubscription *getOrStartSubscription(ConnectionLocator const &d) { ConnectionLocator hostAndPort {d.host(), d.port()}; std::lock_guard<std::mutex> _(mutex_); auto iter = subscriptions_.find(hostAndPort); if (iter == subscriptions_.end()) { auto choice = parseEncodingChoice(d.query("envelop", "cbor")); std::unique_ptr<boost::asio::io_service> svc = std::make_unique<boost::asio::io_service>(); iter = subscriptions_.insert({hostAndPort, std::make_unique<OneMulticastSubscription>(choice, svc.get(), hostAndPort)}).first; std::thread th([svc=std::move(svc)] { boost::asio::io_service::work work(*svc); svc->run(); }); th.detach(); iter->second->setThreadHandle(th.native_handle()); } return iter->second.get(); } void potentiallyStopSubscription(OneMulticastSubscription *p) { std::lock_guard<std::mutex> _(mutex_); if (p->checkWhetherNeedsToStop()) { subscriptions_.erase(p->locator()); } } OneMulticastSender *getOrStartSender(ConnectionLocator const &d) { ConnectionLocator hostAndPort {d.host(), d.port()}; std::lock_guard<std::mutex> _(mutex_); if (!senderThreadStarted_) { senderThread_ = std::thread([this]() { boost::asio::io_service::work work(senderService_); senderService_.run(); }); senderThreadStarted_ = true; } auto iter = senders_.find(hostAndPort); if (iter == senders_.end()) { auto choice = parseEncodingChoice(d.query("envelop", "cbor")); iter = senders_.insert({hostAndPort, std::make_unique<OneMulticastSender>(choice, &senderService_, hostAndPort)}).first; } return iter->second.get(); } public: MulticastComponentImpl() : subscriptions_(), senders_(), senderService_(), senderThread_(), mutex_(), senderThreadStarted_(false) , counter_(0), idToSubscriptionMap_(), idMutex_() { } ~MulticastComponentImpl() { bool b; { std::lock_guard<std::mutex> _(mutex_); subscriptions_.clear(); senders_.clear(); b = senderThreadStarted_; } if (b) { senderService_.stop(); try { senderThread_.join(); } catch (std::system_error const &) { } } } uint32_t addSubscriptionClient(ConnectionLocator const &locator, std::variant<MulticastComponent::NoTopicSelection, std::string, std::regex> const &topic, std::function<void(basic::ByteDataWithTopic &&)> client, std::optional<WireToUserHook> wireToUserHook) { auto *p = getOrStartSubscription(locator); { std::lock_guard<std::mutex> _(idMutex_); ++counter_; p->addSubscription(counter_, topic, client, wireToUserHook); idToSubscriptionMap_[counter_] = p; return counter_; } } void removeSubscriptionClient(uint32_t id) { OneMulticastSubscription *p = nullptr; { std::lock_guard<std::mutex> _(idMutex_); auto iter = idToSubscriptionMap_.find(id); if (iter == idToSubscriptionMap_.end()) { return; } p = iter->second; idToSubscriptionMap_.erase(iter); } if (p != nullptr) { p->removeSubscription(id); potentiallyStopSubscription(p); } } std::function<void(basic::ByteDataWithTopic &&, int)> getPublisher(ConnectionLocator const &locator, std::optional<UserToWireHook> userToWireHook) { auto *p = getOrStartSender(locator); if (userToWireHook) { auto hook = userToWireHook->hook; return [p,hook](basic::ByteDataWithTopic &&data, int ttl) { auto w = hook(basic::ByteData {std::move(data.content)}); p->publish({std::move(data.topic), std::move(w.content)}, ttl); }; } else { return [p](basic::ByteDataWithTopic &&data, int ttl) { p->publish(std::move(data), ttl); }; } } std::unordered_map<ConnectionLocator, std::thread::native_handle_type> threadHandles() { std::unordered_map<ConnectionLocator, std::thread::native_handle_type> retVal; std::lock_guard<std::mutex> _(mutex_); if (senderThreadStarted_) { retVal[ConnectionLocator()] = senderThread_.native_handle(); } for (auto &item : subscriptions_) { auto h = item.second->getThreadHandle(); if (h) { retVal[item.first] = *h; } } return retVal; } }; MulticastComponent::MulticastComponent() : impl_(std::make_unique<MulticastComponentImpl>()) {} MulticastComponent::~MulticastComponent() {} uint32_t MulticastComponent::multicast_addSubscriptionClient(ConnectionLocator const &locator, std::variant<MulticastComponent::NoTopicSelection, std::string, std::regex> const &topic, std::function<void(basic::ByteDataWithTopic &&)> client, std::optional<WireToUserHook> wireToUserHook) { return impl_->addSubscriptionClient(locator, topic, client, wireToUserHook); } void MulticastComponent::multicast_removeSubscriptionClient(uint32_t id) { impl_->removeSubscriptionClient(id); } std::function<void(basic::ByteDataWithTopic &&, int)> MulticastComponent::multicast_getPublisher(ConnectionLocator const &locator, std::optional<UserToWireHook> userToWireHook) { return impl_->getPublisher(locator, userToWireHook); } std::unordered_map<ConnectionLocator, std::thread::native_handle_type> MulticastComponent::multicast_threadHandles() { return impl_->threadHandles(); } } } } } }
46.707657
182
0.509761
[ "vector" ]
4176131f321d489ae839dd427327811c02a77d1e
1,587
cpp
C++
rancha-imgui/Account.cpp
towbes/rancha
156c69ca298d489cd660ee7ab2ba96bdec455e44
[ "MIT" ]
null
null
null
rancha-imgui/Account.cpp
towbes/rancha
156c69ca298d489cd660ee7ab2ba96bdec455e44
[ "MIT" ]
null
null
null
rancha-imgui/Account.cpp
towbes/rancha
156c69ca298d489cd660ee7ab2ba96bdec455e44
[ "MIT" ]
1
2022-01-03T16:46:02.000Z
2022-01-03T16:46:02.000Z
#include "Account.h" Account::Account() { acctName = L""; acctPassword = L""; charList; } Account::Account(std::wstring name, std::wstring pass) { acctName = name; acctPassword = pass; charList; } std::wstring Account::GetAcctName() { return acctName; } std::wstring Account::GetAcctPassword() { return acctPassword; } void Account::SetAcctPassword(std::wstring pass) { acctPassword = pass; } std::vector<Character> Account::GetChars() { return charList; } void Account::AddCharacter(Character character) { charList.push_back(character); } Character::Character() { charName = L""; server = 0; realm = 0; } Character::Character(std::wstring name, int serv, int rlm) { charName = name; server = serv; realm = rlm; } std::wstring Character::GetName() { return charName; } int Character::GetServer() { return server; } int Character::GetRealm() { return realm; } TeamMember::TeamMember() { acct; charIndex = 0; } TeamMember::TeamMember(Account acctname, int charlistIndex) { acct = acctname; charIndex = charlistIndex; } Account TeamMember::GetAccount() { return acct; } int TeamMember::GetCharIndex() { return charIndex; } Team::Team() { teamName = L""; members; } Team::Team(std::vector<TeamMember> memberlist, std::wstring name) { teamName = name; members = memberlist; } std::wstring Team::GetName() { return teamName; } void Team::ChangeName(std::wstring newname) { teamName = newname; } std::vector<TeamMember> Team::GetMembers() { return members; } void Team::AddMember(TeamMember newmember) { members.push_back(newmember); }
16.360825
67
0.699433
[ "vector" ]
417fa5cea504c3eb12b1327d67bbe38b1e0a9df1
59,450
cpp
C++
src/Etterna/Screen/Gameplay/ScreenGameplay.cpp
thenerdie/etterna
341b7c506c785e3a15e7af18814791aefff5c958
[ "MIT" ]
null
null
null
src/Etterna/Screen/Gameplay/ScreenGameplay.cpp
thenerdie/etterna
341b7c506c785e3a15e7af18814791aefff5c958
[ "MIT" ]
null
null
null
src/Etterna/Screen/Gameplay/ScreenGameplay.cpp
thenerdie/etterna
341b7c506c785e3a15e7af18814791aefff5c958
[ "MIT" ]
null
null
null
#include "Etterna/Globals/global.h" #include "Etterna/Actor/Base/ActorUtil.h" #include "Etterna/Models/Misc/AdjustSync.h" #include "Etterna/Actor/Gameplay/ArrowEffects.h" #include "Etterna/Actor/Gameplay/Background.h" #include "Etterna/Models/Misc/CommonMetrics.h" #include "Etterna/Models/Misc/Foreach.h" #include "Etterna/Actor/Gameplay/Foreground.h" #include "Etterna/Models/Misc/Game.h" #include "Etterna/Models/Misc/GameConstantsAndTypes.h" #include "Etterna/Singletons/GameManager.h" #include "Etterna/Models/Misc/GamePreferences.h" #include "Etterna/Singletons/GameSoundManager.h" #include "Etterna/Singletons/GameState.h" #include "Etterna/Actor/Gameplay/LifeMeter.h" #include "Etterna/Actor/Gameplay/LifeMeterBar.h" #include "Etterna/Models/Lua/LuaBinding.h" #include "Etterna/Singletons/LuaManager.h" #include "Etterna/Models/Misc/LyricsLoader.h" #include "Etterna/Singletons/NetworkSyncManager.h" #include "Etterna/Models/NoteData/NoteDataUtil.h" #include "Etterna/Models/NoteData/NoteDataWithScoring.h" #include "Etterna/Actor/Gameplay/Player.h" #include "Etterna/Models/Misc/PlayerAI.h" #include "Etterna/Models/Misc/PlayerState.h" #include "Etterna/Singletons/PrefsManager.h" #include "Etterna/Models/Misc/Profile.h" #include "Etterna/Singletons/ProfileManager.h" #include "RageUtil/Misc/RageLog.h" #include "RageUtil/Sound/RageSoundReader.h" #include "RageUtil/Misc/RageTimer.h" #include "Etterna/Models/ScoreKeepers/ScoreKeeperNormal.h" #include "Etterna/Models/Misc/ScreenDimensions.h" #include "ScreenGameplay.h" #include "Etterna/Singletons/ScreenManager.h" #include "Etterna/Screen/Others/ScreenSaveSync.h" #include "Etterna/Models/Songs/Song.h" #include "Etterna/Singletons/SongManager.h" #include "Etterna/Models/Songs/SongUtil.h" #include "Etterna/Singletons/StatsManager.h" #include "Etterna/Models/StepsAndStyles/Steps.h" #include "Etterna/Actor/GameplayAndMenus/StepsDisplay.h" #include "Etterna/Models/StepsAndStyles/Style.h" #include "Etterna/Singletons/ThemeManager.h" #include "Etterna/Models/Misc/ThemeMetric.h" #include "Etterna/FileTypes/XmlFile.h" #include "Etterna/FileTypes/XmlFileUtil.h" #include "Etterna/Singletons/DownloadManager.h" #include "Etterna/Singletons/ScoreManager.h" #include "Etterna/Models/Misc/PlayerInfo.h" #define SONG_POSITION_METER_WIDTH \ THEME->GetMetricF(m_sName, "SongPositionMeterWidth") static ThemeMetric<float> INITIAL_BACKGROUND_BRIGHTNESS( "ScreenGameplay", "InitialBackgroundBrightness"); static ThemeMetric<float> SECONDS_BETWEEN_COMMENTS("ScreenGameplay", "SecondsBetweenComments"); AutoScreenMessage(SM_PlayGo); // received while STATE_DANCING AutoScreenMessage(SM_LoadNextSong); AutoScreenMessage(SM_StartLoadingNextSong); // received while STATE_OUTRO AutoScreenMessage(SM_DoPrevScreen); AutoScreenMessage(SM_DoNextScreen); // received while STATE_INTRO AutoScreenMessage(SM_StartHereWeGo); AutoScreenMessage(SM_StopHereWeGo); // related to battle mode for triggering announcer stuff AutoScreenMessage(SM_BattleTrickLevel1); AutoScreenMessage(SM_BattleTrickLevel2); AutoScreenMessage(SM_BattleTrickLevel3); static Preference<bool> g_bCenter1Player("Center1Player", true); static Preference<bool> g_bShowLyrics("ShowLyrics", false); ScreenGameplay::ScreenGameplay() { m_pSongBackground = NULL; m_pSongForeground = NULL; m_delaying_ready_announce = false; // Tell DownloadManager we are in Gameplay DLMAN->UpdateDLSpeed(true); // Unload all Replay Data to prevent some things (if not replaying) if (GamePreferences::m_AutoPlay != PC_REPLAY) { LOG->Trace("Unloading excess data."); SCOREMAN->UnloadAllReplayData(); } m_DancingState = STATE_INTRO; m_fTimeSinceLastDancingComment = 0.f; m_bShowScoreboard = false; m_gave_up = false; m_bZeroDeltaOnNextUpdate = false; m_pSoundMusic = NULL; } void ScreenGameplay::Init() { SubscribeToMessage("Judgment"); // Load some stuff from metrics ... for now. PLAYER_TYPE.Load(m_sName, "PlayerType"); PLAYER_INIT_COMMAND.Load(m_sName, "PlayerInitCommand"); GIVE_UP_START_TEXT.Load(m_sName, "GiveUpStartText"); GIVE_UP_BACK_TEXT.Load(m_sName, "GiveUpBackText"); GIVE_UP_ABORTED_TEXT.Load(m_sName, "GiveUpAbortedText"); SKIP_SONG_TEXT.Load(m_sName, "SkipSongText"); GIVE_UP_SECONDS.Load(m_sName, "GiveUpSeconds"); MUSIC_FADE_OUT_SECONDS.Load(m_sName, "MusicFadeOutSeconds"); OUT_TRANSITION_LENGTH.Load(m_sName, "OutTransitionLength"); BEGIN_FAILED_DELAY.Load(m_sName, "BeginFailedDelay"); MIN_SECONDS_TO_STEP.Load(m_sName, "MinSecondsToStep"); MIN_SECONDS_TO_MUSIC.Load(m_sName, "MinSecondsToMusic"); MIN_SECONDS_TO_STEP_NEXT_SONG.Load(m_sName, "MinSecondsToStepNextSong"); if (UseSongBackgroundAndForeground()) { m_pSongBackground = new Background; m_pSongForeground = new Foreground; } ScreenWithMenuElements::Init(); // Tells the screen what player we are using // specifically Normal, Practice, or Replay this->FillPlayerInfo(&m_vPlayerInfo); m_pSoundMusic = NULL; // Prevent some crashes // This happens when the screen changes but we dont have a song (obviously) if (GAMESTATE->m_pCurSong == NULL) return; /* Called once per stage (single song or single course). */ GAMESTATE->BeginStage(); // Starting gameplay, make sure Gamestate doesn't think we are paused // because we ... don't start paused. GAMESTATE->SetPaused(false); // Make sure we have NoteData to play unsigned int count = m_vPlayerInfo.m_vpStepsQueue.size(); for (unsigned int i = 0; i < count; i++) { Steps* curSteps = m_vPlayerInfo.m_vpStepsQueue[i]; if (curSteps->IsNoteDataEmpty()) { if (curSteps->GetNoteDataFromSimfile()) { LOG->Trace("Notes should be loaded for player 1"); } else { LOG->Trace("Error loading notes for player 1"); } } } ASSERT(GAMESTATE->m_pCurSteps.Get() != NULL); // Doesn't technically do anything for now // Since playmodes/courses are gone STATSMAN->m_CurStageStats.m_playMode = GAMESTATE->m_PlayMode; STATSMAN->m_CurStageStats.m_player.m_pStyle = GAMESTATE->GetCurrentStyle(PLAYER_1); /* Record combo rollover. */ m_vPlayerInfo.GetPlayerStageStats()->UpdateComboList(0, true); m_DancingState = STATE_INTRO; m_bZeroDeltaOnNextUpdate = false; if (m_pSongBackground != nullptr) { m_pSongBackground->SetName("SongBackground"); m_pSongBackground->SetDrawOrder(DRAW_ORDER_BEFORE_EVERYTHING); ActorUtil::LoadAllCommands(*m_pSongBackground, m_sName); this->AddChild(m_pSongBackground); } if (m_pSongForeground != nullptr) { m_pSongForeground->SetName("SongForeground"); m_pSongForeground->SetDrawOrder( DRAW_ORDER_OVERLAY + 1); // on top of the overlay, but under transitions ActorUtil::LoadAllCommands(*m_pSongForeground, m_sName); this->AddChild(m_pSongForeground); } m_Toasty.Load(THEME->GetPathB(m_sName, "toasty")); this->AddChild(&m_Toasty); // // // Start a bunch of stuff to make sure the Notefield is placed correctly // // Use the margin function to calculate where the notefields should be and // what size to zoom them to. This way, themes get margins to put cut-ins // in, and the engine can have players on different styles without the // notefields overlapping. -Kyz LuaReference margarine; float margins[2] = { 40, 40 }; THEME->GetMetric(m_sName, "MarginFunction", margarine); if (margarine.GetLuaType() != LUA_TFUNCTION) { LuaHelpers::ReportScriptErrorFmt( "MarginFunction metric for %s must be a function.", m_sName.c_str()); } else { Lua* L = LUA->Get(); margarine.PushSelf(L); lua_createtable(L, 0, 0); int next_player_slot = 1; Enum::Push(L, PLAYER_1); lua_rawseti(L, -2, next_player_slot); ++next_player_slot; Enum::Push(L, GAMESTATE->GetCurrentStyle(PLAYER_INVALID)->m_StyleType); RString err = "Error running MarginFunction: "; if (LuaHelpers::RunScriptOnStack(L, err, 2, 3, true)) { RString marge = "Margin value must be a number."; margins[0] = static_cast<float>(SafeFArg(L, -3, marge, 40)); float center = static_cast<float>(SafeFArg(L, -2, marge, 80)); margins[1] = center / 2.0f; } lua_settop(L, 0); LUA->Release(L); } float left_edge = 0.0f; RString sName("PlayerP1"); m_vPlayerInfo.m_pPlayer->SetName(sName); Style const* style = GAMESTATE->GetCurrentStyle(PLAYER_1); float style_width = style->GetWidth(PLAYER_1); float edge = left_edge; float screen_space; float field_space; float left_marge; float right_marge; screen_space = SCREEN_WIDTH / 2.0f; left_marge = margins[0]; right_marge = margins[1]; field_space = screen_space - left_marge - right_marge; float player_x = edge + left_marge + (field_space / 2.0f); m_vPlayerInfo.GetPlayerState()->m_NotefieldZoom = 1.f; if (!Center1Player()) m_vPlayerInfo.m_pPlayer->SetX(player_x); else m_vPlayerInfo.m_pPlayer->SetX(SCREEN_CENTER_X); m_vPlayerInfo.m_pPlayer->RunCommands(PLAYER_INIT_COMMAND); // ActorUtil::LoadAllCommands(m_vPlayerInfo.m_pPlayer, m_sName); this->AddChild(m_vPlayerInfo.m_pPlayer); m_vPlayerInfo.m_pPlayer->PlayCommand("On"); // // // // m_NextSong.Load(THEME->GetPathB(m_sName, "next course song")); m_NextSong.SetDrawOrder(DRAW_ORDER_TRANSITIONS - 1); this->AddChild(&m_NextSong); // Multiplayer-specific gameplay check if (GAMESTATE->m_bPlayingMulti) NSMAN->StartRequest(0); // Add individual life meter switch (GAMESTATE->m_PlayMode) { case PLAY_MODE_REGULAR: if (!GAMESTATE->IsPlayerEnabled(m_vPlayerInfo.m_pn) || m_sName == "ScreenGameplaySyncMachine") break; m_vPlayerInfo.m_pLifeMeter = LifeMeter::MakeLifeMeter(m_vPlayerInfo.GetPlayerState() ->m_PlayerOptions.GetStage() .m_LifeType); m_vPlayerInfo.m_pLifeMeter->Load( m_vPlayerInfo.GetPlayerState(), m_vPlayerInfo.GetPlayerStageStats()); m_vPlayerInfo.m_pLifeMeter->SetName( ssprintf("Life%s", m_vPlayerInfo.GetName().c_str())); LOAD_ALL_COMMANDS_AND_SET_XY(m_vPlayerInfo.m_pLifeMeter); this->AddChild(m_vPlayerInfo.m_pLifeMeter); break; default: break; } // For multi scoreboard; may be used in the future m_bShowScoreboard = false; if (g_bShowLyrics) { m_LyricDisplay.SetName("LyricDisplay"); LOAD_ALL_COMMANDS(m_LyricDisplay); this->AddChild(&m_LyricDisplay); } m_Ready.Load(THEME->GetPathB(m_sName, "ready")); this->AddChild(&m_Ready); m_Go.Load(THEME->GetPathB(m_sName, "go")); this->AddChild(&m_Go); m_Failed.Load(THEME->GetPathB(m_sName, "failed")); m_Failed.SetDrawOrder(DRAW_ORDER_TRANSITIONS - 1); // on top of everything else this->AddChild(&m_Failed); m_textDebug.LoadFromFont(THEME->GetPathF(m_sName, "debug")); m_textDebug.SetName("Debug"); LOAD_ALL_COMMANDS_AND_SET_XY(m_textDebug); m_textDebug.SetDrawOrder(DRAW_ORDER_TRANSITIONS - 1); // just under transitions, over the foreground this->AddChild(&m_textDebug); m_GameplayAssist.Init(); if (m_pSongBackground != nullptr) m_pSongBackground->Init(); RString sType = PLAYER_TYPE; if (m_vPlayerInfo.m_bIsDummy) sType += "Dummy"; m_vPlayerInfo.m_pPlayer->Init(sType, m_vPlayerInfo.GetPlayerState(), m_vPlayerInfo.GetPlayerStageStats(), m_vPlayerInfo.m_pLifeMeter, m_vPlayerInfo.m_pPrimaryScoreKeeper); // fill in m_apSongsQueue, m_vpStepsQueue, m_asModifiersQueue InitSongQueues(); // Fill StageStats STATSMAN->m_CurStageStats.m_vpPossibleSongs = m_apSongsQueue; if (m_vPlayerInfo.GetPlayerStageStats()) m_vPlayerInfo.GetPlayerStageStats()->m_vpPossibleSteps = m_vPlayerInfo.m_vpStepsQueue; ASSERT(!m_vPlayerInfo.m_vpStepsQueue.empty()); if (m_vPlayerInfo.GetPlayerStageStats()) m_vPlayerInfo.GetPlayerStageStats()->m_bJoined = true; if (m_vPlayerInfo.m_pPrimaryScoreKeeper) m_vPlayerInfo.m_pPrimaryScoreKeeper->Load(m_apSongsQueue, m_vPlayerInfo.m_vpStepsQueue); GAMESTATE->m_bGameplayLeadIn.Set(true); /* LoadNextSong first, since that positions some elements which need to be * positioned before we TweenOnScreen. */ LoadNextSong(); m_GiveUpTimer.SetZero(); m_gave_up = false; GAMESTATE->m_bRestartedGameplay = false; } bool ScreenGameplay::Center1Player() const { return g_bCenter1Player; } // fill in m_apSongsQueue, m_vpStepsQueue, m_asModifiersQueue void ScreenGameplay::InitSongQueues() { m_apSongsQueue.push_back(GAMESTATE->m_pCurSong); Steps* pSteps = GAMESTATE->m_pCurSteps; m_vPlayerInfo.m_vpStepsQueue.push_back(pSteps); if (GAMESTATE->IsPlaylistCourse()) { m_apSongsQueue.clear(); m_vPlayerInfo.m_vpStepsQueue.clear(); Playlist& pl = SONGMAN->GetPlaylists()[SONGMAN->playlistcourse]; FOREACH(Chart, pl.chartlist, ch) { m_apSongsQueue.emplace_back(ch->songptr); m_vPlayerInfo.m_vpStepsQueue.emplace_back(ch->stepsptr); ratesqueue.emplace_back(ch->rate); } } } ScreenGameplay::~ScreenGameplay() { if (this->IsFirstUpdate()) { /* We never received any updates. That means we were deleted without * being used, and never actually played. (This can happen when backing * out of ScreenStage.) Cancel the stage. */ GAMESTATE->CancelStage(); } if (PREFSMAN->m_verbose_log > 1) LOG->Trace("ScreenGameplay::~ScreenGameplay()"); SAFE_DELETE(m_pSongBackground); SAFE_DELETE(m_pSongForeground); if (m_pSoundMusic != nullptr) m_pSoundMusic->StopPlaying(); m_GameplayAssist.StopPlaying(); // If we didn't just restart gameplay... if (!GAMESTATE->m_bRestartedGameplay) { // Tell Multiplayer we ended the song if (GAMESTATE->m_bPlayingMulti) NSMAN->ReportSongOver(); // Tell DownloadManager we aren't in Gameplay DLMAN->UpdateDLSpeed(false); GAMESTATE->m_gameplayMode.Set(GameplayMode_Normal); GAMESTATE->TogglePracticeMode(false); } // Always unpause when exiting gameplay (or restarting) GAMESTATE->SetPaused(false); } void ScreenGameplay::SetupNoteDataFromRow(Steps* pSteps, int row) { NoteData originalNoteData; pSteps->GetNoteData(originalNoteData); const Style* pStyle = GAMESTATE->GetCurrentStyle(m_vPlayerInfo.m_pn); NoteData ndTransformed; pStyle->GetTransformedNoteDataForStyle( m_vPlayerInfo.GetStepsAndTrailIndex(), originalNoteData, ndTransformed); m_vPlayerInfo.GetPlayerState()->Update(0); NoteDataUtil::RemoveAllButRange(ndTransformed, row, MAX_NOTE_ROW); // load player { m_vPlayerInfo.m_NoteData = ndTransformed; NoteDataUtil::RemoveAllTapsOfType(m_vPlayerInfo.m_NoteData, TapNoteType_AutoKeysound); m_vPlayerInfo.m_pPlayer->Reload(); } // load auto keysounds { NoteData nd = ndTransformed; NoteDataUtil::RemoveAllTapsExceptForType(nd, TapNoteType_AutoKeysound); m_AutoKeysounds.Load(m_vPlayerInfo.GetStepsAndTrailIndex(), nd); } { RString sType; switch (GAMESTATE->m_SongOptions.GetCurrent().m_SoundEffectType) { case SoundEffectType_Off: sType = "SoundEffectControl_Off"; break; case SoundEffectType_Speed: sType = "SoundEffectControl_Speed"; break; case SoundEffectType_Pitch: sType = "SoundEffectControl_Pitch"; break; default: break; } m_vPlayerInfo.m_SoundEffectControl.Load( sType, m_vPlayerInfo.GetPlayerState(), &m_vPlayerInfo.m_NoteData); } } void ScreenGameplay::SetupSong(int iSongIndex) { /* This is the first beat that can be changed without it being visible. * Until we draw for the first time, any beat can be changed. */ m_vPlayerInfo.GetPlayerState()->m_fLastDrawnBeat = -100; Steps* pSteps = m_vPlayerInfo.m_vpStepsQueue[iSongIndex]; GAMESTATE->m_pCurSteps.Set(pSteps); NoteData originalNoteData; pSteps->GetNoteData(originalNoteData); const Style* pStyle = GAMESTATE->GetCurrentStyle(m_vPlayerInfo.m_pn); NoteData ndTransformed; pStyle->GetTransformedNoteDataForStyle( m_vPlayerInfo.GetStepsAndTrailIndex(), originalNoteData, ndTransformed); m_vPlayerInfo.GetPlayerState()->Update(0); // load player { m_vPlayerInfo.m_NoteData = ndTransformed; NoteDataUtil::RemoveAllTapsOfType(m_vPlayerInfo.m_NoteData, TapNoteType_AutoKeysound); m_vPlayerInfo.m_pPlayer->Load(); } // load auto keysounds { NoteData nd = ndTransformed; NoteDataUtil::RemoveAllTapsExceptForType(nd, TapNoteType_AutoKeysound); m_AutoKeysounds.Load(m_vPlayerInfo.GetStepsAndTrailIndex(), nd); } { RString sType; switch (GAMESTATE->m_SongOptions.GetCurrent().m_SoundEffectType) { case SoundEffectType_Off: sType = "SoundEffectControl_Off"; break; case SoundEffectType_Speed: sType = "SoundEffectControl_Speed"; break; case SoundEffectType_Pitch: sType = "SoundEffectControl_Pitch"; break; default: break; } m_vPlayerInfo.m_SoundEffectControl.Load( sType, m_vPlayerInfo.GetPlayerState(), &m_vPlayerInfo.m_NoteData); } m_vPlayerInfo.GetPlayerState()->Update(0); // Hack: Course modifiers that are set to start immediately shouldn't // tween on. m_vPlayerInfo.GetPlayerState()->m_PlayerOptions.SetCurrentToLevel( ModsLevel_Stage); } void ScreenGameplay::ReloadCurrentSong() { m_vPlayerInfo.GetPlayerStageStats()->m_iSongsPlayed--; LoadNextSong(); } void ScreenGameplay::LoadNextSong() { // never allow input to remain redirected during gameplay unless an lua // script forces it when loaded below -mina SCREENMAN->set_input_redirected(m_vPlayerInfo.m_pn, false); GAMESTATE->ResetMusicStatistics(); m_vPlayerInfo.GetPlayerStageStats()->m_iSongsPlayed++; int iPlaySongIndex = GAMESTATE->GetCourseSongIndex(); iPlaySongIndex %= m_apSongsQueue.size(); GAMESTATE->m_pCurSong.Set(m_apSongsQueue[iPlaySongIndex]); // Check if the music actually exists, this is to avoid an issue in // AutoKeysounds.cpp, where the reader will ignore whether the file opener // function actually returned a valid object or an error. - Terra GAMESTATE->m_pCurSong.Get()->ReloadIfNoMusic(); STATSMAN->m_CurStageStats.m_vpPlayedSongs.push_back(GAMESTATE->m_pCurSong); SetupSong(iPlaySongIndex); Song* pSong = GAMESTATE->m_pCurSong; Steps* pSteps = GAMESTATE->m_pCurSteps; ++m_vPlayerInfo.GetPlayerStageStats()->m_iStepsPlayed; ASSERT(GAMESTATE->m_pCurSteps != NULL); if (m_vPlayerInfo.m_ptextStepsDescription) m_vPlayerInfo.m_ptextStepsDescription->SetText( pSteps->GetDescription()); if (m_vPlayerInfo.m_ptextPlayerOptions) m_vPlayerInfo.m_ptextPlayerOptions->SetText( m_vPlayerInfo.GetPlayerState() ->m_PlayerOptions.GetCurrent() .GetString()); if (m_vPlayerInfo.m_pStepsDisplay) m_vPlayerInfo.m_pStepsDisplay->SetFromSteps(pSteps); /* The actual note data for scoring is the base class of Player. This * includes transforms, like Wide. Otherwise, the scoring will operate * on the wrong data. */ if (m_vPlayerInfo.m_pPrimaryScoreKeeper) m_vPlayerInfo.m_pPrimaryScoreKeeper->OnNextSong( GAMESTATE->GetCourseSongIndex(), pSteps, &m_vPlayerInfo.m_pPlayer->GetNoteData()); // Don't mess with the PlayerController of the Dummy player if (!m_vPlayerInfo.m_bIsDummy) { if (GAMESTATE->IsCpuPlayer(m_vPlayerInfo.GetStepsAndTrailIndex())) { m_vPlayerInfo.GetPlayerState()->m_PlayerController = PC_CPU; int iMeter = pSteps->GetMeter(); int iNewSkill = SCALE(iMeter, MIN_METER, MAX_METER, 0, 5); /* Watch out: songs aren't actually bound by MAX_METER. */ iNewSkill = clamp(iNewSkill, 0, 5); m_vPlayerInfo.GetPlayerState()->m_iCpuSkill = iNewSkill; } else { if (m_vPlayerInfo.GetPlayerState() ->m_PlayerOptions.GetCurrent() .m_fPlayerAutoPlay != 0) m_vPlayerInfo.GetPlayerState()->m_PlayerController = PC_AUTOPLAY; else m_vPlayerInfo.GetPlayerState()->m_PlayerController = GamePreferences::m_AutoPlay; } } bool bAllReverse = true; bool bAtLeastOneReverse = false; if (m_vPlayerInfo.GetPlayerState() ->m_PlayerOptions.GetCurrent() .m_fScrolls[PlayerOptions::SCROLL_REVERSE] == 1) bAtLeastOneReverse = true; else bAllReverse = false; bool bReverse = m_vPlayerInfo.GetPlayerState() ->m_PlayerOptions.GetCurrent() .m_fScrolls[PlayerOptions::SCROLL_REVERSE] == 1; if (m_vPlayerInfo.m_pStepsDisplay) m_vPlayerInfo.m_pStepsDisplay->PlayCommand(bReverse ? "SetReverse" : "SetNoReverse"); m_LyricDisplay.PlayCommand(bAllReverse ? "SetReverse" : "SetNoReverse"); // Load lyrics // XXX: don't load this here (who and why? -aj) LyricsLoader LL; if (GAMESTATE->m_pCurSong->HasLyrics()) LL.LoadFromLRCFile(GAMESTATE->m_pCurSong->GetLyricsPath(), *GAMESTATE->m_pCurSong); // Set up song-specific graphics. if (m_pSongBackground != nullptr) m_pSongBackground->Unload(); if (m_pSongForeground != nullptr) m_pSongForeground->Unload(); // BeginnerHelper disabled, or failed to load. if (m_pSongBackground) m_pSongBackground->LoadFromSong(GAMESTATE->m_pCurSong); if (m_pSongBackground != nullptr) { m_pSongBackground->SetBrightness(INITIAL_BACKGROUND_BRIGHTNESS); m_pSongBackground->FadeToActualBrightness(); } if (!m_vPlayerInfo.GetPlayerStageStats()->m_bFailed) { // give a little life back between stages if (m_vPlayerInfo.m_pLifeMeter) m_vPlayerInfo.m_pLifeMeter->OnLoadSong(); } if (m_pSongForeground) m_pSongForeground->LoadFromSong(GAMESTATE->m_pCurSong); m_fTimeSinceLastDancingComment = 0; /* m_soundMusic and m_pSongBackground take a very long time to load, * so cap fDelta at 0 so m_NextSong will show up on screen. * -Chris */ m_bZeroDeltaOnNextUpdate = true; SCREENMAN->ZeroNextUpdate(); /* Load the music last, since it may start streaming and we don't want the * music to compete with other loading. */ m_AutoKeysounds.FinishLoading(); m_pSoundMusic = m_AutoKeysounds.GetSound(); /* Give SoundEffectControls the new RageSoundReaders. */ RageSoundReader* pPlayerSound = m_AutoKeysounds.GetPlayerSound(m_vPlayerInfo.m_pn); if (pPlayerSound == NULL && m_vPlayerInfo.m_pn == GAMESTATE->GetMasterPlayerNumber()) pPlayerSound = m_AutoKeysounds.GetSharedSound(); m_vPlayerInfo.m_SoundEffectControl.SetSoundReader(pPlayerSound); if (!GAMESTATE->GetPaused()) MESSAGEMAN->Broadcast("DoneLoadingNextSong"); } void ScreenGameplay::StartPlayingSong(float fMinTimeToNotes, float fMinTimeToMusic) { ASSERT(fMinTimeToNotes >= 0); ASSERT(fMinTimeToMusic >= 0); RageSoundParams p; p.m_fSpeed = GAMESTATE->m_SongOptions.GetCurrent().m_fMusicRate; p.StopMode = RageSoundParams::M_CONTINUE; p.m_bAccurateSync = true; { const float fFirstSecond = GAMESTATE->m_pCurSong->GetFirstSecond(); float fStartDelay = fMinTimeToNotes - fFirstSecond; fStartDelay = max(fStartDelay, fMinTimeToMusic); p.m_StartSecond = -fStartDelay * p.m_fSpeed; } ASSERT(!m_pSoundMusic->IsPlaying()); { float fSecondsToStartFadingOutMusic, fSecondsToStartTransitioningOut; GetMusicEndTiming(fSecondsToStartFadingOutMusic, fSecondsToStartTransitioningOut); if (fSecondsToStartFadingOutMusic < GAMESTATE->m_pCurSong->m_fMusicLengthSeconds) { p.m_fFadeOutSeconds = MUSIC_FADE_OUT_SECONDS; p.m_LengthSeconds = fSecondsToStartFadingOutMusic + MUSIC_FADE_OUT_SECONDS - p.m_StartSecond; } } m_pSoundMusic->Play(false, &p); /* Make sure GAMESTATE->m_fMusicSeconds is set up. */ GAMESTATE->m_Position.m_fMusicSeconds = -5000; UpdateSongPosition(0); ASSERT(GAMESTATE->m_Position.m_fMusicSeconds > -4000); /* make sure the "fake timer" code doesn't trigger */ if (GAMESTATE->m_pCurSteps) { GAMESTATE->m_pCurSteps->GetTimingData()->PrepareLookup(); } } // play assist ticks void ScreenGameplay::PlayTicks() { /* TODO: Allow all players to have ticks. Not as simple as it looks. * If a loop takes place, it could make one player's ticks come later * than intended. Any help here would be appreciated. -Wolfman2000 */ Player& player = *m_vPlayerInfo.m_pPlayer; const NoteData& nd = player.GetNoteData(); m_GameplayAssist.PlayTicks(nd, player.GetPlayerState()); } /* Play announcer "type" if it's been at least fSeconds since the last * announcer. */ void ScreenGameplay::PlayAnnouncer(const RString& type, float fSeconds, float* fDeltaSeconds) { /* Don't play before the first beat, or after we're finished. */ if (m_DancingState != STATE_DANCING) return; if (GAMESTATE->m_pCurSong == NULL || // this will be true on ScreenDemonstration sometimes GAMESTATE->m_Position.m_fSongBeat < GAMESTATE->m_pCurSong->GetFirstBeat()) return; if (*fDeltaSeconds < fSeconds) return; *fDeltaSeconds = 0; SOUND->PlayOnceFromAnnouncer(type); } void ScreenGameplay::UpdateSongPosition(float fDeltaTime) { if (!m_pSoundMusic->IsPlaying()) return; RageTimer tm; const float fSeconds = m_pSoundMusic->GetPositionSeconds(NULL, &tm); const float fAdjust = SOUND->GetFrameTimingAdjustment(fDeltaTime); GAMESTATE->UpdateSongPosition( fSeconds + fAdjust, GAMESTATE->m_pCurSong->m_SongTiming, tm + fAdjust); } void ScreenGameplay::BeginScreen() { if (GAMESTATE->m_pCurSong == NULL) return; ScreenWithMenuElements::BeginScreen(); SOUND->PlayOnceFromAnnouncer("gameplay intro"); // crowd cheer // Tell multi to do its thing (this really does nothing right now) -poco if (GAMESTATE->m_bPlayingMulti && NSMAN->useSMserver) { NSMAN->StartRequest(1); } // Then go StartPlayingSong(MIN_SECONDS_TO_STEP, MIN_SECONDS_TO_MUSIC); if (GAMESTATE->m_bPlayingMulti) { this->SetInterval( [this]() { auto& ptns = this->GetPlayerInfo(PLAYER_1) ->GetPlayerStageStats() ->m_iTapNoteScores; RString doot = ssprintf("%d I %d I %d I %d I %d I %d x%d", ptns[TNS_W1], ptns[TNS_W2], ptns[TNS_W3], ptns[TNS_W4], ptns[TNS_W5], ptns[TNS_Miss], this->GetPlayerInfo(PLAYER_1) ->GetPlayerStageStats() ->m_iCurCombo); auto player = this->GetPlayerInfo(PLAYER_1)->m_pPlayer; if (player->maxwifescore > 0) NSMAN->SendMPLeaderboardUpdate( player->curwifescore / player->maxwifescore, doot); }, 0.25f, -1); } } bool ScreenGameplay::AllAreFailing() { if (m_vPlayerInfo.m_pLifeMeter && !m_vPlayerInfo.m_pLifeMeter->IsFailing()) return false; return true; } void ScreenGameplay::GetMusicEndTiming(float& fSecondsToStartFadingOutMusic, float& fSecondsToStartTransitioningOut) { float fLastStepSeconds = GAMESTATE->m_pCurSong->GetLastSecond(); fLastStepSeconds += Player::GetMaxStepDistanceSeconds(); float fTransitionLength; fTransitionLength = OUT_TRANSITION_LENGTH; fSecondsToStartTransitioningOut = fLastStepSeconds; // Align the end of the music fade to the end of the transition. float fSecondsToFinishFadingOutMusic = fSecondsToStartTransitioningOut + fTransitionLength; if (fSecondsToFinishFadingOutMusic < GAMESTATE->m_pCurSong->m_fMusicLengthSeconds) fSecondsToStartFadingOutMusic = fSecondsToFinishFadingOutMusic - MUSIC_FADE_OUT_SECONDS; else fSecondsToStartFadingOutMusic = GAMESTATE->m_pCurSong->m_fMusicLengthSeconds; // don't fade /* Make sure we keep going long enough to register a miss for the last note, * and never start fading before the last note. */ fSecondsToStartFadingOutMusic = max(fSecondsToStartFadingOutMusic, fLastStepSeconds); fSecondsToStartTransitioningOut = max(fSecondsToStartTransitioningOut, fLastStepSeconds); /* Make sure the fade finishes before the transition finishes. */ fSecondsToStartTransitioningOut = max(fSecondsToStartTransitioningOut, fSecondsToStartFadingOutMusic + MUSIC_FADE_OUT_SECONDS - fTransitionLength); } void ScreenGameplay::Update(float fDeltaTime) { if (GAMESTATE->m_pCurSong == NULL) { /* ScreenDemonstration will move us to the next screen. We just need to * survive for one update without crashing. We need to call * Screen::Update to make sure we receive the next-screen message. */ Screen::Update(fDeltaTime); return; } UpdateSongPosition(fDeltaTime); if (m_bZeroDeltaOnNextUpdate) { Screen::Update(0); m_bZeroDeltaOnNextUpdate = false; } else { Screen::Update(fDeltaTime); } /* This can happen if ScreenDemonstration::HandleScreenMessage sets a new * screen when !PREFSMAN->m_bDelayedScreenLoad. (The new screen was loaded * when we called Screen::Update, and the ctor might set a new * GAMESTATE->m_pCurSong, so the above check can fail.) */ if (SCREENMAN->GetTopScreen() != this) return; // LOG->Trace( "m_fOffsetInBeats = %f, m_fBeatsPerSecond = %f, // m_Music.GetPositionSeconds = %f", m_fOffsetInBeats, m_fBeatsPerSecond, // m_Music.GetPositionSeconds() ); m_AutoKeysounds.Update(fDeltaTime); FailType failtype = GAMESTATE->GetPlayerFailType(m_vPlayerInfo.GetPlayerState()); // update GameState HealthState HealthState& hs = m_vPlayerInfo.GetPlayerState()->m_HealthState; HealthState OldHealthState = hs; if (m_vPlayerInfo.m_pLifeMeter != nullptr) { if (failtype != FailType_Off && m_vPlayerInfo.m_pLifeMeter->IsFailing()) { hs = HealthState_Dead; } else if (m_vPlayerInfo.m_pLifeMeter->IsHot()) { hs = HealthState_Hot; } else if (failtype != FailType_Off && m_vPlayerInfo.m_pLifeMeter->IsInDanger()) { hs = HealthState_Danger; } else { hs = HealthState_Alive; } if (hs != OldHealthState) { Message msg("HealthStateChanged"); msg.SetParam("PlayerNumber", m_vPlayerInfo.m_pn); msg.SetParam("HealthState", hs); msg.SetParam("OldHealthState", OldHealthState); MESSAGEMAN->Broadcast(msg); } } m_vPlayerInfo.m_SoundEffectControl.Update(fDeltaTime); { float fSpeed = GAMESTATE->m_SongOptions.GetCurrent().m_fMusicRate; RageSoundParams p = m_pSoundMusic->GetParams(); if (std::fabs(p.m_fSpeed - fSpeed) > 0.01f && fSpeed >= 0.0f) { p.m_fSpeed = fSpeed; m_pSoundMusic->SetParams(p); } } switch (m_DancingState) { case STATE_DANCING: { /* Set STATSMAN->m_CurStageStats.bFailed for failed players. In, * FAIL_IMMEDIATE, send SM_BeginFailed if all players failed, and * kill dead Oni players. */ PlayerNumber pn = m_vPlayerInfo.GetStepsAndTrailIndex(); if (m_vPlayerInfo.m_pLifeMeter != nullptr) { LifeType lt = m_vPlayerInfo.GetPlayerState() ->m_PlayerOptions.GetStage() .m_LifeType; // check for individual fail if (!(failtype == FailType_Off) && m_vPlayerInfo.m_pLifeMeter->IsFailing() && !m_vPlayerInfo.GetPlayerStageStats()->m_bFailed) { LOG->Trace("Player %d failed", static_cast<int>(pn)); m_vPlayerInfo.GetPlayerStageStats()->m_bFailed = true; // fail { Message msg("PlayerFailed"); msg.SetParam("PlayerNumber", m_vPlayerInfo.m_pn); MESSAGEMAN->Broadcast(msg); } } // Check for and do Oni die. bool bAllowOniDie = false; switch (lt) { case LifeType_Battery: bAllowOniDie = true; break; default: break; } if (bAllowOniDie && failtype == FailType_Immediate) { if (!STATSMAN->m_CurStageStats .AllFailed()) // if not the last one to fail { // kill them! FailFadeRemovePlayer(&m_vPlayerInfo); } } bool bAllFailed = true; switch (failtype) { case FailType_Immediate: if (!m_vPlayerInfo.m_pLifeMeter->IsFailing()) bAllFailed = false; break; case FailType_ImmediateContinue: bAllFailed = false; // wait until the end of the song to fail. break; case FailType_Off: bAllFailed = false; // never fail. break; default: FAIL_M("Invalid fail type! Aborting..."); } if (bAllFailed) { m_pSoundMusic->StopPlaying(); SCREENMAN->PostMessageToTopScreen(SM_NotesEnded, 0); m_LyricDisplay.Stop(); } } // Update living players' alive time // HACK: Don't scale alive time when using tab/tilde. Instead of // accumulating time from a timer, this time should instead be tied // to the music position. float fUnscaledDeltaTime = m_timerGameplaySeconds.GetDeltaTime(); if (!m_vPlayerInfo.GetPlayerStageStats()->m_bFailed) m_vPlayerInfo.GetPlayerStageStats()->m_fAliveSeconds += fUnscaledDeltaTime * GAMESTATE->m_SongOptions.GetCurrent().m_fMusicRate; // update fGameplaySeconds STATSMAN->m_CurStageStats.m_fGameplaySeconds += fUnscaledDeltaTime; float curBeat = GAMESTATE->m_Position.m_fSongBeat; Song& s = *GAMESTATE->m_pCurSong; if (curBeat >= s.GetFirstBeat() && curBeat < s.GetLastBeat()) { STATSMAN->m_CurStageStats.m_fStepsSeconds += fUnscaledDeltaTime; } // Check for end of song { float fSecondsToStartFadingOutMusic, fSecondsToStartTransitioningOut; GetMusicEndTiming(fSecondsToStartFadingOutMusic, fSecondsToStartTransitioningOut); bool bAllReallyFailed = STATSMAN->m_CurStageStats.AllFailed(); if (bAllReallyFailed) fSecondsToStartTransitioningOut += BEGIN_FAILED_DELAY; if (GAMESTATE->m_Position.m_fMusicSeconds >= fSecondsToStartTransitioningOut && !m_NextSong.IsTransitioning()) this->PostScreenMessage(SM_NotesEnded, 0); } // update give up bool bGiveUpTimerFired = false; bGiveUpTimerFired = !m_GiveUpTimer.IsZero() && m_GiveUpTimer.Ago() > GIVE_UP_SECONDS; m_gave_up = bGiveUpTimerFired; // Quitters deserve a failed score. if (bGiveUpTimerFired) { STATSMAN->m_CurStageStats.m_bGaveUp = true; m_vPlayerInfo.GetPlayerStageStats()->m_bDisqualified = true; m_vPlayerInfo.GetPlayerStageStats()->gaveuplikeadumbass = true; ResetGiveUpTimers(false); LOG->Trace("Exited Gameplay to Evaluation"); this->PostScreenMessage(SM_LeaveGameplay, 0); return; } // Check to see if it's time to play a ScreenGameplay comment m_fTimeSinceLastDancingComment += fDeltaTime; PlayMode mode = GAMESTATE->m_PlayMode; switch (mode) { case PLAY_MODE_REGULAR: if (GAMESTATE->OneIsHot()) PlayAnnouncer("gameplay comment hot", SECONDS_BETWEEN_COMMENTS); else if (GAMESTATE->AllAreInDangerOrWorse()) PlayAnnouncer("gameplay comment danger", SECONDS_BETWEEN_COMMENTS); else PlayAnnouncer("gameplay comment good", SECONDS_BETWEEN_COMMENTS); break; default: break; } } default: break; } PlayTicks(); SendCrossedMessages(); /* // Multiplayer Life & C++ Scoreboard Update Stuff. Useless for now. if (GAMESTATE->m_bPlayingMulti && NSMAN->useSMserver) { if (m_vPlayerInfo.m_pLifeMeter) NSMAN->m_playerLife = int(m_vPlayerInfo.m_pLifeMeter->GetLife() * 10000); if (m_bShowScoreboard) FOREACH_NSScoreBoardColumn( cn) if (m_bShowScoreboard && NSMAN->ChangedScoreboard(cn) && GAMESTATE->GetFirstDisabledPlayer() != PLAYER_INVALID) m_Scoreboard[cn] .SetText(NSMAN->m_Scoreboard[cn]); } */ // ArrowEffects::Update call moved because having it happen once per // NoteField (which means twice in two player) seemed wasteful. -Kyz ArrowEffects::Update(); } void ScreenGameplay::DrawPrimitives() { // ScreenGameplay::DrawPrimitives exists so that the notefield board can be // above the song background and underneath everything else. This way, a // theme can put a screen filter in the notefield board and not have it // obscure custom elements on the screen. Putting the screen filter in the // notefield board simplifies placement because it ensures that the filter // is in the same place as the notefield, instead of forcing the filter to // check conditions and metrics that affect the position of the notefield. // This also solves the problem of the ComboUnderField metric putting the // combo underneath the opaque notefield board. // -Kyz if (m_pSongBackground != nullptr) { m_pSongBackground->m_disable_draw = false; m_pSongBackground->Draw(); m_pSongBackground->m_disable_draw = true; } m_vPlayerInfo.m_pPlayer->DrawNoteFieldBoard(); ScreenWithMenuElements::DrawPrimitives(); } void ScreenGameplay::FailFadeRemovePlayer(PlayerInfo* pi) { SOUND->PlayOnceFromDir(THEME->GetPathS(m_sName, "oni die")); int tracks = pi->m_NoteData.GetNumTracks(); pi->m_NoteData.Init(); // remove all notes and scoring pi->m_NoteData.SetNumTracks(tracks); // reset the number of tracks. pi->m_pPlayer->FadeToFail(); // tell the NoteField to fade to white } void ScreenGameplay::SendCrossedMessages() { // hmmm... if (GAMESTATE->m_pCurSong == nullptr) return; { static int iRowLastCrossed = 0; float fPositionSeconds = GAMESTATE->m_Position.m_fMusicSeconds; float fSongBeat = GAMESTATE->m_pCurSong->m_SongTiming.GetBeatFromElapsedTime( fPositionSeconds); int iRowNow = BeatToNoteRow(fSongBeat); iRowNow = max(0, iRowNow); for (int r = iRowLastCrossed + 1; r <= iRowNow; r++) { if (GetNoteType(r) == NOTE_TYPE_4TH) MESSAGEMAN->Broadcast(Message_BeatCrossed); } iRowLastCrossed = iRowNow; } { const int NUM_MESSAGES_TO_SEND = 4; const float MESSAGE_SPACING_SECONDS = 0.4f; PlayerNumber pn = PLAYER_INVALID; if (GAMESTATE->m_pCurSteps->GetDifficulty() == Difficulty_Beginner) { pn = m_vPlayerInfo.m_pn; } if (pn == PLAYER_INVALID) return; const NoteData& nd = m_vPlayerInfo.m_pPlayer->GetNoteData(); static int iRowLastCrossedAll[NUM_MESSAGES_TO_SEND] = { 0, 0, 0, 0 }; for (int i = 0; i < NUM_MESSAGES_TO_SEND; i++) { float fNoteWillCrossInSeconds = MESSAGE_SPACING_SECONDS * i; float fPositionSeconds = GAMESTATE->m_Position.m_fMusicSeconds + fNoteWillCrossInSeconds; float fSongBeat = GAMESTATE->m_pCurSong->m_SongTiming.GetBeatFromElapsedTime( fPositionSeconds); int iRowNow = BeatToNoteRow(fSongBeat); iRowNow = max(0, iRowNow); int& iRowLastCrossed = iRowLastCrossedAll[i]; FOREACH_NONEMPTY_ROW_ALL_TRACKS_RANGE( nd, r, iRowLastCrossed + 1, iRowNow + 1) { int iNumTracksWithTapOrHoldHead = 0; for (int t = 0; t < nd.GetNumTracks(); t++) { if (nd.GetTapNote(t, r).type == TapNoteType_Empty) continue; iNumTracksWithTapOrHoldHead++; // send crossed message if (GAMESTATE->GetCurrentGame() ->m_PlayersHaveSeparateStyles) { const Style* pStyle = GAMESTATE->GetCurrentStyle(m_vPlayerInfo.m_pn); RString sButton = pStyle->ColToButtonName(t); Message msg(i == 0 ? "NoteCrossed" : "NoteWillCross"); msg.SetParam("ButtonName", sButton); msg.SetParam("NumMessagesFromCrossed", i); msg.SetParam("PlayerNumber", m_vPlayerInfo.m_pn); MESSAGEMAN->Broadcast(msg); } else { const Style* pStyle = GAMESTATE->GetCurrentStyle(PLAYER_INVALID); RString sButton = pStyle->ColToButtonName(t); Message msg(i == 0 ? "NoteCrossed" : "NoteWillCross"); msg.SetParam("ButtonName", sButton); msg.SetParam("NumMessagesFromCrossed", i); MESSAGEMAN->Broadcast(msg); } } if (iNumTracksWithTapOrHoldHead > 0) MESSAGEMAN->Broadcast( static_cast<MessageID>(Message_NoteCrossed + i)); if (i == 0 && iNumTracksWithTapOrHoldHead >= 2) { RString sMessageName = "NoteCrossedJump"; MESSAGEMAN->Broadcast(sMessageName); } } iRowLastCrossed = iRowNow; } } } void ScreenGameplay::BeginBackingOutFromGameplay() { m_DancingState = STATE_OUTRO; ResetGiveUpTimers(false); m_pSoundMusic->StopPlaying(); m_GameplayAssist.StopPlaying(); // Stop any queued assist ticks. this->ClearMessageQueue(); m_Cancel.StartTransitioning(SM_DoPrevScreen); } void ScreenGameplay::RestartGameplay() { GAMESTATE->m_bRestartedGameplay = true; if (m_sName.find("Net") != std::string::npos) SetPrevScreenName("ScreenNetStageInformation"); else SetPrevScreenName("ScreenStageInformation"); BeginBackingOutFromGameplay(); } void ScreenGameplay::AbortGiveUpText(bool show_abort_text) { m_textDebug.StopTweening(); if (show_abort_text) { m_textDebug.SetText(GIVE_UP_ABORTED_TEXT); } // otherwise tween out the text that's there m_textDebug.BeginTweening(1 / 2.f); m_textDebug.SetDiffuse(RageColor(1, 1, 1, 0)); } void ScreenGameplay::AbortGiveUp(bool bShowText) { if (m_GiveUpTimer.IsZero()) { return; } AbortGiveUpText(bShowText); m_GiveUpTimer.SetZero(); } void ScreenGameplay::ResetGiveUpTimers(bool show_text) { AbortGiveUp(show_text); } bool ScreenGameplay::Input(const InputEventPlus& input) { // LOG->Trace( "ScreenGameplay::Input()" ); Message msg(""); if (m_Codes.InputMessage(input, msg)) this->HandleMessage(msg); if (m_DancingState != STATE_OUTRO && GAMESTATE->IsHumanPlayer(input.pn) && !m_Cancel.IsTransitioning()) { /* Allow bailing out by holding any START button. */ bool bHoldingGiveUp = false; if (GAMESTATE->GetCurrentStyle(input.pn)->GameInputToColumn( input.GameI) == Column_Invalid) { bHoldingGiveUp |= (input.MenuI == GAME_BUTTON_START); } // Exiting gameplay by holding Start (Forced Fail) if (bHoldingGiveUp) { if (input.type == IET_RELEASE) { AbortGiveUp(true); } else if (input.type == IET_FIRST_PRESS && m_GiveUpTimer.IsZero()) { m_textDebug.SetText(GIVE_UP_START_TEXT); m_textDebug.PlayCommand("StartOn"); m_GiveUpTimer.Touch(); // start the timer } return true; } // Exiting gameplay by pressing Back (Immediate Exit) bool bHoldingBack = false; if (GAMESTATE->GetCurrentStyle(input.pn)->GameInputToColumn( input.GameI) == Column_Invalid) { bHoldingBack |= input.MenuI == GAME_BUTTON_BACK; } if (bHoldingBack) { if (((!PREFSMAN->m_bDelayedBack && input.type == IET_FIRST_PRESS) || (input.DeviceI.device == DEVICE_KEYBOARD && input.type == IET_REPEAT) || (input.DeviceI.device != DEVICE_KEYBOARD && INPUTFILTER->GetSecsHeld(input.DeviceI) >= 1.0f))) { if (PREFSMAN->m_verbose_log > 1) LOG->Trace("Player %i went back", input.pn + 1); BeginBackingOutFromGameplay(); } else if (PREFSMAN->m_bDelayedBack && input.type == IET_FIRST_PRESS) { m_textDebug.SetText(GIVE_UP_BACK_TEXT); m_textDebug.PlayCommand("BackOn"); } else if (PREFSMAN->m_bDelayedBack && input.type == IET_RELEASE) { m_textDebug.PlayCommand("TweenOff"); } return true; } } bool bRelease = input.type == IET_RELEASE; if (!input.GameI.IsValid()) return false; int iCol = GAMESTATE->GetCurrentStyle(input.pn)->GameInputToColumn(input.GameI); // Don't pass on any inputs to Player that aren't a press or a release. switch (input.type) { case IET_FIRST_PRESS: case IET_RELEASE: break; default: return false; } /* Restart gameplay button moved from theme to allow for rebinding for * people who dont want to edit lua files :) */ bool bHoldingRestart = false; if (GAMESTATE->GetCurrentStyle(input.pn)->GameInputToColumn(input.GameI) == Column_Invalid) { bHoldingRestart |= input.MenuI == GAME_BUTTON_RESTART; } if (bHoldingRestart) { RestartGameplay(); } // handle a step or battle item activate if (GAMESTATE->IsHumanPlayer(input.pn)) { ResetGiveUpTimers(true); if (GamePreferences::m_AutoPlay == PC_HUMAN && GAMESTATE->m_pPlayerState->m_PlayerOptions.GetCurrent() .m_fPlayerAutoPlay == 0) { ASSERT(input.GameI.IsValid()); GameButtonType gbt = GAMESTATE->m_pCurGame->GetPerButtonInfo(input.GameI.button) ->m_gbt; switch (gbt) { case GameButtonType_Menu: return false; case GameButtonType_Step: if (iCol != -1) m_vPlayerInfo.m_pPlayer->Step( iCol, -1, input.DeviceI.ts, false, bRelease); return true; } } } return false; } /* Saving StageStats that are affected by the note pattern is a little tricky: * * Stats are cumulative for course play. * * For regular songs, it doesn't matter how we do it; the pattern doesn't change * during play. * * The pattern changes during play in battle and course mode. We want to include * these changes, so run stats for a song after the song finishes. * * If we fail, be sure to include the current song in stats, * with the current modifier set. So: * 1. At the end of a song in any mode, pass or fail, add stats for that song * (from m_pPlayer). * 2. At the end of gameplay in course mode, add stats for any songs that * weren't played, applying the modifiers the song would have been played with. * This doesn't include songs that were played but failed; that was done in * #1. */ void ScreenGameplay::SaveStats() { float fMusicLen = GAMESTATE->m_pCurSong->m_fMusicLengthSeconds; /* Note that adding stats is only meaningful for the counters (eg. * RadarCategory_Jumps), not for the percentages (RadarCategory_Air). */ RadarValues rv; PlayerStageStats& pss = *m_vPlayerInfo.GetPlayerStageStats(); const NoteData& nd = m_vPlayerInfo.m_pPlayer->GetNoteData(); PlayerNumber pn = m_vPlayerInfo.m_pn; GAMESTATE->SetProcessedTimingData(GAMESTATE->m_pCurSteps->GetTimingData()); NoteDataUtil::CalculateRadarValues(nd, fMusicLen, rv); pss.m_radarPossible += rv; NoteDataWithScoring::GetActualRadarValues(nd, pss, fMusicLen, rv); pss.m_radarActual += rv; GAMESTATE->SetProcessedTimingData(NULL); } void ScreenGameplay::SongFinished() { if (GAMESTATE->m_pCurSteps) { GAMESTATE->m_pCurSteps->GetTimingData()->ReleaseLookup(); } SaveStats(); // Let subclasses save the stats. } void ScreenGameplay::StageFinished(bool bBackedOut) { CHECKPOINT_M("Finishing Stage"); if (bBackedOut) { GAMESTATE->CancelStage(); return; } // If all players failed, kill. if (STATSMAN->m_CurStageStats.AllFailed()) { GAMESTATE->m_iPlayerStageTokens = 0; } // Properly set the LivePlay bool STATSMAN->m_CurStageStats.m_bLivePlay = true; STATSMAN->m_CurStageStats.FinalizeScores(false); // If we didn't cheat and aren't in Practice // (Replay does its own thing somewhere else here) if (GamePreferences::m_AutoPlay == PC_HUMAN && !GAMESTATE->m_pPlayerState->m_PlayerOptions.GetCurrent().m_bPractice) { HighScore* pHS = &STATSMAN->m_CurStageStats.m_player.m_HighScore; auto nd = GAMESTATE->m_pCurSteps->GetNoteData(); // Load the replay data for the current score so some cool functionality // works immediately PlayerAI::ResetScoreData(); PlayerAI::SetScoreData(pHS, 0, &nd); GAMESTATE->CommitStageStats(); } // save current stage stats STATSMAN->m_vPlayedStageStats.push_back(STATSMAN->m_CurStageStats); STATSMAN->CalcAccumPlayedStageStats(); GAMESTATE->FinishStage(); CHECKPOINT_M("Done Finishing Stage"); } void ScreenGameplay::HandleScreenMessage(const ScreenMessage SM) { CHECKPOINT_M( ssprintf("HandleScreenMessage(%s)", ScreenMessageHelpers::ScreenMessageToString(SM).c_str())); if (SM == SM_DoneFadingIn) { // If the ready animation is zero length, then playing the sound will // make it overlap with the go sound. // If the Ready animation is zero length, and the Go animation is not, // only play the Go sound. // If they're both zero length, only play the Ready sound. // Otherwise, play both sounds. // -Kyz m_Ready.StartTransitioning(SM_PlayGo); if (m_Ready.GetTweenTimeLeft() <= .0f) { m_delaying_ready_announce = true; } else { m_delaying_ready_announce = false; SOUND->PlayOnceFromAnnouncer("gameplay ready"); } } else if (SM == SM_PlayGo) { m_Go.StartTransitioning(SM_None); bool should_play_go = true; if (m_delaying_ready_announce) { if (m_Go.GetTweenTimeLeft() <= .0f) { SOUND->PlayOnceFromAnnouncer("gameplay ready"); should_play_go = false; } else { should_play_go = true; } } if (should_play_go) { SOUND->PlayOnceFromAnnouncer("gameplay here we go normal"); } GAMESTATE->m_DanceStartTime.Touch(); GAMESTATE->m_bGameplayLeadIn.Set(false); m_DancingState = STATE_DANCING; // STATE CHANGE! Now the user is allowed to press Back } else if (SM == SM_NotesEnded) // received while STATE_DANCING { if (GAMESTATE->m_pPlayerState->m_PlayerOptions.GetCurrent().m_bPractice) return; // don't auto leave gameplay when finishing notes during // practice mode this prevents use of eval screen during // practice which im pretty sure nobody cares about? ResetGiveUpTimers( false); // don't allow giveup while the next song is loading // Mark failure. if (GAMESTATE->GetPlayerFailType(m_vPlayerInfo.GetPlayerState()) != FailType_Off && (m_vPlayerInfo.m_pLifeMeter && m_vPlayerInfo.m_pLifeMeter->IsFailing())) { m_vPlayerInfo.GetPlayerStageStats()->m_bFailed = true; Message msg("SongFinished"); MESSAGEMAN->Broadcast(msg); } if (!m_vPlayerInfo.GetPlayerStageStats()->m_bFailed) { m_vPlayerInfo.GetPlayerStageStats()->m_iSongsPassed++; } // set a life record at the point of failure if (m_vPlayerInfo.GetPlayerStageStats()->m_bFailed) { m_vPlayerInfo.GetPlayerStageStats()->SetLifeRecordAt( 0, STATSMAN->m_CurStageStats.m_fGameplaySeconds); } /* If all players have *really* failed (bFailed, not the life meter or * bFailedEarlier): */ const bool bAllReallyFailed = STATSMAN->m_CurStageStats.AllFailed(); const bool bIsLastSong = m_apSongsQueue.size() == 1; LOG->Trace("bAllReallyFailed = %d " "bIsLastSong = %d, m_gave_up = %d", bAllReallyFailed, bIsLastSong, m_gave_up); if (GAMESTATE->IsPlaylistCourse()) { m_apSongsQueue.erase(m_apSongsQueue.begin(), m_apSongsQueue.begin() + 1); m_vPlayerInfo.m_vpStepsQueue.erase( m_vPlayerInfo.m_vpStepsQueue.begin(), m_vPlayerInfo.m_vpStepsQueue.begin() + 1); ratesqueue.erase(ratesqueue.begin(), ratesqueue.begin() + 1); this->StageFinished(false); if (m_apSongsQueue.size() > 0) { GAMESTATE->m_SongOptions.GetCurrent().m_fMusicRate = ratesqueue[0]; GAMESTATE->m_SongOptions.GetSong().m_fMusicRate = ratesqueue[0]; GAMESTATE->m_SongOptions.GetStage().m_fMusicRate = ratesqueue[0]; GAMESTATE->m_SongOptions.GetPreferred().m_fMusicRate = ratesqueue[0]; STATSMAN->m_CurStageStats.m_player.InternalInit(); } playlistscorekeys.emplace_back( STATSMAN->m_CurStageStats.mostrecentscorekey); } if (!bIsLastSong) { // Load the next song in the course. HandleScreenMessage(SM_StartLoadingNextSong); return; } else { // Time to leave from ScreenGameplay HandleScreenMessage(SM_LeaveGameplay); } } else if (SM == SM_LeaveGameplay) { GAMESTATE->m_DanceDuration = GAMESTATE->m_DanceStartTime.Ago(); // End round. if (m_DancingState == STATE_OUTRO) // ScreenGameplay already ended return; // ignore m_DancingState = STATE_OUTRO; ResetGiveUpTimers(false); bool bAllReallyFailed = STATSMAN->m_CurStageStats.AllFailed(); if (bAllReallyFailed) { this->PostScreenMessage(SM_BeginFailed, 0); return; } // todo: add GameplayCleared, StartTransitioningCleared commands -aj Message msg("SongFinished"); MESSAGEMAN->Broadcast(msg); if (GAMESTATE->IsPlaylistCourse()) { SONGMAN->GetPlaylists()[SONGMAN->playlistcourse] .courseruns.emplace_back(playlistscorekeys); } TweenOffScreen(); m_Out.StartTransitioning(SM_DoNextScreen); SOUND->PlayOnceFromAnnouncer("gameplay cleared"); } else if (SM == SM_StartLoadingNextSong) { // Next song. // give a little life back between stages if (m_vPlayerInfo.m_pLifeMeter) m_vPlayerInfo.m_pLifeMeter->OnSongEnded(); GAMESTATE->m_bLoadingNextSong = true; MESSAGEMAN->Broadcast("BeforeLoadingNextCourseSong"); m_NextSong.Reset(); m_NextSong.PlayCommand("Start"); m_NextSong.StartTransitioning(SM_LoadNextSong); MESSAGEMAN->Broadcast("ChangeCourseSongIn"); } else if (SM == SM_LoadNextSong) { m_pSoundMusic->Stop(); SongFinished(); MESSAGEMAN->Broadcast("ChangeCourseSongOut"); GAMESTATE->m_bLoadingNextSong = false; LoadNextSong(); m_NextSong.Reset(); m_NextSong.PlayCommand("Finish"); m_NextSong.StartTransitioning(SM_None); StartPlayingSong(MIN_SECONDS_TO_STEP_NEXT_SONG, 0); } else if (SM == SM_PlayToasty) { if (PREFSMAN->m_bEasterEggs) { if (m_Toasty.IsWaiting()) { m_Toasty.Reset(); m_Toasty.StartTransitioning(); } } } else if (ScreenMessageHelpers::ScreenMessageToString(SM).find("0Combo") != string::npos) { int iCombo; RString sCropped = ScreenMessageHelpers::ScreenMessageToString(SM).substr(3); sscanf(sCropped.c_str(), "%d%*s", &iCombo); PlayAnnouncer(ssprintf("gameplay %d combo", iCombo), 2); } else if (SM == SM_ComboStopped) { PlayAnnouncer("gameplay combo stopped", 2); } else if (SM == SM_ComboContinuing) { PlayAnnouncer("gameplay combo overflow", 2); } else if (SM >= SM_BattleTrickLevel1 && SM <= SM_BattleTrickLevel3) { int iTrickLevel = SM - SM_BattleTrickLevel1 + 1; PlayAnnouncer(ssprintf("gameplay battle trick level%d", iTrickLevel), 3); if (SM == SM_BattleTrickLevel1) m_soundBattleTrickLevel1.Play(false); else if (SM == SM_BattleTrickLevel2) m_soundBattleTrickLevel2.Play(false); else if (SM == SM_BattleTrickLevel3) m_soundBattleTrickLevel3.Play(false); } else if (SM == SM_DoPrevScreen) { SongFinished(); this->StageFinished(true); m_sNextScreen = GetPrevScreen(); if (!GAMESTATE->IsPlaylistCourse() && AdjustSync::IsSyncDataChanged()) ScreenSaveSync::PromptSaveSync(SM_GoToPrevScreen); else HandleScreenMessage(SM_GoToPrevScreen); } else if (SM == SM_DoNextScreen) { SongFinished(); this->StageFinished(false); auto syncing = !GAMESTATE->IsPlaylistCourse() && AdjustSync::IsSyncDataChanged(); bool replaying = false; if (m_vPlayerInfo.GetPlayerState()->m_PlayerController == PC_REPLAY) // don't duplicate replay saves { replaying = true; } if (syncing) ScreenSaveSync::PromptSaveSync(SM_GoToPrevScreen); else HandleScreenMessage(SM_GoToNextScreen); if (GAMESTATE->IsPlaylistCourse()) { GAMESTATE->isplaylistcourse = false; SONGMAN->playlistcourse = ""; } } else if (SM == SM_GainFocus) { // We do this ourself. SOUND->HandleSongTimer(false); } else if (SM == SM_LoseFocus) { // We might have turned the song timer off. Be sure to turn it back on. SOUND->HandleSongTimer(true); } else if (SM == SM_BeginFailed) { m_DancingState = STATE_OUTRO; ResetGiveUpTimers(false); m_GameplayAssist.StopPlaying(); // Stop any queued assist ticks. TweenOffScreen(); m_Failed.StartTransitioning(SM_DoNextScreen); SOUND->PlayOnceFromAnnouncer("gameplay failed"); } ScreenWithMenuElements::HandleScreenMessage(SM); } void ScreenGameplay::HandleMessage(const Message& msg) { if (msg == "Judgment") { PlayerNumber pn; msg.GetParam("Player", pn); if (m_vPlayerInfo.m_pn == pn && m_vPlayerInfo.GetPlayerState() ->m_PlayerOptions.GetCurrent() .m_bMuteOnError) { RageSoundReader* pSoundReader = m_AutoKeysounds.GetPlayerSound(pn); if (pSoundReader == NULL) pSoundReader = m_AutoKeysounds.GetSharedSound(); HoldNoteScore hns; msg.GetParam("HoldNoteScore", hns); TapNoteScore tns; msg.GetParam("TapNoteScore", tns); bool bOn = false; if (hns != HoldNoteScore_Invalid) bOn = hns != HNS_LetGo; else bOn = tns != TNS_Miss; if (pSoundReader) pSoundReader->SetProperty("Volume", bOn ? 1.0f : 0.0f); } } ScreenWithMenuElements::HandleMessage(msg); } void ScreenGameplay::Cancel(ScreenMessage smSendWhenDone) { m_pSoundMusic->Stop(); ScreenWithMenuElements::Cancel(smSendWhenDone); } PlayerInfo* ScreenGameplay::GetPlayerInfo(PlayerNumber pn) { if (m_vPlayerInfo.m_pn == pn) return &m_vPlayerInfo; return NULL; } const float ScreenGameplay::GetSongPosition() { // Really, this is the music position... RageTimer tm; return m_pSoundMusic->GetPositionSeconds(NULL, &tm); } // lua start /** @brief Allow Lua to have access to the ScreenGameplay. */ class LunaScreenGameplay : public Luna<ScreenGameplay> { public: static int Center1Player(T* p, lua_State* L) { lua_pushboolean(L, p->Center1Player()); return 1; } static int GetLifeMeter(T* p, lua_State* L) { PlayerNumber pn = PLAYER_1; PlayerInfo* pi = p->GetPlayerInfo(pn); if (pi == NULL) return 0; LifeMeter* pLM = pi->m_pLifeMeter; if (pLM == NULL) return 0; pLM->PushSelf(L); return 1; } static int GetPlayerInfo(T* p, lua_State* L) { PlayerNumber pn = PLAYER_1; PlayerInfo* pi = p->GetPlayerInfo(pn); if (pi == NULL) return 0; pi->PushSelf(L); return 1; } static bool TurningPointsValid(lua_State* L, int index) { size_t size = lua_objlen(L, index); if (size < 2) { luaL_error(L, "Invalid number of entries %zu", size); } float prev_turning = -1; for (size_t n = 1; n < size; ++n) { lua_pushnumber(L, n); lua_gettable(L, index); float v = FArg(-1); if (v < prev_turning || v > 1) { luaL_error(L, "Invalid value %f", v); } lua_pop(L, 1); } return true; } static bool AddAmountsValid(lua_State* L, int index) { return TurningPointsValid(L, index); } static int begin_backing_out(T* p, lua_State* L) { p->BeginBackingOutFromGameplay(); COMMON_RETURN_SELF; } static int GetTrueBPS(T* p, lua_State* L) { PlayerNumber pn = PLAYER_1; float rate = GAMESTATE->m_SongOptions.GetCurrent().m_fMusicRate; float bps = GAMESTATE->m_pPlayerState->m_Position.m_fCurBPS; float true_bps = rate * bps; lua_pushnumber(L, true_bps); return 1; } static int GetSongPosition(T* p, lua_State* L) { float pos = p->GetSongPosition(); lua_pushnumber(L, pos); return 1; } LunaScreenGameplay() { ADD_METHOD(Center1Player); ADD_METHOD(GetLifeMeter); ADD_METHOD(GetPlayerInfo); // sm-ssc additions: ADD_METHOD(begin_backing_out); ADD_METHOD(GetTrueBPS); ADD_METHOD(GetSongPosition); } }; LUA_REGISTER_DERIVED_CLASS(ScreenGameplay, ScreenWithMenuElements) // lua end
31.076843
81
0.706762
[ "object" ]
418510037a3986665238115f249c4db2fc916841
2,923
cxx
C++
lib/combilp_srmp_stub.cxx
fgrsnau/combilp
915b2a82f683996d3a015039a93474c81cec77d1
[ "MIT" ]
5
2018-06-27T10:45:58.000Z
2019-10-02T21:39:40.000Z
lib/combilp_srmp_stub.cxx
vislearn/combilp
915b2a82f683996d3a015039a93474c81cec77d1
[ "MIT" ]
null
null
null
lib/combilp_srmp_stub.cxx
vislearn/combilp
915b2a82f683996d3a015039a93474c81cec77d1
[ "MIT" ]
null
null
null
// Copyright (c) 2017 Stefan Haller // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. #include <cstdint> #include <iostream> #include <limits> #include <srmp/SRMP.h> #include <srmp/edge_iterator.h> typedef std::int32_t IndexType; typedef std::int32_t LabelType; typedef double ValueType; extern "C" { srmpLib::Energy* combilp_srmp_stub_create( IndexType number_of_variables, const LabelType *shape ) { srmpLib::Energy *energy = new srmpLib::Energy(number_of_variables); for (IndexType var = 0; var < number_of_variables; ++var) energy->AddNode(shape[var]); return energy; } void combilp_srmp_stub_destroy(srmpLib::Energy *energy) { delete energy; } void combilp_srmp_stub_add_factor( srmpLib::Energy *energy, IndexType arity, const IndexType *variables, const ValueType *costs ) { static_assert(sizeof(srmpLib::Energy::NodeId) == sizeof(IndexType)); energy->AddFactor(arity, const_cast<srmpLib::Energy::NodeId*>(variables), const_cast<double*>(costs)); } void combilp_srmp_stub_solve( srmpLib::Energy *energy, int max_iterations ) { srmpLib::Energy::Options options; options.method = srmpLib::Energy::Options::SRMP; options.iter_max = max_iterations; options.time_max = std::numeric_limits<double>::infinity(); options.sort_flag = -1; options.print_times = false; options.verbose = true; energy->SetMinimalEdges(); energy->Solve(options); } void combilp_srmp_stub_extract_messages ( srmpLib::Energy *energy, void (*func)(size_t alpha_size, IndexType *alpha, IndexType beta, ValueType *message_begin, ValueType *message_end) ) { for (srmpLib::EdgeIterator it(energy); it.valid(); ++it) { if (! (it->alpha.size() >= 2 && it->beta.size() == 1)) throw std::runtime_error("This relaxation type is not supported by the LPReparametrisationStorage!"); func(it->alpha.size(), it->alpha.data(), it->beta[0], it->message_begin(), it->message_end()); } } }
28.940594
116
0.74752
[ "shape" ]
4189816bf40dfab5c48e3a13a4ea6d42ed1b303f
10,568
hpp
C++
X1/Cheat/Engine/SDK/IClientUnknown.hpp
Galenika/Xone-Cheat-90--
44e79f03128194de17a900def38735d29bc85572
[ "Apache-2.0" ]
12
2019-03-30T18:57:45.000Z
2021-04-18T13:44:52.000Z
X1/Cheat/Engine/SDK/IClientUnknown.hpp
CSGOLeaks/Xone-Cheat-90--
44e79f03128194de17a900def38735d29bc85572
[ "Apache-2.0" ]
null
null
null
X1/Cheat/Engine/SDK/IClientUnknown.hpp
CSGOLeaks/Xone-Cheat-90--
44e79f03128194de17a900def38735d29bc85572
[ "Apache-2.0" ]
16
2019-03-30T18:57:55.000Z
2021-12-19T22:44:55.000Z
#pragma once #include "IHandleEntity.hpp" namespace SDK { class ICollideable; class IClientNetworkable; class IClientRenderable; class IClientEntity; class AngularImpulse; class IPhysicsShadowController; class IPhysicsObject { public: virtual ~IPhysicsObject(void) {} // returns true if this object is static/unmoveable // NOTE: returns false for objects that are not created static, but set EnableMotion(false); // Call IsMoveable() to find if the object is static OR has motion disabled virtual bool IsStatic() const = 0; virtual bool IsAsleep() const = 0; virtual bool IsTrigger() const = 0; virtual bool IsFluid() const = 0; // fluids are special triggers with fluid controllers attached, they return true to IsTrigger() as well! virtual bool IsHinged() const = 0; virtual bool IsCollisionEnabled() const = 0; virtual bool IsGravityEnabled() const = 0; virtual bool IsDragEnabled() const = 0; virtual bool IsMotionEnabled() const = 0; virtual bool IsMoveable() const = 0; // legacy: IsMotionEnabled() && !IsStatic() virtual bool IsAttachedToConstraint(bool bExternalOnly) const = 0; // Enable / disable collisions for this object virtual void EnableCollisions(bool enable) = 0; // Enable / disable gravity for this object virtual void EnableGravity(bool enable) = 0; // Enable / disable air friction / drag for this object virtual void EnableDrag(bool enable) = 0; // Enable / disable motion (pin / unpin the object) virtual void EnableMotion(bool enable) = 0; // Game can store data in each object (link back to game object) virtual void SetGameData(void *pGameData) = 0; virtual void *GetGameData(void) const = 0; // This flags word can be defined by the game as well virtual void SetGameFlags(unsigned short userFlags) = 0; virtual unsigned short GetGameFlags(void) const = 0; virtual void SetGameIndex(unsigned short gameIndex) = 0; virtual unsigned short GetGameIndex(void) const = 0; // setup various callbacks for this object virtual void SetCallbackFlags(unsigned short callbackflags) = 0; // get the current callback state for this object virtual unsigned short GetCallbackFlags(void) const = 0; // "wakes up" an object // NOTE: ALL OBJECTS ARE "Asleep" WHEN CREATED virtual void Wake(void) = 0; virtual void Sleep(void) = 0; // call this when the collision filter conditions change due to this // object's state (e.g. changing solid type or collision group) virtual void RecheckCollisionFilter() = 0; // NOTE: Contact points aren't updated when collision rules change, call this to force an update // UNDONE: Force this in RecheckCollisionFilter() ? virtual void RecheckContactPoints() = 0; // mass accessors virtual void SetMass(float mass) = 0; virtual float GetMass(void) const = 0; // get 1/mass (it's cached) virtual float GetInvMass(void) const = 0; virtual Vector GetInertia(void) const = 0; virtual Vector GetInvInertia(void) const = 0; virtual void SetInertia(const Vector &inertia) = 0; virtual void SetDamping(const float *speed, const float *rot) = 0; virtual void GetDamping(float *speed, float *rot) const = 0; // coefficients are optional, pass either virtual void SetDragCoefficient(float *pDrag, float *pAngularDrag) = 0; virtual void SetBuoyancyRatio(float ratio) = 0; // Override bouyancy // material index virtual int GetMaterialIndex() const = 0; virtual void SetMaterialIndex(int materialIndex) = 0; // contents bits virtual unsigned int GetContents() const = 0; virtual void SetContents(unsigned int contents) = 0; // Get the radius if this is a sphere object (zero if this is a polygonal mesh) virtual float GetSphereRadius() const = 0; virtual float GetEnergy() const = 0; virtual Vector GetMassCenterLocalSpace() const = 0; // NOTE: This will teleport the object virtual void SetPosition(const Vector &worldPosition, const QAngle &angles, bool isTeleport) = 0; virtual void SetPositionMatrix(const matrix3x4_t&matrix, bool isTeleport) = 0; virtual void GetPosition(Vector *worldPosition, QAngle *angles) const = 0; virtual void GetPositionMatrix(matrix3x4_t *positionMatrix) const = 0; // force the velocity to a new value // NOTE: velocity is in worldspace, angularVelocity is relative to the object's // local axes (just like pev->velocity, pev->avelocity) virtual void SetVelocity(const Vector *velocity, const AngularImpulse *angularVelocity) = 0; // like the above, but force the change into the simulator immediately virtual void SetVelocityInstantaneous(const Vector *velocity, const AngularImpulse *angularVelocity) = 0; // NOTE: velocity is in worldspace, angularVelocity is relative to the object's // local axes (just like pev->velocity, pev->avelocity) virtual void GetVelocity(Vector *velocity, AngularImpulse *angularVelocity) const = 0; // NOTE: These are velocities, not forces. i.e. They will have the same effect regardless of // the object's mass or inertia virtual void AddVelocity(const Vector *velocity, const AngularImpulse *angularVelocity) = 0; // gets a velocity in the object's local frame of reference at a specific point virtual void GetVelocityAtPoint(const Vector &worldPosition, Vector *pVelocity) const = 0; // gets the velocity actually moved by the object in the last simulation update virtual void GetImplicitVelocity(Vector *velocity, AngularImpulse *angularVelocity) const = 0; // NOTE: These are here for convenience, but you can do them yourself by using the matrix // returned from GetPositionMatrix() // convenient coordinate system transformations (params - dest, src) virtual void LocalToWorld(Vector *worldPosition, const Vector &localPosition) const = 0; virtual void WorldToLocal(Vector *localPosition, const Vector &worldPosition) const = 0; // transforms a vector (no translation) from object-local to world space virtual void LocalToWorldVector(Vector *worldVector, const Vector &localVector) const = 0; // transforms a vector (no translation) from world to object-local space virtual void WorldToLocalVector(Vector *localVector, const Vector &worldVector) const = 0; // push on an object // force vector is direction & magnitude of impulse kg in / s virtual void ApplyForceCenter(const Vector &forceVector) = 0; virtual void ApplyForceOffset(const Vector &forceVector, const Vector &worldPosition) = 0; // apply torque impulse. This will change the angular velocity on the object. // HL Axes, kg degrees / s virtual void ApplyTorqueCenter(const AngularImpulse &torque) = 0; // Calculates the force/torque on the center of mass for an offset force impulse (pass output to ApplyForceCenter / ApplyTorqueCenter) virtual void CalculateForceOffset(const Vector &forceVector, const Vector &worldPosition, Vector *centerForce, AngularImpulse *centerTorque) const = 0; // Calculates the linear/angular velocities on the center of mass for an offset force impulse (pass output to AddVelocity) virtual void CalculateVelocityOffset(const Vector &forceVector, const Vector &worldPosition, Vector *centerVelocity, AngularImpulse *centerAngularVelocity) const = 0; // calculate drag scale virtual float CalculateLinearDrag(const Vector &unitDirection) const = 0; virtual float CalculateAngularDrag(const Vector &objectSpaceRotationAxis) const = 0; // returns true if the object is in contact with another object // if true, puts a point on the contact surface in contactPoint, and // a pointer to the object in contactObject // NOTE: You can pass NULL for either to avoid computations // BUGBUG: Use CreateFrictionSnapshot instead of this - this is a simple hack virtual bool GetContactPoint(Vector *contactPoint, IPhysicsObject **contactObject) const = 0; // refactor this a bit - move some of this to IPhysicsShadowController virtual void SetShadow(float maxSpeed, float maxAngularSpeed, bool allowPhysicsMovement, bool allowPhysicsRotation) = 0; virtual void UpdateShadow(const Vector &targetPosition, const QAngle &targetAngles, bool tempDisableGravity, float timeOffset) = 0; // returns number of ticks since last Update() call virtual int GetShadowPosition(Vector *position, QAngle *angles) const = 0; virtual IPhysicsShadowController *GetShadowController(void) const = 0; virtual void RemoveShadowController() = 0; // applies the math of the shadow controller to this object. // for use in your own controllers // returns the new value of secondsToArrival with dt time elapsed //virtual float ComputeShadowControl(const hlshadowcontrol_params_t &params, float secondsToArrival, float dt) = 0; //virtual const CPhysCollide *GetCollide(void) const = 0; //virtual const char *GetName() const = 0; //virtual void BecomeTrigger() = 0; //virtual void RemoveTrigger() = 0; //// sets the object to be hinged. Fixed it place, but able to rotate around one axis. //virtual void BecomeHinged(int localAxis) = 0; //// resets the object to original state //virtual void RemoveHinged() = 0; //// used to iterate the contact points of an object //virtual IPhysicsFrictionSnapshot *CreateFrictionSnapshot() = 0; //virtual void DestroyFrictionSnapshot(IPhysicsFrictionSnapshot *pSnapshot) = 0; //// dumps info about the object to Msg() //virtual void OutputDebugInfo() const = 0; }; class C_BaseEntity { public: IPhysicsObject* CreateVPhysics(void) { typedef IPhysicsObject*(__thiscall* OriginalFn)(void*); return GetVFunc<OriginalFn>(this, 95)(this); } int VPhysicsUpdate(IPhysicsObject *pList) { typedef int(__thiscall* OriginalFn)(void*, IPhysicsObject *); return GetVFunc<OriginalFn>(this, 97)(this, pList); } //95 C_BaseEntity::CreateVPhysics(void) }; class IClientThinkable; class IClientAlphaProperty; class IClientUnknown : public IHandleEntity { public: virtual ICollideable* GetCollideable() = 0; virtual IClientNetworkable* GetClientNetworkable() = 0; virtual IClientRenderable* GetClientRenderable() = 0; virtual IClientEntity* GetIClientEntity() = 0; virtual C_BaseEntity* GetBaseEntity() = 0; virtual IClientThinkable* GetClientThinkable() = 0; //virtual IClientModelRenderable* GetClientModelRenderable() = 0; virtual IClientAlphaProperty* GetClientAlphaProperty() = 0; }; }
47.178571
170
0.737226
[ "mesh", "object", "vector", "solid" ]
41901e6e9de4bb1df1d23772fcb65e28693cb916
4,802
cpp
C++
qt-creator-opensource-src-4.6.1/src/plugins/qmldesigner/components/componentcore/changestyleaction.cpp
kevinlq/Qt-Creator-Opensource-Study
b8cadff1f33f25a5d4ef33ed93f661b788b1ba0f
[ "MIT" ]
5
2018-12-22T14:49:13.000Z
2022-01-13T07:21:46.000Z
qt-creator-opensource-src-4.6.1/src/plugins/qmldesigner/components/componentcore/changestyleaction.cpp
kevinlq/Qt-Creator-Opensource-Study
b8cadff1f33f25a5d4ef33ed93f661b788b1ba0f
[ "MIT" ]
null
null
null
qt-creator-opensource-src-4.6.1/src/plugins/qmldesigner/components/componentcore/changestyleaction.cpp
kevinlq/Qt-Creator-Opensource-Study
b8cadff1f33f25a5d4ef33ed93f661b788b1ba0f
[ "MIT" ]
8
2018-07-17T03:55:48.000Z
2021-12-22T06:37:53.000Z
/**************************************************************************** ** ** Copyright (C) 2017 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of Qt Creator. ** ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms ** and conditions see https://www.qt.io/terms-conditions. For further ** information use the contact form at https://www.qt.io/contact-us. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3 as published by the Free Software ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT ** included in the packaging of this file. Please review the following ** information to ensure the GNU General Public License requirements will ** be met: https://www.gnu.org/licenses/gpl-3.0.html. ** ****************************************************************************/ #include "changestyleaction.h" #include <projectexplorer/project.h> #include <projectexplorer/session.h> #include <QComboBox> #include <QSettings> namespace QmlDesigner { static QString styleConfigFileName(const QString &qmlFileName) { ProjectExplorer::Project *currentProject = ProjectExplorer::SessionManager::projectForFile(Utils::FileName::fromString(qmlFileName)); if (currentProject) foreach (const Utils::FileName &fileName, currentProject->files(ProjectExplorer::Project::SourceFiles)) if (fileName.endsWith("qtquickcontrols2.conf")) return fileName.toString(); return QString(); } ChangeStyleWidgetAction::ChangeStyleWidgetAction(QObject *parent) : QWidgetAction(parent) { } void ChangeStyleWidgetAction::handleModelUpdate(const QString &style) { emit modelUpdated(style); } const char enabledTooltip[] = QT_TRANSLATE_NOOP("ChangeStyleWidgetAction", "Change style for Qt Quick Controls 2."); const char disbledTooltip[] = QT_TRANSLATE_NOOP("ChangeStyleWidgetAction", "Change style for Qt Quick Controls 2. Configuration file qtquickcontrols2.conf not found."); QWidget *ChangeStyleWidgetAction::createWidget(QWidget *parent) { QComboBox *comboBox = new QComboBox(parent); comboBox->setToolTip(tr(enabledTooltip)); comboBox->addItem("Default"); comboBox->addItem("Fusion"); comboBox->addItem("Imagine"); comboBox->addItem("Material"); comboBox->addItem("Universal"); comboBox->setEditable(true); comboBox->setCurrentIndex(0); connect(this, &ChangeStyleWidgetAction::modelUpdated, comboBox, [comboBox](const QString &style) { if (!comboBox) return; QSignalBlocker blocker(comboBox); if (style.isEmpty()) { /* The .conf file is misssing. */ comboBox->setDisabled(true); comboBox->setToolTip(tr(disbledTooltip)); comboBox->setCurrentIndex(0); } else { comboBox->setDisabled(false); comboBox->setToolTip(tr(enabledTooltip)); comboBox->setEditText(style); } }); connect(comboBox, static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::activated), this, [this](const QString &style) { if (style.isEmpty()) return; const Utils::FileName configFileName = Utils::FileName::fromString(styleConfigFileName(qmlFileName)); if (configFileName.exists()) { QSettings infiFile(configFileName.toString(), QSettings::IniFormat); infiFile.setValue("Controls/Style", style); if (view) view->resetPuppet(); } }); return comboBox; } void ChangeStyleAction::currentContextChanged(const SelectionContext &selectionContext) { AbstractView *view = selectionContext.view(); if (view && view->model()) { m_action->view = view; const QString fileName = view->model()->fileUrl().toLocalFile(); if (m_action->qmlFileName == fileName) return; m_action->qmlFileName = fileName; const QString confFileName = styleConfigFileName(fileName); if (Utils::FileName::fromString(confFileName).exists()) { QSettings infiFile(confFileName, QSettings::IniFormat); m_action->handleModelUpdate(infiFile.value("Controls/Style", "Default").toString()); } else { m_action->handleModelUpdate(""); } } } } // namespace QmlDesigner
34.546763
141
0.650979
[ "model" ]
4192c31b02b7489cc1b5e2061ffd0e2079060e48
14,960
cpp
C++
Source/Core/System/vaThreading.cpp
xingyulu-rgb/VRS-DoF
e94d7ed2019b3935ee1665f9667f4e078d95d047
[ "MIT" ]
1
2021-11-18T07:44:23.000Z
2021-11-18T07:44:23.000Z
Source/Core/System/vaThreading.cpp
xingyulu-rgb/VRS-DoF
e94d7ed2019b3935ee1665f9667f4e078d95d047
[ "MIT" ]
null
null
null
Source/Core/System/vaThreading.cpp
xingyulu-rgb/VRS-DoF
e94d7ed2019b3935ee1665f9667f4e078d95d047
[ "MIT" ]
null
null
null
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Copyright (c) 2018, Intel Corporation // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated // documentation files (the "Software"), to deal in the Software without restriction, including without limitation // the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to the following conditions: // The above copyright notice and this permission notice shall be included in all copies or substantial portions of // the Software. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO // THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // // Author(s): Filip Strugar (filip.strugar@intel.com) // /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #pragma once #include "vaThreading.h" #include "Core/vaMath.h" #include "Core/Misc/vaProfiler.h" #ifdef VA_IMGUI_INTEGRATION_ENABLED #include "IntegratedExternals/vaImguiIntegration.h" #endif using namespace Vanilla; thread_local vaThreading::ThreadLocalProps vaThreading::s_threadLocal; void vaThreading::SetMainThread( ) { // make sure this happens only once static std::atomic_int counter = 0; counter++; assert( counter == 1 ); s_threadLocal.MainThread = true; SetThreadName( "!ThreadMain" ); } namespace { string & LocalThreadName( ) { thread_local static string localThreadName; return localThreadName; } }; void vaThreading::SetThreadName( const string & name ) { assert( LocalThreadName() == "" ); if( LocalThreadName() == "" ) LocalThreadName() = name; #if defined(VA_REMOTERY_INTEGRATION_ENABLED) rmt_SetCurrentThreadName( name ); #endif } const char * vaThreading::GetThreadName( ) { if( LocalThreadName() == "" ) { static atomic_int32 s_threadCounter = 0; int32 threadCounter = s_threadCounter.fetch_add(1); LocalThreadName() = vaStringTools::Format( "Thread%04d", threadCounter ); } return LocalThreadName().c_str(); } vaBackgroundTaskManager::vaBackgroundTaskManager( ) { int physicalPackages, physicalCores, logicalCores; vaThreading::GetCPUCoreCountInfo( physicalPackages, physicalCores, logicalCores ); // adhoc heuristic for determining the number of worker threads m_threadPoolSize = vaMath::Max( 2, ( physicalCores + logicalCores - 1 ) / 2 ); } void vaBackgroundTaskManager::ClearAndRestart( ) { assert( !m_stopped ); if( m_stopped ) return; // prevent any subsequent spawns { std::unique_lock<mutex> spawnLock( m_spawnMutex ); m_stopped = true; } // Signal to all tasks that they need to get stopped and remove all waiting pooled tasks { std::unique_lock<mutex> tasksLock( m_currentTasksMutex ); for( int i = 0; i < (int)m_currentTasks.size(); i++ ) m_currentTasks[i]->Context.ForceStop = true; } // Wait for all tasks to finish ClearFinishedTasks(); { std::unique_lock<mutex> tasksLock( m_currentTasksMutex ); while( m_currentTasks.size() > 0 ) { shared_ptr<TaskInternal> firstTask = m_currentTasks[0]; tasksLock.unlock(); WaitUntilFinished( firstTask ); ClearFinishedTasks(); tasksLock.lock(); } } assert( m_waitingPooledTasks.empty() ); // restart { std::unique_lock<mutex> spawnLock( m_spawnMutex ); m_stopped = false; } } void vaBackgroundTaskManager::Run( const shared_ptr<TaskInternal> & _task ) { assert( !_task->IsFinished ); std::thread thread( [this, _task]() { shared_ptr<TaskInternal> task = _task; bool loopDone = true; do { assert( !task->IsFinished ); // if( !task->Context.ForceStop ) // <- not sure if we want this task->Result = task->UserFunction( task->Context ); assert( !task->IsFinished ); task->Context.Progress = 1.0f; { std::unique_lock<std::mutex> cvLock( task->WaitFinishedMutex ); task->IsFinished = true; task->WaitFinishedCV.notify_all(); } // using thread pool - if we can spawn, spawn, if we can't then if( ( task->Flags & SpawnFlags::UseThreadPool ) != 0 ) { std::unique_lock<mutex> tasksLock( m_currentTasksMutex ); // if we're a threadpool task and there's some threadpool tasks waiting, continue working if( !m_waitingPooledTasks.empty() ) { task = m_waitingPooledTasks.front(); m_waitingPooledTasks.pop(); task->PooledWaiting = false; loopDone = false; } else { m_currentThreadPoolUseCount--; loopDone = true; } } } while ( !loopDone ); }); thread.detach(); // run free little one!! } bool vaBackgroundTaskManager::Spawn( shared_ptr<Task> & outTask, const string & taskName, SpawnFlags flags, const std::function< bool( TaskContext & context ) > & taskFunction ) { std::unique_lock<mutex> spawnLock( m_spawnMutex ); assert( !m_stopped ); if( m_stopped ) return false; shared_ptr<vaBackgroundTaskManager::TaskInternal> newTask = std::make_shared<vaBackgroundTaskManager::TaskInternal>( taskName, flags, taskFunction ); outTask = newTask; { std::unique_lock<mutex> tasksLock( m_currentTasksMutex ); m_currentTasks.push_back( newTask ); // using thread pool - if we can spawn, spawn, if we can't then add to waiting list if( ( newTask->Flags & SpawnFlags::UseThreadPool ) != 0 ) { if( m_currentThreadPoolUseCount >= m_threadPoolSize ) { m_waitingPooledTasks.push( newTask ); newTask->PooledWaiting = true; return true; } else { m_currentThreadPoolUseCount++; } } } Run( newTask ); return true; } void vaBackgroundTaskManager::WaitUntilFinished( const shared_ptr<Task> & _task ) { if( _task == nullptr ) return; const shared_ptr<TaskInternal> task = std::static_pointer_cast<TaskInternal>(_task); { std::unique_lock<std::mutex> cvLock( task->WaitFinishedMutex ); while( !task->IsFinished ) { if( vaThreading::IsMainThread( ) ) vaCore::MessageLoopTick(); using namespace std::chrono_literals; task->WaitFinishedCV.wait_for(cvLock, 20ms); } } assert( task->IsFinished ); } float vaBackgroundTaskManager::GetProgress( const shared_ptr<Task> & _task ) { const shared_ptr<TaskInternal> task = std::static_pointer_cast<TaskInternal>(_task); float progress = task->Context.Progress; if( task->IsFinished ) assert( task->Context.Progress == 1.0f ); return vaMath::Clamp( progress, 0.0f, 1.0f ); } bool vaBackgroundTaskManager::IsFinished( const shared_ptr<Task> & _task ) { const shared_ptr<TaskInternal> task = std::static_pointer_cast<TaskInternal>(_task); return task->IsFinished; } void vaBackgroundTaskManager::MarkForStopping( const shared_ptr<Task> & _task ) { const shared_ptr<TaskInternal> task = std::static_pointer_cast<TaskInternal>(_task); task->Context.ForceStop = true; } void vaBackgroundTaskManager::ClearFinishedTasks( ) { // Clear all 'done' tasks from the array std::unique_lock<mutex> tasksLock( m_currentTasksMutex ); for( int i = (int)m_currentTasks.size()-1; i >= 0; i-- ) { if( m_currentTasks[i]->IsFinished ) { // replace now empty one by last if not already last if( i != (int)m_currentTasks.size()-1 ) m_currentTasks[i] = m_currentTasks.back(); // erase last m_currentTasks.pop_back(); } } } void vaBackgroundTaskManager::ImGuiTaskProgress( const shared_ptr<Task> & _task ) { const shared_ptr<TaskInternal> task = std::static_pointer_cast<TaskInternal>(_task); bool taskWaiting = task->PooledWaiting; taskWaiting; #ifdef VA_IMGUI_INTEGRATION_ENABLED if( taskWaiting ) { ImGui::PushStyleColor( ImGuiCol_Text, ImGui::GetStyleColorVec4(ImGuiCol_TextDisabled) ); } ImGui::ProgressBar( task->Context.Progress, ImVec2(-1, 0), task->Name.c_str() ); if( taskWaiting ) { ImGui::PopStyleColor( 1 ); } #endif } void vaBackgroundTaskManager::InsertImGuiContentInternal( const vector<shared_ptr<TaskInternal>> & tasks ) { tasks; #ifdef VA_IMGUI_INTEGRATION_ENABLED for( const shared_ptr<TaskInternal> & task : tasks ) { ImGuiTaskProgress( task ); } #endif } void vaBackgroundTaskManager::InsertImGuiContent( ) { #ifdef VA_IMGUI_INTEGRATION_ENABLED vector<shared_ptr<TaskInternal>> tasksCopy; ClearFinishedTasks(); { std::unique_lock<mutex> tasksLock( m_currentTasksMutex ); for( auto obj : m_currentTasks ) if( (obj->Flags & SpawnFlags::ShowInUI) != 0 && !obj->Context.HideInUI ) tasksCopy.push_back( obj ); } if( tasksCopy.size() == 0 ) return; std::sort( tasksCopy.begin(), tasksCopy.end(), [](const shared_ptr<TaskInternal> & a, const shared_ptr<TaskInternal> & b) -> bool { return a->Name < b->Name; } ); InsertImGuiContentInternal( tasksCopy ); #endif } void vaBackgroundTaskManager::InsertImGuiWindow( const string & title ) { title; #ifdef VA_IMGUI_INTEGRATION_ENABLED vector<shared_ptr<TaskInternal>> tasksCopy; ClearFinishedTasks(); { std::unique_lock<mutex> tasksLock( m_currentTasksMutex ); for( auto obj : m_currentTasks ) if( (obj->Flags & SpawnFlags::ShowInUI) != 0 && !obj->Context.HideInUI ) tasksCopy.push_back( obj ); } //#define VISUAL_DEBUGGING_ENABLED #ifndef VISUAL_DEBUGGING_ENABLED if( tasksCopy.size() == 0 ) return; #endif std::sort( tasksCopy.begin(), tasksCopy.end(), [](const shared_ptr<TaskInternal> & a, const shared_ptr<TaskInternal> & b) -> bool { return a->Name < b->Name; } ); ImGuiIO& io = ImGui::GetIO(); float lineHeight = ImGui::GetFrameHeightWithSpacing(); //float lineHeight = ImGui::GetFrameHeight(); ImVec2 windowSize = ImVec2( 500.0f, lineHeight * tasksCopy.size() + 30.0f #ifdef VISUAL_DEBUGGING_ENABLED + 70.0f #endif ); ImGui::SetNextWindowPos( ImVec2( io.DisplaySize.x/2.0f - windowSize.x / 2.0f, /*io.DisplaySize.y/2.0f - windowSize.y / 2.0f*/ 10 ), ImGuiCond_Appearing ); // Normally user code doesn't need/want to call it because positions are saved in .ini file anyway. Here we just want to make the demo initial state a bit more friendly! ImGui::SetNextWindowSize( ImVec2( windowSize.x, windowSize.y ), ImGuiCond_Always ); ImGuiWindowFlags windowFlags = 0; windowFlags |= ImGuiWindowFlags_NoResize ; //windowFlags |= ImGuiWindowFlags_NoMove ; windowFlags |= ImGuiWindowFlags_NoScrollbar ; windowFlags |= ImGuiWindowFlags_NoScrollWithMouse ; windowFlags |= ImGuiWindowFlags_NoCollapse ; //windowFlags |= ImGuiWindowFlags_NoInputs ; windowFlags |= ImGuiWindowFlags_NoFocusOnAppearing ; //windowFlags |= ImGuiWindowFlags_NoBringToFrontOnFocus ; windowFlags |= ImGuiWindowFlags_NoDocking ; windowFlags |= ImGuiWindowFlags_NoSavedSettings ; if( ImGui::Begin( title.c_str( ), nullptr, windowFlags ) ) { #ifdef VISUAL_DEBUGGING_ENABLED shared_ptr<vaBackgroundTaskManager::Task> lastTask = nullptr; { std::unique_lock<mutex> tasksLock( m_currentTasksMutex ); if( m_currentTasks.size() > 0 ) lastTask = m_currentTasks.back(); } static int lastTaskIndex = 0; if( ImGui::Button("TEST START TASK") ) { int taskLength = vaRandom::Singleton.NextIntRange( 200 ); bool spawnSubTask = vaRandom::Singleton.NextIntRange( 200 ) > 175; lastTaskIndex++; vaBackgroundTaskManager::GetInstance().Spawn( vaStringTools::Format( "test_%d", lastTaskIndex ), SpawnFlags::UseThreadPool | SpawnFlags::ShowInUI, [taskLength, spawnSubTask]( vaBackgroundTaskManager::TaskContext & context ) { if( spawnSubTask ) { vaBackgroundTaskManager::GetInstance().Spawn( vaStringTools::Format( "test_%d", lastTaskIndex ), SpawnFlags::UseThreadPool | SpawnFlags::ShowInUI, [taskLength]( vaBackgroundTaskManager::TaskContext & context ) { for( int i = 0; i < taskLength; i++ ) { context.Progress = (float)(i) / (float)(taskLength-1); if( context.ForceStop ) break; vaThreading::Sleep( 100 ); } return true; } ); } for( int i = 0; i < taskLength; i++ ) { context.Progress = (float)(i) / (float)(taskLength-1); if( context.ForceStop ) break; vaThreading::Sleep( 100 ); } return true; } ); } if( lastTask != nullptr ) { if( ImGui::Button("TEST FORCE STOP LAST TASK") ) vaBackgroundTaskManager::GetInstance().MarkForStopping( lastTask ); if( ImGui::Button("TEST WAIT LAST TASK") ) vaBackgroundTaskManager::GetInstance().WaitUntilFinished( lastTask ); } ImGui::Separator(); #endif InsertImGuiContentInternal( tasksCopy ); } ImGui::End( ); #endif }
35.961538
332
0.604746
[ "vector" ]
4196f6b8738c8abc78d032a6ce41b9752b912c51
5,618
cc
C++
kythe/cxx/verifier/verifier_main.cc
wlynch/kythe
55231f7e76f202827e4fe3fcf36270d36543414f
[ "Apache-2.0" ]
null
null
null
kythe/cxx/verifier/verifier_main.cc
wlynch/kythe
55231f7e76f202827e4fe3fcf36270d36543414f
[ "Apache-2.0" ]
null
null
null
kythe/cxx/verifier/verifier_main.cc
wlynch/kythe
55231f7e76f202827e4fe3fcf36270d36543414f
[ "Apache-2.0" ]
null
null
null
/* * Copyright 2014 The Kythe Authors. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include <stdio.h> #include <unistd.h> #include <string> #include "absl/flags/flag.h" #include "absl/flags/parse.h" #include "absl/flags/usage.h" #include "absl/strings/str_format.h" #include "assertion_ast.h" #include "glog/logging.h" #include "google/protobuf/io/coded_stream.h" #include "google/protobuf/io/zero_copy_stream.h" #include "google/protobuf/io/zero_copy_stream_impl.h" #include "kythe/cxx/common/init.h" #include "kythe/proto/storage.pb.h" #include "verifier.h" ABSL_FLAG(bool, show_protos, false, "Show protocol buffers read from standard in"); ABSL_FLAG(bool, show_goals, false, "Show goals after parsing"); ABSL_FLAG(bool, ignore_dups, false, "Ignore duplicate facts during verification"); ABSL_FLAG(bool, graphviz, false, "Only dump facts as a GraphViz-compatible graph"); ABSL_FLAG(bool, annotated_graphviz, false, "Solve and annotate a GraphViz graph."); ABSL_FLAG(std::string, goal_prefix, "//-", "Denote goals with this string."); ABSL_FLAG(bool, use_file_nodes, false, "Look for assertions in UTF8 file nodes."); ABSL_FLAG(bool, check_for_singletons, true, "Fail on singleton variables."); ABSL_FLAG(std::string, goal_regex, "", "If nonempty, denote goals with this regex. " "The regex must match the entire line. Expects one capture group."); ABSL_FLAG(bool, convert_marked_source, false, "Convert MarkedSource-valued facts to subgraphs."); ABSL_FLAG(bool, show_anchors, false, "Show anchor locations instead of @s"); ABSL_FLAG(bool, file_vnames, true, "Find file vnames by matching file content."); int main(int argc, char** argv) { GOOGLE_PROTOBUF_VERIFY_VERSION; kythe::InitializeProgram(argv[0]); absl::SetProgramUsageMessage(R"(Verification tool for Kythe databases. Reads Kythe facts from standard input and checks them against one or more rule files. See https://kythe.io/docs/kythe-verifier.html for more details on invocation and rule syntax. Example: ${INDEXER_BIN} -i $1 | ${VERIFIER_BIN} --show_protos --show_goals $1 cat foo.entries | ${VERIFIER_BIN} goals1.cc goals2.cc cat foo.entries | ${VERIFIER_BIN} --use_file_nodes )"); std::vector<char*> remain = absl::ParseCommandLine(argc, argv); kythe::verifier::Verifier v; if (absl::GetFlag(FLAGS_goal_regex).empty()) { v.SetGoalCommentPrefix(absl::GetFlag(FLAGS_goal_prefix)); } else { std::string error; if (!v.SetGoalCommentRegex(absl::GetFlag(FLAGS_goal_regex), &error)) { absl::FPrintF(stderr, "While parsing goal regex: %s\n", error); return 1; } } if (absl::GetFlag(FLAGS_ignore_dups)) { v.IgnoreDuplicateFacts(); } if (absl::GetFlag(FLAGS_annotated_graphviz)) { v.SaveEVarAssignments(); } if (absl::GetFlag(FLAGS_use_file_nodes)) { v.UseFileNodes(); } if (absl::GetFlag(FLAGS_convert_marked_source)) { v.ConvertMarkedSource(); } if (absl::GetFlag(FLAGS_show_anchors)) { v.ShowAnchors(); } if (!absl::GetFlag(FLAGS_file_vnames)) { v.IgnoreFileVnames(); } std::string dbname = "database"; size_t facts = 0; kythe::proto::Entry entry; google::protobuf::uint32 byte_size; google::protobuf::io::FileInputStream raw_input(STDIN_FILENO); for (;;) { google::protobuf::io::CodedInputStream coded_input(&raw_input); coded_input.SetTotalBytesLimit(INT_MAX); if (!coded_input.ReadVarint32(&byte_size)) { break; } auto limit = coded_input.PushLimit(byte_size); if (!entry.ParseFromCodedStream(&coded_input)) { absl::FPrintF(stderr, "Error reading around fact %zu\n", facts); return 1; } if (absl::GetFlag(FLAGS_show_protos)) { entry.PrintDebugString(); putchar('\n'); } if (!v.AssertSingleFact(&dbname, facts, entry)) { absl::FPrintF(stderr, "Error asserting fact %zu\n", facts); return 1; } ++facts; } if (!v.PrepareDatabase()) { return 1; } if (!absl::GetFlag(FLAGS_graphviz)) { std::vector<std::string> rule_files(remain.begin() + 1, remain.end()); if (rule_files.empty() && !absl::GetFlag(FLAGS_use_file_nodes)) { absl::FPrintF(stderr, "No rule files specified\n"); return 1; } for (const auto& rule_file : rule_files) { if (rule_file.empty()) { continue; } if (!v.LoadInlineRuleFile(rule_file)) { absl::FPrintF(stderr, "Failed loading %s.\n", rule_file); return 2; } } } if (absl::GetFlag(FLAGS_check_for_singletons) && v.CheckForSingletonEVars()) { return 1; } if (absl::GetFlag(FLAGS_show_goals)) { v.ShowGoals(); } int result = 0; if (!v.VerifyAllGoals()) { absl::FPrintF( stderr, "Could not verify all goals. The furthest we reached was:\n "); v.DumpErrorGoal(v.highest_group_reached(), v.highest_goal_reached()); result = 1; } if (absl::GetFlag(FLAGS_graphviz) || absl::GetFlag(FLAGS_annotated_graphviz)) { v.DumpAsDot(); } return result; }
31.211111
80
0.685119
[ "vector" ]
419ececbdc01526f8de5016702d79e268ad99558
2,286
cpp
C++
src/ui/widgets/Viewport.cpp
ChillstepCoder/Vorb
f74c0cfa3abde4fed0e9ec9d936b23c5210ba2ba
[ "MIT" ]
65
2018-06-03T23:09:46.000Z
2021-07-22T22:03:34.000Z
src/ui/widgets/Viewport.cpp
ChillstepCoder/Vorb
f74c0cfa3abde4fed0e9ec9d936b23c5210ba2ba
[ "MIT" ]
8
2018-06-20T17:21:30.000Z
2020-06-30T01:06:26.000Z
src/ui/widgets/Viewport.cpp
ChillstepCoder/Vorb
f74c0cfa3abde4fed0e9ec9d936b23c5210ba2ba
[ "MIT" ]
34
2018-06-04T03:40:52.000Z
2022-02-15T07:02:05.000Z
#include "Vorb/stdafx.h" #include "Vorb/ui/InputDispatcher.h" #include "Vorb/ui/widgets/Viewport.h" #include "Vorb/ui/widgets/Widget.h" #include "Vorb/ui/GameWindow.h" vui::Viewport::Viewport(const GameWindow* window /*= nullptr*/) : Widget(), m_window(window) { m_clipping = Clipping{ ClippingState::HIDDEN, ClippingState::HIDDEN, ClippingState::HIDDEN, ClippingState::HIDDEN }; } vui::Viewport::~Viewport() { // Empty } void vui::Viewport::init(const nString& name, const f32v4& dimensions, vg::SpriteFont* defaultFont /*= nullptr*/, vg::SpriteBatch* spriteBatch /*= nullptr*/) { Widget::init(name, dimensions); m_viewport = this; updateDescendantViewports(); m_positionType = PositionType::STATIC_TO_WINDOW; m_renderer.init(defaultFont, spriteBatch); } void vui::Viewport::init(const nString& name, const Length2& position, const Length2& size, vg::SpriteFont* defaultFont /*= nullptr*/, vg::SpriteBatch* spriteBatch /*= nullptr*/) { Widget::init(name, position, size); m_viewport = this; updateDescendantViewports(); m_positionType = PositionType::STATIC_TO_WINDOW; m_renderer.init(defaultFont, spriteBatch); } void vui::Viewport::dispose() { IWidget::dispose(); m_renderer.dispose(); m_window = nullptr; } void vui::Viewport::enable() { if (!m_flags.isEnabled) { vui::InputDispatcher::window.onResize += makeDelegate(this, &Viewport::onResize); } Widget::enable(); } void vui::Viewport::disable() { if (m_flags.isEnabled) { vui::InputDispatcher::window.onResize -= makeDelegate(this, &Viewport::onResize); } Widget::disable(); } void vui::Viewport::update(f32 dt /*= 0.0f*/) { if (!m_flags.isEnabled) return; IWidget::update(dt); IWidget::updateDescendants(dt); } void vui::Viewport::draw() { if (!m_flags.isEnabled) return; m_renderer.prepare(); addDescendantDrawables(m_renderer); m_renderer.render(f32v2(m_window->getViewportDims())); } void vui::Viewport::setGameWindow(const GameWindow* window) { m_window = window; m_flags.needsDimensionUpdate = true; } void vui::Viewport::onResize(Sender, const WindowResizeEvent&) { m_flags.needsDimensionUpdate = true; markDescendantsToUpdateDimensions(); }
25.977273
180
0.692476
[ "render" ]
419ed418153a25e86a3d3299d772bc002ce71c77
17,119
cpp
C++
tests/brokertest/BytesMessageTest.cpp
AlphaHot/broker
671e1f06901b0f4b9db19864e2e8eb2cd5408310
[ "Apache-2.0" ]
null
null
null
tests/brokertest/BytesMessageTest.cpp
AlphaHot/broker
671e1f06901b0f4b9db19864e2e8eb2cd5408310
[ "Apache-2.0" ]
null
null
null
tests/brokertest/BytesMessageTest.cpp
AlphaHot/broker
671e1f06901b0f4b9db19864e2e8eb2cd5408310
[ "Apache-2.0" ]
null
null
null
/* * Copyright 2014-present IVK JSC. 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 "BytesMessageTest.h" #include <cstring> #include <fake_cpp14.h> //////////////////////////////////////////////////////////////////////////////// void BytesMessageTest::SetUp() { cmsProvider = std::make_unique<CMSProvider>(getBrokerURL()); cmsProvider->cleanUpDestination(); } //////////////////////////////////////////////////////////////////////////////// TEST_F(BytesMessageTest, testSendRecvCloneBytesMessage) { // Create CMS Object for Comms cms::Session *session(cmsProvider->getSession()); cms::MessageConsumer *consumer = cmsProvider->getConsumer(); cms::MessageProducer *producer = cmsProvider->getProducer(); producer->setDeliveryMode(DeliveryMode::NON_PERSISTENT); unsigned char test[4]; memcpy(test, "test", 4); cms::BytesMessage *message = session->createBytesMessage(test, 4); message->writeBoolean(false); message->writeBoolean(true); message->writeString("test2"); message->writeLong(0); message->writeInt(1); producer->send(message); delete message; message = nullptr; message = (cms::BytesMessage *)consumer->receive(5000); EXPECT_TRUE(message != nullptr); unsigned char data[4]; memset(&data[0], 0, 4); message->readBytes(&data[0], 4); EXPECT_TRUE(memcmp(data, test, 4) == 0); EXPECT_TRUE(message->readBoolean() == false); EXPECT_TRUE(message->readBoolean() == true); EXPECT_TRUE(message->readString() == "test2"); EXPECT_TRUE(message->readLong() == 0); EXPECT_TRUE(message->readInt() == 1); auto *clonedMessage = (cms::BytesMessage *)message->clone(); EXPECT_TRUE(clonedMessage != nullptr); memset(&data[0], 0, 4); clonedMessage->readBytes(&data[0], 4); EXPECT_TRUE(memcmp(data, test, 4) == 0); EXPECT_TRUE(clonedMessage->readBoolean() == false); EXPECT_TRUE(clonedMessage->readBoolean() == true); EXPECT_TRUE(clonedMessage->readString() == "test2"); EXPECT_TRUE(clonedMessage->readLong() == 0); EXPECT_TRUE(clonedMessage->readInt() == 1); delete message; delete clonedMessage; } //////////////////////////////////////////////////////////////////////////////// TEST_F(BytesMessageTest, testGetBodyLength) { Session *session = cmsProvider->getSession(); BytesMessage *msg = session->createBytesMessage(); int len = 10; try { for (int i = 0; i < len; i++) { msg->writeLong(9223372036854775807LL); } } catch (CMSException &ex) { ex.printStackTrace(); } try { msg->reset(); int resLen = msg->getBodyLength(); EXPECT_TRUE(resLen == (len * static_cast<int>(sizeof(long long)))); } catch (CMSException &ex) { ex.printStackTrace(); EXPECT_TRUE(false) << ex.getMessage(); } delete msg; } //////////////////////////////////////////////////////////////////////////////// TEST_F(BytesMessageTest, testReadBoolean) { Session *session = cmsProvider->getSession(); BytesMessage *msg = session->createBytesMessage(); try { msg->writeBoolean(true); msg->reset(); EXPECT_TRUE(msg->readBoolean()); } catch (CMSException &ex) { ex.printStackTrace(); EXPECT_TRUE(false) << ex.getMessage(); } delete msg; } //////////////////////////////////////////////////////////////////////////////// TEST_F(BytesMessageTest, testReadByte) { Session *session = cmsProvider->getSession(); BytesMessage *msg = session->createBytesMessage(); try { msg->writeByte((unsigned char)2); msg->reset(); EXPECT_TRUE(msg->readByte() == 2); } catch (CMSException &ex) { ex.printStackTrace(); EXPECT_TRUE(false) << ex.getMessage(); } delete msg; } //////////////////////////////////////////////////////////////////////////////// TEST_F(BytesMessageTest, testReadShort) { Session *session = cmsProvider->getSession(); BytesMessage *msg = session->createBytesMessage(); try { msg->writeShort((short)3000); msg->reset(); EXPECT_TRUE(msg->readShort() == 3000); } catch (CMSException &ex) { ex.printStackTrace(); EXPECT_TRUE(false) << ex.getMessage(); } delete msg; } //////////////////////////////////////////////////////////////////////////////// TEST_F(BytesMessageTest, testReadUnsignedShort) { Session *session = cmsProvider->getSession(); BytesMessage *msg = session->createBytesMessage(); try { msg->writeShort((short)3000); msg->reset(); EXPECT_TRUE(msg->readUnsignedShort() == 3000); } catch (CMSException &ex) { ex.printStackTrace(); EXPECT_TRUE(false) << ex.getMessage(); } delete msg; } //////////////////////////////////////////////////////////////////////////////// TEST_F(BytesMessageTest, testReadChar) { Session *session = cmsProvider->getSession(); BytesMessage *msg = session->createBytesMessage(); try { msg->writeChar('a'); msg->reset(); EXPECT_TRUE(msg->readChar() == 'a'); } catch (CMSException &ex) { ex.printStackTrace(); EXPECT_TRUE(false) << ex.getMessage(); } delete msg; } //////////////////////////////////////////////////////////////////////////////// TEST_F(BytesMessageTest, testReadInt) { Session *session = cmsProvider->getSession(); BytesMessage *msg = session->createBytesMessage(); try { msg->writeInt(3000); msg->reset(); EXPECT_TRUE(msg->readInt() == 3000); } catch (CMSException &ex) { ex.printStackTrace(); EXPECT_TRUE(false) << ex.getMessage(); } delete msg; } //////////////////////////////////////////////////////////////////////////////// TEST_F(BytesMessageTest, testReadLong) { Session *session = cmsProvider->getSession(); BytesMessage *msg = session->createBytesMessage(); try { msg->writeLong(3000); msg->reset(); EXPECT_TRUE(msg->readLong() == 3000); } catch (CMSException &ex) { ex.printStackTrace(); EXPECT_TRUE(false) << ex.getMessage(); } delete msg; } //////////////////////////////////////////////////////////////////////////////// TEST_F(BytesMessageTest, testReadFloat) { Session *session = cmsProvider->getSession(); BytesMessage *msg = session->createBytesMessage(); try { msg->writeFloat(3.3F); msg->reset(); EXPECT_TRUE(msg->readFloat() == 3.3F); } catch (CMSException &ex) { ex.printStackTrace(); EXPECT_TRUE(false) << ex.getMessage(); } delete msg; } //////////////////////////////////////////////////////////////////////////////// TEST_F(BytesMessageTest, testReadDouble) { Session *session = cmsProvider->getSession(); BytesMessage *msg = session->createBytesMessage(); try { msg->writeDouble(3.3); msg->reset(); EXPECT_TRUE(msg->readDouble() == 3.3); } catch (CMSException &ex) { ex.printStackTrace(); EXPECT_TRUE(false) << ex.getMessage(); } delete msg; } //////////////////////////////////////////////////////////////////////////////// TEST_F(BytesMessageTest, testReadString) { Session *session = cmsProvider->getSession(); BytesMessage *msg = session->createBytesMessage(); try { std::string str = "this is a test"; msg->writeUTF(str); msg->reset(); EXPECT_TRUE(msg->readUTF() == str); } catch (CMSException &ex) { ex.printStackTrace(); EXPECT_TRUE(false) << ex.getMessage(); } delete msg; } //////////////////////////////////////////////////////////////////////////////// TEST_F(BytesMessageTest, testReadUTF) { Session *session = cmsProvider->getSession(); BytesMessage *msg = session->createBytesMessage(); try { std::string str = "this is a test"; msg->writeUTF(str); msg->reset(); EXPECT_TRUE(msg->readUTF() == str); } catch (CMSException &ex) { ex.printStackTrace(); EXPECT_TRUE(false) << ex.getMessage(); } delete msg; } //////////////////////////////////////////////////////////////////////////////// TEST_F(BytesMessageTest, testReadBytesbyteArray) { Session *session = cmsProvider->getSession(); BytesMessage *msg = session->createBytesMessage(); try { unsigned char data[50]; for (int i = 0; i < 50; i++) { data[i] = (unsigned char)i; } msg->writeBytes(&data[0], 0, 50); msg->reset(); unsigned char test[50]; msg->readBytes(test, 50); for (int i = 0; i < 50; i++) { EXPECT_TRUE(test[i] == i); } EXPECT_THROW(msg->readBytes(test, -1), cms::CMSException) << "Should have thrown a CMSException"; } catch (CMSException &ex) { ex.printStackTrace(); EXPECT_TRUE(false) << ex.getMessage(); } delete msg; } //////////////////////////////////////////////////////////////////////////////// TEST_F(BytesMessageTest, testReadBytesbyteArray2) { Session *session = cmsProvider->getSession(); BytesMessage *msg = session->createBytesMessage(); try { std::vector<unsigned char> data(50); for (int i = 0; i < 50; i++) { data.at(i) = (unsigned char)i; } msg->writeBytes(data); msg->reset(); std::vector<unsigned char> test(50); msg->readBytes(test); for (int i = 0; i < 50; i++) { EXPECT_TRUE(test[i] == i); } EXPECT_THROW(msg->readBytes(test), cms::CMSException) << "Should have thrown a CMSException"; } catch (CMSException &ex) { ex.printStackTrace(); EXPECT_TRUE(false) << ex.getMessage(); } delete msg; } //////////////////////////////////////////////////////////////////////////////// TEST_F(BytesMessageTest, testGetBodyBytes) { Session *session = cmsProvider->getSession(); BytesMessage *msg = session->createBytesMessage(); try { unsigned char data[50]; for (int i = 0; i < 50; i++) { data[i] = (unsigned char)i; } msg->setBodyBytes(data, 50); msg->reset(); unsigned char *data2; data2 = msg->getBodyBytes(); for (int i = 0; i < 50; i++) { EXPECT_TRUE(data[i] == data2[i]); } } catch (CMSException &ex) { ex.printStackTrace(); EXPECT_TRUE(false) << ex.getMessage(); } delete msg; } //////////////////////////////////////////////////////////////////////////////// TEST_F(BytesMessageTest, testClearBody) { Session *session = cmsProvider->getSession(); BytesMessage *bytesMessage = session->createBytesMessage(); try { bytesMessage->writeInt(1); bytesMessage->readInt(); bytesMessage->clearBody(); bytesMessage->writeInt(1); bytesMessage->readInt(); } catch (const MessageNotReadableException &) { } catch (const MessageNotWriteableException &ex) { EXPECT_TRUE(false) << ex.getMessage(); } delete bytesMessage; } //////////////////////////////////////////////////////////////////////////////// TEST_F(BytesMessageTest, testReset) { Session *session = cmsProvider->getSession(); BytesMessage *message = session->createBytesMessage(); try { message->writeDouble(24.5); message->writeLong(311); } catch (const MessageNotWriteableException &) { EXPECT_TRUE(false) << ("should be writeable"); } message->reset(); try { EXPECT_DOUBLE_EQ(message->readDouble(), 24.5); EXPECT_EQ(message->readLong(), 311LL); } catch (const MessageNotReadableException &) { EXPECT_TRUE(false) << ("should be readable"); } EXPECT_THROW(message->writeInt(33), cms::MessageNotWriteableException) << ("should throw exception"); delete message; } //////////////////////////////////////////////////////////////////////////////// TEST_F(BytesMessageTest, testReadOnlyBody) { Session *session = cmsProvider->getSession(); BytesMessage *message = session->createBytesMessage(); std::vector<unsigned char> buffer(3); unsigned char array[2] = {0, 0}; try { message->writeBoolean(true); message->writeByte((unsigned char)1); message->writeByte((unsigned char)1); message->writeBytes(buffer); message->writeBytes(&array[0], 0, 2); message->writeChar('a'); message->writeDouble(1.5); message->writeFloat((float)1.5); message->writeInt(1); message->writeLong(1); message->writeString("stringobj"); message->writeShort((short)1); message->writeShort((short)1); message->writeUTF("utfstring"); } catch (const MessageNotWriteableException &) { EXPECT_TRUE(false) << ("should be writeable"); } message->reset(); try { message->readBoolean(); message->readByte(); message->readByte(); message->readBytes(buffer); message->readBytes(&array[0], 2); message->readChar(); message->readDouble(); message->readFloat(); message->readInt(); message->readLong(); message->readString(); message->readShort(); message->readUnsignedShort(); message->readUTF(); } catch (const MessageNotReadableException &) { EXPECT_TRUE(false) << ("should be readable"); } EXPECT_THROW(message->writeBoolean(true), cms::MessageNotWriteableException) << ("Should have thrown exception"); EXPECT_THROW(message->writeByte((unsigned char)1), cms::MessageNotWriteableException) << ("Should have thrown exception"); EXPECT_THROW(message->writeBytes(buffer), cms::MessageNotWriteableException) << ("Should have thrown exception"); EXPECT_THROW(message->writeBytes(&array[0], 0, 2), cms::MessageNotWriteableException) << ("Should have thrown exception"); EXPECT_THROW(message->writeChar('a'), cms::MessageNotWriteableException) << ("Should have thrown exception"); EXPECT_THROW(message->writeDouble(1.5), cms::MessageNotWriteableException) << ("Should have thrown exception"); EXPECT_THROW(message->writeFloat(1.5F), cms::MessageNotWriteableException) << ("Should have thrown exception"); EXPECT_THROW(message->writeInt(1), cms::MessageNotWriteableException) << ("Should have thrown exception"); EXPECT_THROW(message->writeLong(1L), cms::MessageNotWriteableException) << ("Should have thrown exception"); EXPECT_THROW(message->writeString("StringObject"), cms::MessageNotWriteableException) << ("Should have thrown exception"); EXPECT_THROW(message->writeShort((short)1), cms::MessageNotWriteableException) << ("Should have thrown exception"); EXPECT_THROW(message->writeUTF("UTFString"), cms::MessageNotWriteableException) << ("Should have thrown exception"); EXPECT_THROW(message->writeBoolean(true), cms::MessageNotWriteableException) << ("Should have thrown exception"); delete message; } //////////////////////////////////////////////////////////////////////////////// TEST_F(BytesMessageTest, testWriteOnlyBody) { Session *session = cmsProvider->getSession(); BytesMessage *message = session->createBytesMessage(); message->clearBody(); std::vector<unsigned char> buffer(3); unsigned char array[2]; try { message->writeBoolean(true); message->writeByte((unsigned char)1); message->writeByte((unsigned char)1); message->writeBytes(buffer); message->writeBytes(&array[0], 0, 2); message->writeChar('a'); message->writeDouble(1.5); message->writeFloat((float)1.5); message->writeInt(1); message->writeLong(1LL); message->writeString("stringobj"); message->writeShort((short)1); message->writeShort((short)1); message->writeUTF("utfstring"); } catch (const MessageNotWriteableException &) { EXPECT_TRUE(false) << ("should be writeable"); } EXPECT_THROW(message->readBoolean(), cms::MessageNotReadableException) << ("Should have thrown exception"); EXPECT_THROW(message->readByte(), cms::MessageNotReadableException) << ("Should have thrown exception"); EXPECT_THROW(message->readBytes(buffer), cms::MessageNotReadableException) << ("Should have thrown exception"); EXPECT_THROW(message->readBytes(&array[0], 2), cms::MessageNotReadableException) << ("Should have thrown exception"); EXPECT_THROW(message->readChar(), cms::MessageNotReadableException) << ("Should have thrown exception"); EXPECT_THROW(message->readDouble(), cms::MessageNotReadableException) << ("Should have thrown exception"); EXPECT_THROW(message->readFloat(), cms::MessageNotReadableException) << ("Should have thrown exception"); EXPECT_THROW(message->readInt(), cms::MessageNotReadableException) << ("Should have thrown exception"); EXPECT_THROW(message->readLong(), cms::MessageNotReadableException) << ("Should have thrown exception"); EXPECT_THROW(message->readString(), cms::MessageNotReadableException) << ("Should have thrown exception"); EXPECT_THROW(message->readShort(), cms::MessageNotReadableException) << ("Should have thrown exception"); EXPECT_THROW(message->readUnsignedShort(), cms::MessageNotReadableException) << ("Should have thrown exception"); EXPECT_THROW(message->readUTF(), cms::MessageNotReadableException) << ("Should have thrown exception"); delete message; } void BytesMessageTest::TearDown() {}
33.305447
124
0.616683
[ "object", "vector" ]
41a002b627e49ae83ad27c0023f0ebebe652b33d
748
cc
C++
cpp/api/user/ExitWindowsEx.cc
giuliohome/node-expose-sspi
344aac68e94f9b5a99bce42651bf669b415c92d8
[ "ISC" ]
90
2020-02-13T17:27:27.000Z
2022-03-07T23:02:37.000Z
cpp/api/user/ExitWindowsEx.cc
giuliohome/node-expose-sspi
344aac68e94f9b5a99bce42651bf669b415c92d8
[ "ISC" ]
76
2020-03-19T06:29:23.000Z
2022-03-28T05:27:29.000Z
cpp/api/user/ExitWindowsEx.cc
giuliohome/node-expose-sspi
344aac68e94f9b5a99bce42651bf669b415c92d8
[ "ISC" ]
20
2020-04-30T07:45:45.000Z
2022-02-23T10:59:09.000Z
#include "../../misc.h" namespace myAddon { void e_ExitWindowsEx(const Napi::CallbackInfo& info) { Napi::Env env = info.Env(); CHECK_INPUT("ExitWindowsEx({flag: string, reason: string[]})", 1); Napi::Object input = info[0].As<Napi::Object>(); CHECK_PROP(input, "flag", IsString); CHECK_PROP(input, "reason", IsArray); UINT flag = getFlag(env, EWX_FLAGS, input, "flag", EWX_LOGOFF); UINT reason = getFlags(env, SHTDN_FLAGS, input, "reason", SHTDN_REASON_MAJOR_OTHER | SHTDN_REASON_MINOR_HUNG); BOOL status = ExitWindowsEx(flag, reason); if (status == FALSE) { throw Napi::Error::New(env, "ExitWindowsEx has failed. " + plf::error_msg()); } } } // namespace myAddon
28.769231
77
0.635027
[ "object" ]
41a2e516e96e3d9cf61607c2ce27f9a84e0443d3
28,032
cpp
C++
src/lib/npfg/npfg.cpp
MarvinHarms/ethzasl_fw_px4
93b2cd1cd8e761383134884e4183f84107824a9f
[ "BSD-3-Clause" ]
9
2021-02-09T20:54:46.000Z
2021-11-10T12:49:09.000Z
src/lib/npfg/npfg.cpp
MarvinHarms/ethzasl_fw_px4
93b2cd1cd8e761383134884e4183f84107824a9f
[ "BSD-3-Clause" ]
27
2021-02-09T20:30:51.000Z
2022-03-31T07:15:05.000Z
src/lib/npfg/npfg.cpp
MarvinHarms/ethzasl_fw_px4
93b2cd1cd8e761383134884e4183f84107824a9f
[ "BSD-3-Clause" ]
6
2021-09-03T15:50:42.000Z
2022-02-17T08:27:14.000Z
/**************************************************************************** * * Copyright (c) 2021 Autonomous Systems Lab, ETH Zurich. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * 3. Neither the name PX4 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. * ****************************************************************************/ /* * @file npfg.cpp * Implementation of a lateral-directional nonlinear path following guidance * law with excess wind handling. * * Authors and acknowledgements in header. */ #include "npfg.hpp" #include <lib/ecl/geo/geo.h> #include <px4_platform_common/defines.h> #include <float.h> using matrix::Vector2d; using matrix::Vector2f; void NPFG::evaluate(const Vector2f &ground_vel, const Vector2f &wind_vel, Vector2f &unit_path_tangent, float signed_track_error, const float path_curvature, bool in_front_of_wp /*= false*/, const Vector2f &bearing_vec_to_point /*= Vector2f{0.0f, 0.0f}*/) { const float ground_speed = ground_vel.norm(); Vector2f air_vel = ground_vel - wind_vel; const float airspeed = air_vel.norm(); const float wind_speed = wind_vel.norm(); float track_error = fabsf(signed_track_error); // track error bound is dynamic depending on ground speed track_error_bound_ = trackErrorBound(ground_speed, time_const_); float normalized_track_error = normalizedTrackError(track_error, track_error_bound_); // look ahead angle based purely on track proximity float look_ahead_ang = lookAheadAngle(normalized_track_error); bearing_vec_ = bearingVec(unit_path_tangent, look_ahead_ang, signed_track_error); // on-track wind triangle projections float wind_cross_upt = cross2D(wind_vel, unit_path_tangent); float wind_dot_upt = wind_vel.dot(unit_path_tangent); // calculate the bearing feasibility on the track at the current closest point feas_on_track_ = bearingFeasibility(wind_cross_upt, wind_dot_upt, airspeed, wind_speed); // update control parameters considering upper and lower stability bounds (if enabled) // must be called before trackErrorBound() as it updates time_const_ adapted_period_ = adaptPeriod(ground_speed, airspeed, wind_speed, track_error, path_curvature, wind_vel, unit_path_tangent, feas_on_track_); p_gain_ = pGain(adapted_period_, damping_); time_const_ = timeConst(adapted_period_, damping_); // specific waypoint logic complications... handles case where we are following // waypoints and are in front of the first of the segment. // TODO: find a way to get this out of the main eval method! if (in_front_of_wp && unit_path_tangent.dot(bearing_vec_) < unit_path_tangent.dot(bearing_vec_to_point)) { // we are in front of the first waypoint and the bearing to the point is // shallower than that to the line. reset path params to fly directly to // the first waypoint. // TODO: probably better to blend these instead of hard switching (could // effect the adaptive tuning if we switch between these cases with wind // gusts) // pretend we are on track, recalculate necessary quantities signed_track_error = 0.0f; normalized_track_error = 0.0f; unit_path_tangent = bearing_vec_to_point; bearing_vec_ = bearing_vec_to_point; look_ahead_ang = 0.0f; wind_cross_upt = cross2D(wind_vel, unit_path_tangent); wind_dot_upt = wind_vel.dot(unit_path_tangent); feas_on_track_ = bearingFeasibility(wind_cross_upt, wind_dot_upt, airspeed, wind_speed); adapted_period_ = adaptPeriod(ground_speed, airspeed, wind_speed, track_error, path_curvature, wind_vel, unit_path_tangent, feas_on_track_); p_gain_ = pGain(adapted_period_, damping_); time_const_ = timeConst(adapted_period_, damping_); } track_proximity_ = trackProximity(look_ahead_ang); // wind triangle projections const float wind_cross_bearing = cross2D(wind_vel, bearing_vec_); const float wind_dot_bearing = wind_vel.dot(bearing_vec_); // continuous representation of the bearing feasibility feas_ = bearingFeasibility(wind_cross_bearing, wind_dot_bearing, airspeed, wind_speed); // we consider feasibility of both the current bearing as well as that on the track at the current closest point const float feas_combined = feas_ * feas_on_track_; min_ground_speed_ref_ = minGroundSpeed(normalized_track_error, feas_combined); // reference air velocity with directional feedforward effect for following // curvature in wind and magnitude incrementation depending on minimum ground // speed violations and/or high wind conditions in general air_vel_ref_ = refAirVelocity(wind_vel, bearing_vec_, wind_cross_bearing, wind_dot_bearing, wind_speed, min_ground_speed_ref_); airspeed_ref_ = air_vel_ref_.norm(); // lateral acceleration demand based on heading error const float lateral_accel = lateralAccel(air_vel, air_vel_ref_, airspeed); // lateral acceleration needed to stay on curved track (assuming no heading error) lateral_accel_ff_ = lateralAccelFF(unit_path_tangent, ground_vel, wind_dot_upt, wind_cross_upt, airspeed, wind_speed, signed_track_error, path_curvature); // total lateral acceleration to drive aircaft towards track as well as account // for path curvature. The full effect of the feed-forward acceleration is smoothly // ramped in as the vehicle approaches the track and is further smoothly // zeroed out as the bearing becomes infeasible. lateral_accel_ = lateral_accel + feas_combined * track_proximity_ * lateral_accel_ff_; } // evaluate float NPFG::adaptPeriod(const float ground_speed, const float airspeed, const float wind_speed, const float track_error, const float path_curvature, const Vector2f &wind_vel, const Vector2f &unit_path_tangent, const float feas_on_track) const { float period = period_; const float air_turn_rate = fabsf(path_curvature * airspeed); const float wind_factor = windFactor(airspeed, wind_speed); if (en_period_lb_) { // lower bound for period not considering path curvature const float period_lb_zero_curvature = periodLB(0.0f, wind_factor, feas_on_track) * PERIOD_SAFETY_FACTOR; // lower bound for period *considering path curvature float period_lb = periodLB(air_turn_rate, wind_factor, feas_on_track) * PERIOD_SAFETY_FACTOR; // recalculate the time constant and track error bound considering the zero // curvature, lower-bounded period and subsequently recalculate the normalized // track error const float time_const = timeConst(period_lb_zero_curvature, damping_); const float track_error_bound = trackErrorBound(ground_speed, time_const); const float normalized_track_error = normalizedTrackError(track_error, track_error_bound); // calculate nominal track proximity with lower bounded time constant // (only a numerical solution can find corresponding track proximity // and adapted gains simultaneously) const float look_ahead_ang = lookAheadAngle(normalized_track_error); const float track_proximity = trackProximity(look_ahead_ang); // ramp in curvature dependent lower bound period_lb = (ramp_in_adapted_period_) ? period_lb * track_proximity + (1.0f - track_proximity) * period_lb_zero_curvature : period_lb; // lower bounded period period = math::max(period_lb, period); // only allow upper bounding ONLY if lower bounding is enabled (is otherwise // dangerous to allow period decrements without stability checks). // NOTE: if the roll time constant is not accurately known, lower-bound // checks may be too optimistic and reducing the period can still destabilize // the system! enable this feature at your own risk. if (en_period_ub_) { const float period_ub = periodUB(air_turn_rate, wind_factor, feas_on_track); if (en_period_ub_ && PX4_ISFINITE(period_ub) && period > period_ub) { // NOTE: if the roll time constant is not accurately known, reducing // the period here can destabilize the system! // enable this feature at your own risk! // upper bound the period (for track keeping stability), prefer lower bound if violated const float period_adapted = math::max(period_lb, period_ub); // transition from the nominal period to the adapted period as we get // closer to the track period = (ramp_in_adapted_period_) ? period_adapted * track_proximity + (1.0f - track_proximity) * period : period_adapted; } } } return period; } // adaptPeriod float NPFG::normalizedTrackError(const float track_error, const float track_error_bound) const { return math::constrain(track_error / track_error_bound, 0.0f, 1.0f); } float NPFG::windFactor(const float airspeed, const float wind_speed) const { // See [TODO: include citation] for definition/elaboration of this approximation. if (wind_speed > airspeed || airspeed < EPSILON) { return 2.0f; } else { return 2.0f * (1.0f - sqrtf(1.0f - math::min(1.0f, wind_speed / airspeed))); } } // windFactor float NPFG::periodUB(const float air_turn_rate, const float wind_factor, const float feas_on_track) const { if (air_turn_rate * wind_factor > EPSILON) { // multiply air turn rate by feasibility on track to zero out when we anyway // should not consider the curvature return 4.0f * M_PI_F * damping_ / (air_turn_rate * wind_factor * feas_on_track); } return INFINITY; } // periodUB float NPFG::periodLB(const float air_turn_rate, const float wind_factor, const float feas_on_track) const { // this method considers a "conservative" lower period bound, i.e. a constant // worst case bound for any wind ratio, airspeed, and path curvature // the lower bound for zero curvature and no wind OR damping ratio < 0.5 const float period_lb = M_PI_F * roll_time_const_ / damping_; if (air_turn_rate * wind_factor < EPSILON || damping_ < 0.5f) { return period_lb; } else { // the lower bound for tracking a curved path in wind with damping ratio > 0.5 const float period_windy_curved_damped = 4.0f * M_PI_F * roll_time_const_ * damping_; // blend the two together as the bearing on track becomes less feasible return period_windy_curved_damped * feas_on_track + (1.0f - feas_on_track) * period_lb; } } // periodLB float NPFG::trackProximity(const float look_ahead_ang) const { const float sin_look_ahead_ang = sinf(look_ahead_ang); return sin_look_ahead_ang * sin_look_ahead_ang; } // trackProximity float NPFG::trackErrorBound(const float ground_speed, const float time_const) const { if (ground_speed > 1.0f) { return ground_speed * time_const; } else { // limit bound to some minimum ground speed to avoid singularities in track // error normalization. the following equation assumes ground speed minimum = 1.0 return 0.5f * time_const * (ground_speed * ground_speed + 1.0f); } } // trackErrorBound float NPFG::pGain(const float period, const float damping) const { return 4.0f * M_PI_F * damping / period; } // pGain float NPFG::timeConst(const float period, const float damping) const { return period * damping; } // timeConst float NPFG::lookAheadAngle(const float normalized_track_error) const { return M_PI_F * 0.5f * (normalized_track_error - 1.0f) * (normalized_track_error - 1.0f); } // lookAheadAngle Vector2f NPFG::bearingVec(const Vector2f &unit_path_tangent, const float look_ahead_ang, const float signed_track_error) const { const float cos_look_ahead_ang = cosf(look_ahead_ang); const float sin_look_ahead_ang = sinf(look_ahead_ang); Vector2f unit_path_normal(-unit_path_tangent(1.0f), unit_path_tangent(0.0f)); // right handed 90 deg (clockwise) turn Vector2f unit_track_error = -((signed_track_error < 0.0f) ? -1.0f : 1.0f) * unit_path_normal; return cos_look_ahead_ang * unit_track_error + sin_look_ahead_ang * unit_path_tangent; } // bearingVec float NPFG::minGroundSpeed(const float normalized_track_error, const float feas) { // minimum ground speed demand from track keeping logic min_gsp_track_keeping_ = 0.0f; if (en_track_keeping_ && en_wind_excess_regulation_) { // zero out track keeping speed increment when bearing is feasible min_gsp_track_keeping_ = (1.0f - feas) * min_gsp_track_keeping_max_ * math::constrain( normalized_track_error * inv_nte_fraction_, 0.0f, 1.0f); } // minimum ground speed demand from minimum forward ground speed user setting float min_gsp_desired = 0.0f; if (en_min_ground_speed_ && en_wind_excess_regulation_) { min_gsp_desired = min_gsp_desired_; } return math::max(min_gsp_track_keeping_, min_gsp_desired); } // minGroundSpeed Vector2f NPFG::refAirVelocity(const Vector2f &wind_vel, const Vector2f &bearing_vec, const float wind_cross_bearing, const float wind_dot_bearing, const float wind_speed, const float min_ground_speed) const { Vector2f air_vel_ref; if (min_ground_speed > wind_dot_bearing && (en_min_ground_speed_ || en_track_keeping_) && en_wind_excess_regulation_) { // minimum ground speed and/or track keeping // airspeed required to achieve minimum ground speed along bearing vector const float airspeed_min = sqrtf((min_ground_speed - wind_dot_bearing) * (min_ground_speed - wind_dot_bearing) + wind_cross_bearing * wind_cross_bearing); if (airspeed_min > airspeed_max_) { if (bearingIsFeasible(wind_cross_bearing, wind_dot_bearing, airspeed_max_, wind_speed)) { // we will not maintain the minimum ground speed, but can still achieve the bearing at maximum airspeed const float airsp_dot_bearing = projectAirspOnBearing(airspeed_max_, wind_cross_bearing); air_vel_ref = solveWindTriangle(wind_cross_bearing, airsp_dot_bearing, bearing_vec); } else { // bearing is maximally infeasible, employ mitigation law air_vel_ref = infeasibleAirVelRef(wind_vel, bearing_vec, wind_speed, airspeed_max_); } } else if (airspeed_min > airspeed_nom_) { // the minimum ground speed is achievable within the nom - max airspeed range // solve wind triangle with for air velocity reference with minimum airspeed const float airsp_dot_bearing = projectAirspOnBearing(airspeed_min, wind_cross_bearing); air_vel_ref = solveWindTriangle(wind_cross_bearing, airsp_dot_bearing, bearing_vec); } else { // the minimum required airspeed is less than nominal, so we can track the bearing and minimum // ground speed with our nominal airspeed reference const float airsp_dot_bearing = projectAirspOnBearing(airspeed_nom_, wind_cross_bearing); air_vel_ref = solveWindTriangle(wind_cross_bearing, airsp_dot_bearing, bearing_vec); } } else { // wind excess regulation and/or mitigation if (bearingIsFeasible(wind_cross_bearing, wind_dot_bearing, airspeed_nom_, wind_speed)) { // bearing is nominally feasible, solve wind triangle for air velocity reference using nominal airspeed const float airsp_dot_bearing = projectAirspOnBearing(airspeed_nom_, wind_cross_bearing); air_vel_ref = solveWindTriangle(wind_cross_bearing, airsp_dot_bearing, bearing_vec); } else if (bearingIsFeasible(wind_cross_bearing, wind_dot_bearing, airspeed_max_, wind_speed) && en_wind_excess_regulation_) { // bearing is maximally feasible if (wind_dot_bearing <= 0.0f) { // we only increment the airspeed to regulate, but not overcome, excess wind // NOTE: in the terminal condition, this will result in a zero ground velocity configuration air_vel_ref = wind_vel; } else { // the bearing is achievable within the nom - max airspeed range // solve wind triangle with for air velocity reference with minimum airspeed const float airsp_dot_bearing = 0.0f; // right angle to the bearing line gives minimal airspeed usage air_vel_ref = solveWindTriangle(wind_cross_bearing, airsp_dot_bearing, bearing_vec); } } else { // bearing is maximally infeasible, employ mitigation law const float airspeed_input = (en_wind_excess_regulation_) ? airspeed_max_ : airspeed_nom_; air_vel_ref = infeasibleAirVelRef(wind_vel, bearing_vec, wind_speed, airspeed_input); } } return air_vel_ref; } // refAirVelocity float NPFG::projectAirspOnBearing(const float airspeed, const float wind_cross_bearing) const { // NOTE: wind_cross_bearing must be less than airspeed to use this function // it is assumed that bearing feasibility is checked and found feasible (e.g. bearingIsFeasible() = true) prior to entering this method // otherwise the return will be erroneous return sqrtf(math::max(airspeed * airspeed - wind_cross_bearing * wind_cross_bearing, 0.0f)); } // projectAirspOnBearing int NPFG::bearingIsFeasible(const float wind_cross_bearing, const float wind_dot_bearing, const float airspeed, const float wind_speed) const { return (fabsf(wind_cross_bearing) < airspeed) && ((wind_dot_bearing > 0.0f) || (wind_speed < airspeed)); } // bearingIsFeasible Vector2f NPFG::solveWindTriangle(const float wind_cross_bearing, const float airsp_dot_bearing, const Vector2f &bearing_vec) const { // essentially a 2D rotation with the speeds (magnitudes) baked in return Vector2f{airsp_dot_bearing * bearing_vec(0) - wind_cross_bearing * bearing_vec(1), wind_cross_bearing * bearing_vec(0) + airsp_dot_bearing * bearing_vec(1)}; } // solveWindTriangle Vector2f NPFG::infeasibleAirVelRef(const Vector2f &wind_vel, const Vector2f &bearing_vec, const float wind_speed, const float airspeed) const { // NOTE: wind speed must be greater than airspeed, and airspeed must be greater than zero to use this function // it is assumed that bearing feasibility is checked and found infeasible (e.g. bearingIsFeasible() = false) prior to entering this method // otherwise the normalization of the air velocity vector could have a division by zero Vector2f air_vel_ref = sqrtf(math::max(wind_speed * wind_speed - airspeed * airspeed, 0.0f)) * bearing_vec - wind_vel; return air_vel_ref.normalized() * airspeed; } // infeasibleAirVelRef float NPFG::bearingFeasibility(float wind_cross_bearing, const float wind_dot_bearing, const float airspeed, const float wind_speed) const { if (wind_dot_bearing < 0.0f) { wind_cross_bearing = wind_speed; } else { wind_cross_bearing = fabsf(wind_cross_bearing); } float sin_arg = sinf(M_PI_F * 0.5f * math::constrain((airspeed - wind_cross_bearing) / airspeed_buffer_, 0.0f, 1.0f)); return sin_arg * sin_arg; } // bearingFeasibility float NPFG::lateralAccelFF(const Vector2f &unit_path_tangent, const Vector2f &ground_vel, const float wind_dot_upt, const float wind_cross_upt, const float airspeed, const float wind_speed, const float signed_track_error, const float path_curvature) const { // NOTE: all calculations within this function take place at the closet point // on the path, as if the aircraft were already tracking the given path at // this point with zero angular error. this allows us to evaluate curvature // induced requirements for lateral acceleration incrementation and ramp them // in with the track proximity and further consider the bearing feasibility // in excess wind conditions (this is done external to this method). // path frame curvature is the instantaneous curvature at our current distance // from the actual path (considering e.g. concentric circles emanating outward/inward) float path_frame_curvature = path_curvature / math::max(1.0f - path_curvature * signed_track_error, fabsf(path_curvature) * MIN_RADIUS); // limit tangent ground speed to along track (forward moving) direction const float tangent_ground_speed = math::max(ground_vel.dot(unit_path_tangent), 0.0f); const float path_frame_rate = path_frame_curvature * tangent_ground_speed; // speed ratio = projection of ground vel on track / projection of air velocity // on track const float speed_ratio = (1.0f + wind_dot_upt / math::max(projectAirspOnBearing(airspeed, wind_cross_upt), EPSILON)); // note the use of airspeed * speed_ratio as oppose to ground_speed^2 here -- // the prior considers that we command lateral acceleration in the air mass // relative frame while the latter does not return airspeed * speed_ratio * path_frame_rate; } // lateralAccelFF float NPFG::lateralAccel(const Vector2f &air_vel, const Vector2f &air_vel_ref, const float airspeed) const { // lateral acceleration demand only from the heading error const float dot_air_vel_err = air_vel.dot(air_vel_ref); const float cross_air_vel_err = cross2D(air_vel, air_vel_ref); if (dot_air_vel_err < 0.0f) { // hold max lateral acceleration command above 90 deg heading error return p_gain_ * ((cross_air_vel_err < 0.0f) ? -airspeed : airspeed); } else { // airspeed/airspeed_ref is used to scale any incremented airspeed reference back to the current airspeed // for acceleration commands in a "feedback" sense (i.e. at the current vehicle airspeed) return p_gain_ * cross_air_vel_err / airspeed_ref_; } } // lateralAccel /******************************************************************************* * PX4 NAVIGATION INTERFACE FUNCTIONS (provide similar functionality to ECL_L1_Pos_Controller) */ void NPFG::navigateWaypoints(const Vector2d &waypoint_A, const Vector2d &waypoint_B, const Vector2d &vehicle_pos, const Vector2f &ground_vel, const Vector2f &wind_vel) { // similar to logic found in ECL_L1_Pos_Controller method of same name // BUT no arbitrary max approach angle, approach entirely determined by generated // bearing vectors path_type_loiter_ = false; Vector2f vector_A_to_B = getLocalPlanarVector(waypoint_A, waypoint_B); Vector2f vector_A_to_vehicle = getLocalPlanarVector(waypoint_A, vehicle_pos); if (vector_A_to_B.norm() < EPSILON) { // the waypoints are on top of each other and should be considered as a // single waypoint, fly directly to it unit_path_tangent_ = -vector_A_to_vehicle.normalized(); signed_track_error_ = 0.0f; evaluate(ground_vel, wind_vel, unit_path_tangent_, signed_track_error_, 0.0f); } else if (vector_A_to_B.dot(vector_A_to_vehicle) < 0.0f) { // we are in front of waypoint A, fly directly to it until the bearing generated // to the line segement between A and B is shallower than that from the // bearing to the first waypoint (A). unit_path_tangent_ = vector_A_to_B.normalized(); signed_track_error_ = cross2D(unit_path_tangent_, vector_A_to_vehicle); evaluate(ground_vel, wind_vel, unit_path_tangent_, signed_track_error_, 0.0f, true, -vector_A_to_vehicle.normalized()); } else { // track the line segment between A and B unit_path_tangent_ = vector_A_to_B.normalized(); signed_track_error_ = cross2D(unit_path_tangent_, vector_A_to_vehicle); evaluate(ground_vel, wind_vel, unit_path_tangent_, signed_track_error_, 0.0f); } updateRollSetpoint(); } // navigateWaypoints void NPFG::navigateLoiter(const Vector2d &loiter_center, const Vector2d &vehicle_pos, float radius, int8_t loiter_direction, const Vector2f &ground_vel, const Vector2f &wind_vel) { path_type_loiter_ = true; radius = math::max(radius, MIN_RADIUS); Vector2f vector_center_to_vehicle = getLocalPlanarVector(loiter_center, vehicle_pos); const float dist_to_center = vector_center_to_vehicle.norm(); // find the direction from the circle center to the closest point on its perimeter // from the vehicle position Vector2f unit_vec_center_to_closest_pt; if (dist_to_center < 0.1f) { // the logic breaks down at the circle center, employ some mitigation strategies // until we exit this region if (ground_vel.norm() < 0.1f) { // arbitrarily set the point in the northern top of the circle unit_vec_center_to_closest_pt = Vector2f{1.0f, 0.0f}; } else { // set the point in the direction we are moving unit_vec_center_to_closest_pt = ground_vel.normalized(); } } else { // set the point in the direction of the aircraft unit_vec_center_to_closest_pt = vector_center_to_vehicle.normalized(); } // 90 deg clockwise rotation * loiter direction unit_path_tangent_ = float(loiter_direction) * Vector2f{-unit_vec_center_to_closest_pt(1), unit_vec_center_to_closest_pt(0)}; // positive in direction of path normal signed_track_error_ = -loiter_direction * (dist_to_center - radius); float path_curvature = float(loiter_direction) / radius; evaluate(ground_vel, wind_vel, unit_path_tangent_, signed_track_error_, path_curvature); updateRollSetpoint(); } // navigateLoiter void NPFG::navigateHeading(float heading_ref, const Vector2f &ground_vel, const Vector2f &wind_vel) { path_type_loiter_ = false; Vector2f air_vel = ground_vel - wind_vel; unit_path_tangent_ = Vector2f{cosf(heading_ref), sinf(heading_ref)}; signed_track_error_ = 0.0f; // use the guidance law to regular heading error - ignoring wind or inertial position evaluate(air_vel, Vector2f{0.0f, 0.0f}, unit_path_tangent_, signed_track_error_, 0.0f); updateRollSetpoint(); } // navigateHeading void NPFG::navigateBearing(float bearing, const Vector2f &ground_vel, const Vector2f &wind_vel) { path_type_loiter_ = false; unit_path_tangent_ = Vector2f{cosf(bearing), sinf(bearing)}; signed_track_error_ = 0.0f; // no track error or path curvature to consider, just regulate ground velocity // to bearing vector evaluate(ground_vel, wind_vel, unit_path_tangent_, signed_track_error_, 0.0f); updateRollSetpoint(); } // navigateBearing void NPFG::navigateLevelFlight(const float heading) { path_type_loiter_ = false; airspeed_ref_ = airspeed_nom_; lateral_accel_ = 0.0f; feas_ = 1.0f; bearing_vec_ = Vector2f{cosf(heading), sinf(heading)}; unit_path_tangent_ = bearing_vec_; signed_track_error_ = 0.0f; updateRollSetpoint(); } // navigateLevelFlight float NPFG::switchDistance(float wp_radius) const { return math::min(wp_radius, track_error_bound_ * switch_distance_multiplier_); } // switchDistance Vector2f NPFG::getLocalPlanarVector(const Vector2d &origin, const Vector2d &target) const { /* this is an approximation for small angles, proposed by [2] */ const double x_angle = math::radians(target(0) - origin(0)); const double y_angle = math::radians(target(1) - origin(1)); const double x_origin_cos = cos(math::radians(origin(0))); return Vector2f{ static_cast<float>(x_angle * CONSTANTS_RADIUS_OF_EARTH), static_cast<float>(y_angle *x_origin_cos * CONSTANTS_RADIUS_OF_EARTH), }; } // getLocalPlanarVector void NPFG::updateRollSetpoint() { float roll_new = atanf(lateral_accel_ * 1.0f / CONSTANTS_ONE_G); roll_new = math::constrain(roll_new, -roll_lim_rad_, roll_lim_rad_); if (dt_ > 0.0f && roll_slew_rate_ > 0.0f) { // slew rate limiting active roll_new = math::constrain(roll_new, roll_setpoint_ - roll_slew_rate_ * dt_, roll_setpoint_ + roll_slew_rate_ * dt_); } if (PX4_ISFINITE(roll_new)) { roll_setpoint_ = roll_new; } } // updateRollSetpoint
42.796947
139
0.764305
[ "vector" ]
41a3d9c63a3f0e75b3f15fc65102a0d5027a80cc
5,427
cc
C++
src/engine/scripting/script_system.cc
ProjectSulphur/ProjectSulphur
cb9ee8298f5020fda4a9130802e72034408f050f
[ "Apache-2.0" ]
11
2017-12-19T14:33:02.000Z
2022-03-26T00:34:48.000Z
src/engine/scripting/script_system.cc
ProjectSulphur/ProjectSulphur
cb9ee8298f5020fda4a9130802e72034408f050f
[ "Apache-2.0" ]
1
2018-05-28T10:32:32.000Z
2018-05-28T10:32:35.000Z
src/engine/scripting/script_system.cc
ProjectSulphur/ProjectSulphur
cb9ee8298f5020fda4a9130802e72034408f050f
[ "Apache-2.0" ]
1
2021-01-25T11:31:57.000Z
2021-01-25T11:31:57.000Z
#include "script_system.h" #include "engine/scripting/script_register.h" #include "engine/core/script_debug.h" #include "engine/systems/components/mesh_render_system.h" #include "engine/systems/components/skinned_mesh_render_system.h" #include "engine/systems/components/camera_system.h" #include "engine/systems/components/transform_system.h" #include "engine/systems/components/rigid_body_system.h" #include "engine/systems/components/collider_system.h" #include "engine/systems/components/network_component_system.h" #include "engine/systems/components/audio_event_system.h" #include "engine/systems/components/audio_listener_system.h" #include "engine/systems/components/audio_snapshot_system.h" #include "engine/systems/components/audio_vca_system.h" #include "engine/systems/components/audio_bus_system.h" #include "engine/systems/components/constraint_system.h" #include "engine/audio/audio_system.h" #include "engine/physics/physics_system.h" #include "engine/input/input.h" #include "engine/networking/network_system.h" #include "engine/assets/scriptable_asset_system.h" #include "engine/utilities/scriptable_imgui.h" #include "engine/assets/asset_system.h" #include "engine/assets/script.h" #include <foundation/job/job_graph.h> #include <foundation/job/data_policy.h> #include <foundation/utils/frame.h> namespace sulphur { namespace engine { //------------------------------------------------------------------------- ScriptSystem::ScriptSystem() : IServiceSystem<ScriptSystem>("ScriptSystem"), script_state_(), register_(nullptr), script_resource_("ScriptState") { } //------------------------------------------------------------------------- void ScriptSystem::OnInitialize(Application& app, foundation::JobGraph& job_graph) { InitializeScriptState(app); const auto fixed_update = [](ScriptState* script_state) { script_state->FixedUpdate(); }; job_graph.Add(foundation::make_job("scriptsystem_fixedupdate", "fixed_update", fixed_update, foundation::bind_write(script_resource_) )); const auto update = [](ScriptState* script_state) { script_state->Update(foundation::Frame::delta_time()); }; job_graph.Add(foundation::make_job("scriptsystem_update", "update", update, foundation::bind_write(script_resource_) )); RegisterClasses(app); LoadMain(app); } void ScriptSystem::InitializeScriptState(Application& app) { script_resource_ = foundation::Resource<ScriptState*>("ScriptState", &script_state_); script_state_.Initialize(&app); register_ = ScriptRegister(&script_state_); } //------------------------------------------------------------------------- void ScriptSystem::RegisterClasses(Application& app) { register_.RegisterAll< ScriptClassRegister<ScriptDebug>, ScriptClassRegister<ScriptableWorld>, ScriptClassRegister<Entity>, ScriptClassRegister<CameraComponent>, ScriptClassRegister<TransformComponent>, ScriptClassRegister<MeshRenderComponent>, ScriptClassRegister<SkinnedMeshRenderComponent>, ScriptClassRegister<RigidBodyComponent>, ScriptClassRegister<BoxColliderComponent>, ScriptClassRegister<SphereColliderComponent>, ScriptClassRegister<CylinderColliderComponent>, ScriptClassRegister<CapsuleColliderComponent>, ScriptClassRegister<ConeColliderComponent>, ScriptClassRegister<AudioEventComponent>, ScriptClassRegister<AudioListenerComponent>, ScriptClassRegister<AudioSnapshotComponent>, ScriptClassRegister<AudioVCAComponent>, ScriptClassRegister<AudioBusComponent>, ScriptClassRegister<CameraEnums>, ScriptClassRegister<ScriptableInput>, ScriptClassRegister<ButtonEnumWrapper>, ScriptClassRegister<ScriptableNetworking>, ScriptClassRegister<NetworkComponent>, ScriptClassRegister<ScriptableNetworkPlayer>, ScriptClassRegister<ScriptableImGuiInputText>, ScriptClassRegister<ScriptableImGui>, ScriptClassRegister<ScriptableAsset>, ScriptClassRegister<ScriptableAssetSystem>, ScriptClassRegister<ScriptableAudio>, ScriptClassRegister<PhysicsSystem>, ScriptClassRegister<FixedConstraintComponent>, ScriptClassRegister<HingeConstraintComponent> >(); ScriptableWorld::Initialize(&app.GetService<WorldProviderSystem>(), &app); ScriptableInput::Initialize(&app.platform().input()); } //------------------------------------------------------------------------- void ScriptSystem::LoadMain(Application& app) { AssetHandle<Script> script = AssetSystem::Instance().Load<Script>("main"); foundation::Vector<char> bin = script->binary; script_state_.CompileAndRun(bin.data(), bin.size(), "main.lua"); script_state_.RegisterCallbacks(); } //------------------------------------------------------------------------- void ScriptSystem::OnTerminate() { script_state_.Shutdown(); } //------------------------------------------------------------------------- void ScriptSystem::Start(const foundation::String& project_dir) { script_state_.OnInitialize(project_dir); } } }
35.940397
91
0.664824
[ "vector" ]
41ad562001f4bbea2ef5d6d62ec265132039cefe
4,863
cpp
C++
src/ara/com/option/ipv4_endpoint_option.cpp
bigdark1024/Adaptive-AUTOSAR
b7ebbbd123761bf3f73b1ef425c14c7705c967f8
[ "MIT" ]
49
2021-07-26T14:28:55.000Z
2022-03-29T03:33:32.000Z
src/ara/com/option/ipv4_endpoint_option.cpp
bigdark1024/Adaptive-AUTOSAR
b7ebbbd123761bf3f73b1ef425c14c7705c967f8
[ "MIT" ]
9
2021-07-26T14:35:20.000Z
2022-02-05T15:49:43.000Z
src/ara/com/option/ipv4_endpoint_option.cpp
bigdark1024/Adaptive-AUTOSAR
b7ebbbd123761bf3f73b1ef425c14c7705c967f8
[ "MIT" ]
17
2021-09-03T15:38:27.000Z
2022-03-27T15:48:01.000Z
#include "./ipv4_endpoint_option.h" namespace ara { namespace com { namespace option { uint16_t Ipv4EndpointOption::Length() const noexcept { const uint8_t cOptionLength = 9; return cOptionLength; } helper::Ipv4Address Ipv4EndpointOption::IpAddress() const noexcept { return mIpAddress; } Layer4ProtocolType Ipv4EndpointOption::L4Proto() const noexcept { return mL4Proto; } uint16_t Ipv4EndpointOption::Port() const noexcept { return mPort; } std::vector<uint8_t> Ipv4EndpointOption::Payload() const { auto _result = Option::BasePayload(); helper::Ipv4Address::Inject(_result, mIpAddress); const uint8_t cReservedByte = 0x00; _result.push_back(cReservedByte); uint8_t _protocolByte = static_cast<uint8_t>(mL4Proto); _result.push_back(_protocolByte); helper::Inject(_result, mPort); return _result; } std::shared_ptr<Ipv4EndpointOption> Ipv4EndpointOption::CreateUnitcastEndpoint( bool discardable, helper::Ipv4Address ipAddress, Layer4ProtocolType protocol, uint16_t port) noexcept { std::shared_ptr<Ipv4EndpointOption> _result( new Ipv4EndpointOption( OptionType::IPv4Endpoint, discardable, ipAddress, protocol, port)); return _result; } std::shared_ptr<Ipv4EndpointOption> Ipv4EndpointOption::CreateMulticastEndpoint( bool discardable, helper::Ipv4Address ipAddress, uint16_t port) { const uint8_t cMulticastOctetMin = 224; const uint8_t cMulticastOctetMax = 239; uint8_t _firstOctet = ipAddress.Octets[0]; if ((_firstOctet < cMulticastOctetMin) || (_firstOctet > cMulticastOctetMax)) { throw std::invalid_argument("IP address is out of range."); } std::shared_ptr<Ipv4EndpointOption> _result( new Ipv4EndpointOption( OptionType::IPv4Multicast, discardable, ipAddress, Layer4ProtocolType::Udp, port)); return _result; } std::shared_ptr<Ipv4EndpointOption> Ipv4EndpointOption::CreateSdEndpoint( bool discardable, helper::Ipv4Address ipAddress, Layer4ProtocolType protocol, uint16_t port) noexcept { std::shared_ptr<Ipv4EndpointOption> _result( new Ipv4EndpointOption(OptionType::IPv4SdEndpoint, discardable, ipAddress, protocol, port)); return _result; } std::shared_ptr<Ipv4EndpointOption> Ipv4EndpointOption::Deserialize( const std::vector<uint8_t> &payload, std::size_t &offset, OptionType type, bool discardable) { helper::Ipv4Address _ipAddress = helper::Ipv4Address::Extract(payload, offset); // Apply the reserved byte length field offset offset++; auto _protocol = static_cast<Layer4ProtocolType>(payload.at(offset++)); uint16_t _port = helper::ExtractShort(payload, offset); switch (type) { case OptionType::IPv4Endpoint: return CreateUnitcastEndpoint( discardable, _ipAddress, _protocol, _port); case OptionType::IPv4Multicast: return CreateMulticastEndpoint( discardable, _ipAddress, _port); case OptionType::IPv4SdEndpoint: return CreateSdEndpoint( discardable, _ipAddress, _protocol, _port); default: throw std::out_of_range( "The option type does not belong to IPv4 endpoint option series."); } } } } }
33.770833
92
0.48468
[ "vector" ]
41b038a35ec3908bacb062cc205a77e4a69244ed
1,077
cpp
C++
components/SFMLJoystickComponent.cpp
deb0ch/R-Type
8bb37cd5ec318efb97119afb87d4996f6bb7644e
[ "WTFPL" ]
5
2016-03-15T20:14:10.000Z
2020-10-30T23:56:24.000Z
components/SFMLJoystickComponent.cpp
deb0ch/R-Type
8bb37cd5ec318efb97119afb87d4996f6bb7644e
[ "WTFPL" ]
3
2018-12-19T19:12:44.000Z
2020-04-02T13:07:00.000Z
components/SFMLJoystickComponent.cpp
deb0ch/R-Type
8bb37cd5ec318efb97119afb87d4996f6bb7644e
[ "WTFPL" ]
2
2016-04-11T19:29:28.000Z
2021-11-26T20:53:22.000Z
#include "SFMLJoystickComponent.hh" SFMLJoystickComponent::SFMLJoystickComponent() : ACopyableComponent("SFMLJoystickComponent") { this->_inputs["UP"] = {SFMLJoystickEvent::JoystickButton::UP}; this->_inputs["LEFT"] = {SFMLJoystickEvent::JoystickButton::LEFT}; this->_inputs["DOWN"] = {SFMLJoystickEvent::JoystickButton::DOWN}; this->_inputs["RIGHT"] = {SFMLJoystickEvent::JoystickButton::RIGHT}; this->_inputs["FIRE"] = {SFMLJoystickEvent::JoystickButton::A, SFMLJoystickEvent::JoystickButton::X}; } SFMLJoystickComponent::~SFMLJoystickComponent() {} const std::map<std::string, std::vector<SFMLJoystickEvent::JoystickButton> >& SFMLJoystickComponent::getInputs() const { return (this->_inputs); } void SFMLJoystickComponent::addInput(const std::string &action, const SFMLJoystickEvent::JoystickButton &key) { this->_inputs[action].push_back(key); } void SFMLJoystickComponent::serialize(IBuffer &) const {} void SFMLJoystickComponent::unserialize(IBuffer &) {} void SFMLJoystickComponent::serializeFromFile(std::ofstream &, unsigned char) const {}
31.676471
118
0.763231
[ "vector" ]
41b040356ebaeb1085d5074069a493065ed518c3
1,575
cc
C++
src/composite/menu.cc
Edlward/DesignPattern-CPP
53b1d68786e837d893790be9a5387f885a93cc9d
[ "Apache-2.0" ]
47
2015-03-30T12:24:48.000Z
2021-07-27T20:21:08.000Z
src/composite/menu.cc
shishougang/DesignPattern-CPP
53b1d68786e837d893790be9a5387f885a93cc9d
[ "Apache-2.0" ]
null
null
null
src/composite/menu.cc
shishougang/DesignPattern-CPP
53b1d68786e837d893790be9a5387f885a93cc9d
[ "Apache-2.0" ]
34
2015-01-09T04:13:39.000Z
2021-04-19T06:36:43.000Z
/* * \copyright Copyright 2014 * \license @{ * Licensed under the Apache License, Version 2.0 (the "License"); * @} */ #include "composite/menu.h" #include <iostream> // NOLINT using std::cout; using std::endl; #include <algorithm> using std::find; #include "composite/menu_iterator.h" #include "composite/composite_iterator.h" namespace composite { Menu::Menu(const string &name, const string &description) : name_(name), description_(description) { menu_components_ = new vector<MenuComponent*>; } Menu::~Menu() { for (int i = 0; i < menu_components_->size(); ++i) { MenuComponent *item = menu_components_->at(i); delete item; } delete menu_components_; menu_components_ = NULL; } void Menu::add(MenuComponent *menu_component) { menu_components_->push_back(menu_component); } void Menu::remove(MenuComponent *menu_component) { menu_components_->erase(find(menu_components_->begin(), menu_components_->end(), menu_component)); delete menu_component; } MenuComponent* Menu::getChild(int i) const { if (i < 0 || i >= menu_components_->size()) { return NULL; } return menu_components_->at(i); } Iterator* Menu::createIterator() { return new CompositeIterator(new MenuIterator(menu_components_)); } void Menu::print() const { cout << endl << name(); cout << ", " << description() << endl; cout << "---------------------" << endl; for (int i = 0; i < menu_components_->size(); ++i) { MenuComponent *item = menu_components_->at(i); item->print(); } } } // namespace composite
25
73
0.659683
[ "vector" ]
41b4c705ddf63ef41741bf6e30da08cc813f378c
5,092
cpp
C++
TreeSim.cpp
aabyaneh/MCTED
7fe480134fd8515ad9f1c41168847d7db17362cc
[ "Apache-2.0" ]
1
2018-04-26T07:33:15.000Z
2018-04-26T07:33:15.000Z
TreeSim.cpp
aabyaneh/MCTED
7fe480134fd8515ad9f1c41168847d7db17362cc
[ "Apache-2.0" ]
null
null
null
TreeSim.cpp
aabyaneh/MCTED
7fe480134fd8515ad9f1c41168847d7db17362cc
[ "Apache-2.0" ]
null
null
null
// Copyright (c) 2017, Alireza Abyaneh et al. All rights reserved. // Please see LICENSE file #include <iostream> #include <fstream> #include <sys/time.h> #include <string> #include <cstring> #include <unordered_map> #include <vector> #include <assert.h> #include <atomic> #include <pthread.h> #include "src/preprocess/node.h" #include "src/preprocess/parser.h" #include "src/zhsh/zh_sh.h" #include "src/preprocess/preprocess.h" #include "src/zhsh/zh_sh_serial.h" #include "src/zhsh/zh_sh_parallel.h" Node* tree1; Node* tree2; struct timeval tv_begin; struct timeval tv_end; double time_elapsed_in_mcseconds; void preprocessor(char* tree1_str, char* tree2_str) { tree1_size = 0; tree2_size = 0; leaves_cnt1 = 0; leaves_cnt2 = 0; parser::labelid = 1; parser::num = 0; parser::hash_table_type hash_table; tree1 = parser::tree_create(tree1_str, hash_table, leaves_cnt1); tree1_size = parser::num; parser::num = 0; tree2 = parser::tree_create(tree2_str, hash_table, leaves_cnt2); tree2_size = parser::num; int node_ids = 1; tree1_postorder = new int[tree1_size + 1]; preprocess::postorder_traverse(tree1, tree1_postorder, &node_ids); node_ids = 1; tree2_postorder = new int[tree2_size + 1]; preprocess::postorder_traverse(tree2, tree2_postorder, &node_ids); l1 = new int[tree1_size + 1]; l2 = new int[tree2_size + 1]; preprocess::lmld(tree1, l1); preprocess::lmld(tree2, l2); kr1 = new int[leaves_cnt1+1]; kr2 = new int[leaves_cnt2+1]; preprocess::key_roots(kr1, l1, leaves_cnt1, tree1_size); preprocess::key_roots(kr2, l2, leaves_cnt2, tree2_size); } void zs_serial() { float result; gettimeofday(&tv_begin,NULL); result = zss::tree_dist(tree1_size + 1, tree2_size + 1); gettimeofday(&tv_end,NULL); time_elapsed_in_mcseconds = (tv_end.tv_sec - tv_begin.tv_sec) * 1000000 + (tv_end.tv_usec - tv_begin.tv_usec); std::cout << "######################################"<< std::endl; std::cout << "***** Serial *****" << std::endl; std::cout << "######################################"<< std::endl; std::cout << "**** tree_1 size: " << tree1_size << std::endl; std::cout << "**** tree_2 size: " << tree2_size << std::endl; std::cout << "tree edit distance: " << result << std::endl; std::cout << "time (second): " << time_elapsed_in_mcseconds / 1000000 << std::endl; std::cout << std::endl; } void zs_parallel() { float result; zsp::y_td = tree2_size + 1; gettimeofday(&tv_begin,NULL); result = zsp::workload(tree1, tree2); gettimeofday(&tv_end,NULL); time_elapsed_in_mcseconds = (tv_end.tv_sec - tv_begin.tv_sec) * 1000000 + (tv_end.tv_usec - tv_begin.tv_usec); std::cout << "######################################"<< std::endl; std::cout << "***** Parallel *****" << std::endl; std::cout << "######################################"<< std::endl; std::cout << "**** tree_1 size: " << tree1_size << std::endl; std::cout << "**** tree_2 size: " << tree2_size << std::endl; std::cout << "**** num of threads in pool: " << zsp::num_of_threads_in_pool << std::endl; std::cout << "tree edit distance: " << result << std::endl; std::cout << "time (second): " << time_elapsed_in_mcseconds / 1000000 << std::endl; std::cout << std::endl; } int main (int argc, char* argv[]) { /* key_root pairs with fd matrices of less than 'subtrees_nodes_num_threshold' elements will compute serially. */ zsp::subtrees_nodes_num_threshold = 50; std::string input; int error = 0; int serial = 0; int parallel = 0; int i = 1; while(i < argc) { if (!strcmp(argv[i], "-i")) { if (i + 1 < argc) { input = argv[i + 1]; i++; } else error = 1; } else if (!strcmp(argv[i], "-s")) { serial = 1; } else if (!strcmp(argv[i], "-p")) { if (i + 1 < argc) { zsp::num_of_threads_in_pool = atoi(argv[i + 1]); parallel = 1; i++; } else error = 1; } else if (!strcmp(argv[i], "-h")) { error = 1; break; } i++; } std::ifstream input_trees; if (error == 0 && input.length() != 0) { input_trees.open(input); std::string line1; std::string line2; std::getline(input_trees, line1); std::getline(input_trees, line2); preprocessor(&line1[0], &line2[0]); if (serial == 1) zs_serial(); if (parallel == 1) zs_parallel(); delete[] tree1_postorder; delete[] tree2_postorder; delete[] l1; delete[] l2; delete[] kr1; delete[] kr2; input_trees.close(); } else { std::cout << "HELP:"<< std::endl; std::cout << " " << "-i input" << " " << "Input trees in a file called input"<< std::endl; std::cout << " " << "-s" << " " << "Serial execution"<< std::endl; std::cout << " " << "-p num_cores" << " " << "Parallel execution"<< std::endl; std::cout << " " << "-s -p num_cores" << " " << "Serial and Parallel execution"<< std::endl; std::cout << " " << "example:" << " " << "./mcted -i trees.txt -s -p 4"<< std::endl; } return 0; }
29.952941
112
0.587392
[ "vector" ]
41b771150c4600fe5eadb2717d72a4e507e2d286
6,239
cc
C++
src/Bank/simpleContigLoader.cc
sagrudd/amos
47643a1d238bff83421892cb74daaf6fff8d9548
[ "Artistic-1.0" ]
10
2015-03-20T18:25:56.000Z
2020-06-02T22:00:08.000Z
src/Bank/simpleContigLoader.cc
sagrudd/amos
47643a1d238bff83421892cb74daaf6fff8d9548
[ "Artistic-1.0" ]
5
2015-05-14T17:51:20.000Z
2020-07-19T04:17:47.000Z
src/Bank/simpleContigLoader.cc
sagrudd/amos
47643a1d238bff83421892cb74daaf6fff8d9548
[ "Artistic-1.0" ]
10
2015-05-17T16:01:23.000Z
2020-05-20T08:13:43.000Z
#include "foundation_AMOS.hh" #include <iostream> #include <cassert> #include <unistd.h> using namespace std; using namespace AMOS; //=============================================================== Globals ====// string OPT_BankName; string OPT_ContigFile; bool VERBOSE = 0; bool OPT_APPEND = 0; bool OPT_EID = 0; //========================================================== Fuction Decs ====// //----------------------------------------------------- ParseArgs -------------- //! \brief Sets the global OPT_% values from the command line arguments //! //! \return void //! void ParseArgs (int argc, char ** argv); //----------------------------------------------------- PrintHelp -------------- //! \brief Prints help information to cerr //! //! \param s The program name, i.e. argv[0] //! \return void //! void PrintHelp (const char * s); //----------------------------------------------------- PrintUsage ------------- //! \brief Prints usage information to cerr //! //! \param s The program name, i.e. argv[0] //! \return void //! void PrintUsage (const char * s); void loadContig(Contig_t & contig, Bank_t & bank) { bank.append(contig); cerr << "Loaded contig: " << contig.getEID() << " " << contig.getLength() << " bp, " << contig.getReadTiling().size() << " reads" << endl; } //========================================================= Function Defs ====// int main (int argc, char ** argv) { int exitcode = EXIT_SUCCESS; Bank_t read_bank (Read_t::NCODE); Bank_t contig_bank(Contig_t::NCODE); long int cntw = 0; // written object count //-- Parse the command line arguments ParseArgs (argc, argv); //-- BEGIN: MAIN EXCEPTION CATCH try { ifstream cfile; cfile.open(OPT_ContigFile.c_str()); if (!cfile) { AMOS_THROW_IO("Can't open " + OPT_ContigFile); } read_bank.open (OPT_BankName, B_READ|B_SPY); if (contig_bank.exists(OPT_BankName)) { contig_bank.open(OPT_BankName, B_READ|B_WRITE); if (!OPT_APPEND) { cerr << "WARNING: Removing old contigs" << endl; contig_bank.clear(); } else { cerr << "Appending to bank" << endl; } } else { contig_bank.create(OPT_BankName, B_READ|B_WRITE); } Contig_t ctg; bool first = true; string id; cfile >> id; while (cfile) { if (id[0] == '>') { if (!first) { loadContig(ctg, contig_bank); ctg.clear(); } first = false; ctg.setEID(id.substr(1,id.length())); ctg.setIID(contig_bank.getMaxIID()+1); string cons; cfile >> cons; string cqual; cqual.append(cons.length(), 'X'); ctg.setSequence(cons,cqual); if (VERBOSE) { cout << "Saw contig header: " << id << ", " << cons.length() << "bp." << endl; } } else if (id[0] == '#') { ID_t readiid = 0; int offset; char dir; if (OPT_EID) { readiid = read_bank.lookupIID(id.c_str()+1); if (readiid == 0) { cerr << "Unknown eid: " << id << endl; exit(1); } } else { readiid = atoi(id.c_str()+1); } cfile >> offset; cfile >> dir; Read_t read; read_bank.fetch(readiid, read); Range_t clr = read.getClearRange(); if (dir == 'F') { } else if (dir == 'R') { clr.swap(); } else { AMOS_THROW_IO((string)"Invalid Direction Specified " + dir + " for read " + id); } Tile_t tle; tle.source = readiid; tle.offset = offset; tle.range = clr; ctg.getReadTiling().push_back(tle); if (tle.offset + clr.getLength() > ctg.getLength()) { cerr << "WARNING: Read " << readiid << " extends beyond consensus" << endl; } if (VERBOSE) { cout << "Added read: " << id << " " << offset << " " << dir << endl; } } else { AMOS_THROW_IO("Invalid field: " + id); } cfile >> id; } loadContig(ctg, contig_bank); } catch (const Exception_t & e) { cerr << "FATAL: " << e . what( ) << endl << " there has been a fatal error, abort" << endl; exitcode = EXIT_FAILURE; } //-- END: MAIN EXCEPTION CATCH return exitcode; } //------------------------------------------------------------- ParseArgs ----// void ParseArgs (int argc, char ** argv) { int ch, errflg = 0; optarg = NULL; while ( !errflg && ((ch = getopt (argc, argv, "hvae")) != EOF) ) switch (ch) { case 'h': PrintHelp (argv[0]); exit (EXIT_SUCCESS); break; case 'v': VERBOSE = true; break; case 'a': OPT_APPEND = true; break; case 'e': OPT_EID = true; break; default: errflg ++; } if ( errflg > 0 || optind != argc - 2 ) { PrintUsage (argv[0]); cerr << "Try '" << argv[0] << " -h' for more information.\n"; exit (EXIT_FAILURE); } OPT_BankName = argv [optind ++]; OPT_ContigFile = argv[optind++]; } //------------------------------------------------------------- PrintHelp ----// void PrintHelp (const char * s) { PrintUsage (s); cerr << "-h Display help information\n" << "-v Be Verbose\n" << "-a Append contigs instead of overwriting them\n" << "-e Use read eids instead of iids\n" << endl; cerr << "Loads contigs from file into a bank\n" << "Format of contig file is:\n\n" << ">contig1 consensus\n" << "#readiid1 offset dir\n" << "#readiid2 offset dir\n" << "#readiid3 offset dir\n" << ">contig2 consensus\n" << "#readiid4 offset dir\n\n" << "WARNING: All previously loaded contigs are removed\n"; return; } //------------------------------------------------------------ PrintUsage ----// void PrintUsage (const char * s) { cerr << "\nUSAGE: " << s << " <bank path> <contig file>\n\n"; return; }
21.738676
90
0.468985
[ "object" ]
41b8921600e55a9a7247a66b2673c0635559d9a4
11,551
cpp
C++
pomdog/experimental/spine/skinned_mesh_loader.cpp
mogemimi/pomdog
6dc6244d018f70d42e61c6118535cf94a9ee0618
[ "MIT" ]
163
2015-03-16T08:42:32.000Z
2022-01-11T21:40:22.000Z
pomdog/experimental/spine/skinned_mesh_loader.cpp
mogemimi/pomdog
6dc6244d018f70d42e61c6118535cf94a9ee0618
[ "MIT" ]
17
2015-04-12T20:57:50.000Z
2020-10-10T10:51:45.000Z
pomdog/experimental/spine/skinned_mesh_loader.cpp
mogemimi/pomdog
6dc6244d018f70d42e61c6118535cf94a9ee0618
[ "MIT" ]
21
2015-04-12T20:45:11.000Z
2022-01-14T20:50:16.000Z
// Copyright mogemimi. Distributed under the MIT license. #include "pomdog/experimental/spine/skinned_mesh_loader.hpp" #include "pomdog/basic/conditional_compilation.hpp" #include "pomdog/experimental/skeletal2d/skeleton_pose.hpp" #include "pomdog/experimental/skeletal2d/skinned_mesh.hpp" #include "pomdog/experimental/spine/skeleton_desc.hpp" #include "pomdog/experimental/texture_packer/texture_atlas.hpp" #include "pomdog/math/math.hpp" POMDOG_SUPPRESS_WARNINGS_GENERATED_BY_STD_HEADERS_BEGIN #include <algorithm> #include <tuple> #include <utility> POMDOG_SUPPRESS_WARNINGS_GENERATED_BY_STD_HEADERS_END namespace pomdog::spine { namespace { using skeletal2d::SkinnedMeshPart; using skeletal2d::SkinnedVertex; using TexturePacker::TextureAtlas; using TexturePacker::TextureAtlasRegion; struct SkinnedMeshSlot final { std::vector<skeletal2d::SkinnedVertex> Vertices; std::vector<std::uint16_t> Indices; std::uint16_t DrawOrder; }; SkinnedMeshSlot CreateSkinnedMeshSlot( const SlotDesc& slotDesc, const AttachmentDesc& attachment, const TextureRegion& textureRegion, const Vector2& textureSize, const std::vector<Matrix3x2>& bindPosesInGlobal) { POMDOG_ASSERT(slotDesc.Joint); SkinnedMeshSlot slot; ///@todo Not implemented std::array<float, 4> weights = {{1.0f, 0.0f, 0.0f, 0.0f}}; std::array<std::int32_t, 4> joints = {{*slotDesc.Joint, -1, -1, -1}}; slot.Vertices = { {Vector4{0.0f, 0.0f, 0.0f, 1.0f}, weights, joints}, {Vector4{0.0f, 1.0f, 0.0f, 0.0f}, weights, joints}, {Vector4{1.0f, 1.0f, 1.0f, 0.0f}, weights, joints}, {Vector4{1.0f, 0.0f, 1.0f, 1.0f}, weights, joints}, }; slot.Indices = {0, 1, 2, 2, 3, 0}; Vector2 origin; origin.X = static_cast<float>(textureRegion.Width / 2 - textureRegion.XOffset) / textureRegion.Subrect.Width; origin.Y = static_cast<float>(textureRegion.Height / 2 - textureRegion.YOffset) / textureRegion.Subrect.Height; auto size = Vector2{ static_cast<float>(textureRegion.Subrect.Width), static_cast<float>(textureRegion.Subrect.Height), }; if (textureRegion.Rotate) { std::swap(size.X, size.Y); std::swap(origin.X, origin.Y); } Matrix3x2 scaling = Matrix3x2::CreateScale(attachment.Scale * size); Matrix3x2 rotate = Matrix3x2::CreateRotation(attachment.Rotation); if (textureRegion.Rotate) { rotate = Matrix3x2::CreateRotation(-math::PiOver2<float>) * rotate; } Matrix3x2 translate = Matrix3x2::CreateTranslation(attachment.Translate); POMDOG_ASSERT(*slotDesc.Joint < bindPosesInGlobal.size()); Matrix3x2 transform = scaling * rotate * translate * bindPosesInGlobal[*slotDesc.Joint]; for (auto& vertex : slot.Vertices) { auto position = math::Transform(Vector2(vertex.PositionTextureCoord.X, vertex.PositionTextureCoord.Y) - origin, transform); vertex.PositionTextureCoord.X = position.X; vertex.PositionTextureCoord.Y = position.Y; } for (auto& vertex : slot.Vertices) { auto position = Vector2(vertex.PositionTextureCoord.Z, vertex.PositionTextureCoord.W) * size + Vector2{static_cast<float>(textureRegion.Subrect.X), static_cast<float>(textureRegion.Subrect.Y)}; POMDOG_ASSERT(textureSize.X > 0); POMDOG_ASSERT(textureSize.Y > 0); position = position / textureSize; vertex.PositionTextureCoord.Z = position.X; vertex.PositionTextureCoord.W = position.Y; } return slot; } SkinnedMeshSlot CreateSkinnedMeshSlot( const SkinnedMeshAttachmentDesc& attachment, const TextureRegion& textureRegion, const Vector2& textureSize, const std::vector<Matrix3x2>& bindPosesInGlobal) { SkinnedMeshSlot meshSlot; for (auto& source : attachment.Vertices) { SkinnedVertex vertex; POMDOG_ASSERT(!source.Joints.empty()); POMDOG_ASSERT(source.Joints.front()); POMDOG_ASSERT(*source.Joints.front() < bindPosesInGlobal.size()); auto position = math::Transform(source.Position, bindPosesInGlobal[*source.Joints.front()]); auto originInUV = Vector2{ static_cast<float>(textureRegion.Subrect.X), static_cast<float>(textureRegion.Subrect.Y), }; auto sizeInUV = Vector2{ static_cast<float>(textureRegion.Subrect.Width), static_cast<float>(textureRegion.Subrect.Height), }; Vector2 textureCoordInUV = (textureRegion.Rotate ? Vector2{source.TextureCoordinate.Y * sizeInUV.Y, (1 - source.TextureCoordinate.X) * sizeInUV.X} : source.TextureCoordinate * sizeInUV); auto textureCoord = (originInUV + textureCoordInUV) / textureSize; vertex.PositionTextureCoord = { position.X, position.Y, textureCoord.X, textureCoord.Y }; for (size_t i = 0; i < source.Joints.size(); ++i) { if (source.Joints[i]) { vertex.Joints[i] = *source.Joints[i]; } else { vertex.Joints[i] = -1; } } vertex.Weights[0] = source.Weights[0]; vertex.Weights[1] = source.Weights[1]; vertex.Weights[2] = source.Weights[2]; vertex.Weights[3] = 1.0f - (source.Weights[0] + source.Weights[1] + source.Weights[2]); meshSlot.Vertices.push_back(std::move(vertex)); } meshSlot.Indices = attachment.Indices; return meshSlot; } skeletal2d::SkinnedMesh CreateVertices( const std::vector<SlotDesc>& slots, const SkinDesc& skin, const TextureAtlas& textureAtlas, const Vector2& textureSize, const std::vector<Matrix3x2>& bindPosesInGlobal) { std::vector<SkinnedMeshSlot> meshSlots; meshSlots.reserve(slots.size()); std::uint16_t drawOrder = 0; for (auto& slotDesc : slots) { POMDOG_ASSERT(drawOrder < std::numeric_limits<decltype(drawOrder)>::max()); auto skinSlot = std::find_if(std::begin(skin.Slots), std::end(skin.Slots), [&slotDesc](const SkinSlotDesc& desc) { return desc.SlotName == slotDesc.Name; }); POMDOG_ASSERT(skinSlot != std::end(skin.Slots)); if (skinSlot == std::end(skin.Slots)) { ///@todo Not implemented // Error continue; } if (skinSlot->Attachments.empty() && !skinSlot->SkinnedMeshAttachments.empty()) { auto attachment = std::find_if(std::begin(skinSlot->SkinnedMeshAttachments), std::end(skinSlot->SkinnedMeshAttachments), [&slotDesc](const SkinnedMeshAttachmentDesc& desc) { return desc.Name == slotDesc.Attachement; }); POMDOG_ASSERT(attachment != std::end(skinSlot->SkinnedMeshAttachments)); auto textureAtlasRegion = std::find_if(std::begin(textureAtlas.regions), std::end(textureAtlas.regions), [&attachment](const TextureAtlasRegion& region) { return region.Name == attachment->Name; }); POMDOG_ASSERT(textureAtlasRegion != std::end(textureAtlas.regions)); SkinnedMeshSlot meshSlot = CreateSkinnedMeshSlot(*attachment, textureAtlasRegion->Region, textureSize, bindPosesInGlobal); meshSlot.DrawOrder = drawOrder; meshSlots.push_back(std::move(meshSlot)); ++drawOrder; continue; } POMDOG_ASSERT(!skinSlot->Attachments.empty()); if (skinSlot->Attachments.empty()) { ///@todo Not implemented // Error continue; } auto attachment = std::find_if(std::begin(skinSlot->Attachments), std::end(skinSlot->Attachments), [&slotDesc](const AttachmentDesc& desc) { return desc.Name == slotDesc.Attachement; }); POMDOG_ASSERT(attachment != std::end(skinSlot->Attachments)); if (attachment == std::end(skinSlot->Attachments)) { ///@todo Not implemented // Error continue; } auto textureAtlasRegion = std::find_if(std::begin(textureAtlas.regions), std::end(textureAtlas.regions), [&attachment](const TextureAtlasRegion& region) { return region.Name == attachment->Name; }); POMDOG_ASSERT(textureAtlasRegion != std::end(textureAtlas.regions)); if (textureAtlasRegion == std::end(textureAtlas.regions)) { ///@todo Not implemented // Error continue; } POMDOG_ASSERT(slotDesc.Joint); auto meshSlot = CreateSkinnedMeshSlot(slotDesc, *attachment, textureAtlasRegion->Region, textureSize, bindPosesInGlobal); meshSlot.DrawOrder = drawOrder; meshSlots.push_back(std::move(meshSlot)); ++drawOrder; } std::sort(std::begin(meshSlots), std::end(meshSlots), [](const SkinnedMeshSlot& a, const SkinnedMeshSlot& b) { return a.DrawOrder < b.DrawOrder; }); skeletal2d::SkinnedMesh result; result.MeshParts.reserve(meshSlots.size()); std::uint16_t startIndex = 0; for (auto& slot : meshSlots) { SkinnedMeshPart meshPart; POMDOG_ASSERT(result.Vertices.size() < std::numeric_limits<std::uint16_t>::max()); meshPart.VertexOffset = static_cast<std::uint16_t>(result.Vertices.size()); POMDOG_ASSERT(slot.Vertices.size() < std::numeric_limits<std::uint16_t>::max()); meshPart.VertexCount = static_cast<std::uint16_t>(slot.Vertices.size()); POMDOG_ASSERT(result.Indices.size() < std::numeric_limits<std::uint16_t>::max()); meshPart.StartIndex = static_cast<std::uint16_t>(result.Indices.size()); POMDOG_ASSERT(slot.Indices.size() % 3 == 0); meshPart.PrimitiveCount = static_cast<std::uint16_t>(slot.Indices.size()) / 3; result.MeshParts.push_back(std::move(meshPart)); for (auto& index : slot.Indices) { index += startIndex; } POMDOG_ASSERT(startIndex + slot.Vertices.size() <= std::numeric_limits<decltype(startIndex)>::max()); startIndex += static_cast<decltype(startIndex)>(slot.Vertices.size()); // NOTE: concatenate two vectors result.Vertices.insert(std::end(result.Vertices), std::begin(slot.Vertices), std::end(slot.Vertices)); result.Indices.insert(std::end(result.Indices), std::begin(slot.Indices), std::end(slot.Indices)); } return result; } } // namespace std::tuple<skeletal2d::SkinnedMesh, std::unique_ptr<Error>> CreateSkinnedMesh( const std::vector<Matrix3x2>& bindPosesInGlobal, const SkeletonDesc& skeletonDesc, const TexturePacker::TextureAtlas& textureAtlas, const Vector2& textureSize, const std::string& skinName) { POMDOG_ASSERT(!skeletonDesc.Bones.empty()); POMDOG_ASSERT(!skeletonDesc.Skins.empty()); auto iter = std::find_if(std::begin(skeletonDesc.Skins), std::end(skeletonDesc.Skins), [&](const SkinDesc& desc) { return desc.Name == skinName; }); if (iter == std::end(skeletonDesc.Skins)) { auto err = errors::New("Skin not found '" + skinName + "'"); return std::make_tuple(skeletal2d::SkinnedMesh{}, std::move(err)); } POMDOG_ASSERT(iter != std::end(skeletonDesc.Skins)); auto meshData = CreateVertices(skeletonDesc.Slots, *iter, textureAtlas, textureSize, bindPosesInGlobal); return std::make_tuple(std::move(meshData), nullptr); } } // namespace pomdog::spine
36.323899
134
0.653969
[ "vector", "transform" ]
41bb89043789929b12ce0e552374f955c53e2a77
2,595
cpp
C++
src/engine/ui/Gui.cpp
Ri0ee/Pwned2D
aa67e11449a174289bc75e2e75495ab24f34bae3
[ "MIT" ]
1
2018-03-21T17:42:26.000Z
2018-03-21T17:42:26.000Z
src/engine/ui/Gui.cpp
Ri0ee/Pwned2D
aa67e11449a174289bc75e2e75495ab24f34bae3
[ "MIT" ]
null
null
null
src/engine/ui/Gui.cpp
Ri0ee/Pwned2D
aa67e11449a174289bc75e2e75495ab24f34bae3
[ "MIT" ]
null
null
null
#include "Gui.h" namespace gui { TGui::TGui(freetype::TFreeType *ftlib, graphics::TRenderer *renderer, input::TInputManager *inputmngr) { cout << "gui constructor called" << endl; m_ftlib = ftlib; m_renderer = renderer; m_input_manager = inputmngr; m_window_width = renderer->m_window_width; m_window_height = renderer->m_window_height; color btncolor{77, 0, 57, 50}; color hl_btncolor{133, 51, 85, 50}; color fg_btncolor{255, 51, 204, 100}; vector<vec2> button_shape; button_shape.push_back(vec2(0, 0)); button_shape.push_back(vec2(300, 0)); button_shape.push_back(vec2(300, 40)); button_shape.push_back(vec2(50, 40)); TButton button_1, button_2, button_3; button_1 = TButton("Start", button_shape, vec2(m_window_width - 300, 10), 1, btncolor, fg_btncolor, hl_btncolor, "Start"); AddButton(button_1); button_2 = TButton("Button_2", button_shape, vec2(m_window_width - 300, 80), 2, btncolor, fg_btncolor, hl_btncolor, "middle"); AddButton(button_2); button_3 = TButton("Button_3", button_shape, vec2(m_window_width - 300, 150), 3, btncolor, fg_btncolor, hl_btncolor, "right"); AddButton(button_3); m_visible = true; } TGui::~TGui() { cout << "gui destructor called" << endl; } TButton& TGui::GetButton(string button_name) { for(auto it = m_vecUIButton.begin(); it != m_vecUIButton.end(); it++) if(it->name == button_name) return &*it; return m_vecUIButton[0]; } void TGui::AddButton(TButton button) { button.SetFontLib(m_ftlib); button.SetRenderer(m_renderer); m_vecUIButton.push_back(button); } void TGui::Draw() { if(m_visible) { for(auto button = m_vecUIButton.begin(); button != m_vecUIButton.end(); button++) button->Draw(); } } void TGui::ProcessInput() { if(m_visible) { for(auto it = m_vecUIButton.begin(); it != m_vecUIButton.end(); it++) it->CheckCollision(m_input_manager->m_mouse_pos); if(m_input_manager->m_pressed) { for(auto it = m_vecUIButton.begin(); it != m_vecUIButton.end(); it++) it->Press(); } if(m_input_manager->m_released) { for(auto it = m_vecUIButton.begin(); it != m_vecUIButton.end(); it++) it->Release(); } } } }
32.037037
155
0.576108
[ "vector" ]
41c10cb69ef6b04db79ca152773c77d54c0e148e
31,558
cpp
C++
dist/wcdx/src/wcdx.cpp
Bekenn/wcdx
148bda0c17b9a977e2ef90f27d48b206f89498da
[ "MIT" ]
14
2015-01-13T18:33:37.000Z
2022-01-10T22:17:41.000Z
dist/wcdx/src/wcdx.cpp
Bekenn/wcdx
148bda0c17b9a977e2ef90f27d48b206f89498da
[ "MIT" ]
5
2020-07-12T22:54:11.000Z
2022-01-30T12:18:56.000Z
dist/wcdx/src/wcdx.cpp
Bekenn/wcdx
148bda0c17b9a977e2ef90f27d48b206f89498da
[ "MIT" ]
1
2019-05-24T22:18:10.000Z
2019-05-24T22:18:10.000Z
#include "wcdx.h" #include <image/image.h> #include <image/resources.h> #include <stdext/array_view.h> #include <stdext/scope_guard.h> #include <stdext/file.h> #include <stdext/format.h> #include <stdext/multi.h> #include <stdext/utility.h> #include <algorithm> #include <iterator> #include <limits> #include <random> #include <system_error> #include <io.h> #include <fcntl.h> #pragma warning(push) #pragma warning(disable:4091) // 'typedef ': ignored on left of 'tagGPFIDL_FLAGS' when no variable is declared #include <Shlobj.h> #pragma warning(pop) #include <strsafe.h> namespace { enum { WM_APP_RENDER = WM_APP }; POINT ConvertTo(POINT point, RECT rect); POINT ConvertFrom(POINT point, RECT rect); HRESULT GetSavedGamePath(LPCWSTR subdir, LPWSTR path); HRESULT GetLocalAppDataPath(LPCWSTR subdir, LPWSTR path); bool CreateDirectoryRecursive(LPWSTR pathName); std::independent_bits_engine<std::mt19937, 1, unsigned int> RandomBit(std::random_device{}()); } WCDXAPI IWcdx* WcdxCreate(LPCWSTR windowTitle, WNDPROC windowProc, BOOL _fullScreen) { try { return new Wcdx(windowTitle, windowProc, _fullScreen != FALSE); } catch (const _com_error&) { return nullptr; } } Wcdx::Wcdx(LPCWSTR title, WNDPROC windowProc, bool _fullScreen) : _refCount(1), _monitor(nullptr), _clientWindowProc(windowProc), _frameStyle(WS_OVERLAPPEDWINDOW), _frameExStyle(WS_EX_OVERLAPPEDWINDOW) , _fullScreen(false), _dirty(false), _sizeChanged(false) #if DEBUG_SCREENSHOTS , _screenshotFrameCounter(0), _screenshotIndex(0), _screenshotFileIndex(0) #endif { // Create the window. auto hwnd = ::CreateWindowEx(_frameExStyle, reinterpret_cast<LPCWSTR>(FrameWindowClass()), title, _frameStyle, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, nullptr, nullptr, DllInstance, this); if (hwnd == nullptr) throw std::system_error(::GetLastError(), std::system_category()); _window.Reset(hwnd, &::DestroyWindow); // Force 4:3 aspect ratio. ::GetWindowRect(_window, &_frameRect); OnSizing(WMSZ_TOP, &_frameRect); ::MoveWindow(_window, _frameRect.left, _frameRect.top, _frameRect.right - _frameRect.left, _frameRect.bottom - _frameRect.top, FALSE); // Initialize D3D. _d3d = ::Direct3DCreate9(D3D_SDK_VERSION); // Find the adapter corresponding to the window. HRESULT hr; UINT adapter; if (FAILED(hr = UpdateMonitor(adapter))) _com_raise_error(hr); if (FAILED(hr = RecreateDevice(adapter))) _com_raise_error(hr); WcdxColor defColor = { 0, 0, 0, 0xFF }; std::fill_n(_palette, stdext::lengthof(_palette), defColor); SetFullScreen(IsDebuggerPresent() ? false : _fullScreen); #if DEBUG_SCREENSHOTS auto res = ::FindResource(DllInstance, MAKEINTRESOURCE(RESOURCE_ID_WC1PAL), RT_RCDATA); if (res == nullptr) throw std::system_error(::GetLastError(), std::system_category()); auto resp = ::LoadResource(DllInstance, res); _screenshotPalette = static_cast<const std::byte*>(::LockResource(resp)) + 0x30; _screenshotPaletteSize = 0x300; #endif } Wcdx::~Wcdx() = default; HRESULT STDMETHODCALLTYPE Wcdx::QueryInterface(REFIID riid, void** ppvObject) { if (ppvObject == nullptr) return E_POINTER; if (IsEqualIID(riid, IID_IUnknown)) { *reinterpret_cast<IUnknown**>(ppvObject) = this; ++_refCount; return S_OK; } if (IsEqualIID(riid, IID_IWcdx)) { *reinterpret_cast<IWcdx**>(ppvObject) = this; ++_refCount; return S_OK; } *ppvObject = nullptr; return E_NOINTERFACE; } ULONG STDMETHODCALLTYPE Wcdx::AddRef() { return ++_refCount; } ULONG STDMETHODCALLTYPE Wcdx::Release() { if (--_refCount == 0) { delete this; return 0; } return _refCount; } HRESULT STDMETHODCALLTYPE Wcdx::SetVisible(BOOL visible) { ::ShowWindow(_window, visible ? SW_SHOW : SW_HIDE); if (visible) ::PostMessage(_window, WM_APP_RENDER, 0, 0); return S_OK; } HRESULT STDMETHODCALLTYPE Wcdx::SetPalette(const WcdxColor entries[256]) { std::copy_n(entries, 256, _palette); _dirty = true; return S_OK; } HRESULT STDMETHODCALLTYPE Wcdx::UpdatePalette(UINT index, const WcdxColor* entry) { _palette[index] = *entry; _dirty = true; return S_OK; } HRESULT STDMETHODCALLTYPE Wcdx::UpdateFrame(INT x, INT y, UINT width, UINT height, UINT pitch, const byte* bits) { RECT rect = { x, y, LONG(x + width), LONG(y + height) }; RECT clipped = { std::max(rect.left, LONG(0)), std::max(rect.top, LONG(0)), std::min(rect.right, LONG(ContentWidth)), std::min(rect.bottom, LONG(ContentHeight)) }; auto src = reinterpret_cast<const std::byte*>(bits); auto dest = _framebuffer + clipped.left + (ContentWidth * clipped.top); width = clipped.right - clipped.left; for (height = clipped.bottom - clipped.top; height-- > 0; ) { std::copy_n(src, width, dest); src += pitch; dest += ContentWidth; } _dirty = true; return S_OK; } HRESULT STDMETHODCALLTYPE Wcdx::Present() { HRESULT hr; if (FAILED(hr = _device->TestCooperativeLevel())) { if (hr != D3DERR_DEVICENOTRESET) return hr; if (FAILED(hr = ResetDevice())) return hr; } RECT clientRect; ::GetClientRect(_window, &clientRect); if (FAILED(hr = _device->BeginScene())) return hr; { at_scope_exit([&]{ _device->EndScene(); }); if (_dirty) { D3DLOCKED_RECT locked; RECT bounds = { 0, 0, ContentWidth, ContentHeight }; if (FAILED(hr = _surface->LockRect(&locked, &bounds, D3DLOCK_DISCARD))) return hr; { at_scope_exit([&]{ _surface->UnlockRect(); }); const std::byte* src = _framebuffer; auto dest = static_cast<WcdxColor*>(locked.pBits); for (int row = 0; row < ContentHeight; ++row) { std::transform(src, src + ContentWidth, dest, [&](std::byte index) { return _palette[uint8_t(index)]; }); src += ContentWidth; dest += locked.Pitch / sizeof(*dest); } } } #if DEBUG_SCREENSHOTS std::copy_n(_framebuffer, stdext::lengthof(_framebuffer), _screenshotBuffers[_screenshotIndex]); if (++_screenshotIndex == stdext::lengthof(_screenshotBuffers)) _screenshotIndex = 0; if (_screenshotFrameCounter != 0 && --_screenshotFrameCounter == 0) { for (size_t n = 0; n != stdext::lengthof(_screenshotBuffers); ++n) { auto index = (_screenshotIndex + n) % stdext::lengthof(_screenshotBuffers); auto& buffer = _screenshotBuffers[index]; stdext::array_view<const std::byte> paletteView(_screenshotPalette, _screenshotPaletteSize); stdext::memory_input_stream bufferStream(buffer, sizeof(buffer)); stdext::file_output_stream file(stdext::format_string("screenshot${0:03}.png", _screenshotFileIndex).c_str(), stdext::utf8_path_encoding()); wcdx::image::write_image({ ContentWidth, ContentHeight }, paletteView, bufferStream, file); ++_screenshotFileIndex; } } #endif RECT activeRect = GetContentRect(clientRect); if (_sizeChanged) { if (activeRect.right - activeRect.left < clientRect.right - clientRect.left) { D3DRECT bars[] = { { clientRect.left, clientRect.top, activeRect.left, activeRect.bottom }, { activeRect.right, activeRect.top, clientRect.right, clientRect.bottom } }; if (FAILED(hr = _device->Clear(2, bars, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0, 0, 0), 0.0f, 0))) return hr; } else if (activeRect.bottom - activeRect.top < clientRect.bottom - clientRect.top) { D3DRECT bars[] = { { clientRect.left, clientRect.top, activeRect.right, activeRect.top }, { activeRect.left, activeRect.bottom, clientRect.right, clientRect.bottom } }; if (FAILED(hr = _device->Clear(2, bars, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0, 0, 0), 0.0f, 0))) return hr; } } if (_dirty || _sizeChanged) { IDirect3DSurface9Ptr backBuffer; if (FAILED(hr = _device->GetBackBuffer(0, 0, D3DBACKBUFFER_TYPE_MONO, &backBuffer))) return hr; if (FAILED(hr = _device->StretchRect(_surface, nullptr, backBuffer, &activeRect, D3DTEXF_POINT))) return hr; _dirty = false; _sizeChanged = false; } } if (FAILED(hr = _device->Present(&clientRect, nullptr, nullptr, nullptr))) return hr; return S_OK; } HRESULT STDMETHODCALLTYPE Wcdx::IsFullScreen() { return _fullScreen ? S_OK : S_FALSE; } HRESULT STDMETHODCALLTYPE Wcdx::ConvertPointToClient(POINT* point) { if (point == nullptr) return E_POINTER; RECT viewRect; if (!::GetClientRect(_window, &viewRect)) return HRESULT_FROM_WIN32(::GetLastError()); *point = ConvertTo(*point, GetContentRect(viewRect)); return S_OK; } HRESULT STDMETHODCALLTYPE Wcdx::ConvertPointFromClient(POINT* point) { if (point == nullptr) return E_POINTER; RECT viewRect; if (!::GetClientRect(_window, &viewRect)) return HRESULT_FROM_WIN32(::GetLastError()); *point = ConvertFrom(*point, GetContentRect(viewRect)); return S_OK; } HRESULT STDMETHODCALLTYPE Wcdx::ConvertRectToClient(RECT* rect) { if (rect == nullptr) return E_POINTER; RECT viewRect; if (!::GetClientRect(_window, &viewRect)) return HRESULT_FROM_WIN32(::GetLastError()); auto topLeft = ConvertTo({ rect->left, rect->top }, GetContentRect(viewRect)); auto bottomRight = ConvertTo({ rect->right, rect->bottom }, GetContentRect(viewRect)); *rect = { topLeft.x, topLeft.y, bottomRight.x, bottomRight.y }; return S_OK; } HRESULT STDMETHODCALLTYPE Wcdx::ConvertRectFromClient(RECT* rect) { if (rect == nullptr) return E_POINTER; RECT viewRect; if (!::GetClientRect(_window, &viewRect)) return HRESULT_FROM_WIN32(::GetLastError()); auto topLeft = ConvertFrom({ rect->left, rect->top }, GetContentRect(viewRect)); auto bottomRight = ConvertFrom({ rect->right, rect->bottom }, GetContentRect(viewRect)); *rect = { topLeft.x, topLeft.y, bottomRight.x, bottomRight.y }; return S_OK; } HRESULT STDMETHODCALLTYPE Wcdx::SavedGameOpen(const wchar_t* subdir, const wchar_t* filename, int oflag, int pmode, int* filedesc) { if (subdir == nullptr || filename == nullptr || filedesc == nullptr) return E_POINTER; typedef HRESULT (* GamePathFn)(const wchar_t* subdir, wchar_t* path); GamePathFn pathFuncs[] = { GetSavedGamePath, GetLocalAppDataPath, }; wchar_t path[_MAX_PATH]; for (auto func : pathFuncs) { auto hr = func(subdir, path); if (SUCCEEDED(hr)) { if ((oflag & _O_CREAT) != 0) { if (!CreateDirectoryRecursive(path)) continue; } wchar_t* pathEnd; size_t remaining; if (FAILED(hr = StringCchCatEx(path, _MAX_PATH, L"\\", &pathEnd, &remaining, 0))) return hr; if (FAILED(hr = StringCchCopy(pathEnd, remaining, filename))) return hr; auto error = _wsopen_s(filedesc, path, oflag, _SH_DENYNO, pmode); if (*filedesc != -1) return S_OK; if (error != ENOENT) return E_FAIL; } } if ((oflag & _O_CREAT) == 0) { // If the savegame file exists, try to move or copy it into a better location. for (auto func : pathFuncs) { auto hr = func(subdir, path); if (SUCCEEDED(hr)) { if (!CreateDirectoryRecursive(path)) continue; wchar_t* pathEnd; size_t remaining; if (FAILED(StringCchCatEx(path, _MAX_PATH, L"\\", &pathEnd, &remaining, 0))) continue; if (FAILED(StringCchCopy(pathEnd, remaining, filename))) continue; if (::MoveFileEx(filename, path, MOVEFILE_COPY_ALLOWED | MOVEFILE_REPLACE_EXISTING) || ::CopyFile(filename, path, FALSE)) { ::DeleteFile(filename); filename = path; break; } } } } _wsopen_s(filedesc, filename, oflag, _SH_DENYNO, pmode); if (*filedesc != -1) return S_OK; *filedesc = -1; return E_FAIL; } HRESULT STDMETHODCALLTYPE Wcdx::OpenFile(const char* filename, int oflag, int pmode, int* filedesc) { if (filename == nullptr || filedesc == nullptr) return E_POINTER; return _sopen_s(filedesc, filename, oflag, _SH_DENYNO, pmode) == 0 ? S_OK : E_FAIL; } HRESULT STDMETHODCALLTYPE Wcdx::CloseFile(int filedesc) { return _close(filedesc) == 0 ? S_OK : E_FAIL; } HRESULT STDMETHODCALLTYPE Wcdx::WriteFile(int filedesc, long offset, unsigned int size, const void* data) { if (size > 0 && data == nullptr) return E_POINTER; if (offset != -1 && _lseek(filedesc, offset, SEEK_SET) == -1) return E_FAIL; return _write(filedesc, data, size) != -1 ? S_OK : E_FAIL; } HRESULT STDMETHODCALLTYPE Wcdx::ReadFile(int filedesc, long offset, unsigned int size, void* data) { if (size > 0 && data == nullptr) return E_POINTER; if (offset != -1 && _lseek(filedesc, offset, SEEK_SET) == -1) return E_FAIL; return _read(filedesc, data, size) != -1 ? S_OK : E_FAIL; } HRESULT STDMETHODCALLTYPE Wcdx::SeekFile(int filedesc, long offset, int method, long* position) { if (position == nullptr) return E_POINTER; *position = _lseek(filedesc, offset, method); return *position != -1 ? S_OK : E_FAIL; } HRESULT STDMETHODCALLTYPE Wcdx::FileLength(int filedesc, long *length) { if (length == nullptr) return E_POINTER; *length = _filelength(filedesc); return S_OK; } HRESULT STDMETHODCALLTYPE Wcdx::ConvertPointToScreen(POINT* point) { HRESULT hr; if (FAILED(hr = ConvertPointToClient(point))) return hr; ClientToScreen(_window, point); return S_OK; } HRESULT STDMETHODCALLTYPE Wcdx::ConvertPointFromScreen(POINT* point) { if (point == nullptr) return E_POINTER; ScreenToClient(_window, point); return ConvertPointFromClient(point); } HRESULT STDMETHODCALLTYPE Wcdx::ConvertRectToScreen(RECT* rect) { HRESULT hr; if (FAILED(hr = ConvertRectToClient(rect))) return E_POINTER; ClientToScreen(_window, reinterpret_cast<POINT*>(&rect->left)); ClientToScreen(_window, reinterpret_cast<POINT*>(&rect->right)); return S_OK; } HRESULT STDMETHODCALLTYPE Wcdx::ConvertRectFromScreen(RECT* rect) { if (rect == nullptr) return E_POINTER; ScreenToClient(_window, reinterpret_cast<POINT*>(&rect->left)); ScreenToClient(_window, reinterpret_cast<POINT*>(&rect->right)); return ConvertRectFromClient(rect); } HRESULT STDMETHODCALLTYPE Wcdx::QueryValue(const wchar_t* keyname, const wchar_t* valuename, void* data, DWORD* size) { HKEY roots[] = { HKEY_CURRENT_USER, HKEY_LOCAL_MACHINE }; for (auto root : roots) { HKEY key; auto error = ::RegOpenKeyEx(root, keyname, 0, KEY_QUERY_VALUE, &key); if (error != ERROR_SUCCESS) return HRESULT_FROM_WIN32(error); at_scope_exit([&]{ ::RegCloseKey(key); }); error = ::RegQueryValueEx(key, valuename, nullptr, nullptr, static_cast<BYTE*>(data), size); if (error != ERROR_FILE_NOT_FOUND) return HRESULT_FROM_WIN32(error); } return HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND); } HRESULT STDMETHODCALLTYPE Wcdx::SetValue(const wchar_t* keyname, const wchar_t* valuename, DWORD type, const void* data, DWORD size) { HKEY key; auto error = ::RegCreateKeyEx(HKEY_CURRENT_USER, keyname, 0, nullptr, 0, KEY_SET_VALUE, nullptr, &key, nullptr); if (error != ERROR_SUCCESS) return HRESULT_FROM_WIN32(error); at_scope_exit([&]{ ::RegCloseKey(key); }); error = ::RegSetValueEx(key, valuename, 0, type, static_cast<const BYTE*>(data), size); return HRESULT_FROM_WIN32(error); } HRESULT STDMETHODCALLTYPE Wcdx::FillSnow(byte color_index, INT x, INT y, UINT width, UINT height, UINT pitch, byte* pixels) { for (UINT h = 0; h != height; ++h) { auto p = pixels + (y * pitch) + x; for (UINT w = 0; w != width; ++w) *p++ = byte(RandomBit() * color_index); ++y; } return S_OK; } ATOM Wcdx::FrameWindowClass() { static const ATOM windowClass = [] { // Create an empty cursor. BYTE and_mask = 0xFF; BYTE xor_mask = 0; auto hcursor = ::CreateCursor(DllInstance, 0, 0, 1, 1, &and_mask, &xor_mask); if (hcursor == nullptr) throw std::system_error(::GetLastError(), std::system_category()); WNDCLASSEX wc = { sizeof(WNDCLASSEX), 0, FrameWindowProc, 0, 0, DllInstance, nullptr, hcursor, nullptr, nullptr, L"Wcdx Frame Window", nullptr }; return ::RegisterClassEx(&wc); }(); return windowClass; } LRESULT CALLBACK Wcdx::FrameWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { auto wcdx = reinterpret_cast<Wcdx*>(::GetWindowLongPtr(hwnd, GWLP_USERDATA)); if (wcdx == nullptr) { switch (message) { case WM_NCCREATE: // The client window procedure is an ANSI window procedure, so we need to mangle it // appropriately. We can do that by passing it through SetWindowLongPtr. wcdx = static_cast<Wcdx*>(reinterpret_cast<LPCREATESTRUCT>(lParam)->lpCreateParams); auto wndproc = ::SetWindowLongPtrA(hwnd, GWLP_WNDPROC, LONG_PTR(wcdx->_clientWindowProc)); wcdx->_clientWindowProc = WNDPROC(::SetWindowLongPtrW(hwnd, GWLP_WNDPROC, wndproc)); ::SetWindowLongPtr(hwnd, GWLP_USERDATA, reinterpret_cast<LONG_PTR>(wcdx)); return ::CallWindowProc(wcdx->_clientWindowProc, hwnd, message, wParam, lParam); } } else { switch (message) { case WM_SIZE: wcdx->OnSize(DWORD(wParam), LOWORD(lParam), HIWORD(lParam)); return 0; case WM_ACTIVATE: wcdx->OnActivate(LOWORD(wParam), HIWORD(wParam), reinterpret_cast<HWND>(lParam)); return 0; case WM_ERASEBKGND: return TRUE; case WM_WINDOWPOSCHANGED: wcdx->OnWindowPosChanged(reinterpret_cast<WINDOWPOS*>(lParam)); break; case WM_NCDESTROY: wcdx->OnNCDestroy(); return 0; case WM_NCLBUTTONDBLCLK: if (wcdx->OnNCLButtonDblClk(int(wParam), *reinterpret_cast<POINTS*>(&lParam))) return 0; break; case WM_SYSCHAR: if (wcdx->OnSysChar(DWORD(wParam), LOWORD(lParam), HIWORD(lParam))) return 0; break; case WM_SYSCOMMAND: if (wcdx->OnSysCommand(WORD(wParam), LOWORD(lParam), HIWORD(lParam))) return 0; break; case WM_SIZING: wcdx->OnSizing(DWORD(wParam), reinterpret_cast<RECT*>(lParam)); return TRUE; case WM_APP_RENDER: wcdx->OnRender(); break; } return ::CallWindowProc(wcdx->_clientWindowProc, hwnd, message, wParam, lParam); } return ::DefWindowProc(hwnd, message, wParam, lParam); } void Wcdx::OnSize(DWORD resizeType, WORD clientWidth, WORD clientHeight) { stdext::discard(resizeType, clientWidth, clientHeight); _sizeChanged = true; ::PostMessage(_window, WM_APP_RENDER, 0, 0); } void Wcdx::OnActivate(WORD state, BOOL minimized, HWND other) { stdext::discard(minimized, other); if (state != WA_INACTIVE) ConfineCursor(); } void Wcdx::OnWindowPosChanged(WINDOWPOS* windowPos) { if ((windowPos->flags & SWP_HIDEWINDOW) != 0 || _d3d == nullptr) return; HRESULT hr; UINT adapter; if (FAILED(hr = UpdateMonitor(adapter))) return; D3DDEVICE_CREATION_PARAMETERS parameters; if (FAILED(hr = _device->GetCreationParameters(&parameters)) || parameters.AdapterOrdinal != adapter) RecreateDevice(adapter); } void Wcdx::OnNCDestroy() { _window.Invalidate(); } bool Wcdx::OnNCLButtonDblClk(int hittest, POINTS position) { stdext::discard(position); if (hittest != HTCAPTION) return false; // Windows should already be doing this, but doesn't appear to. ::SendMessage(_window, WM_SYSCOMMAND, SC_MAXIMIZE, 0); return true; } bool Wcdx::OnSysChar(DWORD vkey, WORD repeatCount, WORD flags) { if (vkey == VK_RETURN && ((flags & (KF_REPEAT | KF_ALTDOWN)) == KF_ALTDOWN)) { SetFullScreen(!_fullScreen); return true; } return false; } bool Wcdx::OnSysCommand(WORD type, SHORT x, SHORT y) { stdext::discard(x, y); if (type == SC_MAXIMIZE) { SetFullScreen(true); return true; } return false; } void Wcdx::OnSizing(DWORD windowEdge, RECT* dragRect) { RECT client = { 0, 0, 0, 0 }; ::AdjustWindowRectEx(&client, _frameStyle, FALSE, _frameExStyle); client.left = dragRect->left - client.left; client.top = dragRect->top - client.top; client.right = dragRect->right - client.right; client.bottom = dragRect->bottom - client.bottom; auto width = client.right - client.left; auto height = client.bottom - client.top; bool adjustWidth; switch (windowEdge) { case WMSZ_LEFT: case WMSZ_RIGHT: adjustWidth = false; break; case WMSZ_TOP: case WMSZ_BOTTOM: adjustWidth = true; break; default: adjustWidth = height > (3 * width) / 4; break; } if (adjustWidth) { width = (4 * height) / 3; auto delta = width - (client.right - client.left); switch (windowEdge) { case WMSZ_TOP: case WMSZ_BOTTOM: dragRect->left -= delta / 2; dragRect->right += delta - (delta / 2); break; case WMSZ_TOPLEFT: case WMSZ_BOTTOMLEFT: dragRect->left -= delta; break; case WMSZ_TOPRIGHT: case WMSZ_BOTTOMRIGHT: dragRect->right += delta; break; } } else { height = (3 * width) / 4; auto delta = height - (client.bottom - client.top); switch (windowEdge) { case WMSZ_LEFT: case WMSZ_RIGHT: dragRect->top -= delta / 2; dragRect->bottom += delta - (delta / 2); break; case WMSZ_TOPLEFT: case WMSZ_TOPRIGHT: dragRect->top -= delta; break; case WMSZ_BOTTOMLEFT: case WMSZ_BOTTOMRIGHT: dragRect->bottom += delta; break; } } } void Wcdx::OnRender() { Present(); } HRESULT Wcdx::UpdateMonitor(UINT& adapter) { adapter = D3DADAPTER_DEFAULT; HRESULT hr; _monitor = ::MonitorFromWindow(_window, MONITOR_DEFAULTTONULL); for (UINT n = 0, count = _d3d->GetAdapterCount(); n < count; ++n) { D3DDISPLAYMODE currentMode; if (FAILED(hr = _d3d->GetAdapterDisplayMode(n, &currentMode))) return hr; // Require hardware acceleration. hr = _d3d->CheckDeviceType(n, D3DDEVTYPE_HAL, currentMode.Format, currentMode.Format, TRUE); if (hr == D3DERR_NOTAVAILABLE) continue; if (FAILED(hr)) return hr; D3DCAPS9 caps; hr = _d3d->GetDeviceCaps(n, D3DDEVTYPE_HAL, &caps); if (hr == D3DERR_NOTAVAILABLE) continue; if (FAILED(hr)) return hr; // Select the adapter that's already displaying the window. if (_d3d->GetAdapterMonitor(n) == _monitor) { adapter = n; break; } } return S_OK; } HRESULT Wcdx::RecreateDevice(UINT adapter) { HRESULT hr; D3DDISPLAYMODE currentMode; if (FAILED(hr = _d3d->GetAdapterDisplayMode(adapter, &currentMode))) return hr; _presentParams = { currentMode.Width, currentMode.Height, currentMode.Format, 1, D3DMULTISAMPLE_NONE, 0, D3DSWAPEFFECT_COPY, _window, TRUE, FALSE, D3DFMT_UNKNOWN, 0, 0, D3DPRESENT_INTERVAL_DEFAULT }; if (FAILED(hr = _d3d->CreateDevice(adapter, D3DDEVTYPE_HAL, _window, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &_presentParams, &_device))) return hr; if (FAILED(hr = CreateIntermediateSurface())) return hr; return S_OK; } HRESULT Wcdx::ResetDevice() { HRESULT hr; _surface = nullptr; if (FAILED(hr = _device->Reset(&_presentParams))) return hr; if (FAILED(hr = CreateIntermediateSurface())) return hr; return S_OK; } HRESULT Wcdx::CreateIntermediateSurface() { _dirty = true; return _device->CreateOffscreenPlainSurface(ContentWidth, ContentHeight, D3DFMT_X8R8G8B8, D3DPOOL_DEFAULT, &_surface, nullptr); } void Wcdx::SetFullScreen(bool enabled) { if (enabled == _fullScreen) return; if (enabled) { ::GetWindowRect(_window, &_frameRect); _frameStyle = ::SetWindowLong(_window, GWL_STYLE, WS_OVERLAPPED); _frameExStyle = ::SetWindowLong(_window, GWL_EXSTYLE, 0); HMONITOR monitor = ::MonitorFromWindow(_window, MONITOR_DEFAULTTONEAREST); MONITORINFO monitorInfo = { sizeof(MONITORINFO) }; ::GetMonitorInfo(monitor, &monitorInfo); ::SetWindowPos(_window, HWND_TOP, monitorInfo.rcMonitor.left, monitorInfo.rcMonitor.top, monitorInfo.rcMonitor.right - monitorInfo.rcMonitor.left, monitorInfo.rcMonitor.bottom - monitorInfo.rcMonitor.top, SWP_FRAMECHANGED | SWP_NOCOPYBITS | SWP_SHOWWINDOW); _fullScreen = true; } else { ::SetLastError(0); ::SetWindowLong(_window, GWL_STYLE, _frameStyle); ::SetWindowLong(_window, GWL_EXSTYLE, _frameExStyle); ::SetWindowPos(_window, HWND_TOP, _frameRect.left, _frameRect.top, _frameRect.right - _frameRect.left, _frameRect.bottom - _frameRect.top, SWP_FRAMECHANGED | SWP_NOCOPYBITS | SWP_SHOWWINDOW); _fullScreen = false; } ConfineCursor(); ::PostMessage(_window, WM_APP_RENDER, 0, 0); } RECT Wcdx::GetContentRect(RECT clientRect) { auto width = (4 * clientRect.bottom) / 3; auto height = (3 * clientRect.right) / 4; if (width < clientRect.right) { clientRect.left = (clientRect.right - width) / 2; clientRect.right = clientRect.left + width; } else { clientRect.top = (clientRect.bottom - height) / 2; clientRect.bottom = clientRect.top + height; } return clientRect; } void Wcdx::ConfineCursor() { if (_fullScreen) { RECT contentRect; ::GetClientRect(_window, &contentRect); contentRect = GetContentRect(contentRect); POINT topLeft = { contentRect.left, contentRect.top }; POINT bottomRight = { contentRect.right, contentRect.bottom }; ::ClientToScreen(_window, &topLeft); ::ClientToScreen(_window, &bottomRight); contentRect = { topLeft.x, topLeft.y, bottomRight.x, bottomRight.y }; ::ClipCursor(&contentRect); } else ::ClipCursor(nullptr); } namespace { POINT ConvertTo(POINT point, RECT rect) { return { rect.left + ((point.x * (rect.right - rect.left)) / Wcdx::ContentWidth), rect.top + ((point.y * (rect.bottom - rect.top)) / Wcdx::ContentHeight) }; } POINT ConvertFrom(POINT point, RECT rect) { return { ((point.x - rect.left) * Wcdx::ContentWidth) / (rect.right - rect.left), ((point.y - rect.top) * Wcdx::ContentHeight) / (rect.bottom - rect.top) }; } HRESULT GetSavedGamePath(LPCWSTR subdir, LPWSTR path) { typedef HRESULT(STDAPICALLTYPE* GetKnownFolderPathFn)(REFKNOWNFOLDERID rfid, DWORD dwFlags, HANDLE hToken, PWSTR* ppszPath); auto shellModule = ::GetModuleHandle(L"Shell32.dll"); if (shellModule != nullptr) { auto GetKnownFolderPath = reinterpret_cast<GetKnownFolderPathFn>(::GetProcAddress(shellModule, "SHGetKnownFolderPath")); if (GetKnownFolderPath != nullptr) { // flags for Known Folder APIs enum { KF_FLAG_CREATE = 0x00008000, KF_FLAG_INIT = 0x00000800 }; PWSTR folderPath; auto hr = GetKnownFolderPath(FOLDERID_SavedGames, KF_FLAG_CREATE | KF_FLAG_INIT, nullptr, &folderPath); if (FAILED(hr)) return hr == E_INVALIDARG ? STG_E_PATHNOTFOUND : hr; at_scope_exit([&]{ ::CoTaskMemFree(folderPath); }); PWSTR pathEnd; size_t remaining; if (FAILED(hr = ::StringCchCopyEx(path, MAX_PATH, folderPath, &pathEnd, &remaining, 0))) return hr; if (FAILED(hr = ::StringCchCopyEx(pathEnd, remaining, L"\\", &pathEnd, &remaining, 0))) return hr; return ::StringCchCopy(pathEnd, remaining, subdir); } } return E_NOTIMPL; } HRESULT GetLocalAppDataPath(LPCWSTR subdir, LPWSTR path) { auto hr = ::SHGetFolderPath(nullptr, CSIDL_LOCAL_APPDATA, nullptr, SHGFP_TYPE_CURRENT, path); if (FAILED(hr)) return hr; PWSTR pathEnd; size_t remaining; if (FAILED(hr = ::StringCchCatEx(path, MAX_PATH, L"\\", &pathEnd, &remaining, 0))) return hr; return ::StringCchCopy(pathEnd, remaining, subdir); } bool CreateDirectoryRecursive(LPWSTR pathName) { if (::CreateDirectory(pathName, nullptr) || ::GetLastError() == ERROR_ALREADY_EXISTS) return true; if (::GetLastError() != ERROR_PATH_NOT_FOUND) return false; auto i = std::find(std::make_reverse_iterator(pathName + wcslen(pathName)), std::make_reverse_iterator(pathName), L'\\'); if (i.base() == pathName) return false; *i = L'\0'; auto result = CreateDirectoryRecursive(pathName); *i = L'\\'; return result && ::CreateDirectory(pathName, nullptr); } }
29.328996
156
0.60796
[ "transform" ]
41c3c648a9f6649a90f3dad69afcc8878ffe3a73
42,762
cpp
C++
hyperUI/source/StandardUI/UISliderElement.cpp
sadcatsoft/hyperui
f26242a9034ad1e0abf54bd7691fe48809262f5b
[ "MIT" ]
2
2019-05-17T16:16:21.000Z
2019-08-21T20:18:22.000Z
hyperUI/source/StandardUI/UISliderElement.cpp
sadcatsoft/hyperui
f26242a9034ad1e0abf54bd7691fe48809262f5b
[ "MIT" ]
1
2018-10-18T22:05:12.000Z
2018-10-18T22:05:12.000Z
hyperUI/source/StandardUI/UISliderElement.cpp
sadcatsoft/hyperui
f26242a9034ad1e0abf54bd7691fe48809262f5b
[ "MIT" ]
null
null
null
#include "stdafx.h" //#define BUTTON_SPACING upToScreen(6.0) #define BUTTON_SPACING upToScreen(0) #define VALUE_ANIM_TIME 0.10 #define SLIDER_MULT_HOR_PADDING 0.5 #define VALUE_DISPLAY_FADE_SECONDS 0.10 // Note that the larger the divisor, the flatter the curve - i.e. the faster it rises at first. #define LOG_SLIDER_DIVISOR 13.0 namespace HyperUI { /*****************************************************************************/ UISliderElement::UISliderElement(UIPlane* pParentPlane) : UIElement(pParentPlane), AnimSequenceAddon(PropertySecondaryImage) { onAllocated(pParentPlane); } /*****************************************************************************/ void UISliderElement::onAllocated(IBaseObject* pData) { UIElement::onAllocated(pData); AnimSequenceAddon::onAllocated(PropertySecondaryImage); myCurrUndoBlockId = -1; } /*****************************************************************************/ void UISliderElement::postInit(void) { UIElement::postInit(); // Get this from a property. myIsVertical = this->getBoolProp(PropertyIsVertical); myStartInMiddle = this->getBoolProp(PropertyStartInMiddle); /* if(myIsVertical) myIsSizable = this->getIsSizableInY() || this->doesPropertyExist(PropertyUiObjSpacingWidth) || this->doesPropertyExist(PropertyUiObjFillParentYLessPadding); else myIsSizable = this->getIsSizableInX() || this->doesPropertyExist(PropertyUiObjSpacingWidth) || this->doesPropertyExist(PropertyUiObjFillParentXLessPadding); */ if(myIsVertical) myIsSizable = this->doesPropertyExist(PropertyLayoutWidth) || (this->getFillParentYLessPadding() >= 0); else myIsSizable = this->doesPropertyExist(PropertyLayoutWidth) || (this->getFillParentXLessPadding() >= 0); myIsInCallback = false; myAllowPressing = false; if(myStartInMiddle) { myMinValue = -1.0; myMaxValue = 1.0; } else { myMinValue = 0.0; myMaxValue = 1.0; } myButtonValueStep = 0.05; myCurrValue.setNonAnimValue(0.0); myActiveSliderPart = SliderPartNone; myDragStartValue = 0; myValueDisplayOpacity.setNonAnimValue(0); // See if we have a button size myKnobSize.set(0, 0); myButtonSize.set(0,0); if(this->doesPropertyExist(PropertySliderButtonSizes)) { myKnobSize.x = this->getNumericEnumPropValue(PropertySliderButtonSizes, 0); myKnobSize.y = this->getNumericEnumPropValue(PropertySliderButtonSizes, 1); if(this->getNumericEnumPropCount(PropertySliderButtonSizes) > 2) { myButtonSize.x = this->getNumericEnumPropValue(PropertySliderButtonSizes, 2); myButtonSize.y = this->getNumericEnumPropValue(PropertySliderButtonSizes, 3); } } // Need to specify the knob size _ASSERT(myKnobSize.x > 0 && myKnobSize.y > 0); myValueDisplayAnim = ""; myFullSliderAnim = ""; myLessButtonAnim = myMoreButtonAnim = ""; if(this->doesPropertyExist(PropertySliderParms)) { myLessButtonAnim = this->getEnumPropValue(PropertySliderParms, 0); if(strcmp(myLessButtonAnim.c_str(), PROPERTY_NONE) == 0) myLessButtonAnim = ""; myMoreButtonAnim = this->getEnumPropValue(PropertySliderParms, 1); if(strcmp(myMoreButtonAnim.c_str(), PROPERTY_NONE) == 0) myMoreButtonAnim = ""; if(this->getEnumPropCount(PropertySliderParms) >= 3) { // We have the full slider specified, too. myFullSliderAnim = this->getEnumPropValue(PropertySliderParms, 2); if(strcmp(myFullSliderAnim.c_str(), PROPERTY_NONE) == 0) myFullSliderAnim = ""; } if(this->getEnumPropCount(PropertySliderParms) >= 4) { myValueDisplayAnim = this->getEnumPropValue(PropertySliderParms, 3); if(strcmp(myValueDisplayAnim.c_str(), PROPERTY_NONE) == 0) myValueDisplayAnim = ""; } } // See if we have value display parms myValueDisplayMult = 1.0; myValueDisplayYOffset = 0; if(this->doesPropertyExist(PropertySliderValParms)) { myValueDisplayYOffset = this->getNumericEnumPropValue(PropertySliderValParms, 0); if(this->getEnumPropCount(PropertySliderParms) >= 2) myValueDisplayMult = this->getNumericEnumPropValue(PropertySliderValParms, 1); } if(this->doesPropertyExist(PropertyMin)) { this->getAsString(PropertyMin, theLocalSharedString); getParentWindow()->substituteVariables(theLocalSharedString); FLOAT_TYPE fVal = StringUtils::convertStringToNumber(theLocalSharedString); if(fVal == FLOAT_TYPE_MAX) setMinValue(this->getAsNumber(PropertyMin)); else setMinValue(fVal); } if(this->doesPropertyExist(PropertyMax)) { this->getAsString(PropertyMax, theLocalSharedString); getParentWindow()->substituteVariables(theLocalSharedString); FLOAT_TYPE fVal = StringUtils::convertStringToNumber(theLocalSharedString); if(fVal == FLOAT_TYPE_MAX) setMaxValue(this->getAsNumber(PropertyMax)); else setMaxValue(fVal); } } /*****************************************************************************/ void UISliderElement::setMinValue(FLOAT_TYPE fValue) { myMinValue = fValue; } /*****************************************************************************/ void UISliderElement::setMaxValue(FLOAT_TYPE fValue) { myMaxValue = fValue; } /*****************************************************************************/ void UISliderElement::setButtonStep(FLOAT_TYPE fValue) { myButtonValueStep = fValue; } /*****************************************************************************/ void UISliderElement::setValue(FLOAT_TYPE fValue) { if(myIsInCallback) return; setValueSafe(fValue, false, NULL, false); //myCurrValue.setNonAnimValue(fValue); } /*****************************************************************************/ void UISliderElement::setValueSafe(FLOAT_TYPE fValue, bool bAnimated, UIElement* pOptChangeSourceElem, bool bIsChangingContinuously) { if(fValue < myMinValue) fValue = myMinValue; if(fValue > myMaxValue) fValue = myMaxValue; FLOAT_TYPE fCurrValue = getValue(); if(fabs(fValue - fCurrValue) < FLOAT_EPSILON) return; if(bAnimated) { FLOAT_TYPE fTime = fabs((fValue - fCurrValue)/(myMaxValue - myMinValue))*VALUE_ANIM_TIME; myCurrValue.setAnimation(fCurrValue, fValue, fTime, this->getClockType()); } else myCurrValue.setNonAnimValue(fValue); UIElement::changeValueTo(fValue, pOptChangeSourceElem, bAnimated, bIsChangingContinuously); } /*****************************************************************************/ void UISliderElement::render(const SVector2D& svScroll, FLOAT_TYPE fOpacity, FLOAT_TYPE fScale) { // See if we want to postpone rendering // Bad. There's a copy in UIElement, and anything that overrides render() won't use this... if(this->getDoPostponeRendering() && getUIPlane()->getRenderingPass() != RenderingPostopnedElements) { getUIPlane()->addPostponedElement(this, svScroll, fOpacity, fScale); return; } preRender(svScroll, fOpacity, fScale); renderSliderInternal(svScroll, fOpacity, fScale); postRender(svScroll, fOpacity, fScale); /* #ifdef WIN32 SColor scolRed(1,0,0,1); SRect2D srWindowRect; this->getElementRectangle(svScroll, fScale, srWindowRect); pDrawingCache->addRectangle(srWindowRect.x, srWindowRect.y, srWindowRect.w, srWindowRect.h, scolRed, 2); #endif */ } /*****************************************************************************/ void UISliderElement::renderSliderInternal(const SVector2D& svScroll, FLOAT_TYPE fOpacity, FLOAT_TYPE fScale) { DrawingCache* pDrawingCache = getDrawingCache(); this->getFullTopAnimName(theLocalSharedString); this->getFullBaseAnimName(theLocalSharedString2); // Slider knob anim forgotten if fails _ASSERT(theLocalSharedString.length() > 0); // Empty slider anim forgotten if fails _ASSERT(theLocalSharedString2.length() > 0); // Now, see if we have full slider anim. If we do, just // render progress. If not, just render simple slider. bool bHaveButtons = false; if(myButtonSize.x > 0 && myButtonSize.y > 0 && myLessButtonAnim.length() > 0 && myMoreButtonAnim.length() > 0) bHaveButtons = true; // Progress FLOAT_TYPE fPercProgress = 0.0; FLOAT_TYPE fNormProgress = 0.0; FLOAT_TYPE fCurrProg = getValue(); if(fabs(myMaxValue - myMinValue) > FLOAT_EPSILON) { fPercProgress = valueToPercProgress(fCurrProg); //fPercProgress = (fCurrProg - myMinValue)/(myMaxValue - myMinValue); if(myStartInMiddle) fNormProgress = (fPercProgress - 0.5)*2.0; else fNormProgress = fPercProgress; } if(fPercProgress < 0.0) fPercProgress = 0; if(fPercProgress > 1.0) fPercProgress = 1.0; if(!myStartInMiddle) fNormProgress = fPercProgress; else { if(fNormProgress < -1.0) fNormProgress = -1.0; if(fNormProgress > 1.0) fNormProgress = 1.0; } // Finally, draw the slider SVector2D svPos; FLOAT_TYPE fFinalOpac, fLocScale; this->getLocalPosition(svPos, &fFinalOpac, &fLocScale); fFinalOpac *= fOpacity; if(this->getParent()) svPos *= fScale; SVector2D svCenter(svPos.x + svScroll.x, svPos.y + svScroll.y); FLOAT_TYPE fVeryFinalScale = fScale*fLocScale; // Now, render the slider pos. // For this, we need to know how large our slider bitmap is... int iSliderW, iSliderH; getTextureManager()->getTextureRealDims(theLocalSharedString2.c_str(), iSliderW, iSliderH); SVector2D svSliderSize; if(myIsSizable) { getBoxSize(svSliderSize); if(myIsVertical) svSliderSize.x = iSliderW; else svSliderSize.y = iSliderH; if(!bHaveButtons) { // We need this because if we only have a slider and no buttons, // and the slider is in the 0 or 1 position, // it's impossible to grab the half of the slider outside // of the box. svSliderSize.x -= myKnobSize.x*SLIDER_MULT_HOR_PADDING; } svSliderSize *= fVeryFinalScale; } else { svSliderSize.x = (FLOAT_TYPE)iSliderW*fVeryFinalScale; svSliderSize.y = (FLOAT_TYPE)iSliderH*fVeryFinalScale; } if(bHaveButtons) { if(myIsVertical) svSliderSize.y -= myButtonSize.y*2; else svSliderSize.x -= myButtonSize.x*2; } FLOAT_TYPE fLongPartScale = 1.0; // if(myFullSliderAnim.length() > 0) { ProgressBarStyleType eStyle; // Shouldn't this be left and top, respectivly? if(myIsVertical) eStyle = ProgressBarStyleFromTop; else eStyle = ProgressBarStyleFromLeft; SVector2D *pSizePtr = NULL; if(myIsSizable) pSizePtr = &svSliderSize; // Don't draw the progress if we're disabled (which may be colored and visible under the // semi-transparent knob). FLOAT_TYPE fProgCopy = fNormProgress; if(!getIsEnabled()) fProgCopy = 0; RenderUtils::renderProgressBar(getParentWindow(), theLocalSharedString2, myFullSliderAnim, fProgCopy, svCenter, fFinalOpac, fVeryFinalScale, eStyle, pSizePtr, myStartInMiddle); } // else // { // Just render the empty part. // pDrawingCache->addSprite(theLocalSharedString2.c_str(), svCenter.x, svCenter.y, fFinalOpac, 0, fVeryFinalScale, 1.0, true); // } // Draw the knob FLOAT_TYPE fButtonSpacing = BUTTON_SPACING*fVeryFinalScale; int iPixelOffsetHor; if(myIsVertical) { iPixelOffsetHor = (FLOAT_TYPE)svSliderSize.y*fPercProgress; // Now, draw the buttons, if any. if(bHaveButtons) { pDrawingCache->addSprite(myLessButtonAnim.c_str(), svCenter.x, svCenter.y - svSliderSize.y/2.0 - fButtonSpacing - myButtonSize.y/2.0, fFinalOpac, 0, fVeryFinalScale,1.0, true); pDrawingCache->addSprite(myMoreButtonAnim.c_str(), svCenter.x, svCenter.y + svSliderSize.y/2.0 + fButtonSpacing + myButtonSize.y/2.0, fFinalOpac, 0, fVeryFinalScale,1.0, true); } FLOAT_TYPE fFinalKnobPos = svCenter.y - svSliderSize.y/2.0 + iPixelOffsetHor; if(bHaveButtons) { FLOAT_TYPE fMinKnobVisualPos, fMaxKnobVisualPos; fMinKnobVisualPos = svCenter.y - svSliderSize.y/2.0 + myKnobSize.y/2.0; if(fFinalKnobPos < fMinKnobVisualPos) fFinalKnobPos = fMinKnobVisualPos; fMaxKnobVisualPos = svCenter.y + svSliderSize.y/2.0 - myKnobSize.y/2.0; if(fFinalKnobPos > fMaxKnobVisualPos) fFinalKnobPos = fMaxKnobVisualPos; } pDrawingCache->addSprite(theLocalSharedString.c_str(), svCenter.x, fFinalKnobPos, fFinalOpac, 0, fVeryFinalScale,1.0, true); if(myActiveSliderPart == SliderPartKnob && myValueDisplayAnim.length() > 0) { // Ahtung! _ASSERT(0); } } else { iPixelOffsetHor = (FLOAT_TYPE)svSliderSize.x*fPercProgress; // Now, draw the buttons, if any. if(bHaveButtons) { pDrawingCache->addSprite(myLessButtonAnim.c_str(), svCenter.x - svSliderSize.x/2.0 - fButtonSpacing - myButtonSize.x/2.0, svCenter.y, fFinalOpac, 0, fVeryFinalScale,1.0, true); pDrawingCache->addSprite(myMoreButtonAnim.c_str(), svCenter.x + svSliderSize.x/2.0 + fButtonSpacing + myButtonSize.x/2.0, svCenter.y, fFinalOpac, 0, fVeryFinalScale,1.0, true); } // Knob FLOAT_TYPE fFinalKnobPos = svCenter.x - svSliderSize.x/2.0 + iPixelOffsetHor; if(bHaveButtons) { FLOAT_TYPE fMinKnobVisualPos, fMaxKnobVisualPos; fMinKnobVisualPos = svCenter.x - svSliderSize.x/2.0 + myKnobSize.x/2.0; if(fFinalKnobPos < fMinKnobVisualPos) fFinalKnobPos = fMinKnobVisualPos; fMaxKnobVisualPos = svCenter.x + svSliderSize.x/2.0 - myKnobSize.x/2.0; if(fFinalKnobPos > fMaxKnobVisualPos) fFinalKnobPos = fMaxKnobVisualPos; } pDrawingCache->addSprite(theLocalSharedString.c_str(), fFinalKnobPos, svCenter.y, fFinalOpac, 0, fVeryFinalScale,1.0, true); // Render the slider value if we're dragged GTIME lTime = Application::getInstance()->getGlobalTime(this->getClockType()); FLOAT_TYPE fValueOp = myValueDisplayOpacity.getValue(); if(fValueOp > 0.0 && myValueDisplayAnim.length() > 0) { pDrawingCache->flush(); pDrawingCache->addSprite(myValueDisplayAnim.c_str(), svCenter.x - svSliderSize.x/2.0 + iPixelOffsetHor, svCenter.y + myValueDisplayYOffset, fFinalOpac*fValueOp, 0, fVeryFinalScale,1.0, true); char pcsBuffer[256]; theLocalSharedString = "%d"; if(this->doesPropertyExist(PropertyTextFormat)) theLocalSharedString = this->getStringProp(PropertyTextFormat); if(theLocalSharedString.find("d") != string::npos) { int iVal = fCurrProg*myValueDisplayMult; sprintf(pcsBuffer, theLocalSharedString.c_str(), iVal); } else { FLOAT_TYPE fVal = fCurrProg*myValueDisplayMult; sprintf(pcsBuffer, theLocalSharedString.c_str(), fVal); } SColor scolSelCol; this->getAsColor(PropertySelectedTextColor, scolSelCol); scolSelCol.alpha = fFinalOpac*fValueOp; pDrawingCache->addText(pcsBuffer, getCachedFont(), getCachedFontSize(), svCenter.x - svSliderSize.x/2.0 + iPixelOffsetHor + this->getNumProp(PropertyTextOffsetX), svCenter.y + myValueDisplayYOffset + this->getNumProp(PropertyTextOffsetY), scolSelCol, HorAlignCenter); } } if(this->doesPropertyExist(PropertySliderMarkParms)) { // Draw the marks FLOAT_TYPE fMarkSpacing = this->getNumericEnumPropValue(PropertySliderMarkParms, 0); int iNthLargeMark = (int)this->getNumericEnumPropValue(PropertySliderMarkParms, 1); SColor scolMarks; this->getAsColor(PropertySliderMarkColor, scolMarks); FLOAT_TYPE fSmallLength = upToScreen(1.0); FLOAT_TYPE fSmallThickness = upToScreen(0.4); FLOAT_TYPE fLargeLength = upToScreen(1.5); FLOAT_TYPE fLargeThickness = upToScreen(0.9); FLOAT_TYPE fMarkCenterOffset = upToScreen(5); if(myIsVertical) { theCommonString = "notchesAnim:3"; theCommonString2 = "notchesAnim:4"; if(myStartInMiddle) { int iCount = 0; FLOAT_TYPE fStart, fEnd = svCenter.y + svSliderSize.y/2.0; for(fStart = svCenter.y; fStart <= fEnd; fStart += fMarkSpacing, iCount++ ) { if(iNthLargeMark > 0 && iCount % iNthLargeMark == 0) { pDrawingCache->addSprite(theCommonString2.c_str(), svCenter.x - fMarkCenterOffset, fStart, fOpacity, 0, 1.0, 1.0, true); pDrawingCache->addSprite(theCommonString2.c_str(), svCenter.x + fMarkCenterOffset, fStart, fOpacity, 0, 1.0, 1.0, true); // pDrawingCache->addLine(svCenter.x - fMarkCenterOffset - fLargeLength, fStart, svCenter.x - fMarkCenterOffset + fLargeLength, fStart, scolMarks, fLargeThickness); // pDrawingCache->addLine(svCenter.x + fMarkCenterOffset - fLargeLength, fStart, svCenter.x + fMarkCenterOffset + fLargeLength, fStart, scolMarks, fLargeThickness); } else { pDrawingCache->addSprite(theCommonString.c_str(), svCenter.x - fMarkCenterOffset, fStart, fOpacity, 0, 1.0, 1.0, true); pDrawingCache->addSprite(theCommonString.c_str(), svCenter.x + fMarkCenterOffset, fStart, fOpacity, 0, 1.0, 1.0, true); // pDrawingCache->addLine(svCenter.x - fMarkCenterOffset - fSmallLength, fStart, svCenter.x - fMarkCenterOffset + fSmallLength, fStart, scolMarks, fSmallThickness); // pDrawingCache->addLine(svCenter.x + fMarkCenterOffset - fSmallLength, fStart, svCenter.x + fMarkCenterOffset + fSmallLength, fStart, scolMarks, fSmallThickness); } } iCount = 0; fEnd = svCenter.y - svSliderSize.y/2.0; for(fStart = svCenter.y; fStart >= fEnd; fStart -= fMarkSpacing, iCount++ ) { if(iNthLargeMark > 0 && iCount % iNthLargeMark == 0) { pDrawingCache->addSprite(theCommonString2.c_str(), svCenter.x - fMarkCenterOffset, fStart, fOpacity, 0, 1.0, 1.0, true); pDrawingCache->addSprite(theCommonString2.c_str(), svCenter.x + fMarkCenterOffset, fStart, fOpacity, 0, 1.0, 1.0, true); // pDrawingCache->addLine(svCenter.x - fMarkCenterOffset - fLargeLength, fStart, svCenter.x - fMarkCenterOffset + fLargeLength, fStart, scolMarks, fLargeThickness); // pDrawingCache->addLine(svCenter.x + fMarkCenterOffset - fLargeLength, fStart, svCenter.x + fMarkCenterOffset + fLargeLength, fStart, scolMarks, fLargeThickness); } else { pDrawingCache->addSprite(theCommonString.c_str(), svCenter.x - fMarkCenterOffset, fStart, fOpacity, 0, 1.0, 1.0, true); pDrawingCache->addSprite(theCommonString.c_str(), svCenter.x + fMarkCenterOffset, fStart, fOpacity, 0, 1.0, 1.0, true); // pDrawingCache->addLine(svCenter.x - fMarkCenterOffset - fSmallLength, fStart, svCenter.x - fMarkCenterOffset + fSmallLength, fStart, scolMarks, fSmallThickness); // pDrawingCache->addLine(svCenter.x + fMarkCenterOffset - fSmallLength, fStart, svCenter.x + fMarkCenterOffset + fSmallLength, fStart, scolMarks, fSmallThickness); } } } else { int iCount = 0; FLOAT_TYPE fStart, fEnd = svCenter.x + svSliderSize.x/2.0; for(fStart = svCenter.x - svSliderSize.x/2.0; fStart <= fEnd; fStart += fMarkSpacing, iCount++ ) { if(iNthLargeMark > 0 && iCount % iNthLargeMark == 0) { pDrawingCache->addSprite(theCommonString2.c_str(), svCenter.x - fMarkCenterOffset, fStart, fOpacity, 0, 1.0, 1.0, true); pDrawingCache->addSprite(theCommonString2.c_str(), svCenter.x + fMarkCenterOffset, fStart, fOpacity, 0, 1.0, 1.0, true); // pDrawingCache->addLine(svCenter.x - fMarkCenterOffset - fLargeLength, fStart, svCenter.x - fMarkCenterOffset + fLargeLength, fStart, scolMarks, fLargeThickness); // pDrawingCache->addLine(svCenter.x + fMarkCenterOffset - fLargeLength, fStart, svCenter.x + fMarkCenterOffset + fLargeLength, fStart, scolMarks, fLargeThickness); } else { pDrawingCache->addSprite(theCommonString.c_str(), svCenter.x - fMarkCenterOffset, fStart, fOpacity, 0, 1.0, 1.0, true); pDrawingCache->addSprite(theCommonString.c_str(), svCenter.x + fMarkCenterOffset, fStart, fOpacity, 0, 1.0, 1.0, true); // pDrawingCache->addLine(svCenter.x - fMarkCenterOffset - fSmallLength, fStart, svCenter.x - fMarkCenterOffset + fSmallLength, fStart, scolMarks, fSmallThickness); // pDrawingCache->addLine(svCenter.x + fMarkCenterOffset - fSmallLength, fStart, svCenter.x + fMarkCenterOffset + fSmallLength, fStart, scolMarks, fSmallThickness); } } } } else { theCommonString = "notchesAnim:2"; theCommonString2 = "notchesAnim:1"; if(myStartInMiddle) { int iCount = 0; FLOAT_TYPE fStart, fEnd = svCenter.x + svSliderSize.x/2.0; for(fStart = svCenter.x; fStart <= fEnd; fStart += fMarkSpacing, iCount++ ) { if(iNthLargeMark > 0 && iCount % iNthLargeMark == 0) { // pDrawingCache->addLine(fStart, svCenter.y - fMarkCenterOffset - fLargeLength, fStart, svCenter.y - fMarkCenterOffset + fLargeLength, scolMarks, fLargeThickness); // pDrawingCache->addLine(fStart, svCenter.y + fMarkCenterOffset - fLargeLength, fStart, svCenter.y + fMarkCenterOffset + fLargeLength, scolMarks, fLargeThickness); pDrawingCache->addSprite(theCommonString2.c_str(), fStart, svCenter.y - fMarkCenterOffset, fOpacity, 0, 1.0, 1.0, true); pDrawingCache->addSprite(theCommonString2.c_str(), fStart, svCenter.y + fMarkCenterOffset, fOpacity, 0, 1.0, 1.0, true); } else { pDrawingCache->addSprite(theCommonString.c_str(), fStart, svCenter.y - fMarkCenterOffset, fOpacity, 0, 1.0, 1.0, true); pDrawingCache->addSprite(theCommonString.c_str(), fStart, svCenter.y + fMarkCenterOffset, fOpacity, 0, 1.0, 1.0, true); // pDrawingCache->addLine(fStart, svCenter.y - fMarkCenterOffset - fSmallLength, fStart, svCenter.y - fMarkCenterOffset + fSmallLength, scolMarks, fSmallThickness); // pDrawingCache->addLine(fStart, svCenter.y + fMarkCenterOffset - fSmallLength, fStart, svCenter.y + fMarkCenterOffset + fSmallLength, scolMarks, fSmallThickness); } } iCount = 0; fEnd = svCenter.x - svSliderSize.x/2.0; for(fStart = svCenter.x; fStart >= fEnd; fStart -= fMarkSpacing, iCount++ ) { if(iNthLargeMark > 0 && iCount % iNthLargeMark == 0) { // pDrawingCache->addLine(fStart, svCenter.y - fMarkCenterOffset - fLargeLength, fStart, svCenter.y - fMarkCenterOffset + fLargeLength, scolMarks, fLargeThickness); // pDrawingCache->addLine(fStart, svCenter.y + fMarkCenterOffset - fLargeLength, fStart, svCenter.y + fMarkCenterOffset + fLargeLength, scolMarks, fLargeThickness); pDrawingCache->addSprite(theCommonString2.c_str(), fStart, svCenter.y - fMarkCenterOffset, fOpacity, 0, 1.0, 1.0, true); pDrawingCache->addSprite(theCommonString2.c_str(), fStart, svCenter.y + fMarkCenterOffset, fOpacity, 0, 1.0, 1.0, true); } else { pDrawingCache->addSprite(theCommonString.c_str(), fStart, svCenter.y - fMarkCenterOffset, fOpacity, 0, 1.0, 1.0, true); pDrawingCache->addSprite(theCommonString.c_str(), fStart, svCenter.y + fMarkCenterOffset, fOpacity, 0, 1.0, 1.0, true); // pDrawingCache->addLine(fStart, svCenter.y - fMarkCenterOffset - fSmallLength, fStart, svCenter.y - fMarkCenterOffset + fSmallLength, scolMarks, fSmallThickness); // pDrawingCache->addLine(fStart, svCenter.y + fMarkCenterOffset - fSmallLength, fStart, svCenter.y + fMarkCenterOffset + fSmallLength, scolMarks, fSmallThickness); } } } else { int iCount = 0; FLOAT_TYPE fStart, fEnd = svCenter.x + svSliderSize.x/2.0; for(fStart = svCenter.x - svSliderSize.x/2.0; fStart <= fEnd; fStart += fMarkSpacing, iCount++ ) { if(iNthLargeMark > 0 && iCount % iNthLargeMark == 0) { // pDrawingCache->addLine(fStart, svCenter.y - fMarkCenterOffset - fLargeLength, fStart, svCenter.y - fMarkCenterOffset + fLargeLength, scolMarks, fLargeThickness); // pDrawingCache->addLine(fStart, svCenter.y + fMarkCenterOffset - fLargeLength, fStart, svCenter.y + fMarkCenterOffset + fLargeLength, scolMarks, fLargeThickness); pDrawingCache->addSprite(theCommonString2.c_str(), fStart, svCenter.y - fMarkCenterOffset, fOpacity, 0, 1.0, 1.0, true); pDrawingCache->addSprite(theCommonString2.c_str(), fStart, svCenter.y + fMarkCenterOffset, fOpacity, 0, 1.0, 1.0, true); } else { // pDrawingCache->addLine(fStart, svCenter.y - fMarkCenterOffset - fSmallLength, fStart, svCenter.y - fMarkCenterOffset + fSmallLength, scolMarks, fSmallThickness); // pDrawingCache->addLine(fStart, svCenter.y + fMarkCenterOffset - fSmallLength, fStart, svCenter.y + fMarkCenterOffset + fSmallLength, scolMarks, fSmallThickness); pDrawingCache->addSprite(theCommonString.c_str(), fStart, svCenter.y - fMarkCenterOffset, fOpacity, 0, 1.0, 1.0, true); pDrawingCache->addSprite(theCommonString.c_str(), fStart, svCenter.y + fMarkCenterOffset, fOpacity, 0, 1.0, 1.0, true); } } } } } } /*****************************************************************************/ SliderPartType UISliderElement::getClickedPart(int iX, int iY, FLOAT_TYPE* fKnobValueOut) { SliderPartType eRes = SliderPartNone; SVector2D svTestPoint(iX, iY); SVector2D svScroll(0,0); if(fKnobValueOut) *fKnobValueOut = myMinValue; this->getFullBaseAnimName(theLocalSharedString2); // Empty slider anim forgotten if fails _ASSERT(theLocalSharedString2.length() > 0); // Now, see if we have full slider anim. If we do, just // render progress. If not, just render simple slider. bool bHaveButtons = false; if(myButtonSize.x > 0 && myButtonSize.y > 0 && myLessButtonAnim.length() > 0 && myMoreButtonAnim.length() > 9) bHaveButtons = true; // Finally, draw the slider SVector2D svPos; FLOAT_TYPE fGlobalScale; this->getGlobalPosition(svPos, NULL, &fGlobalScale); SVector2D svOwnSize; this->getBoxSize(svOwnSize); svOwnSize *= fGlobalScale; // Progress FLOAT_TYPE fPercProgress = 0.0; FLOAT_TYPE fNormProgress; if(fabs(myMaxValue - myMinValue) > FLOAT_EPSILON) { FLOAT_TYPE fCurrProg = getValue(); fPercProgress = valueToPercProgress(fCurrProg); //fPercProgress = (fCurrProg - myMinValue)/(myMaxValue - myMinValue); if(myStartInMiddle) fNormProgress = (fPercProgress - 0.5)*2.0; else fNormProgress = fPercProgress; } if(fPercProgress < 0.0) fPercProgress = 0; if(fPercProgress > 1.0) fPercProgress = 1.0; if(!myStartInMiddle) fNormProgress = fPercProgress; else { if(fNormProgress < -1.0) fNormProgress = -1.0; if(fNormProgress > 1.0) fNormProgress = 1.0; } SVector2D svCenter(svPos.x + svScroll.x, svPos.y + svScroll.y); // Now, render the slider pos. // For this, we need to know how large our slider bitmap is... int iSliderW, iSliderH; getTextureManager()->getTextureRealDims(theLocalSharedString2.c_str(), iSliderW, iSliderH); SVector2D svSliderSize; if(myIsSizable) { getBoxSize(svSliderSize); if(!bHaveButtons) { // We need this because if we only have a slider and no buttons, // and the slider is in the 0 or 1 position, // it's impossible to grab the half of the slider outside // of the box. svSliderSize.x -= myKnobSize.x*SLIDER_MULT_HOR_PADDING; } svSliderSize *= fGlobalScale; } else { svSliderSize.x = (FLOAT_TYPE)iSliderW*fGlobalScale; svSliderSize.y = (FLOAT_TYPE)iSliderH*fGlobalScale; } if(bHaveButtons) { if(myIsVertical) svSliderSize.y -= myButtonSize.y*2; else svSliderSize.x -= myButtonSize.x*2; } FLOAT_TYPE fLongPartScale = 1.0; SRect2D srTestRect; if(myIsVertical) { int iPixelOffsetHor = (FLOAT_TYPE)svSliderSize.y*fPercProgress; // Try the buttons, if any, first. With new allowances on the // slider/knob, we may always be thinking we're over the slider, // even when visually we're over buttons... if(bHaveButtons) { FLOAT_TYPE fButtonSpacing = BUTTON_SPACING*fGlobalScale; // Less button srTestRect.x = svCenter.x - svOwnSize.x/2.0; srTestRect.y = svCenter.y - svSliderSize.y/2.0 - fButtonSpacing - myButtonSize.y; srTestRect.w = svOwnSize.x; srTestRect.h = myButtonSize.y; if(srTestRect.doesContain(svTestPoint)) { // We're over the less button eRes = SliderPartLess; return eRes; } else { // More button srTestRect.x = svCenter.x - svOwnSize.x/2.0; srTestRect.y = svCenter.y + svSliderSize.y/2.0 + fButtonSpacing; srTestRect.w = svOwnSize.x; srTestRect.h = myButtonSize.y; if(srTestRect.doesContain(svTestPoint)) { // We're over the less button eRes = SliderPartMore; if(fKnobValueOut) *fKnobValueOut = myMaxValue; return eRes; } } } srTestRect.x = svCenter.x - svOwnSize.x/2.0; srTestRect.y = svCenter.y - svSliderSize.y/2.0 - myKnobSize.y/2.0; srTestRect.w = svOwnSize.x; srTestRect.h = svSliderSize.y + myKnobSize.y; if(srTestRect.doesContain(svTestPoint)) { // We're over the slider. See if we're on a knob or not. // If not, return percentage. srTestRect.x = svCenter.x - svOwnSize.x/2.0; srTestRect.y = svCenter.y - svSliderSize.y/2.0 + iPixelOffsetHor - myKnobSize.y/2.0; srTestRect.w = svOwnSize.x; srTestRect.h = myKnobSize.y; if(srTestRect.doesContain(svTestPoint)) eRes = SliderPartKnob; else eRes = SliderPartMain; // If we need the location, see where it is if(fKnobValueOut) { *fKnobValueOut = (svTestPoint.y - (svCenter.y - svSliderSize.y/2.0))/(FLOAT_TYPE)svSliderSize.y; // This is currently in [0,1]. Convert to actual values. *fKnobValueOut = percProgressToValue(*fKnobValueOut); //*fKnobValueOut = (*fKnobValueOut)*(myMaxValue - myMinValue) + myMinValue; } return eRes; } else if(fKnobValueOut) { *fKnobValueOut = (svTestPoint.y - (svCenter.y - svSliderSize.y/2.0))/(FLOAT_TYPE)svSliderSize.y; *fKnobValueOut = HyperCore::clampToRange<FLOAT_TYPE>(0, 1, *fKnobValueOut); *fKnobValueOut = percProgressToValue(*fKnobValueOut); /* if(svTestPoint.y < svCenter.y) *fKnobValueOut = myMinValue; else if(svTestPoint.y > svCenter.y) *fKnobValueOut = myMaxValue; else *fKnobValueOut = (myMaxValue + myMinValue)*0.5; */ } } else { int iPixelOffsetHor = (FLOAT_TYPE)svSliderSize.x*fPercProgress; // Try the buttons, if any, first. With new allowances on the // slider/knob, we may always be thinking we're over the slider, // even when visually we're over buttons... if(bHaveButtons) { FLOAT_TYPE fButtonSpacing = BUTTON_SPACING*fGlobalScale; // Less button srTestRect.x = svCenter.x - svSliderSize.x/2.0 - fButtonSpacing - myButtonSize.x; srTestRect.y = svCenter.y - svOwnSize.y/2.0; srTestRect.w = myButtonSize.x; srTestRect.h = svOwnSize.y; if(srTestRect.doesContain(svTestPoint)) { // We're over the less button eRes = SliderPartLess; return eRes; } else { // More button srTestRect.x = svCenter.x + svSliderSize.x/2.0 + fButtonSpacing; srTestRect.y = svCenter.y - svOwnSize.y/2.0; srTestRect.w = myButtonSize.x; srTestRect.h = svOwnSize.y; if(srTestRect.doesContain(svTestPoint)) { // We're over the less button eRes = SliderPartMore; if(fKnobValueOut) *fKnobValueOut = myMaxValue; return eRes; } } } // See if we're over main slider. We'll probably need position, too. srTestRect.x = svCenter.x - svSliderSize.x/2.0 - myKnobSize.x/2.0; srTestRect.y = svCenter.y - svOwnSize.y/2.0; srTestRect.w = svSliderSize.x + myKnobSize.x; srTestRect.h = svOwnSize.y; if(srTestRect.doesContain(svTestPoint)) { // We're over the slider. See if we're on a knob or not. // If not, return percentage. srTestRect.x = svCenter.x - svSliderSize.x/2.0 + iPixelOffsetHor - myKnobSize.x/2.0; srTestRect.y = svCenter.y - svOwnSize.y/2.0; srTestRect.w = myKnobSize.x; srTestRect.h = svOwnSize.y; if(srTestRect.doesContain(svTestPoint)) eRes = SliderPartKnob; else eRes = SliderPartMain; // If we need the location, see where it is if(fKnobValueOut) { *fKnobValueOut = (svTestPoint.x - (svCenter.x - svSliderSize.x/2.0))/(FLOAT_TYPE)svSliderSize.x; // This is currently in [0,1]. Convert to actual values. *fKnobValueOut = percProgressToValue(*fKnobValueOut); //*fKnobValueOut = (*fKnobValueOut)*(myMaxValue - myMinValue) + myMinValue; } return eRes; } else if(fKnobValueOut) { *fKnobValueOut = (svTestPoint.x - (svCenter.x - svSliderSize.x/2.0))/(FLOAT_TYPE)svSliderSize.x; *fKnobValueOut = HyperCore::clampToRange<FLOAT_TYPE>(0, 1, *fKnobValueOut); *fKnobValueOut = percProgressToValue(*fKnobValueOut); /* if(svTestPoint.x < svCenter.x) *fKnobValueOut = myMinValue; else if(svTestPoint.x > svCenter.x) *fKnobValueOut = myMaxValue; else *fKnobValueOut = (myMaxValue + myMinValue)*0.5; */ } } return eRes; } /*****************************************************************************/ void UISliderElement::onPressed(TTouchVector& vecTouches) { UIElement::onPressed(vecTouches); if(getIsEnabled() && vecTouches.size() > 0) { myActiveSliderPart = this->getClickedPart(vecTouches[0].myPoint.x, vecTouches[0].myPoint.y, NULL); myDragStartValue = getValue(); if(myActiveSliderPart == SliderPartKnob) { myValueDisplayOpacity.changeAnimation(0, 1, VALUE_DISPLAY_FADE_SECONDS, getClockType()); getUIPlane()->lockMouseCursor(this); if(this->getLinkedToElementWithValidTarget()) EventManager::getInstance()->sendEvent(EventUIParmChangeBegin, this); } myAllowPressing = true; // Save undo... _ASSERT(myCurrUndoBlockId < 0); UIElement* pParmElem = getLinkedToElementWithValidTarget(); if(pParmElem && UndoManager::canAcceptNewUndoNow()) myCurrUndoBlockId = UndoManager::addUndoItemToCurrentManager(pParmElem->getUndoStringForSelfChange(), pParmElem->createUndoItemForSelfChange(), true, getParentWindow(), NULL); } } /*****************************************************************************/ void UISliderElement::onMouseEnter(TTouchVector& vecTouches) { UIElement::onMouseEnter(vecTouches); if(getIsEnabled() && myActiveSliderPart == SliderPartKnob) { GTIME lTime = Application::getInstance()->getGlobalTime(this->getClockType()); if(myValueDisplayOpacity.getValue() < 1.0) myValueDisplayOpacity.changeAnimation(0, 1, VALUE_DISPLAY_FADE_SECONDS, getClockType()); if(this->getLinkedToElementWithValidTarget()) EventManager::getInstance()->sendEvent(EventUIParmChangeBegin, this); } } /*****************************************************************************/ void UISliderElement::onMouseLeave(TTouchVector& vecTouches) { UIElement::onMouseLeave(vecTouches); if(getIsEnabled() && myActiveSliderPart == SliderPartKnob && this->getLinkedToElementWithValidTarget()) EventManager::getInstance()->sendEvent(EventUIParmChangeEnd, this); if(getIsEnabled() && myActiveSliderPart != SliderPartKnob) { myActiveSliderPart = SliderPartNone; getUIPlane()->unlockMouseCursor(); myAllowPressing = false; } GTIME lTime = Application::getInstance()->getGlobalTime(this->getClockType()); if(myValueDisplayOpacity.getValue() > 0) myValueDisplayOpacity.changeAnimation(1, 0, VALUE_DISPLAY_FADE_SECONDS, getClockType()); finishUndo(); } /*****************************************************************************/ void UISliderElement::onReleased(TTouchVector& vecTouches, bool bIgnoreActions) { UIElement::onReleased(vecTouches, bIgnoreActions); if(getIsEnabled()) { if(myActiveSliderPart == SliderPartKnob && this->getLinkedToElementWithValidTarget()) EventManager::getInstance()->sendEvent(EventUIParmChangeEnd, this); getUIPlane()->unlockMouseCursor(); if(myAllowPressing) { FLOAT_TYPE fReleasedValue; SliderPartType eFinalPart = this->getClickedPart(vecTouches[0].myPoint.x, vecTouches[0].myPoint.y, &fReleasedValue); // If we were dragging the knob, set the new final value. if((myActiveSliderPart == SliderPartKnob || myActiveSliderPart == SliderPartMain) && (eFinalPart == SliderPartMain || eFinalPart == SliderPartKnob)) { setValueSafe(fReleasedValue, myActiveSliderPart == SliderPartMain, NULL, false); } else if(myActiveSliderPart == SliderPartLess) { // Decrease the value by a given step FLOAT_TYPE fNewValue = getValue() - myButtonValueStep; setValueSafe(fNewValue, true, NULL, false); } else if(myActiveSliderPart == SliderPartMore) { // Increase the slider value by a given step FLOAT_TYPE fNewValue = getValue() + myButtonValueStep; setValueSafe(fNewValue, true, NULL, false); } myDragStartValue = getValue(); if(myCallbacks) { myIsInCallback = true; myCallbacks->onSliderValueChanged(this); myIsInCallback = false; } } // else // this->setPushed(false); } GTIME lTime = Application::getInstance()->getGlobalTime(this->getClockType()); if(myValueDisplayOpacity.getValue() > 0) myValueDisplayOpacity.changeAnimation(1, 0, VALUE_DISPLAY_FADE_SECONDS, getClockType()); myActiveSliderPart = SliderPartNone; myAllowPressing = false; finishUndo(); } /*****************************************************************************/ void UISliderElement::onMouseMove(TTouchVector& vecTouches) { #ifdef _DEBUG if(vecTouches.size() > 0 && vecTouches[0].myPoint.x >= 820) { int bp = 0; } #endif UIElement::onMouseMove(vecTouches); if(getIsEnabled() && vecTouches.size() > 0) { if(myAllowPressing && myActiveSliderPart == SliderPartKnob) { // Get the new position of the slider FLOAT_TYPE fTempVal; SliderPartType eSlidePart = this->getClickedPart(vecTouches[0].myPoint.x, vecTouches[0].myPoint.y, &fTempVal); // If we're moving the slider, make sure we continue to do so if(myActiveSliderPart == SliderPartKnob) eSlidePart = SliderPartKnob; if(eSlidePart == SliderPartMain || eSlidePart == SliderPartKnob) { setValueSafe(fTempVal, false, NULL, true); } if(myCallbacks) { myIsInCallback = true; myCallbacks->onSliderValueChanged(this); myIsInCallback = false; } } // Otherwise, we don't really care when the mouse moves. } } /*****************************************************************************/ FLOAT_TYPE UISliderElement::getValue(void) { GTIME lTime = Application::getInstance()->getGlobalTime(this->getClockType()); return myCurrValue.getValue(); } /*****************************************************************************/ void UISliderElement::onTimerTick(GTIME lGlobalTime) { UIElement::onTimerTick(lGlobalTime); // myCurrValue.checkTime(lGlobalTime); //myValueDisplayOpacity.checkTime(lGlobalTime); if(myCurrValue.getIsAnimating(false)) { // Callback if(myCallbacks) { myIsInCallback = true; myCallbacks->onSliderValueChanged(this); myIsInCallback = false; } } } /*****************************************************************************/ bool UISliderElement::getIsSliderBeingAnimated(void) { //GTIME lTime = Application::getInstance()->getGlobalTime(this->getClockType()); return myCurrValue.getIsAnimating(false); } /*****************************************************************************/ void UISliderElement::changeValueTo(FLOAT_TYPE fValue, UIElement* pOptSourceElem, bool bAnimate, bool bIsChangingContinuously) { if(myIsCallingChangeValue) return; // Note that will be called from the set value safe. //UIElement::changeValueTo(fValue); setValueSafe(fValue, bAnimate, pOptSourceElem, bIsChangingContinuously); } /*****************************************************************************/ void UISliderElement::finishUndo() { if(myCurrUndoBlockId >= 0) { UndoManager::endUndoBlockInCurrentManager(myCurrUndoBlockId, getParentWindow(), NULL); myCurrUndoBlockId = -1; } } /*****************************************************************************/ FLOAT_TYPE UISliderElement::percProgressToValue(FLOAT_TYPE fPercProgress) { if(this->getBoolProp(PropertyIsLogarithmic)) { ///FLOAT_TYPE fLogInterp = log10(fPercProgress*LOG_SLIDER_DIVISOR + 1)/log10(LOG_SLIDER_DIVISOR + 1); FLOAT_TYPE fLogInterp = (pow(10, fPercProgress*log10(LOG_SLIDER_DIVISOR + 1)) - 1)/LOG_SLIDER_DIVISOR; return fLogInterp*(myMaxValue - myMinValue) + myMinValue; } else return fPercProgress*(myMaxValue - myMinValue) + myMinValue; } /*****************************************************************************/ FLOAT_TYPE UISliderElement::valueToPercProgress(FLOAT_TYPE fValue) { if(this->getBoolProp(PropertyIsLogarithmic)) { FLOAT_TYPE fNormValue = (fValue - myMinValue)/(myMaxValue - myMinValue); return log10(fNormValue*LOG_SLIDER_DIVISOR + 1)/log10(LOG_SLIDER_DIVISOR + 1); //FLOAT_TYPE fInterp = pow(10, fNormValue*log10(LOG_SLIDER_DIVISOR + 1)) - 1; //return fInterp/LOG_SLIDER_DIVISOR; } else return (fValue - myMinValue)/(myMaxValue - myMinValue); } /*****************************************************************************/ bool UISliderElement::onMouseWheel(FLOAT_TYPE fDelta) { // Find if we're related to anything // Note that if we start asserting in UIElement::applyMouseWheelDelta() // we can just return true here to never scroll if we're over a slider. if(!doesPropertyExist(PropertyLinkTo)) return false; // Otherwise, get that element and call its onMouseWheel(). UIElement* pLinkedElem = this->getElementAtPath(this->getStringProp(PropertyLinkTo)); if(!pLinkedElem) ASSERT_RETURN_FALSE; return pLinkedElem->onMouseWheel(fDelta); } /*****************************************************************************/ bool UISliderElement::getAllowValuePropagation(FLOAT_TYPE fNewValue, bool bIsChangingContinuously, UIElement* pOptSourceElem, UIElement* pLinkedToElem) { // We don't propagate the value if we are a table's slider. // Otherwise, we may start marking nodes dirty every slide... UITableElement* pTable = as<UITableElement>(pLinkedToElem); if(pTable && pTable->getRelatedTableSlider() == this) return false; return UIElement::getAllowValuePropagation(fNewValue, bIsChangingContinuously, pOptSourceElem, pLinkedToElem); } /*****************************************************************************/ void UISliderElement::resetEvalCache(bool bRecursive) { UIElement::resetEvalCache(bRecursive); AnimSequenceAddon::resetEvalCache(); } /*****************************************************************************/ };
37.775618
195
0.673331
[ "render" ]
41cb7dc2fc0ca54e3831dc4d28e01adb247ee3b4
257
cpp
C++
5e/C++11/353_lambdaReturn.cpp
mallius/CppPrimer
0285fabe5934492dfed0a9cf67ba5650982a5f76
[ "MIT" ]
null
null
null
5e/C++11/353_lambdaReturn.cpp
mallius/CppPrimer
0285fabe5934492dfed0a9cf67ba5650982a5f76
[ "MIT" ]
null
null
null
5e/C++11/353_lambdaReturn.cpp
mallius/CppPrimer
0285fabe5934492dfed0a9cf67ba5650982a5f76
[ "MIT" ]
1
2022-01-25T15:51:34.000Z
2022-01-25T15:51:34.000Z
#include <iostream> #include <vector> #include <algorithm> using namespace std; int main(void) { vector<int> vi{1,2,3,4,5}; //transform(vi.begin, vi.end(), vi.begin(), //[](int i) -> int //{ if(i < 0) return -i; else return i; }); return 0; }
18.357143
49
0.59144
[ "vector", "transform" ]
41d32a7f0c36ff16c4340137cb9394b582b2196b
20,478
cpp
C++
editor.cpp
roelfdutoit/libchars
675658ba87e59a57caa16cae8248971941c89a55
[ "MIT" ]
2
2015-02-04T07:13:33.000Z
2015-05-07T02:49:24.000Z
editor.cpp
roelfdutoit/libchars
675658ba87e59a57caa16cae8248971941c89a55
[ "MIT" ]
null
null
null
editor.cpp
roelfdutoit/libchars
675658ba87e59a57caa16cae8248971941c89a55
[ "MIT" ]
null
null
null
/* Copyright (C) 2013-2015 Roelof Nico du Toit. @description Editor implementation Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "editor.h" #include "debug.h" namespace libchars { struct decode_sequence_t { const char *sequence; key_e result; }; decode_sequence_t __decode_table[] = { { "\x1b[D", KEY_LEFT }, { "\x1b[C", KEY_RIGHT }, { "\x1b[A", KEY_UP }, { "\x1b[B", KEY_DOWN }, { "\x1b[5~", KEY_PGUP }, { "\x1b[6~", KEY_PGDN }, { "\x1b[3~", KEY_DEL }, { "\x7f", KEY_BKSP }, { "\x01", KEY_SOL }, { "\x03", KEY_QUIT }, { "\x04", KEY_DEL }, // ^D (will be translated into KEY_EOF in multiline mode) { "\x05", KEY_EOL }, { "\x08", KEY_BKSP }, { "\x09", KEY_TAB }, { "\x0b", KEY_WIPE }, { "\x0c", KEY_CLEAR }, { "\x0d", KEY_ENTER }, { "\x14", KEY_SWAP }, { "\x1a", KEY_EOF }, // ^Z (only used in multiline mode) { "\x1b\x1b", IGNORE_SEQ }, { "\x1b[H", IGNORE_SEQ }, { "\x1b[F", IGNORE_SEQ }, { "\x1bO", IGNORE_SEQ }, { "\x1b[1", IGNORE_SEQ }, { "\x1b[2", IGNORE_SEQ }, }; const static size_t DECODE_TABLE_ENTRIES = (sizeof(__decode_table) / sizeof(decode_sequence_t)); key_e editor::decode_key(uint8_t c) { if (seq_N < MAX_DECODE_SEQUENCE) { seq[seq_N++] = c; size_t idx; for (idx = 0; idx < DECODE_TABLE_ENTRIES; ++idx) { const char *T_seq = __decode_table[idx].sequence; size_t T_seq_N = strlen(T_seq); if (memcmp(T_seq, seq, seq_N) == 0) { if (T_seq_N == seq_N) { seq_N = 0; if (obj->mode == MODE_MULTILINE && __decode_table[idx].result == KEY_DEL) return KEY_EOF; else return __decode_table[idx].result; } else if (T_seq_N > seq_N) { return PARTIAL_SEQ; } } } } if (seq_N>1 || !isprint(c)) { size_t i; char buffer[256] = ""; for (i=0; i<seq_N; ++i) { uint8_t cc = seq[i]; if (isprint(cc)) sprintf(buffer+strlen(buffer), "%c", cc); else sprintf(buffer+strlen(buffer), "\\x%02x", cc); } LC_LOG_DEBUG("UNKNOWN SEQUENCE: --> %s <--",buffer); } seq_N = 0; if (obj->mode == MODE_COMMAND && c == '?') return KEY_HELP; else if (isprint(c)) return PRINTABLE_CHAR; else return IGNORE_SEQ; } void editor::request_render() { if (state == IDLE || state == RENDER_DEFER) { if (driver.read_available()) state = RENDER_DEFER; else state = RENDER_NOW; } } size_t editor::render(size_t buf_idx, size_t length) { std::string sequence; size_t n = obj->render(obj->idx(buf_idx),length,sequence); if (n > 0) driver.write(sequence.data(),sequence.length()); return n; } int editor::print() { state = IDLE; if (obj->mode == MODE_MULTILINE) { // render prompt (if not already rendered) if (obj->prompt_rendered == 0) { driver.write(obj->prompt.data(), obj->prompt.length()); obj->prompt_rendered = obj->prompt.length(); } // print from previous cursor up to current end-of-buffer if (obj->cursor < obj->insert_idx) { size_t n_to_write = (obj->insert_idx - obj->cursor); driver.write(obj->data() + obj->cursor, n_to_write); obj->cursor = obj->insert_idx; } } else if (!driver.control()) { // render prompt (if not already rendered) if (obj->prompt_rendered == 0) { driver.write(obj->prompt.data(), obj->prompt.length()); obj->prompt_rendered = obj->prompt.length(); } // render from previous position up to current end-of-buffer if (obj->cursor < obj->insert_idx) { size_t start = obj->terminal_idx(obj->idx(obj->cursor)); size_t end = obj->terminal_idx(obj->idx(obj->insert_idx + 1)); size_t render_length = (obj->mode == MODE_PASSWORD || end <= start) ? 0 : (end - start); obj->cursor += render(obj->cursor,render_length); } } else { size_t cols = driver.columns(); size_t rows = driver.rows(); // invalid: no rows or columns if (cols == 0 || rows == 0) return -2; // do nothing if only 1 position available (1 x 1 terminal) if (cols <= 1 && rows <= 1) return -3; // calculate available terminal space (leave extra space at the end for the cursor to overflow into) size_t window = cols * rows - 1; // dump will be limited depending on available terminal space; // prompt will be shortened if terminal not big enough for full string size_t cursor = obj->terminal_cursor(obj->idx(obj->insert_idx)); size_t start = obj->terminal_idx(obj->idx(obj->insert_idx)); size_t end = obj->terminal_idx(obj->idx(obj->insert_idx + 1)); size_t render_length = (obj->mode == MODE_PASSWORD) ? 0 : obj->terminal_idx(obj->idx(obj->length())); if (cursor < start) start = cursor; if (end < start) end = start; if ((cursor - start) > window) cursor = start; LC_LOG_VERBOSE("window[%zu:%zux%zu];start[%zu];cursor[%zu];end[%zu];render_len[%zu]",window,cols,rows,start,cursor,end,render_length); if ((render_length + obj->prompt.length()) > window) { size_t idx_from = 0; size_t from = 0; if (render_length > 0) { if ((end - start) >= window) { idx_from = obj->insert_idx; from = start; } else { size_t search_from = 0; if ((render_length - cursor) <= window/2) { // <-- cursor in last 1/2 window // find all complete expanded characters that fit into (window - (LENGTH - START)) before START if (render_length > window) search_from = render_length - window; else search_from = 0; } else if (cursor < window/2) { // <-- cursor in first 1/2 window // find all complete expanded characters that fit into space before START search_from = 0; } else { search_from = cursor - window/2; } LC_LOG_VERBOSE("search_from[%zu];start[%zu]",search_from,start); if (search_from < start) { // start searching with assumption that render is 1:1 with buffer size_t space = start - search_from; if (space < obj->insert_idx) idx_from = obj->insert_idx - space; else idx_from = 0; // keep on comparing until rendered string fits in or until space runs out from = obj->terminal_idx(obj->idx(idx_from)); if (from > search_from) { // more space available; search backwards while (idx_from > 0 && from > search_from) { --idx_from; from = obj->terminal_idx(obj->idx(idx_from)); } if (from < search_from) { ++idx_from; from = obj->terminal_idx(obj->idx(idx_from)); } } else if (from < search_from) { // used too much space; search forwards while (idx_from < obj->insert_idx && from < search_from) { ++idx_from; from = obj->terminal_idx(obj->idx(idx_from)); } } } else { idx_from = obj->insert_idx; from = start; } } LC_LOG_VERBOSE("from[%zu];idx_from[%zu]",from,idx_from); // find all expanded characters (even partial) that fit into (window - END) on and after END size_t search_to = from + window; if (search_to > render_length) search_to = render_length; size_t idx_to = obj->insert_idx; if (idx_to < idx_from) idx_to = idx_from; size_t to = obj->terminal_idx(obj->idx(idx_to + 1)); LC_LOG_VERBOSE("search_to[%zu];end[%zu]",search_to,end); if (search_to > end) { // start searching with assumption that render is 1:1 with buffer idx_to = obj->idx(obj->insert_idx + (search_to - end)); // keep on comparing until rendered string fits in or until space runs out to = obj->terminal_idx(obj->idx(idx_to + 1)); if (to < search_to) { // more space available; search forwards while (idx_to < obj->length() && to < search_to) { ++idx_to; to = obj->terminal_idx(obj->idx(idx_to + 1)); } if (to > search_to && idx_to > obj->insert_idx) { --idx_to; to = obj->terminal_idx(obj->idx(idx_to + 1)); } } else if (to > search_to) { // used too much space; search backwards while (idx_to > obj->insert_idx && to > search_to) { --idx_to; to = obj->terminal_idx(obj->idx(idx_to + 1)); } } } LC_LOG_VERBOSE("to[%zu];idx_to[%zu]",to,idx_to); if (to < from) to = from; else if ((to - from) > window) to = from + window; render_length = to - from; } // start printing in upper-left corner terminal_driver::auto_cursor __(driver); driver.clear_screen(); // print partial prompt (if possible) if (render_length < window) { obj->prompt_rendered = window - render_length; driver.write(obj->prompt.data() + obj->prompt.length() - obj->prompt_rendered, obj->prompt_rendered); LC_LOG_VERBOSE("prompt_rendered[%zu]:%s",obj->prompt_rendered,obj->prompt.c_str()+obj->prompt.length()-obj->prompt_rendered); } else { obj->prompt_rendered = 0; render_length = window; } // print line[idx_from..] size_t rendered = render(idx_from, render_length); // move to final cursor position (relative to current position) LC_LOG_VERBOSE("cursor[%zu];from[%zu];rendered[%zu]",cursor,from,rendered); if (driver.set_new_xy((ssize_t)cursor - (ssize_t)(from + rendered)) < 0) return -1; } else { LC_LOG_VERBOSE("obj->cursor[%zu]",obj->cursor); // move cursor to start of prompt position (relative to current position) if (driver.set_new_xy(0 - (ssize_t)obj->cursor - (ssize_t)obj->prompt_rendered) < 0) return -1; // clear area for printing (TODO: optimize by only clearing specific lines) driver.clear_to_end_of_screen(); // render prompt if (obj->prompt.length() > 0) { driver.write(obj->prompt.data(), obj->prompt.length()); LC_LOG_VERBOSE("cursor[%zu];prompt_rendered[%zu]",obj->cursor,obj->prompt_rendered); obj->cursor = 0; } obj->prompt_rendered = obj->prompt.length(); if (render_length > 0) { // print line terminal_driver::auto_cursor __(driver); size_t rendered = render(0, render_length); LC_LOG_VERBOSE("rendered[%zu]",rendered); // hack to convince cursor to move to the start of the next line // on a fully populated rendered line if (((obj->prompt_rendered + rendered) % cols) == 0) driver.newline(); // move to final cursor position (relative to current position) if (driver.set_new_xy((ssize_t)cursor - (ssize_t)rendered) < 0) return -1; } } obj->cursor = (render_length > 0) ? cursor : 0; if (LC_LOG_CHECK_LEVEL(debug::VERBOSE) && driver.control()) { size_t x,y; driver.cursor_position(x,y); LC_LOG_VERBOSE("obj->cursor[%zu];x[%zu],y[%zu]",obj->cursor,x,y); } } return 0; } int editor::edit(edit_object &obj_ref, size_t timeout_s) { //TODO: remove newlines from prompt (not for multi-line mode) //TODO: prevent re-entrant calls obj = &obj_ref; //XXX assume cursor position has not shifted since last edit print(); uint8_t c; int r; while ((r = driver.read(c,timeout_s)) >= 0) { if (driver.size_changed() && obj->mode == MODE_COMMAND) { // clear screen because position is not reliable after terminal size update driver.clear_screen(); obj->prompt_rendered = 0; print(); } if (r > 0) { k = decode_key(c); switch (k) { case PRINTABLE_CHAR: obj->insert(c); request_render(); break; case KEY_LEFT: if (obj->mode == MODE_COMMAND && driver.control()) { obj->left(); request_render(); } break; case KEY_RIGHT: if (obj->mode == MODE_COMMAND && driver.control()) { obj->right(); request_render(); } break; case KEY_WIPE: if (obj->mode == MODE_COMMAND && driver.control()) { obj->wipe(); request_render(); } break; case KEY_CLEAR: if (obj->mode == MODE_COMMAND && driver.control()) { obj->rewind(); driver.clear_screen(); print(); } break; case KEY_SWAP: if (obj->mode == MODE_COMMAND && driver.control()) { obj->swap(); request_render(); } break; case KEY_DEL: if (obj->mode == MODE_COMMAND && driver.control()) { obj->del(); request_render(); } break; case KEY_BKSP: if (obj->mode == MODE_MULTILINE) { //TODO: multiline backspace } else if (driver.control()) { obj->bksp(); request_render(); } break; case KEY_SOL: if (obj->mode == MODE_COMMAND && driver.control()) { obj->left(obj->length()); request_render(); } break; case KEY_EOL: if (obj->mode == MODE_COMMAND && driver.control()) { obj->right(obj->length()); request_render(); } break; case KEY_ENTER: switch (obj->mode) { case MODE_STRING: case MODE_PASSWORD: print(); return 0; case MODE_MULTILINE: obj->insert('\n'); request_render(); break; case MODE_COMMAND: if (obj->key_valid(KEY_ENTER)) { print(); return 0; } break; } break; case KEY_EOF: if (obj->mode == MODE_MULTILINE) return 0; break; case KEY_QUIT: print(); return 0; case KEY_TAB: case KEY_HELP: case KEY_UP: case KEY_DOWN: case KEY_PGUP: case KEY_PGDN: if (obj->mode == MODE_COMMAND && obj->key_valid(k)) { print(); return 0; } break; case PARTIAL_SEQ: case IGNORE_SEQ: case SEQ_TIMEOUT: case FORCED_RET: break;// ignore sequence } if (must_render()) print(); } } switch (r) { case -3: k = SEQ_TIMEOUT; break; case -4: k = FORCED_RET; break; default: k = IGNORE_SEQ; } return -1; } int editor::edit(std::string &str, size_t timeout_s) { edit_object O_tmp(MODE_STRING,str); int r = edit(O_tmp, timeout_s); if (r == 0 && O_tmp.length() > 0 && O_tmp.data() != NULL) str.assign(O_tmp.data(),O_tmp.length()); return r; } }
39.380769
144
0.449116
[ "render" ]
41e1021deb11abfc5848bdfcba6b572fc3abbd4d
6,887
cpp
C++
src/graph.cpp
H1d3r/binmap
78f5454690958871846a2417513ae75e9a4bacdd
[ "Apache-2.0" ]
235
2016-03-09T16:04:19.000Z
2021-05-13T09:05:39.000Z
src/graph.cpp
H1d3r/binmap
78f5454690958871846a2417513ae75e9a4bacdd
[ "Apache-2.0" ]
12
2016-03-10T12:35:42.000Z
2018-07-13T11:06:52.000Z
src/graph.cpp
H1d3r/binmap
78f5454690958871846a2417513ae75e9a4bacdd
[ "Apache-2.0" ]
64
2016-03-08T14:19:29.000Z
2022-02-09T12:08:10.000Z
// // Copyright 2014 QuarksLab // // 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 "binmap/graph.hpp" #include <boost/graph/breadth_first_search.hpp> #include <boost/graph/floyd_warshall_shortest.hpp> #include <ciso646> Graph::Graph() : distance_matrix_(0) {} Graph::~Graph() { if (distance_matrix_) { delete[] distance_matrix_; } } bool Graph::has_node(boost::filesystem::path const &path) const { bool res; #pragma omp critical(graph_) res = mapping_.find(path) != mapping_.end(); return res; } Hash const &Graph::hash(graph_type::vertex_descriptor vd) const { return boost::get(boost::vertex_hash_t(), graph_, vd); } boost::filesystem::path const & Graph::key(graph_type::vertex_descriptor vd) const { return boost::get(boost::vertex_name_t(), graph_, vd); } Hash const &Graph::hash(boost::filesystem::path const &key) const { if(mapping_.find(key) == mapping_.end()) throw std::out_of_range(key.string()); return boost::get(boost::vertex_hash_t(), graph_, mapping_.find(key)->second); } void Graph::successors(successors_type &succs, boost::filesystem::path const &key) const { for (edge_iterator viter = edge_begin(key); viter != edge_end(key); ++viter) succs.insert(this->key(boost::target(*viter, graph_))); } void Graph::predecessors(successors_type &preds, boost::filesystem::path const &key) const { boost::unordered_map<boost::filesystem::path, graph_type::vertex_descriptor>::const_iterator where = mapping_.find(key); if(where == mapping_.end()) throw std::out_of_range(key.string()); graph_type::in_edge_iterator in_begin, in_end; for (boost::tie(in_begin, in_end) = boost::in_edges(where->second, graph_); in_begin != in_end; ++in_begin) preds.insert(this->key(boost::source(*in_begin, graph_))); } Graph::const_hashes_t Graph::hashes() const { return boost::get(boost::vertex_hash_t(), graph_); } Graph::vertex_iterator Graph::begin() const { return boost::vertices(graph_).first; } Graph::vertex_iterator Graph::end() const { return boost::vertices(graph_).second; } Graph::graph_type const &Graph::graph() const { return graph_; } Graph::edge_iterator Graph::edge_begin(boost::filesystem::path const &input_file) const { assert(has_node(input_file)); return boost::out_edges(mapping_.find(input_file)->second, graph_).first; } Graph::edge_iterator Graph::edge_end(boost::filesystem::path const &input_file) const { assert(has_node(input_file)); return boost::out_edges(mapping_.find(input_file)->second, graph_).second; } Graph::edge_iterator Graph::edge_begin(graph_type::vertex_descriptor input) const { return boost::out_edges(input, graph_).first; } Graph::edge_iterator Graph::edge_end(graph_type::vertex_descriptor input) const { return boost::out_edges(input, graph_).second; } void Graph::add_edge(boost::filesystem::path const &from, boost::filesystem::path const &to) { boost::filesystem::path to_path = to; assert(has_node(from)); if(not has_node(to)){ to_path = add_node(to, (Hash)(to)); assert(has_node(to_path)); } #pragma omp critical(graph_) if(from != to_path){ boost::add_edge(mapping_[from], mapping_[to_path], graph_); } } void Graph::dot(boost::filesystem::path const &path) const { std::ofstream dotfile(path.string().c_str()); #pragma omp critical(graph_) boost::write_graphviz(dotfile, graph_, boost::make_label_writer(boost::get( boost::vertex_name_t(), graph_))); } bool Graph::has_path(boost::filesystem::path const &from, boost::filesystem::path const &to) const { assert(has_node(from)); assert(has_node(to)); compute_distance_matrix(); graph_type::vertex_descriptor vfrom = mapping_.find(from)->second, vto = mapping_.find(to)->second; return distance_matrix_[vfrom][vto] != std::numeric_limits<int>::max(); } void Graph::compute_distance_matrix() const { if (!distance_matrix_) { boost::static_property_map<int> weight_map(1); distance_matrix_ = new std::vector<int>[boost::num_vertices(graph_)]; std::fill(distance_matrix_, distance_matrix_ + boost::num_vertices(graph_), std::vector<int>(boost::num_vertices(graph_))); floyd_warshall_all_pairs_shortest_paths(graph_, distance_matrix_, boost::weight_map(weight_map)); } } boost::filesystem::path Graph::add_node(boost::filesystem::path const &input_file, Hash const &input_hash) { if(not has_node(input_file)){ if (visited_path_.find(input_file.parent_path()) == visited_path_.end()){ //path not parsed yet visited_path_.insert(input_file.parent_path()); } boost::filesystem::path no_path1 = "/."; boost::filesystem::path no_path2 = "."; std::string file = input_file.string(); if(input_file.parent_path() == no_path1 || input_file.parent_path() == no_path2){ boost::unordered_set<boost::filesystem::path>::iterator it_p_; for (it_p_=visited_path_.begin(); it_p_!=visited_path_.end();it_p_++){ if(*it_p_ != no_path1 && *it_p_ != no_path2 && has_node(*it_p_ / input_file.filename())){ return (*it_p_ / input_file.filename()); } } }else{ boost::filesystem::path known_dll1 = "/."/input_file.filename(); boost::filesystem::path known_dll2 = "."/input_file.filename(); if(has_node(known_dll1)){ mapping_[input_file] = mapping_[known_dll1]; mapping_.erase(known_dll1); boost::put(boost::vertex_name_t(), graph_, mapping_[input_file], input_file); boost::put(boost::vertex_hash_t(), graph_, mapping_[input_file], input_hash); return input_file; }else if(has_node(known_dll2)){ mapping_[input_file] = mapping_[known_dll2]; mapping_.erase(known_dll1); boost::put(boost::vertex_name_t(), graph_, mapping_[input_file], input_file); boost::put(boost::vertex_hash_t(), graph_, mapping_[input_file], input_hash); return input_file; } } graph_type::vertex_descriptor v = boost::add_vertex(graph_); mapping_[input_file] = v; boost::put(boost::vertex_name_t(), graph_, v, input_file); boost::put(boost::vertex_hash_t(), graph_, v, input_hash); } return input_file; } size_t Graph::size() const { return boost::num_vertices(graph_); }
33.595122
122
0.692754
[ "vector" ]
41e19ffdcda0d80dcb6db560496f3d0fdecee389
8,514
cpp
C++
lonestar/experimental/aigRewriting/main.cpp
vancemiller/Galois
e462b92888c073f765e5bc1b77100ccc668fc716
[ "BSD-3-Clause" ]
null
null
null
lonestar/experimental/aigRewriting/main.cpp
vancemiller/Galois
e462b92888c073f765e5bc1b77100ccc668fc716
[ "BSD-3-Clause" ]
null
null
null
lonestar/experimental/aigRewriting/main.cpp
vancemiller/Galois
e462b92888c073f765e5bc1b77100ccc668fc716
[ "BSD-3-Clause" ]
null
null
null
/* * This file belongs to the Galois project, a C++ library for exploiting parallelism. * The code is being released under the terms of the 3-Clause BSD License (a * copy is located in LICENSE.txt at the top-level directory). * * Copyright (C) 2018, The University of Texas at Austin. All rights reserved. * UNIVERSITY EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES CONCERNING THIS * SOFTWARE AND DOCUMENTATION, INCLUDING ANY WARRANTIES OF MERCHANTABILITY, * FITNESS FOR ANY PARTICULAR PURPOSE, NON-INFRINGEMENT AND WARRANTIES OF * PERFORMANCE, AND ANY WARRANTY THAT MIGHT OTHERWISE ARISE FROM COURSE OF * DEALING OR USAGE OF TRADE. NO WARRANTY IS EITHER EXPRESS OR IMPLIED WITH * RESPECT TO THE USE OF THE SOFTWARE OR DOCUMENTATION. Under no circumstances * shall University be liable for incidental, special, indirect, direct or * consequential damages or loss of profits, interruption of business, or * related expenses which may arise from use of Software or Documentation, * including but not limited to those resulting from defects in Software and/or * Documentation, or loss or inaccuracy of data of any kind. */ #include "parsers/AigParser.h" #include "writers/AigWriter.h" #include "subjectgraph/aig/Aig.h" #include "algorithms/CutManager.h" #include "algorithms/NPNManager.h" #include "algorithms/RewriteManager.h" #include "algorithms/PreCompGraphManager.h" #include "algorithms/ReconvDrivenCut.h" #include "galois/Galois.h" #include <chrono> #include <iostream> #include <sstream> using namespace std::chrono; void aigRewriting(aig::Aig& aig, std::string& fileName, int nThreads, int verbose); void kcut(aig::Aig& aig, std::string& fileName, int nThreads, int verbose); void rdCut(aig::Aig& aig, std::string& fileName, int nThreads, int verbose); std::string getFileName(std::string path); int main(int argc, char* argv[]) { galois::SharedMemSys G; // shared-memory system object initializes global variables for galois if (argc < 3) { std::cout << "Mandatory arguments: <nThreads> <AigInputFile>" << std::endl; std::cout << "Optional arguments: -v (verrbose)" << std::endl; exit(1); } int nThreads = atoi(argv[1]); std::string path(argv[2]); std::string fileName = getFileName(path); aig::Aig aig; AigParser aigParser(path, aig); aigParser.parseAig(); // aigParser.parseAag(); int verbose = 0; if (argc > 3) { std::string verbosity(argv[3]); if (verbosity.compare("-v") == 0) { verbose = 1; } } if (verbose == 1) { std::cout << "############## AIG REWRITING ##############" << std::endl; std::cout << "Design Name: " << fileName << std::endl; std::cout << "|Nodes|: " << aig.getGraph().size() << std::endl; std::cout << "|I|: " << aigParser.getI() << std::endl; std::cout << "|L|: " << aigParser.getL() << std::endl; std::cout << "|O|: " << aigParser.getO() << std::endl; std::cout << "|A|: " << aigParser.getA() << std::endl; std::cout << "|E|: " << aigParser.getE() << " (outgoing edges)" << std::endl; } // std::vector< int > levelHistogram = aigParser.getLevelHistogram(); // int i = 0; // for( int value : levelHistogram ) { // std::cout << i++ << ": " << value << std::endl; //} aigRewriting(aig, fileName, nThreads, verbose); // kcut( aig, fileName, nThreads, verbose ); // rdCut( aig, fileName, nThreads, verbose ); return 0; } void aigRewriting(aig::Aig& aig, std::string& fileName, int nThreads, int verbose) { int numThreads = galois::setActiveThreads(nThreads); int K = 4, C = 500; int triesNGraphs = 500; bool compTruth = true; bool useZeros = false; bool updateLevel = false; if (verbose == 1) { std::cout << "############# Configurations ############## " << std::endl; std::cout << "K: " << K << std::endl; std::cout << "C: " << C << std::endl; std::cout << "TriesNGraphs: " << triesNGraphs << std::endl; std::cout << "CompTruth: " << (compTruth ? "yes" : "no") << std::endl; std::cout << "UseZeroCost: " << (useZeros ? "yes" : "no") << std::endl; std::cout << "UpdateLevel: " << (updateLevel ? "yes" : "no") << std::endl; std::cout << "nThreads: " << numThreads << std::endl; } high_resolution_clock::time_point t1 = high_resolution_clock::now(); // CutMan algorithm::CutManager cutMan(aig, K, C, numThreads, compTruth); // NPNMan algorithm::NPNManager npnMan; // StrMan algorithm::PreCompGraphManager pcgMan(npnMan); pcgMan.loadPreCompGraphFromArray(); pcgMan.processDecompositionGraphs(); // RWMan algorithm::RewriteManager rwtMan(aig, cutMan, npnMan, pcgMan, triesNGraphs, useZeros, updateLevel); algorithm::runRewriteOperator(rwtMan); high_resolution_clock::time_point t2 = high_resolution_clock::now(); long double rewriteTime = duration_cast<microseconds>(t2 - t1).count(); if (verbose == 0) { std::cout << fileName << ";" << C << ";" << triesNGraphs << ";" << useZeros << ";" << aig.getNumAnds() << ";" << aig.getDepth() << ";" << numThreads << ";" << rewriteTime << std::endl; } if (verbose == 1) { std::cout << "################ Results ################## " << std::endl; std::cout << "Size: " << aig.getNumAnds() << std::endl; std::cout << "Depth: " << aig.getDepth() << std::endl; std::cout << "Runtime (us): " << rewriteTime << std::endl; } // WRITE AIG // std::cout << "Writing final AIG file..." << std::endl; AigWriter aigWriter(fileName + "_rewritten.aig"); aigWriter.writeAig(aig); // WRITE DOT // // aig.writeDot( fileName + "_rewritten.dot", aig.toDot() ); } void kcut(aig::Aig& aig, std::string& fileName, int nThreads, int verbose) { int numThreads = galois::setActiveThreads(nThreads); int K = 6, C = 20; bool compTruth = false; if (verbose == 1) { std::cout << "############# Configurations ############## " << std::endl; std::cout << "K: " << K << std::endl; std::cout << "C: " << C << std::endl; std::cout << "CompTruth: " << (compTruth ? "yes" : "no") << std::endl; std::cout << "nThreads: " << numThreads << std::endl; } long double kcutTime = 0; high_resolution_clock::time_point t1 = high_resolution_clock::now(); algorithm::CutManager cutMan(aig, K, C, numThreads, compTruth); algorithm::runKCutOperator(cutMan); high_resolution_clock::time_point t2 = high_resolution_clock::now(); kcutTime = duration_cast<microseconds>(t2 - t1).count(); if (verbose == 0) { std::cout << fileName << ";" << K << ";" << C << ";" << compTruth << ";" << aig.getNumAnds() << ";" << aig.getDepth() << ";" << numThreads << ";" << kcutTime << std::endl; } if (verbose >= 1) { std::cout << "################ Results ################## " << std::endl; // cutMan.printAllCuts(); // cutMan.printRuntimes(); cutMan.printCutStatistics(); std::cout << "Size: " << aig.getNumAnds() << std::endl; std::cout << "Depth: " << aig.getDepth() << std::endl; std::cout << "Runtime (us): " << kcutTime << std::endl; } } void rdCut(aig::Aig& aig, std::string& fileName, int nThreads, int verbose) { int numThreads = galois::setActiveThreads(nThreads); int K = 4; if (verbose == 1) { std::cout << "############# Configurations ############## " << std::endl; std::cout << "K: " << K << std::endl; std::cout << "nThreads: " << numThreads << std::endl; } high_resolution_clock::time_point t1 = high_resolution_clock::now(); algorithm::ReconvDrivenCut rdcMan(aig); rdcMan.run(K); high_resolution_clock::time_point t2 = high_resolution_clock::now(); long double rdCutTime = duration_cast<microseconds>(t2 - t1).count(); if (verbose == 0) { std::cout << fileName << ";" << K << ";" << aig.getNumAnds() << ";" << aig.getDepth() << ";" << numThreads << ";" << rdCutTime << std::endl; } if (verbose == 1) { std::cout << "################ Results ################## " << std::endl; std::cout << "Size: " << aig.getNumAnds() << std::endl; std::cout << "Depth: " << aig.getDepth() << std::endl; std::cout << "Runtime (us): " << rdCutTime << std::endl; } } std::string getFileName(std::string path) { std::size_t slash = path.find_last_of("/") + 1; std::size_t dot = path.find_last_of("."); std::string fileName = path.substr(slash, (dot - slash)); return fileName; }
34.893443
85
0.600423
[ "object", "vector" ]
41eb1f00ed14eec6e44946842e8450536f3895f8
2,254
hpp
C++
src/share/monitor/grabber_alerts_monitor.hpp
iove8319/Karabiner-Elements
18698c792991da080f8ac91f8eb7936dd4aea6e5
[ "Unlicense" ]
null
null
null
src/share/monitor/grabber_alerts_monitor.hpp
iove8319/Karabiner-Elements
18698c792991da080f8ac91f8eb7936dd4aea6e5
[ "Unlicense" ]
null
null
null
src/share/monitor/grabber_alerts_monitor.hpp
iove8319/Karabiner-Elements
18698c792991da080f8ac91f8eb7936dd4aea6e5
[ "Unlicense" ]
null
null
null
#pragma once // `krbn::grabber_alerts_monitor` can be used safely in a multi-threaded environment. #include "constants.hpp" #include "logger.hpp" #include <fstream> #include <nod/nod.hpp> #include <pqrs/filesystem.hpp> #include <pqrs/json.hpp> #include <pqrs/osx/file_monitor.hpp> namespace krbn { class grabber_alerts_monitor final : public pqrs::dispatcher::extra::dispatcher_client { public: // Signals (invoked from the shared dispatcher thread) nod::signal<void(std::shared_ptr<nlohmann::json> alerts)> alerts_changed; // Methods grabber_alerts_monitor(const grabber_alerts_monitor&) = delete; grabber_alerts_monitor(const std::string& grabber_alerts_json_file_path) { std::vector<std::string> targets = { grabber_alerts_json_file_path, }; file_monitor_ = std::make_unique<pqrs::osx::file_monitor>(weak_dispatcher_, targets); file_monitor_->file_changed.connect([this](auto&& changed_file_path, auto&& changed_file_body) { if (changed_file_body) { try { auto json = nlohmann::json::parse(*changed_file_body); // json example // // { // "alerts": [ // "system_policy_prevents_loading_kext" // ] // } if (auto v = pqrs::json::find_array(json, "alerts")) { auto s = v->value().dump(); if (last_json_string_ != s) { last_json_string_ = s; auto alerts = std::make_shared<nlohmann::json>(v->value()); enqueue_to_dispatcher([this, alerts] { alerts_changed(alerts); }); } } } catch (std::exception& e) { logger::get_logger()->error("parse error in {0}: {1}", changed_file_path, e.what()); } } }); } virtual ~grabber_alerts_monitor(void) { detach_from_dispatcher([this] { file_monitor_ = nullptr; }); } void async_start(void) { file_monitor_->async_start(); } private: std::unique_ptr<pqrs::osx::file_monitor> file_monitor_; std::optional<std::string> last_json_string_; }; } // namespace krbn
28.531646
94
0.590949
[ "vector" ]