hexsha
stringlengths
40
40
size
int64
7
1.05M
ext
stringclasses
13 values
lang
stringclasses
1 value
max_stars_repo_path
stringlengths
4
269
max_stars_repo_name
stringlengths
5
108
max_stars_repo_head_hexsha
stringlengths
40
40
max_stars_repo_licenses
listlengths
1
9
max_stars_count
int64
1
191k
max_stars_repo_stars_event_min_datetime
stringlengths
24
24
max_stars_repo_stars_event_max_datetime
stringlengths
24
24
max_issues_repo_path
stringlengths
4
269
max_issues_repo_name
stringlengths
5
116
max_issues_repo_head_hexsha
stringlengths
40
40
max_issues_repo_licenses
listlengths
1
9
max_issues_count
int64
1
67k
max_issues_repo_issues_event_min_datetime
stringlengths
24
24
max_issues_repo_issues_event_max_datetime
stringlengths
24
24
max_forks_repo_path
stringlengths
4
269
max_forks_repo_name
stringlengths
5
116
max_forks_repo_head_hexsha
stringlengths
40
40
max_forks_repo_licenses
listlengths
1
9
max_forks_count
int64
1
105k
max_forks_repo_forks_event_min_datetime
stringlengths
24
24
max_forks_repo_forks_event_max_datetime
stringlengths
24
24
content
stringlengths
7
1.05M
avg_line_length
float64
1.21
330k
max_line_length
int64
6
990k
alphanum_fraction
float64
0.01
0.99
author_id
stringlengths
2
40
4d3b7b3ede25a864fd89caaf3ab240c382f95ed4
4,087
cpp
C++
net/mmc/wins/ipctrl.cpp
npocmaka/Windows-Server-2003
5c6fe3db626b63a384230a1aa6b92ac416b0765f
[ "Unlicense" ]
17
2020-11-13T13:42:52.000Z
2021-09-16T09:13:13.000Z
net/mmc/wins/ipctrl.cpp
sancho1952007/Windows-Server-2003
5c6fe3db626b63a384230a1aa6b92ac416b0765f
[ "Unlicense" ]
2
2020-10-19T08:02:06.000Z
2020-10-19T08:23:18.000Z
net/mmc/wins/ipctrl.cpp
sancho1952007/Windows-Server-2003
5c6fe3db626b63a384230a1aa6b92ac416b0765f
[ "Unlicense" ]
14
2020-11-14T09:43:20.000Z
2021-08-28T08:59:57.000Z
//============================================================================ // Copyright (C) Microsoft Corporation, 1996 - 1999 // // File: ipctrl.cpp // // History: // Tony Romano Created. // 06/17/96 Abolade Gbadegesin Revised. // // Implements the C++ class encapsulating the IP-address custom control. //============================================================================ #include "stdafx.h" extern "C" { #include "ipaddr.h" }; #include "ipctrl.h" IPControl::IPControl( ) { m_hIPaddr = 0; } IPControl::~IPControl( ) { } BOOL IPControl::Create( HWND hParent, UINT nID ) { ASSERT(IsWindow(hParent)); if (hParent) m_hIPaddr = GetDlgItem(hParent, nID); return m_hIPaddr != NULL; } LRESULT IPControl::SendMessage( UINT uMsg, WPARAM wParam, LPARAM lParam ) { ASSERT(IsWindow(m_hIPaddr)); return ::SendMessage(m_hIPaddr, uMsg, wParam, lParam); } BOOL IPControl::IsBlank( ) { return (BOOL) SendMessage(IP_ISBLANK, 0, 0); } VOID IPControl::SetAddress( DWORD ardwAddress[4] ) { SendMessage( IP_SETADDRESS, 0, MAKEIPADDRESS( ardwAddress[0], ardwAddress[1], ardwAddress[2], ardwAddress[3] ) ); } VOID IPControl::SetAddress( DWORD a1, DWORD a2, DWORD a3, DWORD a4 ) { SendMessage(IP_SETADDRESS, 0, MAKEIPADDRESS(a1,a2,a3,a4)); } VOID IPControl::SetAddress( LPCTSTR lpszString ) { if (!lpszString) { ClearAddress(); } SendMessage(WM_SETTEXT, 0, (LPARAM)lpszString); } INT IPControl::GetAddress( DWORD *a1, DWORD *a2, DWORD *a3, DWORD *a4 ) { LRESULT nSet; DWORD dwAddress; ASSERT(a1 && a2 && a3 && a4); if ((nSet = SendMessage(IP_GETADDRESS,0,(LPARAM)&dwAddress)) == 0) { *a1 = 0; *a2 = 0; *a3 = 0; *a4 = 0; } else { *a1 = FIRST_IPADDRESS( dwAddress ); *a2 = SECOND_IPADDRESS( dwAddress ); *a3 = THIRD_IPADDRESS( dwAddress ); *a4 = FOURTH_IPADDRESS( dwAddress ); } return (INT) nSet; } INT IPControl::GetAddress( DWORD ardwAddress[4] ) { LRESULT nSet; DWORD dwAddress; if ((nSet = SendMessage(IP_GETADDRESS, 0, (LPARAM)&dwAddress )) == 0) { ardwAddress[0] = 0; ardwAddress[1] = 0; ardwAddress[2] = 0; ardwAddress[3] = 0; } else { ardwAddress[0] = FIRST_IPADDRESS( dwAddress ); ardwAddress[1] = SECOND_IPADDRESS( dwAddress ); ardwAddress[2] = THIRD_IPADDRESS( dwAddress ); ardwAddress[3] = FOURTH_IPADDRESS( dwAddress ); } return (INT) nSet; } INT IPControl::GetAddress( CString& address ) { LRESULT nSet, c; DWORD dwAddress; nSet = SendMessage(IP_GETADDRESS, 0, (LPARAM)&dwAddress); address.ReleaseBuffer((int) (c = SendMessage(WM_GETTEXT, 256, (LPARAM)address.GetBuffer(256)))); return (INT) nSet; } VOID IPControl::SetFocusField( DWORD dwField ) { SendMessage(IP_SETFOCUS, dwField, 0); } VOID IPControl::ClearAddress( ) { SendMessage(IP_CLEARADDRESS, 0, 0); } VOID IPControl::SetFieldRange( DWORD dwField, DWORD dwMin, DWORD dwMax ) { SendMessage(IP_SETRANGE, dwField, MAKERANGE(dwMin,dwMax)); } #if 0 WCHAR * inet_ntoaw( struct in_addr dwAddress ) { static WCHAR szAddress[16]; mbstowcs(szAddress, inet_ntoa(*(struct in_addr *)&dwAddress), 16); return szAddress; } DWORD inet_addrw( LPCWSTR szAddressW ) { CHAR szAddressA[16]; wcstombs(szAddressA, szAddressW, 16); return inet_addr(szAddressA); } #endif
17.100418
101
0.519941
npocmaka
4d3fdf9a85f8d94b2ebe372c8eeb2e5d06d11fb3
1,834
cpp
C++
examples/ftp_server/ftp_server.cpp
kayfour/MAVSDK
48faf36a15ad9371b9e0a3c16ecac248e27e03ad
[ "BSD-3-Clause" ]
null
null
null
examples/ftp_server/ftp_server.cpp
kayfour/MAVSDK
48faf36a15ad9371b9e0a3c16ecac248e27e03ad
[ "BSD-3-Clause" ]
null
null
null
examples/ftp_server/ftp_server.cpp
kayfour/MAVSDK
48faf36a15ad9371b9e0a3c16ecac248e27e03ad
[ "BSD-3-Clause" ]
1
2021-01-08T00:43:04.000Z
2021-01-08T00:43:04.000Z
/** * @file ftp_server.cpp * * @brief Demonstrates how to use a FTP server with MAVSDK. * * @author Matej Frančeškin <matej@auterion.com>, * @date 2019-09-06 */ #include <mavsdk/mavsdk.h> #include <mavsdk/plugins/ftp/ftp.h> #include <chrono> #include <iostream> #include <iomanip> #include <string> #include <thread> #define ERROR_CONSOLE_TEXT "\033[31m" // Turn text on console red #define NORMAL_CONSOLE_TEXT "\033[0m" // Restore normal console colour using namespace mavsdk; void usage(const std::string& bin_name) { std::cout << NORMAL_CONSOLE_TEXT << "Usage : " << bin_name << " <remote_ip> <remote_port> <root_dir>" << std::endl << "Start mavlink FTP server on <root_dir> sending heartbeats to <remote_ip>:<remote_port>" << std::endl; } int main(int argc, char** argv) { if (argc != 4) { usage(argv[0]); return 1; } Mavsdk mavsdk; Mavsdk::Configuration configuration(Mavsdk::Configuration::UsageType::CompanionComputer); mavsdk.set_configuration(configuration); ConnectionResult connection_result = mavsdk.setup_udp_remote(argv[1], std::stoi(argv[2])); if (connection_result != ConnectionResult::Success) { std::cout << ERROR_CONSOLE_TEXT << "Error setting up Mavlink FTP server." << std::endl; return 1; } auto system_cc = mavsdk.systems().at(0); auto ftp_server = std::make_shared<Ftp>(system_cc); ftp_server->set_root_directory(argv[3]); std::cout << NORMAL_CONSOLE_TEXT << "Mavlink FTP server running." << std::endl << "Remote: " << argv[1] << ":" << argv[2] << std::endl << "Component ID: " << static_cast<int>(ftp_server->get_our_compid()) << std::endl; for (;;) { std::this_thread::sleep_for(std::chrono::seconds(1)); } return 0; }
28.65625
99
0.640676
kayfour
4d41c982c02c6b1679db108db4806e2ebbb3178e
6,347
inl
C++
gemcutter/Entity/Entity.inl
EmilianC/Jewel3D
ce11aa686ab35d4989f018c948b26abed6637d77
[ "MIT" ]
30
2017-02-02T01:57:13.000Z
2020-07-04T04:38:20.000Z
gemcutter/Entity/Entity.inl
EmilianC/Jewel3D
ce11aa686ab35d4989f018c948b26abed6637d77
[ "MIT" ]
null
null
null
gemcutter/Entity/Entity.inl
EmilianC/Jewel3D
ce11aa686ab35d4989f018c948b26abed6637d77
[ "MIT" ]
10
2017-07-10T01:31:54.000Z
2020-01-13T20:38:57.000Z
// Copyright (c) 2017 Emilian Cioca namespace gem { namespace detail { // Allows for compile-time decision of whether or not a dynamic cast is required. // A dynamic cast is required when a class inherits from Component indirectly, and // as such, doesn't compile its own unique component type ID. template<class T> T* safe_cast(ComponentBase* comp) { if constexpr (std::is_same_v<T, typename T::StaticComponentType>) { return static_cast<T*>(comp); } else { return dynamic_cast<T*>(comp); } } } template<class derived> Component<derived>::Component(Entity& owner) : ComponentBase(owner, componentId) {} template<class derived> unsigned Component<derived>::GetComponentId() { return componentId; } template<class T, typename... Args> T& Entity::Add(Args&&... constructorParams) { static_assert(std::is_base_of_v<ComponentBase, T>, "Template argument must inherit from Component."); static_assert(!std::is_base_of_v<TagBase, T>, "Template argument cannot be a Tag."); ASSERT(!Has<T>(), "Component already exists on this entity."); auto* newComponent = new T(*this, std::forward<Args>(constructorParams)...); components.push_back(newComponent); if (IsEnabled()) { Index(*newComponent); } return *newComponent; } template<class T1, class T2, typename... Tx> std::tuple<T1&, T2&, Tx&...> Entity::Add() { return std::tie(Add<T1>(), Add<T2>(), Add<Tx>()...); } template<class T> T& Entity::Require() { auto* comp = Try<T>(); return comp ? *comp : Add<T>(); } template<class T1, class T2, typename... Tx> std::tuple<T1&, T2&, Tx&...> Entity::Require() { return std::tie(Require<T1>(), Require<T2>(), Require<Tx>()...); } template<class T> const T& Entity::Get() const { return GetComponent<T>(); } template<class T> T& Entity::Get() { return GetComponent<T>(); } template<class T> const T* Entity::Try() const { return TryComponent<T>(); } template<class T> T* Entity::Try() { return TryComponent<T>(); } template<class T> void Entity::Remove() { using namespace detail; static_assert(std::is_base_of_v<ComponentBase, T>, "Template argument must inherit from Component."); static_assert(!std::is_base_of_v<TagBase, T>, "Template argument cannot be a Tag."); for (unsigned i = 0; i < components.size(); ++i) { if (components[i]->componentId == T::GetComponentId()) { if (safe_cast<T>(components[i])) { auto* comp = components[i]; components.erase(components.begin() + i); if (comp->IsEnabled()) { Unindex(*comp); } delete comp; } return; } } } template<class T> bool Entity::Has() const { static_assert(std::is_base_of_v<ComponentBase, T>, "Template argument must inherit from Component."); static_assert(!std::is_base_of_v<TagBase, T>, "Template argument cannot be a Tag."); return Try<T>() != nullptr; } template<class T, typename... Args> void Entity::Tag() { if constexpr (sizeof...(Args)) { Tag<T>(); Tag<Args...>(); } else { static_assert(std::is_base_of_v<TagBase, T>, "Template argument must inherit from Tag."); if (!HasTag<T>()) { Tag(T::GetComponentId()); } } } template<class T> void Entity::RemoveTag() { static_assert(std::is_base_of_v<TagBase, T>, "Template argument must inherit from Tag."); RemoveTag(T::GetComponentId()); } template<class T> bool Entity::HasTag() const { static_assert(std::is_base_of_v<TagBase, T>, "Template argument must inherit from Tag."); for (auto tag : tags) { if (tag == T::GetComponentId()) { return true; } } return false; } template<class T> void Entity::GlobalRemoveTag() { static_assert(std::is_base_of_v<TagBase, T>, "Template argument must inherit from Tag."); std::vector<Entity*>& taggedEntities = detail::entityIndex[T::GetComponentId()]; for (Entity* ent : taggedEntities) { auto& tags = ent->tags; auto itr = std::find(tags.begin(), tags.end(), T::GetComponentId()); *itr = tags.back(); tags.pop_back(); } taggedEntities.clear(); } template<class T> void Entity::Enable() { static_assert(std::is_base_of_v<ComponentBase, T>, "Template argument must inherit from Component."); static_assert(!std::is_base_of_v<TagBase, T>, "Tags cannot be enabled or disabled. Add or remove them instead."); auto& comp = Get<T>(); // The component state changes either way, but it only gets indexed if the Entity is also enabled. bool wasEnabled = comp.isEnabled; comp.isEnabled = true; if (!this->IsEnabled()) { return; } if (!wasEnabled) { Index(comp); static_cast<ComponentBase&>(comp).OnEnable(); } } template<class T> void Entity::Disable() { static_assert(std::is_base_of_v<ComponentBase, T>, "Template argument must inherit from Component."); static_assert(!std::is_base_of_v<TagBase, T>, "Tags cannot be enabled or disabled. Add or remove them instead."); auto& comp = Get<T>(); // The component state changes either way, but it only gets removed if the Entity is enabled. bool wasEnabled = comp.isEnabled; comp.isEnabled = false; if (!this->IsEnabled()) { return; } if (wasEnabled) { Unindex(comp); static_cast<ComponentBase&>(comp).OnDisable(); } } template<class T> T& Entity::GetComponent() const { using namespace detail; static_assert(std::is_base_of_v<ComponentBase, T>, "Template argument must inherit from Component."); static_assert(!std::is_base_of_v<TagBase, T>, "Template argument cannot be a Tag."); auto itr = components.begin(); while (true) { ASSERT(itr != components.end(), "Entity did not have the expected component."); if ((*itr)->componentId == T::GetComponentId()) { ASSERT(safe_cast<T>(*itr), "Entity did not have the expected component."); return *static_cast<T*>(*itr); } ++itr; } } template<class T> T* Entity::TryComponent() const { using namespace detail; static_assert(std::is_base_of_v<ComponentBase, T>, "Template argument must inherit from Component."); static_assert(!std::is_base_of_v<TagBase, T>, "Template argument cannot be a Tag."); for (auto* comp : components) { if (comp->componentId == T::GetComponentId()) { return safe_cast<T>(comp); } } return nullptr; } }
24.13308
115
0.659367
EmilianC
4d4371cc7edda0cc1c18a53bb8f33acfeedaa2a2
1,045
cpp
C++
13.cpp
jonathanxqs/lintcode
148435aff0a83ac5d77a7ccbd5d0caaea3140a62
[ "MIT" ]
1
2016-06-21T16:29:37.000Z
2016-06-21T16:29:37.000Z
13.cpp
jonathanxqs/lintcode
148435aff0a83ac5d77a7ccbd5d0caaea3140a62
[ "MIT" ]
null
null
null
13.cpp
jonathanxqs/lintcode
148435aff0a83ac5d77a7ccbd5d0caaea3140a62
[ "MIT" ]
null
null
null
class Solution { public: /** * Returns a index to the first occurrence of target in source, * or -1 if target is not part of source. * @param source string to be scanned. * @param target string containing the sequence of characters to match. */ int strStr(const char *source, const char *target) { // write your code here int result = -1; int i = 0; int j = -1; if (source == nullptr || target == nullptr) { return result; } if ( *target == '\0') return i; while (*source !='\0') { ++j; if(*source == *target) { i = j; const char *p = source; const char *q = target; while (*p == *q) { if (*(q+1) =='\0') { return i; } p++; q++; } } ++source; ++i; } return result; } };
26.794872
75
0.396172
jonathanxqs
4d451c95ea5e2759820f3c0f648e5b4b651d243f
4,516
hpp
C++
ConsensusCore/include/ConsensusCore/Mutation.hpp
pb-cdunn/pbccs
fb327a7145791d3c023bc63717f5de2925225ccc
[ "BSD-3-Clause-Clear" ]
null
null
null
ConsensusCore/include/ConsensusCore/Mutation.hpp
pb-cdunn/pbccs
fb327a7145791d3c023bc63717f5de2925225ccc
[ "BSD-3-Clause-Clear" ]
null
null
null
ConsensusCore/include/ConsensusCore/Mutation.hpp
pb-cdunn/pbccs
fb327a7145791d3c023bc63717f5de2925225ccc
[ "BSD-3-Clause-Clear" ]
null
null
null
// Copyright (c) 2011-2013, Pacific Biosciences of California, Inc. // // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted (subject to the limitations in the // disclaimer below) 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 Pacific Biosciences nor the names of its // contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE // GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY PACIFIC // BIOSCIENCES 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 PACIFIC BIOSCIENCES 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. // Author: Patrick Marks, David Alexander #pragma once #include <string> #include <vector> #include <utility> #include <ostream> #include <ConsensusCore/Types.hpp> #include <ConsensusCore/Utils.hpp> namespace ConsensusCore { enum MutationType { INSERTION = 0, DELETION = 1, SUBSTITUTION = 2 }; /// \brief Single mutation to a template sequence. class Mutation { private: MutationType type_; int start_; int end_; std::string newBases_; bool CheckInvariants() const; public: Mutation(MutationType type, int start, int end, const std::string& newBases); Mutation(MutationType type, int position, const std::string& newBases); Mutation(MutationType type, int position, char base); Mutation(const Mutation& other); // Note: this defines a default mutation. This is really only needed to fix // SWIG compilation. Mutation(); MutationType Type() const; bool IsSubstitution() const; bool IsInsertion() const; bool IsDeletion() const; /// \brief Template positions of the mutation. /// Convention: the bases of the template changed by the mutation are /// [ Start, End ). /// For a substitution, tpl[Start..End) are mutated; /// for a deletion, tpl[Start..End) are removed; /// for an insertion, Start=End=template position after the /// new bases are to be inserted. int Start() const; int End() const; std::string NewBases() const; int LengthDiff() const; std::string ToString() const; public: bool operator==(const Mutation& other) const; bool operator<(const Mutation& other) const; public: ScoredMutation WithScore(float score) const; }; std::ostream& operator<<(std::ostream& out, const Mutation& m); std::string ApplyMutation(const Mutation& mut, const std::string& tpl); std::string ApplyMutations(const std::vector<Mutation>& muts, const std::string& tpl); std::string MutationsToTranscript(const std::vector<Mutation>& muts, const std::string& tpl); std::vector<int> TargetToQueryPositions(const std::vector<Mutation>& mutations, const std::string& tpl); class ScoredMutation : public Mutation { private: float score_; public: ScoredMutation(); ScoredMutation(const Mutation& m, float score); float Score() const; std::string ToString() const; }; std::ostream& operator<<(std::ostream& out, const ScoredMutation& m); } #include "Mutation-inl.hpp"
34.212121
90
0.674712
pb-cdunn
4d45f4dcb3f8f12614bda83bfaa9de1c212b7f9d
1,112
cpp
C++
tests/juliet/testcases/CWE775_Missing_Release_of_File_Descriptor_or_Handle/CWE775_Missing_Release_of_File_Descriptor_or_Handle__fopen_no_close_82_goodB2G.cpp
RanerL/analyzer
a401da4680f163201326881802ee535d6cf97f5a
[ "MIT" ]
28
2017-01-20T15:25:54.000Z
2020-03-17T00:28:31.000Z
testcases/CWE775_Missing_Release_of_File_Descriptor_or_Handle/CWE775_Missing_Release_of_File_Descriptor_or_Handle__fopen_no_close_82_goodB2G.cpp
mellowCS/cwe_checker_juliet_suite
ae604f6fd94964251fbe88ef04d5287f6c1ffbe2
[ "MIT" ]
1
2017-01-20T15:26:27.000Z
2018-08-20T00:55:37.000Z
testcases/CWE775_Missing_Release_of_File_Descriptor_or_Handle/CWE775_Missing_Release_of_File_Descriptor_or_Handle__fopen_no_close_82_goodB2G.cpp
mellowCS/cwe_checker_juliet_suite
ae604f6fd94964251fbe88ef04d5287f6c1ffbe2
[ "MIT" ]
2
2019-07-15T19:07:04.000Z
2019-09-07T14:21:04.000Z
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE775_Missing_Release_of_File_Descriptor_or_Handle__fopen_no_close_82_goodB2G.cpp Label Definition File: CWE775_Missing_Release_of_File_Descriptor_or_Handle__fopen_no_close.label.xml Template File: source-sinks-82_goodB2G.tmpl.cpp */ /* * @description * CWE: 775 Missing Release of File Descriptor or Handle After Effective Lifetime * BadSource: Open a file using fopen() * Sinks: * GoodSink: Close the file using fclose() * BadSink : Do not close file * Flow Variant: 82 Data flow: data passed in a parameter to an virtual method called via a pointer * * */ #ifndef OMITGOOD #include "std_testcase.h" #include "CWE775_Missing_Release_of_File_Descriptor_or_Handle__fopen_no_close_82.h" namespace CWE775_Missing_Release_of_File_Descriptor_or_Handle__fopen_no_close_82 { void CWE775_Missing_Release_of_File_Descriptor_or_Handle__fopen_no_close_82_goodB2G::action(FILE * data) { /* FIX: If the file is still opened, close it */ if (data != NULL) { fclose(data); } } } #endif /* OMITGOOD */
31.771429
105
0.758094
RanerL
4d476c70e24e2cc79d4838d0bcb7f49818ef157f
1,795
cc
C++
Linked_List/7B_Merge_K_Sorted_Lists/method2/solution.cc
sheriby/DandAInLeetCode
dd7f5029aa0c297ea82bb20f882b524789f35c96
[ "MIT" ]
1
2020-02-07T12:25:56.000Z
2020-02-07T12:25:56.000Z
Linked_List/7B_Merge_K_Sorted_Lists/method2/solution.cc
sheriby/DandAInLeetCode
dd7f5029aa0c297ea82bb20f882b524789f35c96
[ "MIT" ]
null
null
null
Linked_List/7B_Merge_K_Sorted_Lists/method2/solution.cc
sheriby/DandAInLeetCode
dd7f5029aa0c297ea82bb20f882b524789f35c96
[ "MIT" ]
null
null
null
#include <algorithm> #include <iostream> #include <vector> using std::vector; /** * The definition from single-linked list */ struct ListNode { int val; ListNode *next; ListNode(int val) : val(val), next(nullptr) {} // here use nullptr instead of NULL }; class Solution { public: ListNode *mergeKLists(vector<ListNode *> &lists) { // divide and conquer algorithm // merge sort is a good example of divide and conquer algorithm if (lists.size() == 0) { return nullptr; } return mergeKListsHelper(lists, 0, lists.size() - 1); } ListNode *mergeKListsHelper(vector<ListNode *> &lists, int left, int right) { if (left < right) { int mid = left + (right - left) / 2; ListNode *leftList = mergeKListsHelper(lists, left, mid); ListNode *rightList = mergeKListsHelper(lists, mid + 1, right); return mergeTwoLists(leftList, rightList); } else { // std::cout << left << std::endl; return lists.at(left); } } private: // we have already writeen merge two sorted lists before. ListNode *mergeTwoLists(ListNode *l1, ListNode *l2) { // the second methods is two pointer. ListNode *p = l1, *q = l2; ListNode *head = new ListNode(0); ListNode *pos = head; while (p && q) { if (p->val < q->val) { pos->next = p; p = p->next; } else { pos->next = q; q = q->next; } pos = pos->next; } if (p) { pos->next = p; } else { pos->next = q; } return head->next; } };
26.791045
75
0.504178
sheriby
4d4998fa064380187f433abefda6740bd4e4f9d8
2,476
cpp
C++
development/Tests/YagetCore-Test/TestFiles/Json_Test.cpp
eglowacki/zloty
9c864ae0beb1ac64137a096795261768b7fc6710
[ "MIT" ]
null
null
null
development/Tests/YagetCore-Test/TestFiles/Json_Test.cpp
eglowacki/zloty
9c864ae0beb1ac64137a096795261768b7fc6710
[ "MIT" ]
44
2018-06-28T03:01:44.000Z
2022-03-20T19:53:00.000Z
development/Tests/YagetCore-Test/TestFiles/Json_Test.cpp
eglowacki/zloty
9c864ae0beb1ac64137a096795261768b7fc6710
[ "MIT" ]
null
null
null
#include "pch.h" #include "Debugging/DevConfiguration.h" #include "Debugging/DevConfigurationParsers.h" #include "TestHelpers/TestHelpers.h" #include "Json/JsonHelpers.h" //CHECK_EQUAL(expected, actual); class JsonUtilities : public ::testing::Test { }; TEST_F(JsonUtilities, ConfigString) { using namespace yaget; dev::Configuration expectedTestconfiguration1; expectedTestconfiguration1.mDebug.mMetrics.TraceOn = false; dev::Configuration expectedTestconfiguration2; expectedTestconfiguration2.mDebug.mMetrics.TraceFileName = "Foo.trc"; dev::Configuration expectedTestconfiguration4; expectedTestconfiguration4.mDebug.mMetrics.TraceFileName = ""; const char* testString1 = "Debug.Metrics.TraceOn=false"; const char* testString2 = "Debug.Metrics.TraceFileName = 'Foo.trc'"; const char* testString3 = "Debug.Metrics.TraceFileName='Foo.trc'"; const char* testString4 = "Debug.Metrics.TraceFileName=''"; const char* testString5 = "Debug.Metrics.TraceFileName"; const auto jsonBlock1 = json::ParseConfig(testString1); const auto jsonBlock2 = json::ParseConfig(testString2); const auto jsonBlock3 = json::ParseConfig(testString3); const auto jsonBlock4 = json::ParseConfig(testString4); const auto jsonBlock5 = json::ParseConfig(testString5); dev::Configuration configuration; EXPECT_TRUE(configuration.mDebug.mMetrics.TraceOn); from_json(jsonBlock1, configuration); EXPECT_EQ(expectedTestconfiguration1, configuration); configuration = {}; EXPECT_STREQ(configuration.mDebug.mMetrics.TraceFileName.c_str(), "$(Temp)/$(AppName)_trace.json"); from_json(jsonBlock2, configuration); EXPECT_EQ(expectedTestconfiguration2, configuration); configuration = {}; EXPECT_STREQ(configuration.mDebug.mMetrics.TraceFileName.c_str(), "$(Temp)/$(AppName)_trace.json"); from_json(jsonBlock3, configuration); EXPECT_EQ(expectedTestconfiguration2, configuration); configuration = {}; EXPECT_STREQ(configuration.mDebug.mMetrics.TraceFileName.c_str(), "$(Temp)/$(AppName)_trace.json"); from_json(jsonBlock4, configuration); EXPECT_EQ(expectedTestconfiguration4, configuration); configuration = {}; EXPECT_STREQ(configuration.mDebug.mMetrics.TraceFileName.c_str(), "$(Temp)/$(AppName)_trace.json"); from_json(jsonBlock5, configuration); EXPECT_STREQ(configuration.mDebug.mMetrics.TraceFileName.c_str(), "$(Temp)/$(AppName)_trace.json"); }
38.6875
103
0.753635
eglowacki
4d4ad7e828eb02cd709ca8268e8ee2d507abc1b8
1,231
cpp
C++
src/pages/incomes_pages.cpp
FORGIS98/budgetwarrior
ca4c79a7b9694a0db5c7fe11b1b4e9cba96a9971
[ "MIT" ]
null
null
null
src/pages/incomes_pages.cpp
FORGIS98/budgetwarrior
ca4c79a7b9694a0db5c7fe11b1b4e9cba96a9971
[ "MIT" ]
null
null
null
src/pages/incomes_pages.cpp
FORGIS98/budgetwarrior
ca4c79a7b9694a0db5c7fe11b1b4e9cba96a9971
[ "MIT" ]
null
null
null
//======================================================================= // Copyright (c) 2013-2020 Baptiste Wicht. // Distributed under the terms of the MIT License. // (See accompanying file LICENSE or copy at // http://opensource.org/licenses/MIT) //======================================================================= #include "incomes.hpp" #include "writer.hpp" #include "pages/incomes_pages.hpp" #include "http.hpp" using namespace budget; void budget::incomes_page(const httplib::Request& req, httplib::Response& res) { std::stringstream content_stream; if (!page_start(req, res, content_stream, "All Incomes")) { return; } budget::html_writer w(content_stream); budget::show_incomes(w); make_tables_sortable(w); page_end(w, req, res); } void budget::set_incomes_page(const httplib::Request& req, httplib::Response& res) { std::stringstream content_stream; if (!page_start(req, res, content_stream, "Set income")) { return; } budget::html_writer w(content_stream); w << title_begin << "Set income" << title_end; form_begin(w, "/api/incomes/add/", "/incomes/set/"); add_amount_picker(w); form_end(w); page_end(w, req, res); }
25.645833
84
0.595451
FORGIS98
4d4c557f6e6e440e4cc54129fab9b7f71da1b987
6,612
cpp
C++
interfaces/native_cpp/nfc_standard/src/sdk-reader/src/iso15693_tag.cpp
dawmlight/communication_nfc
84a10d69eb9cb3128e864230c53d5a5e6660dfb9
[ "Apache-2.0" ]
null
null
null
interfaces/native_cpp/nfc_standard/src/sdk-reader/src/iso15693_tag.cpp
dawmlight/communication_nfc
84a10d69eb9cb3128e864230c53d5a5e6660dfb9
[ "Apache-2.0" ]
null
null
null
interfaces/native_cpp/nfc_standard/src/sdk-reader/src/iso15693_tag.cpp
dawmlight/communication_nfc
84a10d69eb9cb3128e864230c53d5a5e6660dfb9
[ "Apache-2.0" ]
null
null
null
/* * Copyright (C) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "iso15693_tag.h" #include <cstring> #include "itag_session.h" #include "loghelper.h" #include "nfc_map.h" #include "nfc_sdk_common.h" using namespace std; using OHOS::nfc::reader::ResResult; namespace OHOS { namespace nfc { namespace sdk { Iso15693Tag::Iso15693Tag(std::weak_ptr<Tag> tag) : BasicTagSession(tag, Tag::EmTagTechnology::NFC_ISO_15693_TECH) { if (tag.expired() || tag.lock()->GetTechExtras(Tag::NFC_ISO_15693_TECH).expired()) { return; } std::weak_ptr<NfcMap> extraData = tag.lock()->GetTechExtras(Tag::NFC_ISO_15693_TECH); mDsfId_ = char(tag.lock()->GetIntExternData(extraData, Tag::DSF_ID)); mRespFlags_ = char(tag.lock()->GetIntExternData(extraData, Tag::RESPONSE_FLAGS)); } Iso15693Tag::~Iso15693Tag() { mDsfId_ = 0; mRespFlags_ = 0; } std::shared_ptr<Iso15693Tag> Iso15693Tag::GetTag(std::weak_ptr<Tag> tag) { if (tag.expired() || !tag.lock()->IsSupportTech(Tag::EmTagTechnology::NFC_ISO_15693_TECH)) { return std::shared_ptr<Iso15693Tag>(); } return std::make_shared<Iso15693Tag>(tag); } string Iso15693Tag::ReadSingleBlock(int flag, int blockIndex) { InfoLog("Iso15693Tag::ReadSingleBlock in flag= %d blockIndex= %d", flag, blockIndex); if ((flag < 0 || flag >= ISO15693_MAX_FLAG_COUNT) || (blockIndex < 0 || blockIndex >= ISO15693_MAX_BLOCK_INDEX) || !IsConnect()) { DebugLog("[Iso15693Tag::ReadSingleBlock] flag= %d blockIndex= %d err", flag, blockIndex); return ""; } string tagId = GetTagId(); char command[Tag::SEND_COMMAND_HEAD_LEN_2] = {char(flag & 0xFF), 0x20}; string sendCommand(command, Tag::SEND_COMMAND_HEAD_LEN_2); sendCommand = sendCommand + tagId + char(blockIndex & 0xFF); int response = ResResult::ResponseResult::RESULT_FAILURE; return SendCommand(sendCommand, false, response); } int Iso15693Tag::WriteSingleBlock(int flag, int blockIndex, const string& data) { InfoLog("Iso15693Tag::WriteSingleBlock in"); if (!IsConnect()) { DebugLog("[Iso15693Tag::WriteSingleBlock] connect tag first!"); return NfcErrorCode::NFC_SDK_ERROR_TAG_NOT_CONNECT; } if ((flag < 0 || flag >= ISO15693_MAX_FLAG_COUNT) || (blockIndex < 0 || blockIndex >= ISO15693_MAX_BLOCK_INDEX)) { DebugLog("[Iso15693Tag::WriteSingleBlock] flag= %d blockIndex= %d err", flag, blockIndex); return NfcErrorCode::NFC_SDK_ERROR_INVALID_PARAM; } string tagId = GetTagId(); char command[Tag::SEND_COMMAND_HEAD_LEN_2] = {char(flag & 0xFF), 0x21}; string sendCommand(command, Tag::SEND_COMMAND_HEAD_LEN_2); sendCommand = sendCommand + tagId + char(blockIndex & 0xFF) + data; int response = ResResult::ResponseResult::RESULT_FAILURE; string res = SendCommand(sendCommand, false, response); return response; } int Iso15693Tag::LockSingleBlock(int flag, int blockIndex) { InfoLog("Iso15693Tag::LockSingleBlock in"); if (!IsConnect()) { DebugLog("[Iso15693Tag::LockSingleBlock] connect tag first!"); return NfcErrorCode::NFC_SDK_ERROR_TAG_NOT_CONNECT; } if ((flag < 0 || flag >= ISO15693_MAX_FLAG_COUNT) || (blockIndex < 0 || blockIndex >= ISO15693_MAX_BLOCK_INDEX)) { DebugLog("[Iso15693Tag::LockSingleBlock] flag= %d blockIndex= %d err", flag, blockIndex); return NfcErrorCode::NFC_SDK_ERROR_INVALID_PARAM; } string tagId = GetTagId(); char command[Tag::SEND_COMMAND_HEAD_LEN_2] = {char(flag & 0xFF), 0x22}; string sendCommand(command, Tag::SEND_COMMAND_HEAD_LEN_2); sendCommand = sendCommand + tagId + char(blockIndex & 0xFF); int response = ResResult::ResponseResult::RESULT_FAILURE; string res = SendCommand(sendCommand, false, response); return response; } string Iso15693Tag::ReadMultipleBlock(int flag, int blockIndex, int blockNum) { InfoLog("Iso15693Tag::ReadMultipleBlock in flag= %d blockIndex= %d blockNum=%d", flag, blockIndex, blockNum); if ((flag < 0 || flag >= ISO15693_MAX_FLAG_COUNT) || (blockIndex < 0 || blockIndex >= ISO15693_MAX_BLOCK_INDEX) || (blockNum < 0 || blockNum >= ISO15693_MAX_BLOCK_INDEX) || !IsConnect()) { DebugLog( "[Iso15693Tag::ReadMultipleBlock] flag= %d blockIndex= %d " "blockNum=%d err", flag, blockIndex, blockNum); return ""; } string tagId = GetTagId(); char command[Tag::SEND_COMMAND_HEAD_LEN_2] = {char(flag & 0xFF), 0x23}; string sendCommand(command, Tag::SEND_COMMAND_HEAD_LEN_2); sendCommand = sendCommand + tagId + char(blockIndex & 0xFF) + char(blockNum & 0xFF); int response = ResResult::ResponseResult::RESULT_FAILURE; return SendCommand(sendCommand, false, response); } int Iso15693Tag::WriteMultipleBlock(int flag, int blockIndex, int blockNum, const string& data) { InfoLog("Iso15693Tag::WriteMultipleBlock in"); if (!IsConnect()) { DebugLog("[Iso15693Tag::WriteMultipleBlock] connect tag first!"); return NfcErrorCode::NFC_SDK_ERROR_TAG_NOT_CONNECT; } if ((flag < 0 || flag >= ISO15693_MAX_FLAG_COUNT) || (blockIndex < 0 || blockIndex >= ISO15693_MAX_BLOCK_INDEX) || (blockNum <= 0 || blockNum > ISO15693_MAX_BLOCK_INDEX)) { DebugLog("[Iso15693Tag::WriteMultipleBlock] flag=%d blockIndex= %d err", flag, blockIndex); return NfcErrorCode::NFC_SDK_ERROR_INVALID_PARAM; } string tagId = GetTagId(); char command[Tag::SEND_COMMAND_HEAD_LEN_2] = {char(flag & 0xFF), 0x24}; string sendCommand(command, Tag::SEND_COMMAND_HEAD_LEN_2); sendCommand = sendCommand + tagId + char(blockIndex & 0xFF) + char(blockNum & 0xFF) + data; int response = ResResult::ResponseResult::RESULT_FAILURE; string res = SendCommand(sendCommand, false, response); return response; } char Iso15693Tag::GetDsfId() const { return mDsfId_; } char Iso15693Tag::GetRespFlags() const { return mRespFlags_; } } // namespace sdk } // namespace nfc } // namespace OHOS
38
118
0.695705
dawmlight
4d4d390aa51a2f123a85615508ca73322ec5c7fc
3,327
cpp
C++
Source/Macad.Occt/Generated/BRepIntCurveSurface.cpp
zhyifei/Macad3D
55d92a7de53a1fc8f4453c09b162c261a40586f0
[ "MIT" ]
107
2020-11-29T18:01:50.000Z
2022-03-31T13:54:40.000Z
Source/Macad.Occt/Generated/BRepIntCurveSurface.cpp
zhyifei/Macad3D
55d92a7de53a1fc8f4453c09b162c261a40586f0
[ "MIT" ]
10
2021-03-12T18:34:24.000Z
2022-01-08T21:03:58.000Z
Source/Macad.Occt/Generated/BRepIntCurveSurface.cpp
zhyifei/Macad3D
55d92a7de53a1fc8f4453c09b162c261a40586f0
[ "MIT" ]
42
2021-01-07T06:23:24.000Z
2022-03-29T10:03:51.000Z
// Generated wrapper code for package BRepIntCurveSurface #include "OcctPCH.h" #include "BRepIntCurveSurface.h" using namespace System::Runtime::InteropServices; // for class Marshal #include "BRepIntCurveSurface.h" #include "TopoDS.h" #include "GeomAdaptor.h" #include "Standard.h" #include "gp.h" #include "TopAbs.h" //--------------------------------------------------------------------- // Class BRepIntCurveSurface_Inter //--------------------------------------------------------------------- Macad::Occt::BRepIntCurveSurface_Inter::BRepIntCurveSurface_Inter() : BaseClass<::BRepIntCurveSurface_Inter>(BaseClass::InitMode::Uninitialized) { _NativeInstance = new ::BRepIntCurveSurface_Inter(); } Macad::Occt::BRepIntCurveSurface_Inter::BRepIntCurveSurface_Inter(Macad::Occt::BRepIntCurveSurface_Inter^ parameter1) : BaseClass<::BRepIntCurveSurface_Inter>(BaseClass::InitMode::Uninitialized) { _NativeInstance = new ::BRepIntCurveSurface_Inter(*(::BRepIntCurveSurface_Inter*)parameter1->NativeInstance); } void Macad::Occt::BRepIntCurveSurface_Inter::Init(Macad::Occt::TopoDS_Shape^ theShape, Macad::Occt::GeomAdaptor_Curve^ theCurve, double theTol) { ((::BRepIntCurveSurface_Inter*)_NativeInstance)->Init(*(::TopoDS_Shape*)theShape->NativeInstance, *(::GeomAdaptor_Curve*)theCurve->NativeInstance, theTol); } void Macad::Occt::BRepIntCurveSurface_Inter::Init(Macad::Occt::TopoDS_Shape^ theShape, Macad::Occt::gp_Lin^ theLine, double theTol) { ((::BRepIntCurveSurface_Inter*)_NativeInstance)->Init(*(::TopoDS_Shape*)theShape->NativeInstance, *(::gp_Lin*)theLine->NativeInstance, theTol); } void Macad::Occt::BRepIntCurveSurface_Inter::Load(Macad::Occt::TopoDS_Shape^ theShape, double theTol) { ((::BRepIntCurveSurface_Inter*)_NativeInstance)->Load(*(::TopoDS_Shape*)theShape->NativeInstance, theTol); } void Macad::Occt::BRepIntCurveSurface_Inter::Init(Macad::Occt::GeomAdaptor_Curve^ theCurve) { ((::BRepIntCurveSurface_Inter*)_NativeInstance)->Init(*(::GeomAdaptor_Curve*)theCurve->NativeInstance); } bool Macad::Occt::BRepIntCurveSurface_Inter::More() { return ((::BRepIntCurveSurface_Inter*)_NativeInstance)->More(); } void Macad::Occt::BRepIntCurveSurface_Inter::Next() { ((::BRepIntCurveSurface_Inter*)_NativeInstance)->Next(); } Macad::Occt::Pnt Macad::Occt::BRepIntCurveSurface_Inter::Pnt() { return Macad::Occt::Pnt(((::BRepIntCurveSurface_Inter*)_NativeInstance)->Pnt()); } double Macad::Occt::BRepIntCurveSurface_Inter::U() { return ((::BRepIntCurveSurface_Inter*)_NativeInstance)->U(); } double Macad::Occt::BRepIntCurveSurface_Inter::V() { return ((::BRepIntCurveSurface_Inter*)_NativeInstance)->V(); } double Macad::Occt::BRepIntCurveSurface_Inter::W() { return ((::BRepIntCurveSurface_Inter*)_NativeInstance)->W(); } Macad::Occt::TopAbs_State Macad::Occt::BRepIntCurveSurface_Inter::State() { return (Macad::Occt::TopAbs_State)((::BRepIntCurveSurface_Inter*)_NativeInstance)->State(); } Macad::Occt::TopoDS_Face^ Macad::Occt::BRepIntCurveSurface_Inter::Face() { ::TopoDS_Face* _result = new ::TopoDS_Face(); *_result = (::TopoDS_Face)((::BRepIntCurveSurface_Inter*)_NativeInstance)->Face(); return _result==nullptr ? nullptr : gcnew Macad::Occt::TopoDS_Face(_result); }
34.65625
157
0.715359
zhyifei
4d50a0e6b36072965cdb4ebd4e6b830f58f7bf35
2,522
cpp
C++
src/CLR/CorLib/corlib_native_System_Object.cpp
TIPConsulting/nf-interpreter
d5407872f4705d6177e1ee5a2e966bd02fd476e4
[ "MIT" ]
null
null
null
src/CLR/CorLib/corlib_native_System_Object.cpp
TIPConsulting/nf-interpreter
d5407872f4705d6177e1ee5a2e966bd02fd476e4
[ "MIT" ]
1
2021-02-22T07:54:30.000Z
2021-02-22T07:54:30.000Z
src/CLR/CorLib/corlib_native_System_Object.cpp
TIPConsulting/nf-interpreter
d5407872f4705d6177e1ee5a2e966bd02fd476e4
[ "MIT" ]
null
null
null
// // Copyright (c) .NET Foundation and Contributors // Portions Copyright (c) Microsoft Corporation. All rights reserved. // See LICENSE file in the project root for full license information. // #include "CorLib.h" //--// HRESULT Library_corlib_native_System_Object::Equals___BOOLEAN__OBJECT( CLR_RT_StackFrame& stack ) { NATIVE_PROFILE_CLR_CORE(); NANOCLR_HEADER(); stack.SetResult_Boolean( CLR_RT_HeapBlock::ObjectsEqual( stack.Arg0(), stack.Arg1(), true ) ); NANOCLR_NOCLEANUP_NOLABEL(); } HRESULT Library_corlib_native_System_Object::GetHashCode___I4( CLR_RT_StackFrame& stack ) { NATIVE_PROFILE_CLR_CORE(); NANOCLR_HEADER(); stack.SetResult_I4( CLR_RT_HeapBlock::GetHashCode( stack.This(), true, 0 ) ); NANOCLR_NOCLEANUP_NOLABEL(); } #if (NANOCLR_REFLECTION == TRUE) HRESULT Library_corlib_native_System_Object::GetType___SystemType( CLR_RT_StackFrame& stack ) { NATIVE_PROFILE_CLR_CORE(); NANOCLR_HEADER(); CLR_RT_TypeDescriptor desc; CLR_RT_ReflectionDef_Index idx; CLR_RT_HeapBlock& arg0 = stack.Arg0(); CLR_RT_HeapBlock* pObj; NANOCLR_CHECK_HRESULT(desc.InitializeFromObject( arg0 )); pObj = arg0.Dereference(); if(pObj && arg0.DataType() == DATATYPE_REFLECTION) { idx.m_kind = REFLECTION_TYPE; idx.m_levels = 0; idx.m_data.m_type.m_data = desc.m_handlerCls.m_data; } else { idx = desc.m_reflex; } { CLR_RT_HeapBlock& top = stack.PushValue(); CLR_RT_HeapBlock* hbObj; NANOCLR_CHECK_HRESULT(g_CLR_RT_ExecutionEngine.NewObjectFromIndex(top, g_CLR_RT_WellKnownTypes.m_TypeStatic)); hbObj = top.Dereference(); hbObj->SetReflection( idx ); } NANOCLR_NOCLEANUP(); } #endif // NANOCLR_REFLECTION HRESULT Library_corlib_native_System_Object::MemberwiseClone___OBJECT( CLR_RT_StackFrame& stack ) { NATIVE_PROFILE_CLR_CORE(); NANOCLR_HEADER(); NANOCLR_SET_AND_LEAVE(g_CLR_RT_ExecutionEngine.CloneObject( stack.PushValueAndClear(), stack.Arg0() )); NANOCLR_NOCLEANUP(); } HRESULT Library_corlib_native_System_Object::ReferenceEquals___STATIC__BOOLEAN__OBJECT__OBJECT( CLR_RT_StackFrame& stack ) { NATIVE_PROFILE_CLR_CORE(); NANOCLR_HEADER(); stack.SetResult_Boolean( CLR_RT_HeapBlock::ObjectsEqual( stack.Arg0(), stack.Arg1(), true ) ); NANOCLR_NOCLEANUP_NOLABEL(); }
27.413043
123
0.692308
TIPConsulting
4d51020f7f574bf33eb2bc46fcf386c3e10c485f
2,107
cpp
C++
neutrino/graphics/src/render/opengl/opengl_logger.cpp
alexiynew/nih_framework
a65335586331daa0ece892f98265bd1d2f8f579f
[ "MIT" ]
1
2017-07-14T04:51:54.000Z
2017-07-14T04:51:54.000Z
neutrino/graphics/src/render/opengl/opengl_logger.cpp
alexiynew/nih_framework
a65335586331daa0ece892f98265bd1d2f8f579f
[ "MIT" ]
32
2017-02-02T14:49:41.000Z
2019-06-25T19:38:27.000Z
neutrino/graphics/src/render/opengl/opengl_logger.cpp
alexiynew/nih_framework
a65335586331daa0ece892f98265bd1d2f8f579f
[ "MIT" ]
null
null
null
#include <map> #include <string> #include <log/log.hpp> #include <graphics/src/opengl/opengl.hpp> #include <graphics/src/render/opengl/opengl_logger.hpp> using namespace framework::graphics::details::opengl; namespace framework::graphics { const std::string tag = "OpenGL"; void log_opengl_errors(const std::string& file, int line) { struct ErrorDescription { std::string name; std::string description; }; static const std::map<GLenum, ErrorDescription> error_descriptions = { {GL_INVALID_ENUM, {"GL_INVALID_ENUM", "An unacceptable value is specified for an enumerated argument. The offending command is ignored and has no " "other side effect than to set the error flag."}}, {GL_INVALID_VALUE, {"GL_INVALID_VALUE", "A numeric argument is out of range. The offending command is ignored and has no other side effect than to set " "the error flag."}}, {GL_INVALID_OPERATION, {"GL_INVALID_OPERATION", "The specified operation is not allowed in the current state. The offending command is ignored and has no other " "side effect than to set the error flag."}}, {GL_INVALID_FRAMEBUFFER_OPERATION, {"GL_INVALID_FRAMEBUFFER_OPERATION", "The framebuffer object is not complete. The offending command is ignored and has no other side effect than to " "set the error flag."}}, {GL_OUT_OF_MEMORY, {"GL_OUT_OF_MEMORY", "There is not enough memory left to execute the command. The state of the GL is undefined, except for the state " "of the error flags, after this error is recorded."}}, }; for (GLenum error = glGetError(); error != GL_NO_ERROR; error = glGetError()) { if (error_descriptions.count(error)) { const auto& desc = error_descriptions.at(error); log::error(tag) << file << ":" << line << "\n" << desc.name << " " << desc.description; } else { log::error(tag) << file << ":" << line << "\n" << "Unknown error: " << error; } } } } // namespace framework::graphics
36.964912
119
0.654485
alexiynew
4d5369d2135904d9036d4497808d6d343d0553d3
128
hpp
C++
libraries/fc/include/fc/compress/zlib.hpp
techsharesteam/techshares
47c58630a578204147057b7504e571e19546444f
[ "MIT" ]
6
2018-08-08T06:10:45.000Z
2019-06-23T13:45:08.000Z
libraries/fc/include/fc/compress/zlib.hpp
techsharesteam/techshares
47c58630a578204147057b7504e571e19546444f
[ "MIT" ]
null
null
null
libraries/fc/include/fc/compress/zlib.hpp
techsharesteam/techshares
47c58630a578204147057b7504e571e19546444f
[ "MIT" ]
2
2018-08-06T06:50:46.000Z
2019-01-03T09:48:54.000Z
#pragma once #include <fc/string.hpp> namespace fc { string zlib_compress(const string& in); } // namespace fc
11.636364
42
0.640625
techsharesteam
4d55a5a46029f396546008aaed68a9e37b73376b
1,651
cpp
C++
sliding-window-min-swaps-group-1s/min_swaps.cpp
JBlakd/self-study
71cb86d43fe7f6514657958db0c0e81113bd4c43
[ "MIT" ]
null
null
null
sliding-window-min-swaps-group-1s/min_swaps.cpp
JBlakd/self-study
71cb86d43fe7f6514657958db0c0e81113bd4c43
[ "MIT" ]
null
null
null
sliding-window-min-swaps-group-1s/min_swaps.cpp
JBlakd/self-study
71cb86d43fe7f6514657958db0c0e81113bd4c43
[ "MIT" ]
null
null
null
#include <algorithm> #include <iostream> #include <limits> #include <string> #include <vector> using namespace std; class Solution { public: int minSwaps(vector<int>& data) { // count number of 1's int count = 0; for (int& element : data) { if (element == 1) { ++count; } } if (count < 1) { return 0; } // Create the window, track number of 0's in the window int lo = 0; int hi = count - 1; // Repurpose the count variable count = 0; for (int i = lo; i <= hi; ++i) { if (data[i] == 0) { ++count; } } int ret = count; ++lo; ++hi; // Slide the window while (hi < data.size()) { if (data[hi] == 0) { ++count; } if (data[lo - 1] == 0) { --count; } ret = min(ret, count); ++lo; ++hi; } return ret; } }; template <typename T> void print_vector(vector<T> vec) { cout << "{"; for (int i = 0; i < vec.size(); i++) { cout << vec[i]; if (i != vec.size() - 1) { cout << ", "; } } cout << "}"; } int main() { Solution solution; vector<int> data; // 1 data = {1, 0, 1, 0, 1}; cout << solution.minSwaps(data) << '\n'; // 0 data = {0, 0, 0, 1, 0}; cout << solution.minSwaps(data) << '\n'; // 3 data = {1, 0, 1, 0, 1, 0, 0, 1, 1, 0, 1}; cout << solution.minSwaps(data) << '\n'; }
19.423529
63
0.396124
JBlakd
4d5712951b043c60311141346fe14055823c1ebe
16,274
cc
C++
media/fuchsia/cdm/fuchsia_stream_decryptor.cc
Ron423c/chromium
2edf7b980065b648f8b2a6e52193d83832fe36b7
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
null
null
null
media/fuchsia/cdm/fuchsia_stream_decryptor.cc
Ron423c/chromium
2edf7b980065b648f8b2a6e52193d83832fe36b7
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
null
null
null
media/fuchsia/cdm/fuchsia_stream_decryptor.cc
Ron423c/chromium
2edf7b980065b648f8b2a6e52193d83832fe36b7
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
1
2021-03-07T14:20:02.000Z
2021-03-07T14:20:02.000Z
// Copyright 2019 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 "media/fuchsia/cdm/fuchsia_stream_decryptor.h" #include <fuchsia/media/cpp/fidl.h> #include <fuchsia/media/drm/cpp/fidl.h> #include "base/bind.h" #include "base/fuchsia/fuchsia_logging.h" #include "base/logging.h" #include "media/base/bind_to_current_loop.h" #include "media/base/decoder_buffer.h" #include "media/base/decrypt_config.h" #include "media/base/encryption_pattern.h" #include "media/base/subsample_entry.h" #include "media/fuchsia/common/sysmem_buffer_reader.h" #include "media/fuchsia/common/sysmem_buffer_writer.h" namespace media { namespace { // Minimum number of buffers in the input and output buffer collection. // Decryptors provided by fuchsia.media.drm API normally decrypt a single // buffer at a time. Second buffer is useful to allow reading/writing a // packet while the decryptor is working on another one. const size_t kMinBufferCount = 2; std::string GetEncryptionScheme(EncryptionScheme mode) { switch (mode) { case EncryptionScheme::kCenc: return fuchsia::media::ENCRYPTION_SCHEME_CENC; case EncryptionScheme::kCbcs: return fuchsia::media::ENCRYPTION_SCHEME_CBCS; default: NOTREACHED() << "unknown encryption mode " << static_cast<int>(mode); return ""; } } std::vector<fuchsia::media::SubsampleEntry> GetSubsamples( const std::vector<SubsampleEntry>& subsamples) { std::vector<fuchsia::media::SubsampleEntry> fuchsia_subsamples( subsamples.size()); for (size_t i = 0; i < subsamples.size(); i++) { fuchsia_subsamples[i].clear_bytes = subsamples[i].clear_bytes; fuchsia_subsamples[i].encrypted_bytes = subsamples[i].cypher_bytes; } return fuchsia_subsamples; } fuchsia::media::EncryptionPattern GetEncryptionPattern( EncryptionPattern pattern) { fuchsia::media::EncryptionPattern fuchsia_pattern; fuchsia_pattern.clear_blocks = pattern.skip_byte_block(); fuchsia_pattern.encrypted_blocks = pattern.crypt_byte_block(); return fuchsia_pattern; } fuchsia::media::FormatDetails GetClearFormatDetails() { fuchsia::media::EncryptedFormat encrypted_format; encrypted_format.set_scheme(fuchsia::media::ENCRYPTION_SCHEME_UNENCRYPTED) .set_subsamples({}) .set_init_vector({}); fuchsia::media::FormatDetails format; format.set_format_details_version_ordinal(0); format.mutable_domain()->crypto().set_encrypted(std::move(encrypted_format)); return format; } fuchsia::media::FormatDetails GetEncryptedFormatDetails( const DecryptConfig* config) { DCHECK(config); fuchsia::media::EncryptedFormat encrypted_format; encrypted_format.set_scheme(GetEncryptionScheme(config->encryption_scheme())) .set_key_id(std::vector<uint8_t>(config->key_id().begin(), config->key_id().end())) .set_init_vector( std::vector<uint8_t>(config->iv().begin(), config->iv().end())) .set_subsamples(GetSubsamples(config->subsamples())); if (config->encryption_scheme() == EncryptionScheme::kCbcs) { DCHECK(config->encryption_pattern().has_value()); encrypted_format.set_pattern( GetEncryptionPattern(config->encryption_pattern().value())); } fuchsia::media::FormatDetails format; format.set_format_details_version_ordinal(0); format.mutable_domain()->crypto().set_encrypted(std::move(encrypted_format)); return format; } } // namespace FuchsiaStreamDecryptorBase::FuchsiaStreamDecryptorBase( fuchsia::media::StreamProcessorPtr processor, size_t min_buffer_size) : processor_(std::move(processor), this), min_buffer_size_(min_buffer_size), allocator_("CrFuchsiaStreamDecryptorBase") {} FuchsiaStreamDecryptorBase::~FuchsiaStreamDecryptorBase() { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); } int FuchsiaStreamDecryptorBase::GetMaxDecryptRequests() const { return input_writer_queue_.num_buffers() + 1; } void FuchsiaStreamDecryptorBase::DecryptInternal( scoped_refptr<DecoderBuffer> encrypted) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); input_writer_queue_.EnqueueBuffer(std::move(encrypted)); } void FuchsiaStreamDecryptorBase::ResetStream() { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); // Close current stream and drop all the cached decoder buffers. // Keep input and output buffers to avoid buffer re-allocation. processor_.Reset(); input_writer_queue_.ResetQueue(); } // StreamProcessorHelper::Client implementation: void FuchsiaStreamDecryptorBase::AllocateInputBuffers( const fuchsia::media::StreamBufferConstraints& stream_constraints) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); base::Optional<fuchsia::sysmem::BufferCollectionConstraints> buffer_constraints = SysmemBufferWriter::GetRecommendedConstraints( kMinBufferCount, min_buffer_size_); if (!buffer_constraints.has_value()) { OnError(); return; } input_pool_creator_ = allocator_.MakeBufferPoolCreator(1 /* num_shared_token */); input_pool_creator_->Create( std::move(buffer_constraints).value(), base::BindOnce(&FuchsiaStreamDecryptorBase::OnInputBufferPoolCreated, base::Unretained(this))); } void FuchsiaStreamDecryptorBase::OnOutputFormat( fuchsia::media::StreamOutputFormat format) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); } void FuchsiaStreamDecryptorBase::OnInputBufferPoolCreated( std::unique_ptr<SysmemBufferPool> pool) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); if (!pool) { DLOG(ERROR) << "Fail to allocate input buffer."; OnError(); return; } input_pool_ = std::move(pool); // Provide token before enabling writer. Tokens must be provided to // StreamProcessor before getting the allocated buffers. processor_.CompleteInputBuffersAllocation(input_pool_->TakeToken()); input_pool_->CreateWriter(base::BindOnce( &FuchsiaStreamDecryptorBase::OnWriterCreated, base::Unretained(this))); } void FuchsiaStreamDecryptorBase::OnWriterCreated( std::unique_ptr<SysmemBufferWriter> writer) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); if (!writer) { OnError(); return; } input_writer_queue_.Start( std::move(writer), base::BindRepeating(&FuchsiaStreamDecryptorBase::SendInputPacket, base::Unretained(this)), base::BindRepeating(&FuchsiaStreamDecryptorBase::ProcessEndOfStream, base::Unretained(this))); } void FuchsiaStreamDecryptorBase::SendInputPacket( const DecoderBuffer* buffer, StreamProcessorHelper::IoPacket packet) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); if (!packet.unit_end()) { // The encrypted data size is too big. Decryptor should consider // splitting the buffer and update the IV and subsample entries. // TODO(crbug.com/1003651): Handle large encrypted buffer correctly. For // now, just reject the decryption. LOG(ERROR) << "DecoderBuffer doesn't fit in one packet."; OnError(); return; } fuchsia::media::FormatDetails format = (buffer->decrypt_config()) ? GetEncryptedFormatDetails(buffer->decrypt_config()) : GetClearFormatDetails(); packet.set_format(std::move(format)); processor_.Process(std::move(packet)); } void FuchsiaStreamDecryptorBase::ProcessEndOfStream() { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); processor_.ProcessEos(); } FuchsiaClearStreamDecryptor::FuchsiaClearStreamDecryptor( fuchsia::media::StreamProcessorPtr processor, size_t min_buffer_size) : FuchsiaStreamDecryptorBase(std::move(processor), min_buffer_size) {} FuchsiaClearStreamDecryptor::~FuchsiaClearStreamDecryptor() = default; void FuchsiaClearStreamDecryptor::Decrypt( scoped_refptr<DecoderBuffer> encrypted, Decryptor::DecryptCB decrypt_cb) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); DCHECK(!decrypt_cb_); decrypt_cb_ = std::move(decrypt_cb); current_status_ = Decryptor::kSuccess; DecryptInternal(std::move(encrypted)); } void FuchsiaClearStreamDecryptor::CancelDecrypt() { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); ResetStream(); // Fire |decrypt_cb_| immediately as required by Decryptor::CancelDecrypt. if (decrypt_cb_) std::move(decrypt_cb_).Run(Decryptor::kSuccess, nullptr); } void FuchsiaClearStreamDecryptor::AllocateOutputBuffers( const fuchsia::media::StreamBufferConstraints& stream_constraints) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); if (!stream_constraints.has_packet_count_for_client_max() || !stream_constraints.has_packet_count_for_client_min()) { DLOG(ERROR) << "StreamBufferConstraints doesn't contain required fields."; OnError(); return; } output_pool_creator_ = allocator_.MakeBufferPoolCreator(1 /* num_shared_token */); output_pool_creator_->Create( SysmemBufferReader::GetRecommendedConstraints(kMinBufferCount, min_buffer_size_), base::BindOnce(&FuchsiaClearStreamDecryptor::OnOutputBufferPoolCreated, base::Unretained(this))); } void FuchsiaClearStreamDecryptor::OnProcessEos() { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); // Decryptor never pushes EOS frame. NOTREACHED(); } void FuchsiaClearStreamDecryptor::OnOutputPacket( StreamProcessorHelper::IoPacket packet) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); DCHECK(decrypt_cb_); DCHECK(output_reader_); if (!output_pool_->is_live()) { DLOG(ERROR) << "Output buffer pool is dead."; return; } // If that's not the last packet for the current Decrypt() request then just // store the output and wait for the next packet. if (!packet.unit_end()) { size_t pos = output_data_.size(); output_data_.resize(pos + packet.size()); bool read_success = output_reader_->Read( packet.buffer_index(), packet.offset(), base::make_span(output_data_.data() + pos, packet.size())); if (!read_success) { // If we've failed to read a partial packet then delay reporting the error // until we've received the last packet to make sure we consume all output // packets generated by the last Decrypt() call. DLOG(ERROR) << "Fail to get decrypted result."; current_status_ = Decryptor::kError; output_data_.clear(); } return; } // We've received the last packet. Assemble DecoderBuffer and pass it to the // DecryptCB. auto clear_buffer = base::MakeRefCounted<DecoderBuffer>(output_data_.size() + packet.size()); clear_buffer->set_timestamp(packet.timestamp()); // Copy data received in the previous packets. memcpy(clear_buffer->writable_data(), output_data_.data(), output_data_.size()); output_data_.clear(); // Copy data received in the last packet bool read_success = output_reader_->Read( packet.buffer_index(), packet.offset(), base::make_span(clear_buffer->writable_data() + output_data_.size(), packet.size())); if (!read_success) { DLOG(ERROR) << "Fail to get decrypted result."; current_status_ = Decryptor::kError; } std::move(decrypt_cb_) .Run(current_status_, current_status_ == Decryptor::kSuccess ? std::move(clear_buffer) : nullptr); } void FuchsiaClearStreamDecryptor::OnNoKey() { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); // Reset the queue. The client is expected to call Decrypt() with the same // buffer again when it gets kNoKey. input_writer_queue_.ResetQueue(); if (decrypt_cb_) std::move(decrypt_cb_).Run(Decryptor::kNoKey, nullptr); } void FuchsiaClearStreamDecryptor::OnError() { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); ResetStream(); if (decrypt_cb_) std::move(decrypt_cb_).Run(Decryptor::kError, nullptr); } void FuchsiaClearStreamDecryptor::OnOutputBufferPoolCreated( std::unique_ptr<SysmemBufferPool> pool) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); if (!pool) { LOG(ERROR) << "Fail to allocate output buffer."; OnError(); return; } output_pool_ = std::move(pool); // Provide token before enabling reader. Tokens must be provided to // StreamProcessor before getting the allocated buffers. processor_.CompleteOutputBuffersAllocation(output_pool_->TakeToken()); output_pool_->CreateReader(base::BindOnce( &FuchsiaClearStreamDecryptor::OnOutputBufferPoolReaderCreated, base::Unretained(this))); } void FuchsiaClearStreamDecryptor::OnOutputBufferPoolReaderCreated( std::unique_ptr<SysmemBufferReader> reader) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); if (!reader) { LOG(ERROR) << "Fail to enable output buffer reader."; OnError(); return; } DCHECK(!output_reader_); output_reader_ = std::move(reader); } FuchsiaSecureStreamDecryptor::FuchsiaSecureStreamDecryptor( fuchsia::media::StreamProcessorPtr processor, Client* client) : FuchsiaStreamDecryptorBase(std::move(processor), client->GetInputBufferSize()), client_(client) {} FuchsiaSecureStreamDecryptor::~FuchsiaSecureStreamDecryptor() = default; void FuchsiaSecureStreamDecryptor::SetOutputBufferCollectionToken( fuchsia::sysmem::BufferCollectionTokenPtr token) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); DCHECK(!complete_buffer_allocation_callback_); complete_buffer_allocation_callback_ = base::BindOnce(&StreamProcessorHelper::CompleteOutputBuffersAllocation, base::Unretained(&processor_), std::move(token)); if (waiting_output_buffers_) { std::move(complete_buffer_allocation_callback_).Run(); waiting_output_buffers_ = false; } } void FuchsiaSecureStreamDecryptor::Decrypt( scoped_refptr<DecoderBuffer> encrypted) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); DecryptInternal(std::move(encrypted)); } void FuchsiaSecureStreamDecryptor::Reset() { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); ResetStream(); waiting_for_key_ = false; } void FuchsiaSecureStreamDecryptor::AllocateOutputBuffers( const fuchsia::media::StreamBufferConstraints& stream_constraints) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); if (complete_buffer_allocation_callback_) { std::move(complete_buffer_allocation_callback_).Run(); } else { waiting_output_buffers_ = true; } } void FuchsiaSecureStreamDecryptor::OnProcessEos() { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); client_->OnDecryptorEndOfStreamPacket(); } void FuchsiaSecureStreamDecryptor::OnOutputPacket( StreamProcessorHelper::IoPacket packet) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); client_->OnDecryptorOutputPacket(std::move(packet)); } base::RepeatingClosure FuchsiaSecureStreamDecryptor::GetOnNewKeyClosure() { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); return BindToCurrentLoop(base::BindRepeating( &FuchsiaSecureStreamDecryptor::OnNewKey, weak_factory_.GetWeakPtr())); } void FuchsiaSecureStreamDecryptor::OnError() { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); ResetStream(); // No need to reset other fields since OnError() is called for non-recoverable // errors. client_->OnDecryptorError(); } void FuchsiaSecureStreamDecryptor::OnNoKey() { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); DCHECK(!waiting_for_key_); // Reset stream position, but keep all pending buffers. They will be // resubmitted later, when we have a new key. input_writer_queue_.ResetPositionAndPause(); if (retry_on_no_key_) { retry_on_no_key_ = false; input_writer_queue_.Unpause(); return; } waiting_for_key_ = true; client_->OnDecryptorNoKey(); } void FuchsiaSecureStreamDecryptor::OnNewKey() { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); if (!waiting_for_key_) { retry_on_no_key_ = true; return; } DCHECK(!retry_on_no_key_); waiting_for_key_ = false; input_writer_queue_.Unpause(); } } // namespace media
32.162055
80
0.74278
Ron423c
4d57e6fc965761c247733f10defcd0a567fb935d
5,577
cc
C++
compiler/mcr_cc/llvm/llvm_to_quick.cc
Paschalis/android-llvm
317f7fd4b736a0511a2273a2487915c34cf8933e
[ "Apache-2.0" ]
20
2021-06-24T16:38:42.000Z
2022-01-20T16:15:57.000Z
compiler/mcr_cc/llvm/llvm_to_quick.cc
Paschalis/android-llvm
317f7fd4b736a0511a2273a2487915c34cf8933e
[ "Apache-2.0" ]
null
null
null
compiler/mcr_cc/llvm/llvm_to_quick.cc
Paschalis/android-llvm
317f7fd4b736a0511a2273a2487915c34cf8933e
[ "Apache-2.0" ]
4
2021-11-03T06:01:12.000Z
2022-02-24T02:57:31.000Z
/** * Calling Quick code (that is code generated by the default/optimizing Android * backend) from LLVM. * Ideally we want to import ALL of the quick code in LLVM, as this transition * is not optimized. * * Copyright (C) 2021 Paschalis Mpeis (paschalis.mpeis-AT-gmail.com) * * 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 "function_helper.h" #include "hgraph_to_llvm-inl.h" #include "hgraph_to_llvm.h" #include "llvm_macros_irb.h" using namespace ::llvm; namespace art { namespace LLVM { /** * INFO LtQ_StackBug we need to perform a slightly larger alloca to * solve an issue that occured in some cases. */ Value* FunctionHelper::LLVMtoQuick( HGraphToLLVM* HL, IRBuilder* irb, HInvoke* hinvoke, Value* art_method_or_idx, Value* receiver, bool is_static, std::vector<Value*> callee_args, DataType::Type ret_type, uint32_t didx, const char* shorty, uint32_t shorty_len, std::string pretty_method, std::string call_info) { bool has_uses = hinvoke->HasUses(); UNUSED(has_uses); D2LOG(INFO) << __func__ << ": " << pretty_method << ":" << shorty << ":" << (is_static ? "STATIC" : ""); const bool isInterface = hinvoke->IsInvokeInterface(); const bool isVirtual = hinvoke->IsInvokeVirtual(); if(isInterface || isVirtual) { std::stringstream ss; ss << "WARNING: Invoke" << (isInterface?"Interface":"Virtual"); LOGLLVMD(ERROR, ss.str()); } if (!is_static) { receiver->setName("receiver"); } // removes return type size_t num_slots = shorty_len - 1; // +1 in case of receiver. for (size_t i = 1; i < shorty_len; ++i) { char c = shorty[i]; // wide values take 2x slot if (c == 'J' || c == 'D') { num_slots++; } } // extra slot for receiver if (!is_static) num_slots++; // LtQ_Workaround2 for LtQ_StackBug num_slots+=2; // Allocate an array (place at the first basic block) Type* argsArrayTy = ArrayType::get(irb->getJIntTy(), num_slots); Value* lnum_slots = irb->getJInt(num_slots); AllocaInst* invoke_args = new AllocaInst( argsArrayTy, 0, lnum_slots, Align(), "invoke_args", irb->GetInsertBlock()); Value* invoke_args_ptr = irb->CreateBitCast( invoke_args, irb->getJIntTy()->getPointerTo()); invoke_args_ptr->setName("invoke_args_ptr"); uint32_t arg_offset = 0; if (!is_static) { HL->StoreToObjectOffset(invoke_args_ptr, arg_offset, receiver); arg_offset += 4; } for (size_t i = 1; i < shorty_len; ++i) { Value* arg = callee_args.at(i-1); arg = irb->UpcastInt(arg, DataType::FromShorty(shorty[i])); HL->StoreToObjectOffset(invoke_args_ptr, arg_offset, arg); switch (shorty[i]) { case 'Z': case 'B': case 'C': case 'S': case 'I': case 'F': case 'L': arg_offset += 4; break; case 'D': case 'J': arg_offset += 8; break; } } // Allocate for storing the result (in JValue union) AllocaInst* jvalue = new AllocaInst( irb->getJValueTy(), 0, "jvalue", irb->GetInsertBlock()); if (McrDebug::VerifyInvokeQuickLlvmToQuick()) { irb->AndroidLogPrint(WARNING, "-> Quick:" + call_info + ": " + pretty_method); } #ifdef ART_MCR_ANDROID_10 // Push quick frame StructType* managed_stack_type = irb->GetManagedStackTy(); AllocaInst* managed_stack = irb->CreateAlloca(managed_stack_type); managed_stack->setName("ManagedStack"); HL->ArtCallPushQuickFrame(managed_stack); if(McrDebug::DebugLlvmCode3()) { irb->AndroidLogPrintHex(WARNING, "Alloca: ManagedStack", managed_stack); irb->AndroidLogPrint(ERROR, "===== LL2 LtQ: PushQuickFrame ========"); HL->ArtCallVerifyStackFrameCurrent(); irb->AndroidLogPrint(ERROR, "================================="); } Value* lshorty = irb->mCreateGlobalStringPtr(shorty); Value* largs_size=irb->getJInt(arg_offset); constexpr bool use_wrapper = false; HL->ArtCallInvokeQuick__(hinvoke, art_method_or_idx, invoke_args_ptr, largs_size, jvalue, lshorty, is_static, use_wrapper); #elif defined(ART_MCR_ANDROID_6) // Parameters std::vector<Value*> args; args.push_back(art_method_or_idx); args.push_back(invoke_args_ptr); // args size is same as final offset args.push_back(irb->getJInt(arg_offset)); args.push_back(jvalue); irb->CreateCall(fh->__InvokeWrapper(), args); #endif Value* result = nullptr; if (ret_type != DataType::Type::kVoid) { result = irb->CallGetReturnValue(HL, jvalue, ret_type); result->setName("result"); } if (McrDebug::VerifyInvokeQuickLlvmToQuick()) { irb->AndroidLogPrint(WARNING, "<- Quick:" + call_info + ": " + pretty_method + "\n"); } // Pop quick frame HL->ArtCallPopQuickFrame(managed_stack); if(McrDebug::DebugLlvmCode3()) { irb->AndroidLogPrint(ERROR, "===== LL3 LtQ: PopQuickFrame ========"); HL->ArtCallVerifyStackFrameCurrent(); irb->AndroidLogPrint(ERROR, "================================="); } return result; } #include "llvm_macros_undef.h" } // namespace LLVM } // namespace art
30.47541
82
0.665591
Paschalis
4d5a9f0b7a81565ca0eb186d5b068b8f40997fff
1,064
cpp
C++
benchmarks/binary_tree/taskflow.cpp
drobison00/taskflow
9415c3b68fd050889f57412394933e94b74755e0
[ "MIT" ]
3,337
2020-06-02T02:04:17.000Z
2022-03-31T19:12:03.000Z
benchmarks/binary_tree/taskflow.cpp
drobison00/taskflow
9415c3b68fd050889f57412394933e94b74755e0
[ "MIT" ]
235
2020-06-02T01:26:49.000Z
2022-03-31T01:35:31.000Z
benchmarks/binary_tree/taskflow.cpp
drobison00/taskflow
9415c3b68fd050889f57412394933e94b74755e0
[ "MIT" ]
414
2020-06-02T16:25:23.000Z
2022-03-30T09:17:19.000Z
#include "binary_tree.hpp" #include <taskflow/taskflow.hpp> // binary_tree_taskflow void binary_tree_taskflow(size_t num_layers, unsigned num_threads) { std::atomic<size_t> counter {0}; std::vector<tf::Task> tasks(1 << num_layers); tf::Executor executor(num_threads); tf::Taskflow taskflow; for(unsigned i=1; i<tasks.size(); i++) { tasks[i] = taskflow.emplace([&](){ counter.fetch_add(1, std::memory_order_relaxed); }); } for(unsigned i=1; i<tasks.size(); i++) { unsigned l = i << 1; unsigned r = l + 1; if(l < tasks.size() && r < tasks.size()) { tasks[i].precede(tasks[l], tasks[r]); } } executor.run(taskflow).get(); assert(counter + 1 == tasks.size()); } std::chrono::microseconds measure_time_taskflow( size_t num_layers, unsigned num_threads ) { auto beg = std::chrono::high_resolution_clock::now(); binary_tree_taskflow(num_layers, num_threads); auto end = std::chrono::high_resolution_clock::now(); return std::chrono::duration_cast<std::chrono::microseconds>(end - beg); }
24.744186
74
0.660714
drobison00
4d5d98e5f9a65f11b2760888910775c9e064eb45
9,782
cpp
C++
src/common.cpp
bwpow/libshaga
d457ee8dc267af9e20564961c9f6928290cb29cb
[ "CC0-1.0" ]
1
2018-05-09T18:15:21.000Z
2018-05-09T18:15:21.000Z
src/common.cpp
bwpow/libshaga
d457ee8dc267af9e20564961c9f6928290cb29cb
[ "CC0-1.0" ]
null
null
null
src/common.cpp
bwpow/libshaga
d457ee8dc267af9e20564961c9f6928290cb29cb
[ "CC0-1.0" ]
null
null
null
/****************************************************************************** Shaga library is released under the New BSD license (see LICENSE.md): Copyright (c) 2012-2021, SAGE team s.r.o., Samuel Kupka All rights reserved. *******************************************************************************/ #include "shaga/common.h" namespace shaga { #if BYTE_ORDER == LITTLE_ENDIAN const bool _shaga_compiled_little_endian {true}; #ifndef __clang__ #pragma message "Endian: LITTLE" #endif // __clang__ #elif BYTE_ORDER == BIG_ENDIAN const bool _shaga_compiled_little_endian {false}; #ifndef __clang__ #pragma message "Endian: BIG" #endif // __clang__ #else #error Unable to detect version of the library #endif #if defined SHAGA_MULTI_THREAD const bool _shaga_compiled_with_threading {true}; #ifndef __clang__ #pragma message "Threading support: YES" #endif // __clang__ #elif defined SHAGA_SINGLE_THREAD const bool _shaga_compiled_with_threading {false}; #ifndef __clang__ #pragma message "Threading support: NO" #endif // __clang__ #else #error Unable to detect version of the library #endif #if defined SHAGA_LITE const bool _shaga_compiled_full {false}; #ifndef __clang__ #pragma message "Version: LITE" #endif // __clang__ #elif defined SHAGA_FULL const bool _shaga_compiled_full {true}; #ifndef __clang__ #pragma message "Version: FULL" #endif // __clang__ #else #error Unable to detect version of the library #endif ///////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Most used templates //////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////// template class SPSC<std::string>; template class Simple8EncodeSPSC<SPSCDataPreAlloc>; template class Simple8DecodeSPSC<SPSCDataPreAlloc>; template class Simple16EncodeSPSC<SPSCDataPreAlloc>; template class Simple16DecodeSPSC<SPSCDataPreAlloc>; template class PacketEncodeSPSC<SPSCDataDynAlloc>; template class PacketDecodeSPSC<SPSCDataDynAlloc>; template class SeqPacketEncodeSPSC<SPSCDataDynAlloc>; template class SeqPacketDecodeSPSC<SPSCDataDynAlloc>; ///////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Static definitions ///////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////// #ifdef SHAGA_THREADING static std::mutex _callback_mutex; static std::recursive_mutex _exit_mutex; #endif // SHAGA_THREADING typedef std::list<std::function<void (void)>> CALLBACK_LIST; static CALLBACK_LIST _at_shutdown_callback_list; static CALLBACK_LIST _at_exit_callback_list; static FINAL_CALL _final_call {nullptr}; #ifdef SHAGA_THREADING static std::atomic<bool> _is_shutdown {false}; static std::atomic<bool> _is_in_exit {false}; #else volatile bool _is_shutdown {false}; bool _is_in_exit {false}; #endif // SHAGA_THREADING void add_at_exit_callback (std::function<void (void)> func) { #ifdef SHAGA_THREADING std::lock_guard<std::mutex> lock (_callback_mutex); #endif // SHAGA_THREADING _at_exit_callback_list.push_back (func); } HEDLEY_NO_RETURN void _exit (const std::string_view text, const int rcode, const std::string_view prefix) noexcept { try { #ifdef SHAGA_THREADING std::unique_lock<std::recursive_mutex> exitlck (_exit_mutex); #endif // SHAGA_THREADING #ifdef SHAGA_THREADING if (_is_in_exit.exchange (true) == true) #else if (std::exchange (_is_in_exit, true) == true) #endif // SHAGA_THREADING { /* This function is already being executed, clearly from one of the callback functions. */ P::_print ("Exit executed recursively from callback function."sv, "FATAL ERROR: "sv, true); P::set_enabled (false); ::exit (EXIT_FAILURE); } #ifdef SHAGA_THREADING std::unique_lock<std::mutex> lck (_callback_mutex); #endif // SHAGA_THREADING CALLBACK_LIST lst; lst.swap (_at_exit_callback_list); #ifdef SHAGA_THREADING lck.unlock (); #endif // SHAGA_THREADING for (auto &func : lst) { if (func != nullptr) { func (); func = nullptr; } } lst.clear (); if (text.empty () == false || prefix.empty () == false) { P::_print (text, prefix, true); } P::print ("Application exit with errorcode {}"sv, rcode); if (nullptr != _final_call) { _final_call (text, rcode); _final_call = nullptr; } P::set_enabled (false); ::exit (rcode); } catch (...) { P::_print ("Exception caught in exit."sv, "FATAL ERROR: "sv, true); P::set_enabled (false); ::exit (EXIT_FAILURE); } } HEDLEY_NO_RETURN void exit (const int rcode) noexcept { _exit (""sv, rcode); } HEDLEY_NO_RETURN void exit_failure (void) noexcept { _exit (""sv, EXIT_FAILURE); } HEDLEY_NO_RETURN void exit (void) noexcept { _exit (""sv, EXIT_SUCCESS); } void set_final_call (FINAL_CALL func) { _final_call = func; } void add_at_shutdown_callback (std::function<void (void)> func) { #ifdef SHAGA_THREADING std::lock_guard<std::mutex> lock(_callback_mutex); #endif // SHAGA_THREADING _at_shutdown_callback_list.push_back (func); } void _try_to_shutdown (const char *file, const char *funct, const int line) { #ifdef SHAGA_THREADING if (_is_shutdown.exchange (true, std::memory_order_seq_cst) == false) #else if (std::exchange (_is_shutdown, true) == false) #endif // SHAGA_THREADING { P::print ("Shutdown requested from {}: {} line {}"sv, file, funct, line); #ifdef SHAGA_THREADING std::unique_lock<std::mutex> lck (_callback_mutex); #endif // SHAGA_THREADING CALLBACK_LIST lst; lst.swap (_at_shutdown_callback_list); #ifdef SHAGA_THREADING lck.unlock (); #endif // SHAGA_THREADING for (auto &func : lst) { if (func != nullptr) { func (); func = nullptr; } } } } HEDLEY_WARN_UNUSED_RESULT bool is_shutting_down (void) { #ifdef SHAGA_THREADING return _is_shutdown.load (std::memory_order_relaxed); #else return _is_shutdown; #endif // SHAGA_THREADING } HEDLEY_WARN_UNUSED_RESULT int64_t timeval_diff_msec (const struct timeval &starttime, const struct timeval &finishtime) { return ((static_cast<int64_t> (finishtime.tv_sec) - static_cast<int64_t> (starttime.tv_sec)) * 1'000) + (static_cast<int64_t> (finishtime.tv_usec) - static_cast<int64_t> (starttime.tv_usec)) / 1'000; } HEDLEY_WARN_UNUSED_RESULT int64_t timespec_diff_msec (const struct timespec &starttime, const struct timespec &finishtime) { return ((static_cast<int64_t> (finishtime.tv_sec) - static_cast<int64_t> (starttime.tv_sec)) * 1'000) + (static_cast<int64_t> (finishtime.tv_nsec / 1'000'000) - static_cast<int64_t> (starttime.tv_nsec / 1'000'000)); } HEDLEY_WARN_UNUSED_RESULT uint64_t get_monotime_sec (void) { struct timespec monotime; #ifdef CLOCK_MONOTONIC_RAW ::clock_gettime(CLOCK_MONOTONIC_RAW, &monotime); #else ::clock_gettime(CLOCK_MONOTONIC, &monotime); #endif // CLOCK_MONOTONIC_RAW return static_cast<uint64_t> (monotime.tv_sec); } HEDLEY_WARN_UNUSED_RESULT uint64_t get_monotime_msec (void) { struct timespec monotime; #ifdef CLOCK_MONOTONIC_RAW ::clock_gettime(CLOCK_MONOTONIC_RAW, &monotime); #else ::clock_gettime(CLOCK_MONOTONIC, &monotime); #endif // CLOCK_MONOTONIC_RAW return (static_cast<uint64_t> (monotime.tv_sec) * 1'000) + (static_cast<uint64_t> (monotime.tv_nsec) / 1'000'000); } HEDLEY_WARN_UNUSED_RESULT uint64_t get_monotime_usec (void) { struct timespec monotime; #ifdef CLOCK_MONOTONIC_RAW ::clock_gettime(CLOCK_MONOTONIC_RAW, &monotime); #else ::clock_gettime(CLOCK_MONOTONIC, &monotime); #endif // CLOCK_MONOTONIC_RAW return (static_cast<uint64_t> (monotime.tv_sec) * 1'000'000) + (static_cast<uint64_t> (monotime.tv_nsec) / 1'000); } HEDLEY_WARN_UNUSED_RESULT uint64_t get_realtime_sec (void) { struct timespec monotime; ::clock_gettime (CLOCK_REALTIME, &monotime); return static_cast<uint64_t> (monotime.tv_sec); } HEDLEY_WARN_UNUSED_RESULT uint64_t get_realtime_msec (void) { struct timespec monotime; ::clock_gettime (CLOCK_REALTIME, &monotime); return (static_cast<uint64_t> (monotime.tv_sec) * 1'000) + (static_cast<uint64_t> (monotime.tv_nsec) / 1'000'000); } HEDLEY_WARN_UNUSED_RESULT uint64_t get_realtime_usec (void) { struct timespec monotime; ::clock_gettime (CLOCK_REALTIME, &monotime); return (static_cast<uint64_t> (monotime.tv_sec) * 1'000'000) + (static_cast<uint64_t> (monotime.tv_nsec) / 1'000); } HEDLEY_WARN_UNUSED_RESULT SHAGA_PARSED_REALTIME get_realtime_parsed (const time_t theTime, const bool local) { SHAGA_PARSED_REALTIME out; struct tm t; ::memset (&t, 0, sizeof (t)); if (local == true) { ::localtime_r (&theTime, &t); } else { ::gmtime_r (&theTime, &t); } out.year = t.tm_year + 1900; out.month = t.tm_mon + 1; out.day = t.tm_mday; out.hour = t.tm_hour; out.minute = t.tm_min; out.second = t.tm_sec; return out; } HEDLEY_WARN_UNUSED_RESULT SHAGA_PARSED_REALTIME get_realtime_parsed (const bool local) { time_t theTime; ::time (&theTime); return get_realtime_parsed (theTime, local); } HEDLEY_WARN_UNUSED_RESULT time_t get_realtime_sec_shifted (const time_t shift_start) { struct timespec monotime; ::clock_gettime (CLOCK_REALTIME, &monotime); if (shift_start > monotime.tv_sec) { return 0; } else { return (monotime.tv_sec - shift_start); } } }
29.026706
123
0.665099
bwpow
4d5e13d2f9e1b2359d477c2dd4a22a415f3925b4
618
hpp
C++
src/IceRay/camera/type/affine.hpp
dmilos/IceRay
4e01f141363c0d126d3c700c1f5f892967e3d520
[ "MIT-0" ]
2
2020-09-04T12:27:15.000Z
2022-01-17T14:49:40.000Z
src/IceRay/camera/type/affine.hpp
dmilos/IceRay
4e01f141363c0d126d3c700c1f5f892967e3d520
[ "MIT-0" ]
null
null
null
src/IceRay/camera/type/affine.hpp
dmilos/IceRay
4e01f141363c0d126d3c700c1f5f892967e3d520
[ "MIT-0" ]
1
2020-09-04T12:27:52.000Z
2020-09-04T12:27:52.000Z
#ifndef Dh_DDMM_IceRay_camera_type_affine_HPP_ #define Dh_DDMM_IceRay_camera_type_affine_HPP_ // GS_DDMRM::S_IceRay::S_camera::S_type::GT_affine; #include "../../type/math/affine.hpp" namespace GS_DDMRM { namespace S_IceRay { namespace S_camera { namespace S_type { typedef GS_DDMRM::S_IceRay::S_type::S_affine::GT_scalar2D GT_affine2D; typedef GS_DDMRM::S_IceRay::S_type::S_affine::GT_scalar3D GT_affine3D; //typedef GS_DDMRM::S_IceRay::S_type::S_affine::GT_scalar4D GT_affine4D; } } } } #endif
20.6
82
0.645631
dmilos
4d62d974734cff2e28346adfc6941e2f4c8d5a4f
1,320
hpp
C++
boost/network/message/directives/detail/string_value.hpp
antoinelefloch/cpp-netlib
5eb9b5550a10d06f064ee9883c7d942d3426f31b
[ "BSL-1.0" ]
3
2015-02-10T22:08:08.000Z
2021-11-13T20:59:25.000Z
include/boost/network/message/directives/detail/string_value.hpp
waTeim/boost
eb3850fae8c037d632244cf15cf6905197d64d39
[ "BSL-1.0" ]
1
2018-08-10T04:47:12.000Z
2018-08-10T13:54:57.000Z
include/boost/network/message/directives/detail/string_value.hpp
waTeim/boost
eb3850fae8c037d632244cf15cf6905197d64d39
[ "BSL-1.0" ]
5
2017-12-28T12:42:25.000Z
2021-07-01T07:41:53.000Z
#ifndef BOOST_NETWORK_MESSAGE_DIRECTIVES_DETAIL_STRING_VALUE_HPP_20100915 #define BOOST_NETWORK_MESSAGE_DIRECTIVES_DETAIL_STRING_VALUE_HPP_20100915 // Copyright Dean Michael Berris 2010. // 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 <boost/network/traits/string.hpp> #include <boost/network/support/is_async.hpp> #include <boost/network/support/is_sync.hpp> #include <boost/thread/future.hpp> #include <boost/type_traits/is_same.hpp> #include <boost/mpl/if.hpp> #include <boost/mpl/or.hpp> namespace boost { namespace network { namespace detail { template <class Tag> struct string_value : mpl::if_< is_async<Tag>, boost::shared_future<typename string<Tag>::type>, typename mpl::if_< mpl::or_< is_sync<Tag>, is_same<Tag, tags::default_string>, is_same<Tag, tags::default_wstring> >, typename string<Tag>::type, unsupported_tag<Tag> >::type > {}; } /* detail */ } /* network */ } /* boost */ #endif /* BOOST_NETWORK_MESSAGE_DIRECTIVES_DETAIL_STRING_VALUE_HPP_20100915 */
32.195122
78
0.643939
antoinelefloch
4d6595d2982fe160d200bd0cf3f2e92703cb6a68
1,003
cpp
C++
oy/test1.cpp
mhilmyh/algo-data-struct
6a9b1e5220e3c4e4a41200a09cb27f3f55560693
[ "MIT" ]
null
null
null
oy/test1.cpp
mhilmyh/algo-data-struct
6a9b1e5220e3c4e4a41200a09cb27f3f55560693
[ "MIT" ]
null
null
null
oy/test1.cpp
mhilmyh/algo-data-struct
6a9b1e5220e3c4e4a41200a09cb27f3f55560693
[ "MIT" ]
null
null
null
// **Level 1** operator (+, -) // “-3+2” = -1 // “4+7” = 11 // “9-5” = 4 // “4-7+5-3” = -1 #include <bits/stdc++.h> #define lli long long int using namespace std; bool isNum(char x) { return x >= '0' && x <= '9'; } int main() { string str; int sum = 0; int num = 0; bool neg = false; cin >> str; for (int i = 0; i < str.length(); i++) { if (str[i] == '-') { sum += neg ? num * -1 : num; num = 0; // cout << "sum: " << sum << "--\n"; neg = true; } else if (str[i] == '+') { sum += neg ? num * -1 : num; num = 0; // cout << "sum: " << sum << "--\n"; neg = false; } else if (isNum(str[i])) { num *= 10; num += (int)(str[i] - '0'); // cout << "num: " << num << "\tneg:" << neg << "\n"; } } sum += neg ? num * -1 : num; cout << sum << "\n"; return 0; }
20.06
65
0.335992
mhilmyh
4d6abdf89951667452233ee7f5058dacd7db8253
3,573
hpp
C++
external/cfmesh/meshLibrary/utilities/smoothers/geometry/meshSurfaceOptimizer/advancedSurfaceSmoothers/surfaceOptimizer/surfaceOptimizer.hpp
MrAwesomeRocks/caelus-cml
55b6dc5ba47d0e95c07412d9446ac72ac11d7fd7
[ "mpich2" ]
null
null
null
external/cfmesh/meshLibrary/utilities/smoothers/geometry/meshSurfaceOptimizer/advancedSurfaceSmoothers/surfaceOptimizer/surfaceOptimizer.hpp
MrAwesomeRocks/caelus-cml
55b6dc5ba47d0e95c07412d9446ac72ac11d7fd7
[ "mpich2" ]
null
null
null
external/cfmesh/meshLibrary/utilities/smoothers/geometry/meshSurfaceOptimizer/advancedSurfaceSmoothers/surfaceOptimizer/surfaceOptimizer.hpp
MrAwesomeRocks/caelus-cml
55b6dc5ba47d0e95c07412d9446ac72ac11d7fd7
[ "mpich2" ]
null
null
null
/*---------------------------------------------------------------------------*\ Copyright (C) Creative Fields, Ltd. ------------------------------------------------------------------------------- License This file is part of cfMesh. cfMesh is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. cfMesh is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with cfMesh. If not, see <http://www.gnu.org/licenses/>. Class surfaceOptimizer Description Performs optimisation of a central vertex in a simplex Author: Franjo Juretic (franjo.juretic@c-fields.com) SourceFiles surfaceOptimizer.cpp \*---------------------------------------------------------------------------*/ #ifndef surfaceOptimizer_HPP #define surfaceOptimizer_HPP #include "point.hpp" #include "triFace.hpp" #include "DynList.hpp" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace CML { /*---------------------------------------------------------------------------*\ Class surfaceOptimizer Declaration \*---------------------------------------------------------------------------*/ class surfaceOptimizer { // Private static data //- direction vectors for divide and conquer algorithm static const vector dirVecs[4]; // Private data //- reference to the simplex points DynList<point>& pts_; //- reference to the triangles forming a simplex const DynList<triFace>& trias_; //- min position of the bnd box point pMin_; //- max position of the bnd box point pMax_; // Private member functions //- evaluate stabilisation factor scalar evaluateStabilisationFactor() const; //- evaluate the functional scalar evaluateFunc(const scalar& K) const; //- evaluate gradients needed for optimisation void evaluateGradients(const scalar&, vector&, tensor&) const; //- optimise point position using the divide and conquer technique scalar optimiseDivideAndConquer(const scalar tol); //- optimise point position via the steepest descent method scalar optimiseSteepestDescent(const scalar tol); //- Disallow default bitwise copy construct surfaceOptimizer(const surfaceOptimizer&); //- Disallow default bitwise assignment void operator=(const surfaceOptimizer&); public: // Constructors //- Construct from transformed points and triangles forming a simplex surfaceOptimizer ( DynList<point>& pts, const DynList<triFace>& trias ); // Destructor ~surfaceOptimizer(); // Member Functions //- optimizes position of a central point in the simplex point optimizePoint(const scalar tol = 0.1); }; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace CML // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #endif // ************************************************************************* //
29.286885
79
0.541562
MrAwesomeRocks
4d6ba33709c044517e3cef3cd738a1da75e040a9
2,786
cc
C++
leetcode/Design/data_stream_as_disjoint_intervals.cc
LIZHICHAOUNICORN/Toolkits
db45dac4de14402a21be0c40ba8e87b4faeda1b6
[ "Apache-2.0" ]
null
null
null
leetcode/Design/data_stream_as_disjoint_intervals.cc
LIZHICHAOUNICORN/Toolkits
db45dac4de14402a21be0c40ba8e87b4faeda1b6
[ "Apache-2.0" ]
null
null
null
leetcode/Design/data_stream_as_disjoint_intervals.cc
LIZHICHAOUNICORN/Toolkits
db45dac4de14402a21be0c40ba8e87b4faeda1b6
[ "Apache-2.0" ]
null
null
null
#include <algorithm> #include <functional> #include <map> #include "third_party/gflags/include/gflags.h" #include "third_party/glog/include/logging.h" using namespace std; // Problem: https://leetcode-cn.com/problems/data-stream-as-disjoint-intervals/ class SummaryRanges { private: map<int, int> intervals; public: SummaryRanges() {} void addNum(int val) { // 找到 l1 最小的且满足 l1 > val 的区间 interval1 = [l1, r1] // 如果不存在这样的区间,interval1 为尾迭代器 auto interval1 = intervals.upper_bound(val); // 找到 l0 最大的且满足 l0 <= val 的区间 interval0 = [l0, r0] // 在有序集合中,interval0 就是 interval1 的前一个区间 // 如果不存在这样的区间,interval0 为尾迭代器 auto interval0 = (interval1 == intervals.begin() ? intervals.end() : prev(interval1)); if (interval0 != intervals.end() && interval0->first <= val && val <= interval0->second) { // 情况一 return; } else { bool left_aside = (interval0 != intervals.end() && interval0->second + 1 == val); bool right_aside = (interval1 != intervals.end() && interval1->first - 1 == val); if (left_aside && right_aside) { // 情况四 int left = interval0->first, right = interval1->second; intervals.erase(interval0); intervals.erase(interval1); intervals.emplace(left, right); } else if (left_aside) { // 情况二 ++interval0->second; } else if (right_aside) { // 情况三 int right = interval1->second; intervals.erase(interval1); intervals.emplace(val, right); } else { // 情况五 intervals.emplace(val, val); } } } vector<vector<int>> getIntervals() { vector<vector<int>> ans; for (const auto& inter : intervals) { ans.push_back({inter.first, inter.second}); } return ans; } }; void PrintVector(const vector<vector<int>>& vals) { LOG(INFO) << & vals; for (auto& val : vals) { LOG(INFO) << "[" << val.front() << " , " << val.back() << "]"; } } int main(int argc, char* argv[]) { google::InitGoogleLogging(argv[0]); gflags::ParseCommandLineFlags(&argc, &argv, false); SummaryRanges summaryRanges; summaryRanges.addNum(1); // arr = [1] auto ret = summaryRanges.getIntervals(); // 返回 [[1, 1]] PrintVector(ret); summaryRanges.addNum(3); // arr = [1, 3] ret = summaryRanges.getIntervals(); // 返回 [[1, 1], [3, 3]] PrintVector(ret); summaryRanges.addNum(7); // arr = [1, 3, 7] summaryRanges.getIntervals(); // 返回 [[1, 1], [3, 3], [7, 7]] summaryRanges.addNum(2); // arr = [1, 2, 3, 7] summaryRanges.getIntervals(); // 返回 [[1, 3], [7, 7]] summaryRanges.addNum(6); // arr = [1, 2, 3, 6, 7] summaryRanges.getIntervals(); // 返回 [[1, 3], [6, 7]] return 0; }
29.638298
79
0.584709
LIZHICHAOUNICORN
4d6c107651d665ce27c36f38b167d4f9d737c429
2,206
cc
C++
modules/localization/msf/local_tool/data_extraction/rosbag_reader.cc
BaiduXLab/apollo
2764e934b6d0da1342be781447348288ac84c5e9
[ "Apache-2.0" ]
22
2018-10-10T14:46:32.000Z
2022-02-28T12:43:43.000Z
modules/localization/msf/local_tool/data_extraction/rosbag_reader.cc
BaiduXLab/apollo
2764e934b6d0da1342be781447348288ac84c5e9
[ "Apache-2.0" ]
9
2019-12-07T07:26:32.000Z
2022-02-10T18:26:18.000Z
modules/localization/msf/local_tool/data_extraction/rosbag_reader.cc
BaiduXLab/apollo
2764e934b6d0da1342be781447348288ac84c5e9
[ "Apache-2.0" ]
12
2018-12-24T02:17:19.000Z
2021-12-06T01:54:09.000Z
/****************************************************************************** * Copyright 2017 The Apollo 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 "modules/localization/msf/local_tool/data_extraction/rosbag_reader.h" #include <rosbag/bag.h> #include <rosbag/view.h> #include <boost/foreach.hpp> #include <utility> #define foreach BOOST_FOREACH namespace apollo { namespace localization { namespace msf { RosbagReader::RosbagReader() {} RosbagReader::~RosbagReader() {} void RosbagReader::Subscribe(const std::string &topic, BaseExporter::OnRosmsgCallback call_back, BaseExporter::Ptr exporter) { call_back_map_[topic] = std::make_pair(exporter, call_back); topics_.push_back(topic); } void RosbagReader::Read(const std::string &file_name) { rosbag::Bag bag; bag.open(file_name, rosbag::bagmode::Read); rosbag::View view(bag, rosbag::TopicQuery(topics_)); foreach(rosbag::MessageInstance const m, view) { const std::string tp = m.getTopic(); std::cout << "Read topic: " << tp << std::endl; std::unordered_map<std::string, std::pair<BaseExporter::Ptr, BaseExporter::OnRosmsgCallback>>::iterator it = call_back_map_.find(tp); if (it != call_back_map_.end()) { BaseExporter &exporter = *(it->second.first); BaseExporter::OnRosmsgCallback call_back = it->second.second; (exporter.*call_back)(m); } } bag.close(); } } // namespace msf } // namespace localization } // namespace apollo
32.441176
80
0.63282
BaiduXLab
4d6e617024c9b39158f791aa408cfdb29b0b247b
10,909
cpp
C++
src/ace/ACE_wrappers/apps/JAWS/clients/Blobby/Blob_Handler.cpp
wfnex/OpenBRAS
b8c2cd836ae85d5307f7f5ca87573b964342bb49
[ "BSD-3-Clause" ]
8
2017-06-05T08:56:27.000Z
2020-04-08T16:50:11.000Z
src/ace/ACE_wrappers/apps/JAWS/clients/Blobby/Blob_Handler.cpp
wfnex/OpenBRAS
b8c2cd836ae85d5307f7f5ca87573b964342bb49
[ "BSD-3-Clause" ]
null
null
null
src/ace/ACE_wrappers/apps/JAWS/clients/Blobby/Blob_Handler.cpp
wfnex/OpenBRAS
b8c2cd836ae85d5307f7f5ca87573b964342bb49
[ "BSD-3-Clause" ]
17
2017-06-05T08:54:27.000Z
2021-08-29T14:19:12.000Z
#include "Blob_Handler.h" #include "ace/OS_NS_stdio.h" #include "ace/OS_NS_string.h" #include "ace/OS_NS_strings.h" // Empty constructor for compliance with new Connector behavior. ACE_Blob_Handler::ACE_Blob_Handler (void) { } // Always use this constructor ACE_Blob_Handler::ACE_Blob_Handler (ACE_Message_Block * mb, size_t length, size_t offset, ACE_TCHAR *filename) : mb_ (mb), length_ (length), offset_ (offset), filename_ (ACE_OS::strdup (filename)), bytecount_ (0) { } ACE_Blob_Handler::~ACE_Blob_Handler (void) { if (filename_) { ACE_OS::free ((void *) filename_); filename_ = 0; } } // Called by Connector after connection is established int ACE_Blob_Handler::open (void *) { if (this->send_request () != 0) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "ACE_Blob_Handler::open():send_request failed"), -1); if (this->receive_reply () != 0) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "ACE_Blob_Handler::open():receive_reply failed"), -1); return 0; } // No-op int ACE_Blob_Handler::close (u_long flags) { ACE_UNUSED_ARG (flags); return 0; } // Always overridden by the derived classes int ACE_Blob_Handler::send_request (void) { return -1; } // Always overridden by the derived classes int ACE_Blob_Handler::receive_reply (void) { return -1; } // used to retrieve the number of bytes read/written by the // last operation on the Blob int ACE_Blob_Handler::byte_count (void) { return bytecount_; } // Reader ************************************************** ACE_Blob_Reader::ACE_Blob_Reader (ACE_Message_Block * mb, size_t length, size_t offset, ACE_TCHAR *filename, const char *request_prefix, const char *request_suffix) : ACE_Blob_Handler (mb, length, offset, filename), request_prefix_ (request_prefix), request_suffix_ (request_suffix) { } // Send the HTTP request int ACE_Blob_Reader::send_request (void) { char mesg [MAX_HEADER_SIZE]; // Check to see if the request is too big if (MAX_HEADER_SIZE < (ACE_OS::strlen (request_prefix_) + ACE_OS::strlen (filename_) + ACE_OS::strlen (request_suffix_) + 4)) ACE_ERROR_RETURN((LM_ERROR,"Request too large!"), -1); // Create a message to send to the server requesting retrieval of the file int len = ACE_OS::sprintf (mesg, "%s %s %s", request_prefix_, ACE_TEXT_ALWAYS_CHAR (filename_), request_suffix_); // Send the message to server if (peer ().send_n (mesg, len) != len) ACE_ERROR_RETURN((LM_ERROR,"Error sending request"), -1); return 0; } // Recieve the HTTP Reply int ACE_Blob_Reader::receive_reply (void) { ssize_t len; char buf [MAX_HEADER_SIZE + 1]; char *buf_ptr; size_t bytes_read = 0; size_t bytes_left = this->length_; size_t offset_left = this->offset_; // Receive the first MAX_HEADER_SIZE bytes to be able to strip off the // header. Note that we assume that the header will fit into the // first MAX_HEADER_SIZE bytes of the transmitted data. if ((len = peer ().recv_n (buf, MAX_HEADER_SIZE)) >= 0) { buf[len] = '\0'; // Search for the header termination string "\r\n\r\n", or "\n\n". If // found, move past it to get to the data portion. if ((buf_ptr = ACE_OS::strstr (buf,"\r\n\r\n")) != 0) buf_ptr += 4; else if ((buf_ptr = ACE_OS::strstr (buf, "\n\n")) != 0) buf_ptr += 2; else buf_ptr = buf; // Determine number of data bytes read. This is equal to the // total bytes read minus number of header bytes. bytes_read = (buf + len) - buf_ptr; } else ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "ACE_Blob_Reader::receiveReply():Error while reading header"), -1); // *************************************************************** // At this point, we have stripped off the header and are ready to // process data. buf_ptr points to the data // First adjust for offset. There are two cases: // (1) The first block of data encountered the offset. In this case // we simply increment the buf_ptr by offset. // (2) The first block of data did not encounter the offset. That // is, the offset needs to go past the number of data bytes already read. if (bytes_read > offset_left) { // The first case is true -- that is offset is less than the // data bytes we just read. buf_ptr += offset_left; // Determine how many data bytes are actually there. This is // basically the total number of data bytes we read minus any // offset we have. size_t data_bytes = bytes_read - offset_left; // Check for the case where the bytes read are enough to fulfill // our request (for length bytes). If this is the case, then we // don't need to do any extra recvs and can simply return with // the data. if (data_bytes >= bytes_left) { // The first block contains enough data to satisfy the // length. So copy the data into the message buffer. if (mb_->copy (buf_ptr, bytes_left) == -1) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "ACE Blob_Reader::receiveReply():Error copying data into Message_Block"), -1); bytecount_ = length_; return 0; } // Copy over all the data bytes into our message buffer. if (mb_->copy (buf_ptr, data_bytes) == -1) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "ACE_Blob_Reader::receiveReply():Error copying data into Message_Block" ), -1); // Adjust bytes left bytes_left -= data_bytes; // No more offset left. So set it to zero. offset_left = 0; } else { // The second case is true -- that is offset is greater than // the data bytes we just read. offset_left -= bytes_read; } // If we ad any offset left, take care of that. while (offset_left > 0) { // MAX_HEADER_SIZE in which case we should do a receive of // offset bytes into a temporary buffer. Otherwise, we should // receive MAX_HEADER_SIZE bytes into temporary buffer and // decrement offset_left. if (offset_left < (sizeof buf)) len = offset_left; else len = sizeof buf; if (peer().recv_n (buf, len) != len) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "ACE_Blob_Reader::receiveReply():Read error" ), -1); offset_left -= len; } // ***************************************************************** // At this point we are all set to receive the actual data which the // user wants. We have made adjustments for offset and are ready to // receive the actual data. Receive the data directly into the // message buffer. len = peer().recv_n (mb_->wr_ptr (), bytes_left); if (len < 0 || static_cast<size_t> (len) != bytes_left) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "ACE_Blob_Reader::receiveReply():Read error" ), -1); // Adjust the message buffer write pointer by number of bytes we // received. mb_->wr_ptr (len); // Set the byte count to number of bytes received this->bytecount_ = length_; return 0; } // Writer ************************************************** ACE_Blob_Writer::ACE_Blob_Writer (ACE_Message_Block * mb, size_t length, size_t offset, ACE_TCHAR *filename, const char *request_prefix, const char *request_suffix) : ACE_Blob_Handler (mb, length, offset, filename), request_prefix_ (request_prefix), request_suffix_ (request_suffix) { } int ACE_Blob_Writer::send_request (void) { // Check for sanity -- check if we have any data to send. if (offset_+ length_ > mb_->length ()) ACE_ERROR_RETURN((LM_ERROR, "%p\n", "ACE_Blob_Writer::sendRequest():Invalid offset/length"), -1); // Determine the length of the header message we will be sending to // the server. Note that we add 32 for safety -- this corresponds to // the number of bytes needed for the length field. size_t mesglen = ACE_OS::strlen (request_prefix_) + ACE_OS::strlen (filename_) + ACE_OS::strlen (request_suffix_) + 32; // safety // Allocate a buffer to hold the header char *mesg = 0; ACE_NEW_RETURN (mesg, char [mesglen], -1); // Create the header, store the actual length in mesglen. mesglen = ACE_OS::sprintf (mesg, "%s /%s %s " ACE_SIZE_T_FORMAT_SPECIFIER_ASCII "\n\n", request_prefix_, ACE_TEXT_ALWAYS_CHAR (filename_), request_suffix_, length_); // Send the header followed by the data // First send the header if (peer ().send_n (mesg, mesglen) == -1) ACE_ERROR_RETURN((LM_ERROR, "%p\n", "Error sending request"), -1); // "Consume" the offset by moving the read pointer of the message // buffer mb_->rd_ptr (offset_); // Now send the data if (peer ().send_n (mb_->rd_ptr (), length_) != (int)length_) ACE_ERROR_RETURN((LM_ERROR, "%p\n", "Error sending file"), -1); // Adjust the read pointer of the mesage buffer mb_->rd_ptr (length_); return 0; } int ACE_Blob_Writer::receive_reply (void) { // Allocate a buffer big enough to hold the header char buf[MAX_HEADER_SIZE]; // Receive the reply from the server size_t num_recvd = 0; ssize_t len = peer ().recv_n (buf, sizeof buf - 1, 0, &num_recvd); // reserve one byte to store the \0 if (len ==-1) ACE_ERROR_RETURN((LM_ERROR, "%p\n", "Error reading header"), -1); buf [num_recvd] = 0; // Parse the header char *lasts = 0; // First check if this was a valid header -- HTTP/1.0 char *token = ACE_OS::strtok_r (buf, " \t", &lasts); if ( (token == 0) || (ACE_OS::strcasecmp (token, "HTTP/1.0") != 0)) ACE_ERROR_RETURN((LM_ERROR, "%p\n", "Did not receive a HTTP/1.0 response"), -1); // Get the return code. int return_code = ACE_OS::atoi (ACE_OS::strtok_r (0, " \t", &lasts)); // Check if the transaction succeeded. The only success codes are in // the range of 200-299 (HTTP specification). if (return_code >= 200 && return_code < 300) return 0; else { // Something went wrong! // Get the description from the header message of what went wrong. char *description = ACE_OS::strtok_r (0, "\n\r", &lasts); ACE_ERROR_RETURN((LM_ERROR, "%p\n", description), -1); } ACE_NOTREACHED(return 0); }
31.62029
109
0.602713
wfnex
4d6eac15ee37d246dc7c92db6ee8cf1035e95de5
682
cpp
C++
demos/game_of_life/get_life_1_06.cpp
a-n-t-h-o-n-y/MCurses
c9184a0fefbdc4eb9a044f815ee2270e6b8f202c
[ "MIT" ]
284
2017-11-07T10:06:48.000Z
2021-01-12T15:32:51.000Z
demos/game_of_life/get_life_1_06.cpp
a-n-t-h-o-n-y/MCurses
c9184a0fefbdc4eb9a044f815ee2270e6b8f202c
[ "MIT" ]
38
2018-01-14T12:34:54.000Z
2020-09-26T15:32:43.000Z
demos/game_of_life/get_life_1_06.cpp
a-n-t-h-o-n-y/MCurses
c9184a0fefbdc4eb9a044f815ee2270e6b8f202c
[ "MIT" ]
31
2017-11-30T11:22:21.000Z
2020-11-03T05:27:47.000Z
#include "get_life_1_06.hpp" #include <fstream> #include <string> #include "coordinate.hpp" #include "pattern.hpp" namespace gol { auto get_life_1_06(std::string const& filename) -> Pattern { auto file = std::ifstream{filename}; if (file.fail()) return {}; auto cells = Pattern::Cells{}; auto first_line = std::string{}; std::getline(file, first_line); while (file) { auto x = 0; file >> x; if (!file) break; auto y = 0; file >> y; if (!file.good()) break; cells.push_back({x, y}); } return {cells, parse_rule_string("B3/S23")}; } } // namespace gol
19.485714
58
0.548387
a-n-t-h-o-n-y
4d6ef2f4ab020aa44724318655dc86a81342b6e5
150
cpp
C++
ace/OS_NS_dlfcn.cpp
BeiJiaan/ace
2845970c894bb350d12d6a32e867d7ddf2487f25
[ "DOC" ]
16
2015-05-11T04:33:44.000Z
2022-02-15T04:28:39.000Z
ace/OS_NS_dlfcn.cpp
BeiJiaan/ace
2845970c894bb350d12d6a32e867d7ddf2487f25
[ "DOC" ]
null
null
null
ace/OS_NS_dlfcn.cpp
BeiJiaan/ace
2845970c894bb350d12d6a32e867d7ddf2487f25
[ "DOC" ]
7
2015-01-08T16:11:34.000Z
2021-07-04T16:04:40.000Z
// $Id$ #include "ace/OS_NS_dlfcn.h" #if !defined (ACE_HAS_INLINED_OSCALLS) # include "ace/OS_NS_dlfcn.inl" #endif /* ACE_HAS_INLINED_OSCALLS */
13.636364
38
0.72
BeiJiaan
4d6f5ab508b9e91fd3279b2ab2256a5bbd018544
5,424
cpp
C++
src/Magnum/MeshTools/Test/SubdivideRemoveDuplicatesBenchmark.cpp
Graphics-Physics-Libraries/magnum-games-and-data-visualization
a817f55d6ff0ef0510d93b310c2ba897e4de49ee
[ "MIT" ]
null
null
null
src/Magnum/MeshTools/Test/SubdivideRemoveDuplicatesBenchmark.cpp
Graphics-Physics-Libraries/magnum-games-and-data-visualization
a817f55d6ff0ef0510d93b310c2ba897e4de49ee
[ "MIT" ]
null
null
null
src/Magnum/MeshTools/Test/SubdivideRemoveDuplicatesBenchmark.cpp
Graphics-Physics-Libraries/magnum-games-and-data-visualization
a817f55d6ff0ef0510d93b310c2ba897e4de49ee
[ "MIT" ]
null
null
null
/* This file is part of Magnum. Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 Vladimír Vondruš <mosra@centrum.cz> 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 <Corrade/Containers/GrowableArray.h> #include <Corrade/TestSuite/Tester.h> #include <Corrade/Utility/Algorithms.h> #include "Magnum/Math/Vector4.h" #include "Magnum/MeshTools/Duplicate.h" #include "Magnum/MeshTools/RemoveDuplicates.h" #include "Magnum/MeshTools/Subdivide.h" #include "Magnum/Primitives/Icosphere.h" #include "Magnum/Trade/MeshData.h" namespace Magnum { namespace MeshTools { namespace Test { namespace { struct SubdivideRemoveDuplicatesBenchmark: TestSuite::Tester { explicit SubdivideRemoveDuplicatesBenchmark(); void subdivide(); void subdivideAndRemoveDuplicatesAfter(); void subdivideAndRemoveDuplicatesAfterInPlace(); void subdivideAndRemoveDuplicatesInBetween(); }; SubdivideRemoveDuplicatesBenchmark::SubdivideRemoveDuplicatesBenchmark() { addBenchmarks({&SubdivideRemoveDuplicatesBenchmark::subdivide, &SubdivideRemoveDuplicatesBenchmark::subdivideAndRemoveDuplicatesAfter, &SubdivideRemoveDuplicatesBenchmark::subdivideAndRemoveDuplicatesAfterInPlace, &SubdivideRemoveDuplicatesBenchmark::subdivideAndRemoveDuplicatesInBetween}, 4); } namespace { static Vector3 interpolator(const Vector3& a, const Vector3& b) { return (a+b).normalized(); } } void SubdivideRemoveDuplicatesBenchmark::subdivide() { Trade::MeshData icosphere = Primitives::icosphereSolid(0); CORRADE_BENCHMARK(3) { Containers::Array<UnsignedInt> indices; arrayResize(indices, Containers::NoInit, icosphere.indexCount()); Utility::copy(icosphere.indices<UnsignedInt>(), indices); Containers::Array<Vector3> positions; arrayResize(positions, Containers::NoInit, icosphere.vertexCount()); Utility::copy(icosphere.attribute<Vector3>(Trade::MeshAttribute::Position), positions); /* Subdivide 5 times */ for(std::size_t i = 0; i != 5; ++i) MeshTools::subdivide(indices, positions, interpolator); } } void SubdivideRemoveDuplicatesBenchmark::subdivideAndRemoveDuplicatesAfter() { Trade::MeshData icosphere = Primitives::icosphereSolid(0); CORRADE_BENCHMARK(3) { Containers::Array<UnsignedInt> indices; arrayResize(indices, Containers::NoInit, icosphere.indexCount()); Utility::copy(icosphere.indices<UnsignedInt>(), indices); Containers::Array<Vector3> positions; arrayResize(positions, Containers::NoInit, icosphere.vertexCount()); Utility::copy(icosphere.attribute<Vector3>(Trade::MeshAttribute::Position), positions); /* Subdivide 5 times */ for(std::size_t i = 0; i != 5; ++i) MeshTools::subdivide(indices, positions, interpolator); /* Remove duplicates after */ arrayResize(positions, MeshTools::removeDuplicatesIndexedInPlace( stridedArrayView(indices), stridedArrayView(positions))); } } void SubdivideRemoveDuplicatesBenchmark::subdivideAndRemoveDuplicatesAfterInPlace() { CORRADE_BENCHMARK(3) { /* Because that's what this thing does */ Trade::MeshData icosphere = Primitives::icosphereSolid(5); } } void SubdivideRemoveDuplicatesBenchmark::subdivideAndRemoveDuplicatesInBetween() { Trade::MeshData icosphere = Primitives::icosphereSolid(0); CORRADE_BENCHMARK(3) { Containers::Array<UnsignedInt> indices; arrayResize(indices, Containers::NoInit, icosphere.indexCount()); Utility::copy(icosphere.indices<UnsignedInt>(), indices); Containers::Array<Vector3> positions; arrayResize(positions, Containers::NoInit, icosphere.vertexCount()); Utility::copy(icosphere.attribute<Vector3>(Trade::MeshAttribute::Position), positions); /* Subdivide 5 times and remove duplicates during the operation */ for(std::size_t i = 0; i != 5; ++i) { MeshTools::subdivide(indices, positions, interpolator); arrayResize(positions, MeshTools::removeDuplicatesIndexedInPlace( stridedArrayView(indices), stridedArrayView(positions))); } } } }}}} CORRADE_TEST_MAIN(Magnum::MeshTools::Test::SubdivideRemoveDuplicatesBenchmark)
40.781955
99
0.722529
Graphics-Physics-Libraries
4d73221afd1de46e822bccc66dc3b513d3912a9d
1,827
cpp
C++
engine/modules/box2d/box2d_joint.cpp
Houkime/echo
d115ca55faf3a140bea04feffeb2efdedb0e7f82
[ "MIT" ]
null
null
null
engine/modules/box2d/box2d_joint.cpp
Houkime/echo
d115ca55faf3a140bea04feffeb2efdedb0e7f82
[ "MIT" ]
null
null
null
engine/modules/box2d/box2d_joint.cpp
Houkime/echo
d115ca55faf3a140bea04feffeb2efdedb0e7f82
[ "MIT" ]
null
null
null
#include "box2d_joint.h" #include "box2d_body.h" namespace Echo { Box2DJoint::Box2DJoint() { } Box2DJoint::~Box2DJoint() { } void Box2DJoint::bindMethods() { CLASS_BIND_METHOD(Box2DJoint, getBodyA, DEF_METHOD("getBodyA")); CLASS_BIND_METHOD(Box2DJoint, setBodyA, DEF_METHOD("setBodyA")); CLASS_BIND_METHOD(Box2DJoint, getBodyB, DEF_METHOD("getBodyB")); CLASS_BIND_METHOD(Box2DJoint, setBodyB, DEF_METHOD("setBodyB")); CLASS_REGISTER_PROPERTY(Box2DJoint, "BodyA", Variant::Type::NodePath, "getBodyA", "setBodyA"); CLASS_REGISTER_PROPERTY(Box2DJoint, "BodyB", Variant::Type::NodePath, "getBodyB", "setBodyB"); } void Box2DJoint::setBodyA(const NodePath& nodePath) { if (m_bodyA.setPath(nodePath.getPath())) { m_dirtyFlag = true; } } void Box2DJoint::setBodyB(const NodePath& nodePath) { if (m_bodyB.setPath(nodePath.getPath())) { m_dirtyFlag = true; } } b2Body* Box2DJoint::getb2BodyA() { if(!m_bodyA.getPath().empty()) { Box2DBody* body = getNodeT<Box2DBody*>(m_bodyA.getPath().c_str()); return body ? body->getb2Body() : nullptr; } return nullptr; } b2Body* Box2DJoint::getb2BodyB() { if(!m_bodyB.getPath().empty()) { Box2DBody* body = getNodeT<Box2DBody*>(m_bodyB.getPath().c_str()); return body ? body->getb2Body() : nullptr; } return nullptr; } void Box2DJoint::update_self() { if(m_isEnable && !m_joint && m_dirtyFlag) { m_joint = createb2Joint(); m_dirtyFlag = false; } } }
25.027397
102
0.558292
Houkime
4d7486d172f08aa5b6a4322a5aed68011e24833e
766
cpp
C++
C++/lengthOfLongestSubstring.cpp
colorfulberry/LeetCode
a4103a63d2969e8819447685f42423cd22fed2ff
[ "MIT" ]
2
2020-04-08T17:57:43.000Z
2021-11-07T09:11:51.000Z
C++/lengthOfLongestSubstring.cpp
colorfulberry/LeetCode
a4103a63d2969e8819447685f42423cd22fed2ff
[ "MIT" ]
null
null
null
C++/lengthOfLongestSubstring.cpp
colorfulberry/LeetCode
a4103a63d2969e8819447685f42423cd22fed2ff
[ "MIT" ]
8
2018-03-13T18:20:26.000Z
2022-03-09T19:48:11.000Z
// Time Complexity: O(n) // Space Complexity: O(1) class Solution { public: int lengthOfLongestSubstring(string s) { vector<int> last(26, -1); int start = 0; int ans = 0; for(int i = 0; i < s.size(); ++i) { if(last[s[i] - 'a'] >= start) { // meet a repeated character ans = max(i - start, ans); // recount max length of substring start = last[s[i] - 'a'] + 1; // update start index next to the repeated one } last[s[i] - 'a'] = i; // update last index } return max(static_cast<int>(s.size()) - start, ans); // recount max length of substring due to end } };
34.818182
110
0.462141
colorfulberry
4d79b6e5120e6fd436da35ce583449b603aba9b5
7,313
ipp
C++
src/solver/convdiffe.ipp
ChristopherKotthoff/Aphros-with-GraphContraction
18af982a50e350a8bf6979ae5bd25b2ef4d3792a
[ "MIT" ]
252
2020-06-03T16:01:59.000Z
2022-03-30T14:06:32.000Z
src/solver/convdiffe.ipp
ChristopherKotthoff/Aphros-with-GraphContraction
18af982a50e350a8bf6979ae5bd25b2ef4d3792a
[ "MIT" ]
4
2021-03-13T11:13:55.000Z
2022-03-31T15:11:22.000Z
src/solver/convdiffe.ipp
ChristopherKotthoff/Aphros-with-GraphContraction
18af982a50e350a8bf6979ae5bd25b2ef4d3792a
[ "MIT" ]
27
2020-09-18T04:12:03.000Z
2022-03-30T04:22:42.000Z
// Created by Petr Karnakov on 30.04.2019 // Copyright 2019 ETH Zurich #include <cmath> #include <sstream> #include <stdexcept> #include "approx.h" #include "approx_eb.h" #include "convdiffe.h" #include "debug/isnan.h" template <class EB_> struct ConvDiffScalExp<EB_>::Imp { using Owner = ConvDiffScalExp<EB_>; using Vect = typename M::Vect; using UEB = UEmbed<M>; Imp(Owner* owner, const Args& args) : owner_(owner) , par(owner_->GetPar()) , m(owner_->m) , eb(owner_->eb) , mebc_(args.mebc) , dtp_(-1.) , error_(0) { fcu_.time_curr = args.fcu; fcu_.time_prev = args.fcu; fcu_.iter_curr = args.fcu; } // Fields: void StartStep() { owner_->ClearIter(); CHECKNAN(fcu_.time_curr, m.flags.check_nan) fcu_.iter_curr = fcu_.time_curr; if (dtp_ == -1.) { // TODO: revise dtp_ = owner_->GetTimeStep(); } error_ = 0.; } // Assembles linear system // fcu: field from previous iteration [a] // ffv: volume flux // Output: // diagonal linear system: fcla * (fcup - fcu) + fclb = 0 // where fcup at new iteration void Assemble( const FieldCell<Scal>& fcu, const FieldFaceb<Scal>& ffv, FieldCell<Scal>& fcla, FieldCell<Scal>& fclb) const { fcla.Reinit(m, 0); fclb.Reinit(m, 0); // convective fluxes if (!par.stokes) { FieldFaceb<Scal> ffq(eb, 0); const FieldCell<Vect> fcg = UEB::Gradient(UEB::Interpolate(fcu, mebc_, eb), eb); const FieldFaceb<Scal> ffu = UEB::InterpolateUpwind(fcu, mebc_, par.sc, fcg, ffv, eb); eb.LoopFaces([&](auto cf) { // ffq[cf] = ffu[cf] * ffv[cf]; }); for (auto c : eb.Cells()) { Scal sum = 0; eb.LoopNci(c, [&](auto q) { const auto cf = eb.GetFace(c, q); sum += ffq[cf] * eb.GetOutwardFactor(c, q); }); fclb[c] += sum * (*owner_->fcr_)[c]; } } // diffusive fluxes if (owner_->ffd_) { FieldFaceb<Scal> ffq(eb, 0); const FieldFaceb<Scal> ffg = UEB::Gradient(fcu, mebc_, eb); eb.LoopFaces([&](auto cf) { // ffq[cf] = -ffg[cf] * (*owner_->ffd_)[cf] * eb.GetArea(cf); }); for (auto c : eb.Cells()) { Scal sum = 0; eb.LoopNci(c, [&](auto q) { const auto cf = eb.GetFace(c, q); sum += ffq[cf] * eb.GetOutwardFactor(c, q); }); fclb[c] += sum; } } fclb = UEB::RedistributeCutCells(fclb, eb); // time derivative if (!par.stokes) { const Scal dt = owner_->GetTimeStep(); const std::vector<Scal> tt = GetGradCoeffs(0., {-(dt + dtp_), -dt, 0.}, par.second ? 0 : 1); for (auto c : eb.Cells()) { const Scal a = eb.GetVolume(c) * (*owner_->fcr_)[c]; fcla[c] += tt[2] * a; fclb[c] += (tt[0] * fcu_.time_prev[c] + tt[1] * fcu_.time_curr[c]) * a; } } else { for (auto c : eb.Cells()) { fcla[c] += eb.GetVolume(c); fclb[c] -= fcu[c] * eb.GetVolume(c); } } for (auto c : eb.Cells()) { // source fclb[c] -= (*owner_->fcs_)[c] * eb.GetVolume(c); // delta form fclb[c] += fcla[c] * fcu[c]; // under-relaxation fcla[c] /= par.relax; } } // Assembles linear system // fcu: field from previous iteration [a] // ffv: volume flux // Output: // fcl: linear system void Assemble(const FieldCell<Scal>& fcu, const FieldFaceb<Scal>& ffv) { Assemble(fcu, ffv, fcla_, fclb_); } // Solves linear system. // fcla * u + fclb = 0: system to solve // Output: // fcu: result void Solve( const FieldCell<Scal>& fcla, const FieldCell<Scal>& fclb, FieldCell<Scal>& fcu) { fcu.Reinit(m, 0); for (auto c : eb.Cells()) { fcu[c] = -fclb[c] / fcla[c]; } } void MakeIteration() { auto sem = m.GetSem("convdiff-iter"); auto& prev = fcu_.iter_prev; auto& curr = fcu_.iter_curr; if (sem("init")) { prev.swap(curr); } if (sem("assemble")) { Assemble(prev, *owner_->ffv_, fcla_, fclb_); } if (sem("solve")) { Solve(fcla_, fclb_, curr); // solve for correction, store in curr } if (sem("apply")) { // apply, store result in curr for (auto c : eb.Cells()) { curr[c] += prev[c]; } error_ = CalcError(); m.Reduce(&error_, "max"); m.Comm(&curr); owner_->IncIter(); } } void FinishStep() { fcu_.time_prev.swap(fcu_.time_curr); fcu_.time_curr = fcu_.iter_curr; CHECKNAN(fcu_.time_curr, m.flags.check_nan) owner_->IncTime(); dtp_ = owner_->GetTimeStep(); } Scal CalcError() { // max difference between iter_curr and iter_prev auto& prev = fcu_.iter_prev; auto& curr = fcu_.iter_curr; Scal a = 0; for (auto c : eb.Cells()) { a = std::max<Scal>(a, std::abs(curr[c] - prev[c])); } return a; } double GetError() const { return error_; } // Apply correction to field and comm // uc: correction [i] // Output: // u(l) += uc [a] void CorrectField(Step l, const FieldCell<Scal>& uc) { auto sem = m.GetSem("corr"); if (sem("apply")) { auto& u = fcu_.Get(l); for (auto c : eb.Cells()) { u[c] += uc[c]; } CalcError(); m.Comm(&u); } } FieldCell<Scal> GetDiag() const { FieldCell<Scal> fc(eb, 0); for (auto c : eb.Cells()) { fc[c] = fcla_[c] / eb.GetVolume(c); } return fc; } FieldCell<Scal> GetConst() const { FieldCell<Scal> fc(eb, 0); for (auto c : eb.Cells()) { fc[c] = fclb_[c] / eb.GetVolume(c); } return fc; } Owner* owner_; Par par; M& m; // mesh const EB& eb; // embed mesh StepData<FieldCell<Scal>> fcu_; // field const MapEmbed<BCond<Scal>>& mebc_; // boundary conditions // diagonal linear system: fcla * (fcup - fcu) + fclb = 0 FieldCell<Scal> fcla_; FieldCell<Scal> fclb_; Scal dtp_; // dt prev Scal error_; // error }; template <class EB_> ConvDiffScalExp<EB_>::ConvDiffScalExp(M& m_, const EB& eb_, const Args& args) : Base( args.t, args.dt, m_, eb_, args.par, args.fcr, args.ffd, args.fcs, args.ffv) , imp(new Imp(this, args)) {} template <class EB_> ConvDiffScalExp<EB_>::~ConvDiffScalExp() = default; template <class EB_> void ConvDiffScalExp<EB_>::Assemble( const FieldCell<Scal>& fcu, const FieldFaceb<Scal>& ffv) { imp->Assemble(fcu, ffv); } template <class EB_> void ConvDiffScalExp<EB_>::CorrectField(Step l, const FieldCell<Scal>& uc) { imp->CorrectField(l, uc); } template <class EB_> auto ConvDiffScalExp<EB_>::GetDiag() const -> FieldCell<Scal> { return imp->GetDiag(); } template <class EB_> auto ConvDiffScalExp<EB_>::GetConst() const -> FieldCell<Scal> { return imp->GetConst(); } template <class EB_> void ConvDiffScalExp<EB_>::StartStep() { imp->StartStep(); } template <class EB_> void ConvDiffScalExp<EB_>::MakeIteration() { imp->MakeIteration(); } template <class EB_> void ConvDiffScalExp<EB_>::FinishStep() { imp->FinishStep(); } template <class EB_> double ConvDiffScalExp<EB_>::GetError() const { return imp->GetError(); } template <class EB_> auto ConvDiffScalExp<EB_>::GetField(Step l) const -> const FieldCell<Scal>& { return imp->fcu_.Get(l); }
25.659649
79
0.573226
ChristopherKotthoff
4d7a143cd5adac6653ab63b68221b4be6add2a3f
1,954
cpp
C++
LuoguCodes/P2568.cpp
Anguei/OI-Codes
0ef271e9af0619d4c236e314cd6d8708d356536a
[ "MIT" ]
null
null
null
LuoguCodes/P2568.cpp
Anguei/OI-Codes
0ef271e9af0619d4c236e314cd6d8708d356536a
[ "MIT" ]
null
null
null
LuoguCodes/P2568.cpp
Anguei/OI-Codes
0ef271e9af0619d4c236e314cd6d8708d356536a
[ "MIT" ]
null
null
null
// luogu-judger-enable-o2 // luogu-judger-enable-o2 #include <cmath> #include <cctype> #include <cstdio> #include <cstring> #include <set> #include <map> #include <stack> #include <queue> #include <string> #include <vector> #include <numeric> #include <iomanip> #include <iostream> #include <algorithm> #define fn "2818" #define ll long long #define int long long #define pc(x) putchar(x) #define fileIn freopen("testdata.in", "r", stdin) #define fileOut freopen("testdata.out", "w", stdout) #define rep(i, a, b) for (register int i = (a); i <= (b); ++i) #define per(i, a, b) for (int i = (a); i >= (b); --i) #ifdef yyfLocal #define dbg(x) std::clog << #x" = " << (x) << std::endl #define logs(x) std::clog << (x) << std::endl #else #define dbg(x) 42 #define logs(x) 42 #endif int read() { int res = 0, flag = 1; char ch = getchar(); while (!isdigit(ch)) { if (ch == ';-';) flag = -1; ch = getchar(); } while (isdigit(ch)) res = res * 10 + ch - 48, ch = getchar(); return res * flag; } void print(int x) { if (x < 0) putchar(';-';), x = -x; if (x > 9) print(x / 10); putchar(x % 10 + 48); } const int N = 10000000 + 5; int n, p = 0, ans = 0, prime[N >> 2], phi[N]; bool v[N]; void solution() { n = read(); rep(i, 2, n) { if (!v[i]) prime[++p] = i, phi[i] = i - 1; for (int j = 1; j <= p && prime[j] * i <= n; ++j) { v[i * prime[j]] = true; if (!(i % prime[j])) { phi[i * prime[j]] = phi[i] * prime[j]; break; } phi[i * prime[j]] = phi[i] * (prime[j] - 1); } } rep(i, 3, n) phi[i] += phi[i - 1]; rep(i, 1, p) ans += phi[n / prime[i]]; print((ans << 1) + p), puts(""); } signed main() { #ifdef yyfLocal fileIn; // fileOut; #else #ifndef ONLINE_JUDGE freopen(fn".in", "r", stdin); freopen(fn".out", "w", stdout); #endif #endif logs("2818.exe"); solution(); return 0; }
24.123457
72
0.520983
Anguei
4d7a53e6253cd1f694f58516275d426e8cb95458
42,863
cxx
C++
GPU/GPUTracking/Global/GPUChainTrackingClusterizer.cxx
chengtt0406/AliRoot
c1d89b133b433f608b2373112d3608d8cec26095
[ "BSD-3-Clause" ]
52
2016-12-11T13:04:01.000Z
2022-03-11T11:49:35.000Z
GPU/GPUTracking/Global/GPUChainTrackingClusterizer.cxx
chengtt0406/AliRoot
c1d89b133b433f608b2373112d3608d8cec26095
[ "BSD-3-Clause" ]
1,388
2016-11-01T10:27:36.000Z
2022-03-30T15:26:09.000Z
GPU/GPUTracking/Global/GPUChainTrackingClusterizer.cxx
chengtt0406/AliRoot
c1d89b133b433f608b2373112d3608d8cec26095
[ "BSD-3-Clause" ]
275
2016-06-21T20:24:05.000Z
2022-03-31T13:06:19.000Z
//**************************************************************************\ //* This file is property of and copyright by the ALICE Project *\ //* ALICE Experiment at CERN, All rights reserved. *\ //* *\ //* Primary Authors: Matthias Richter <Matthias.Richter@ift.uib.no> *\ //* for The ALICE HLT Project. *\ //* *\ //* Permission to use, copy, modify and distribute this software and its *\ //* documentation strictly for non-commercial purposes is hereby granted *\ //* without fee, provided that the above copyright notice appears in all *\ //* copies and that both the copyright notice and this permission notice *\ //* appear in the supporting documentation. The authors make no claims *\ //* about the suitability of this software for any purpose. It is *\ //* provided "as is" without express or implied warranty. *\ //************************************************************************** /// \file GPUChainTrackingClusterizer.cxx /// \author David Rohr #include "GPUChainTracking.h" #include "GPUChainTrackingDefs.h" #include "GPULogging.h" #include "GPUO2DataTypes.h" #include "GPUMemorySizeScalers.h" #include "GPUTrackingInputProvider.h" #include <fstream> #ifdef GPUCA_O2_LIB #include "CommonDataFormat/InteractionRecord.h" #endif #ifdef HAVE_O2HEADERS #include "GPUHostDataTypes.h" #include "GPUTPCCFChainContext.h" #include "GPURawData.h" #include "DataFormatsTPC/ZeroSuppression.h" #include "DetectorsRaw/RDHUtils.h" #include "DataFormatsTPC/Digit.h" #include "DataFormatsTPC/Constants.h" #else #include "GPUO2FakeClasses.h" #endif #include "utils/strtag.h" #ifndef GPUCA_NO_VC #include <Vc/Vc> #endif using namespace GPUCA_NAMESPACE::gpu; using namespace o2::tpc; using namespace o2::tpc::constants; using namespace o2::dataformats; #ifdef GPUCA_TPC_GEOMETRY_O2 std::pair<unsigned int, unsigned int> GPUChainTracking::TPCClusterizerDecodeZSCountUpdate(unsigned int iSlice, const CfFragment& fragment) { bool doGPU = mRec->GetRecoStepsGPU() & GPUDataTypes::RecoStep::TPCClusterFinding; GPUTPCClusterFinder& clusterer = processors()->tpcClusterer[iSlice]; GPUTPCClusterFinder::ZSOffset* o = processors()->tpcClusterer[iSlice].mPzsOffsets; unsigned int digits = 0; unsigned int pages = 0; for (unsigned short j = 0; j < GPUTrackingInOutZS::NENDPOINTS; j++) { clusterer.mMinMaxCN[j] = mCFContext->fragmentData[fragment.index].minMaxCN[iSlice][j]; if (doGPU) { unsigned short posInEndpoint = 0; unsigned short pagesEndpoint = 0; for (unsigned int k = clusterer.mMinMaxCN[j].minC; k < clusterer.mMinMaxCN[j].maxC; k++) { const unsigned int minL = (k == clusterer.mMinMaxCN[j].minC) ? clusterer.mMinMaxCN[j].minN : 0; const unsigned int maxL = (k + 1 == clusterer.mMinMaxCN[j].maxC) ? clusterer.mMinMaxCN[j].maxN : mIOPtrs.tpcZS->slice[iSlice].nZSPtr[j][k]; for (unsigned int l = minL; l < maxL; l++) { unsigned short pageDigits = mCFContext->fragmentData[fragment.index].pageDigits[iSlice][j][posInEndpoint++]; if (pageDigits) { *(o++) = GPUTPCClusterFinder::ZSOffset{digits, j, pagesEndpoint}; digits += pageDigits; } pagesEndpoint++; } } if (pagesEndpoint != mCFContext->fragmentData[fragment.index].pageDigits[iSlice][j].size()) { GPUFatal("TPC raw page count mismatch in TPCClusterizerDecodeZSCountUpdate: expected %d / buffered %lu", pagesEndpoint, mCFContext->fragmentData[fragment.index].pageDigits[iSlice][j].size()); } } else { clusterer.mPzsOffsets[j] = GPUTPCClusterFinder::ZSOffset{digits, j, 0}; digits += mCFContext->fragmentData[fragment.index].nDigits[iSlice][j]; pages += mCFContext->fragmentData[fragment.index].nPages[iSlice][j]; } } if (doGPU) { pages = o - processors()->tpcClusterer[iSlice].mPzsOffsets; } return {digits, pages}; } std::pair<unsigned int, unsigned int> GPUChainTracking::TPCClusterizerDecodeZSCount(unsigned int iSlice, const CfFragment& fragment) { mRec->getGeneralStepTimer(GeneralStep::Prepare).Start(); unsigned int nDigits = 0; unsigned int nPages = 0; bool doGPU = mRec->GetRecoStepsGPU() & GPUDataTypes::RecoStep::TPCClusterFinding; int firstHBF = (mIOPtrs.settingsTF && mIOPtrs.settingsTF->hasTfStartOrbit) ? mIOPtrs.settingsTF->tfStartOrbit : (mIOPtrs.tpcZS->slice[iSlice].count[0] && mIOPtrs.tpcZS->slice[iSlice].nZSPtr[0][0]) ? o2::raw::RDHUtils::getHeartBeatOrbit(*(const RAWDataHeaderGPU*)mIOPtrs.tpcZS->slice[iSlice].zsPtr[0][0]) : 0; for (unsigned short j = 0; j < GPUTrackingInOutZS::NENDPOINTS; j++) { #ifndef GPUCA_NO_VC if (GetProcessingSettings().prefetchTPCpageScan >= 3 && j < GPUTrackingInOutZS::NENDPOINTS - 1) { for (unsigned int k = 0; k < mIOPtrs.tpcZS->slice[iSlice].count[j + 1]; k++) { for (unsigned int l = 0; l < mIOPtrs.tpcZS->slice[iSlice].nZSPtr[j + 1][k]; l++) { Vc::Common::prefetchMid(((const unsigned char*)mIOPtrs.tpcZS->slice[iSlice].zsPtr[j + 1][k]) + l * TPCZSHDR::TPC_ZS_PAGE_SIZE); Vc::Common::prefetchMid(((const unsigned char*)mIOPtrs.tpcZS->slice[iSlice].zsPtr[j + 1][k]) + l * TPCZSHDR::TPC_ZS_PAGE_SIZE + sizeof(RAWDataHeaderGPU)); } } } #endif std::vector<std::pair<CfFragment, std::array<int, 5>>> fragments; fragments.reserve(mCFContext->nFragments); fragments.emplace_back(std::pair<CfFragment, std::array<int, 5>>{fragment, {0, 0, 0, 0, 0}}); for (unsigned int i = 1; i < mCFContext->nFragments; i++) { fragments.emplace_back(std::pair<CfFragment, std::array<int, 5>>{fragments.back().first.next(), {0, 0, 0, 0, 0}}); } unsigned int emptyPages = 0; unsigned int firstPossibleFragment = 0; for (unsigned int k = 0; k < mIOPtrs.tpcZS->slice[iSlice].count[j]; k++) { nPages += mIOPtrs.tpcZS->slice[iSlice].nZSPtr[j][k]; for (unsigned int l = 0; l < mIOPtrs.tpcZS->slice[iSlice].nZSPtr[j][k]; l++) { #ifndef GPUCA_NO_VC if (GetProcessingSettings().prefetchTPCpageScan >= 2 && l + 1 < mIOPtrs.tpcZS->slice[iSlice].nZSPtr[j][k]) { Vc::Common::prefetchForOneRead(((const unsigned char*)mIOPtrs.tpcZS->slice[iSlice].zsPtr[j][k]) + (l + 1) * TPCZSHDR::TPC_ZS_PAGE_SIZE); Vc::Common::prefetchForOneRead(((const unsigned char*)mIOPtrs.tpcZS->slice[iSlice].zsPtr[j][k]) + (l + 1) * TPCZSHDR::TPC_ZS_PAGE_SIZE + sizeof(RAWDataHeaderGPU)); } #endif const unsigned char* const page = ((const unsigned char*)mIOPtrs.tpcZS->slice[iSlice].zsPtr[j][k]) + l * TPCZSHDR::TPC_ZS_PAGE_SIZE; const RAWDataHeaderGPU* rdh = (const RAWDataHeaderGPU*)page; if (o2::raw::RDHUtils::getMemorySize(*rdh) == sizeof(RAWDataHeaderGPU)) { emptyPages++; continue; } const TPCZSHDR* const hdr = (const TPCZSHDR*)(page + sizeof(RAWDataHeaderGPU)); nDigits += hdr->nADCsamples; unsigned int timeBin = (hdr->timeOffset + (o2::raw::RDHUtils::getHeartBeatOrbit(*rdh) - firstHBF) * o2::constants::lhc::LHCMaxBunches) / LHCBCPERTIMEBIN; if (timeBin + hdr->nTimeBins > mCFContext->tpcMaxTimeBin) { mCFContext->tpcMaxTimeBin = timeBin + hdr->nTimeBins; } for (unsigned int f = firstPossibleFragment; f < mCFContext->nFragments; f++) { if (timeBin < (unsigned int)fragments[f].first.last()) { if ((unsigned int)fragments[f].first.first() <= timeBin + hdr->nTimeBins) { fragments[f].second[2] = k + 1; fragments[f].second[3] = l + 1; if (!fragments[f].second[4]) { fragments[f].second[4] = 1; fragments[f].second[0] = k; fragments[f].second[1] = l; } else if (emptyPages) { mCFContext->fragmentData[f].nPages[iSlice][j] += emptyPages; for (unsigned int m = 0; m < emptyPages; m++) { mCFContext->fragmentData[f].pageDigits[iSlice][j].emplace_back(0); } } mCFContext->fragmentData[f].nPages[iSlice][j]++; mCFContext->fragmentData[f].nDigits[iSlice][j] += hdr->nADCsamples; if (doGPU) { mCFContext->fragmentData[f].pageDigits[iSlice][j].emplace_back(hdr->nADCsamples); } } } else { firstPossibleFragment = f + 1; } } emptyPages = 0; } } for (unsigned int f = 0; f < mCFContext->nFragments; f++) { mCFContext->fragmentData[f].minMaxCN[iSlice][j].maxC = fragments[f].second[2]; mCFContext->fragmentData[f].minMaxCN[iSlice][j].minC = fragments[f].second[0]; mCFContext->fragmentData[f].minMaxCN[iSlice][j].maxN = fragments[f].second[3]; mCFContext->fragmentData[f].minMaxCN[iSlice][j].minN = fragments[f].second[1]; } } mCFContext->nPagesTotal += nPages; mCFContext->nPagesSector[iSlice] = nPages; mCFContext->nPagesSectorMax = std::max(mCFContext->nPagesSectorMax, nPages); unsigned int digitsFragment = 0; for (unsigned int i = 0; i < mCFContext->nFragments; i++) { unsigned int pages = 0; unsigned int digits = 0; for (unsigned short j = 0; j < GPUTrackingInOutZS::NENDPOINTS; j++) { pages += mCFContext->fragmentData[i].nPages[iSlice][j]; digits += mCFContext->fragmentData[i].nDigits[iSlice][j]; } mCFContext->nPagesFragmentMax = std::max(mCFContext->nPagesSectorMax, pages); digitsFragment = std::max(digitsFragment, digits); } mRec->getGeneralStepTimer(GeneralStep::Prepare).Stop(); return {nDigits, digitsFragment}; } void GPUChainTracking::RunTPCClusterizer_compactPeaks(GPUTPCClusterFinder& clusterer, GPUTPCClusterFinder& clustererShadow, int stage, bool doGPU, int lane) { auto& in = stage ? clustererShadow.mPpeakPositions : clustererShadow.mPpositions; auto& out = stage ? clustererShadow.mPfilteredPeakPositions : clustererShadow.mPpeakPositions; if (doGPU) { const unsigned int iSlice = clusterer.mISlice; auto& count = stage ? clusterer.mPmemory->counters.nPeaks : clusterer.mPmemory->counters.nPositions; std::vector<size_t> counts; unsigned int nSteps = clusterer.getNSteps(count); if (nSteps > clusterer.mNBufs) { GPUError("Clusterer buffers exceeded (%u > %u)", nSteps, (int)clusterer.mNBufs); exit(1); } size_t tmpCount = count; if (nSteps > 1) { for (unsigned int i = 1; i < nSteps; i++) { counts.push_back(tmpCount); if (i == 1) { runKernel<GPUTPCCFStreamCompaction, GPUTPCCFStreamCompaction::scanStart>(GetGrid(tmpCount, clusterer.mScanWorkGroupSize, lane), {iSlice}, {}, i, stage); } else { runKernel<GPUTPCCFStreamCompaction, GPUTPCCFStreamCompaction::scanUp>(GetGrid(tmpCount, clusterer.mScanWorkGroupSize, lane), {iSlice}, {}, i, tmpCount); } tmpCount = (tmpCount + clusterer.mScanWorkGroupSize - 1) / clusterer.mScanWorkGroupSize; } runKernel<GPUTPCCFStreamCompaction, GPUTPCCFStreamCompaction::scanTop>(GetGrid(tmpCount, clusterer.mScanWorkGroupSize, lane), {iSlice}, {}, nSteps, tmpCount); for (unsigned int i = nSteps - 1; i > 1; i--) { tmpCount = counts[i - 1]; runKernel<GPUTPCCFStreamCompaction, GPUTPCCFStreamCompaction::scanDown>(GetGrid(tmpCount - clusterer.mScanWorkGroupSize, clusterer.mScanWorkGroupSize, lane), {iSlice}, {}, i, clusterer.mScanWorkGroupSize, tmpCount); } } runKernel<GPUTPCCFStreamCompaction, GPUTPCCFStreamCompaction::compactDigits>(GetGrid(count, clusterer.mScanWorkGroupSize, lane), {iSlice}, {}, 1, stage, in, out); } else { auto& nOut = stage ? clusterer.mPmemory->counters.nClusters : clusterer.mPmemory->counters.nPeaks; auto& nIn = stage ? clusterer.mPmemory->counters.nPeaks : clusterer.mPmemory->counters.nPositions; size_t count = 0; for (size_t i = 0; i < nIn; i++) { if (clusterer.mPisPeak[i]) { out[count++] = in[i]; } } nOut = count; } } std::pair<unsigned int, unsigned int> GPUChainTracking::RunTPCClusterizer_transferZS(int iSlice, const CfFragment& fragment, int lane) { bool doGPU = GetRecoStepsGPU() & RecoStep::TPCClusterFinding; const auto& retVal = TPCClusterizerDecodeZSCountUpdate(iSlice, fragment); if (doGPU) { GPUTPCClusterFinder& clusterer = processors()->tpcClusterer[iSlice]; GPUTPCClusterFinder& clustererShadow = doGPU ? processorsShadow()->tpcClusterer[iSlice] : clusterer; unsigned int nPagesSector = 0; for (unsigned int j = 0; j < GPUTrackingInOutZS::NENDPOINTS; j++) { unsigned int nPages = 0; mInputsHost->mPzsMeta->slice[iSlice].zsPtr[j] = &mInputsShadow->mPzsPtrs[iSlice * GPUTrackingInOutZS::NENDPOINTS + j]; mInputsHost->mPzsPtrs[iSlice * GPUTrackingInOutZS::NENDPOINTS + j] = clustererShadow.mPzs + (nPagesSector + nPages) * TPCZSHDR::TPC_ZS_PAGE_SIZE; for (unsigned int k = clusterer.mMinMaxCN[j].minC; k < clusterer.mMinMaxCN[j].maxC; k++) { const unsigned int min = (k == clusterer.mMinMaxCN[j].minC) ? clusterer.mMinMaxCN[j].minN : 0; const unsigned int max = (k + 1 == clusterer.mMinMaxCN[j].maxC) ? clusterer.mMinMaxCN[j].maxN : mIOPtrs.tpcZS->slice[iSlice].nZSPtr[j][k]; if (max > min) { char* src = (char*)mIOPtrs.tpcZS->slice[iSlice].zsPtr[j][k] + min * TPCZSHDR::TPC_ZS_PAGE_SIZE; size_t size = o2::raw::RDHUtils::getMemorySize(*(const RAWDataHeaderGPU*)src); size = (max - min - 1) * TPCZSHDR::TPC_ZS_PAGE_SIZE + (size ? TPCZSHDR::TPC_ZS_PAGE_SIZE : size); GPUMemCpy(RecoStep::TPCClusterFinding, clustererShadow.mPzs + (nPagesSector + nPages) * TPCZSHDR::TPC_ZS_PAGE_SIZE, src, size, lane, true); } nPages += max - min; } mInputsHost->mPzsMeta->slice[iSlice].nZSPtr[j] = &mInputsShadow->mPzsSizes[iSlice * GPUTrackingInOutZS::NENDPOINTS + j]; mInputsHost->mPzsSizes[iSlice * GPUTrackingInOutZS::NENDPOINTS + j] = nPages; mInputsHost->mPzsMeta->slice[iSlice].count[j] = 1; nPagesSector += nPages; } GPUMemCpy(RecoStep::TPCClusterFinding, clustererShadow.mPzsOffsets, clusterer.mPzsOffsets, clusterer.mNMaxPages * sizeof(*clusterer.mPzsOffsets), lane, true); } return retVal; } int GPUChainTracking::RunTPCClusterizer_prepare(bool restorePointers) { if (restorePointers) { for (unsigned int iSlice = 0; iSlice < NSLICES; iSlice++) { processors()->tpcClusterer[iSlice].mPzsOffsets = mCFContext->ptrSave[iSlice].zsOffsetHost; processorsShadow()->tpcClusterer[iSlice].mPzsOffsets = mCFContext->ptrSave[iSlice].zsOffsetDevice; processorsShadow()->tpcClusterer[iSlice].mPzs = mCFContext->ptrSave[iSlice].zsDevice; } processorsShadow()->ioPtrs.clustersNative = mCFContext->ptrClusterNativeSave; return 0; } const auto& threadContext = GetThreadContext(); mRec->MemoryScalers()->nTPCdigits = 0; if (mCFContext == nullptr) { mCFContext.reset(new GPUTPCCFChainContext); } mCFContext->tpcMaxTimeBin = param().par.ContinuousTracking ? std::max<int>(param().par.continuousMaxTimeBin, TPC_MAX_FRAGMENT_LEN) : TPC_MAX_TIME_BIN_TRIGGERED; const CfFragment fragmentMax{(tpccf::TPCTime)mCFContext->tpcMaxTimeBin + 1, TPC_MAX_FRAGMENT_LEN}; mCFContext->prepare(mIOPtrs.tpcZS, fragmentMax); if (mIOPtrs.tpcZS) { unsigned int nDigitsFragment[NSLICES]; for (unsigned int iSlice = 0; iSlice < NSLICES; iSlice++) { if (mIOPtrs.tpcZS->slice[iSlice].count[0]) { const void* rdh = mIOPtrs.tpcZS->slice[iSlice].zsPtr[0][0]; if (rdh && o2::raw::RDHUtils::getVersion<o2::gpu::RAWDataHeaderGPU>() != o2::raw::RDHUtils::getVersion(rdh)) { GPUError("Data has invalid RDH version %d, %d required\n", o2::raw::RDHUtils::getVersion(rdh), o2::raw::RDHUtils::getVersion<o2::gpu::RAWDataHeaderGPU>()); return 1; } } #ifndef GPUCA_NO_VC if (GetProcessingSettings().prefetchTPCpageScan >= 1 && iSlice < NSLICES - 1) { for (unsigned int j = 0; j < GPUTrackingInOutZS::NENDPOINTS; j++) { for (unsigned int k = 0; k < mIOPtrs.tpcZS->slice[iSlice].count[j]; k++) { for (unsigned int l = 0; l < mIOPtrs.tpcZS->slice[iSlice].nZSPtr[j][k]; l++) { Vc::Common::prefetchFar(((const unsigned char*)mIOPtrs.tpcZS->slice[iSlice + 1].zsPtr[j][k]) + l * TPCZSHDR::TPC_ZS_PAGE_SIZE); Vc::Common::prefetchFar(((const unsigned char*)mIOPtrs.tpcZS->slice[iSlice + 1].zsPtr[j][k]) + l * TPCZSHDR::TPC_ZS_PAGE_SIZE + sizeof(RAWDataHeaderGPU)); } } } } #endif const auto& x = TPCClusterizerDecodeZSCount(iSlice, fragmentMax); nDigitsFragment[iSlice] = x.second; processors()->tpcClusterer[iSlice].mPmemory->counters.nDigits = x.first; mRec->MemoryScalers()->nTPCdigits += x.first; } for (unsigned int iSlice = 0; iSlice < NSLICES; iSlice++) { processors()->tpcClusterer[iSlice].SetNMaxDigits(processors()->tpcClusterer[iSlice].mPmemory->counters.nDigits, mCFContext->nPagesFragmentMax, nDigitsFragment[iSlice]); if (mRec->IsGPU()) { processorsShadow()->tpcClusterer[iSlice].SetNMaxDigits(processors()->tpcClusterer[iSlice].mPmemory->counters.nDigits, mCFContext->nPagesFragmentMax, nDigitsFragment[iSlice]); } if (mPipelineNotifyCtx && GetProcessingSettings().doublePipelineClusterizer) { mPipelineNotifyCtx->rec->AllocateRegisteredForeignMemory(processors()->tpcClusterer[iSlice].mZSOffsetId, mRec); mPipelineNotifyCtx->rec->AllocateRegisteredForeignMemory(processors()->tpcClusterer[iSlice].mZSId, mRec); } else { AllocateRegisteredMemory(processors()->tpcClusterer[iSlice].mZSOffsetId); AllocateRegisteredMemory(processors()->tpcClusterer[iSlice].mZSId); } } } else { for (unsigned int iSlice = 0; iSlice < NSLICES; iSlice++) { unsigned int nDigits = mIOPtrs.tpcPackedDigits->nTPCDigits[iSlice]; mRec->MemoryScalers()->nTPCdigits += nDigits; processors()->tpcClusterer[iSlice].SetNMaxDigits(nDigits, mCFContext->nPagesFragmentMax, nDigits); } } if (mIOPtrs.tpcZS) { GPUInfo("Event has %u 8kb TPC ZS pages, %lld digits", mCFContext->nPagesTotal, (long long int)mRec->MemoryScalers()->nTPCdigits); } else { GPUInfo("Event has %lld TPC Digits", (long long int)mRec->MemoryScalers()->nTPCdigits); } mCFContext->fragmentFirst = CfFragment{std::max<int>(mCFContext->tpcMaxTimeBin + 1, TPC_MAX_FRAGMENT_LEN), TPC_MAX_FRAGMENT_LEN}; for (int iSlice = 0; iSlice < GetProcessingSettings().nTPCClustererLanes && iSlice < NSLICES; iSlice++) { if (mIOPtrs.tpcZS && mCFContext->nPagesSector[iSlice]) { mCFContext->nextPos[iSlice] = RunTPCClusterizer_transferZS(iSlice, mCFContext->fragmentFirst, GetProcessingSettings().nTPCClustererLanes + iSlice); } } if (mPipelineNotifyCtx && GetProcessingSettings().doublePipelineClusterizer) { for (unsigned int iSlice = 0; iSlice < NSLICES; iSlice++) { mCFContext->ptrSave[iSlice].zsOffsetHost = processors()->tpcClusterer[iSlice].mPzsOffsets; mCFContext->ptrSave[iSlice].zsOffsetDevice = processorsShadow()->tpcClusterer[iSlice].mPzsOffsets; mCFContext->ptrSave[iSlice].zsDevice = processorsShadow()->tpcClusterer[iSlice].mPzs; } } return 0; } #endif int GPUChainTracking::RunTPCClusterizer(bool synchronizeOutput) { if (param().rec.fwdTPCDigitsAsClusters) { return ForwardTPCDigits(); } #ifdef GPUCA_TPC_GEOMETRY_O2 mRec->PushNonPersistentMemory(qStr2Tag("TPCCLUST")); const auto& threadContext = GetThreadContext(); bool doGPU = GetRecoStepsGPU() & RecoStep::TPCClusterFinding; if (RunTPCClusterizer_prepare(mPipelineNotifyCtx && GetProcessingSettings().doublePipelineClusterizer)) { return 1; } if (GetProcessingSettings().ompAutoNThreads && !mRec->IsGPU()) { mRec->SetNOMPThreads(mRec->MemoryScalers()->nTPCdigits / 20000); } for (unsigned int iSlice = 0; iSlice < NSLICES; iSlice++) { processors()->tpcClusterer[iSlice].SetMaxData(mIOPtrs); // First iteration to set data sizes } mRec->ComputeReuseMax(nullptr); // Resolve maximums for shared buffers for (unsigned int iSlice = 0; iSlice < NSLICES; iSlice++) { SetupGPUProcessor(&processors()->tpcClusterer[iSlice], true); // Now we allocate } if (mPipelineNotifyCtx && GetProcessingSettings().doublePipelineClusterizer) { RunTPCClusterizer_prepare(true); // Restore some pointers, allocated by the other pipeline, and set to 0 by SetupGPUProcessor (since not allocated in this pipeline) } if (doGPU && mIOPtrs.tpcZS) { processorsShadow()->ioPtrs.tpcZS = mInputsShadow->mPzsMeta; WriteToConstantMemory(RecoStep::TPCClusterFinding, (char*)&processors()->ioPtrs - (char*)processors(), &processorsShadow()->ioPtrs, sizeof(processorsShadow()->ioPtrs), mRec->NStreams() - 1); } if (doGPU) { WriteToConstantMemory(RecoStep::TPCClusterFinding, (char*)processors()->tpcClusterer - (char*)processors(), processorsShadow()->tpcClusterer, sizeof(GPUTPCClusterFinder) * NSLICES, mRec->NStreams() - 1, &mEvents->init); } size_t nClsTotal = 0; ClusterNativeAccess* tmpNative = mClusterNativeAccess.get(); // setup MC Labels bool propagateMCLabels = GetProcessingSettings().runMC && processors()->ioPtrs.tpcPackedDigits && processors()->ioPtrs.tpcPackedDigits->tpcDigitsMC; auto* digitsMC = propagateMCLabels ? processors()->ioPtrs.tpcPackedDigits->tpcDigitsMC : nullptr; if (param().par.continuousMaxTimeBin > 0 && mCFContext->tpcMaxTimeBin >= (unsigned int)std::max(param().par.continuousMaxTimeBin + 1, TPC_MAX_FRAGMENT_LEN)) { GPUError("Input data has invalid time bin %u > %d\n", mCFContext->tpcMaxTimeBin, std::max(param().par.continuousMaxTimeBin + 1, TPC_MAX_FRAGMENT_LEN)); return 1; } bool buildNativeGPU = (mRec->GetRecoStepsGPU() & GPUDataTypes::RecoStep::TPCConversion) || (mRec->GetRecoStepsGPU() & GPUDataTypes::RecoStep::TPCSliceTracking) || (mRec->GetRecoStepsGPU() & GPUDataTypes::RecoStep::TPCMerging) || (mRec->GetRecoStepsGPU() & GPUDataTypes::RecoStep::TPCCompression); bool buildNativeHost = mRec->GetRecoStepsOutputs() & GPUDataTypes::InOutType::TPCClusters; // TODO: Should do this also when clusters are needed for later steps on the host but not requested as output mRec->MemoryScalers()->nTPCHits = mRec->MemoryScalers()->NTPCClusters(mRec->MemoryScalers()->nTPCdigits); mInputsHost->mNClusterNative = mInputsShadow->mNClusterNative = mRec->MemoryScalers()->nTPCHits; if (buildNativeGPU) { AllocateRegisteredMemory(mInputsHost->mResourceClusterNativeBuffer); } if (buildNativeHost && !(buildNativeGPU && GetProcessingSettings().delayedOutput)) { AllocateRegisteredMemory(mInputsHost->mResourceClusterNativeOutput, mSubOutputControls[GPUTrackingOutputs::getIndex(&GPUTrackingOutputs::clustersNative)]); } GPUTPCLinearLabels mcLinearLabels; if (propagateMCLabels) { // No need to overallocate here, nTPCHits is anyway an upper bound used for the GPU cluster buffer, and we can always enlarge the buffer anyway mcLinearLabels.header.reserve(mRec->MemoryScalers()->nTPCHits / 2); mcLinearLabels.data.reserve(mRec->MemoryScalers()->nTPCHits); } char transferRunning[NSLICES] = {0}; unsigned int outputQueueStart = mOutputQueue.size(); for (unsigned int iSliceBase = 0; iSliceBase < NSLICES; iSliceBase += GetProcessingSettings().nTPCClustererLanes) { std::vector<bool> laneHasData(GetProcessingSettings().nTPCClustererLanes, false); for (CfFragment fragment = mCFContext->fragmentFirst; !fragment.isEnd(); fragment = fragment.next()) { if (GetProcessingSettings().debugLevel >= 3) { GPUInfo("Processing time bins [%d, %d) for sectors %d to %d", fragment.start, fragment.last(), iSliceBase, iSliceBase + GetProcessingSettings().nTPCClustererLanes - 1); } for (int lane = 0; lane < GetProcessingSettings().nTPCClustererLanes && iSliceBase + lane < NSLICES; lane++) { if (fragment.index != 0) { SynchronizeStream(lane); // Don't overwrite charge map from previous iteration until cluster computation is finished } unsigned int iSlice = iSliceBase + lane; GPUTPCClusterFinder& clusterer = processors()->tpcClusterer[iSlice]; GPUTPCClusterFinder& clustererShadow = doGPU ? processorsShadow()->tpcClusterer[iSlice] : clusterer; clusterer.mPmemory->counters.nPeaks = clusterer.mPmemory->counters.nClusters = 0; clusterer.mPmemory->fragment = fragment; if (propagateMCLabels && fragment.index == 0) { clusterer.PrepareMC(); clusterer.mPinputLabels = digitsMC->v[iSlice]; // TODO: Why is the number of header entries in truth container // sometimes larger than the number of digits? assert(clusterer.mPinputLabels->getIndexedSize() >= mIOPtrs.tpcPackedDigits->nTPCDigits[iSlice]); } if (mIOPtrs.tpcPackedDigits) { bool setDigitsOnGPU = doGPU && not mIOPtrs.tpcZS; bool setDigitsOnHost = (not doGPU && not mIOPtrs.tpcZS) || propagateMCLabels; auto* inDigits = mIOPtrs.tpcPackedDigits; size_t numDigits = inDigits->nTPCDigits[iSlice]; if (setDigitsOnGPU) { GPUMemCpy(RecoStep::TPCClusterFinding, clustererShadow.mPdigits, inDigits->tpcDigits[iSlice], sizeof(clustererShadow.mPdigits[0]) * numDigits, lane, true); clusterer.mPmemory->counters.nDigits = numDigits; } else if (setDigitsOnHost) { clusterer.mPdigits = const_cast<o2::tpc::Digit*>(inDigits->tpcDigits[iSlice]); // TODO: Needs fixing (invalid const cast) clusterer.mPmemory->counters.nDigits = numDigits; } } if (mIOPtrs.tpcZS) { if (mCFContext->nPagesSector[iSlice]) { clusterer.mPmemory->counters.nPositions = mCFContext->nextPos[iSlice].first; clusterer.mPmemory->counters.nPagesSubslice = mCFContext->nextPos[iSlice].second; } else { clusterer.mPmemory->counters.nPositions = clusterer.mPmemory->counters.nPagesSubslice = 0; } } TransferMemoryResourceLinkToGPU(RecoStep::TPCClusterFinding, clusterer.mMemoryId, lane); using ChargeMapType = decltype(*clustererShadow.mPchargeMap); using PeakMapType = decltype(*clustererShadow.mPpeakMap); runKernel<GPUMemClean16>(GetGridAutoStep(lane, RecoStep::TPCClusterFinding), krnlRunRangeNone, {}, clustererShadow.mPchargeMap, TPCMapMemoryLayout<ChargeMapType>::items() * sizeof(ChargeMapType)); runKernel<GPUMemClean16>(GetGridAutoStep(lane, RecoStep::TPCClusterFinding), krnlRunRangeNone, {}, clustererShadow.mPpeakMap, TPCMapMemoryLayout<PeakMapType>::items() * sizeof(PeakMapType)); if (fragment.index == 0) { using HasLostBaselineType = decltype(*clustererShadow.mPpadHasLostBaseline); runKernel<GPUMemClean16>(GetGridAutoStep(lane, RecoStep::TPCClusterFinding), krnlRunRangeNone, {}, clustererShadow.mPpadHasLostBaseline, TPC_PADS_IN_SECTOR * sizeof(HasLostBaselineType)); } DoDebugAndDump(RecoStep::TPCClusterFinding, 0, clusterer, &GPUTPCClusterFinder::DumpChargeMap, *mDebugFile, "Zeroed Charges"); if (mIOPtrs.tpcZS && mCFContext->nPagesSector[iSlice]) { TransferMemoryResourceLinkToGPU(RecoStep::TPCClusterFinding, mInputsHost->mResourceZS, lane); SynchronizeStream(GetProcessingSettings().nTPCClustererLanes + lane); } SynchronizeStream(mRec->NStreams() - 1); // Wait for copying to constant memory if (mIOPtrs.tpcZS && !mCFContext->nPagesSector[iSlice]) { continue; } if (not mIOPtrs.tpcZS) { runKernel<GPUTPCCFChargeMapFiller, GPUTPCCFChargeMapFiller::findFragmentStart>(GetGrid(1, lane), {iSlice}, {}, mIOPtrs.tpcZS == nullptr); TransferMemoryResourceLinkToHost(RecoStep::TPCClusterFinding, clusterer.mMemoryId, lane); } else if (propagateMCLabels) { runKernel<GPUTPCCFChargeMapFiller, GPUTPCCFChargeMapFiller::findFragmentStart>(GetGrid(1, lane, GPUReconstruction::krnlDeviceType::CPU), {iSlice}, {}, mIOPtrs.tpcZS == nullptr); TransferMemoryResourceLinkToGPU(RecoStep::TPCClusterFinding, clusterer.mMemoryId, lane); } if (mIOPtrs.tpcZS) { int firstHBF = (mIOPtrs.settingsTF && mIOPtrs.settingsTF->hasTfStartOrbit) ? mIOPtrs.settingsTF->tfStartOrbit : (mIOPtrs.tpcZS->slice[iSlice].count[0] && mIOPtrs.tpcZS->slice[iSlice].nZSPtr[0][0]) ? o2::raw::RDHUtils::getHeartBeatOrbit(*(const RAWDataHeaderGPU*)mIOPtrs.tpcZS->slice[iSlice].zsPtr[0][0]) : 0; runKernel<GPUTPCCFDecodeZS, GPUTPCCFDecodeZS::decodeZS>(GetGridBlk(doGPU ? clusterer.mPmemory->counters.nPagesSubslice : GPUTrackingInOutZS::NENDPOINTS, lane), {iSlice}, {}, firstHBF); TransferMemoryResourceLinkToHost(RecoStep::TPCClusterFinding, clusterer.mMemoryId, lane); } } for (int lane = 0; lane < GetProcessingSettings().nTPCClustererLanes && iSliceBase + lane < NSLICES; lane++) { unsigned int iSlice = iSliceBase + lane; SynchronizeStream(lane); if (mIOPtrs.tpcZS) { CfFragment f = fragment.next(); int nextSlice = iSlice; if (f.isEnd()) { nextSlice += GetProcessingSettings().nTPCClustererLanes; f = mCFContext->fragmentFirst; } if (nextSlice < NSLICES && mIOPtrs.tpcZS && mCFContext->nPagesSector[nextSlice]) { mCFContext->nextPos[nextSlice] = RunTPCClusterizer_transferZS(nextSlice, f, GetProcessingSettings().nTPCClustererLanes + lane); } } GPUTPCClusterFinder& clusterer = processors()->tpcClusterer[iSlice]; GPUTPCClusterFinder& clustererShadow = doGPU ? processorsShadow()->tpcClusterer[iSlice] : clusterer; if (clusterer.mPmemory->counters.nPositions == 0) { continue; } if (!mIOPtrs.tpcZS) { runKernel<GPUTPCCFChargeMapFiller, GPUTPCCFChargeMapFiller::fillFromDigits>(GetGrid(clusterer.mPmemory->counters.nPositions, lane), {iSlice}, {}); } if (DoDebugAndDump(RecoStep::TPCClusterFinding, 0, clusterer, &GPUTPCClusterFinder::DumpDigits, *mDebugFile)) { clusterer.DumpChargeMap(*mDebugFile, "Charges"); } if (propagateMCLabels) { runKernel<GPUTPCCFChargeMapFiller, GPUTPCCFChargeMapFiller::fillIndexMap>(GetGrid(clusterer.mPmemory->counters.nDigitsInFragment, lane, GPUReconstruction::krnlDeviceType::CPU), {iSlice}, {}); } bool checkForNoisyPads = (rec()->GetParam().rec.maxTimeBinAboveThresholdIn1000Bin > 0) || (rec()->GetParam().rec.maxConsecTimeBinAboveThreshold > 0); checkForNoisyPads &= (rec()->GetParam().rec.noisyPadsQuickCheck ? fragment.index == 0 : true); if (checkForNoisyPads) { int nBlocks = TPC_PADS_IN_SECTOR / GPUTPCCFCheckPadBaseline::PadsPerCacheline; runKernel<GPUTPCCFCheckPadBaseline>(GetGridBlk(nBlocks, lane), {iSlice}, {}); } runKernel<GPUTPCCFPeakFinder>(GetGrid(clusterer.mPmemory->counters.nPositions, lane), {iSlice}, {}); DoDebugAndDump(RecoStep::TPCClusterFinding, 0, clusterer, &GPUTPCClusterFinder::DumpPeaks, *mDebugFile); RunTPCClusterizer_compactPeaks(clusterer, clustererShadow, 0, doGPU, lane); TransferMemoryResourceLinkToHost(RecoStep::TPCClusterFinding, clusterer.mMemoryId, lane); DoDebugAndDump(RecoStep::TPCClusterFinding, 0, clusterer, &GPUTPCClusterFinder::DumpPeaksCompacted, *mDebugFile); } for (int lane = 0; lane < GetProcessingSettings().nTPCClustererLanes && iSliceBase + lane < NSLICES; lane++) { unsigned int iSlice = iSliceBase + lane; GPUTPCClusterFinder& clusterer = processors()->tpcClusterer[iSlice]; GPUTPCClusterFinder& clustererShadow = doGPU ? processorsShadow()->tpcClusterer[iSlice] : clusterer; SynchronizeStream(lane); if (clusterer.mPmemory->counters.nPeaks == 0) { continue; } runKernel<GPUTPCCFNoiseSuppression, GPUTPCCFNoiseSuppression::noiseSuppression>(GetGrid(clusterer.mPmemory->counters.nPeaks, lane), {iSlice}, {}); runKernel<GPUTPCCFNoiseSuppression, GPUTPCCFNoiseSuppression::updatePeaks>(GetGrid(clusterer.mPmemory->counters.nPeaks, lane), {iSlice}, {}); DoDebugAndDump(RecoStep::TPCClusterFinding, 0, clusterer, &GPUTPCClusterFinder::DumpSuppressedPeaks, *mDebugFile); RunTPCClusterizer_compactPeaks(clusterer, clustererShadow, 1, doGPU, lane); TransferMemoryResourceLinkToHost(RecoStep::TPCClusterFinding, clusterer.mMemoryId, lane); DoDebugAndDump(RecoStep::TPCClusterFinding, 0, clusterer, &GPUTPCClusterFinder::DumpSuppressedPeaksCompacted, *mDebugFile); } for (int lane = 0; lane < GetProcessingSettings().nTPCClustererLanes && iSliceBase + lane < NSLICES; lane++) { unsigned int iSlice = iSliceBase + lane; GPUTPCClusterFinder& clusterer = processors()->tpcClusterer[iSlice]; GPUTPCClusterFinder& clustererShadow = doGPU ? processorsShadow()->tpcClusterer[iSlice] : clusterer; SynchronizeStream(lane); if (fragment.index == 0) { runKernel<GPUMemClean16>(GetGridAutoStep(lane, RecoStep::TPCClusterFinding), krnlRunRangeNone, {nullptr, transferRunning[lane] == 1 ? &mEvents->stream[lane] : nullptr}, clustererShadow.mPclusterInRow, GPUCA_ROW_COUNT * sizeof(*clustererShadow.mPclusterInRow)); transferRunning[lane] = 2; } if (clusterer.mPmemory->counters.nClusters == 0) { continue; } runKernel<GPUTPCCFDeconvolution>(GetGrid(clusterer.mPmemory->counters.nPositions, lane), {iSlice}, {}); DoDebugAndDump(RecoStep::TPCClusterFinding, 0, clusterer, &GPUTPCClusterFinder::DumpChargeMap, *mDebugFile, "Split Charges"); runKernel<GPUTPCCFClusterizer>(GetGrid(clusterer.mPmemory->counters.nClusters, lane), {iSlice}, {}, 0); if (doGPU && propagateMCLabels) { TransferMemoryResourceLinkToHost(RecoStep::TPCClusterFinding, clusterer.mScratchId, lane); SynchronizeStream(lane); runKernel<GPUTPCCFClusterizer>(GetGrid(clusterer.mPmemory->counters.nClusters, lane, GPUReconstruction::krnlDeviceType::CPU), {iSlice}, {}, 1); } if (GetProcessingSettings().debugLevel >= 3) { GPUInfo("Lane %d: Found clusters: digits %u peaks %u clusters %u", lane, (int)clusterer.mPmemory->counters.nPositions, (int)clusterer.mPmemory->counters.nPeaks, (int)clusterer.mPmemory->counters.nClusters); } TransferMemoryResourcesToHost(RecoStep::TPCClusterFinding, &clusterer, lane); laneHasData[lane] = true; if (DoDebugAndDump(RecoStep::TPCClusterFinding, 0, clusterer, &GPUTPCClusterFinder::DumpCountedPeaks, *mDebugFile)) { clusterer.DumpClusters(*mDebugFile); } } } size_t nClsFirst = nClsTotal; bool anyLaneHasData = false; for (int lane = 0; lane < GetProcessingSettings().nTPCClustererLanes && iSliceBase + lane < NSLICES; lane++) { unsigned int iSlice = iSliceBase + lane; std::fill(&tmpNative->nClusters[iSlice][0], &tmpNative->nClusters[iSlice][0] + MAXGLOBALPADROW, 0); SynchronizeStream(lane); GPUTPCClusterFinder& clusterer = processors()->tpcClusterer[iSlice]; GPUTPCClusterFinder& clustererShadow = doGPU ? processorsShadow()->tpcClusterer[iSlice] : clusterer; if (laneHasData[lane]) { anyLaneHasData = true; if (buildNativeGPU && GetProcessingSettings().tpccfGatherKernel) { runKernel<GPUTPCCFGather>(GetGridBlk(GPUCA_ROW_COUNT, mRec->NStreams() - 1), {iSlice}, {}, &mInputsShadow->mPclusterNativeBuffer[nClsTotal]); } for (unsigned int j = 0; j < GPUCA_ROW_COUNT; j++) { if (buildNativeGPU) { if (!GetProcessingSettings().tpccfGatherKernel) { GPUMemCpyAlways(RecoStep::TPCClusterFinding, (void*)&mInputsShadow->mPclusterNativeBuffer[nClsTotal], (const void*)&clustererShadow.mPclusterByRow[j * clusterer.mNMaxClusterPerRow], sizeof(mIOPtrs.clustersNative->clustersLinear[0]) * clusterer.mPclusterInRow[j], mRec->NStreams() - 1, -2); } } else if (buildNativeHost) { GPUMemCpyAlways(RecoStep::TPCClusterFinding, (void*)&mInputsHost->mPclusterNativeOutput[nClsTotal], (const void*)&clustererShadow.mPclusterByRow[j * clusterer.mNMaxClusterPerRow], sizeof(mIOPtrs.clustersNative->clustersLinear[0]) * clusterer.mPclusterInRow[j], mRec->NStreams() - 1, false); } tmpNative->nClusters[iSlice][j] += clusterer.mPclusterInRow[j]; nClsTotal += clusterer.mPclusterInRow[j]; } if (transferRunning[lane]) { ReleaseEvent(&mEvents->stream[lane]); } RecordMarker(&mEvents->stream[lane], mRec->NStreams() - 1); transferRunning[lane] = 1; } if (not propagateMCLabels || not laneHasData[lane]) { assert(propagateMCLabels ? mcLinearLabels.header.size() == nClsTotal : true); continue; } runKernel<GPUTPCCFMCLabelFlattener, GPUTPCCFMCLabelFlattener::setRowOffsets>(GetGrid(GPUCA_ROW_COUNT, lane, GPUReconstruction::krnlDeviceType::CPU), {iSlice}, {}); GPUTPCCFMCLabelFlattener::setGlobalOffsetsAndAllocate(clusterer, mcLinearLabels); runKernel<GPUTPCCFMCLabelFlattener, GPUTPCCFMCLabelFlattener::flatten>(GetGrid(GPUCA_ROW_COUNT, lane, GPUReconstruction::krnlDeviceType::CPU), {iSlice}, {}, &mcLinearLabels); clusterer.clearMCMemory(); assert(propagateMCLabels ? mcLinearLabels.header.size() == nClsTotal : true); } if (buildNativeHost && buildNativeGPU && anyLaneHasData) { if (GetProcessingSettings().delayedOutput) { mOutputQueue.emplace_back(outputQueueEntry{(void*)((char*)&mInputsHost->mPclusterNativeOutput[nClsFirst] - (char*)&mInputsHost->mPclusterNativeOutput[0]), &mInputsShadow->mPclusterNativeBuffer[nClsFirst], (nClsTotal - nClsFirst) * sizeof(mInputsHost->mPclusterNativeOutput[nClsFirst]), RecoStep::TPCClusterFinding}); } else { GPUMemCpy(RecoStep::TPCClusterFinding, (void*)&mInputsHost->mPclusterNativeOutput[nClsFirst], (void*)&mInputsShadow->mPclusterNativeBuffer[nClsFirst], (nClsTotal - nClsFirst) * sizeof(mInputsHost->mPclusterNativeOutput[nClsFirst]), mRec->NStreams() - 1, false); } } } for (int i = 0; i < GetProcessingSettings().nTPCClustererLanes; i++) { if (transferRunning[i]) { ReleaseEvent(&mEvents->stream[i]); } } ClusterNativeAccess::ConstMCLabelContainerView* mcLabelsConstView = nullptr; if (propagateMCLabels) { // TODO: write to buffer directly o2::dataformats::MCTruthContainer<o2::MCCompLabel> mcLabels; std::pair<ConstMCLabelContainer*, ConstMCLabelContainerView*> buffer; if (mSubOutputControls[GPUTrackingOutputs::getIndex(&GPUTrackingOutputs::clusterLabels)] && mSubOutputControls[GPUTrackingOutputs::getIndex(&GPUTrackingOutputs::clusterLabels)]->useExternal()) { if (!mSubOutputControls[GPUTrackingOutputs::getIndex(&GPUTrackingOutputs::clusterLabels)]->allocator) { throw std::runtime_error("Cluster MC Label buffer missing"); } ClusterNativeAccess::ConstMCLabelContainerViewWithBuffer* container = reinterpret_cast<ClusterNativeAccess::ConstMCLabelContainerViewWithBuffer*>(mSubOutputControls[GPUTrackingOutputs::getIndex(&GPUTrackingOutputs::clusterLabels)]->allocator(0)); buffer = {&container->first, &container->second}; } else { mIOMem.clusterNativeMCView = std::make_unique<ConstMCLabelContainerView>(); mIOMem.clusterNativeMCBuffer = std::make_unique<ConstMCLabelContainer>(); buffer.first = mIOMem.clusterNativeMCBuffer.get(); buffer.second = mIOMem.clusterNativeMCView.get(); } assert(propagateMCLabels ? mcLinearLabels.header.size() == nClsTotal : true); assert(propagateMCLabels ? mcLinearLabels.data.size() >= nClsTotal : true); mcLabels.setFrom(mcLinearLabels.header, mcLinearLabels.data); mcLabels.flatten_to(*buffer.first); *buffer.second = *buffer.first; mcLabelsConstView = buffer.second; } if (buildNativeHost && buildNativeGPU && GetProcessingSettings().delayedOutput) { mInputsHost->mNClusterNative = mInputsShadow->mNClusterNative = nClsTotal; AllocateRegisteredMemory(mInputsHost->mResourceClusterNativeOutput, mSubOutputControls[GPUTrackingOutputs::getIndex(&GPUTrackingOutputs::clustersNative)]); for (unsigned int i = outputQueueStart; i < mOutputQueue.size(); i++) { mOutputQueue[i].dst = (char*)mInputsHost->mPclusterNativeOutput + (size_t)mOutputQueue[i].dst; } } if (buildNativeHost) { tmpNative->clustersLinear = mInputsHost->mPclusterNativeOutput; tmpNative->clustersMCTruth = mcLabelsConstView; tmpNative->setOffsetPtrs(); mIOPtrs.clustersNative = tmpNative; } if (mPipelineNotifyCtx) { SynchronizeStream(mRec->NStreams() - 2); // Must finish before updating ioPtrs in (global) constant memory std::lock_guard<std::mutex> lock(mPipelineNotifyCtx->mutex); mPipelineNotifyCtx->ready = true; mPipelineNotifyCtx->cond.notify_one(); } if (buildNativeGPU) { processorsShadow()->ioPtrs.clustersNative = mInputsShadow->mPclusterNativeAccess; WriteToConstantMemory(RecoStep::TPCClusterFinding, (char*)&processors()->ioPtrs - (char*)processors(), &processorsShadow()->ioPtrs, sizeof(processorsShadow()->ioPtrs), 0); *mInputsHost->mPclusterNativeAccess = *mIOPtrs.clustersNative; mInputsHost->mPclusterNativeAccess->clustersLinear = mInputsShadow->mPclusterNativeBuffer; mInputsHost->mPclusterNativeAccess->setOffsetPtrs(); TransferMemoryResourceLinkToGPU(RecoStep::TPCClusterFinding, mInputsHost->mResourceClusterNativeAccess, 0); } if (synchronizeOutput) { SynchronizeStream(mRec->NStreams() - 1); } if (buildNativeHost && GetProcessingSettings().debugLevel >= 4) { for (unsigned int i = 0; i < NSLICES; i++) { for (unsigned int j = 0; j < GPUCA_ROW_COUNT; j++) { std::sort(&mInputsHost->mPclusterNativeOutput[tmpNative->clusterOffset[i][j]], &mInputsHost->mPclusterNativeOutput[tmpNative->clusterOffset[i][j] + tmpNative->nClusters[i][j]]); } } } mRec->MemoryScalers()->nTPCHits = nClsTotal; mRec->PopNonPersistentMemory(RecoStep::TPCClusterFinding, qStr2Tag("TPCCLUST")); if (mPipelineNotifyCtx) { mRec->UnblockStackedMemory(); mPipelineNotifyCtx = nullptr; } #endif return 0; }
56.99867
324
0.692812
chengtt0406
4d7d0b621b983938ef3adab9603ba34038e58855
142
cc
C++
test/db/data/multi-module/lib.cc
0x8000-0000/ftags
ea751257f7930936b63f1471cae81407a09ea707
[ "Apache-2.0" ]
2
2019-01-15T22:50:42.000Z
2019-01-29T16:31:16.000Z
test/db/data/multi-module/lib.cc
0x8000-0000/ftags
ea751257f7930936b63f1471cae81407a09ea707
[ "Apache-2.0" ]
null
null
null
test/db/data/multi-module/lib.cc
0x8000-0000/ftags
ea751257f7930936b63f1471cae81407a09ea707
[ "Apache-2.0" ]
null
null
null
#include "lib.h" int test::function(int arg) { if (arg % 2) { return 3 * arg + 1; } else { return arg / 2; } }
10.142857
27
0.443662
0x8000-0000
4d7f93f0016f329758d5450b3ab9c7024a88d65b
1,035
cpp
C++
src/State.cpp
Speedy-code13/Shawarma.is-SFML-2022
904359317eef4fb90df32db961dfcb3819287bbb
[ "Apache-2.0" ]
null
null
null
src/State.cpp
Speedy-code13/Shawarma.is-SFML-2022
904359317eef4fb90df32db961dfcb3819287bbb
[ "Apache-2.0" ]
null
null
null
src/State.cpp
Speedy-code13/Shawarma.is-SFML-2022
904359317eef4fb90df32db961dfcb3819287bbb
[ "Apache-2.0" ]
null
null
null
#include "pch.h" #include "State.h" State::State(StateData* stateData) : resolution(stateData->gfx->resolution), stateData(stateData) { this->window = this->stateData->window; this->dt = this->stateData->dt; this->states = this->stateData->states; this->quit = false; this->updatedRes = false; this->keytimeMax = 10.f; this->keytime = keytimeMax; } void State::updateKeytime() { if (this->keytime <= keytimeMax) this->keytime += 50.f * (*dt); } const bool State::getQuit() const { return this->quit; } const bool State::getUpdatedRes() const { return this->updatedRes; } void State::endState() { this->quit = true; } const bool State::getKeytime() { if (this->keytime >= this->keytimeMax) { this->keytime = 0.f; return true; } return false; } void State::updateMousePositions() { this->mousePosScreen = sf::Mouse::getPosition(); this->mousePosWindow = sf::Mouse::getPosition(*this->window); this->mousePosView = this->window->mapPixelToCoords(sf::Mouse::getPosition(*this->window)); }
16.693548
92
0.675362
Speedy-code13
4d8034c64400950d7b8e6b00e08fd4214d510e6b
4,576
cxx
C++
minisw/minisw.cxx
trotill/11parts_CPP
53a69d516fdcb5c92b591b5dadc49dfdd2a3b26b
[ "MIT" ]
null
null
null
minisw/minisw.cxx
trotill/11parts_CPP
53a69d516fdcb5c92b591b5dadc49dfdd2a3b26b
[ "MIT" ]
null
null
null
minisw/minisw.cxx
trotill/11parts_CPP
53a69d516fdcb5c92b591b5dadc49dfdd2a3b26b
[ "MIT" ]
null
null
null
#include "engine/minisw/minisw.h" #include "engine/lib/11p_string.h" eErrorTp MiniSW_Run(int argc,char *argv[],string SWname) { //printf("run %s\n",SWname.c_str()); if (SWname.compare(USB_RESET_SW)==0) { usb_reset_main(argc,argv); } if (SWname.compare(IMAGE_CHECK)==0) { imcheck_main(argc,argv); } if (SWname.compare(CNODA_PROCESS_NAME)==0) { EventSender(argc,argv,SWname); } if (SWname.compare(WDT_PROCESS_NAME)==0) { EventSender(argc,argv,SWname); } if (SWname.compare(NODE_PROCESS_NAME)==0) { EventSender(argc,argv,SWname); } #ifdef _SNMP if (SWname.compare(SNMP_AGENT)==0) { snmp_main(argc,argv); } #endif if (SWname.compare(LOAD_SETTINGS_PROCESS_NAME)==0) { load_settings(argc,argv); } if (SWname.compare(SAVE_SETTINGS_PROCESS_NAME)==0) { save_settings(argc,argv); } if (SWname.compare(SETTINGS_CLEAN_PROCESS_NAME)==0) { settings_clean_main(argc,argv); } if (SWname.compare(SETTINGS_GET_PRIVATE)==0) { settings_private(argc,argv); } if (SWname.compare(TO_FACTORY)==0) { to_factory(argc,argv); } // //zr(); #ifdef _SAFE_LOGGER if (SWname.compare(SAFE_LOGGER_FW)==0) { //zr(); safe_logger(argc,argv); } #endif return NO_ERROR; } EvSender::EvSender(string & ToProcess,char * event, char * args,int method,int packtype) { debug_level=NO_USE; u16 ToPort=0; if (ToProcess.compare(WDT_PROCESS_NAME)==0) { ToPort=CnT->WDT_PORT_NODEJS; } else { if (ToProcess.compare(NODE_PROCESS_NAME)==0) { ToPort=CnT->NODE_PORT_NODEJS; } else { if (ToProcess.compare(CNODA_PROCESS_NAME)==0) { ToPort=CnT->NODE_PORT_CPP; } else { GPRINT(NORMAL_LEVEL,"Incorrect port, Error send Event %s(%s)\n",event,args); exit(1); } } } GPRINT(NORMAL_LEVEL,"Send from port %d to port %d\n",htons(CnT->WDT_PORT_CPP),htons(ToPort)); if (InitLHBus(CnT->WDT_PORT_CPP,ToPort,(char*)CnT->NODE_GROUP_IP.c_str())==NO_ERROR) { stringstream SendBuf; if (strlen(args)!=0){ if (method==EV_SENDER_METHOD_EVENT) { SendBuf<< "{\"t\":["<< packtype <<","<< JSON_PACK_HEADER_VERSION << "],\"d\":{\"" << event << "\":" << args << "}}"; } if (method==EV_SENDER_METHOD_RAW) { SendBuf<< "{\"t\":["<< packtype <<","<< JSON_PACK_HEADER_VERSION << "],\"d\":" << event << args <<"}"; } } else{ SendBuf<< event; } SockSendToLH_Bus((char*)SendBuf.str().c_str(), SendBuf.str().length()); GPRINT(NORMAL_LEVEL,"Send Event %s(%s) %s\n",event,args,SendBuf.str().c_str()); } else { GPRINT(NORMAL_LEVEL,"Error send Event %s(%s)\n",event,args); } exit(1); } eErrorTp SendDataFromCnodaToUI_base(string dMessage,u32 json_pack_type,u32 json_pack_version, string user ,char * action) { string data="{}"; string sid=""; if (user.length()!=0){ sid=string_format(",\"sid\":\"%s\"",(char*)user.c_str()); } string evnative="{}"; if (dMessage[0]=='{'){ evnative=string_format("%s/evwdt '{\"t\":[%d,%d],\"d\":' '{\"action\":\"%s\",\"%s\":%s}%s}' %d\n", (char*)CnT->CNODA_PATH.c_str(), json_pack_type, json_pack_version, action, action, dMessage.c_str(), sid.c_str(), JSON_PACK_TYPE_TO_UI); //(char*)user.c_str()); } else{ evnative=string_format("%s/evwdt '{\"t\":[%d,%d],\"d\":' '{\"action\":\"%s\",\"%s\":\"%s\"}%s}' %d\n", (char*)CnT->CNODA_PATH.c_str(), json_pack_type, json_pack_version, action, action, dMessage.c_str(), sid.c_str(), JSON_PACK_TYPE_TO_UI); //(char*)user.c_str()); } printf("%s\n",evnative.c_str()); system(evnative.c_str()); return NO_ERROR; //GPRINT(MEDIUM_LEVEL,"SendEventFromCnoda\n"); //return SendSharedFifoMessage(srvmSendToLH,"wead", (u8*)container.c_str(),container.size()); } eErrorTp SendSystemFromCnodaToUI(string dMessageJson) { return SendDataFromCnodaToUI_base(dMessageJson,JSON_PACK_TYPE_SET_SYSTEM,JSON_PACK_VERSION,"","cnoda"); } eErrorTp SendSystemFromCnodaToUI(string dMessageJson,string user) { return SendDataFromCnodaToUI_base(dMessageJson,JSON_PACK_TYPE_SET_SYSTEM,JSON_PACK_VERSION,user,"cnoda"); } eErrorTp SendEventFromCnodaToUI(string dMessageJson) { return SendDataFromCnodaToUI_base(dMessageJson,JSON_PACK_TYPE_SEND_EVENT,JSON_PACK_VERSION,"","cnoda"); } eErrorTp SendEventFromCnodaToUI(string dMessageJson,string user) { return SendDataFromCnodaToUI_base(dMessageJson,JSON_PACK_TYPE_SEND_EVENT,JSON_PACK_VERSION,user,"cnoda"); }
22.653465
122
0.646416
trotill
4d80f5ca14ca158b7f72c7c6d5b993a84ff0070f
245,092
hpp
C++
cisco-ios-xr/ydk/models/cisco_ios_xr/fragmented/Cisco_IOS_XR_pmengine_oper_5.hpp
CiscoDevNet/ydk-cpp
ef7d75970f2ef1154100e0f7b0a2ee823609b481
[ "ECL-2.0", "Apache-2.0" ]
17
2016-12-02T05:45:49.000Z
2022-02-10T19:32:54.000Z
cisco-ios-xr/ydk/models/cisco_ios_xr/fragmented/Cisco_IOS_XR_pmengine_oper_5.hpp
CiscoDevNet/ydk-cpp
ef7d75970f2ef1154100e0f7b0a2ee823609b481
[ "ECL-2.0", "Apache-2.0" ]
2
2017-03-27T15:22:38.000Z
2019-11-05T08:30:16.000Z
cisco-ios-xr/ydk/models/cisco_ios_xr/fragmented/Cisco_IOS_XR_pmengine_oper_5.hpp
CiscoDevNet/ydk-cpp
ef7d75970f2ef1154100e0f7b0a2ee823609b481
[ "ECL-2.0", "Apache-2.0" ]
11
2016-12-02T05:45:52.000Z
2019-11-07T08:28:17.000Z
#ifndef _CISCO_IOS_XR_PMENGINE_OPER_5_ #define _CISCO_IOS_XR_PMENGINE_OPER_5_ #include <memory> #include <vector> #include <string> #include <ydk/types.hpp> #include <ydk/errors.hpp> #include "Cisco_IOS_XR_pmengine_oper_0.hpp" #include "Cisco_IOS_XR_pmengine_oper_4.hpp" namespace cisco_ios_xr { namespace Cisco_IOS_XR_pmengine_oper { class PerformanceManagement::Sts::StsPorts::StsPort::StsCurrent::StsMinute15::StsMinute15Paths::StsMinute15Path::Path::PathESs : public ydk::Entity { public: PathESs(); ~PathESs(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf data; //type: uint32 ydk::YLeaf threshold; //type: uint32 ydk::YLeaf tca_report; //type: boolean }; // PerformanceManagement::Sts::StsPorts::StsPort::StsCurrent::StsMinute15::StsMinute15Paths::StsMinute15Path::Path::PathESs class PerformanceManagement::Sts::StsPorts::StsPort::StsCurrent::StsMinute15::StsMinute15Paths::StsMinute15Path::Path::PathSeSs : public ydk::Entity { public: PathSeSs(); ~PathSeSs(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf data; //type: uint32 ydk::YLeaf threshold; //type: uint32 ydk::YLeaf tca_report; //type: boolean }; // PerformanceManagement::Sts::StsPorts::StsPort::StsCurrent::StsMinute15::StsMinute15Paths::StsMinute15Path::Path::PathSeSs class PerformanceManagement::Sts::StsPorts::StsPort::StsCurrent::StsMinute15::StsMinute15Paths::StsMinute15Path::Path::PathCVs : public ydk::Entity { public: PathCVs(); ~PathCVs(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf data; //type: uint32 ydk::YLeaf threshold; //type: uint32 ydk::YLeaf tca_report; //type: boolean }; // PerformanceManagement::Sts::StsPorts::StsPort::StsCurrent::StsMinute15::StsMinute15Paths::StsMinute15Path::Path::PathCVs class PerformanceManagement::Sts::StsPorts::StsPort::StsCurrent::StsMinute15::StsMinute15Paths::StsMinute15Path::Path::PathUaSs : public ydk::Entity { public: PathUaSs(); ~PathUaSs(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf data; //type: uint32 ydk::YLeaf threshold; //type: uint32 ydk::YLeaf tca_report; //type: boolean }; // PerformanceManagement::Sts::StsPorts::StsPort::StsCurrent::StsMinute15::StsMinute15Paths::StsMinute15Path::Path::PathUaSs class PerformanceManagement::Sts::StsPorts::StsPort::StsCurrent::StsMinute15::StsMinute15Paths::StsMinute15Path::FePath : public ydk::Entity { public: FePath(); ~FePath(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf far_end_path_e_ss; //type: uint32 ydk::YLeaf far_end_path_se_ss; //type: uint32 ydk::YLeaf far_end_path_c_vs; //type: uint32 ydk::YLeaf far_end_path_ua_ss; //type: uint32 }; // PerformanceManagement::Sts::StsPorts::StsPort::StsCurrent::StsMinute15::StsMinute15Paths::StsMinute15Path::FePath class PerformanceManagement::Sts::StsPorts::StsPort::StsCurrent::StsHour24 : public ydk::Entity { public: StsHour24(); ~StsHour24(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; class StsHour24Paths; //type: PerformanceManagement::Sts::StsPorts::StsPort::StsCurrent::StsHour24::StsHour24Paths std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Sts::StsPorts::StsPort::StsCurrent::StsHour24::StsHour24Paths> sts_hour24_paths; }; // PerformanceManagement::Sts::StsPorts::StsPort::StsCurrent::StsHour24 class PerformanceManagement::Sts::StsPorts::StsPort::StsCurrent::StsHour24::StsHour24Paths : public ydk::Entity { public: StsHour24Paths(); ~StsHour24Paths(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; class StsHour24Path; //type: PerformanceManagement::Sts::StsPorts::StsPort::StsCurrent::StsHour24::StsHour24Paths::StsHour24Path ydk::YList sts_hour24_path; }; // PerformanceManagement::Sts::StsPorts::StsPort::StsCurrent::StsHour24::StsHour24Paths class PerformanceManagement::Sts::StsPorts::StsPort::StsCurrent::StsHour24::StsHour24Paths::StsHour24Path : public ydk::Entity { public: StsHour24Path(); ~StsHour24Path(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf number; //type: uint32 ydk::YLeaf index_; //type: uint32 ydk::YLeaf valid; //type: boolean ydk::YLeaf timestamp; //type: string ydk::YLeaf last_clear_time; //type: string ydk::YLeaf last_clear15_min_time; //type: string ydk::YLeaf last_clear24_hr_time; //type: string class Path; //type: PerformanceManagement::Sts::StsPorts::StsPort::StsCurrent::StsHour24::StsHour24Paths::StsHour24Path::Path class FePath; //type: PerformanceManagement::Sts::StsPorts::StsPort::StsCurrent::StsHour24::StsHour24Paths::StsHour24Path::FePath std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Sts::StsPorts::StsPort::StsCurrent::StsHour24::StsHour24Paths::StsHour24Path::Path> path; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Sts::StsPorts::StsPort::StsCurrent::StsHour24::StsHour24Paths::StsHour24Path::FePath> fe_path; }; // PerformanceManagement::Sts::StsPorts::StsPort::StsCurrent::StsHour24::StsHour24Paths::StsHour24Path class PerformanceManagement::Sts::StsPorts::StsPort::StsCurrent::StsHour24::StsHour24Paths::StsHour24Path::Path : public ydk::Entity { public: Path(); ~Path(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf path_width; //type: PmSonetPathWidthEnum ydk::YLeaf path_status; //type: int32 class PathESs; //type: PerformanceManagement::Sts::StsPorts::StsPort::StsCurrent::StsHour24::StsHour24Paths::StsHour24Path::Path::PathESs class PathSeSs; //type: PerformanceManagement::Sts::StsPorts::StsPort::StsCurrent::StsHour24::StsHour24Paths::StsHour24Path::Path::PathSeSs class PathCVs; //type: PerformanceManagement::Sts::StsPorts::StsPort::StsCurrent::StsHour24::StsHour24Paths::StsHour24Path::Path::PathCVs class PathUaSs; //type: PerformanceManagement::Sts::StsPorts::StsPort::StsCurrent::StsHour24::StsHour24Paths::StsHour24Path::Path::PathUaSs std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Sts::StsPorts::StsPort::StsCurrent::StsHour24::StsHour24Paths::StsHour24Path::Path::PathESs> path_e_ss; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Sts::StsPorts::StsPort::StsCurrent::StsHour24::StsHour24Paths::StsHour24Path::Path::PathSeSs> path_se_ss; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Sts::StsPorts::StsPort::StsCurrent::StsHour24::StsHour24Paths::StsHour24Path::Path::PathCVs> path_c_vs; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Sts::StsPorts::StsPort::StsCurrent::StsHour24::StsHour24Paths::StsHour24Path::Path::PathUaSs> path_ua_ss; }; // PerformanceManagement::Sts::StsPorts::StsPort::StsCurrent::StsHour24::StsHour24Paths::StsHour24Path::Path class PerformanceManagement::Sts::StsPorts::StsPort::StsCurrent::StsHour24::StsHour24Paths::StsHour24Path::Path::PathESs : public ydk::Entity { public: PathESs(); ~PathESs(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf data; //type: uint32 ydk::YLeaf threshold; //type: uint32 ydk::YLeaf tca_report; //type: boolean }; // PerformanceManagement::Sts::StsPorts::StsPort::StsCurrent::StsHour24::StsHour24Paths::StsHour24Path::Path::PathESs class PerformanceManagement::Sts::StsPorts::StsPort::StsCurrent::StsHour24::StsHour24Paths::StsHour24Path::Path::PathSeSs : public ydk::Entity { public: PathSeSs(); ~PathSeSs(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf data; //type: uint32 ydk::YLeaf threshold; //type: uint32 ydk::YLeaf tca_report; //type: boolean }; // PerformanceManagement::Sts::StsPorts::StsPort::StsCurrent::StsHour24::StsHour24Paths::StsHour24Path::Path::PathSeSs class PerformanceManagement::Sts::StsPorts::StsPort::StsCurrent::StsHour24::StsHour24Paths::StsHour24Path::Path::PathCVs : public ydk::Entity { public: PathCVs(); ~PathCVs(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf data; //type: uint32 ydk::YLeaf threshold; //type: uint32 ydk::YLeaf tca_report; //type: boolean }; // PerformanceManagement::Sts::StsPorts::StsPort::StsCurrent::StsHour24::StsHour24Paths::StsHour24Path::Path::PathCVs class PerformanceManagement::Sts::StsPorts::StsPort::StsCurrent::StsHour24::StsHour24Paths::StsHour24Path::Path::PathUaSs : public ydk::Entity { public: PathUaSs(); ~PathUaSs(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf data; //type: uint32 ydk::YLeaf threshold; //type: uint32 ydk::YLeaf tca_report; //type: boolean }; // PerformanceManagement::Sts::StsPorts::StsPort::StsCurrent::StsHour24::StsHour24Paths::StsHour24Path::Path::PathUaSs class PerformanceManagement::Sts::StsPorts::StsPort::StsCurrent::StsHour24::StsHour24Paths::StsHour24Path::FePath : public ydk::Entity { public: FePath(); ~FePath(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf far_end_path_e_ss; //type: uint32 ydk::YLeaf far_end_path_se_ss; //type: uint32 ydk::YLeaf far_end_path_c_vs; //type: uint32 ydk::YLeaf far_end_path_ua_ss; //type: uint32 }; // PerformanceManagement::Sts::StsPorts::StsPort::StsCurrent::StsHour24::StsHour24Paths::StsHour24Path::FePath class PerformanceManagement::Dwdm : public ydk::Entity { public: Dwdm(); ~Dwdm(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; std::string get_absolute_path() const override; class DwdmPorts; //type: PerformanceManagement::Dwdm::DwdmPorts std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Dwdm::DwdmPorts> dwdm_ports; }; // PerformanceManagement::Dwdm class PerformanceManagement::Dwdm::DwdmPorts : public ydk::Entity { public: DwdmPorts(); ~DwdmPorts(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; std::string get_absolute_path() const override; class DwdmPort; //type: PerformanceManagement::Dwdm::DwdmPorts::DwdmPort ydk::YList dwdm_port; }; // PerformanceManagement::Dwdm::DwdmPorts class PerformanceManagement::Dwdm::DwdmPorts::DwdmPort : public ydk::Entity { public: DwdmPort(); ~DwdmPort(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; std::string get_absolute_path() const override; ydk::YLeaf name; //type: string class DwdmCurrent; //type: PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent> dwdm_current; }; // PerformanceManagement::Dwdm::DwdmPorts::DwdmPort class PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent : public ydk::Entity { public: DwdmCurrent(); ~DwdmCurrent(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; class DwdmMinute15; //type: PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15 class DwdmHour24; //type: PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24 std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15> dwdm_minute15; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24> dwdm_hour24; }; // PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent class PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15 : public ydk::Entity { public: DwdmMinute15(); ~DwdmMinute15(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; class DwdmMinute15fecs; //type: PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15fecs class DwdmMinute15Optics; //type: PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15Optics class DwdmMinute15otns; //type: PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15otns std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15fecs> dwdm_minute15fecs; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15Optics> dwdm_minute15_optics; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15otns> dwdm_minute15otns; }; // PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15 class PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15fecs : public ydk::Entity { public: DwdmMinute15fecs(); ~DwdmMinute15fecs(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; class DwdmMinute15fec; //type: PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15fecs::DwdmMinute15fec ydk::YList dwdm_minute15fec; }; // PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15fecs class PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15fecs::DwdmMinute15fec : public ydk::Entity { public: DwdmMinute15fec(); ~DwdmMinute15fec(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf number; //type: uint32 ydk::YLeaf index_; //type: uint32 ydk::YLeaf valid; //type: boolean ydk::YLeaf timestamp; //type: string ydk::YLeaf last_clear_time; //type: string ydk::YLeaf last_clear15_min_time; //type: string ydk::YLeaf last_clear30_sec_time; //type: string ydk::YLeaf last_clear24_hr_time; //type: string ydk::YLeaf sec30_support; //type: boolean class EcBits; //type: PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15fecs::DwdmMinute15fec::EcBits class UcWords; //type: PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15fecs::DwdmMinute15fec::UcWords class PreFecBer; //type: PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15fecs::DwdmMinute15fec::PreFecBer class PostFecBer; //type: PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15fecs::DwdmMinute15fec::PostFecBer class Q; //type: PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15fecs::DwdmMinute15fec::Q class Qmargin; //type: PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15fecs::DwdmMinute15fec::Qmargin std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15fecs::DwdmMinute15fec::EcBits> ec_bits; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15fecs::DwdmMinute15fec::UcWords> uc_words; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15fecs::DwdmMinute15fec::PreFecBer> pre_fec_ber; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15fecs::DwdmMinute15fec::PostFecBer> post_fec_ber; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15fecs::DwdmMinute15fec::Q> q; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15fecs::DwdmMinute15fec::Qmargin> qmargin; }; // PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15fecs::DwdmMinute15fec class PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15fecs::DwdmMinute15fec::EcBits : public ydk::Entity { public: EcBits(); ~EcBits(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf data; //type: uint64 ydk::YLeaf threshold; //type: uint64 ydk::YLeaf tca_report; //type: boolean ydk::YLeaf valid; //type: boolean }; // PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15fecs::DwdmMinute15fec::EcBits class PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15fecs::DwdmMinute15fec::UcWords : public ydk::Entity { public: UcWords(); ~UcWords(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf data; //type: uint64 ydk::YLeaf threshold; //type: uint64 ydk::YLeaf tca_report; //type: boolean ydk::YLeaf valid; //type: boolean }; // PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15fecs::DwdmMinute15fec::UcWords class PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15fecs::DwdmMinute15fec::PreFecBer : public ydk::Entity { public: PreFecBer(); ~PreFecBer(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf minimum; //type: string ydk::YLeaf average; //type: string ydk::YLeaf maximum; //type: string ydk::YLeaf minimum_threshold; //type: string ydk::YLeaf minimum_tca_report; //type: boolean ydk::YLeaf maximum_threshold; //type: string ydk::YLeaf maximum_tca_report; //type: boolean ydk::YLeaf valid; //type: boolean }; // PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15fecs::DwdmMinute15fec::PreFecBer class PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15fecs::DwdmMinute15fec::PostFecBer : public ydk::Entity { public: PostFecBer(); ~PostFecBer(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf minimum; //type: string ydk::YLeaf average; //type: string ydk::YLeaf maximum; //type: string ydk::YLeaf minimum_threshold; //type: string ydk::YLeaf minimum_tca_report; //type: boolean ydk::YLeaf maximum_threshold; //type: string ydk::YLeaf maximum_tca_report; //type: boolean ydk::YLeaf valid; //type: boolean }; // PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15fecs::DwdmMinute15fec::PostFecBer class PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15fecs::DwdmMinute15fec::Q : public ydk::Entity { public: Q(); ~Q(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf minimum; //type: string ydk::YLeaf average; //type: string ydk::YLeaf maximum; //type: string ydk::YLeaf minimum_threshold; //type: string ydk::YLeaf minimum_tca_report; //type: boolean ydk::YLeaf maximum_threshold; //type: string ydk::YLeaf maximum_tca_report; //type: boolean ydk::YLeaf valid; //type: boolean }; // PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15fecs::DwdmMinute15fec::Q class PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15fecs::DwdmMinute15fec::Qmargin : public ydk::Entity { public: Qmargin(); ~Qmargin(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf minimum; //type: string ydk::YLeaf average; //type: string ydk::YLeaf maximum; //type: string ydk::YLeaf minimum_threshold; //type: string ydk::YLeaf minimum_tca_report; //type: boolean ydk::YLeaf maximum_threshold; //type: string ydk::YLeaf maximum_tca_report; //type: boolean ydk::YLeaf valid; //type: boolean }; // PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15fecs::DwdmMinute15fec::Qmargin class PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15Optics : public ydk::Entity { public: DwdmMinute15Optics(); ~DwdmMinute15Optics(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; class DwdmMinute15Optic; //type: PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15Optics::DwdmMinute15Optic ydk::YList dwdm_minute15_optic; }; // PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15Optics class PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15Optics::DwdmMinute15Optic : public ydk::Entity { public: DwdmMinute15Optic(); ~DwdmMinute15Optic(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf number; //type: uint32 ydk::YLeaf index_; //type: uint32 ydk::YLeaf valid; //type: boolean ydk::YLeaf timestamp; //type: string ydk::YLeaf last_clear_time; //type: string ydk::YLeaf last_clear15_min_time; //type: string ydk::YLeaf last_clear30_sec_time; //type: string ydk::YLeaf last_clear24_hr_time; //type: string ydk::YLeaf sec30_support; //type: boolean class Lbc; //type: PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15Optics::DwdmMinute15Optic::Lbc class LbcPc; //type: PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15Optics::DwdmMinute15Optic::LbcPc class Opt; //type: PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15Optics::DwdmMinute15Optic::Opt class Opr; //type: PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15Optics::DwdmMinute15Optic::Opr class Cd; //type: PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15Optics::DwdmMinute15Optic::Cd class Dgd; //type: PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15Optics::DwdmMinute15Optic::Dgd class Pmd; //type: PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15Optics::DwdmMinute15Optic::Pmd class Osnr; //type: PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15Optics::DwdmMinute15Optic::Osnr class CenterWavelength; //type: PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15Optics::DwdmMinute15Optic::CenterWavelength class Pdl; //type: PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15Optics::DwdmMinute15Optic::Pdl class Pcr; //type: PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15Optics::DwdmMinute15Optic::Pcr class Pn; //type: PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15Optics::DwdmMinute15Optic::Pn class RxSigPow; //type: PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15Optics::DwdmMinute15Optic::RxSigPow class LowSigFreqOff; //type: PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15Optics::DwdmMinute15Optic::LowSigFreqOff class AmpliGain; //type: PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15Optics::DwdmMinute15Optic::AmpliGain class AmpliGainTilt; //type: PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15Optics::DwdmMinute15Optic::AmpliGainTilt std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15Optics::DwdmMinute15Optic::Lbc> lbc; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15Optics::DwdmMinute15Optic::LbcPc> lbc_pc; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15Optics::DwdmMinute15Optic::Opt> opt; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15Optics::DwdmMinute15Optic::Opr> opr; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15Optics::DwdmMinute15Optic::Cd> cd; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15Optics::DwdmMinute15Optic::Dgd> dgd; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15Optics::DwdmMinute15Optic::Pmd> pmd; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15Optics::DwdmMinute15Optic::Osnr> osnr; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15Optics::DwdmMinute15Optic::CenterWavelength> center_wavelength; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15Optics::DwdmMinute15Optic::Pdl> pdl; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15Optics::DwdmMinute15Optic::Pcr> pcr; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15Optics::DwdmMinute15Optic::Pn> pn; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15Optics::DwdmMinute15Optic::RxSigPow> rx_sig_pow; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15Optics::DwdmMinute15Optic::LowSigFreqOff> low_sig_freq_off; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15Optics::DwdmMinute15Optic::AmpliGain> ampli_gain; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15Optics::DwdmMinute15Optic::AmpliGainTilt> ampli_gain_tilt; }; // PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15Optics::DwdmMinute15Optic class PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15Optics::DwdmMinute15Optic::Lbc : public ydk::Entity { public: Lbc(); ~Lbc(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf valid; //type: boolean ydk::YLeaf minimum; //type: int32 ydk::YLeaf average; //type: int32 ydk::YLeaf maximum; //type: int32 ydk::YLeaf minimum_threshold; //type: int32 ydk::YLeaf configured_min_thresh; //type: string ydk::YLeaf minimum_tca_report; //type: boolean ydk::YLeaf maximum_threshold; //type: int32 ydk::YLeaf configured_max_thresh; //type: string ydk::YLeaf maximum_tca_report; //type: boolean }; // PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15Optics::DwdmMinute15Optic::Lbc class PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15Optics::DwdmMinute15Optic::LbcPc : public ydk::Entity { public: LbcPc(); ~LbcPc(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf valid; //type: boolean ydk::YLeaf minimum; //type: string ydk::YLeaf average; //type: string ydk::YLeaf maximum; //type: string ydk::YLeaf minimum_threshold; //type: string ydk::YLeaf configured_min_thresh; //type: string ydk::YLeaf minimum_tca_report; //type: boolean ydk::YLeaf maximum_threshold; //type: string ydk::YLeaf configured_max_thresh; //type: string ydk::YLeaf maximum_tca_report; //type: boolean }; // PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15Optics::DwdmMinute15Optic::LbcPc class PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15Optics::DwdmMinute15Optic::Opt : public ydk::Entity { public: Opt(); ~Opt(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf valid; //type: boolean ydk::YLeaf minimum; //type: string ydk::YLeaf average; //type: string ydk::YLeaf maximum; //type: string ydk::YLeaf minimum_threshold; //type: string ydk::YLeaf configured_min_thresh; //type: string ydk::YLeaf minimum_tca_report; //type: boolean ydk::YLeaf maximum_threshold; //type: string ydk::YLeaf configured_max_thresh; //type: string ydk::YLeaf maximum_tca_report; //type: boolean }; // PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15Optics::DwdmMinute15Optic::Opt class PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15Optics::DwdmMinute15Optic::Opr : public ydk::Entity { public: Opr(); ~Opr(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf valid; //type: boolean ydk::YLeaf minimum; //type: string ydk::YLeaf average; //type: string ydk::YLeaf maximum; //type: string ydk::YLeaf minimum_threshold; //type: string ydk::YLeaf configured_min_thresh; //type: string ydk::YLeaf minimum_tca_report; //type: boolean ydk::YLeaf maximum_threshold; //type: string ydk::YLeaf configured_max_thresh; //type: string ydk::YLeaf maximum_tca_report; //type: boolean }; // PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15Optics::DwdmMinute15Optic::Opr class PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15Optics::DwdmMinute15Optic::Cd : public ydk::Entity { public: Cd(); ~Cd(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf valid; //type: boolean ydk::YLeaf minimum; //type: int32 ydk::YLeaf average; //type: int32 ydk::YLeaf maximum; //type: int32 ydk::YLeaf minimum_threshold; //type: int32 ydk::YLeaf configured_min_thresh; //type: string ydk::YLeaf minimum_tca_report; //type: boolean ydk::YLeaf maximum_threshold; //type: int32 ydk::YLeaf configured_max_thresh; //type: string ydk::YLeaf maximum_tca_report; //type: boolean }; // PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15Optics::DwdmMinute15Optic::Cd class PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15Optics::DwdmMinute15Optic::Dgd : public ydk::Entity { public: Dgd(); ~Dgd(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf valid; //type: boolean ydk::YLeaf minimum; //type: string ydk::YLeaf average; //type: string ydk::YLeaf maximum; //type: string ydk::YLeaf minimum_threshold; //type: string ydk::YLeaf configured_min_thresh; //type: string ydk::YLeaf minimum_tca_report; //type: boolean ydk::YLeaf maximum_threshold; //type: string ydk::YLeaf configured_max_thresh; //type: string ydk::YLeaf maximum_tca_report; //type: boolean }; // PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15Optics::DwdmMinute15Optic::Dgd class PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15Optics::DwdmMinute15Optic::Pmd : public ydk::Entity { public: Pmd(); ~Pmd(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf valid; //type: boolean ydk::YLeaf minimum; //type: string ydk::YLeaf average; //type: string ydk::YLeaf maximum; //type: string ydk::YLeaf minimum_threshold; //type: string ydk::YLeaf configured_min_thresh; //type: string ydk::YLeaf minimum_tca_report; //type: boolean ydk::YLeaf maximum_threshold; //type: string ydk::YLeaf configured_max_thresh; //type: string ydk::YLeaf maximum_tca_report; //type: boolean }; // PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15Optics::DwdmMinute15Optic::Pmd class PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15Optics::DwdmMinute15Optic::Osnr : public ydk::Entity { public: Osnr(); ~Osnr(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf valid; //type: boolean ydk::YLeaf minimum; //type: string ydk::YLeaf average; //type: string ydk::YLeaf maximum; //type: string ydk::YLeaf minimum_threshold; //type: string ydk::YLeaf configured_min_thresh; //type: string ydk::YLeaf minimum_tca_report; //type: boolean ydk::YLeaf maximum_threshold; //type: string ydk::YLeaf configured_max_thresh; //type: string ydk::YLeaf maximum_tca_report; //type: boolean }; // PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15Optics::DwdmMinute15Optic::Osnr class PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15Optics::DwdmMinute15Optic::CenterWavelength : public ydk::Entity { public: CenterWavelength(); ~CenterWavelength(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf valid; //type: boolean ydk::YLeaf minimum; //type: string ydk::YLeaf average; //type: string ydk::YLeaf maximum; //type: string ydk::YLeaf minimum_threshold; //type: string ydk::YLeaf configured_min_thresh; //type: string ydk::YLeaf minimum_tca_report; //type: boolean ydk::YLeaf maximum_threshold; //type: string ydk::YLeaf configured_max_thresh; //type: string ydk::YLeaf maximum_tca_report; //type: boolean }; // PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15Optics::DwdmMinute15Optic::CenterWavelength class PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15Optics::DwdmMinute15Optic::Pdl : public ydk::Entity { public: Pdl(); ~Pdl(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf valid; //type: boolean ydk::YLeaf minimum; //type: string ydk::YLeaf average; //type: string ydk::YLeaf maximum; //type: string ydk::YLeaf minimum_threshold; //type: string ydk::YLeaf configured_min_thresh; //type: string ydk::YLeaf minimum_tca_report; //type: boolean ydk::YLeaf maximum_threshold; //type: string ydk::YLeaf configured_max_thresh; //type: string ydk::YLeaf maximum_tca_report; //type: boolean }; // PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15Optics::DwdmMinute15Optic::Pdl class PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15Optics::DwdmMinute15Optic::Pcr : public ydk::Entity { public: Pcr(); ~Pcr(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf valid; //type: boolean ydk::YLeaf minimum; //type: string ydk::YLeaf average; //type: string ydk::YLeaf maximum; //type: string ydk::YLeaf minimum_threshold; //type: string ydk::YLeaf configured_min_thresh; //type: string ydk::YLeaf minimum_tca_report; //type: boolean ydk::YLeaf maximum_threshold; //type: string ydk::YLeaf configured_max_thresh; //type: string ydk::YLeaf maximum_tca_report; //type: boolean }; // PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15Optics::DwdmMinute15Optic::Pcr class PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15Optics::DwdmMinute15Optic::Pn : public ydk::Entity { public: Pn(); ~Pn(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf valid; //type: boolean ydk::YLeaf minimum; //type: string ydk::YLeaf average; //type: string ydk::YLeaf maximum; //type: string ydk::YLeaf minimum_threshold; //type: string ydk::YLeaf configured_min_thresh; //type: string ydk::YLeaf minimum_tca_report; //type: boolean ydk::YLeaf maximum_threshold; //type: string ydk::YLeaf configured_max_thresh; //type: string ydk::YLeaf maximum_tca_report; //type: boolean }; // PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15Optics::DwdmMinute15Optic::Pn class PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15Optics::DwdmMinute15Optic::RxSigPow : public ydk::Entity { public: RxSigPow(); ~RxSigPow(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf valid; //type: boolean ydk::YLeaf minimum; //type: string ydk::YLeaf average; //type: string ydk::YLeaf maximum; //type: string ydk::YLeaf minimum_threshold; //type: string ydk::YLeaf configured_min_thresh; //type: string ydk::YLeaf minimum_tca_report; //type: boolean ydk::YLeaf maximum_threshold; //type: string ydk::YLeaf configured_max_thresh; //type: string ydk::YLeaf maximum_tca_report; //type: boolean }; // PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15Optics::DwdmMinute15Optic::RxSigPow class PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15Optics::DwdmMinute15Optic::LowSigFreqOff : public ydk::Entity { public: LowSigFreqOff(); ~LowSigFreqOff(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf valid; //type: boolean ydk::YLeaf minimum; //type: int32 ydk::YLeaf average; //type: int32 ydk::YLeaf maximum; //type: int32 ydk::YLeaf minimum_threshold; //type: int32 ydk::YLeaf configured_min_thresh; //type: string ydk::YLeaf minimum_tca_report; //type: boolean ydk::YLeaf maximum_threshold; //type: int32 ydk::YLeaf configured_max_thresh; //type: string ydk::YLeaf maximum_tca_report; //type: boolean }; // PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15Optics::DwdmMinute15Optic::LowSigFreqOff class PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15Optics::DwdmMinute15Optic::AmpliGain : public ydk::Entity { public: AmpliGain(); ~AmpliGain(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf valid; //type: boolean ydk::YLeaf minimum; //type: string ydk::YLeaf average; //type: string ydk::YLeaf maximum; //type: string ydk::YLeaf minimum_threshold; //type: string ydk::YLeaf configured_min_thresh; //type: string ydk::YLeaf minimum_tca_report; //type: boolean ydk::YLeaf maximum_threshold; //type: string ydk::YLeaf configured_max_thresh; //type: string ydk::YLeaf maximum_tca_report; //type: boolean }; // PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15Optics::DwdmMinute15Optic::AmpliGain class PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15Optics::DwdmMinute15Optic::AmpliGainTilt : public ydk::Entity { public: AmpliGainTilt(); ~AmpliGainTilt(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf valid; //type: boolean ydk::YLeaf minimum; //type: string ydk::YLeaf average; //type: string ydk::YLeaf maximum; //type: string ydk::YLeaf minimum_threshold; //type: string ydk::YLeaf configured_min_thresh; //type: string ydk::YLeaf minimum_tca_report; //type: boolean ydk::YLeaf maximum_threshold; //type: string ydk::YLeaf configured_max_thresh; //type: string ydk::YLeaf maximum_tca_report; //type: boolean }; // PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15Optics::DwdmMinute15Optic::AmpliGainTilt class PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15otns : public ydk::Entity { public: DwdmMinute15otns(); ~DwdmMinute15otns(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; class DwdmMinute15otn; //type: PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15otns::DwdmMinute15otn ydk::YList dwdm_minute15otn; }; // PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15otns class PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15otns::DwdmMinute15otn : public ydk::Entity { public: DwdmMinute15otn(); ~DwdmMinute15otn(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf number; //type: uint32 ydk::YLeaf index_; //type: uint32 ydk::YLeaf valid; //type: boolean ydk::YLeaf timestamp; //type: string ydk::YLeaf last_clear_time; //type: string ydk::YLeaf last_clear15_min_time; //type: string ydk::YLeaf last_clear30_sec_time; //type: string ydk::YLeaf last_clear24_hr_time; //type: string ydk::YLeaf sec30_support; //type: boolean class Lbc; //type: PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15otns::DwdmMinute15otn::Lbc class EsNe; //type: PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15otns::DwdmMinute15otn::EsNe class EsrNe; //type: PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15otns::DwdmMinute15otn::EsrNe class SesNe; //type: PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15otns::DwdmMinute15otn::SesNe class SesrNe; //type: PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15otns::DwdmMinute15otn::SesrNe class UasNe; //type: PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15otns::DwdmMinute15otn::UasNe class BbeNe; //type: PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15otns::DwdmMinute15otn::BbeNe class BberNe; //type: PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15otns::DwdmMinute15otn::BberNe class FcNe; //type: PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15otns::DwdmMinute15otn::FcNe class EsFe; //type: PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15otns::DwdmMinute15otn::EsFe class EsrFe; //type: PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15otns::DwdmMinute15otn::EsrFe class SesFe; //type: PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15otns::DwdmMinute15otn::SesFe class SesrFe; //type: PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15otns::DwdmMinute15otn::SesrFe class UasFe; //type: PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15otns::DwdmMinute15otn::UasFe class BbeFe; //type: PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15otns::DwdmMinute15otn::BbeFe class BberFe; //type: PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15otns::DwdmMinute15otn::BberFe class FcFe; //type: PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15otns::DwdmMinute15otn::FcFe std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15otns::DwdmMinute15otn::Lbc> lbc; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15otns::DwdmMinute15otn::EsNe> es_ne; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15otns::DwdmMinute15otn::EsrNe> esr_ne; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15otns::DwdmMinute15otn::SesNe> ses_ne; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15otns::DwdmMinute15otn::SesrNe> sesr_ne; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15otns::DwdmMinute15otn::UasNe> uas_ne; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15otns::DwdmMinute15otn::BbeNe> bbe_ne; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15otns::DwdmMinute15otn::BberNe> bber_ne; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15otns::DwdmMinute15otn::FcNe> fc_ne; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15otns::DwdmMinute15otn::EsFe> es_fe; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15otns::DwdmMinute15otn::EsrFe> esr_fe; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15otns::DwdmMinute15otn::SesFe> ses_fe; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15otns::DwdmMinute15otn::SesrFe> sesr_fe; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15otns::DwdmMinute15otn::UasFe> uas_fe; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15otns::DwdmMinute15otn::BbeFe> bbe_fe; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15otns::DwdmMinute15otn::BberFe> bber_fe; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15otns::DwdmMinute15otn::FcFe> fc_fe; }; // PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15otns::DwdmMinute15otn class PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15otns::DwdmMinute15otn::Lbc : public ydk::Entity { public: Lbc(); ~Lbc(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf data; //type: uint64 ydk::YLeaf threshold; //type: uint64 ydk::YLeaf tca_report; //type: boolean }; // PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15otns::DwdmMinute15otn::Lbc class PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15otns::DwdmMinute15otn::EsNe : public ydk::Entity { public: EsNe(); ~EsNe(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf data; //type: uint64 ydk::YLeaf threshold; //type: uint64 ydk::YLeaf tca_report; //type: boolean }; // PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15otns::DwdmMinute15otn::EsNe class PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15otns::DwdmMinute15otn::EsrNe : public ydk::Entity { public: EsrNe(); ~EsrNe(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf data; //type: string ydk::YLeaf threshold; //type: string ydk::YLeaf tca_report; //type: boolean }; // PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15otns::DwdmMinute15otn::EsrNe class PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15otns::DwdmMinute15otn::SesNe : public ydk::Entity { public: SesNe(); ~SesNe(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf data; //type: uint64 ydk::YLeaf threshold; //type: uint64 ydk::YLeaf tca_report; //type: boolean }; // PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15otns::DwdmMinute15otn::SesNe class PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15otns::DwdmMinute15otn::SesrNe : public ydk::Entity { public: SesrNe(); ~SesrNe(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf data; //type: string ydk::YLeaf threshold; //type: string ydk::YLeaf tca_report; //type: boolean }; // PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15otns::DwdmMinute15otn::SesrNe class PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15otns::DwdmMinute15otn::UasNe : public ydk::Entity { public: UasNe(); ~UasNe(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf data; //type: uint64 ydk::YLeaf threshold; //type: uint64 ydk::YLeaf tca_report; //type: boolean }; // PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15otns::DwdmMinute15otn::UasNe class PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15otns::DwdmMinute15otn::BbeNe : public ydk::Entity { public: BbeNe(); ~BbeNe(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf data; //type: uint64 ydk::YLeaf threshold; //type: uint64 ydk::YLeaf tca_report; //type: boolean }; // PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15otns::DwdmMinute15otn::BbeNe class PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15otns::DwdmMinute15otn::BberNe : public ydk::Entity { public: BberNe(); ~BberNe(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf data; //type: string ydk::YLeaf threshold; //type: string ydk::YLeaf tca_report; //type: boolean }; // PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15otns::DwdmMinute15otn::BberNe class PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15otns::DwdmMinute15otn::FcNe : public ydk::Entity { public: FcNe(); ~FcNe(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf data; //type: uint64 ydk::YLeaf threshold; //type: uint64 ydk::YLeaf tca_report; //type: boolean }; // PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15otns::DwdmMinute15otn::FcNe class PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15otns::DwdmMinute15otn::EsFe : public ydk::Entity { public: EsFe(); ~EsFe(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf data; //type: uint64 ydk::YLeaf threshold; //type: uint64 ydk::YLeaf tca_report; //type: boolean }; // PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15otns::DwdmMinute15otn::EsFe class PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15otns::DwdmMinute15otn::EsrFe : public ydk::Entity { public: EsrFe(); ~EsrFe(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf data; //type: string ydk::YLeaf threshold; //type: string ydk::YLeaf tca_report; //type: boolean }; // PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15otns::DwdmMinute15otn::EsrFe class PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15otns::DwdmMinute15otn::SesFe : public ydk::Entity { public: SesFe(); ~SesFe(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf data; //type: uint64 ydk::YLeaf threshold; //type: uint64 ydk::YLeaf tca_report; //type: boolean }; // PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15otns::DwdmMinute15otn::SesFe class PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15otns::DwdmMinute15otn::SesrFe : public ydk::Entity { public: SesrFe(); ~SesrFe(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf data; //type: string ydk::YLeaf threshold; //type: string ydk::YLeaf tca_report; //type: boolean }; // PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15otns::DwdmMinute15otn::SesrFe class PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15otns::DwdmMinute15otn::UasFe : public ydk::Entity { public: UasFe(); ~UasFe(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf data; //type: uint64 ydk::YLeaf threshold; //type: uint64 ydk::YLeaf tca_report; //type: boolean }; // PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15otns::DwdmMinute15otn::UasFe class PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15otns::DwdmMinute15otn::BbeFe : public ydk::Entity { public: BbeFe(); ~BbeFe(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf data; //type: uint64 ydk::YLeaf threshold; //type: uint64 ydk::YLeaf tca_report; //type: boolean }; // PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15otns::DwdmMinute15otn::BbeFe class PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15otns::DwdmMinute15otn::BberFe : public ydk::Entity { public: BberFe(); ~BberFe(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf data; //type: string ydk::YLeaf threshold; //type: string ydk::YLeaf tca_report; //type: boolean }; // PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15otns::DwdmMinute15otn::BberFe class PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15otns::DwdmMinute15otn::FcFe : public ydk::Entity { public: FcFe(); ~FcFe(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf data; //type: uint64 ydk::YLeaf threshold; //type: uint64 ydk::YLeaf tca_report; //type: boolean }; // PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmMinute15::DwdmMinute15otns::DwdmMinute15otn::FcFe class PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24 : public ydk::Entity { public: DwdmHour24(); ~DwdmHour24(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; class DwdmHour24Optics; //type: PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24Optics class DwdmHour24fecs; //type: PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24fecs class DwdmHour24otns; //type: PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24otns std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24Optics> dwdm_hour24_optics; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24fecs> dwdm_hour24fecs; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24otns> dwdm_hour24otns; }; // PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24 class PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24Optics : public ydk::Entity { public: DwdmHour24Optics(); ~DwdmHour24Optics(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; class DwdmHour24Optic; //type: PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24Optics::DwdmHour24Optic ydk::YList dwdm_hour24_optic; }; // PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24Optics class PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24Optics::DwdmHour24Optic : public ydk::Entity { public: DwdmHour24Optic(); ~DwdmHour24Optic(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf number; //type: uint32 ydk::YLeaf index_; //type: uint32 ydk::YLeaf valid; //type: boolean ydk::YLeaf timestamp; //type: string ydk::YLeaf last_clear_time; //type: string ydk::YLeaf last_clear15_min_time; //type: string ydk::YLeaf last_clear30_sec_time; //type: string ydk::YLeaf last_clear24_hr_time; //type: string ydk::YLeaf sec30_support; //type: boolean class Lbc; //type: PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24Optics::DwdmHour24Optic::Lbc class LbcPc; //type: PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24Optics::DwdmHour24Optic::LbcPc class Opt; //type: PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24Optics::DwdmHour24Optic::Opt class Opr; //type: PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24Optics::DwdmHour24Optic::Opr class Cd; //type: PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24Optics::DwdmHour24Optic::Cd class Dgd; //type: PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24Optics::DwdmHour24Optic::Dgd class Pmd; //type: PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24Optics::DwdmHour24Optic::Pmd class Osnr; //type: PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24Optics::DwdmHour24Optic::Osnr class CenterWavelength; //type: PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24Optics::DwdmHour24Optic::CenterWavelength class Pdl; //type: PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24Optics::DwdmHour24Optic::Pdl class Pcr; //type: PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24Optics::DwdmHour24Optic::Pcr class Pn; //type: PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24Optics::DwdmHour24Optic::Pn class RxSigPow; //type: PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24Optics::DwdmHour24Optic::RxSigPow class LowSigFreqOff; //type: PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24Optics::DwdmHour24Optic::LowSigFreqOff class AmpliGain; //type: PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24Optics::DwdmHour24Optic::AmpliGain class AmpliGainTilt; //type: PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24Optics::DwdmHour24Optic::AmpliGainTilt std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24Optics::DwdmHour24Optic::Lbc> lbc; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24Optics::DwdmHour24Optic::LbcPc> lbc_pc; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24Optics::DwdmHour24Optic::Opt> opt; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24Optics::DwdmHour24Optic::Opr> opr; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24Optics::DwdmHour24Optic::Cd> cd; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24Optics::DwdmHour24Optic::Dgd> dgd; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24Optics::DwdmHour24Optic::Pmd> pmd; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24Optics::DwdmHour24Optic::Osnr> osnr; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24Optics::DwdmHour24Optic::CenterWavelength> center_wavelength; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24Optics::DwdmHour24Optic::Pdl> pdl; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24Optics::DwdmHour24Optic::Pcr> pcr; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24Optics::DwdmHour24Optic::Pn> pn; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24Optics::DwdmHour24Optic::RxSigPow> rx_sig_pow; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24Optics::DwdmHour24Optic::LowSigFreqOff> low_sig_freq_off; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24Optics::DwdmHour24Optic::AmpliGain> ampli_gain; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24Optics::DwdmHour24Optic::AmpliGainTilt> ampli_gain_tilt; }; // PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24Optics::DwdmHour24Optic class PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24Optics::DwdmHour24Optic::Lbc : public ydk::Entity { public: Lbc(); ~Lbc(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf valid; //type: boolean ydk::YLeaf minimum; //type: int32 ydk::YLeaf average; //type: int32 ydk::YLeaf maximum; //type: int32 ydk::YLeaf minimum_threshold; //type: int32 ydk::YLeaf configured_min_thresh; //type: string ydk::YLeaf minimum_tca_report; //type: boolean ydk::YLeaf maximum_threshold; //type: int32 ydk::YLeaf configured_max_thresh; //type: string ydk::YLeaf maximum_tca_report; //type: boolean }; // PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24Optics::DwdmHour24Optic::Lbc class PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24Optics::DwdmHour24Optic::LbcPc : public ydk::Entity { public: LbcPc(); ~LbcPc(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf valid; //type: boolean ydk::YLeaf minimum; //type: string ydk::YLeaf average; //type: string ydk::YLeaf maximum; //type: string ydk::YLeaf minimum_threshold; //type: string ydk::YLeaf configured_min_thresh; //type: string ydk::YLeaf minimum_tca_report; //type: boolean ydk::YLeaf maximum_threshold; //type: string ydk::YLeaf configured_max_thresh; //type: string ydk::YLeaf maximum_tca_report; //type: boolean }; // PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24Optics::DwdmHour24Optic::LbcPc class PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24Optics::DwdmHour24Optic::Opt : public ydk::Entity { public: Opt(); ~Opt(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf valid; //type: boolean ydk::YLeaf minimum; //type: string ydk::YLeaf average; //type: string ydk::YLeaf maximum; //type: string ydk::YLeaf minimum_threshold; //type: string ydk::YLeaf configured_min_thresh; //type: string ydk::YLeaf minimum_tca_report; //type: boolean ydk::YLeaf maximum_threshold; //type: string ydk::YLeaf configured_max_thresh; //type: string ydk::YLeaf maximum_tca_report; //type: boolean }; // PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24Optics::DwdmHour24Optic::Opt class PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24Optics::DwdmHour24Optic::Opr : public ydk::Entity { public: Opr(); ~Opr(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf valid; //type: boolean ydk::YLeaf minimum; //type: string ydk::YLeaf average; //type: string ydk::YLeaf maximum; //type: string ydk::YLeaf minimum_threshold; //type: string ydk::YLeaf configured_min_thresh; //type: string ydk::YLeaf minimum_tca_report; //type: boolean ydk::YLeaf maximum_threshold; //type: string ydk::YLeaf configured_max_thresh; //type: string ydk::YLeaf maximum_tca_report; //type: boolean }; // PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24Optics::DwdmHour24Optic::Opr class PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24Optics::DwdmHour24Optic::Cd : public ydk::Entity { public: Cd(); ~Cd(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf valid; //type: boolean ydk::YLeaf minimum; //type: int32 ydk::YLeaf average; //type: int32 ydk::YLeaf maximum; //type: int32 ydk::YLeaf minimum_threshold; //type: int32 ydk::YLeaf configured_min_thresh; //type: string ydk::YLeaf minimum_tca_report; //type: boolean ydk::YLeaf maximum_threshold; //type: int32 ydk::YLeaf configured_max_thresh; //type: string ydk::YLeaf maximum_tca_report; //type: boolean }; // PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24Optics::DwdmHour24Optic::Cd class PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24Optics::DwdmHour24Optic::Dgd : public ydk::Entity { public: Dgd(); ~Dgd(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf valid; //type: boolean ydk::YLeaf minimum; //type: string ydk::YLeaf average; //type: string ydk::YLeaf maximum; //type: string ydk::YLeaf minimum_threshold; //type: string ydk::YLeaf configured_min_thresh; //type: string ydk::YLeaf minimum_tca_report; //type: boolean ydk::YLeaf maximum_threshold; //type: string ydk::YLeaf configured_max_thresh; //type: string ydk::YLeaf maximum_tca_report; //type: boolean }; // PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24Optics::DwdmHour24Optic::Dgd class PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24Optics::DwdmHour24Optic::Pmd : public ydk::Entity { public: Pmd(); ~Pmd(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf valid; //type: boolean ydk::YLeaf minimum; //type: string ydk::YLeaf average; //type: string ydk::YLeaf maximum; //type: string ydk::YLeaf minimum_threshold; //type: string ydk::YLeaf configured_min_thresh; //type: string ydk::YLeaf minimum_tca_report; //type: boolean ydk::YLeaf maximum_threshold; //type: string ydk::YLeaf configured_max_thresh; //type: string ydk::YLeaf maximum_tca_report; //type: boolean }; // PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24Optics::DwdmHour24Optic::Pmd class PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24Optics::DwdmHour24Optic::Osnr : public ydk::Entity { public: Osnr(); ~Osnr(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf valid; //type: boolean ydk::YLeaf minimum; //type: string ydk::YLeaf average; //type: string ydk::YLeaf maximum; //type: string ydk::YLeaf minimum_threshold; //type: string ydk::YLeaf configured_min_thresh; //type: string ydk::YLeaf minimum_tca_report; //type: boolean ydk::YLeaf maximum_threshold; //type: string ydk::YLeaf configured_max_thresh; //type: string ydk::YLeaf maximum_tca_report; //type: boolean }; // PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24Optics::DwdmHour24Optic::Osnr class PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24Optics::DwdmHour24Optic::CenterWavelength : public ydk::Entity { public: CenterWavelength(); ~CenterWavelength(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf valid; //type: boolean ydk::YLeaf minimum; //type: string ydk::YLeaf average; //type: string ydk::YLeaf maximum; //type: string ydk::YLeaf minimum_threshold; //type: string ydk::YLeaf configured_min_thresh; //type: string ydk::YLeaf minimum_tca_report; //type: boolean ydk::YLeaf maximum_threshold; //type: string ydk::YLeaf configured_max_thresh; //type: string ydk::YLeaf maximum_tca_report; //type: boolean }; // PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24Optics::DwdmHour24Optic::CenterWavelength class PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24Optics::DwdmHour24Optic::Pdl : public ydk::Entity { public: Pdl(); ~Pdl(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf valid; //type: boolean ydk::YLeaf minimum; //type: string ydk::YLeaf average; //type: string ydk::YLeaf maximum; //type: string ydk::YLeaf minimum_threshold; //type: string ydk::YLeaf configured_min_thresh; //type: string ydk::YLeaf minimum_tca_report; //type: boolean ydk::YLeaf maximum_threshold; //type: string ydk::YLeaf configured_max_thresh; //type: string ydk::YLeaf maximum_tca_report; //type: boolean }; // PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24Optics::DwdmHour24Optic::Pdl class PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24Optics::DwdmHour24Optic::Pcr : public ydk::Entity { public: Pcr(); ~Pcr(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf valid; //type: boolean ydk::YLeaf minimum; //type: string ydk::YLeaf average; //type: string ydk::YLeaf maximum; //type: string ydk::YLeaf minimum_threshold; //type: string ydk::YLeaf configured_min_thresh; //type: string ydk::YLeaf minimum_tca_report; //type: boolean ydk::YLeaf maximum_threshold; //type: string ydk::YLeaf configured_max_thresh; //type: string ydk::YLeaf maximum_tca_report; //type: boolean }; // PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24Optics::DwdmHour24Optic::Pcr class PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24Optics::DwdmHour24Optic::Pn : public ydk::Entity { public: Pn(); ~Pn(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf valid; //type: boolean ydk::YLeaf minimum; //type: string ydk::YLeaf average; //type: string ydk::YLeaf maximum; //type: string ydk::YLeaf minimum_threshold; //type: string ydk::YLeaf configured_min_thresh; //type: string ydk::YLeaf minimum_tca_report; //type: boolean ydk::YLeaf maximum_threshold; //type: string ydk::YLeaf configured_max_thresh; //type: string ydk::YLeaf maximum_tca_report; //type: boolean }; // PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24Optics::DwdmHour24Optic::Pn class PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24Optics::DwdmHour24Optic::RxSigPow : public ydk::Entity { public: RxSigPow(); ~RxSigPow(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf valid; //type: boolean ydk::YLeaf minimum; //type: string ydk::YLeaf average; //type: string ydk::YLeaf maximum; //type: string ydk::YLeaf minimum_threshold; //type: string ydk::YLeaf configured_min_thresh; //type: string ydk::YLeaf minimum_tca_report; //type: boolean ydk::YLeaf maximum_threshold; //type: string ydk::YLeaf configured_max_thresh; //type: string ydk::YLeaf maximum_tca_report; //type: boolean }; // PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24Optics::DwdmHour24Optic::RxSigPow class PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24Optics::DwdmHour24Optic::LowSigFreqOff : public ydk::Entity { public: LowSigFreqOff(); ~LowSigFreqOff(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf valid; //type: boolean ydk::YLeaf minimum; //type: int32 ydk::YLeaf average; //type: int32 ydk::YLeaf maximum; //type: int32 ydk::YLeaf minimum_threshold; //type: int32 ydk::YLeaf configured_min_thresh; //type: string ydk::YLeaf minimum_tca_report; //type: boolean ydk::YLeaf maximum_threshold; //type: int32 ydk::YLeaf configured_max_thresh; //type: string ydk::YLeaf maximum_tca_report; //type: boolean }; // PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24Optics::DwdmHour24Optic::LowSigFreqOff class PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24Optics::DwdmHour24Optic::AmpliGain : public ydk::Entity { public: AmpliGain(); ~AmpliGain(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf valid; //type: boolean ydk::YLeaf minimum; //type: string ydk::YLeaf average; //type: string ydk::YLeaf maximum; //type: string ydk::YLeaf minimum_threshold; //type: string ydk::YLeaf configured_min_thresh; //type: string ydk::YLeaf minimum_tca_report; //type: boolean ydk::YLeaf maximum_threshold; //type: string ydk::YLeaf configured_max_thresh; //type: string ydk::YLeaf maximum_tca_report; //type: boolean }; // PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24Optics::DwdmHour24Optic::AmpliGain class PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24Optics::DwdmHour24Optic::AmpliGainTilt : public ydk::Entity { public: AmpliGainTilt(); ~AmpliGainTilt(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf valid; //type: boolean ydk::YLeaf minimum; //type: string ydk::YLeaf average; //type: string ydk::YLeaf maximum; //type: string ydk::YLeaf minimum_threshold; //type: string ydk::YLeaf configured_min_thresh; //type: string ydk::YLeaf minimum_tca_report; //type: boolean ydk::YLeaf maximum_threshold; //type: string ydk::YLeaf configured_max_thresh; //type: string ydk::YLeaf maximum_tca_report; //type: boolean }; // PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24Optics::DwdmHour24Optic::AmpliGainTilt class PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24fecs : public ydk::Entity { public: DwdmHour24fecs(); ~DwdmHour24fecs(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; class DwdmHour24fec; //type: PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24fecs::DwdmHour24fec ydk::YList dwdm_hour24fec; }; // PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24fecs class PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24fecs::DwdmHour24fec : public ydk::Entity { public: DwdmHour24fec(); ~DwdmHour24fec(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf number; //type: uint32 ydk::YLeaf index_; //type: uint32 ydk::YLeaf valid; //type: boolean ydk::YLeaf timestamp; //type: string ydk::YLeaf last_clear_time; //type: string ydk::YLeaf last_clear15_min_time; //type: string ydk::YLeaf last_clear30_sec_time; //type: string ydk::YLeaf last_clear24_hr_time; //type: string ydk::YLeaf sec30_support; //type: boolean class EcBits; //type: PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24fecs::DwdmHour24fec::EcBits class UcWords; //type: PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24fecs::DwdmHour24fec::UcWords class PreFecBer; //type: PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24fecs::DwdmHour24fec::PreFecBer class PostFecBer; //type: PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24fecs::DwdmHour24fec::PostFecBer class Q; //type: PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24fecs::DwdmHour24fec::Q class Qmargin; //type: PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24fecs::DwdmHour24fec::Qmargin std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24fecs::DwdmHour24fec::EcBits> ec_bits; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24fecs::DwdmHour24fec::UcWords> uc_words; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24fecs::DwdmHour24fec::PreFecBer> pre_fec_ber; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24fecs::DwdmHour24fec::PostFecBer> post_fec_ber; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24fecs::DwdmHour24fec::Q> q; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24fecs::DwdmHour24fec::Qmargin> qmargin; }; // PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24fecs::DwdmHour24fec class PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24fecs::DwdmHour24fec::EcBits : public ydk::Entity { public: EcBits(); ~EcBits(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf data; //type: uint64 ydk::YLeaf threshold; //type: uint64 ydk::YLeaf tca_report; //type: boolean ydk::YLeaf valid; //type: boolean }; // PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24fecs::DwdmHour24fec::EcBits class PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24fecs::DwdmHour24fec::UcWords : public ydk::Entity { public: UcWords(); ~UcWords(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf data; //type: uint64 ydk::YLeaf threshold; //type: uint64 ydk::YLeaf tca_report; //type: boolean ydk::YLeaf valid; //type: boolean }; // PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24fecs::DwdmHour24fec::UcWords class PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24fecs::DwdmHour24fec::PreFecBer : public ydk::Entity { public: PreFecBer(); ~PreFecBer(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf minimum; //type: string ydk::YLeaf average; //type: string ydk::YLeaf maximum; //type: string ydk::YLeaf minimum_threshold; //type: string ydk::YLeaf minimum_tca_report; //type: boolean ydk::YLeaf maximum_threshold; //type: string ydk::YLeaf maximum_tca_report; //type: boolean ydk::YLeaf valid; //type: boolean }; // PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24fecs::DwdmHour24fec::PreFecBer class PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24fecs::DwdmHour24fec::PostFecBer : public ydk::Entity { public: PostFecBer(); ~PostFecBer(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf minimum; //type: string ydk::YLeaf average; //type: string ydk::YLeaf maximum; //type: string ydk::YLeaf minimum_threshold; //type: string ydk::YLeaf minimum_tca_report; //type: boolean ydk::YLeaf maximum_threshold; //type: string ydk::YLeaf maximum_tca_report; //type: boolean ydk::YLeaf valid; //type: boolean }; // PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24fecs::DwdmHour24fec::PostFecBer class PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24fecs::DwdmHour24fec::Q : public ydk::Entity { public: Q(); ~Q(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf minimum; //type: string ydk::YLeaf average; //type: string ydk::YLeaf maximum; //type: string ydk::YLeaf minimum_threshold; //type: string ydk::YLeaf minimum_tca_report; //type: boolean ydk::YLeaf maximum_threshold; //type: string ydk::YLeaf maximum_tca_report; //type: boolean ydk::YLeaf valid; //type: boolean }; // PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24fecs::DwdmHour24fec::Q class PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24fecs::DwdmHour24fec::Qmargin : public ydk::Entity { public: Qmargin(); ~Qmargin(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf minimum; //type: string ydk::YLeaf average; //type: string ydk::YLeaf maximum; //type: string ydk::YLeaf minimum_threshold; //type: string ydk::YLeaf minimum_tca_report; //type: boolean ydk::YLeaf maximum_threshold; //type: string ydk::YLeaf maximum_tca_report; //type: boolean ydk::YLeaf valid; //type: boolean }; // PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24fecs::DwdmHour24fec::Qmargin class PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24otns : public ydk::Entity { public: DwdmHour24otns(); ~DwdmHour24otns(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; class DwdmHour24otn; //type: PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24otns::DwdmHour24otn ydk::YList dwdm_hour24otn; }; // PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24otns class PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24otns::DwdmHour24otn : public ydk::Entity { public: DwdmHour24otn(); ~DwdmHour24otn(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf number; //type: uint32 ydk::YLeaf index_; //type: uint32 ydk::YLeaf valid; //type: boolean ydk::YLeaf timestamp; //type: string ydk::YLeaf last_clear_time; //type: string ydk::YLeaf last_clear15_min_time; //type: string ydk::YLeaf last_clear30_sec_time; //type: string ydk::YLeaf last_clear24_hr_time; //type: string ydk::YLeaf sec30_support; //type: boolean class Lbc; //type: PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24otns::DwdmHour24otn::Lbc class EsNe; //type: PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24otns::DwdmHour24otn::EsNe class EsrNe; //type: PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24otns::DwdmHour24otn::EsrNe class SesNe; //type: PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24otns::DwdmHour24otn::SesNe class SesrNe; //type: PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24otns::DwdmHour24otn::SesrNe class UasNe; //type: PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24otns::DwdmHour24otn::UasNe class BbeNe; //type: PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24otns::DwdmHour24otn::BbeNe class BberNe; //type: PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24otns::DwdmHour24otn::BberNe class FcNe; //type: PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24otns::DwdmHour24otn::FcNe class EsFe; //type: PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24otns::DwdmHour24otn::EsFe class EsrFe; //type: PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24otns::DwdmHour24otn::EsrFe class SesFe; //type: PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24otns::DwdmHour24otn::SesFe class SesrFe; //type: PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24otns::DwdmHour24otn::SesrFe class UasFe; //type: PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24otns::DwdmHour24otn::UasFe class BbeFe; //type: PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24otns::DwdmHour24otn::BbeFe class BberFe; //type: PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24otns::DwdmHour24otn::BberFe class FcFe; //type: PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24otns::DwdmHour24otn::FcFe std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24otns::DwdmHour24otn::Lbc> lbc; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24otns::DwdmHour24otn::EsNe> es_ne; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24otns::DwdmHour24otn::EsrNe> esr_ne; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24otns::DwdmHour24otn::SesNe> ses_ne; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24otns::DwdmHour24otn::SesrNe> sesr_ne; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24otns::DwdmHour24otn::UasNe> uas_ne; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24otns::DwdmHour24otn::BbeNe> bbe_ne; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24otns::DwdmHour24otn::BberNe> bber_ne; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24otns::DwdmHour24otn::FcNe> fc_ne; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24otns::DwdmHour24otn::EsFe> es_fe; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24otns::DwdmHour24otn::EsrFe> esr_fe; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24otns::DwdmHour24otn::SesFe> ses_fe; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24otns::DwdmHour24otn::SesrFe> sesr_fe; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24otns::DwdmHour24otn::UasFe> uas_fe; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24otns::DwdmHour24otn::BbeFe> bbe_fe; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24otns::DwdmHour24otn::BberFe> bber_fe; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24otns::DwdmHour24otn::FcFe> fc_fe; }; // PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24otns::DwdmHour24otn class PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24otns::DwdmHour24otn::Lbc : public ydk::Entity { public: Lbc(); ~Lbc(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf data; //type: uint64 ydk::YLeaf threshold; //type: uint64 ydk::YLeaf tca_report; //type: boolean }; // PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24otns::DwdmHour24otn::Lbc class PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24otns::DwdmHour24otn::EsNe : public ydk::Entity { public: EsNe(); ~EsNe(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf data; //type: uint64 ydk::YLeaf threshold; //type: uint64 ydk::YLeaf tca_report; //type: boolean }; // PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24otns::DwdmHour24otn::EsNe class PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24otns::DwdmHour24otn::EsrNe : public ydk::Entity { public: EsrNe(); ~EsrNe(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf data; //type: string ydk::YLeaf threshold; //type: string ydk::YLeaf tca_report; //type: boolean }; // PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24otns::DwdmHour24otn::EsrNe class PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24otns::DwdmHour24otn::SesNe : public ydk::Entity { public: SesNe(); ~SesNe(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf data; //type: uint64 ydk::YLeaf threshold; //type: uint64 ydk::YLeaf tca_report; //type: boolean }; // PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24otns::DwdmHour24otn::SesNe class PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24otns::DwdmHour24otn::SesrNe : public ydk::Entity { public: SesrNe(); ~SesrNe(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf data; //type: string ydk::YLeaf threshold; //type: string ydk::YLeaf tca_report; //type: boolean }; // PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24otns::DwdmHour24otn::SesrNe class PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24otns::DwdmHour24otn::UasNe : public ydk::Entity { public: UasNe(); ~UasNe(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf data; //type: uint64 ydk::YLeaf threshold; //type: uint64 ydk::YLeaf tca_report; //type: boolean }; // PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24otns::DwdmHour24otn::UasNe class PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24otns::DwdmHour24otn::BbeNe : public ydk::Entity { public: BbeNe(); ~BbeNe(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf data; //type: uint64 ydk::YLeaf threshold; //type: uint64 ydk::YLeaf tca_report; //type: boolean }; // PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24otns::DwdmHour24otn::BbeNe class PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24otns::DwdmHour24otn::BberNe : public ydk::Entity { public: BberNe(); ~BberNe(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf data; //type: string ydk::YLeaf threshold; //type: string ydk::YLeaf tca_report; //type: boolean }; // PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24otns::DwdmHour24otn::BberNe class PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24otns::DwdmHour24otn::FcNe : public ydk::Entity { public: FcNe(); ~FcNe(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf data; //type: uint64 ydk::YLeaf threshold; //type: uint64 ydk::YLeaf tca_report; //type: boolean }; // PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24otns::DwdmHour24otn::FcNe class PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24otns::DwdmHour24otn::EsFe : public ydk::Entity { public: EsFe(); ~EsFe(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf data; //type: uint64 ydk::YLeaf threshold; //type: uint64 ydk::YLeaf tca_report; //type: boolean }; // PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24otns::DwdmHour24otn::EsFe class PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24otns::DwdmHour24otn::EsrFe : public ydk::Entity { public: EsrFe(); ~EsrFe(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf data; //type: string ydk::YLeaf threshold; //type: string ydk::YLeaf tca_report; //type: boolean }; // PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24otns::DwdmHour24otn::EsrFe class PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24otns::DwdmHour24otn::SesFe : public ydk::Entity { public: SesFe(); ~SesFe(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf data; //type: uint64 ydk::YLeaf threshold; //type: uint64 ydk::YLeaf tca_report; //type: boolean }; // PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24otns::DwdmHour24otn::SesFe class PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24otns::DwdmHour24otn::SesrFe : public ydk::Entity { public: SesrFe(); ~SesrFe(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf data; //type: string ydk::YLeaf threshold; //type: string ydk::YLeaf tca_report; //type: boolean }; // PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24otns::DwdmHour24otn::SesrFe class PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24otns::DwdmHour24otn::UasFe : public ydk::Entity { public: UasFe(); ~UasFe(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf data; //type: uint64 ydk::YLeaf threshold; //type: uint64 ydk::YLeaf tca_report; //type: boolean }; // PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24otns::DwdmHour24otn::UasFe class PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24otns::DwdmHour24otn::BbeFe : public ydk::Entity { public: BbeFe(); ~BbeFe(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf data; //type: uint64 ydk::YLeaf threshold; //type: uint64 ydk::YLeaf tca_report; //type: boolean }; // PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24otns::DwdmHour24otn::BbeFe class PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24otns::DwdmHour24otn::BberFe : public ydk::Entity { public: BberFe(); ~BberFe(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf data; //type: string ydk::YLeaf threshold; //type: string ydk::YLeaf tca_report; //type: boolean }; // PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24otns::DwdmHour24otn::BberFe class PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24otns::DwdmHour24otn::FcFe : public ydk::Entity { public: FcFe(); ~FcFe(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf data; //type: uint64 ydk::YLeaf threshold; //type: uint64 ydk::YLeaf tca_report; //type: boolean }; // PerformanceManagement::Dwdm::DwdmPorts::DwdmPort::DwdmCurrent::DwdmHour24::DwdmHour24otns::DwdmHour24otn::FcFe class PerformanceManagement::Oc : public ydk::Entity { public: Oc(); ~Oc(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; std::string get_absolute_path() const override; class OcPorts; //type: PerformanceManagement::Oc::OcPorts std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Oc::OcPorts> oc_ports; }; // PerformanceManagement::Oc class PerformanceManagement::Oc::OcPorts : public ydk::Entity { public: OcPorts(); ~OcPorts(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; std::string get_absolute_path() const override; class OcPort; //type: PerformanceManagement::Oc::OcPorts::OcPort ydk::YList oc_port; }; // PerformanceManagement::Oc::OcPorts class PerformanceManagement::Oc::OcPorts::OcPort : public ydk::Entity { public: OcPort(); ~OcPort(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; std::string get_absolute_path() const override; ydk::YLeaf name; //type: string class OcCurrent; //type: PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent> oc_current; }; // PerformanceManagement::Oc::OcPorts::OcPort class PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent : public ydk::Entity { public: OcCurrent(); ~OcCurrent(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; class OcHour24; //type: PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcHour24 class OcMinute15; //type: PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcMinute15 std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcHour24> oc_hour24; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcMinute15> oc_minute15; }; // PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent class PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcHour24 : public ydk::Entity { public: OcHour24(); ~OcHour24(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; class OcHour24ocns; //type: PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcHour24::OcHour24ocns std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcHour24::OcHour24ocns> oc_hour24ocns; }; // PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcHour24 class PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcHour24::OcHour24ocns : public ydk::Entity { public: OcHour24ocns(); ~OcHour24ocns(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; class OcHour24ocn; //type: PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcHour24::OcHour24ocns::OcHour24ocn ydk::YList oc_hour24ocn; }; // PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcHour24::OcHour24ocns class PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcHour24::OcHour24ocns::OcHour24ocn : public ydk::Entity { public: OcHour24ocn(); ~OcHour24ocn(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf number; //type: uint32 ydk::YLeaf index_; //type: uint32 ydk::YLeaf valid; //type: boolean ydk::YLeaf timestamp; //type: string ydk::YLeaf last_clear_time; //type: string ydk::YLeaf last_clear15_min_time; //type: string ydk::YLeaf last_clear24_hr_time; //type: string class Section; //type: PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcHour24::OcHour24ocns::OcHour24ocn::Section class Line; //type: PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcHour24::OcHour24ocns::OcHour24ocn::Line class FeLine; //type: PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcHour24::OcHour24ocns::OcHour24ocn::FeLine std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcHour24::OcHour24ocns::OcHour24ocn::Section> section; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcHour24::OcHour24ocns::OcHour24ocn::Line> line; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcHour24::OcHour24ocns::OcHour24ocn::FeLine> fe_line; }; // PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcHour24::OcHour24ocns::OcHour24ocn class PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcHour24::OcHour24ocns::OcHour24ocn::Section : public ydk::Entity { public: Section(); ~Section(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf section_status; //type: int32 class SectionESs; //type: PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcHour24::OcHour24ocns::OcHour24ocn::Section::SectionESs class SectionSeSs; //type: PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcHour24::OcHour24ocns::OcHour24ocn::Section::SectionSeSs class SectionSefSs; //type: PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcHour24::OcHour24ocns::OcHour24ocn::Section::SectionSefSs class SectionCVs; //type: PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcHour24::OcHour24ocns::OcHour24ocn::Section::SectionCVs std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcHour24::OcHour24ocns::OcHour24ocn::Section::SectionESs> section_e_ss; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcHour24::OcHour24ocns::OcHour24ocn::Section::SectionSeSs> section_se_ss; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcHour24::OcHour24ocns::OcHour24ocn::Section::SectionSefSs> section_sef_ss; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcHour24::OcHour24ocns::OcHour24ocn::Section::SectionCVs> section_c_vs; }; // PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcHour24::OcHour24ocns::OcHour24ocn::Section class PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcHour24::OcHour24ocns::OcHour24ocn::Section::SectionESs : public ydk::Entity { public: SectionESs(); ~SectionESs(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf data; //type: uint32 ydk::YLeaf threshold; //type: uint32 ydk::YLeaf tca_report; //type: boolean }; // PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcHour24::OcHour24ocns::OcHour24ocn::Section::SectionESs class PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcHour24::OcHour24ocns::OcHour24ocn::Section::SectionSeSs : public ydk::Entity { public: SectionSeSs(); ~SectionSeSs(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf data; //type: uint32 ydk::YLeaf threshold; //type: uint32 ydk::YLeaf tca_report; //type: boolean }; // PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcHour24::OcHour24ocns::OcHour24ocn::Section::SectionSeSs class PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcHour24::OcHour24ocns::OcHour24ocn::Section::SectionSefSs : public ydk::Entity { public: SectionSefSs(); ~SectionSefSs(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf data; //type: uint32 ydk::YLeaf threshold; //type: uint32 ydk::YLeaf tca_report; //type: boolean }; // PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcHour24::OcHour24ocns::OcHour24ocn::Section::SectionSefSs class PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcHour24::OcHour24ocns::OcHour24ocn::Section::SectionCVs : public ydk::Entity { public: SectionCVs(); ~SectionCVs(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf data; //type: uint32 ydk::YLeaf threshold; //type: uint32 ydk::YLeaf tca_report; //type: boolean }; // PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcHour24::OcHour24ocns::OcHour24ocn::Section::SectionCVs class PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcHour24::OcHour24ocns::OcHour24ocn::Line : public ydk::Entity { public: Line(); ~Line(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf line_status; //type: int32 class LineESs; //type: PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcHour24::OcHour24ocns::OcHour24ocn::Line::LineESs class LineSeSs; //type: PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcHour24::OcHour24ocns::OcHour24ocn::Line::LineSeSs class LineCVs; //type: PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcHour24::OcHour24ocns::OcHour24ocn::Line::LineCVs class LineUaSs; //type: PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcHour24::OcHour24ocns::OcHour24ocn::Line::LineUaSs class LineFcLs; //type: PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcHour24::OcHour24ocns::OcHour24ocn::Line::LineFcLs std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcHour24::OcHour24ocns::OcHour24ocn::Line::LineESs> line_e_ss; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcHour24::OcHour24ocns::OcHour24ocn::Line::LineSeSs> line_se_ss; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcHour24::OcHour24ocns::OcHour24ocn::Line::LineCVs> line_c_vs; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcHour24::OcHour24ocns::OcHour24ocn::Line::LineUaSs> line_ua_ss; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcHour24::OcHour24ocns::OcHour24ocn::Line::LineFcLs> line_fc_ls; }; // PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcHour24::OcHour24ocns::OcHour24ocn::Line class PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcHour24::OcHour24ocns::OcHour24ocn::Line::LineESs : public ydk::Entity { public: LineESs(); ~LineESs(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf data; //type: uint32 ydk::YLeaf threshold; //type: uint32 ydk::YLeaf tca_report; //type: boolean }; // PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcHour24::OcHour24ocns::OcHour24ocn::Line::LineESs class PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcHour24::OcHour24ocns::OcHour24ocn::Line::LineSeSs : public ydk::Entity { public: LineSeSs(); ~LineSeSs(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf data; //type: uint32 ydk::YLeaf threshold; //type: uint32 ydk::YLeaf tca_report; //type: boolean }; // PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcHour24::OcHour24ocns::OcHour24ocn::Line::LineSeSs class PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcHour24::OcHour24ocns::OcHour24ocn::Line::LineCVs : public ydk::Entity { public: LineCVs(); ~LineCVs(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf data; //type: uint32 ydk::YLeaf threshold; //type: uint32 ydk::YLeaf tca_report; //type: boolean }; // PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcHour24::OcHour24ocns::OcHour24ocn::Line::LineCVs class PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcHour24::OcHour24ocns::OcHour24ocn::Line::LineUaSs : public ydk::Entity { public: LineUaSs(); ~LineUaSs(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf data; //type: uint32 ydk::YLeaf threshold; //type: uint32 ydk::YLeaf tca_report; //type: boolean }; // PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcHour24::OcHour24ocns::OcHour24ocn::Line::LineUaSs class PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcHour24::OcHour24ocns::OcHour24ocn::Line::LineFcLs : public ydk::Entity { public: LineFcLs(); ~LineFcLs(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf data; //type: uint32 ydk::YLeaf threshold; //type: uint32 ydk::YLeaf tca_report; //type: boolean }; // PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcHour24::OcHour24ocns::OcHour24ocn::Line::LineFcLs class PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcHour24::OcHour24ocns::OcHour24ocn::FeLine : public ydk::Entity { public: FeLine(); ~FeLine(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; class FarEndLineESs; //type: PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcHour24::OcHour24ocns::OcHour24ocn::FeLine::FarEndLineESs class FarEndLineSeSs; //type: PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcHour24::OcHour24ocns::OcHour24ocn::FeLine::FarEndLineSeSs class FarEndLineCVs; //type: PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcHour24::OcHour24ocns::OcHour24ocn::FeLine::FarEndLineCVs class FarEndLineUaSs; //type: PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcHour24::OcHour24ocns::OcHour24ocn::FeLine::FarEndLineUaSs class FarEndLineFcLs; //type: PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcHour24::OcHour24ocns::OcHour24ocn::FeLine::FarEndLineFcLs std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcHour24::OcHour24ocns::OcHour24ocn::FeLine::FarEndLineESs> far_end_line_e_ss; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcHour24::OcHour24ocns::OcHour24ocn::FeLine::FarEndLineSeSs> far_end_line_se_ss; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcHour24::OcHour24ocns::OcHour24ocn::FeLine::FarEndLineCVs> far_end_line_c_vs; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcHour24::OcHour24ocns::OcHour24ocn::FeLine::FarEndLineUaSs> far_end_line_ua_ss; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcHour24::OcHour24ocns::OcHour24ocn::FeLine::FarEndLineFcLs> far_end_line_fc_ls; }; // PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcHour24::OcHour24ocns::OcHour24ocn::FeLine class PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcHour24::OcHour24ocns::OcHour24ocn::FeLine::FarEndLineESs : public ydk::Entity { public: FarEndLineESs(); ~FarEndLineESs(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf data; //type: uint32 ydk::YLeaf threshold; //type: uint32 ydk::YLeaf tca_report; //type: boolean }; // PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcHour24::OcHour24ocns::OcHour24ocn::FeLine::FarEndLineESs class PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcHour24::OcHour24ocns::OcHour24ocn::FeLine::FarEndLineSeSs : public ydk::Entity { public: FarEndLineSeSs(); ~FarEndLineSeSs(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf data; //type: uint32 ydk::YLeaf threshold; //type: uint32 ydk::YLeaf tca_report; //type: boolean }; // PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcHour24::OcHour24ocns::OcHour24ocn::FeLine::FarEndLineSeSs class PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcHour24::OcHour24ocns::OcHour24ocn::FeLine::FarEndLineCVs : public ydk::Entity { public: FarEndLineCVs(); ~FarEndLineCVs(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf data; //type: uint32 ydk::YLeaf threshold; //type: uint32 ydk::YLeaf tca_report; //type: boolean }; // PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcHour24::OcHour24ocns::OcHour24ocn::FeLine::FarEndLineCVs class PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcHour24::OcHour24ocns::OcHour24ocn::FeLine::FarEndLineUaSs : public ydk::Entity { public: FarEndLineUaSs(); ~FarEndLineUaSs(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf data; //type: uint32 ydk::YLeaf threshold; //type: uint32 ydk::YLeaf tca_report; //type: boolean }; // PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcHour24::OcHour24ocns::OcHour24ocn::FeLine::FarEndLineUaSs class PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcHour24::OcHour24ocns::OcHour24ocn::FeLine::FarEndLineFcLs : public ydk::Entity { public: FarEndLineFcLs(); ~FarEndLineFcLs(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf data; //type: uint32 ydk::YLeaf threshold; //type: uint32 ydk::YLeaf tca_report; //type: boolean }; // PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcHour24::OcHour24ocns::OcHour24ocn::FeLine::FarEndLineFcLs class PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcMinute15 : public ydk::Entity { public: OcMinute15(); ~OcMinute15(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; class OcMinute15ocns; //type: PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcMinute15::OcMinute15ocns std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcMinute15::OcMinute15ocns> oc_minute15ocns; }; // PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcMinute15 class PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcMinute15::OcMinute15ocns : public ydk::Entity { public: OcMinute15ocns(); ~OcMinute15ocns(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; class OcMinute15ocn; //type: PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcMinute15::OcMinute15ocns::OcMinute15ocn ydk::YList oc_minute15ocn; }; // PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcMinute15::OcMinute15ocns class PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcMinute15::OcMinute15ocns::OcMinute15ocn : public ydk::Entity { public: OcMinute15ocn(); ~OcMinute15ocn(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf number; //type: uint32 ydk::YLeaf index_; //type: uint32 ydk::YLeaf valid; //type: boolean ydk::YLeaf timestamp; //type: string ydk::YLeaf last_clear_time; //type: string ydk::YLeaf last_clear15_min_time; //type: string ydk::YLeaf last_clear24_hr_time; //type: string class Section; //type: PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcMinute15::OcMinute15ocns::OcMinute15ocn::Section class Line; //type: PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcMinute15::OcMinute15ocns::OcMinute15ocn::Line class FeLine; //type: PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcMinute15::OcMinute15ocns::OcMinute15ocn::FeLine std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcMinute15::OcMinute15ocns::OcMinute15ocn::Section> section; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcMinute15::OcMinute15ocns::OcMinute15ocn::Line> line; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcMinute15::OcMinute15ocns::OcMinute15ocn::FeLine> fe_line; }; // PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcMinute15::OcMinute15ocns::OcMinute15ocn class PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcMinute15::OcMinute15ocns::OcMinute15ocn::Section : public ydk::Entity { public: Section(); ~Section(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf section_status; //type: int32 class SectionESs; //type: PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcMinute15::OcMinute15ocns::OcMinute15ocn::Section::SectionESs class SectionSeSs; //type: PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcMinute15::OcMinute15ocns::OcMinute15ocn::Section::SectionSeSs class SectionSefSs; //type: PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcMinute15::OcMinute15ocns::OcMinute15ocn::Section::SectionSefSs class SectionCVs; //type: PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcMinute15::OcMinute15ocns::OcMinute15ocn::Section::SectionCVs std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcMinute15::OcMinute15ocns::OcMinute15ocn::Section::SectionESs> section_e_ss; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcMinute15::OcMinute15ocns::OcMinute15ocn::Section::SectionSeSs> section_se_ss; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcMinute15::OcMinute15ocns::OcMinute15ocn::Section::SectionSefSs> section_sef_ss; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcMinute15::OcMinute15ocns::OcMinute15ocn::Section::SectionCVs> section_c_vs; }; // PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcMinute15::OcMinute15ocns::OcMinute15ocn::Section class PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcMinute15::OcMinute15ocns::OcMinute15ocn::Section::SectionESs : public ydk::Entity { public: SectionESs(); ~SectionESs(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf data; //type: uint32 ydk::YLeaf threshold; //type: uint32 ydk::YLeaf tca_report; //type: boolean }; // PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcMinute15::OcMinute15ocns::OcMinute15ocn::Section::SectionESs class PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcMinute15::OcMinute15ocns::OcMinute15ocn::Section::SectionSeSs : public ydk::Entity { public: SectionSeSs(); ~SectionSeSs(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf data; //type: uint32 ydk::YLeaf threshold; //type: uint32 ydk::YLeaf tca_report; //type: boolean }; // PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcMinute15::OcMinute15ocns::OcMinute15ocn::Section::SectionSeSs class PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcMinute15::OcMinute15ocns::OcMinute15ocn::Section::SectionSefSs : public ydk::Entity { public: SectionSefSs(); ~SectionSefSs(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf data; //type: uint32 ydk::YLeaf threshold; //type: uint32 ydk::YLeaf tca_report; //type: boolean }; // PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcMinute15::OcMinute15ocns::OcMinute15ocn::Section::SectionSefSs class PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcMinute15::OcMinute15ocns::OcMinute15ocn::Section::SectionCVs : public ydk::Entity { public: SectionCVs(); ~SectionCVs(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf data; //type: uint32 ydk::YLeaf threshold; //type: uint32 ydk::YLeaf tca_report; //type: boolean }; // PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcMinute15::OcMinute15ocns::OcMinute15ocn::Section::SectionCVs class PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcMinute15::OcMinute15ocns::OcMinute15ocn::Line : public ydk::Entity { public: Line(); ~Line(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf line_status; //type: int32 class LineESs; //type: PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcMinute15::OcMinute15ocns::OcMinute15ocn::Line::LineESs class LineSeSs; //type: PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcMinute15::OcMinute15ocns::OcMinute15ocn::Line::LineSeSs class LineCVs; //type: PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcMinute15::OcMinute15ocns::OcMinute15ocn::Line::LineCVs class LineUaSs; //type: PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcMinute15::OcMinute15ocns::OcMinute15ocn::Line::LineUaSs class LineFcLs; //type: PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcMinute15::OcMinute15ocns::OcMinute15ocn::Line::LineFcLs std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcMinute15::OcMinute15ocns::OcMinute15ocn::Line::LineESs> line_e_ss; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcMinute15::OcMinute15ocns::OcMinute15ocn::Line::LineSeSs> line_se_ss; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcMinute15::OcMinute15ocns::OcMinute15ocn::Line::LineCVs> line_c_vs; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcMinute15::OcMinute15ocns::OcMinute15ocn::Line::LineUaSs> line_ua_ss; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcMinute15::OcMinute15ocns::OcMinute15ocn::Line::LineFcLs> line_fc_ls; }; // PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcMinute15::OcMinute15ocns::OcMinute15ocn::Line class PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcMinute15::OcMinute15ocns::OcMinute15ocn::Line::LineESs : public ydk::Entity { public: LineESs(); ~LineESs(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf data; //type: uint32 ydk::YLeaf threshold; //type: uint32 ydk::YLeaf tca_report; //type: boolean }; // PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcMinute15::OcMinute15ocns::OcMinute15ocn::Line::LineESs class PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcMinute15::OcMinute15ocns::OcMinute15ocn::Line::LineSeSs : public ydk::Entity { public: LineSeSs(); ~LineSeSs(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf data; //type: uint32 ydk::YLeaf threshold; //type: uint32 ydk::YLeaf tca_report; //type: boolean }; // PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcMinute15::OcMinute15ocns::OcMinute15ocn::Line::LineSeSs class PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcMinute15::OcMinute15ocns::OcMinute15ocn::Line::LineCVs : public ydk::Entity { public: LineCVs(); ~LineCVs(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf data; //type: uint32 ydk::YLeaf threshold; //type: uint32 ydk::YLeaf tca_report; //type: boolean }; // PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcMinute15::OcMinute15ocns::OcMinute15ocn::Line::LineCVs class PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcMinute15::OcMinute15ocns::OcMinute15ocn::Line::LineUaSs : public ydk::Entity { public: LineUaSs(); ~LineUaSs(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf data; //type: uint32 ydk::YLeaf threshold; //type: uint32 ydk::YLeaf tca_report; //type: boolean }; // PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcMinute15::OcMinute15ocns::OcMinute15ocn::Line::LineUaSs class PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcMinute15::OcMinute15ocns::OcMinute15ocn::Line::LineFcLs : public ydk::Entity { public: LineFcLs(); ~LineFcLs(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf data; //type: uint32 ydk::YLeaf threshold; //type: uint32 ydk::YLeaf tca_report; //type: boolean }; // PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcMinute15::OcMinute15ocns::OcMinute15ocn::Line::LineFcLs class PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcMinute15::OcMinute15ocns::OcMinute15ocn::FeLine : public ydk::Entity { public: FeLine(); ~FeLine(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; class FarEndLineESs; //type: PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcMinute15::OcMinute15ocns::OcMinute15ocn::FeLine::FarEndLineESs class FarEndLineSeSs; //type: PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcMinute15::OcMinute15ocns::OcMinute15ocn::FeLine::FarEndLineSeSs class FarEndLineCVs; //type: PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcMinute15::OcMinute15ocns::OcMinute15ocn::FeLine::FarEndLineCVs class FarEndLineUaSs; //type: PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcMinute15::OcMinute15ocns::OcMinute15ocn::FeLine::FarEndLineUaSs class FarEndLineFcLs; //type: PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcMinute15::OcMinute15ocns::OcMinute15ocn::FeLine::FarEndLineFcLs std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcMinute15::OcMinute15ocns::OcMinute15ocn::FeLine::FarEndLineESs> far_end_line_e_ss; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcMinute15::OcMinute15ocns::OcMinute15ocn::FeLine::FarEndLineSeSs> far_end_line_se_ss; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcMinute15::OcMinute15ocns::OcMinute15ocn::FeLine::FarEndLineCVs> far_end_line_c_vs; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcMinute15::OcMinute15ocns::OcMinute15ocn::FeLine::FarEndLineUaSs> far_end_line_ua_ss; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_pmengine_oper::PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcMinute15::OcMinute15ocns::OcMinute15ocn::FeLine::FarEndLineFcLs> far_end_line_fc_ls; }; // PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcMinute15::OcMinute15ocns::OcMinute15ocn::FeLine class PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcMinute15::OcMinute15ocns::OcMinute15ocn::FeLine::FarEndLineESs : public ydk::Entity { public: FarEndLineESs(); ~FarEndLineESs(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf data; //type: uint32 ydk::YLeaf threshold; //type: uint32 ydk::YLeaf tca_report; //type: boolean }; // PerformanceManagement::Oc::OcPorts::OcPort::OcCurrent::OcMinute15::OcMinute15ocns::OcMinute15ocn::FeLine::FarEndLineESs } } #endif /* _CISCO_IOS_XR_PMENGINE_OPER_5_ */
60.561404
218
0.716902
CiscoDevNet
4d81bc7e0d9fbcccbeb19e2375f19e83c1b5ab8e
2,478
hh
C++
hoo/emitter/EmitterContext.hh
benoybose/hoolang
4e280a03caec837be35c8aac948923e1bea96b85
[ "BSD-3-Clause" ]
null
null
null
hoo/emitter/EmitterContext.hh
benoybose/hoolang
4e280a03caec837be35c8aac948923e1bea96b85
[ "BSD-3-Clause" ]
14
2020-07-24T10:25:59.000Z
2020-08-02T13:27:09.000Z
hoo/emitter/EmitterContext.hh
benoybose/hoolang
4e280a03caec837be35c8aac948923e1bea96b85
[ "BSD-3-Clause" ]
null
null
null
/* * Copyright 2020 Benoy Bose * * 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. */ #ifndef EMITTER_CONTEXT_HH #define EMITTER_CONTEXT_HH #include <hoo/emitter/BlockContext.hh> #include <llvm/IR/LLVMContext.h> #include <llvm/IR/Module.h> #include <llvm/IR/IRBuilder.h> #include <llvm/IR/Function.h> #include <string> #include <memory> #include <stack> namespace hoo { namespace emitter { class EmitterContext { private: std::shared_ptr<llvm::LLVMContext> _context; std::shared_ptr<llvm::Module> _module; std::shared_ptr<llvm::IRBuilder<>> _builder; std::string _unit_name; Function* _function; std::shared_ptr<std::stack<BlockContext*>> _block_stack; public: EmitterContext(const std::string &unit_name); public: llvm::LLVMContext *GetContext() { return _context.get(); } llvm::Module *GetModule() { return _module.get(); } llvm::IRBuilder<> *GetBuilder() { return _builder.get(); }; std::string &GetUnitName() { return _unit_name; } BlockContext *BeginBlock(const std::string &name = ""); void EndBlock(); BlockContext *GetCurrentBlockContext(); void SetFunction(Function* function) { _function = function; } Function* GetFunction() { return _function; } }; } } #endif // EMITTER_CONTEXT_HH
38.71875
100
0.679177
benoybose
4d850efb97344c14e4fc6d87caa017afebfa9d6a
8,646
cpp
C++
jni/RTKLIB/app/qtapp/rtkplot_qt/skydlg.cpp
wjw164833/RtkGpsForPad
c9fb10c0bc56cfa473582088dbc673c6da2d31be
[ "BSD-2-Clause" ]
2
2022-01-10T06:25:39.000Z
2022-02-25T10:26:39.000Z
jni/RTKLIB/app/qtapp/rtkplot_qt/skydlg.cpp
wjw164833/RtkGpsForPad
c9fb10c0bc56cfa473582088dbc673c6da2d31be
[ "BSD-2-Clause" ]
null
null
null
jni/RTKLIB/app/qtapp/rtkplot_qt/skydlg.cpp
wjw164833/RtkGpsForPad
c9fb10c0bc56cfa473582088dbc673c6da2d31be
[ "BSD-2-Clause" ]
2
2021-12-28T10:16:17.000Z
2022-02-25T10:26:41.000Z
//--------------------------------------------------------------------------- #include <QShowEvent> #include <QMessageBox> #include <QFileDialog> #include <stdio.h> #include "rtklib.h" #include "plotmain.h" #include "skydlg.h" extern Plot *plot; //--------------------------------------------------------------------------- SkyImgDialog::SkyImgDialog(QWidget *parent) : QDialog(parent) { setupUi(this); connect(BtnClose, SIGNAL(clicked(bool)), this, SLOT(BtnCloseClick())); connect(BtnGenMask, SIGNAL(clicked(bool)), this, SLOT(BtnGenMaskClick())); connect(BtnLoad, SIGNAL(clicked(bool)), this, SLOT(BtnLoadClick())); connect(BtnSave, SIGNAL(clicked(bool)), this, SLOT(BtnSaveClick())); connect(BtnUpdate, SIGNAL(clicked(bool)), this, SLOT(BtnUpdateClick())); connect(SkyRes, SIGNAL(currentIndexChanged(int)), this, SLOT(SkyResChange())); connect(SkyElMask, SIGNAL(clicked(bool)), this, SLOT(SkyElMaskClicked())); connect(SkyDestCorr, SIGNAL(clicked(bool)), this, SLOT(SkyDestCorrClicked())); connect(SkyFlip, SIGNAL(clicked(bool)), this, SLOT(SkyFlipClicked())); connect(SkyBinarize, SIGNAL(clicked(bool)), this, SLOT(SkyBinarizeClicked())); } //--------------------------------------------------------------------------- void SkyImgDialog::showEvent(QShowEvent *event) { if (event->spontaneous()) return; UpdateField(); UpdateEnable(); } //--------------------------------------------------------------------------- void SkyImgDialog::BtnSaveClick() { QFile fp; QString file = plot->SkyImageFile; if (file == "") return; UpdateSky(); file = file + ".tag"; fp.setFileName(file); if (QFile::exists(file)) if (QMessageBox::question(this, file, tr("File exists. Overwrite it?")) != QMessageBox::Yes) return; if (!fp.open(QIODevice::WriteOnly)) return; QString data; data = QString("%% sky image tag file: rtkplot %1 %2\n\n").arg(VER_RTKLIB).arg(PATCH_LEVEL); data += QString("centx = %1\n").arg(plot->SkyCent[0], 0, 'g', 6); data += QString("centy = %1\n").arg(plot->SkyCent[1], 0, 'g', 6); data += QString("scale = %1\n").arg(plot->SkyScale, 0, 'g', 6); data += QString("roll = %1\n").arg(plot->SkyFov[0], 0, 'g', 6); data += QString("pitch = %1\n").arg(plot->SkyFov[1], 0, 'g', 6); data += QString("yaw = %1\n").arg(plot->SkyFov[2], 0, 'g', 6); data += QString("destcorr= %1\n").arg(plot->SkyDestCorr); data += QString("resample= %1\n").arg(plot->SkyRes); data += QString("flip = %1\n").arg(plot->SkyFlip); data += QString("dest = %1 %2 %3 %4 %5 %6 %7 %8 %9s\n") .arg(plot->SkyDest[1], 0, 'g', 6).arg(plot->SkyDest[2], 0, 'g', 6).arg(plot->SkyDest[3], 0, 'g', 6).arg(plot->SkyDest[4], 0, 'g', 6) .arg(plot->SkyDest[5], 0, 'g', 6).arg(plot->SkyDest[6], 0, 'g', 6).arg(plot->SkyDest[7], 0, 'g', 6).arg(plot->SkyDest[8], 0, 'g', 6) .arg(plot->SkyDest[9], 0, 'g', 6); data += QString("elmask = %1\n").arg(plot->SkyElMask); data += QString("binarize= %1\n").arg(plot->SkyBinarize); data += QString("binthr1 = %1\n").arg(plot->SkyBinThres1, 0, 'f', 2); data += QString("binthr2 = %1f\n").arg(plot->SkyBinThres2, 0, 'f', 2); fp.write(data.toLatin1()); } //--------------------------------------------------------------------------- void SkyImgDialog::BtnUpdateClick() { UpdateSky(); } //--------------------------------------------------------------------------- void SkyImgDialog::BtnCloseClick() { accept(); } //--------------------------------------------------------------------------- void SkyImgDialog::UpdateField(void) { setWindowTitle(plot->SkyImageFile); SkySize1->setValue(plot->SkySize[0]); SkySize2->setValue(plot->SkySize[1]); SkyCent1->setValue(plot->SkyCent[0]); SkyCent2->setValue(plot->SkyCent[1]); SkyScale->setValue(plot->SkyScale); SkyFov1->setValue(plot->SkyFov[0]); SkyFov2->setValue(plot->SkyFov[1]); SkyFov3->setValue(plot->SkyFov[2]); SkyDest1->setValue(plot->SkyDest[1]); SkyDest2->setValue(plot->SkyDest[2]); SkyDest3->setValue(plot->SkyDest[3]); SkyDest4->setValue(plot->SkyDest[4]); SkyDest5->setValue(plot->SkyDest[5]); SkyDest6->setValue(plot->SkyDest[6]); SkyDest7->setValue(plot->SkyDest[7]); SkyDest8->setValue(plot->SkyDest[8]); SkyDest9->setValue(plot->SkyDest[9]); SkyElMask->setChecked(plot->SkyElMask); SkyDestCorr->setChecked(plot->SkyDestCorr); SkyRes->setCurrentIndex(plot->SkyRes); SkyFlip->setChecked(plot->SkyFlip); SkyBinarize->setChecked(plot->SkyBinarize); SkyBinThres1->setValue(plot->SkyBinThres1); SkyBinThres2->setValue(plot->SkyBinThres2); } //--------------------------------------------------------------------------- void SkyImgDialog::UpdateSky(void) { plot->SkyCent[0] = SkyCent1->value(); plot->SkyCent[1] = SkyCent2->value(); plot->SkyScale = SkyScale->value(); plot->SkyFov[0] = SkyFov1->value(); plot->SkyFov[1] = SkyFov2->value(); plot->SkyFov[2] = SkyFov3->value(); plot->SkyDest[1] = SkyDest1->value(); plot->SkyDest[2] = SkyDest2->value(); plot->SkyDest[3] = SkyDest3->value(); plot->SkyDest[4] = SkyDest4->value(); plot->SkyDest[5] = SkyDest5->value(); plot->SkyDest[6] = SkyDest6->value(); plot->SkyDest[7] = SkyDest7->value(); plot->SkyDest[8] = SkyDest8->value(); plot->SkyDest[9] = SkyDest9->value(); plot->SkyElMask = SkyElMask->isChecked(); plot->SkyDestCorr = SkyDestCorr->isChecked(); plot->SkyRes = SkyRes->currentIndex(); plot->SkyFlip = SkyFlip->isChecked(); plot->SkyBinarize = SkyBinarize->isChecked(); plot->SkyBinThres1 = SkyBinThres1->value(); plot->SkyBinThres2 = SkyBinThres2->value(); plot->UpdateSky(); } //--------------------------------------------------------------------------- void SkyImgDialog::UpdateEnable(void) { SkyDest1->setEnabled(SkyDestCorr->isChecked()); SkyDest2->setEnabled(SkyDestCorr->isChecked()); SkyDest3->setEnabled(SkyDestCorr->isChecked()); SkyDest4->setEnabled(SkyDestCorr->isChecked()); SkyDest5->setEnabled(SkyDestCorr->isChecked()); SkyDest6->setEnabled(SkyDestCorr->isChecked()); SkyDest7->setEnabled(SkyDestCorr->isChecked()); SkyDest8->setEnabled(SkyDestCorr->isChecked()); SkyDest9->setEnabled(SkyDestCorr->isChecked()); SkyBinThres1->setEnabled(SkyBinarize->isChecked()); SkyBinThres2->setEnabled(SkyBinarize->isChecked()); BtnGenMask->setEnabled(SkyBinarize->isChecked()); } //--------------------------------------------------------------------------- void SkyImgDialog::SkyElMaskClicked() { UpdateSky(); } //--------------------------------------------------------------------------- void SkyImgDialog::SkyDestCorrClicked() { UpdateSky(); UpdateEnable(); } //--------------------------------------------------------------------------- void SkyImgDialog::SkyFlipClicked() { UpdateSky(); } //--------------------------------------------------------------------------- void SkyImgDialog::SkyResChange() { UpdateSky(); } //--------------------------------------------------------------------------- void SkyImgDialog::BtnLoadClick() { plot->ReadSkyTag(QDir::toNativeSeparators(QFileDialog::getOpenFileName(this, tr("Open Tag"), QString(), tr("Tag File (*.tag);;All (*.*)")))); UpdateField(); plot->UpdateSky(); } //--------------------------------------------------------------------------- void SkyImgDialog::BtnGenMaskClick() { QImage &bm = plot->SkyImageR; double r, ca, sa, el, el0; int x, y, w, h, az, n; w = bm.width(); h = bm.height(); if (w <= 0 || h <= 0) return; for (az = 0; az <= 360; az++) { ca = cos(az * D2R); sa = sin(az * D2R); for (el = 90.0, n = 0, el0 = 0.0; el >= 0.0; el -= 0.1) { r = (1.0 - el / 90.0) * plot->SkyScaleR; x = (int)floor(w / 2.0 + sa * r + 0.5); y = (int)floor(h / 2.0 + ca * r + 0.5); if (x < 0 || x >= w || y < 0 || y >= h) continue; QRgb pix = bm.pixel(x, y); if (qRed(pix) < 255 && qGreen(pix) < 255 && qBlue(pix) < 255) { if (++n == 1) el0 = el; if (n >= 5) break; } else { n = 0; } } plot->ElMaskData[az] = el0 == 90.0 ? 0.0 : el0 * D2R; } plot->UpdateSky(); } //--------------------------------------------------------------------------- void SkyImgDialog::SkyBinarizeClicked() { UpdateSky(); UpdateEnable(); } //---------------------------------------------------------------------------
38.7713
145
0.522785
wjw164833
4d85d955ffae4b0f070bcee9a900a806bb3195d0
11,945
cpp
C++
olp-cpp-sdk-dataservice-write/src/generated/PublishApi.cpp
matthiaskunter/here-data-sdk-cpp
30b0cdce39dc7218416e820cc3f928f2f2e15675
[ "Apache-2.0" ]
null
null
null
olp-cpp-sdk-dataservice-write/src/generated/PublishApi.cpp
matthiaskunter/here-data-sdk-cpp
30b0cdce39dc7218416e820cc3f928f2f2e15675
[ "Apache-2.0" ]
null
null
null
olp-cpp-sdk-dataservice-write/src/generated/PublishApi.cpp
matthiaskunter/here-data-sdk-cpp
30b0cdce39dc7218416e820cc3f928f2f2e15675
[ "Apache-2.0" ]
null
null
null
/* * Copyright (C) 2019 HERE Europe B.V. * * 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. * * SPDX-License-Identifier: Apache-2.0 * License-Filename: LICENSE */ #include "PublishApi.h" #include <memory> #include <sstream> #include <olp/core/client/HttpResponse.h> // clang-format off // Ordering Required - Parser template specializations before #include "JsonResultParser.h" #include <generated/parser/PublicationParser.h> #include <generated/parser/PublishPartitionsParser.h> #include "JsonResultParser.h" #include <generated/serializer/PublicationSerializer.h> #include <generated/serializer/PublishPartitionsSerializer.h> #include <generated/serializer/JsonSerializer.h> // clang-format on namespace client = olp::client; namespace { const std::string kQueryParamBillingTag = "billingTag"; } // namespace namespace olp { namespace dataservice { namespace write { client::CancellationToken PublishApi::InitPublication( const client::OlpClient& client, const model::Publication& publication, const boost::optional<std::string>& billing_tag, InitPublicationCallback callback) { std::multimap<std::string, std::string> header_params; std::multimap<std::string, std::string> query_params; std::multimap<std::string, std::string> form_params; header_params.insert(std::make_pair("Accept", "application/json")); if (billing_tag) { query_params.insert( std::make_pair(kQueryParamBillingTag, billing_tag.get())); } std::string init_publication_uri = "/publications"; auto serialized_publication = serializer::serialize(publication); auto data = std::make_shared<std::vector<unsigned char>>( serialized_publication.begin(), serialized_publication.end()); auto cancel_token = client.CallApi( init_publication_uri, "POST", query_params, header_params, form_params, data, "application/json", [callback](client::HttpResponse http_response) { if (http_response.status != http::HttpStatusCode::OK) { callback(InitPublicationResponse{client::ApiError( http_response.status, http_response.response.str())}); return; } callback(parser::parse_result<InitPublicationResponse>( http_response.response)); }); return cancel_token; } InitPublicationResponse PublishApi::InitPublication( const client::OlpClient& client, const model::Publication& publication, const boost::optional<std::string>& billing_tag, client::CancellationContext cancellation_context) { std::multimap<std::string, std::string> header_params; std::multimap<std::string, std::string> query_params; std::multimap<std::string, std::string> form_params; header_params.insert(std::make_pair("Accept", "application/json")); if (billing_tag) { query_params.insert( std::make_pair(kQueryParamBillingTag, billing_tag.get())); } std::string init_publication_uri = "/publications"; auto serialized_publication = serializer::serialize(publication); auto data = std::make_shared<std::vector<unsigned char>>( serialized_publication.begin(), serialized_publication.end()); auto http_response = client.CallApi( std::move(init_publication_uri), "POST", std::move(query_params), std::move(header_params), std::move(form_params), std::move(data), "application/json", cancellation_context); if (http_response.status != olp::http::HttpStatusCode::OK) { return InitPublicationResponse( client::ApiError(http_response.status, http_response.response.str())); } return parser::parse_result<InitPublicationResponse>(http_response.response); } client::CancellationToken PublishApi::UploadPartitions( const client::OlpClient& client, const model::PublishPartitions& publish_partitions, const std::string& publication_id, const std::string& layer_id, const boost::optional<std::string>& billing_tag, UploadPartitionsCallback callback) { std::multimap<std::string, std::string> header_params; std::multimap<std::string, std::string> query_params; std::multimap<std::string, std::string> form_params; header_params.insert(std::make_pair("Accept", "application/json")); if (billing_tag) { query_params.insert( std::make_pair(kQueryParamBillingTag, billing_tag.get())); } std::string upload_partitions_uri = "/layers/" + layer_id + "/publications/" + publication_id + "/partitions"; auto serialized_publish_partitions = serializer::serialize(publish_partitions); auto data = std::make_shared<std::vector<unsigned char>>( serialized_publish_partitions.begin(), serialized_publish_partitions.end()); auto cancel_token = client.CallApi( upload_partitions_uri, "POST", query_params, header_params, form_params, data, "application/json", [callback](client::HttpResponse http_response) { if (http_response.status != olp::http::HttpStatusCode::NO_CONTENT) { callback(UploadPartitionsResponse{client::ApiError( http_response.status, http_response.response.str())}); return; } callback(UploadPartitionsResponse(client::ApiNoResult())); }); return cancel_token; } UploadPartitionsResponse PublishApi::UploadPartitions( const client::OlpClient& client, const model::PublishPartitions& publish_partitions, const std::string& publication_id, const std::string& layer_id, const boost::optional<std::string>& billing_tag, client::CancellationContext cancellation_context) { std::multimap<std::string, std::string> header_params; std::multimap<std::string, std::string> query_params; std::multimap<std::string, std::string> form_params; header_params.insert(std::make_pair("Accept", "application/json")); if (billing_tag) { query_params.insert( std::make_pair(kQueryParamBillingTag, billing_tag.get())); } std::string upload_partitions_uri = "/layers/" + layer_id + "/publications/" + publication_id + "/partitions"; auto serialized_publish_partitions = serializer::serialize(publish_partitions); auto data = std::make_shared<std::vector<unsigned char>>( serialized_publish_partitions.begin(), serialized_publish_partitions.end()); auto http_response = client.CallApi( std::move(upload_partitions_uri), "POST", std::move(query_params), std::move(header_params), std::move(form_params), std::move(data), "application/json", cancellation_context); if (http_response.status != olp::http::HttpStatusCode::NO_CONTENT) { return UploadPartitionsResponse( client::ApiError(http_response.status, http_response.response.str())); } return UploadPartitionsResponse(client::ApiNoResult()); } client::CancellationToken PublishApi::SubmitPublication( const client::OlpClient& client, const std::string& publication_id, const boost::optional<std::string>& billing_tag, SubmitPublicationCallback callback) { std::multimap<std::string, std::string> header_params; std::multimap<std::string, std::string> query_params; std::multimap<std::string, std::string> form_params; header_params.insert(std::make_pair("Accept", "application/json")); if (billing_tag) { query_params.insert( std::make_pair(kQueryParamBillingTag, billing_tag.get())); } std::string submit_publication_uri = "/publications/" + publication_id; auto cancel_token = client.CallApi( submit_publication_uri, "PUT", query_params, header_params, form_params, nullptr, "application/json", [callback](client::HttpResponse http_response) { if (http_response.status != olp::http::HttpStatusCode::NO_CONTENT) { callback(SubmitPublicationResponse{client::ApiError( http_response.status, http_response.response.str())}); return; } callback(SubmitPublicationResponse(client::ApiNoResult())); }); return cancel_token; } SubmitPublicationResponse PublishApi::SubmitPublication( const client::OlpClient& client, const std::string& publication_id, const boost::optional<std::string>& billing_tag, client::CancellationContext cancellation_context) { std::multimap<std::string, std::string> header_params; std::multimap<std::string, std::string> query_params; std::multimap<std::string, std::string> form_params; header_params.insert(std::make_pair("Accept", "application/json")); if (billing_tag) { query_params.insert( std::make_pair(kQueryParamBillingTag, billing_tag.get())); } std::string submit_publication_uri = "/publications/" + publication_id; auto http_response = client.CallApi( std::move(submit_publication_uri), "PUT", std::move(query_params), std::move(header_params), std::move(form_params), nullptr, "application/json", cancellation_context); if (http_response.status != olp::http::HttpStatusCode::NO_CONTENT) { return SubmitPublicationResponse( client::ApiError(http_response.status, http_response.response.str())); } return SubmitPublicationResponse(client::ApiNoResult()); } client::CancellationToken PublishApi::GetPublication( const client::OlpClient& client, const std::string& publication_id, const boost::optional<std::string>& billing_tag, GetPublicationCallback callback) { std::multimap<std::string, std::string> header_params; std::multimap<std::string, std::string> query_params; std::multimap<std::string, std::string> form_params; header_params.insert(std::make_pair("Accept", "application/json")); if (billing_tag) { query_params.insert( std::make_pair(kQueryParamBillingTag, billing_tag.get())); } std::string get_publication_uri = "/publications/" + publication_id; auto cancel_token = client.CallApi( get_publication_uri, "GET", query_params, header_params, form_params, nullptr, "application/json", [callback](client::HttpResponse http_response) { if (http_response.status != http::HttpStatusCode::OK) { callback(GetPublicationResponse{client::ApiError( http_response.status, http_response.response.str())}); return; } callback(parser::parse_result<GetPublicationResponse>( http_response.response)); }); return cancel_token; } SubmitPublicationResponse PublishApi::CancelPublication( const client::OlpClient& client, const std::string& publication_id, const boost::optional<std::string>& billing_tag, client::CancellationContext context) { std::multimap<std::string, std::string> header_params; std::multimap<std::string, std::string> query_params; std::multimap<std::string, std::string> form_params; header_params.insert(std::make_pair("Accept", "application/json")); if (billing_tag) { query_params.insert( std::make_pair(kQueryParamBillingTag, billing_tag.get())); } std::string submit_publication_uri = "/publications/" + publication_id; auto http_response = client.CallApi(submit_publication_uri, "DELETE", query_params, header_params, form_params, nullptr, "application/json", context); if (http_response.status != olp::http::HttpStatusCode::NO_CONTENT) { return client::ApiError(http_response.status, http_response.response.str()); } return client::ApiNoResult(); } } // namespace write } // namespace dataservice } // namespace olp
37.211838
91
0.721139
matthiaskunter
4d86fc5b80363cbf4fa3584d4f6cee54cff43c1c
13,998
cpp
C++
backends/ubpf/ubpfDeparser.cpp
anasyrmia/p4c-1
2bf2f615fdaaf4efed1f2f8ab0b3f3261cface60
[ "Apache-2.0" ]
487
2016-12-22T03:33:27.000Z
2022-03-29T06:36:45.000Z
backends/ubpf/ubpfDeparser.cpp
anasyrmia/p4c-1
2bf2f615fdaaf4efed1f2f8ab0b3f3261cface60
[ "Apache-2.0" ]
2,114
2016-12-18T11:36:27.000Z
2022-03-31T22:33:23.000Z
backends/ubpf/ubpfDeparser.cpp
anasyrmia/p4c-1
2bf2f615fdaaf4efed1f2f8ab0b3f3261cface60
[ "Apache-2.0" ]
456
2016-12-20T14:01:11.000Z
2022-03-30T19:26:05.000Z
/* Copyright 2019 Orange 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 "ubpfDeparser.h" #include "ubpfType.h" #include "frontends/p4/methodInstance.h" namespace UBPF { class OutHeaderSize final : public EBPF::CodeGenInspector { P4::ReferenceMap* refMap; P4::TypeMap* typeMap; const UBPFProgram* program; std::map<const IR::Parameter*, const IR::Parameter*> substitution; bool illegal(const IR::Statement* statement) { ::error(ErrorType::ERR_UNSUPPORTED, "%1%: not supported in deparser", statement); return false; } public: OutHeaderSize(P4::ReferenceMap* refMap, P4::TypeMap* typeMap, const UBPFProgram* program): EBPF::CodeGenInspector(refMap, typeMap), refMap(refMap), typeMap(typeMap), program(program) { CHECK_NULL(refMap); CHECK_NULL(typeMap); CHECK_NULL(program); setName("OutHeaderSize"); } bool preorder(const IR::PathExpression* expression) override { auto decl = refMap->getDeclaration(expression->path, true); auto param = decl->getNode()->to<IR::Parameter>(); if (param != nullptr) { auto subst = ::get(substitution, param); if (subst != nullptr) { builder->append(subst->name); return false; } } builder->append(expression->path->name); return false; } bool preorder(const IR::SwitchStatement* statement) override { return illegal(statement); } bool preorder(const IR::IfStatement* statement) override { return illegal(statement); } bool preorder(const IR::AssignmentStatement* statement) override { return illegal(statement); } bool preorder(const IR::ReturnStatement* statement) override { return illegal(statement); } bool preorder(const IR::ExitStatement* statement) override { return illegal(statement); } bool preorder(const IR::MethodCallStatement* statement) override { LOG5("Calculate OutHeaderSize"); auto &p4lib = P4::P4CoreLibrary::instance; auto mi = P4::MethodInstance::resolve(statement->methodCall, refMap, typeMap); auto method = mi->to<P4::ExternMethod>(); if (method == nullptr) return illegal(statement); auto declType = method->originalExternType; if (declType->name.name != p4lib.packetOut.name || method->method->name.name != p4lib.packetOut.emit.name || method->expr->arguments->size() != 1) { return illegal(statement); } auto h = method->expr->arguments->at(0); auto type = typeMap->getType(h); auto ht = type->to<IR::Type_Header>(); if (ht == nullptr) { ::error(ErrorType::ERR_UNSUPPORTED_ON_TARGET, "Cannot emit a non-header type %1%", h); return false; } unsigned width = ht->width_bits(); builder->append("if ("); visit(h); builder->append(".ebpf_valid) "); builder->newline(); builder->emitIndent(); builder->appendFormat("%s += %d;", program->outerHdrLengthVar.c_str(), width); builder->newline(); return false; } void substitute(const IR::Parameter* p, const IR::Parameter* with) { substitution.emplace(p, with); } }; UBPFDeparserTranslationVisitor::UBPFDeparserTranslationVisitor( const UBPFDeparser *deparser) : CodeGenInspector(deparser->program->refMap, deparser->program->typeMap), deparser(deparser), p4lib(P4::P4CoreLibrary::instance) { setName("UBPFDeparserTranslationVisitor"); } void UBPFDeparserTranslationVisitor::compileEmitField(const IR::Expression *expr, cstring field, unsigned alignment, EBPF::EBPFType *type) { auto et = dynamic_cast<EBPF::IHasWidth *>(type); if (et == nullptr) { ::error(ErrorType::ERR_UNSUPPORTED_ON_TARGET, "Only headers with fixed widths supported %1%", expr); return; } unsigned widthToEmit = et->widthInBits(); unsigned loadSize = 0; cstring swap = ""; if (widthToEmit <= 8) { loadSize = 8; } else if (widthToEmit <= 16) { swap = "bpf_htons"; loadSize = 16; } else if (widthToEmit <= 32) { swap = "htonl"; loadSize = 32; } else if (widthToEmit <= 64) { swap = "htonll"; loadSize = 64; } unsigned bytes = ROUNDUP(widthToEmit, 8); unsigned shift = widthToEmit < 8 ? (loadSize - alignment - widthToEmit) : (loadSize - widthToEmit); if (!swap.isNullOrEmpty()) { builder->emitIndent(); visit(expr); builder->appendFormat(".%s = %s(", field.c_str(), swap); visit(expr); builder->appendFormat(".%s", field.c_str()); if (shift != 0) builder->appendFormat(" << %d", shift); builder->append(")"); builder->endOfStatement(true); } auto program = deparser->program; unsigned bitsInFirstByte = widthToEmit % 8; if (bitsInFirstByte == 0) bitsInFirstByte = 8; unsigned bitsInCurrentByte = bitsInFirstByte; unsigned left = widthToEmit; for (unsigned i = 0; i < (widthToEmit + 7) / 8; i++) { builder->emitIndent(); builder->appendFormat("%s = ((char*)(&", program->byteVar.c_str()); visit(expr); builder->appendFormat(".%s))[%d]", field.c_str(), i); builder->endOfStatement(true); unsigned freeBits = alignment != 0 ? (8 - alignment) : 8; bitsInCurrentByte = left >= 8 ? 8 : left; unsigned bitsToWrite = bitsInCurrentByte > freeBits ? freeBits : bitsInCurrentByte; BUG_CHECK((bitsToWrite > 0) && (bitsToWrite <= 8), "invalid bitsToWrite %d", bitsToWrite); builder->emitIndent(); if (alignment == 0 && bitsToWrite == 8) { // write whole byte builder->appendFormat( "write_byte(%s, BYTES(%s) + %d, (%s))", program->packetStartVar.c_str(), program->offsetVar.c_str(), widthToEmit > 64 ? bytes - i - 1 : i, // reversed order for wider fields program->byteVar.c_str()); } else { // write partial shift = (8 - alignment - bitsToWrite); builder->appendFormat( "write_partial(%s + BYTES(%s) + %d, %d, %d, (%s >> %d))", program->packetStartVar.c_str(), program->offsetVar.c_str(), widthToEmit > 64 ? bytes - i - 1 : i, // reversed order for wider fields bitsToWrite, shift, program->byteVar.c_str(), widthToEmit > freeBits ? alignment == 0 ? shift : alignment : 0); } builder->endOfStatement(true); left -= bitsToWrite; bitsInCurrentByte -= bitsToWrite; alignment = (alignment + bitsToWrite) % 8; bitsToWrite = (8 - bitsToWrite); if (bitsInCurrentByte > 0) { builder->emitIndent(); if (bitsToWrite == 8) { builder->appendFormat( "write_byte(%s, BYTES(%s) + %d + 1, (%s << %d))", program->packetStartVar.c_str(), program->offsetVar.c_str(), widthToEmit > 64 ? bytes - i - 1 : i, // reversed order for wider fields program->byteVar.c_str(), 8 - alignment % 8); } else { builder->appendFormat( "write_partial(%s + BYTES(%s) + %d + 1, %d, %d, (%s))", program->packetStartVar.c_str(), program->offsetVar.c_str(), widthToEmit > 64 ? bytes - i - 1 : i, // reversed order for wider fields bitsToWrite, 8 + alignment - bitsToWrite, program->byteVar.c_str()); } builder->endOfStatement(true); left -= bitsToWrite; } alignment = (alignment + bitsToWrite) % 8; } builder->emitIndent(); builder->appendFormat("%s += %d", program->offsetVar.c_str(), widthToEmit); builder->endOfStatement(true); builder->newline(); } void UBPFDeparserTranslationVisitor::compileEmit(const IR::Vector<IR::Argument> *args) { BUG_CHECK(args->size() == 1, "%1%: expected 1 argument for emit", args); auto expr = args->at(0)->expression; auto type = typeMap->getType(expr); auto ht = type->to<IR::Type_Header>(); if (ht == nullptr) { ::error(ErrorType::ERR_UNSUPPORTED_ON_TARGET, "Cannot emit a non-header type %1%", expr); return; } builder->emitIndent(); builder->append("if ("); visit(expr); builder->append(".ebpf_valid) "); builder->blockStart(); auto program = deparser->program; unsigned width = ht->width_bits(); builder->emitIndent(); builder->appendFormat("if (%s < BYTES(%s + %d)) ", program->lengthVar.c_str(), program->offsetVar.c_str(), width); builder->blockStart(); builder->emitIndent(); builder->appendFormat("goto %s;", IR::ParserState::reject.c_str()); builder->newline(); builder->blockEnd(true); builder->emitIndent(); builder->newline(); unsigned alignment = 0; for (auto f : ht->fields) { auto ftype = typeMap->getType(f); auto etype = UBPFTypeFactory::instance->create(ftype); auto et = dynamic_cast<EBPF::IHasWidth *>(etype); if (et == nullptr) { ::error(ErrorType::ERR_UNSUPPORTED_ON_TARGET, "Only headers with fixed widths supported %1%", f); return; } compileEmitField(expr, f->name, alignment, etype); alignment += et->widthInBits(); alignment %= 8; } builder->blockEnd(true); } bool UBPFDeparserTranslationVisitor::preorder(const IR::MethodCallExpression *expression) { auto mi = P4::MethodInstance::resolve(expression, deparser->program->refMap, deparser->program->typeMap); auto extMethod = mi->to<P4::ExternMethod>(); if (extMethod != nullptr) { auto decl = extMethod->object; if (decl == deparser->packet_out) { if (extMethod->method->name.name == p4lib.packetOut.emit.name) { compileEmit(extMethod->expr->arguments); return false; } } } ::error(ErrorType::ERR_UNEXPECTED, "Unexpected method call in deparser %1%", expression); return false; } bool UBPFDeparser::build() { auto pl = controlBlock->container->type->applyParams; if (pl->size() != 2) { ::error(ErrorType::ERR_EXPECTED, "%1%: Expected deparser to have exactly 2 parameters", controlBlock->getNode()); return false; } auto it = pl->parameters.begin(); packet_out = *it; ++it; headers = *it; codeGen = new UBPFDeparserTranslationVisitor(this); codeGen->substitute(headers, parserHeaders); return ::errorCount() == 0; } void UBPFDeparser::emit(EBPF::CodeBuilder *builder) { builder->emitIndent(); builder->appendFormat("int %s = 0", program->outerHdrLengthVar.c_str()); builder->endOfStatement(true); auto ohs = new OutHeaderSize(program->refMap, program->typeMap, static_cast<const UBPFProgram*>(program)); ohs->substitute(headers, parserHeaders); ohs->setBuilder(builder); builder->emitIndent(); controlBlock->container->body->apply(*ohs); builder->newline(); builder->emitIndent(); builder->appendFormat("int %s = BYTES(%s) - BYTES(%s)", program->outerHdrOffsetVar.c_str(), program->outerHdrLengthVar.c_str(), program->offsetVar.c_str()); builder->endOfStatement(true); builder->emitIndent(); builder->appendFormat("%s = ubpf_adjust_head(%s, %s)", program->packetStartVar.c_str(), program->contextVar.c_str(), program->outerHdrOffsetVar.c_str()); builder->endOfStatement(true); builder->emitIndent(); builder->appendFormat("%s += %s", program->lengthVar.c_str(), program->outerHdrOffsetVar.c_str()); builder->endOfStatement(true); builder->emitIndent(); builder->appendFormat("%s = 0", program->offsetVar.c_str()); builder->endOfStatement(true); builder->emitIndent(); builder->appendFormat("if (%s > 0) ", program->packetTruncatedSizeVar.c_str()); builder->blockStart(); builder->emitIndent(); builder->appendFormat("%s -= ubpf_truncate_packet(%s, %s)", program->lengthVar.c_str(), program->contextVar.c_str(), program->packetTruncatedSizeVar.c_str()); builder->endOfStatement(true); builder->blockEnd(true); builder->emitIndent(); builder->newline(); codeGen->setBuilder(builder); controlBlock->container->body->apply(*codeGen); } } // namespace UBPF
37.228723
97
0.573939
anasyrmia
4d89df432248faaf6e44a51b841e966a8877671d
796
cc
C++
src/script/isomorphic.cc
entn-at/openfst
10ab103134b1872e475800fd5ea37747d1c0c858
[ "Apache-2.0" ]
336
2018-11-06T14:03:32.000Z
2022-03-31T00:48:03.000Z
src/script/isomorphic.cc
entn-at/openfst
10ab103134b1872e475800fd5ea37747d1c0c858
[ "Apache-2.0" ]
43
2017-07-13T21:04:44.000Z
2022-02-16T19:47:53.000Z
src/script/isomorphic.cc
entn-at/openfst
10ab103134b1872e475800fd5ea37747d1c0c858
[ "Apache-2.0" ]
77
2018-11-07T06:43:10.000Z
2021-12-10T04:16:43.000Z
// See www.openfst.org for extensive documentation on this weighted // finite-state transducer library. #include <fst/script/fst-class.h> #include <fst/script/isomorphic.h> #include <fst/script/script-impl.h> namespace fst { namespace script { bool Isomorphic(const FstClass &fst1, const FstClass &fst2, float delta) { if (!internal::ArcTypesMatch(fst1, fst2, "Isomorphic")) return false; IsomorphicInnerArgs iargs(fst1, fst2, delta); IsomorphicArgs args(iargs); Apply<Operation<IsomorphicArgs>>("Isomorphic", fst1.ArcType(), &args); return args.retval; } REGISTER_FST_OPERATION(Isomorphic, StdArc, IsomorphicArgs); REGISTER_FST_OPERATION(Isomorphic, LogArc, IsomorphicArgs); REGISTER_FST_OPERATION(Isomorphic, Log64Arc, IsomorphicArgs); } // namespace script } // namespace fst
31.84
74
0.770101
entn-at
4d8a1e840f2dcfefeb94dff39420f4b4cd13381a
8,977
cc
C++
src/Properties.cc
ax3l/GPos
4555cead437f3ca847b6b8a2ce3227a47eb25af7
[ "BSD-3-Clause-LBNL" ]
3
2021-07-30T21:01:23.000Z
2021-08-05T18:49:34.000Z
src/Properties.cc
ax3l/GPos
4555cead437f3ca847b6b8a2ce3227a47eb25af7
[ "BSD-3-Clause-LBNL" ]
3
2022-03-04T18:38:50.000Z
2022-03-04T18:39:03.000Z
src/Properties.cc
ax3l/GPos
4555cead437f3ca847b6b8a2ce3227a47eb25af7
[ "BSD-3-Clause-LBNL" ]
2
2021-07-30T19:20:46.000Z
2021-09-17T14:56:10.000Z
/** * @file Properties.cc * @author Ligia Diana Amorim * @date 06/2021 * @copyright GPos 2021 LBNL */ #include "Properties.hpp" /** * Constructor. * * @param[in] in Parameters read from input.txt file. */ Properties::Properties (Query in) { input = in; } /** * Destructor. */ Properties::~Properties () { } /** * Main function where all the properties functions of all the beams at end of Foil and Drift are * called and results are merged accross all MPI ranks and stored in TXT and OPMD file formats. * * @param[in] tf Pointer to global time at the end of the foil * @param[in] p Pointer to vector with particle data * @param[in] mq Pointer to map of all species mass and charge data */ void Properties::ComputeBeams (G4double * tf, vector<Part> * p, map<G4String,map<G4String,G4double>> * mq){ G4int nspecies = input.s_list.size(); map<G4String, PartBeams> beams; for (G4int i = 0; i < nspecies; ++i ) { if ( mq -> find(input.s_list[i]) != mq -> end() ){ beams[input.s_list[i]].set_partBeams(p, input.s_list[i], (*mq)[input.s_list[i]]["mass"], (*mq)[input.s_list[i]]["charge"]); if (input.debug) beams[input.s_list[i]].Print("at end of run"); np0[i] = beams[input.s_list[i]].np; } else np0[i] = 0; } for ( auto & beam : beams ) { beam.second.Propagate(tf); if (input.debug) beam.second.Print("at foil"); } MPI_Allreduce(np0, npT, nspecies, MPI_INT, MPI_SUM, MPI_COMM_WORLD); MPI_Scan(np0, npS, nspecies, MPI_INT, MPI_SUM, MPI_COMM_WORLD); if (input.debug) { for ( G4int j = 0; j < nspecies; ++j ) { G4cout << "Local # " << input.s_list[j] << " : " << np0[j] << "\n"; G4cout << "MPI merged # " << input.s_list[j] << " : " << npT[j] << " and MPI scan # : " << npS[j] << "\n"; } } if (input.frms > 0){ MeanSTD(&beams, np0, npT, 0); for (G4int k = 0; k < nspecies; ++k ) { if ( np0[k] > 0 ){ beams[input.s_list[k]].Select(input, 0); np0[k] = beams[input.s_list[k]].np; } else np0[k] = 0; npT[k] = 0; } MPI_Allreduce(np0, npT, nspecies, MPI_INT, MPI_SUM, MPI_COMM_WORLD); MPI_Scan(np0, npS, nspecies, MPI_INT, MPI_SUM, MPI_COMM_WORLD); } Analysis(&beams, np0, npT, 0); G4String * label = new G4String; *label = "_foil"; ShareMQ(&beams, np0, npT); save_outOPMD(input, &beams, npT, npS, label); *label = "Foil"; G4int rank = G4MPImanager::GetManager()->GetRank(); if (rank == 0) save_txt(input, &beams, npT, 0, label); if (input.drift > 0.0){ *td0 = numeric_limits<double>::max(); for (G4int l = 0; l < nspecies; ++l ) { if ( npT[l] > 0 ){ *td0 = min(*td0,beams[input.s_list[l]].get_tdrift(input)); } } MPI_Allreduce(td0, tdT, 1, MPI_DOUBLE, MPI_MIN, MPI_COMM_WORLD); for (G4int mi = 0; mi < nspecies; ++mi ) { if ( npT[mi] > 0 ){ beams[input.s_list[mi]].Drift(tdT, input); if (input.debug) beams[input.s_list[mi]].Print("after drift"); } } Analysis(&beams, np0, npT, 1); *label = "_drift"; save_outOPMD(input, &beams, npT, npS, label); *label = "Drift"; if (rank == 0) save_txt(input, &beams, npT, 1, label); } } /** * Function to compute beam mean and RMS position and momentum merged accross all MPI ranks. * * @param[in] b Pointer to beam data * @param[in] n0 Pointer to number of beam particles in each rank * @param[in] nT Pointer to total number of particles accross all MPI ranks * @param[in] ifdrift Determines if user requested drift in input.txt file. */ void Properties::MeanSTD (map<G4String,PartBeams> * b, G4int * n0, G4int * nT, G4int ifdrift) { G4int nspecies = input.s_list.size(); for (G4int i = 0; i < nspecies ; ++i){ if ( nT[i] > 0 ){ G4String name = input.s_list[i]; G4double dnpT = (double)(nT[i]); if ( n0[i] > 0 ){ (*b)[name].Centroids(mpi_in); for (G4int j = 0; j < 7; j++) mpi_in[j] = mpi_in[j]/dnpT; } MPI_Allreduce(mpi_in, mpi_out, 7, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); (*b)[name].set_globalC(ifdrift, mpi_out); if ( n0[i] > 0 ){ for (G4int k=0; k < 7; k++){ mpi_in[k] = 0; mpi_out[k] = 0; } (*b)[name].StandardDeviation(input, ifdrift, mpi_in); for (G4int l = 0; l < 7; l++) mpi_in[l] = mpi_in[l]/dnpT; } MPI_Allreduce(mpi_in, mpi_out, 7, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); (*b)[name].set_globalSTD(ifdrift, mpi_out); if ( n0[i] > 0 ){ for (G4int mi = 0; mi < 7; mi++){ mpi_in[mi] = 0; mpi_out[mi] = 0; } } } } } /** * Function to compute all beam properties merged accross all MPI ranks. * * @param[in] b Pointer to beam data * @param[in] n0 Pointer to number of beam particles in each rank * @param[in] nT Pointer to total number of particles accross all MPI ranks * @param[in] ifdrift Determines if user requested drift in input.txt file. */ void Properties::Analysis (map<G4String,PartBeams> * b, G4int * n0, G4int * nT, G4int ifdrift) { G4int nspecies = input.s_list.size(); for (G4int i = 0; i < nspecies ; ++i){ if ( nT[i] > 0 ){ G4String name = input.s_list[i]; G4double dnpT = (double)(nT[i]); if ( n0[i] > 0 ){ (*b)[name].Centroids(mpi_in); for (G4int j = 0; j < 7; j++) mpi_in[j] = mpi_in[j]/dnpT; } MPI_Allreduce(mpi_in, mpi_out, 7, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); (*b)[name].set_globalC(ifdrift, mpi_out); if ( n0[i] > 0 ){ for (G4int k = 0; k < 7; k++){ mpi_in[k] = 0; mpi_out[k] = 0; } (*b)[name].StandardDeviation(input, ifdrift, mpi_in); for (G4int l = 0; l < 7; l++) mpi_in[l] = mpi_in[l]/dnpT; } MPI_Allreduce(mpi_in, mpi_out, 7, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); (*b)[name].set_globalSTD(ifdrift, mpi_out); if ( n0[i] > 0 ){ for (G4int mi = 0; mi < 7; mi++){ mpi_in[mi] = 0; mpi_out[mi] = 0; } (*b)[name].Divergence(mpi_in); for (G4int n = 0; n < 4; n++) mpi_in[n]=mpi_in[n]/dnpT; } MPI_Allreduce(mpi_in, mpi_out, 4, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); (*b)[name].set_globalDiv(ifdrift, mpi_out); if ( n0[i] > 0 ){ for (G4int o=0; o < 4; o++){ mpi_in[o] = mpi_out[o]; mpi_out[o] = 0; } (*b)[name].Div_Emittance(ifdrift, mpi_in); for (G4int p = 0; p < 6; p++) mpi_in[p]=mpi_in[p]/dnpT; } MPI_Allreduce(mpi_in, mpi_out, 6, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); (*b)[name].set_globalDivEm(ifdrift, mpi_out, &nT[i]); if ( n0[i] > 0 ){ for (G4int q = 0; q < 7; q++){ mpi_in[q] = 0; mpi_out[q] = 0; } } G4int nsteps0 = (*b)[name].get_nsteps(); MPI_Allreduce(&nsteps0, nsT, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD); (*b)[name].set_nsteps(nsT); } } } /** * Function to store beams mass and charge information merged accross all MPI ranks (for openPMD). * * @param[in] b Pointer to beam data * @param[in] n0 Pointer to number of beam particles in each rank * @param[in] nT Pointer to total number of particles accross all MPI ranks */ void Properties::ShareMQ (map<G4String,PartBeams> * b, G4int * n0, G4int * nT) { G4int nspecies = input.s_list.size(); for (G4int i = 0; i < nspecies ; ++i){ if ( nT[i] > 0 ){ G4String name = input.s_list[i]; if ( n0[i] > 0 ){ mpi_in[0] = (*b)[name].mass; mpi_in[1] = (*b)[name].charge; mpi_in[2] = 1.0; } else { mpi_in[0] = 0.0; mpi_in[1] = 0.0; mpi_in[2] = 0.0; } MPI_Allreduce(mpi_in, mpi_out, 3, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); (*b)[name].set_MQ(mpi_out[0]/mpi_out[2], mpi_out[1]/mpi_out[2]); if ( n0[i] > 0 ){ for (G4int j = 0; j < 3; j++){ mpi_in[j] = 0; mpi_out[j] = 0; } } } } }
36.942387
100
0.50596
ax3l
4d8ab2eb5c9df9f09fe80607692b68b3bcc7dde6
600
cc
C++
elang/compiler/string_source_code.cc
eval1749/elang
5208b386ba3a3e866a5c0f0271280f79f9aac8c4
[ "Apache-2.0" ]
1
2018-01-27T22:40:53.000Z
2018-01-27T22:40:53.000Z
elang/compiler/string_source_code.cc
eval1749/elang
5208b386ba3a3e866a5c0f0271280f79f9aac8c4
[ "Apache-2.0" ]
1
2016-01-29T00:54:49.000Z
2016-01-29T00:54:49.000Z
elang/compiler/string_source_code.cc
eval1749/elang
5208b386ba3a3e866a5c0f0271280f79f9aac8c4
[ "Apache-2.0" ]
null
null
null
// Copyright 2014-2015 Project Vogue. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include <string> #include "elang/compiler/string_source_code.h" #include "elang/compiler/string_stream.h" namespace elang { namespace compiler { StringSourceCode::StringSourceCode(const base::string16& name, const base::StringPiece16& string) : SourceCode(name), stream_(new StringStream(string)) { } StringSourceCode::~StringSourceCode() { } } // namespace compiler } // namespace elang
25
73
0.71
eval1749
4d8cc39ad118c3961952f65f6821862138fa2485
371
cpp
C++
mazeLocation.cpp
bolym/C-Escape
fe448c1bcbfcda8090c6642fa1417e08581cdf8e
[ "MIT" ]
null
null
null
mazeLocation.cpp
bolym/C-Escape
fe448c1bcbfcda8090c6642fa1417e08581cdf8e
[ "MIT" ]
null
null
null
mazeLocation.cpp
bolym/C-Escape
fe448c1bcbfcda8090c6642fa1417e08581cdf8e
[ "MIT" ]
null
null
null
#include "mazeLocation.hpp" /****************************************************************** * Function: mazeLocation() * Description: Default empty MazeLocation constructor * Parameters: None * Pre-Conditions: None * Post-Conditions: None ******************************************************************/ MazeLocation::MazeLocation(){ //empty }
28.538462
68
0.447439
bolym
4d8d565fa9d9a5ef5f1918204e8c55481a02c65c
7,246
cxx
C++
examples/cmdline.cxx
elcuco/mimetic
00c46f7e25235ea6de9ddefc0b63c3249eb1d1da
[ "MIT" ]
null
null
null
examples/cmdline.cxx
elcuco/mimetic
00c46f7e25235ea6de9ddefc0b63c3249eb1d1da
[ "MIT" ]
null
null
null
examples/cmdline.cxx
elcuco/mimetic
00c46f7e25235ea6de9ddefc0b63c3249eb1d1da
[ "MIT" ]
1
2022-02-24T19:24:28.000Z
2022-02-24T19:24:28.000Z
#include <getopt.h> #include <iostream> #include <cstring> #include "mm.h" #include "cmdline.h" using namespace std; command_line::command_line() { for(int i = 0; i < p_last_item; ++i) m_is_opt_set[i] = 0; } command_line::iterator command_line::begin(const string& key) { if(key.length()) return m_map.lower_bound(key); else return m_map.begin(); } command_line::iterator command_line::end(const string& key) { if(key.length()) return m_map.upper_bound(key); else return m_map.end(); } command_line::const_iterator command_line::begin(const string& key) const { if(key.length()) return m_map.lower_bound(key); else return m_map.begin(); } command_line::const_iterator command_line::end(const string& key) const { if(key.length()) return m_map.upper_bound(key); else return m_map.end(); } string& command_line::operator[](const string& key) { iterator it = m_map.find(key); if(it == m_map.end()) it = m_map.insert(command_line_switch(key,"")); return it->second; } bool command_line::is_set(int i) const { return m_is_opt_set[i]; } bool command_line::is_set(const string& switch_name) const { return m_map.find(switch_name) != m_map.end(); } void command_line::die_if_not_valid() const { die_if(is_set(p_match_shell) && is_set(p_match_regex), "just one of --match-shell and --match-regex can be specified"); die_if(is_set(p_match_shell) && is_set(p_perl_regex), "--match-shell and --perl-regex are not compatible"); die_if(is_set(p_print_msg) && is_set(p_print_part), "just one of --print-message and --print-part can be specified"); die_if(is_set(p_delete_msg) && is_set(p_delete_part), "just one of --delete-msg and --delete-part can be specified"); } void command_line::add_switch(const string& name, const string& arg) { m_map.insert(command_line_switch(name,arg)); } bool command_line::parse_cmd_line(int argc, char **argv) { #define CMDLINE_ARG( name, desc, arg ) { name "\000" desc, arg, 0, 0 } #define CMDLINE_ARG_VAL( name, desc, arg, val ) { name "\000" desc, arg, 0, val } enum { NO_ARG, REQ_ARG, OPT_ARG }; int opt_idx = 0; static struct option long_options[] = { // "name", has-arg, flag, val CMDLINE_ARG_VAL("attachment-filename", "filename of the attachment", REQ_ARG, p_attachment_filename), CMDLINE_ARG_VAL("has-binary-attach", "match if the message has attachments", NO_ARG,p_has_binary_attach), CMDLINE_ARG_VAL("has-field","",OPT_ARG,p_has_field), CMDLINE_ARG_VAL("field", "",OPT_ARG,p_field), CMDLINE_ARG_VAL("ifield","",OPT_ARG,p_ifield), CMDLINE_ARG_VAL("from", "",OPT_ARG, p_std_field), CMDLINE_ARG_VAL("sender", "", OPT_ARG,p_std_field), CMDLINE_ARG_VAL("to", "", OPT_ARG,p_std_field), CMDLINE_ARG_VAL("subject", "", OPT_ARG,p_std_field), CMDLINE_ARG_VAL("cc", "", OPT_ARG,p_std_field), CMDLINE_ARG_VAL("bcc", "", OPT_ARG,p_std_field), CMDLINE_ARG_VAL("user-agent", "", OPT_ARG,p_std_field), CMDLINE_ARG_VAL("date", "", OPT_ARG,p_std_field), CMDLINE_ARG_VAL("content-type", "", OPT_ARG,p_std_field), CMDLINE_ARG_VAL("content-transfer-encoding","",OPT_ARG,p_std_field), CMDLINE_ARG_VAL("content-disposition", "", OPT_ARG,p_std_field), CMDLINE_ARG_VAL("content-description", "", OPT_ARG,p_std_field), CMDLINE_ARG_VAL("add-header", "", REQ_ARG, p_add_header), CMDLINE_ARG_VAL("del-header", "", REQ_ARG, p_del_header), CMDLINE_ARG_VAL("mod-header", "", REQ_ARG, p_mod_header), CMDLINE_ARG_VAL("add-part-header", "", REQ_ARG, p_add_part_header), CMDLINE_ARG_VAL("del-part-header", "", REQ_ARG, p_del_part_header), CMDLINE_ARG_VAL("mod-part-header", "", REQ_ARG, p_mod_part_header), CMDLINE_ARG_VAL("attach", "", REQ_ARG, p_attach), CMDLINE_ARG_VAL("detach", "", NO_ARG, p_detach), CMDLINE_ARG_VAL("delete-part", "", NO_ARG, p_delete_part), CMDLINE_ARG_VAL("delete-message", "", NO_ARG, p_delete_msg), CMDLINE_ARG_VAL("print-part", "", NO_ARG,p_print_part), CMDLINE_ARG_VAL("print-message", "", NO_ARG,p_print_msg), CMDLINE_ARG_VAL("pipe-to", "", REQ_ARG, p_pipe_to), CMDLINE_ARG_VAL("recursive", "", NO_ARG, p_recursive), CMDLINE_ARG_VAL("invert-selection", "", NO_ARG, p_invert_selection), CMDLINE_ARG_VAL("match-shell", "", NO_ARG, p_match_shell), CMDLINE_ARG_VAL("match-regex", "", NO_ARG, p_match_regex), CMDLINE_ARG_VAL("perl-regex", "", NO_ARG, p_perl_regex), CMDLINE_ARG_VAL("case-insensitive", "", NO_ARG, p_case_insensitive), CMDLINE_ARG_VAL("encoding", "", REQ_ARG, p_encoding), CMDLINE_ARG_VAL("in", "", REQ_ARG, p_in), CMDLINE_ARG_VAL("out", "", REQ_ARG, p_out), CMDLINE_ARG_VAL("help", "", NO_ARG, p_help), CMDLINE_ARG_VAL("version", "", NO_ARG, p_version), {0, 0, 0, 0} }; int ret; while((ret = getopt_long(argc,argv, "hv", long_options, &opt_idx))!= -1) { switch(ret) { case ':': die("missing parameter"); case '?': die("unknown option"); case 'v': cerr << MM_VERSION << endl; exit(1); break; case 'h': //usage_if(1); for(int i = 0; long_options[i].name; ++i) { const char *name= long_options[i].name; cerr << "--" << name; switch(long_options[i].has_arg) { case NO_ARG: break; case REQ_ARG: cerr << " ARG"; break; case OPT_ARG: cerr << " [ARG]"; break; default: die("unknown has_arg"); } // past the end of name const char *desc = 1 + name + strlen(name); cerr << "\t" << desc << endl; } exit(0); break; default: m_is_opt_set[ret]++; for(int i = 0; long_options[i].name; ++i) { struct option *opt = &long_options[i]; if(ret == opt->val) { if(opt->has_arg == NO_ARG || !optarg) add_switch(opt->name,""); else add_switch(opt->name, optarg); } } } } /* switch(argc - optind) { case 0: // read from stdin write to stdout break; case 1: //stdin provided in argv[optind] pCl->args.push_back(argv[optind]); break; case 2: //stdin & stdout provided in argv[optind] && argv[++optind] pCl->args.push_back(argv[optind]); pCl->args.push_back(argv[++optind]); break; default: usage(); } cerr << endl; */ return true; }
33.238532
85
0.571488
elcuco
4d8e6016b10a02398941365fb9b5e4a78b8011fb
5,083
cpp
C++
src/xray/animation/sources/test_mixing_animation_group.cpp
ixray-team/ixray-2.0
85c3a544175842323fc82f42efd96c66f0fc5abb
[ "Linux-OpenIB" ]
3
2021-10-30T09:36:14.000Z
2022-03-26T17:00:06.000Z
src/xray/animation/sources/test_mixing_animation_group.cpp
acidicMercury8/ixray-2.0
85c3a544175842323fc82f42efd96c66f0fc5abb
[ "Linux-OpenIB" ]
null
null
null
src/xray/animation/sources/test_mixing_animation_group.cpp
acidicMercury8/ixray-2.0
85c3a544175842323fc82f42efd96c66f0fc5abb
[ "Linux-OpenIB" ]
1
2022-03-26T17:00:08.000Z
2022-03-26T17:00:08.000Z
//////////////////////////////////////////////////////////////////////////// // Created : 15.04.2010 // Author : Konstantin Slipchenko // Copyright (C) GSC Game World - 2010 //////////////////////////////////////////////////////////////////////////// #include "pch.h" #include "test_mixing_animation_group.h" #include "fermi_dirac_interpolator.h" #include "linear_interpolator.h" #include "instant_interpolator.h" #include "mixing_animation_lexeme.h" #include "mixing_weight_lexeme.h" #include "mixing_addition_lexeme.h" #include "mixing_multiplication_lexeme.h" #include "mixing_expression.h" #include "skeleton_animation_data.h" #include "mixer.h" #include "skeleton_animation.h" #include "mixing_animation_clip.h" using xray::animation::test_mixing_animation_group; using xray::configs::lua_config_ptr; using xray::configs::lua_config_value; using xray::configs::lua_config_iterator; void test_mixing_animation_group::add_animation( lua_config_value const &config, xray::resources::query_result_for_user const &anim, xray::animation::skeleton const* skel ) { lua_config_value cfg = config["animation"]; base_interpolator* interpolator = 0; pcstr const interpolator_type = cfg["interpolator_type"]; if ( !strings::compare(interpolator_type,"fermi") ) { interpolator = NEW(fermi_dirac_interpolator)(cfg["interpolation_time"], cfg["interpolation_epsilon"] ); } else if ( !strings::compare(interpolator_type,"linear") ) { interpolator = NEW(linear_interpolator)( cfg["interpolation_time"] ); } else if ( !strings::compare(interpolator_type,"instant") ) { interpolator = NEW(instant_interpolator); } else if ( !strings::compare(interpolator_type,"instant") ) { UNREACHABLE_CODE( ); } skeleton_animation_data* const animation_data = static_cast_checked<skeleton_animation_data*>( anim.get_unmanaged_resource().c_ptr() ); animation_data->set_skeleton( skel ); skeleton_animation* const skeleton_animation = NEW( animation::skeleton_animation )( *animation_data ) ; m_p_animations.push_back( skeleton_animation ); ASSERT ( interpolator ); mixing::animation_clip* const animation = NEW (mixing::animation_clip) ( cfg["animation"], interpolator, skeleton_animation, !strings::compare( "full", cfg["animation_type"]) ? mixing::animation_clip::full : mixing::animation_clip::additive ); m_max_time = math::min( m_max_time, animation->time() ); m_max_mix_time = math::max( m_max_mix_time, interpolator->transition_time() ); m_clips.push_back (std::make_pair( animation, config["weight"] ) ); } test_mixing_animation_group::test_mixing_animation_group( lua_config_value cfg, xray::animation::skeleton const* skel ): m_max_mix_time( 0 ), m_max_time( math::infinity ), m_config( cfg ), m_skeleton( skel ), m_loaded( false ) { u32 const size = cfg["group"].size(); resources::request* const resources = static_cast<resources::request*>( ALLOCA( size*sizeof(resources::request) ) ); lua_config_iterator i = cfg["group"].begin( ); lua_config_iterator const e = cfg["group"].end( ); for (resources::request* j = resources; i != e; ++i, ++j ) { j->path = (*i)["animation"]["animation"]; j->id = resources::animation_data_class; } xray::resources::query_resources( resources, size, boost::bind( &test_mixing_animation_group::on_animations_loaded, this, _1 ), g_allocator ); } float test_mixing_animation_group::play_time() const { ASSERT( m_max_time != math::infinity ); return m_max_time - m_max_mix_time ; } test_mixing_animation_group::~test_mixing_animation_group( ) { { vector< animation_pair >::iterator i = m_clips.begin() , e = m_clips.end(); for ( ; i != e; ++i ) DELETE( (*i).first ); } { vector< skeleton_animation* >::iterator i = m_p_animations.begin() , e = m_p_animations.end(); for ( ; i != e; ++i ) DELETE( (*i) ); } } void test_mixing_animation_group::on_animations_loaded ( xray::resources::queries_result& resource ) { u32 const size =resource.size(); for (u32 i=0; i < size; ++i ) { add_animation( m_config["group"][i], resource[i], m_skeleton ); } m_loaded = true; } void test_mixing_animation_group::set_target( xray::animation::mixer& mxr, const u32 time )const { mutable_buffer buffer( ALLOCA(mixer::stack_buffer_size), mixer::stack_buffer_size ); mixing::animation_lexeme lx_animation( buffer, m_clips.front().first ); mixing::weight_lexeme lx_weight( buffer, m_clips.front().second, &m_clips.front().first->interpolator() ); mixing::expression expression = lx_weight * lx_animation; const u32 count = m_clips.size(); for( u32 i = 1; i < count; ++i ) { mixing::animation_lexeme animation( buffer, m_clips[i].first ); mixing::weight_lexeme weight( buffer, m_clips[i].second, & m_clips[i].first->interpolator() ); expression = animation*weight + expression; } mxr.set_target ( expression, time ); }
31.968553
173
0.677159
ixray-team
4d9086a35c7444e0846d3373373b205787533b2c
1,708
cpp
C++
clang/test/CodeGen/attr-cpuspecific-renaming.cpp
ornata/llvm-project
494913b8b4e4bce0b3525e5569d8e486e82b9a52
[ "Apache-2.0" ]
null
null
null
clang/test/CodeGen/attr-cpuspecific-renaming.cpp
ornata/llvm-project
494913b8b4e4bce0b3525e5569d8e486e82b9a52
[ "Apache-2.0" ]
null
null
null
clang/test/CodeGen/attr-cpuspecific-renaming.cpp
ornata/llvm-project
494913b8b4e4bce0b3525e5569d8e486e82b9a52
[ "Apache-2.0" ]
null
null
null
// RUN: %clang_cc1 -no-opaque-pointers -triple x86_64-linux-gnu -emit-llvm -o - -debug-info-kind=constructor -dwarf-version=4 -debugger-tuning=gdb %s | FileCheck %s --check-prefixes=CHECK,LIN // RUN: %clang_cc1 -no-opaque-pointers -triple x86_64-windows-pc -emit-llvm -o - -debug-info-kind=constructor -dwarf-version=4 -debugger-tuning=gdb %s | FileCheck %s --check-prefixes=CHECK,WIN // LIN: @[[S1_NAME:.+]].ifunc = weak_odr ifunc void (%struct.S1*), void (%struct.S1*)* ()* @[[S1_NAME]].resolver // LIN: @[[S2_NAME:.+]].ifunc = weak_odr ifunc void (%struct.S2*), void (%struct.S2*)* ()* @[[S2_NAME]].resolver // WIN: $"[[S1_NAME:.+]]" = comdat any // WIN: $"[[S2_NAME:.+]]" = comdat any struct S1 { void foo(); void mv(); }; void S1::foo(){} __attribute__((cpu_dispatch(ivybridge, generic))) void S1::mv() {} // LIN: define weak_odr void (%struct.S1*)* @[[S1_NAME]].resolver // WIN: define weak_odr dso_local void @"[[S1_NAME]]"(%struct.S1* __attribute__((cpu_specific(generic))) void S1::mv() {} // CHECK: define dso_local {{.*}}void @{{\"?}}[[S1_NAME]].S{{\"?}} // CHECK: define dso_local {{.*}}void @{{\"?}}[[S1_NAME]].A{{\"?}} __attribute__((cpu_specific(ivybridge))) void S1::mv() {} struct S2 { void foo(); void mv(); }; void S2::foo(){} __attribute__((cpu_specific(generic))) void S2::mv() {} // CHECK: define dso_local {{.*}}void @{{\"?}}[[S2_NAME]].A{{\"?}} __attribute__((cpu_dispatch(ivybridge, generic))) void S2::mv() {} // LIN: define weak_odr void (%struct.S2*)* @[[S2_NAME]].resolver // WIN: define weak_odr dso_local void @"[[S2_NAME]]"(%struct.S2* __attribute__((cpu_specific(ivybridge))) void S2::mv() {} // CHECK: define dso_local {{.*}}void @{{\"?}}[[S2_NAME]].S{{\"?}}
38.818182
192
0.636417
ornata
4d92aa703dd41f98481d02f3b464b0789798764e
2,706
cc
C++
node_modules/sodium/src/crypto_hash_sha256.cc
17mahera/Ruu-Bot
25c47c1c591894946c49315bca6e9d806c496cb3
[ "MIT" ]
5
2017-07-09T14:13:08.000Z
2017-11-17T10:16:25.000Z
node_modules/sodium/src/crypto_hash_sha256.cc
17mahera/Ruu-Bot
25c47c1c591894946c49315bca6e9d806c496cb3
[ "MIT" ]
4
2017-02-02T11:26:25.000Z
2021-03-05T08:44:08.000Z
node_modules/sodium/src/crypto_hash_sha256.cc
17mahera/Ruu-Bot
25c47c1c591894946c49315bca6e9d806c496cb3
[ "MIT" ]
18
2017-02-08T15:13:56.000Z
2018-06-20T09:06:09.000Z
/** * Node Native Module for Lib Sodium * * @Author Pedro Paixao * @email paixaop at gmail dot com * @License MIT */ #include "node_sodium.h" /** * int crypto_hash_sha256( * unsigned char * hbuf, * const unsigned char * msg, * unsigned long long mlen) */ NAN_METHOD(bind_crypto_hash_sha256) { Nan::EscapableHandleScope scope; ARGS(1,"argument message must be a buffer"); ARG_TO_UCHAR_BUFFER(msg); NEW_BUFFER_AND_PTR(hash, crypto_hash_sha256_BYTES); if( crypto_hash_sha256(hash_ptr, msg, msg_size) == 0 ) { return info.GetReturnValue().Set(hash); } return info.GetReturnValue().Set(Nan::Null()); } /* * int crypto_hash_sha256_init(crypto_hash_sha256_state *state); */ NAN_METHOD(bind_crypto_hash_sha256_init) { Nan::EscapableHandleScope scope; NEW_BUFFER_AND_PTR(state, crypto_hash_sha256_statebytes()); if( crypto_hash_sha256_init((crypto_hash_sha256_state*) state_ptr) == 0 ) { return info.GetReturnValue().Set(state); } return info.GetReturnValue().Set(Nan::Null()); } /* int crypto_hash_sha256_update(crypto_hash_sha256_state *state, const unsigned char *in, unsigned long long inlen); Buffer state Buffer inStr */ NAN_METHOD(bind_crypto_hash_sha256_update) { Nan::EscapableHandleScope scope; ARGS(2,"arguments must be two buffers: hash state, message part"); ARG_TO_VOID_BUFFER(state); ARG_TO_UCHAR_BUFFER(msg); NEW_BUFFER_AND_PTR(state2, crypto_hash_sha256_statebytes()); memcpy(state2_ptr, state, crypto_hash_sha256_statebytes()); if( crypto_hash_sha256_update((crypto_hash_sha256_state*)state2_ptr, msg, msg_size) == 0 ) { return info.GetReturnValue().Set(state2); } return info.GetReturnValue().Set(Nan::Null()); } /* int crypto_hash_sha256_final(crypto_hash_sha256_state *state, unsigned char *out); */ NAN_METHOD(bind_crypto_hash_sha256_final) { Nan::EscapableHandleScope scope; ARGS(1,"arguments must be a hash state buffer"); ARG_TO_VOID_BUFFER(state); NEW_BUFFER_AND_PTR(hash, crypto_hash_sha256_BYTES); if( crypto_hash_sha256_final((crypto_hash_sha256_state*)state, hash_ptr) == 0 ) { return info.GetReturnValue().Set(hash); } return info.GetReturnValue().Set(Nan::False()); } /** * Register function calls in node binding */ void register_crypto_hash_sha256(Handle<Object> target) { // Hash NEW_METHOD(crypto_hash_sha256); NEW_METHOD(crypto_hash_sha256_init); NEW_METHOD(crypto_hash_sha256_update); NEW_METHOD(crypto_hash_sha256_final); NEW_INT_PROP(crypto_hash_sha256_BYTES); }
27.333333
96
0.699187
17mahera
4d932491803642b2df18bf94827e3b7f9a0b619c
943
hh
C++
video-player/src/player.hh
deets/brombeerquark
9314bc6adaf19ee3868612c8aafdce0f1ebbabb9
[ "MIT" ]
null
null
null
video-player/src/player.hh
deets/brombeerquark
9314bc6adaf19ee3868612c8aafdce0f1ebbabb9
[ "MIT" ]
null
null
null
video-player/src/player.hh
deets/brombeerquark
9314bc6adaf19ee3868612c8aafdce0f1ebbabb9
[ "MIT" ]
null
null
null
#pragma once #include "connector.hh" #include "messages.hh" #include "bcm_host.h" #include "ilclient.h" struct IClientHelper { ILCLIENT_T *client; IClientHelper(); ~IClientHelper(); }; struct ComponentHelper { COMPONENT_T *component; ComponentHelper(IClientHelper&, const char* name, ILCLIENT_CREATE_FLAGS_T flags); ~ComponentHelper(); ComponentHelper(const ComponentHelper&) = delete; ComponentHelper operator=(const ComponentHelper&) = delete; void changeState(OMX_STATETYPE state); template<typename ... CH> static void cleanup(CH& ... components); template<typename ... CH> static void stateTransition(OMX_STATETYPE, CH& ... components); }; class Player { public: Player(); ~Player(); ControlMessage play(const std::string& filename, Connector& connector); private: IClientHelper _iclient; ComponentHelper _video_decode, _video_scheduler, _video_render, _clock; TUNNEL_T _tunnel[4]; };
19.645833
83
0.73701
deets
4d934e01eff13a2f80272a21ca30a22d738a5ffe
1,435
cpp
C++
Heureka/Heureka/PathfindingDriver.cpp
perlangelaursen/02180-Heureka
09bbacf57ad95b276538b213117b5484992c1459
[ "MIT" ]
null
null
null
Heureka/Heureka/PathfindingDriver.cpp
perlangelaursen/02180-Heureka
09bbacf57ad95b276538b213117b5484992c1459
[ "MIT" ]
null
null
null
Heureka/Heureka/PathfindingDriver.cpp
perlangelaursen/02180-Heureka
09bbacf57ad95b276538b213117b5484992c1459
[ "MIT" ]
null
null
null
// // Created by Per Lange Laursen on 17/03/16. // #include "PathfindingDriver.h" void PathfindingDriver::run() { readStateSpace(); readDirections(); } void PathfindingDriver::readDirections() { std::vector<std::string> temp(2); std::ifstream ifs(directions); if(!(ifs.is_open())) { std::cerr << "Error! Could not open the file" + directions; } int startIndex = getIndex(temp, ifs); int goalIndex = getIndex(temp, ifs); pathfinding.aStar(startIndex, goalIndex); ifs.close(); } int PathfindingDriver::getIndex(std::vector<std::string> &temp, std::ifstream &ifs) { getline(ifs, tempString); split(temp, tempString, boost::algorithm::is_any_of(" ")); return pathfinding.getIndex(boost::lexical_cast<int>(temp[0]), boost::lexical_cast<int>(temp[1])); } void PathfindingDriver::readStateSpace() { std::ifstream ifs(file); std::vector<std::string> temp(5); if(!(ifs.is_open())) { std::cerr << "Error! Could not open the file" + file; } while (getline(ifs, tempString)) { split(temp, tempString, boost::algorithm::is_any_of(" ")); tempX1 = boost::lexical_cast<int>(temp[0]); tempY1 = boost::lexical_cast<int>(temp[1]); tempX2 = boost::lexical_cast<int>(temp[3]); tempY2 = boost::lexical_cast<int>(temp[4]); pathfinding.addState(tempX1, tempY1, temp[2], tempX2, tempY2); } ifs.close(); }
27.596154
102
0.636237
perlangelaursen
4d98c3f2a25b98e2f311550427041394596a88d0
1,103
cpp
C++
dx11/vertexbuffer.cpp
ousttrue/Skeletal
bfbed4ec87e06787d3c004050d65954d53d0abbd
[ "MIT" ]
null
null
null
dx11/vertexbuffer.cpp
ousttrue/Skeletal
bfbed4ec87e06787d3c004050d65954d53d0abbd
[ "MIT" ]
null
null
null
dx11/vertexbuffer.cpp
ousttrue/Skeletal
bfbed4ec87e06787d3c004050d65954d53d0abbd
[ "MIT" ]
null
null
null
#include "vertexbuffer.h" #include "vertexbuffer_impl.h" #include <plog/Log.h> #include <d3d11.h> #include <wrl/client.h> using namespace Microsoft::WRL; namespace skeletal::dx11 { VertexBufferGroup::VertexBufferGroup(int vertexCount, simplegltf::GltfTopologyType topology) : m_impl(new VertexBufferGroupImpl) { switch (topology) { case simplegltf::GltfTopologyType::TRIANGLES: m_impl->m_topology = D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST; break; default: throw std::exception("not implemented"); } } VertexBufferGroup::~VertexBufferGroup() { delete m_impl; } void VertexBufferGroup::AddAttribute(ID3D11Device *device, const std::string &semantic, const simplegltf::View &view) { if (semantic == "JOINTS_0" || semantic == "WEIGHTS_0") { // skip return; } m_impl->CreateVertexBuffer(device, semantic, view); } void VertexBufferGroup::SetIndex(ID3D11Device *device, const simplegltf::View &view) { m_impl->CreateIndexBuffer(device, view); } } // namespace skeletal::dx11
25.068182
118
0.68087
ousttrue
4d9bf6c8bc698703a4e65733ec8f71ed5c75fdde
3,163
cc
C++
servlib/conv_layers/RecvRawConvergenceLayer.cc
lauramazzuca21/DTNME
c97b598b09a8c8e97c2e4136879d9f0e157c8df7
[ "Apache-2.0" ]
7
2021-02-11T16:54:24.000Z
2021-08-20T06:15:30.000Z
servlib/conv_layers/RecvRawConvergenceLayer.cc
lauramazzuca21/DTNME
c97b598b09a8c8e97c2e4136879d9f0e157c8df7
[ "Apache-2.0" ]
3
2020-09-18T13:48:53.000Z
2021-05-27T18:28:14.000Z
servlib/conv_layers/RecvRawConvergenceLayer.cc
lauramazzuca21/DTNME
c97b598b09a8c8e97c2e4136879d9f0e157c8df7
[ "Apache-2.0" ]
10
2020-09-26T05:08:40.000Z
2022-01-25T12:57:55.000Z
/* * Copyright 2015 United States Government as represented by NASA * Marshall Space Flight Center. All Rights Reserved. * * Released under the NASA Open Source Software Agreement version 1.3; * You may obtain a copy of the Agreement at: * * http://ti.arc.nasa.gov/opensource/nosa/ * * The subject software is provided "AS IS" WITHOUT ANY WARRANTY of any kind, * either expressed, implied or statutory and this agreement does not, * in any manner, constitute an endorsement by government agency of any * results, designs or products resulting from use of the subject software. * See the Agreement for the specific language governing permissions and * limitations. */ #ifdef HAVE_CONFIG_H # include <dtn-config.h> #endif #include <sys/types.h> #include <sys/stat.h> #include <dirent.h> #include <errno.h> #include <fcntl.h> #include <unistd.h> #include <netinet/in.h> #include <oasys/io/IO.h> #include <oasys/util/StringBuffer.h> #include <oasys/util/URI.h> #include "RecvRawConvergenceLayer.h" #include "bundling/Bundle.h" #include "bundling/BundleEvent.h" #include "bundling/BundleList.h" #include "bundling/BundleProtocol.h" #include "bundling/BundleDaemon.h" namespace dtn { class RecvRawConvergenceLayer::Params RecvRawConvergenceLayer::defaults_; /****************************************************************************** * * RecvRawConvergenceLayer * *****************************************************************************/ RecvRawConvergenceLayer::RecvRawConvergenceLayer() : ConvergenceLayer("RecvRawConvergenceLayer", "file") { defaults_.can_transmit_ = true; } //---------------------------------------------------------------------- CLInfo* RecvRawConvergenceLayer::new_link_params() { return new RecvRawConvergenceLayer::Params(RecvRawConvergenceLayer::defaults_); } /** * Bring up a new interface. */ bool RecvRawConvergenceLayer::interface_up(Interface* iface, int argc, const char* argv[]) { (void)iface; (void)argc; (void)argv; return true; } //---------------------------------------------------------------------- void RecvRawConvergenceLayer::interface_activate(Interface* iface) { (void) iface; } /** * Bring down the interface. */ bool RecvRawConvergenceLayer::interface_down(Interface* iface) { (void)iface; return true; } /** * Validate that the contact eid specifies a legit directory. */ bool RecvRawConvergenceLayer::open_contact(const ContactRef& contact) { (void)contact; // nothing to do return true; } /** * Close the connnection to the contact. */ bool RecvRawConvergenceLayer::close_contact(const ContactRef& contact) { (void)contact; // nothing to do return true; } /** * Try to send the bundles queued up for the given contact. */ void RecvRawConvergenceLayer::send_bundle(const ContactRef& contact, Bundle* bundle) { (void)contact; (void)bundle; return; } void RecvRawConvergenceLayer::bundle_queued(const LinkRef& link, const BundleRef& bref) { (void)link; (void)bref; return; } } // namespace dtn
23.257353
83
0.641796
lauramazzuca21
4da11d3b7e98ea2242567634b3cae0a956d67928
4,412
cpp
C++
lib/heif/Srcs/common/samplegroupdescriptionbox.cpp
anzksdk/tifig-by
17a306b27e6e2dd2992e1c0896312047541f4be0
[ "Apache-2.0" ]
null
null
null
lib/heif/Srcs/common/samplegroupdescriptionbox.cpp
anzksdk/tifig-by
17a306b27e6e2dd2992e1c0896312047541f4be0
[ "Apache-2.0" ]
null
null
null
lib/heif/Srcs/common/samplegroupdescriptionbox.cpp
anzksdk/tifig-by
17a306b27e6e2dd2992e1c0896312047541f4be0
[ "Apache-2.0" ]
null
null
null
/* Copyright (c) 2015, Nokia Technologies Ltd. * All rights reserved. * * Licensed under the Nokia High-Efficiency Image File Format (HEIF) License (the "License"). * * You may not use the High-Efficiency Image File Format except in compliance with the License. * The License accompanies the software and can be found in the file "LICENSE.TXT". * * You may also obtain the License at: * https://nokiatech.github.io/heif/license.txt */ #include "samplegroupdescriptionbox.hpp" #include "bitstream.hpp" #include "log.hpp" #include <memory> #include <stdexcept> SampleGroupDescriptionBox::SampleGroupDescriptionBox() : FullBox("sgpd", 0, 0), mGroupingType(), mDefaultLength(0), mSampleGroupEntry() { } void SampleGroupDescriptionBox::setDefaultLength(std::uint32_t defaultLength) { mDefaultLength = defaultLength; } std::uint32_t SampleGroupDescriptionBox::getDefaultLength() const { return mDefaultLength; } void SampleGroupDescriptionBox::addEntry(std::unique_ptr<SampleGroupEntry> sampleGroupEntry) { mSampleGroupEntry.push_back(std::move(sampleGroupEntry)); } const SampleGroupEntry* SampleGroupDescriptionBox::getEntry(std::uint32_t index) const { return mSampleGroupEntry.at(index - 1).get(); } void SampleGroupDescriptionBox::setGroupingType(const std::string& groupingType) { if (groupingType.length() != 4) { throw std::runtime_error("SampleGroupDescriptionBox::setGroupingType: invalid grouping type length, must be 4 characters"); } mGroupingType = groupingType; } const std::string& SampleGroupDescriptionBox::getGroupingType() const { return mGroupingType; } std::uint32_t SampleGroupDescriptionBox::getEntryIndexOfSampleId(const std::uint32_t sampleId) const { uint32_t index = 1; for (const auto& entry : mSampleGroupEntry) { DirectReferenceSampleListEntry* drsle = dynamic_cast<DirectReferenceSampleListEntry*>(entry.get()); if ((drsle != nullptr) && (drsle->getSampleId() == sampleId)) { return index; } ++index; } throw std::runtime_error("SampleGroupDescriptionBox::getEntryIndexOfSampleId: no entry for sampleId found."); } void SampleGroupDescriptionBox::writeBox(BitStream& bitstr) { if (mSampleGroupEntry.size() == 0) { throw std::runtime_error("SampleGroupDescriptionBox::writeBox: not writing an invalid box without entries"); } // Write box headers writeFullBoxHeader(bitstr); if (mGroupingType.length() != 4) { throw std::runtime_error("SampleGroupDescriptionBox::writeBox: Invalid grouping_type length"); } bitstr.writeString(mGroupingType); if (getVersion() == 1) { bitstr.write32Bits(mDefaultLength); } bitstr.write32Bits(mSampleGroupEntry.size()); for (auto& entry : mSampleGroupEntry) { if (getVersion() == 1 && mDefaultLength == 0) { bitstr.write32Bits(entry->getSize()); } entry->writeEntry(bitstr); } // Update the size of the movie box updateSize(bitstr); } void SampleGroupDescriptionBox::parseBox(BitStream& bitstr) { // First parse the box header parseFullBoxHeader(bitstr); bitstr.readStringWithLen(mGroupingType, 4); if (getVersion() == 1) { mDefaultLength = bitstr.read32Bits(); } const uint32_t entryCount = bitstr.read32Bits(); for (unsigned int i = 0; i < entryCount; ++i) { uint32_t descriptionLength = mDefaultLength; if (getVersion() == 1 && mDefaultLength == 0) { descriptionLength = bitstr.read32Bits(); } BitStream subBitstr; bitstr.extract(bitstr.getPos(), bitstr.getPos() + descriptionLength, subBitstr); // extract "sub-bitstream" for entry bitstr.skipBytes(descriptionLength); if (mGroupingType == "refs") { std::unique_ptr<SampleGroupEntry> directReferenceSampleListEntry(new DirectReferenceSampleListEntry); directReferenceSampleListEntry->parseEntry(subBitstr); mSampleGroupEntry.push_back(std::move(directReferenceSampleListEntry)); } else { /** @todo Add support for other entry types here. **/ logWarning() << "Skipping an entry of SampleGroupDescriptionBox of an unknown grouping type '" << mGroupingType << "'."; } } }
28.649351
132
0.682457
anzksdk
4da1f7b370bfce64e7f86275a8ac669d0b8a0dcc
2,228
cpp
C++
test/unittest/rtps/history/TopicPayloadPoolRegistryTests.cpp
jason-fox/Fast-RTPS
af466cfe63a8319cc9d37514267de8952627a9a4
[ "Apache-2.0" ]
575
2015-01-22T20:05:04.000Z
2020-06-01T10:06:12.000Z
test/unittest/rtps/history/TopicPayloadPoolRegistryTests.cpp
jason-fox/Fast-RTPS
af466cfe63a8319cc9d37514267de8952627a9a4
[ "Apache-2.0" ]
1,110
2015-04-20T19:30:34.000Z
2020-06-01T08:13:52.000Z
test/unittest/rtps/history/TopicPayloadPoolRegistryTests.cpp
jason-fox/Fast-RTPS
af466cfe63a8319cc9d37514267de8952627a9a4
[ "Apache-2.0" ]
273
2015-08-10T23:34:42.000Z
2020-05-28T13:03:32.000Z
// Copyright 2020 Proyectos y Sistemas de Mantenimiento SL (eProsima). // // 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 <gtest/gtest.h> #include <rtps/history/TopicPayloadPoolRegistry.hpp> #include <rtps/history/TopicPayloadPoolRegistry_impl/TopicPayloadPoolProxy.hpp> using namespace eprosima::fastrtps::rtps; using namespace ::testing; using namespace std; TEST(TopicPayloadPoolRegistryTests, basic_checks) { PoolConfig cfg{ PREALLOCATED_MEMORY_MODE, 4u, 4u, 4u }; // Same topic, same config should result on same pool auto pool_a1 = TopicPayloadPoolRegistry::get("topic_a", cfg); auto pool_a2 = TopicPayloadPoolRegistry::get("topic_a", cfg); EXPECT_EQ(pool_a1, pool_a2); // Same topic, same config should result on same pool auto pool_b1 = TopicPayloadPoolRegistry::get("topic_b", cfg); auto pool_b2 = TopicPayloadPoolRegistry::get("topic_b", cfg); EXPECT_EQ(pool_b1, pool_b2); // Different topics should be different pools EXPECT_NE(pool_a1, pool_b1); cfg.memory_policy = DYNAMIC_RESERVE_MEMORY_MODE; // Same topic, different policy should result on different pool. auto pool_a3 = TopicPayloadPoolRegistry::get("topic_a", cfg); EXPECT_NE(pool_a1, pool_a3); // And be different from the other topic. EXPECT_NE(pool_b1, pool_a3); // Releasing all references to a topic pool should automatically release the entry std::weak_ptr<ITopicPayloadPool> pool_wa = pool_a1; pool_a1.reset(); pool_a2.reset(); pool_a3.reset(); EXPECT_TRUE(pool_wa.expired()); // Destructor should have been called a certain number of times EXPECT_EQ(detail::TopicPayloadPoolProxy::DestructorHelper::instance().get(), 2u); }
37.133333
86
0.741472
jason-fox
4da4220cb0d259307ff95cd134a724b843b45219
16,191
cpp
C++
src/yyy_main.cpp
FlyingJester/kashyyyk2
b7de62d6db6d3740f49ff72e5dd94b2f412aa143
[ "Linux-OpenIB" ]
null
null
null
src/yyy_main.cpp
FlyingJester/kashyyyk2
b7de62d6db6d3740f49ff72e5dd94b2f412aa143
[ "Linux-OpenIB" ]
null
null
null
src/yyy_main.cpp
FlyingJester/kashyyyk2
b7de62d6db6d3740f49ff72e5dd94b2f412aa143
[ "Linux-OpenIB" ]
null
null
null
/* * Copyright (c) 2014-2017 Martin McDonough. 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. * * - Products derived from this software may not be called "Kashyyyk", nor may * "YYY" appear in their name, without prior written permission of * the copyright holders. * * 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 "yyy_main.h" #include "yyy_assert.h" #include "yyy_connect_thread.h" // Vector must be included before Fl_Window or else Watcom literally crashes. // The issue seems related with FL_x.H including Windows.h, which redefines // 'max' in a way that seriously confuses Watcom. To the point of crashing. // Somehow that redefine messes up how the std::numeric_limits<>::max() is // understood by the compiler. #include <vector> // Included early to fix warnings about unary & operators. #include <FL/fl_ask.H> #include <FL/Fl_Image.H> #include <FL/Fl_Window.H> #include <FL/Fl_Tree.H> #include <FL/Fl_Tree_Item.H> #include "kashyyyk2.hpp" #include "ui/yyy_server_tree.hpp" #include "yyy_server_controller.hpp" #include "yyy_server_core.hpp" #include "yyy_server_ui.hpp" #include "yyy_server_thread.hpp" #include "yyy_theme.h" #include "yyy_maintainer.hpp" #include "yyy_alloca.h" #include "monitor/yyy_monitor.hpp" #include "thread/yyy_thread.h" #include <FL/Fl.H> #include "utils/yyy_fl_locker.hpp" #include <string> #include <stdlib.h> #include <assert.h> #ifdef YYY_ENABLE_IRC #include "irc/yyy_irc.hpp" #endif #ifdef YYY_ENABLE_SPARK #include "irc/yyy_spark.hpp" #endif #ifdef YYY_ENABLE_DISCORD #include "irc/yyy_discord.hpp" #endif #ifdef _WIN32 #define WIN32_LEAN_AND_MEAN #include "Windows.h" #include "TCHAR.h" #ifdef __WATCOMC__ #ifndef _TRUNCATE #define _TRUNCATE 0 #endif static inline int _sntprintf_s(TCHAR *dest, size_t size, size_t count, const TCHAR *fmt, ...){ assert(count == _TRUNCATE || count <= size); va_list args; va_start(args, fmt); const int r = _sntprintf(dest, size - 1, fmt, args); va_end(args); dest[size-1] = *TEXT(""); return r; } #endif #endif const char help_string[] = "Kashyyyk2\n"\ " -v, --version Display version information\n"\ " -h, --help Display this help information\n"; namespace YYY { /*---------------------------------------------------------------------------*/ struct Window { Fl_Double_Window *m_window; ServerTree *m_server_tree; ServerThread *m_server_thread; } yyy_main_window; /*---------------------------------------------------------------------------*/ #ifdef YYY_ENABLE_IRC static ChatProtocol *irc_protocol; #endif /*---------------------------------------------------------------------------*/ #ifdef YYY_ENABLE_SPARK ChatProtocol *spark_protocol; #endif /*---------------------------------------------------------------------------*/ #ifdef YYY_ENABLE_DISCORD ChatProtocol *discord_protocol; #endif /*---------------------------------------------------------------------------*/ static inline const char *yyy_determine_server_name(const char *url, unsigned short &name_len){ const char *name; unsigned short dot_indices[2] = {0, 0}; // Sort out the probable name of the server. This mostly depends on // where the domain separators (aka, a dot) appear. If there is only // one, everything before the separator is used. If there are two or // more, the name is everything after the first but before the last. unsigned short len = 0; for(unsigned short dot = 0; url[len] != '\0'; len++){ if(url[len] == '.'){ dot_indices[dot] = len; dot = 1; } } YYY_Assert(dot_indices[0] != 0 || dot_indices[1] != 0, "Invalid URI"); if(dot_indices[0] == 0 && dot_indices[1] == 0){ // What the actual fart? name = url; name_len = len; } else if(dot_indices[1] == 0){ name = url; name_len = dot_indices[0]; } else{ name = url + dot_indices[0] + 1; name_len = dot_indices[1] - (dot_indices[0] + 1); } return name; } /*---------------------------------------------------------------------------*/ static inline Window &yyy_connection_args(const char *uri, void *arg, const char *&out_name, unsigned short &out_name_len){ assert(uri != NULL); assert(*uri != '\0'); out_name = yyy_determine_server_name(uri, out_name_len); return (arg == NULL) ? yyy_main_window : *static_cast<Window*>(arg); } /*---------------------------------------------------------------------------*/ extern "C" void YYY_FASTCALL YYY_AttemptingConnection(const char *uri, void *arg){ unsigned short name_len; const char *name; Window &window = yyy_connection_args(uri, arg, name, name_len); { YYY::FlLocker locker; window.m_server_tree->addConnectingServer(uri, name, name_len); window.m_server_tree->redraw(); } } /*---------------------------------------------------------------------------*/ extern "C" void YYY_FASTCALL YYY_FailedConnection(const char *uri, void *arg){ unsigned short name_len; const char *name; Window &window = yyy_connection_args(uri, arg, name, name_len); { YYY::FlLocker locker; window.m_server_tree->connectionFailed(name, name_len); window.m_server_tree->redraw(); } } /*---------------------------------------------------------------------------*/ extern "C" void YYY_FASTCALL YYY_AddConnection(struct YYY_NetworkSocket *socket, const char *uri, void *arg){ unsigned short name_len; const char *name; Window &window = yyy_connection_args(uri, arg, name, name_len); // TEST: Assume IRC for now. ServerController *const server = new ServerController(*irc_protocol); server->setup(name, name_len, socket); window.m_server_thread->addServer(*server); } /*---------------------------------------------------------------------------*/ extern "C" void YYY_FASTCALL YYY_TryJoin(const char *channel){ ServerTree::ServerData *const server_data = yyy_main_window.m_server_tree->getSelectedServer(); YYY_Assert(server_data != NULL, "No server data found when trying to connect"); if(server_data){ Message join_msg; const size_t where_len = strlen(channel); assert(where_len < ~((unsigned short)0)); join_msg.type = eYYYChatJoin; join_msg.m.join.from = NULL; join_msg.m.join.from_len = 0; join_msg.m.join.where = channel; join_msg.m.join.where_len = (unsigned short)where_len; server_data->arg->send(join_msg); } } /*---------------------------------------------------------------------------*/ extern "C" void YYY_FASTCALL YYY_SendPrivateMessage(const char *msg, unsigned short lens, const char *channel){ YYY_SendPrivateMessageV(&msg, &lens, 1, channel); } /*---------------------------------------------------------------------------*/ extern "C" void YYY_SendPrivateMessageV(const char **msgs, unsigned short *lens, unsigned short num_msgs, const char *channel){ assert(msgs); assert(lens); if(num_msgs == 0) return; Message priv_msg; priv_msg.type = eYYYChatMessage; priv_msg.m.message.from = NULL; priv_msg.m.message.from_len = 0; ServerTree::ServerData *server_data = NULL; // This is used to echo the message in our own buffer if applicable. ChannelController *channel_controller = NULL; if(channel == NULL){ if(const ServerTree::ChannelData *const channel_data = yyy_main_window.m_server_tree->getSelectedChannel(&server_data)){ assert(server_data != NULL); assert(channel_data->arg != NULL); channel_controller = channel_data->arg; const std::string &channel_name = channel_controller->name(); priv_msg.m.message.to = channel_name.c_str(); assert(channel_name.length() < ~((unsigned short)0)); priv_msg.m.message.to_len = (unsigned short)channel_name.length(); } else{ // Send an error message otherwise? return; } } else{ server_data = yyy_main_window.m_server_tree->getSelectedServer(); priv_msg.m.message.to = channel; const size_t channel_len = strlen(channel); assert(channel_len < ~((unsigned short)0)); priv_msg.m.message.to_len = (unsigned short)channel_len; } if(server_data == NULL) return; assert(server_data->arg != NULL); ServerController &server = *server_data->arg; for(unsigned short i = 0; i < num_msgs; i++){ if(const unsigned short len = lens[i]){ priv_msg.m.message.message = msgs[i]; priv_msg.m.message.message_len = len; assert(msgs[i] != NULL); server.send(priv_msg); if(channel_controller) channel_controller->handleMessage(priv_msg, false, false); } } } /*---------------------------------------------------------------------------*/ static void yyy_server_tree_callback(Fl_Widget *w, void *arg){ assert(w != NULL); assert(arg != NULL); Window &window = *static_cast<Window*>(arg); ServerTree &tree = *static_cast<ServerTree*>(w); (void)window; if(tree.callback_reason() != FL_TREE_REASON_SELECTED) return; Fl_Tree_Item *const item = tree.callback_item(); const char *l = item->label(); assert(l != NULL); if(item == tree.root()){} else if(item->parent() == tree.root()){ // Is a server ServerTree::ServerData *const data = (ServerTree::ServerData*)(item->user_data()); assert(data != NULL); ServerController *const server = data->arg; if(ServerTree::IsConnected(data)){ assert(server != NULL); server->select(NULL, 0); } else if(server != NULL){ // Since we only put a server/arg into the server data when a // connection succeeds, this means we were previously connected, // and then got disconnected. } } else{ // Is a channel ServerTree::ChannelData *const data = (ServerTree::ChannelData*)(item->user_data()); ChannelController *controller = data->arg; controller->select(); } } /*---------------------------------------------------------------------------*/ // args must be free-able by YYY_ALLOCA_FREE. static bool Main(unsigned num_args, const std::string *args){ #ifndef NDEBUG #if defined __GNUC__ Fl::scheme("plastic"); #elif defined __WATCOMC__ Fl::scheme("gleam"); #else Fl::scheme("gtk+"); #endif #else Fl::scheme("gtk+"); #endif #ifdef YYY_ENABLE_IRC irc_protocol = new IRCProtocol(); #endif #ifdef YYY_ENABLE_SPARK ChatProtocol *spark_protocol; #endif #ifdef YYY_ENABLE_DISCORD ChatProtocol *discord_protocol; #endif YYY_InitThemes(); YYY_StartConnectThread(); yyy_main_window.m_window = YYY_MakeWindow(); #ifdef _WIN32 // Get the application icon, and set the FLTK window to this icon. { const HINSTANCE instance = GetModuleHandle(NULL); HICON icon = LoadIcon(instance, MAKEINTRESOURCE(101)); if(icon != NULL){ yyy_main_window.m_window->icon(icon); DestroyIcon(icon); } else{ TCHAR buffer[100]; _sntprintf_s(buffer, sizeof(buffer) / sizeof(TCHAR), _TRUNCATE, TEXT("Could not load icon: %i\n"), GetLastError()); OutputDebugString(buffer); } } #endif yyy_main_window.m_server_tree = server_tree; yyy_main_window.m_window->show(); yyy_main_window.m_server_thread = new ServerThread(); yyy_main_window.m_server_thread->start(); chat_scroll->callback(ChannelController::ChatScrollCallback, NULL); chat_scroll->step(1); chat_scroll->step(1.0); chat_scroll->range(0.0, 1.0); chat_scroll->value(0); server_tree->callback(yyy_server_tree_callback, &yyy_main_window); YYY_SetTheme(eYYY_DefaultTheme); { YYY::FlLocker locker; Fl::run(); } YYY_StopConnectThread(); delete yyy_main_window.m_server_thread; delete yyy_main_window.m_window; YYY_ALLOCA_FREE(args); return EXIT_SUCCESS; } } // namespace YYY /*---------------------------------------------------------------------------*/ // Returns false if the option means we should quit. static bool yyy_handle_arg(const char *arg){ if(arg[0] != '-') return true; if((arg[1] == 'h' && (arg[2] == '\0' || strcmp(arg+2, "elp") == 0)) || strcmp(arg+1, "-help") == 0){ fwrite(help_string, sizeof(help_string)-1, 1, stdout); fflush(stdout); return false; } if((arg[1] == 'v' && (arg[2] == '\0' || strcmp(arg+2, "ersion") == 0)) || strcmp(arg+1, "-version") == 0){ printf("Kashyyyk 2\nCompiled %s using %s and FLTK %f\n"\ "Copyright Martin McDonough (C) 2017, released under the Mozilla Public License 1.1\n", __DATE__, #if (defined __clang__) || (defined __CLANG__) "Clang", #elif defined __GNUC__ "GNU gcc/g++ Compiler", #elif defined _MSC_VER "Microsoft Visual C/C++ Compiler", #elif defined __WATCOMC__ "Open Watcom C/C++ Compiler", #else "Unknown C/C++ Compiler", #endif Fl::version()); fflush(stdout); return false; } return true; } /*---------------------------------------------------------------------------*/ #if (defined _MSC_VER) || (((defined WIN32) || (defined _WIN32)) && (defined __GNUC__)) #include <Windows.h> extern "C" int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int){ LPWSTR raw_args = GetCommandLineW(); int argc = 0; LPWSTR *const argv = CommandLineToArgvW(raw_args, &argc); std::string *const args = (std::string*)YYY_ALLOCA(argc*sizeof(std::string)); for(int i = 0; i < argc; i++){ const unsigned len = wcslen(argv[i]); new (args + i) std::string(len + sizeof(TEXT("")), ' '); size_t resize_len; #ifdef __WATCOMC__ resize_len = wcstombs(&(args[i][0]), argv[i], args[i].length()); #else wcstombs_s(&resize_len, &(args[i][0]), args[i].length(), argv[i], len); #endif args[i].resize(resize_len); if(!yyy_handle_arg(args[i].c_str())) return EXIT_SUCCESS; } return YYY::Main(argc, args) ? EXIT_SUCCESS : EXIT_FAILURE; } #else int main(int argc, char **argv){ std::string *const args = (std::string*)YYY_ALLOCA(argc*sizeof(std::string)); for(unsigned i = 0; i < static_cast<unsigned>(argc); i++){ if(!yyy_handle_arg(argv[i])){ return EXIT_SUCCESS; } else{ new (args + i) std::string(argv[i]); } } return YYY::Main(argc, args) ? EXIT_SUCCESS : EXIT_FAILURE; } #endif
29.708257
99
0.584955
FlyingJester
4da59ae2f57432424fa441ea9f7a6e6748af5e85
813
cc
C++
src/script/randgen.cc
entn-at/openfst
10ab103134b1872e475800fd5ea37747d1c0c858
[ "Apache-2.0" ]
336
2018-11-06T14:03:32.000Z
2022-03-31T00:48:03.000Z
src/script/randgen.cc
entn-at/openfst
10ab103134b1872e475800fd5ea37747d1c0c858
[ "Apache-2.0" ]
43
2017-07-13T21:04:44.000Z
2022-02-16T19:47:53.000Z
src/script/randgen.cc
entn-at/openfst
10ab103134b1872e475800fd5ea37747d1c0c858
[ "Apache-2.0" ]
77
2018-11-07T06:43:10.000Z
2021-12-10T04:16:43.000Z
// See www.openfst.org for extensive documentation on this weighted // finite-state transducer library. #include <fst/script/fst-class.h> #include <fst/script/randgen.h> #include <fst/script/script-impl.h> namespace fst { namespace script { void RandGen(const FstClass &ifst, MutableFstClass *ofst, time_t seed, const RandGenOptions<RandArcSelection> &opts) { if (!internal::ArcTypesMatch(ifst, *ofst, "RandGen")) { ofst->SetProperties(kError, kError); return; } RandGenArgs args(ifst, ofst, seed, opts); Apply<Operation<RandGenArgs>>("RandGen", ifst.ArcType(), &args); } REGISTER_FST_OPERATION(RandGen, StdArc, RandGenArgs); REGISTER_FST_OPERATION(RandGen, LogArc, RandGenArgs); REGISTER_FST_OPERATION(RandGen, Log64Arc, RandGenArgs); } // namespace script } // namespace fst
30.111111
70
0.738007
entn-at
4da685673e98898aa5a8fe658f19fe18cbc78274
136
cc
C++
third-party/paxos/src/deptran/empty.cc
shenweihai1/rolis-eurosys2022
59b3fd58144496a9b13415e30b41617b34924323
[ "MIT" ]
1
2022-03-08T00:36:10.000Z
2022-03-08T00:36:10.000Z
third-party/paxos/src/deptran/empty.cc
shenweihai1/rolis-eurosys2022
59b3fd58144496a9b13415e30b41617b34924323
[ "MIT" ]
null
null
null
third-party/paxos/src/deptran/empty.cc
shenweihai1/rolis-eurosys2022
59b3fd58144496a9b13415e30b41617b34924323
[ "MIT" ]
null
null
null
/** * This empty file is for building purpose. Building systems such as * waf and cmake needs a source file to generate a target. */
27.2
68
0.720588
shenweihai1
4dabc83776b871de31d9a018c3b16d6d078091ae
298
cpp
C++
Crack_Practice/Xor_Decode_Shellcode.cpp
TuringGu/RELearning
a44813d6ae0416631bf5b345a7606cdf3d1a3ffe
[ "MIT" ]
null
null
null
Crack_Practice/Xor_Decode_Shellcode.cpp
TuringGu/RELearning
a44813d6ae0416631bf5b345a7606cdf3d1a3ffe
[ "MIT" ]
null
null
null
Crack_Practice/Xor_Decode_Shellcode.cpp
TuringGu/RELearning
a44813d6ae0416631bf5b345a7606cdf3d1a3ffe
[ "MIT" ]
null
null
null
void main() { __asm int 3 // break __asm { nop nop nop nop nop nop pop eax add eax, 0x14 xor ecx,ecx decode_loop: mov bl,[eax+ecx] xor bl, 0x44 mov [eax+ecx],bl inc ecx cmp bl,0x90 // Ende jne decode_loop nop nop nop nop nop } }
9.933333
22
0.536913
TuringGu
4dac4be4eb05e68464363041ed58d3aacfcb99c3
6,057
cpp
C++
skse/GameEvents.cpp
Schwarz-Hexe/YAMMS
2a64c482a3813ec2450f025e97854f5671c1851e
[ "MIT" ]
null
null
null
skse/GameEvents.cpp
Schwarz-Hexe/YAMMS
2a64c482a3813ec2450f025e97854f5671c1851e
[ "MIT" ]
null
null
null
skse/GameEvents.cpp
Schwarz-Hexe/YAMMS
2a64c482a3813ec2450f025e97854f5671c1851e
[ "MIT" ]
null
null
null
#include "GameEvents.h" // For testing // TESActivateEvent 0x012E3E60 // TESActiveEffectApplyRemoveEvent 0x012E3E90 // TESActorLocationChangeEvent 0x012E3EC0 // TESBookReadEvent 0x012E3EF0 // TESCellAttachDetachEvent 0x012E3F20 // TESCellFullyLoadedEvent 0x012E3F50 EventDispatcher<TESCombatEvent>* g_combatEventDispatcher = (EventDispatcher<TESCombatEvent>*) 0x012E4DB0; // TESContainerChangedEvent 0x012E3FE0 EventDispatcher<TESDeathEvent>* g_deathEventDispatcher = (EventDispatcher<TESDeathEvent>*) 0x012E4E10; // TESDestructionStageChangedEvent 0x012E4E40 // TESEnterBleedoutEvent 0x012E4E70 // TESEquipEvent 0x012E4EA0 // TESFormDeleteEvent 0x012E4ED0 // TESFurnitureEvent 0x012E4F00 // TESGrabReleaseEvent 0x012E4F30 EventDispatcher<TESHitEvent>* g_hitEventDispatcher = (EventDispatcher<TESHitEvent>*) 0x012E4F60; // TESLoadGameEvent 0x012E4FC0 // TESLockChangedEvent 0x012E4FF0 // TESMagicEffectApplyEvent 0x012E5020 // TESMagicWardHitEvent 0x012E5050 // TESMoveAttachDetachEvent 0x012E5080 // TESObjectLoadedEvent 0x012E50B0 // TESObjectREFRTranslationEvent 0x012E50E0 // TESOpenCloseEvent 0x012E5110 // TESPackageEvent 0x012E5140 // TESPerkEntryRunEvent 0x012E5170 // TESQuestInitEvent 0x012E51A0 EventDispatcher<TESQuestStageEvent>* g_questStageEventDispatcher = (EventDispatcher<TESQuestStageEvent>*) 0x012E51D0; // TESResetEvent 0x012E5260 // TESResolveNPCTemplatesEvent 0x012E5290 // TESSceneEvent 0x012E52C0 // TESSceneActionEvent 0x012E52F0 // TESScenePhaseEvent 0x012E5320 // TESSellEvent 0x012E5350 //EventDispatcher<TESSleepStartEvent>* g_sleepStartEventDispatcher = (EventDispatcher<TESSleepStartEvent>*) 0x012E4580; // TESSleepStopEvent 0x012E53B0 // TESSpellCastEvent 0x012E53E0 // TESTopicInfoEvent 0x012E5440 // TESTrackedStatsEvent 0x012E5470 // TESTrapHitEvent 0x012E54A0 // TESTriggerEvent 0x012E54D0 // TESTriggerEnterEvent 0x012E5500 // TESTriggerLeaveEvent 0x012E5530 // TESUniqueIDChangeEvent 0x012E5560 // TESSwitchRaceCompleteEvent 0x012E55F0 // TESPlayerBowShotEvent 0x012E5410 EventDispatcher<BGSFootstepEvent>* g_footstepEventDispatcher = (EventDispatcher<BGSFootstepEvent>*) 0x01B2E9C0; // Story based events EventDispatcher<TESHarvestEvent::ItemHarvested>* g_harvestEventDispatcher = (EventDispatcher<TESHarvestEvent::ItemHarvested>*) 0x012E5A74; // Event ActorKill 0xDEADBEEF // Event ActorItemEquipped 0xDEADBEEF // Event Pickpocket 0xDEADBEEF // Event BooksRead 0xDEADBEEF EventDispatcher<LevelIncrease::Event>* g_levelIncreaseEventDispatcher = (EventDispatcher<LevelIncrease::Event>*) 0x01B39804; // Event SkillIncrease 0xDEADBEEF // Event WordLearned 0xDEADBEEF // Event WordUnlocked 0xDEADBEEF // Event Inventory 0xDEADBEEF // Event Bounty 0xDEADBEEF // Event QuestStatus 0xDEADBEEF // Event ObjectiveState 0xDEADBEEF // Event Trespass 0xDEADBEEF // Event FinePaid 0xDEADBEEF // Event HoursPassed 0xDEADBEEF // Event DaysPassed 0xDEADBEEF // Event DaysJailed 0xDEADBEEF // Event CriticalHitEvent 0xDEADBEEF // Event DisarmedEvent 0xDEADBEEF // Event ItemsPickpocketed 0xDEADBEEF // Event ItemSteal 0xDEADBEEF // Event ItemCrafted 0xDEADBEEF // Event LocationDiscovery 0xDEADBEEF // Event Jailing 0xDEADBEEF // Event ChestsLooted 0xDEADBEEF // Event TimesTrained 0xDEADBEEF // Event TimesBartered 0xDEADBEEF // Event ContractedDisease 0xDEADBEEF // Event SpellsLearned 0xDEADBEEF // Event DragonSoulGained 0xDEADBEEF // Event SoulGemsUsed 0xDEADBEEF // Event SoulsTrapped 0xDEADBEEF // Event PoisonedWeapon 0xDEADBEEF // Event ShoutAttack 0xDEADBEEF // Event JailEscape 0xDEADBEEF // Event GrandTheftHorse 0xDEADBEEF // Event AssaultCrime 0xDEADBEEF // Event MurderCrime 0xDEADBEEF // Event LocksPicked 0xDEADBEEF // Event LocationCleared 0xDEADBEEF // Event ShoutMastered 0xDEADBEEF
62.443299
139
0.517418
Schwarz-Hexe
4db2c93e2f3756702fca4065eb04355580b84e38
1,844
cpp
C++
POJ/10 - 13/poj1001.cpp
bilibiliShen/CodeBank
49a69b2b2c3603bf105140a9d924946ed3193457
[ "MIT" ]
1
2017-08-19T16:02:15.000Z
2017-08-19T16:02:15.000Z
POJ/10 - 13/poj1001.cpp
bilibiliShen/CodeBank
49a69b2b2c3603bf105140a9d924946ed3193457
[ "MIT" ]
null
null
null
POJ/10 - 13/poj1001.cpp
bilibiliShen/CodeBank
49a69b2b2c3603bf105140a9d924946ed3193457
[ "MIT" ]
1
2018-01-05T23:37:23.000Z
2018-01-05T23:37:23.000Z
#include <iostream> #include <cstdio> #include <string> #include <cstring> using namespace std; const int MaxL = 1000; int n, point, index; // n次幂。point代表小数点后有几位。 int si[MaxL], res[MaxL], tmp[MaxL], l; // si[MaxL]存s变成的整数,一位一位存 string s; void _toInt() // 让s变成一个整数串,并且记录下小数点后有几位 { point = 0; // 初始化point; index = 0; // si的下标变量 int l = s.length(); int i = l - 1, flag = 0; for (int j = 0; j <= i; j++) { if (s[j] == '0' && !index && !flag) /*除去前导0,前导0满足3个要求 1.为0 2.在.前面 3.在数前面*/ continue; if (s[j]=='.') { for (i = l - 1; s[i] == '0'; i--); // 除去后导0 flag = 1; continue; } if (flag) { si[index++] = s[j] - 48; point++; } else si[index++] = s[j] - 48; } } void print() { int k = point * n; if (l + 1 > k) { for (int i = 1; i <= l + 1; i++) { if (i == l + 1 - k + 1) cout << "."; cout << res[i - 1]; } } else{ cout << "."; for (int i = 0; i < k - l - 1; i++) cout << "0"; for (int i = 0; i <= l; i++) cout << res[i]; } cout << endl; } int main() { while (cin >> s >> n) { _toInt(); memcpy(res, si, sizeof(res)); l = index - 1; // 记录res的长度 int tsz; // 记录中间过程的下标 for (int tt = 0; tt < n - 1; tt++) // 进行n - 1次迭代 { memset(tmp, 0, sizeof(tmp)); // 把中间变量置为0 for (int i = index - 1; i >= 0; i--) // 对于si的每一位 { tsz = index - i - 2; // 要把这位的结果从这里开始放。模拟竖式乘法 for (int j = l; j >= 0; j--) // 乘以res中的每一位 { tsz++; tmp[tsz] += si[i] * res[j]; if (tmp[tsz] >= 10) { int k = tmp[tsz] / 10; tmp[tsz] %= 10; tmp[tsz + 1] += k; } } } tsz++; while (tmp[tsz] != 0) { if (tmp[tsz] >= 10) { int k = tmp[tsz] / 10; tmp[tsz] %= 10; tmp[tsz + 1] += k; } tsz++; } tsz--; if (tsz > l) l = tsz; for (int i = 0; i <= l; i++) res[i] = tmp[l - i]; } print(); } return 0; }
19.410526
63
0.453362
bilibiliShen
4db319e00a64a6d4c96bed55b70dea71b109e371
19,518
cxx
C++
main/svx/source/sidebar/graphic/GraphicPropertyPanel.cxx
Grosskopf/openoffice
93df6e8a695d5e3eac16f3ad5e9ade1b963ab8d7
[ "Apache-2.0" ]
679
2015-01-06T06:34:58.000Z
2022-03-30T01:06:03.000Z
main/svx/source/sidebar/graphic/GraphicPropertyPanel.cxx
Grosskopf/openoffice
93df6e8a695d5e3eac16f3ad5e9ade1b963ab8d7
[ "Apache-2.0" ]
102
2017-11-07T08:51:31.000Z
2022-03-17T12:13:49.000Z
main/svx/source/sidebar/graphic/GraphicPropertyPanel.cxx
Grosskopf/openoffice
93df6e8a695d5e3eac16f3ad5e9ade1b963ab8d7
[ "Apache-2.0" ]
331
2015-01-06T11:40:55.000Z
2022-03-14T04:07:51.000Z
/************************************************************** * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * *************************************************************/ #include <sfx2/sidebar/ResourceDefinitions.hrc> #include <sfx2/sidebar/Theme.hxx> #include <sfx2/sidebar/ControlFactory.hxx> #include <sfx2/sidebar/Layouter.hxx> #include <GraphicPropertyPanel.hxx> #include <GraphicPropertyPanel.hrc> #include <svx/dialogs.hrc> #include <svx/dialmgr.hxx> #include <vcl/field.hxx> #include <vcl/lstbox.hxx> #include <svl/intitem.hxx> #include <sfx2/bindings.hxx> #include <sfx2/dispatch.hxx> #include "svx/dialogs.hrc" using namespace css; using namespace cssu; using ::sfx2::sidebar::Layouter; using ::sfx2::sidebar::Theme; #define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString))) ////////////////////////////////////////////////////////////////////////////// namespace svx { namespace sidebar { ////////////////////////////////////////////////////////////////////////////// GraphicPropertyPanel::GraphicPropertyPanel( Window* pParent, const cssu::Reference<css::frame::XFrame>& rxFrame, SfxBindings* pBindings) : Control( pParent, SVX_RES(RID_SIDEBAR_GRAPHIC_PANEL)), mpFtBrightness(new FixedText(this, SVX_RES(FT_BRIGHTNESS))), mpMtrBrightness(new MetricField(this, SVX_RES(MTR_BRIGHTNESS))), mpFtContrast(new FixedText(this, SVX_RES(FT_CONTRAST))), mpMtrContrast(new MetricField(this, SVX_RES(MTR_CONTRAST))), mpFtColorMode(new FixedText(this, SVX_RES(FT_COLOR_MODE))), mpLBColorMode(new ListBox(this, SVX_RES(LB_COLOR_MODE))), mpFtTrans(new FixedText(this, SVX_RES(FT_TRANSPARENT))), mpMtrTrans(new MetricField(this, SVX_RES(MTR_TRANSPARENT))), mpMtrRed(new MetricField(this, SVX_RES(MF_RED))), mpMtrGreen(new MetricField(this, SVX_RES(MF_GREEN))), mpMtrBlue(new MetricField(this, SVX_RES(MF_BLUE))), mpMtrGamma(new MetricField(this, SVX_RES(MF_GAMMA))), maBrightControl(SID_ATTR_GRAF_LUMINANCE, *pBindings, *this), maContrastControl(SID_ATTR_GRAF_CONTRAST, *pBindings, *this), maTransparenceControl(SID_ATTR_GRAF_TRANSPARENCE, *pBindings, *this), maRedControl(SID_ATTR_GRAF_RED, *pBindings, *this), maGreenControl(SID_ATTR_GRAF_GREEN, *pBindings, *this), maBlueControl(SID_ATTR_GRAF_BLUE, *pBindings, *this), maGammaControl(SID_ATTR_GRAF_GAMMA, *pBindings, *this), maModeControl(SID_ATTR_GRAF_MODE, *pBindings, *this), maImgRed(this, SVX_RES(IMG_RED)), maImgGreen(this, SVX_RES(IMG_GREEN)), maImgBlue(this, SVX_RES(IMG_BLUE)), maImgGamma(this, SVX_RES(IMG_GAMMA)), mxFrame(rxFrame), mpBindings(pBindings), maLayouter(*this) { Initialize(); FreeResource(); // Setup the grid layouter. maLayouter.GetCell(0,0).SetControl(*mpFtBrightness).SetGridWidth(2); maLayouter.GetCell(1,0).SetControl(*mpMtrBrightness).SetGridWidth(2); maLayouter.GetCell(0,3).SetControl(*mpFtContrast).SetGridWidth(2); maLayouter.GetCell(1,3).SetControl(*mpMtrContrast).SetGridWidth(2); maLayouter.GetCell(2,0).SetControl(*mpFtColorMode).SetGridWidth(2); maLayouter.GetCell(3,0).SetControl(*mpLBColorMode).SetGridWidth(2); maLayouter.GetCell(2,3).SetControl(*mpFtTrans).SetGridWidth(2); maLayouter.GetCell(3,3).SetControl(*mpMtrTrans).SetGridWidth(2); maLayouter.GetCell(4,0).SetControl(maImgRed).SetFixedWidth(); maLayouter.GetCell(4,1).SetControl(*mpMtrRed); maLayouter.GetCell(5,0).SetControl(maImgBlue).SetFixedWidth(); maLayouter.GetCell(5,1).SetControl(*mpMtrBlue); maLayouter.GetCell(4,3).SetControl(maImgGreen).SetFixedWidth(); maLayouter.GetCell(4,4).SetControl(*mpMtrGreen); maLayouter.GetCell(5,3).SetControl(maImgGamma).SetFixedWidth(); maLayouter.GetCell(5,4).SetControl(*mpMtrGamma); maLayouter.GetColumn(0) .SetWeight(0) .SetLeftPadding(Layouter::MapWidth(*this,SECTIONPAGE_MARGIN_HORIZONTAL)); maLayouter.GetColumn(1) .SetWeight(1) .SetMinimumWidth(Layouter::MapWidth(*this, MBOX_WIDTH - 10)); maLayouter.GetColumn(2) .SetWeight(0) .SetMinimumWidth(Layouter::MapWidth(*this, CONTROL_SPACING_HORIZONTAL)); maLayouter.GetColumn(3) .SetWeight(0); maLayouter.GetColumn(4) .SetWeight(1) .SetMinimumWidth(Layouter::MapWidth(*this, MBOX_WIDTH - 10)) .SetRightPadding(Layouter::MapWidth(*this,SECTIONPAGE_MARGIN_HORIZONTAL)); // Make controls that display text handle short widths more // graceful. Layouter::PrepareForLayouting(*mpFtBrightness); Layouter::PrepareForLayouting(*mpFtContrast); Layouter::PrepareForLayouting(*mpFtColorMode); Layouter::PrepareForLayouting(*mpFtTrans); } ////////////////////////////////////////////////////////////////////////////// GraphicPropertyPanel::~GraphicPropertyPanel() { } ////////////////////////////////////////////////////////////////////////////// void GraphicPropertyPanel::Initialize() { mpFtBrightness->SetBackground(Wallpaper()); mpFtContrast->SetBackground(Wallpaper()); mpFtColorMode->SetBackground(Wallpaper()); mpFtTrans->SetBackground(Wallpaper()); mpMtrBrightness->SetModifyHdl( LINK( this, GraphicPropertyPanel, ModifyBrightnessHdl ) ); mpMtrBrightness->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Brightness"))); mpMtrContrast->SetModifyHdl( LINK( this, GraphicPropertyPanel, ModifyContrastHdl ) ); mpMtrContrast->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Contrast"))); mpMtrTrans->SetModifyHdl( LINK( this, GraphicPropertyPanel, ModifyTransHdl ) ); mpMtrTrans->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Transparency"))); mpLBColorMode->InsertEntry(String(SVX_RES(RID_SVXSTR_GRAFMODE_STANDARD))); mpLBColorMode->InsertEntry(String(SVX_RES(RID_SVXSTR_GRAFMODE_GREYS))); mpLBColorMode->InsertEntry(String(SVX_RES(RID_SVXSTR_GRAFMODE_MONO))); mpLBColorMode->InsertEntry(String(SVX_RES(RID_SVXSTR_GRAFMODE_WATERMARK))); mpLBColorMode->SetSelectHdl( LINK( this, GraphicPropertyPanel, ClickColorModeHdl )); mpLBColorMode->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Color mode"))); mpMtrRed->SetModifyHdl( LINK( this, GraphicPropertyPanel, RedHdl ) ); mpMtrGreen->SetModifyHdl( LINK( this, GraphicPropertyPanel, GreenHdl ) ); mpMtrBlue->SetModifyHdl( LINK( this, GraphicPropertyPanel, BlueHdl ) ); mpMtrGamma->SetModifyHdl( LINK( this, GraphicPropertyPanel, GammaHdl ) ); mpMtrRed->SetAccessibleName(mpMtrRed->GetQuickHelpText()); mpMtrGreen->SetAccessibleName(mpMtrGreen->GetQuickHelpText()); mpMtrBlue->SetAccessibleName(mpMtrBlue->GetQuickHelpText()); mpMtrGamma->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Gamma value"))); mpMtrRed->SetAccessibleRelationLabeledBy(mpMtrRed.get()); mpMtrGreen->SetAccessibleRelationLabeledBy(mpMtrGreen.get()); mpMtrBlue->SetAccessibleRelationLabeledBy(mpMtrBlue.get()); mpMtrGamma->SetAccessibleRelationLabeledBy(mpMtrGamma.get()); mpMtrBrightness->SetAccessibleRelationLabeledBy(mpFtBrightness.get()); mpMtrContrast->SetAccessibleRelationLabeledBy(mpFtContrast.get()); mpMtrTrans->SetAccessibleRelationLabeledBy(mpFtTrans.get()); mpLBColorMode->SetAccessibleRelationLabeledBy(mpFtColorMode.get()); // Fix left position of some controls that may be wrong due to // rounding errors. const sal_Int32 nRight0 (mpLBColorMode->GetPosPixel().X() + mpLBColorMode->GetSizePixel().Width()); const sal_Int32 nRight1 (mpMtrTrans->GetPosPixel().X() + mpMtrTrans->GetSizePixel().Width()); mpMtrRed->SetPosPixel(Point( nRight0 - mpMtrRed->GetSizePixel().Width(), mpMtrRed->GetPosPixel().Y())); mpMtrBlue->SetPosPixel(Point( nRight0 - mpMtrBlue->GetSizePixel().Width(), mpMtrBlue->GetPosPixel().Y())); mpMtrGreen->SetPosPixel(Point( nRight1 - mpMtrGreen->GetSizePixel().Width(), mpMtrGreen->GetPosPixel().Y())); mpMtrGamma->SetPosPixel(Point( nRight1 - mpMtrGamma->GetSizePixel().Width(), mpMtrGamma->GetPosPixel().Y())); } ////////////////////////////////////////////////////////////////////////////// IMPL_LINK( GraphicPropertyPanel, ModifyBrightnessHdl, void *, EMPTYARG ) { const sal_Int16 nBright = mpMtrBrightness->GetValue(); const SfxInt16Item aBrightItem( SID_ATTR_GRAF_LUMINANCE, nBright ); GetBindings()->GetDispatcher()->Execute(SID_ATTR_GRAF_LUMINANCE, SFX_CALLMODE_RECORD, &aBrightItem, 0L); return 0L; } ////////////////////////////////////////////////////////////////////////////// IMPL_LINK( GraphicPropertyPanel, ModifyContrastHdl, void *, EMPTYARG ) { const sal_Int16 nContrast = mpMtrContrast->GetValue(); const SfxInt16Item aContrastItem( SID_ATTR_GRAF_CONTRAST, nContrast ); GetBindings()->GetDispatcher()->Execute(SID_ATTR_GRAF_CONTRAST, SFX_CALLMODE_RECORD, &aContrastItem, 0L); return 0L; } ////////////////////////////////////////////////////////////////////////////// IMPL_LINK( GraphicPropertyPanel, ModifyTransHdl, void *, EMPTYARG ) { const sal_Int16 nTrans = mpMtrTrans->GetValue(); const SfxInt16Item aTransItem( SID_ATTR_GRAF_TRANSPARENCE, nTrans ); GetBindings()->GetDispatcher()->Execute(SID_ATTR_GRAF_TRANSPARENCE, SFX_CALLMODE_RECORD, &aTransItem, 0L); return 0L; } ////////////////////////////////////////////////////////////////////////////// IMPL_LINK( GraphicPropertyPanel, ClickColorModeHdl, ToolBox *, /* pBox */) { const sal_Int16 nTrans = mpLBColorMode->GetSelectEntryPos(); const SfxInt16Item aTransItem( SID_ATTR_GRAF_MODE, nTrans ); GetBindings()->GetDispatcher()->Execute(SID_ATTR_GRAF_MODE, SFX_CALLMODE_RECORD, &aTransItem, 0L); return 0L; } ////////////////////////////////////////////////////////////////////////////// IMPL_LINK( GraphicPropertyPanel, RedHdl, void*, EMPTYARG ) { const sal_Int16 nRed = mpMtrRed->GetValue(); const SfxInt16Item aRedItem( SID_ATTR_GRAF_RED, nRed ); GetBindings()->GetDispatcher()->Execute(SID_ATTR_GRAF_RED, SFX_CALLMODE_RECORD, &aRedItem, 0L); return 0L; } ////////////////////////////////////////////////////////////////////////////// IMPL_LINK( GraphicPropertyPanel, GreenHdl, void*, EMPTYARG ) { const sal_Int16 nGreen = mpMtrGreen->GetValue(); const SfxInt16Item aGreenItem( SID_ATTR_GRAF_GREEN, nGreen ); GetBindings()->GetDispatcher()->Execute(SID_ATTR_GRAF_GREEN, SFX_CALLMODE_RECORD, &aGreenItem, 0L); return 0L; } ////////////////////////////////////////////////////////////////////////////// IMPL_LINK(GraphicPropertyPanel, BlueHdl, void *, EMPTYARG) { const sal_Int16 nBlue = mpMtrBlue->GetValue(); const SfxInt16Item aBlueItem( SID_ATTR_GRAF_BLUE, nBlue ); GetBindings()->GetDispatcher()->Execute(SID_ATTR_GRAF_BLUE, SFX_CALLMODE_RECORD, &aBlueItem, 0L); return 0L; } ////////////////////////////////////////////////////////////////////////////// IMPL_LINK(GraphicPropertyPanel, GammaHdl, void *, EMPTYARG) { const sal_Int32 nGamma = mpMtrGamma->GetValue(); const SfxInt32Item nGammaItem( SID_ATTR_GRAF_GAMMA, nGamma ); GetBindings()->GetDispatcher()->Execute(SID_ATTR_GRAF_GAMMA, SFX_CALLMODE_RECORD, &nGammaItem, 0L); return 0L; } ////////////////////////////////////////////////////////////////////////////// void GraphicPropertyPanel::SetupIcons(void) { if(Theme::GetBoolean(Theme::Bool_UseSymphonyIcons)) { // todo } else { // todo } } ////////////////////////////////////////////////////////////////////////////// GraphicPropertyPanel* GraphicPropertyPanel::Create ( Window* pParent, const cssu::Reference<css::frame::XFrame>& rxFrame, SfxBindings* pBindings) { if (pParent == NULL) throw lang::IllegalArgumentException(A2S("no parent Window given to GraphicPropertyPanel::Create"), NULL, 0); if ( ! rxFrame.is()) throw lang::IllegalArgumentException(A2S("no XFrame given to GraphicPropertyPanel::Create"), NULL, 1); if (pBindings == NULL) throw lang::IllegalArgumentException(A2S("no SfxBindings given to GraphicPropertyPanel::Create"), NULL, 2); return new GraphicPropertyPanel( pParent, rxFrame, pBindings); } ////////////////////////////////////////////////////////////////////////////// void GraphicPropertyPanel::DataChanged( const DataChangedEvent& rEvent) { (void)rEvent; SetupIcons(); } ////////////////////////////////////////////////////////////////////////////// void GraphicPropertyPanel::NotifyItemUpdate( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState, const bool bIsEnabled) { (void)bIsEnabled; switch( nSID ) { case SID_ATTR_GRAF_LUMINANCE: { if(eState >= SFX_ITEM_AVAILABLE) { mpMtrBrightness->Enable(); const SfxInt16Item* pItem = dynamic_cast< const SfxInt16Item* >(pState); if(pItem) { const sal_Int64 nBright = pItem->GetValue(); mpMtrBrightness->SetValue(nBright); } } else if(SFX_ITEM_DISABLED == eState) { mpMtrBrightness->Disable(); } else { mpMtrBrightness->Enable(); mpMtrBrightness->SetText(String()); } break; } case SID_ATTR_GRAF_CONTRAST: { if(eState >= SFX_ITEM_AVAILABLE) { mpMtrContrast->Enable(); const SfxInt16Item* pItem = dynamic_cast< const SfxInt16Item* >(pState); if(pItem) { const sal_Int64 nContrast = pItem->GetValue(); mpMtrContrast->SetValue(nContrast); } } else if(SFX_ITEM_DISABLED == eState) { mpMtrContrast->Disable(); } else { mpMtrContrast->Enable(); mpMtrContrast->SetText(String()); } break; } case SID_ATTR_GRAF_TRANSPARENCE: { if(eState >= SFX_ITEM_AVAILABLE) { mpMtrTrans->Enable(); const SfxUInt16Item* pItem = dynamic_cast< const SfxUInt16Item* >(pState); if(pItem) { const sal_Int64 nTrans = pItem->GetValue(); mpMtrTrans->SetValue(nTrans); } } else if(SFX_ITEM_DISABLED == eState) { mpMtrTrans->Disable(); } else { mpMtrTrans->Enable(); mpMtrTrans->SetText(String()); } break; } case SID_ATTR_GRAF_MODE: { if(eState >= SFX_ITEM_AVAILABLE) { mpLBColorMode->Enable(); const SfxUInt16Item* pItem = dynamic_cast< const SfxUInt16Item* >(pState); if(pItem) { const sal_Int64 nTrans = pItem->GetValue(); mpLBColorMode->SelectEntryPos(nTrans); } } else if(SFX_ITEM_DISABLED == eState) { mpLBColorMode->Disable(); } else { mpLBColorMode->Enable(); mpLBColorMode->SetNoSelection(); } break; } case SID_ATTR_GRAF_RED: { if(eState >= SFX_ITEM_AVAILABLE) { mpMtrRed->Enable(); const SfxInt16Item* pItem = dynamic_cast< const SfxInt16Item* >(pState); if(pItem) { const sal_Int64 nRed = pItem->GetValue(); mpMtrRed->SetValue( nRed ); } } else if(SFX_ITEM_DISABLED == eState) { mpMtrRed->Disable(); } else { mpMtrRed->Enable(); mpMtrRed->SetText(String()); } break; } case SID_ATTR_GRAF_GREEN: { if(eState >= SFX_ITEM_AVAILABLE) { mpMtrGreen->Enable(); const SfxInt16Item* pItem = dynamic_cast< const SfxInt16Item* >(pState); if(pItem) { const sal_Int64 nGreen = pItem->GetValue(); mpMtrGreen->SetValue( nGreen ); } } else if(SFX_ITEM_DISABLED == eState) { mpMtrGreen->Disable(); } else { mpMtrGreen->Enable(); mpMtrGreen->SetText(String()); } break; } case SID_ATTR_GRAF_BLUE: { if(eState >= SFX_ITEM_AVAILABLE) { mpMtrBlue->Enable(); const SfxInt16Item* pItem = dynamic_cast< const SfxInt16Item* >(pState); if(pItem) { const sal_Int64 nBlue = pItem->GetValue(); mpMtrBlue->SetValue( nBlue ); } } else if(SFX_ITEM_DISABLED == eState) { mpMtrBlue->Disable(); } else { mpMtrBlue->Enable(); mpMtrBlue->SetText(String()); } break; } case SID_ATTR_GRAF_GAMMA: { if(eState >= SFX_ITEM_AVAILABLE) { mpMtrGamma->Enable(); const SfxUInt32Item* pItem = dynamic_cast< const SfxUInt32Item* >(pState); if(pItem) { const sal_Int64 nGamma = pItem->GetValue(); mpMtrGamma->SetValue( nGamma ); } } else if(SFX_ITEM_DISABLED == eState) { mpMtrGamma->Disable(); } else { mpMtrGamma->Enable(); mpMtrGamma->SetText(String()); } break; } } } SfxBindings* GraphicPropertyPanel::GetBindings() { return mpBindings; } void GraphicPropertyPanel::Resize (void) { maLayouter.Layout(); } }} // end of namespace ::svx::sidebar
35.167568
117
0.586587
Grosskopf
4db57cd9240af0e1895789bafc57cbdaf4aad307
8,566
cc
C++
src/application/stresstest/BlastTerminal.cc
nicmcd/slimsupersim
f73ce6b01fb7723e835665c55d45b8e582a6ba4e
[ "Apache-2.0" ]
null
null
null
src/application/stresstest/BlastTerminal.cc
nicmcd/slimsupersim
f73ce6b01fb7723e835665c55d45b8e582a6ba4e
[ "Apache-2.0" ]
null
null
null
src/application/stresstest/BlastTerminal.cc
nicmcd/slimsupersim
f73ce6b01fb7723e835665c55d45b8e582a6ba4e
[ "Apache-2.0" ]
null
null
null
/* * Copyright 2016 Hewlett Packard Enterprise Development LP * * 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 "application/stresstest/BlastTerminal.h" #include <mut/mut.h> #include <cassert> #include <cmath> #include "application/stresstest/Application.h" #include "network/Network.h" #include "stats/MessageLog.h" #include "types/Flit.h" #include "types/Packet.h" #include "traffic/TrafficPatternFactory.h" namespace StressTest { BlastTerminal::BlastTerminal(const std::string& _name, const Component* _parent, u32 _id, const std::vector<u32>& _address, ::Application* _app, Json::Value _settings) : ::Terminal(_name, _parent, _id, _address, _app), lastSendTime_(0) { // create a traffic pattern trafficPattern_ = TrafficPatternFactory::createTrafficPattern( "TrafficPattern", this, getApplication()->numTerminals(), getId(), _settings["traffic_pattern"]); // message quantity limition numMessages_ = _settings["num_messages"].asUInt(); remainingMessages_ = numMessages_; // message and packet sizes minMessageSize_ = _settings["min_message_size"].asUInt(); maxMessageSize_ = _settings["max_message_size"].asUInt(); maxPacketSize_ = _settings["max_packet_size"].asUInt(); // warmup/saturation detector warmupEnable_ = true; warmupInterval_ = _settings["warmup_interval"].asUInt(); assert(warmupInterval_ > 0); warmupFlitsReceived_ = 0; warmupWindow_ = _settings["warmup_window"].asUInt(); assert(warmupWindow_ >= 5); maxWarmupAttempts_ = _settings["warmup_attempts"].asUInt(); assert(maxWarmupAttempts_ > 0); warmupAttempts_ = 0; enrouteSamplePos_ = 0; fastFailSample_ = U32_MAX; // choose a random number of cycles in the future to start // make an event to start the BlastTerminal in the future u64 cycles = getApplication()->cyclesToSend(maxMessageSize_); cycles = gSim->rnd.nextU64(1, 1 + cycles); u64 time = gSim->futureCycle(1) + ((cycles - 1) * gSim->cycleTime()); dbgprintf("start time is %lu", time); addEvent(time, 0, nullptr, 0); // initialize the FSM enableLogging_ = false; enableSending_ = true; loggableEnteredCount_ = 0; loggableExitedCount_ = 0; } BlastTerminal::~BlastTerminal() { delete trafficPattern_; } void BlastTerminal::processEvent(void* _event, s32 _type) { sendNextMessage(); } void BlastTerminal::handleMessage(Message* _message) { // end the transaction endTransaction(_message->getTransaction()); delete _message; // don't need this anymore } void BlastTerminal::messageEnteredInterface(Message* _message) { if (messagesToLog_.count(_message->getId()) == 1) { loggableEnteredCount_++; dbgprintf("loggable entered network (%u of %u)", loggableEnteredCount_, numMessages_); } // determine if more messages should be created and sent if (enableSending_) { u64 now = gSim->time(); assert(lastSendTime_ <= now); if (now == lastSendTime_) { addEvent(gSim->futureCycle(1), 0, nullptr, 0); } else { sendNextMessage(); } } } void BlastTerminal::messageExitedNetwork(Message* _message) { // any override of this function must call the base class's function ::Terminal::messageExitedNetwork(_message); Application* app = reinterpret_cast<Application*>(getApplication()); // process for each warmup window if (warmupEnable_) { // count flits received warmupFlitsReceived_ += _message->numFlits(); if (warmupFlitsReceived_ >= warmupInterval_) { warmupFlitsReceived_ %= warmupInterval_; u32 msgs; u32 pkts; u32 flits; enrouteCount(&msgs, &pkts, &flits); dbgprintf("enroute: msgs=%u pkts=%u flits=%u", msgs, pkts, flits); // push this sample into the cyclic buffers if (enrouteSampleTimes_.size() < warmupWindow_) { enrouteSampleTimes_.push_back(gSim->cycle()); enrouteSampleValues_.push_back(flits); } else { enrouteSampleTimes_.at(enrouteSamplePos_) = gSim->time(); enrouteSampleValues_.at(enrouteSamplePos_) = flits; enrouteSamplePos_ = (enrouteSamplePos_ + 1) % warmupWindow_; } bool warmed = false; bool saturated = false; // run the fast fail logic for early saturation detection if (enrouteSampleTimes_.size() == warmupWindow_) { if (fastFailSample_ == U32_MAX) { fastFailSample_ = mut::arithmeticMean<u64>(enrouteSampleTimes_); } else if (flits > (fastFailSample_ * 3)) { printf("fast fail detected\n"); saturated = true; } } // after enough samples were taken, try to figure out network status using // a sliding window linear regression if (enrouteSampleTimes_.size() == warmupWindow_) { warmupAttempts_++; dbgprintf("warmup attempt %u of %u", warmupAttempts_, maxWarmupAttempts_); f64 growthRate = mut::slope<u64>(enrouteSampleTimes_, enrouteSampleValues_); dbgprintf("growthRate: %e", growthRate); if (growthRate <= 0.0) { warmed = true; } else if (warmupAttempts_ == maxWarmupAttempts_) { saturated = true; } } // react to warmed or saturated if (warmed) { // the network is warmed up dbgprintf("warmed"); app->terminalWarmed(getId()); warmupEnable_ = false; enrouteSampleTimes_.clear(); enrouteSampleValues_.clear(); } else if (saturated) { // the network is saturated dbgprintf("saturated"); app->terminalSaturated(getId()); warmupEnable_ = false; enrouteSampleTimes_.clear(); enrouteSampleValues_.clear(); } } } // log message if tagged u32 mId = _message->getId(); if (messagesToLog_.count(mId) == 1) { assert(enableLogging_); assert(messagesToLog_.erase(mId) == 1); // log the message app->getMessageLog()->logMessage(_message); loggableExitedCount_++; // detect when done if (loggableExitedCount_ == numMessages_) { assert(messagesToLog_.size() == 0); app->terminalComplete(getId()); } } } f64 BlastTerminal::percentComplete() const { if (!enableLogging_) { return 0.0; } else { return (f64)loggableExitedCount_ / (f64)numMessages_; } } void BlastTerminal::startLogging() { enableLogging_ = true; warmupEnable_ = false; } void BlastTerminal::stopSending() { enableSending_ = false; warmupEnable_ = false; enrouteSampleTimes_.clear(); enrouteSampleValues_.clear(); } void BlastTerminal::sendNextMessage() { u64 now = gSim->time(); lastSendTime_ = now; // pick a destination u32 destination = trafficPattern_->nextDestination(); assert(destination < getApplication()->numTerminals()); // pick a random message length u32 messageLength = gSim->rnd.nextU64(minMessageSize_, maxMessageSize_); u32 numPackets = messageLength / maxPacketSize_; if ((messageLength % maxPacketSize_) > 0) { numPackets++; } // create the message object Message* message = new Message(numPackets, nullptr); message->setTransaction(createTransaction()); // create the packets u32 flitsLeft = messageLength; for (u32 p = 0; p < numPackets; p++) { u32 packetLength = flitsLeft > maxPacketSize_ ? maxPacketSize_ : flitsLeft; Packet* packet = new Packet(p, packetLength, message); message->setPacket(p, packet); // create flits for (u32 f = 0; f < packetLength; f++) { bool headFlit = f == 0; bool tailFlit = f == (packetLength - 1); Flit* flit = new Flit(f, headFlit, tailFlit, packet); packet->setFlit(f, flit); } flitsLeft -= packetLength; } // send the message u32 msgId = sendMessage(message, destination); // determine if this message should be logged if ((enableLogging_) && (remainingMessages_ > 0)) { remainingMessages_--; messagesToLog_.insert(msgId); } } } // namespace StressTest
30.924188
80
0.670558
nicmcd
4db831c9c6d505e9a1efbfa95ca87ed1202550b0
410
cpp
C++
2012/day4/exam2.cpp
jasha64/jasha64
653881f0f79075a628f98857e77eac27aef1919d
[ "MIT" ]
null
null
null
2012/day4/exam2.cpp
jasha64/jasha64
653881f0f79075a628f98857e77eac27aef1919d
[ "MIT" ]
null
null
null
2012/day4/exam2.cpp
jasha64/jasha64
653881f0f79075a628f98857e77eac27aef1919d
[ "MIT" ]
1
2020-06-15T07:58:13.000Z
2020-06-15T07:58:13.000Z
#include<iostream> using namespace std; int main() { int wd; cin>>wd; if (wd==1) cout<<"Monday"<<endl; else if (wd==2) cout<<"Tuesday"<<endl; else if (wd==3) cout<<"Wednesday"<<endl; else if (wd==4) cout<<"Thursday"<<endl; else if (wd==5) cout<<"Friday"<<endl; else if (wd==6) cout<<"Satday"<<endl; else if (wd==7) cout<<"Sunday"<<endl; system("pause"); return 0; }
24.117647
44
0.560976
jasha64
4dbaef671c5ae9df84c6bc67b713e514c099acb9
5,061
cpp
C++
lib/AST/Stmt.cpp
jamboree/Sora
a75c96452857109e90ff61771991415d880b5b37
[ "MIT" ]
null
null
null
lib/AST/Stmt.cpp
jamboree/Sora
a75c96452857109e90ff61771991415d880b5b37
[ "MIT" ]
null
null
null
lib/AST/Stmt.cpp
jamboree/Sora
a75c96452857109e90ff61771991415d880b5b37
[ "MIT" ]
null
null
null
//===--- Stmt.cpp -----------------------------------------------*- C++ -*-===// // Part of the Sora project, licensed under the MIT license. // See LICENSE.txt in the project root for license information. // // Copyright (c) 2019 Pierre van Houtryve //===----------------------------------------------------------------------===// #include "Sora/AST/Stmt.hpp" #include "ASTNodeLoc.hpp" #include "Sora/AST/ASTContext.hpp" #include "Sora/AST/Decl.hpp" #include "Sora/AST/Expr.hpp" #include "llvm/ADT/ArrayRef.h" using namespace sora; /// Check that all statements are trivially destructible. This is needed /// because, as they are allocated in the ASTContext's arenas, their destructors /// are never called. #define STMT(ID, PARENT) \ static_assert(std::is_trivially_destructible<ID##Stmt>::value, \ #ID "Stmt is not trivially destructible."); #include "Sora/AST/StmtNodes.def" void *Stmt::operator new(size_t size, ASTContext &ctxt, unsigned align) { return ctxt.allocate(size, align, ArenaKind::Permanent); } SourceLoc Stmt::getBegLoc() const { switch (getKind()) { #define STMT(ID, PARENT) \ case StmtKind::ID: \ return ASTNodeLoc<Stmt, ID##Stmt>::getBegLoc(cast<ID##Stmt>(this)); #include "Sora/AST/StmtNodes.def" } llvm_unreachable("unknown StmtKind"); } SourceLoc Stmt::getEndLoc() const { switch (getKind()) { #define STMT(ID, PARENT) \ case StmtKind::ID: \ return ASTNodeLoc<Stmt, ID##Stmt>::getEndLoc(cast<ID##Stmt>(this)); #include "Sora/AST/StmtNodes.def" } llvm_unreachable("unknown StmtKind"); } SourceLoc Stmt::getLoc() const { switch (getKind()) { #define STMT(ID, PARENT) \ case StmtKind::ID: \ return ASTNodeLoc<Stmt, ID##Stmt>::getLoc(cast<ID##Stmt>(this)); #include "Sora/AST/StmtNodes.def" } llvm_unreachable("unknown StmtKind"); } SourceRange Stmt::getSourceRange() const { switch (getKind()) { #define STMT(ID, PARENT) \ case StmtKind::ID: \ return ASTNodeLoc<Stmt, ID##Stmt>::getSourceRange(cast<ID##Stmt>(this)); #include "Sora/AST/StmtNodes.def" } llvm_unreachable("unknown StmtKind"); } SourceLoc ReturnStmt::getBegLoc() const { return returnLoc; } SourceLoc ReturnStmt::getEndLoc() const { return result ? result->getEndLoc() : returnLoc; } SourceRange BlockStmtElement::getSourceRange() const { if (is<Expr *>()) return get<Expr *>()->getSourceRange(); if (is<Decl *>()) return get<Decl *>()->getSourceRange(); if (is<Stmt *>()) return get<Stmt *>()->getSourceRange(); llvm_unreachable("unknown node"); } SourceLoc BlockStmtElement::getBegLoc() const { if (is<Expr *>()) return get<Expr *>()->getBegLoc(); if (is<Decl *>()) return get<Decl *>()->getBegLoc(); if (is<Stmt *>()) return get<Stmt *>()->getBegLoc(); llvm_unreachable("unknown node"); } SourceLoc BlockStmtElement::getEndLoc() const { if (is<Expr *>()) return get<Expr *>()->getEndLoc(); if (is<Decl *>()) return get<Decl *>()->getEndLoc(); if (is<Stmt *>()) return get<Stmt *>()->getEndLoc(); llvm_unreachable("unknown node"); } BlockStmt::BlockStmt(SourceLoc lCurlyLoc, ArrayRef<BlockStmtElement> elts, SourceLoc rCurlyLoc) : Stmt(StmtKind::Block), lCurlyLoc(lCurlyLoc), rCurlyLoc(rCurlyLoc) { bits.BlockStmt.numElements = elts.size(); assert(getNumElements() == elts.size() && "Bits dropped"); std::uninitialized_copy(elts.begin(), elts.end(), getTrailingObjects<BlockStmtElement>()); } BlockStmt *BlockStmt::create(ASTContext &ctxt, SourceLoc lCurlyLoc, ArrayRef<BlockStmtElement> elts, SourceLoc rCurlyLoc) { auto size = totalSizeToAlloc<BlockStmtElement>(elts.size()); void *mem = ctxt.allocate(size, alignof(BlockStmt)); return new (mem) BlockStmt(lCurlyLoc, elts, rCurlyLoc); } BlockStmt *BlockStmt::createEmpty(ASTContext &ctxt, SourceLoc lCurlyLoc, SourceLoc rCurlyLoc) { return create(ctxt, lCurlyLoc, {}, rCurlyLoc); } SourceLoc StmtCondition::getBegLoc() const { switch (getKind()) { case StmtConditionKind::Expr: return getExpr()->getBegLoc(); case StmtConditionKind::LetDecl: return getLetDecl()->getBegLoc(); } llvm_unreachable("unknown condition kind"); } SourceLoc StmtCondition::getEndLoc() const { switch (getKind()) { case StmtConditionKind::Expr: return getExpr()->getEndLoc(); case StmtConditionKind::LetDecl: return getLetDecl()->getEndLoc(); } llvm_unreachable("unknown condition kind"); }
34.903448
80
0.586248
jamboree
4dbc52d42548a04dc5decb6e930c34eaa808b735
11,769
cpp
C++
uuv_assistants/src/message_to_tf.cpp
oKermorgant/Plankton
ce21579792122b05d27f147ab66f515001ccb733
[ "Apache-2.0", "BSD-3-Clause" ]
79
2020-09-30T22:19:07.000Z
2022-03-27T12:30:58.000Z
uuv_assistants/src/message_to_tf.cpp
oKermorgant/Plankton
ce21579792122b05d27f147ab66f515001ccb733
[ "Apache-2.0", "BSD-3-Clause" ]
17
2020-10-05T01:01:49.000Z
2022-03-04T13:58:53.000Z
uuv_assistants/src/message_to_tf.cpp
oKermorgant/Plankton
ce21579792122b05d27f147ab66f515001ccb733
[ "Apache-2.0", "BSD-3-Clause" ]
22
2020-10-27T14:42:48.000Z
2022-03-25T10:41:51.000Z
// Copyright (c) 2020 The Plankton Authors. // All rights reserved. // // This source code is derived from UUV Simulator // (https://github.com/uuvsimulator/uuv_simulator) // Copyright (c) 2016-2019 The UUV Simulator Authors // licensed under the Apache license, Version 2.0 // cf. 3rd-party-licenses.txt file in the root directory of this source tree. // // 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. // // This source code is derived from hector_localization // (https://github.com/tu-darmstadt-ros-pkg/hector_localization) // Copyright (c) 2012, Johannes Meyer, TU Darmstadt, // licensed under the BSD 3-Clause license, // cf. 3rd-party-licenses.txt file in the root directory of this source tree. // // The original code was modified to: // - be more consistent with other sensor plugins within uuv_simulator, // - adhere to Gazebo's coding standards. #include "rclcpp/rclcpp.hpp" #include <nav_msgs/msg/odometry.hpp> #include <geometry_msgs/msg/pose_stamped.hpp> #include <geometry_msgs/msg/vector3_stamped.hpp> #include <geometry_msgs/msg/transform_stamped.hpp> #include <sensor_msgs/msg/imu.hpp> #include <tf2/LinearMath/Transform.h> #include <tf2_ros/transform_broadcaster.h> #include <tf2_geometry_msgs/tf2_geometry_msgs.h> std::string g_odometry_topic; std::string g_pose_topic; std::string g_imu_topic; std::string g_topic; std::string g_frame_id; std::string g_footprint_frame_id; std::string g_position_frame_id; std::string g_stabilized_frame_id; std::string g_child_frame_id; bool g_publish_roll_pitch; std::string g_tf_prefix; tf2_ros::TransformBroadcaster *g_transform_broadcaster; //revert to not static version rclcpp::Publisher<geometry_msgs::msg::PoseStamped>::SharedPtr g_pose_publisher; rclcpp::Publisher<geometry_msgs::msg::Vector3Stamped>::SharedPtr g_euler_publisher; #ifndef TF2_MATRIX3x3_H typedef btScalar tfScalar; namespace tf { typedef btMatrix3x3 Matrix3x3; } #endif void addTransform(std::vector<geometry_msgs::msg::TransformStamped>& transforms, const tf2::Stamped<tf2::Transform>& tf, std::string child_frame_id) { // Might work. Might not. It probably do work though. auto new_msg = tf2::toMsg(tf); new_msg.child_frame_id = child_frame_id; transforms.push_back(new_msg); } namespace tf2 { //Specialization for Point msg static inline void fromMsg(const geometry_msgs::msg::Point& msgIn, tf2::Vector3& out) { out = Vector3(msgIn.x, msgIn.y, msgIn.z); } } std::string stripSlash(const std::string & in) { if (in.size() && in[0] == '/') { return in.substr(1); } return in; } void sendTransform(geometry_msgs::msg::Pose const &pose, const std_msgs::msg::Header& header, std::string child_frame_id = "") { std::vector<geometry_msgs::msg::TransformStamped> transforms; tf2::Stamped<tf2::Transform> tf; auto time_stamp = header.stamp; // Manual conversion tf.stamp_ = tf2::TimePoint( std::chrono::seconds(time_stamp.sec) + std::chrono::nanoseconds(time_stamp.nanosec)); tf.frame_id_ = header.frame_id; if (!g_frame_id.empty()) tf.frame_id_ = g_frame_id; // No idea what I'm doing tf.frame_id_ = stripSlash(tf.frame_id_); if (!g_child_frame_id.empty()) child_frame_id = g_child_frame_id; if (child_frame_id.empty()) child_frame_id = "base_link"; tf2::Quaternion orientation; tf2::fromMsg(pose.orientation, orientation); tf2Scalar yaw, pitch, roll; tf2::Matrix3x3(orientation).getEulerYPR(yaw, pitch, roll); tf2::Vector3 position; tf2::fromMsg(pose.position, position); // position intermediate transform (x,y,z) if( !g_position_frame_id.empty() && child_frame_id != g_position_frame_id) { tf.setOrigin(tf2::Vector3(position.x(), position.y(), position.z() )); tf.setRotation(tf2::Quaternion(0.0, 0.0, 0.0, 1.0)); addTransform(transforms, tf, stripSlash(g_position_frame_id)); } // footprint intermediate transform (x,y,yaw) if (!g_footprint_frame_id.empty() && child_frame_id != g_footprint_frame_id) { tf.setOrigin(tf2::Vector3(position.x(), position.y(), 0.0)); tf2::Quaternion quat; quat.setRPY(0.0, 0.0, yaw); tf.setRotation(quat); addTransform(transforms, tf, stripSlash(g_footprint_frame_id)); yaw = 0.0; position.setX(0.0); position.setY(0.0); tf.frame_id_ = stripSlash(g_footprint_frame_id); } // stabilized intermediate transform (z) if (!g_footprint_frame_id.empty() && child_frame_id != g_stabilized_frame_id) { tf.setOrigin(tf2::Vector3(0.0, 0.0, position.z())); tf.setBasis(tf2::Matrix3x3::getIdentity()); addTransform(transforms, tf, stripSlash(g_stabilized_frame_id)); position.setZ(0.0); tf.frame_id_ = stripSlash(g_stabilized_frame_id); } // base_link transform (roll, pitch) if (g_publish_roll_pitch) { tf.setOrigin(position); tf2::Quaternion quat; quat.setRPY(roll, pitch, yaw); tf.setRotation(quat); addTransform(transforms, tf, stripSlash(child_frame_id)); } g_transform_broadcaster->sendTransform(transforms); // publish pose message if (g_pose_publisher) { geometry_msgs::msg::PoseStamped pose_stamped; pose_stamped.pose = pose; pose_stamped.header = header; g_pose_publisher->publish(pose_stamped); } // publish pose message if (g_euler_publisher) { geometry_msgs::msg::Vector3Stamped euler_stamped; euler_stamped.vector.x = roll; euler_stamped.vector.y = pitch; euler_stamped.vector.z = yaw; euler_stamped.header = header; g_euler_publisher->publish(euler_stamped); } } void odomCallback(nav_msgs::msg::Odometry::SharedPtr odometry) { sendTransform(odometry->pose.pose, odometry->header, odometry->child_frame_id); } void poseCallback(geometry_msgs::msg::PoseStamped::SharedPtr pose) { sendTransform(pose->pose, pose->header); } void tfCallback(geometry_msgs::msg::TransformStamped::SharedPtr tf) { geometry_msgs::msg::Pose pose; pose.position.x = tf->transform.translation.x; pose.position.y = tf->transform.translation.y; pose.position.z = tf->transform.translation.z; pose.orientation = tf->transform.rotation; sendTransform(pose, tf->header); } void imuCallback(sensor_msgs::msg::Imu::SharedPtr imu) { std::vector<geometry_msgs::msg::TransformStamped> transforms; std::string child_frame_id; tf2::Stamped<tf2::Transform> tf; // TODO auto time_stamp = imu->header.stamp; tf.stamp_ = tf2::TimePoint( std::chrono::seconds(time_stamp.sec) + std::chrono::nanoseconds(time_stamp.nanosec)); tf.frame_id_ = stripSlash(g_stabilized_frame_id); if (!g_child_frame_id.empty()) child_frame_id = g_child_frame_id; if (child_frame_id.empty()) child_frame_id = "base_link"; tf2::Quaternion orientation; tf2::fromMsg(imu->orientation, orientation); tf2Scalar yaw, pitch, roll; tf2::Matrix3x3(orientation).getEulerYPR(yaw, pitch, roll); tf2::Quaternion rollpitch; rollpitch.setRPY(roll, pitch, 0.0); // base_link transform (roll, pitch) if (g_publish_roll_pitch) { tf.setOrigin(tf2::Vector3(0.0, 0.0, 0.0)); tf.setRotation(rollpitch); addTransform(transforms, tf, stripSlash(child_frame_id)); } if (!transforms.empty()) g_transform_broadcaster->sendTransform(transforms); // publish pose message if (g_pose_publisher) { geometry_msgs::msg::PoseStamped pose_stamped; pose_stamped.header.stamp = imu->header.stamp; pose_stamped.header.frame_id = g_stabilized_frame_id; pose_stamped.pose.orientation = tf2::toMsg(rollpitch); g_pose_publisher->publish(pose_stamped); } } // Disabled multicallback as this is not seemingly possible easily with ros2 int main(int argc, char** argv) { //Use init_and_remove_arguments instead of init to remove cmd line args rclcpp::init(argc, argv); //Add node options to auto declare parameters from launch files and cmd line auto node = rclcpp::Node::make_shared("message_to_tf", rclcpp::NodeOptions().allow_undeclared_parameters(true). automatically_declare_parameters_from_overrides(true) ); g_footprint_frame_id = "base_footprint"; g_stabilized_frame_id = "base_stabilized"; // g_position_frame_id = "base_position"; // g_child_frame_id = "base_link"; node->get_parameter("odometry_topic", g_odometry_topic); node->get_parameter("pose_topic", g_pose_topic); node->get_parameter("imu_topic", g_imu_topic); //node->get_parameter("topic", g_topic); // Not possible anymore node->get_parameter("frame_id", g_frame_id); node->get_parameter("footprint_frame_id", g_footprint_frame_id); node->get_parameter("position_frame_id", g_position_frame_id); node->get_parameter("stabilized_frame_id", g_stabilized_frame_id); node->get_parameter("child_frame_id", g_child_frame_id); g_publish_roll_pitch = true; node->get_parameter("publish_roll_pitch", g_publish_roll_pitch); g_transform_broadcaster = new tf2_ros::TransformBroadcaster(node); // TODO Check rclcpp::Subscription<nav_msgs::msg::Odometry>::SharedPtr sub1; rclcpp::Subscription<geometry_msgs::msg::PoseStamped>::SharedPtr sub2; rclcpp::Subscription<sensor_msgs::msg::Imu>::SharedPtr sub3; int subscribers = 0; if (!g_odometry_topic.empty()) { sub1 = node->create_subscription<nav_msgs::msg::Odometry>(g_odometry_topic, 10, &odomCallback); subscribers++; } if (!g_pose_topic.empty()) { sub2 = node->create_subscription<geometry_msgs::msg::PoseStamped>(g_pose_topic, 10, &poseCallback); subscribers++; } if (!g_imu_topic.empty()) { sub3 = node->create_subscription<sensor_msgs::msg::Imu>(g_imu_topic, 10, &imuCallback); subscribers++; } if (!g_topic.empty()) { // RCLCPP_FATAL(node->get_logger(), "Multicallbacks from ROS 1 not yet implemented"); //sub4 = node.subscribe(g_topic, 10, &multiCallback); subscribers++; } if (subscribers == 0) { RCLCPP_FATAL(node->get_logger(), "Usage: rosrun message_to_tf message_to_tf <topic>"); return 1; } else if (subscribers > 1) { RCLCPP_FATAL(node->get_logger(), "More than one of the parameters odometry_topic, pose_topic, imu_topic and topic are set.\n" "Please specify exactly one of them or simply add the topic name to the command line."); return 1; } bool publish_pose = true; node->get_parameter("publish_pose", publish_pose); if (publish_pose) { std::string publish_pose_topic; node->get_parameter("publish_pose_topic", publish_pose_topic); if (!publish_pose_topic.empty()) g_pose_publisher = node->create_publisher<geometry_msgs::msg::PoseStamped>(publish_pose_topic, 10); else g_pose_publisher = node->create_publisher<geometry_msgs::msg::PoseStamped>("~/pose", 10); } bool publish_euler = true; node->get_parameter("publish_euler", publish_euler); if (publish_euler) { std::string publish_euler_topic; node->get_parameter("publish_euler_topic", publish_euler_topic); if (!publish_euler_topic.empty()) g_euler_publisher = node->create_publisher<geometry_msgs::msg::Vector3Stamped>(publish_euler_topic, 10); else g_euler_publisher = node->create_publisher<geometry_msgs::msg::Vector3Stamped>("~/euler", 10); } rclcpp::spin(node); delete g_transform_broadcaster; rclcpp::shutdown(); return 0; }
35.026786
148
0.729799
oKermorgant
4dbc7e2c54ee15fdcc13bd611c177fae31bcc842
931
hpp
C++
SDK/ARKSurvivalEvolved_SpiderL_Character_BP_Medium_parameters.hpp
2bite/ARK-SDK
c38ca9925309516b2093ad8c3a70ed9489e1d573
[ "MIT" ]
10
2020-02-17T19:08:46.000Z
2021-07-31T11:07:19.000Z
SDK/ARKSurvivalEvolved_SpiderL_Character_BP_Medium_parameters.hpp
2bite/ARK-SDK
c38ca9925309516b2093ad8c3a70ed9489e1d573
[ "MIT" ]
9
2020-02-17T18:15:41.000Z
2021-06-06T19:17:34.000Z
SDK/ARKSurvivalEvolved_SpiderL_Character_BP_Medium_parameters.hpp
2bite/ARK-SDK
c38ca9925309516b2093ad8c3a70ed9489e1d573
[ "MIT" ]
3
2020-07-22T17:42:07.000Z
2021-06-19T17:16:13.000Z
#pragma once // ARKSurvivalEvolved (329.9) SDK #ifdef _MSC_VER #pragma pack(push, 0x8) #endif #include "ARKSurvivalEvolved_SpiderL_Character_BP_Medium_classes.hpp" namespace sdk { //--------------------------------------------------------------------------- //Parameters //--------------------------------------------------------------------------- // Function SpiderL_Character_BP_Medium.SpiderL_Character_BP_Medium_C.UserConstructionScript struct ASpiderL_Character_BP_Medium_C_UserConstructionScript_Params { }; // Function SpiderL_Character_BP_Medium.SpiderL_Character_BP_Medium_C.ExecuteUbergraph_SpiderL_Character_BP_Medium struct ASpiderL_Character_BP_Medium_C_ExecuteUbergraph_SpiderL_Character_BP_Medium_Params { int EntryPoint; // (Parm, ZeroConstructor, IsPlainOldData) }; } #ifdef _MSC_VER #pragma pack(pop) #endif
28.212121
152
0.62406
2bite
4dc0bf2ad998aef2dc265069a24a59052750f211
1,279
cpp
C++
test/doc/math/geommean.cpp
the-moisrex/eve
80b52663eefee11460abb0aedf4158a5067cf7dc
[ "MIT" ]
340
2020-09-16T21:12:48.000Z
2022-03-28T15:40:33.000Z
test/doc/math/geommean.cpp
the-moisrex/eve
80b52663eefee11460abb0aedf4158a5067cf7dc
[ "MIT" ]
383
2020-09-17T06:56:35.000Z
2022-03-13T15:58:53.000Z
test/doc/math/geommean.cpp
the-moisrex/eve
80b52663eefee11460abb0aedf4158a5067cf7dc
[ "MIT" ]
28
2021-02-27T23:11:23.000Z
2022-03-25T12:31:29.000Z
//#include <eve/function/geommean.hpp> #include <eve/module/math.hpp> #include <eve/literals.hpp> #include <eve/wide.hpp> #include <vector> #include <iostream> int main() { using w_t = eve::wide<double, eve::fixed<4>>; w_t pi = {3, 2, 3, -3}, qi = {4, 2, 1, -100}; std::cout << "---- simd" << '\n' << " <- pi = " << pi << '\n' << " <- qi = " << qi << '\n' << " -> geommean(pi, qi) = " << eve::geommean(pi, qi) << '\n'; float xi = 3, yi = 4; std::cout << "---- scalar" << '\n' << " xi = " << xi << '\n' << " yi = " << yi << '\n' << " -> geommean(xi, yi) = " << eve::geommean(xi, yi) << '\n'; w_t pf = {3, 1, -3, -10}, qf = {4, 1, 1, 15};; std::cout << "---- multi" << '\n' << " <- pf = " << pf << '\n' << " <- qf = " << qf << '\n' << " -> geommean(1.0f, qf, pf, 32.0f) = " << eve::geommean(1.0f, qf, pf, 32.0f) << '\n' << " -> geommean(1.0f, qf, pf, 32.0f) = " << eve::geommean(1.0f, qf, pf, 32.0f) << '\n' << " -> geommean(-1.0f, qf, pf) = " << eve::geommean(-1.0f, qf, pf) << '\n'; return 0; }
36.542857
101
0.351837
the-moisrex
4dc15a0f79e0439877e50c88b073d29b408d3ebb
2,458
cpp
C++
src/RcppExports.cpp
rdinnager/rbff
899e4f32558c82e180ecd79df247f1c8e5e92308
[ "MIT" ]
4
2021-08-18T04:33:42.000Z
2021-12-30T02:06:07.000Z
src/RcppExports.cpp
rdinnager/rbff
899e4f32558c82e180ecd79df247f1c8e5e92308
[ "MIT" ]
7
2021-09-21T17:38:21.000Z
2022-01-11T14:54:54.000Z
src/RcppExports.cpp
rdinnager/rbff
899e4f32558c82e180ecd79df247f1c8e5e92308
[ "MIT" ]
3
2021-09-09T20:43:55.000Z
2021-12-29T23:17:04.000Z
// Generated by using Rcpp::compileAttributes() -> do not edit by hand // Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393 #include <Rcpp.h> using namespace Rcpp; #ifdef RCPP_USE_GLOBAL_ROSTREAM Rcpp::Rostream<true>& Rcpp::Rcout = Rcpp::Rcpp_cout_get(); Rcpp::Rostream<false>& Rcpp::Rcerr = Rcpp::Rcpp_cerr_get(); #endif // auto_flatten void auto_flatten(const std::string& inputPath, int nCones, bool flattenToDisk, bool mapToSphere, bool normalizeUVs, const std::string& outputPath); RcppExport SEXP _rbff_auto_flatten(SEXP inputPathSEXP, SEXP nConesSEXP, SEXP flattenToDiskSEXP, SEXP mapToSphereSEXP, SEXP normalizeUVsSEXP, SEXP outputPathSEXP) { BEGIN_RCPP Rcpp::RNGScope rcpp_rngScope_gen; Rcpp::traits::input_parameter< const std::string& >::type inputPath(inputPathSEXP); Rcpp::traits::input_parameter< int >::type nCones(nConesSEXP); Rcpp::traits::input_parameter< bool >::type flattenToDisk(flattenToDiskSEXP); Rcpp::traits::input_parameter< bool >::type mapToSphere(mapToSphereSEXP); Rcpp::traits::input_parameter< bool >::type normalizeUVs(normalizeUVsSEXP); Rcpp::traits::input_parameter< const std::string& >::type outputPath(outputPathSEXP); auto_flatten(inputPath, nCones, flattenToDisk, mapToSphere, normalizeUVs, outputPath); return R_NilValue; END_RCPP } // flatten_to_shape void flatten_to_shape(const std::string& inputPath, NumericMatrix boundary_shape, bool normalizeUVs, const std::string& outputPath); RcppExport SEXP _rbff_flatten_to_shape(SEXP inputPathSEXP, SEXP boundary_shapeSEXP, SEXP normalizeUVsSEXP, SEXP outputPathSEXP) { BEGIN_RCPP Rcpp::RNGScope rcpp_rngScope_gen; Rcpp::traits::input_parameter< const std::string& >::type inputPath(inputPathSEXP); Rcpp::traits::input_parameter< NumericMatrix >::type boundary_shape(boundary_shapeSEXP); Rcpp::traits::input_parameter< bool >::type normalizeUVs(normalizeUVsSEXP); Rcpp::traits::input_parameter< const std::string& >::type outputPath(outputPathSEXP); flatten_to_shape(inputPath, boundary_shape, normalizeUVs, outputPath); return R_NilValue; END_RCPP } static const R_CallMethodDef CallEntries[] = { {"_rbff_auto_flatten", (DL_FUNC) &_rbff_auto_flatten, 6}, {"_rbff_flatten_to_shape", (DL_FUNC) &_rbff_flatten_to_shape, 4}, {NULL, NULL, 0} }; RcppExport void R_init_rbff(DllInfo *dll) { R_registerRoutines(dll, NULL, CallEntries, NULL, NULL); R_useDynamicSymbols(dll, FALSE); }
47.269231
163
0.771766
rdinnager
4dc3e113d59467dae5f14e3acbd211f36d0677d0
634
hpp
C++
services/interactive_python/jupyter/display_publisher.hpp
jinntechio/RocketJoe
9b08a21fda1609c57b40ef8b9750897797ac815b
[ "BSD-3-Clause" ]
9
2020-07-20T15:32:07.000Z
2021-06-04T13:02:58.000Z
services/interactive_python/jupyter/display_publisher.hpp
jinntechio/RocketJoe
9b08a21fda1609c57b40ef8b9750897797ac815b
[ "BSD-3-Clause" ]
26
2019-10-27T12:58:42.000Z
2020-05-30T16:43:48.000Z
services/interactive_python/jupyter/display_publisher.hpp
jinntechio/RocketJoe
9b08a21fda1609c57b40ef8b9750897797ac815b
[ "BSD-3-Clause" ]
3
2020-08-29T07:07:49.000Z
2021-06-04T13:02:59.000Z
#pragma once #include <pybind11/embed.h> #include <pybind11/functional.h> #include <pybind11/pybind11.h> #include <pybind11/stl.h> namespace services { namespace interactive_python { namespace jupyter { namespace py = pybind11; class display_publisher final { public: static auto set_parent(py::object self, py::dict parent) -> void; static auto publish(py::object self, py::dict data, py::dict metadata, py::str source, py::dict trasistent, py::bool_ update) -> void; static auto clear_output(py::object self, py::bool_ wait = false) -> void; }; }}}
26.416667
82
0.648265
jinntechio
4dca20639345e2fb09e2ae2ac76726892aa651ab
5,493
cpp
C++
src/lib/foundations/geometry/decomposition.cpp
abetten/orbiter
5994d0868a26c37676d6aadfc66a1f1bcb715c4b
[ "RSA-MD" ]
15
2016-10-27T15:18:28.000Z
2022-02-09T11:13:07.000Z
src/lib/foundations/geometry/decomposition.cpp
abetten/orbiter
5994d0868a26c37676d6aadfc66a1f1bcb715c4b
[ "RSA-MD" ]
4
2019-12-09T11:49:11.000Z
2020-07-30T17:34:45.000Z
src/lib/foundations/geometry/decomposition.cpp
abetten/orbiter
5994d0868a26c37676d6aadfc66a1f1bcb715c4b
[ "RSA-MD" ]
15
2016-06-10T20:05:30.000Z
2020-12-18T04:59:19.000Z
// decomposition.cpp // // Anton Betten // // December 1, 2012 #include "foundations.h" using namespace std; namespace orbiter { namespace foundations { decomposition::decomposition() { null(); } decomposition::~decomposition() { freeself(); } void decomposition::null() { Inc = 0; I = 0; Stack = NULL; f_has_decomposition = FALSE; f_has_row_scheme = FALSE; f_has_col_scheme = FALSE; } void decomposition::freeself() { if (Inc) { FREE_int(Inc); } if (I) { FREE_OBJECT(I); } if (Stack) { FREE_OBJECT(Stack); } if (f_has_decomposition) { FREE_int(row_classes); FREE_int(row_class_inv); FREE_int(col_classes); FREE_int(col_class_inv); } if (f_has_row_scheme) { FREE_int(row_scheme); } if (f_has_col_scheme) { FREE_int(col_scheme); } null(); } void decomposition::init_inc_and_stack( incidence_structure *Inc, partitionstack *Stack, int verbose_level) { int f_v = (verbose_level >= 1); if (f_v) { cout << "decomposition::init_inc_and_stack" << endl; } nb_points = Inc->nb_rows; nb_blocks = Inc->nb_cols; I = Inc; decomposition::Stack = Stack; if (f_v) { cout << "decomposition::init_inc_and_stack done" << endl; } } void decomposition::init_incidence_matrix( int m, int n, int *M, int verbose_level) // copies the incidence matrix { int f_v = (verbose_level >= 1); int i; if (f_v) { cout << "decomposition::init_incidence_matrix" << endl; } nb_points = m; nb_blocks = n; Inc = NEW_int(nb_points * nb_blocks); for (i = 0; i < nb_points * nb_blocks; i++) { Inc[i] = M[i]; } } void decomposition::setup_default_partition(int verbose_level) { int f_v = (verbose_level >= 1); if (f_v) { cout << "decomposition::setup_default_partition" << endl; } I = NEW_OBJECT(incidence_structure); if (f_v) { cout << "decomposition::setup_default_partition " "before I->init_by_matrix" << endl; } I->init_by_matrix(nb_points, nb_blocks, Inc, 0 /* verbose_level */); if (f_v) { cout << "decomposition::setup_default_partition " "after I->init_by_matrix" << endl; } Stack = NEW_OBJECT(partitionstack); Stack->allocate(nb_points + nb_blocks, 0 /* verbose_level */); Stack->subset_continguous(nb_points, nb_blocks); Stack->split_cell(0 /* verbose_level */); Stack->sort_cells(); if (f_v) { cout << "decomposition::setup_default_partition done" << endl; } } void decomposition::compute_TDO(int max_depth, int verbose_level) // put max_depth = INT_MAX if you want full depth { int f_v = (verbose_level >= 1); //int depth = INT_MAX; if (f_v) { cout << "decomposition::compute_TDO" << endl; } if (f_v) { cout << "decomposition::compute_TDO " "before I->compute_TDO_safe" << endl; } I->compute_TDO_safe(*Stack, max_depth, verbose_level /*- 2 */); if (f_v) { cout << "decomposition::compute_TDO " "after I->compute_TDO_safe" << endl; } Stack->allocate_and_get_decomposition( row_classes, row_class_inv, nb_row_classes, col_classes, col_class_inv, nb_col_classes, 0); f_has_decomposition = TRUE; if (f_v) { cout << "decomposition::compute_TDO done" << endl; } } void decomposition::get_row_scheme(int verbose_level) { int f_v = (verbose_level >= 1); if (f_v) { cout << "decomposition::get_row_scheme" << endl; } if (!f_has_decomposition) { cout << "decomposition::get_row_scheme " "!f_has_decomposition" << endl; exit(1); } f_has_row_scheme = TRUE; row_scheme = NEW_int(nb_row_classes * nb_col_classes); I->get_row_decomposition_scheme(*Stack, row_classes, row_class_inv, nb_row_classes, col_classes, col_class_inv, nb_col_classes, row_scheme, 0); if (f_v) { cout << "decomposition::get_row_scheme done" << endl; } } void decomposition::get_col_scheme(int verbose_level) { int f_v = (verbose_level >= 1); if (f_v) { cout << "decomposition::get_col_scheme" << endl; } if (!f_has_decomposition) { cout << "decomposition::get_col_scheme " "!f_has_decomposition" << endl; exit(1); } f_has_col_scheme = TRUE; col_scheme = NEW_int(nb_row_classes * nb_col_classes); I->get_col_decomposition_scheme(*Stack, row_classes, row_class_inv, nb_row_classes, col_classes, col_class_inv, nb_col_classes, col_scheme, 0); if (f_v) { cout << "decomposition::get_col_scheme done" << endl; } } void decomposition::print_row_decomposition_tex( ostream &ost, int f_enter_math, int f_print_subscripts, int verbose_level) { int f_v = (verbose_level >= 1); if (f_v) { cout << "decomposition::print_row_decomposition_tex" << endl; } if (!f_has_row_scheme) { cout << "decomposition::print_row_decomposition_tex " "!f_has_row_scheme" << endl; exit(1); } //I->get_and_print_row_tactical_decomposition_scheme_tex( // file, FALSE /* f_enter_math */, *Stack); Stack->print_row_tactical_decomposition_scheme_tex( ost, f_enter_math, row_classes, nb_row_classes, col_classes, nb_col_classes, row_scheme, f_print_subscripts); } void decomposition::print_column_decomposition_tex( ostream &ost, int f_enter_math, int f_print_subscripts, int verbose_level) { int f_v = (verbose_level >= 1); if (f_v) { cout << "decomposition::print_column_decomposition_tex" << endl; } //I->get_and_print_column_tactical_decomposition_scheme_tex( // file, FALSE /* f_enter_math */, *Stack); Stack->print_column_tactical_decomposition_scheme_tex( ost, f_enter_math, row_classes, nb_row_classes, col_classes, nb_col_classes, col_scheme, f_print_subscripts); } } }
21.373541
66
0.697797
abetten
4dca932f6db3b9a3dabc5d7c95e9075d7f91d709
617
cpp
C++
Websites/Codeforces/339A.cpp
justaname94/Algorithms
4c9ec4119b0d92d5889f85b89fcb24f885a82373
[ "MIT" ]
null
null
null
Websites/Codeforces/339A.cpp
justaname94/Algorithms
4c9ec4119b0d92d5889f85b89fcb24f885a82373
[ "MIT" ]
null
null
null
Websites/Codeforces/339A.cpp
justaname94/Algorithms
4c9ec4119b0d92d5889f85b89fcb24f885a82373
[ "MIT" ]
null
null
null
#include <iostream> #include <algorithm> using namespace std; int main() { string operation; cin >> operation; string result; int arrSize = (operation.length()/2) + 1; int digits[arrSize]; int digitIndex = 0; for (int i = 0; i < operation.length(); i++) { if (operation[i] != '+') digits[digitIndex++] = operation[i] - '0'; } sort(digits, digits+arrSize); for (int i = 0; i < arrSize; i++) { result += (digits[i] + '0'); result += "+"; } result = result.substr(0, result.length()-1); cout << result << endl; return 0; }
21.275862
54
0.531605
justaname94
4dcaff8952eddbe7a377bcbff443daebfb3f60a7
173
cpp
C++
cpp_composition_over_inheritance_code/src/i_movable.cpp
kedingp/sandbox
b9a814c6578dfabe2463b3c83982c3fdfeda7f21
[ "MIT" ]
null
null
null
cpp_composition_over_inheritance_code/src/i_movable.cpp
kedingp/sandbox
b9a814c6578dfabe2463b3c83982c3fdfeda7f21
[ "MIT" ]
4
2019-02-24T07:59:05.000Z
2019-03-17T22:51:23.000Z
cpp_composition_over_inheritance_code/src/i_movable.cpp
kedingp/sandbox
b9a814c6578dfabe2463b3c83982c3fdfeda7f21
[ "MIT" ]
null
null
null
#include <cpp_composition_over_inheritance_code/i_movable.h> namespace table_tennis { I_Movable::I_Movable() { } I_Movable::~I_Movable() { } }
10.8125
60
0.641618
kedingp
4dccdbec58853d23d5d1490cdc0bedf6d57efc12
184
cpp
C++
source/tests.cpp
Looo911/programmiersprachen-aufgabenblatt-3
7ac3e5f0a37e889e03ceae3b62ebd5da2370b91f
[ "MIT" ]
null
null
null
source/tests.cpp
Looo911/programmiersprachen-aufgabenblatt-3
7ac3e5f0a37e889e03ceae3b62ebd5da2370b91f
[ "MIT" ]
null
null
null
source/tests.cpp
Looo911/programmiersprachen-aufgabenblatt-3
7ac3e5f0a37e889e03ceae3b62ebd5da2370b91f
[ "MIT" ]
null
null
null
#define CATCH_CONFIG_RUNNER #include <catch.hpp> TEST_CASE("Circle&Rectangle", "[operator]") { } int main(int argc, char *argv[]) { return Catch::Session().run(argc, argv); }
12.266667
43
0.668478
Looo911
4dd0653c57f4ce46eb0910682235f37dab678229
721
cpp
C++
samples/round_robin.cpp
alarouche/cppao
5519c8014286c60200bc7123b445b57848168584
[ "MIT", "Unlicense" ]
null
null
null
samples/round_robin.cpp
alarouche/cppao
5519c8014286c60200bc7123b445b57848168584
[ "MIT", "Unlicense" ]
null
null
null
samples/round_robin.cpp
alarouche/cppao
5519c8014286c60200bc7123b445b57848168584
[ "MIT", "Unlicense" ]
null
null
null
#include <active/object.hpp> #include <cstdio> /* A slightly more sophisticated example. * In this case, each node punts a message to its next node in a loop. * To make things interesting, we add lots of messages concurrently. */ struct RoundRobin : public active::object<RoundRobin> { RoundRobin * next; void active_method( int packet ) { printf( "Received packed %d\n", packet ); if( packet>0 ) (*next)(packet-1); } }; int main() { // Create 1000 nodes. const int Count=1000; RoundRobin nodes[Count]; // Link them together for(int i=0; i<Count-1; ++i) nodes[i].next = nodes+i+1; nodes[Count-1].next=nodes; // Send each node a packet. for(int i=0; i<Count; ++i) nodes[i](10); active::run(); }
20.6
70
0.67129
alarouche
4dd6ced1a677d4037761f3c67ae3208d4675f008
1,136
cpp
C++
tests/gaf-tests/Library/Sources/TagDefineTimeline.cpp
ethankennerly/cocos2d-gaf-demo
7757cc04bc4142a58477c58c39684ae8b7218757
[ "MIT" ]
1
2020-03-08T09:39:00.000Z
2020-03-08T09:39:00.000Z
tests/gaf-tests/Library/Sources/TagDefineTimeline.cpp
ethankennerly/cocos2d-gaf-demo
7757cc04bc4142a58477c58c39684ae8b7218757
[ "MIT" ]
null
null
null
tests/gaf-tests/Library/Sources/TagDefineTimeline.cpp
ethankennerly/cocos2d-gaf-demo
7757cc04bc4142a58477c58c39684ae8b7218757
[ "MIT" ]
null
null
null
#include "GAFPrecompiled.h" #include "TagDefineTimeline.h" #include "GAFLoader.h" #include "GAFStream.h" #include "GAFAsset.h" #include "GAFHeader.h" #include "GAFTimeline.h" #include "PrimitiveDeserializer.h" NS_GAF_BEGIN void TagDefineTimeline::read(GAFStream* in, GAFAsset* asset, GAFTimeline* timeline) { unsigned int id = in->readU32(); unsigned int framesCount = in->readU32(); cocos2d::Rect aabb; cocos2d::Point pivot; PrimitiveDeserializer::deserialize(in, &aabb); PrimitiveDeserializer::deserialize(in, &pivot); GAFTimeline *tl = new GAFTimeline(timeline, id, aabb, pivot, framesCount); ////////////////////////////////////////////////////////////////////////// char hasLinkage = in->readUByte(); if (hasLinkage) { std::string linkageName; in->readString(&linkageName); tl->setLinkageName(linkageName); } m_loader->loadTags(in, asset, tl); asset->pushTimeline(id, tl); if (id == 0) { asset->setRootTimeline((uint32_t)0); } } TagDefineTimeline::TagDefineTimeline(GAFLoader* loader) : m_loader(loader) { } NS_GAF_END
22.27451
83
0.634683
ethankennerly
4dda8568e1f82e45dd54c4a579f6fdb93fb35e89
732
cpp
C++
src/llvmir2hll/pattern/pattern_finder_runners/no_action_pattern_finder_runner.cpp
mehrdad-shokri/retdec
a82f16e97b163afe789876e0a819489c5b9b358e
[ "MIT", "Zlib", "BSD-3-Clause" ]
4,816
2017-12-12T18:07:09.000Z
2019-04-17T02:01:04.000Z
src/llvmir2hll/pattern/pattern_finder_runners/no_action_pattern_finder_runner.cpp
mehrdad-shokri/retdec
a82f16e97b163afe789876e0a819489c5b9b358e
[ "MIT", "Zlib", "BSD-3-Clause" ]
514
2017-12-12T18:22:52.000Z
2019-04-16T16:07:11.000Z
src/llvmir2hll/pattern/pattern_finder_runners/no_action_pattern_finder_runner.cpp
mehrdad-shokri/retdec
a82f16e97b163afe789876e0a819489c5b9b358e
[ "MIT", "Zlib", "BSD-3-Clause" ]
579
2017-12-12T18:38:02.000Z
2019-04-11T13:32:53.000Z
/** * @file src/llvmir2hll/pattern/pattern_finder_runners/no_action_pattern_finder_runner.cpp * @brief Implementation of NoActionPatternFinderRunner. * @copyright (c) 2017 Avast Software, licensed under the MIT license */ #include <string> #include "retdec/llvmir2hll/pattern/pattern_finder_runners/no_action_pattern_finder_runner.h" namespace retdec { namespace llvmir2hll { /** * @brief Does nothing. */ void NoActionPatternFinderRunner::doActionsBeforePatternFinderRuns( ShPtr<PatternFinder> pf) {} /** * @brief Does nothing. */ void NoActionPatternFinderRunner::doActionsAfterPatternFinderHasRun( ShPtr<PatternFinder> pf, const PatternFinder::Patterns &foundPatterns) {} } // namespace llvmir2hll } // namespace retdec
26.142857
93
0.797814
mehrdad-shokri
4dddccd6861c9ebff6d530023c4981974fbe7aed
5,947
hpp
C++
src/autonomy/script_commands.hpp
medlefsen/autonomy
ed9da86e9be98dd2505a7f02af9cd4db995e6baf
[ "Artistic-2.0" ]
2
2015-05-31T20:26:51.000Z
2022-02-19T16:11:14.000Z
src/autonomy/script_commands.hpp
medlefsen/autonomy
ed9da86e9be98dd2505a7f02af9cd4db995e6baf
[ "Artistic-2.0" ]
null
null
null
src/autonomy/script_commands.hpp
medlefsen/autonomy
ed9da86e9be98dd2505a7f02af9cd4db995e6baf
[ "Artistic-2.0" ]
null
null
null
#ifndef AUTONOMY_SCRIPT_COMMANDS_HPP #define AUTONOMY_SCRIPT_COMMANDS_HPP #include <boost/random.hpp> #include <autonomy/script_instruction.hpp> #include <autonomy/entity/scripted_drone.hpp> namespace autonomy { //! \brief Move command. //! Takes 2 "directions", up and right. //! A direction is either positive, 0 or negative struct move : public script_instruction_base<move> { friend class boost::serialization::access; static std::string name() { return "move"; } unsigned int execute(size_t which_queue, entity::scripted_drone & drone); private: template<class Archive> void serialize(Archive & ar, const unsigned int version) { ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(script_instruction_base<move>); } }; struct get_x : public script_instruction_base<get_x> { friend class boost::serialization::access; static std::string name() { return "get_x"; } unsigned int execute(size_t which_queue, entity::scripted_drone & drone); private: template<class Archive> void serialize(Archive & ar, const unsigned int version) { ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(script_instruction_base<get_x>); } }; struct get_y : public script_instruction_base<get_y> { friend class boost::serialization::access; static std::string name() { return "get_y"; } unsigned int execute(size_t which_queue, entity::scripted_drone & drone); private: template<class Archive> void serialize(Archive & ar, const unsigned int version) { ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(script_instruction_base<get_y>); } }; //! \brief scan command //! Takes an x and a y and returns an "object type" struct scan : public script_instruction_base<scan> { friend class boost::serialization::access; static std::string name() { return "scan"; } unsigned int execute(size_t which_queue, entity::scripted_drone & drone); private: template<class Archive> void serialize(Archive & ar, const unsigned int version) { ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(script_instruction_base<scan>); } }; struct is_drone : public script_instruction_base<is_drone> { friend class boost::serialization::access; static std::string name() { return "is_drone"; } unsigned int execute(size_t which_queue, entity::scripted_drone & drone); private: template<class Archive> void serialize(Archive & ar, const unsigned int version) { ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(script_instruction_base<is_drone>); } }; struct is_asteroid : public script_instruction_base<is_asteroid> { friend class boost::serialization::access; static std::string name() { return "is_asteroid"; } unsigned int execute(size_t which_queue, entity::scripted_drone & drone); private: template<class Archive> void serialize(Archive & ar, const unsigned int version) { ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(script_instruction_base<is_asteroid>); } }; struct is_base : public script_instruction_base<is_base> { friend class boost::serialization::access; static std::string name() { return "is_base"; } unsigned int execute(size_t which_queue, entity::scripted_drone & drone ); private: template<class Archive> void serialize(Archive & ar, const unsigned int version) { ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(script_instruction_base<is_base>); } }; //! \brief Random direction command //! Returns a random "direction" which is either -1, 0, or 1 struct rand_dir : public script_instruction_base<rand_dir> { friend class boost::serialization::access; rand_dir() {} static std::string name() { return "rand_dir"; } unsigned int execute(size_t which_queue, entity::scripted_drone & drone); static boost::mt19937 rng; static boost::uniform_int<> dir; static boost::variate_generator<boost::mt19937&, boost::uniform_int<> > _rand_dir; private: template<class Archive> void serialize(Archive & ar, const unsigned int version) { ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(script_instruction_base<rand_dir>); } }; //! \brief Mine command //! Takes an x, and a y and mines an asteroid some set amount if there is one there struct mine : public script_instruction_base<mine> { friend class boost::serialization::access; static std::string name() { return "mine"; } unsigned int execute(size_t which_queue, entity::scripted_drone & drone); private: template<class Archive> void serialize(Archive & ar, const unsigned int version) { ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(script_instruction_base<mine>); } }; //! \brief Unload command //! Takes an x, and a y and unloads some set amount to a basestation struct unload : public script_instruction_base<unload> { friend class boost::serialization::access; static std::string name() { return "unload"; } unsigned int execute(size_t which_queue, entity::scripted_drone & drone); private: template<class Archive> void serialize(Archive & ar, const unsigned int version) { ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(script_instruction_base<unload>); } }; } #endif
38.121795
95
0.633092
medlefsen
4ddf249e6bd0d57ada52921e5a19a88b411a1ba6
748
cpp
C++
local_addons/ofxCv/example-gesture/src/ofApp.cpp
yxcde/RTP_MIT_RECODED
181deb2e3228484fa9d4ed0e6bf3f4a639d99419
[ "MIT" ]
446
2015-01-08T00:14:06.000Z
2022-03-16T13:08:03.000Z
local_addons/ofxCv/example-gesture/src/ofApp.cpp
yxcde/RTP_MIT_RECODED
181deb2e3228484fa9d4ed0e6bf3f4a639d99419
[ "MIT" ]
139
2015-01-02T19:20:53.000Z
2021-05-03T16:54:45.000Z
local_addons/ofxCv/example-gesture/src/ofApp.cpp
yxcde/RTP_MIT_RECODED
181deb2e3228484fa9d4ed0e6bf3f4a639d99419
[ "MIT" ]
195
2015-01-18T05:13:39.000Z
2022-03-21T08:24:37.000Z
#include "ofApp.h" using namespace ofxCv; using namespace cv; void ofApp::setup() { ofSetVerticalSync(true); ofEnableSmoothing(); ofEnableAlphaBlending(); ofSetLineWidth(3); ofSetFrameRate(120); } void ofApp::update() { } void ofApp::draw() { ofBackground(0); ofSetColor(255, 64); polyline.draw(); switch(recognizer.getGestureType()) { case Recognizer::GESTURE_LINE: ofSetColor(magentaPrint); break; case Recognizer::GESTURE_ARC: ofSetColor(cyanPrint); break; } if(recognizer.getFitError() < .5) { recognizer.getPolyline().draw(); } } void ofApp::mousePressed(int x, int y, int button) { polyline.clear(); } void ofApp::mouseDragged(int x, int y, int button) { polyline.addVertex(x, y); recognizer.update(polyline); }
18.7
65
0.713904
yxcde
4de02a6730eedb7fe2158b32483e9c1f5c3e26ce
177
cpp
C++
non-iOS/antlr4_generated_src/init_parser/InitFileParserListener.cpp
opendragon/IF
11e9132b896a67115b8fc9fc9cddcd592b838bfa
[ "BSD-3-Clause" ]
null
null
null
non-iOS/antlr4_generated_src/init_parser/InitFileParserListener.cpp
opendragon/IF
11e9132b896a67115b8fc9fc9cddcd592b838bfa
[ "BSD-3-Clause" ]
null
null
null
non-iOS/antlr4_generated_src/init_parser/InitFileParserListener.cpp
opendragon/IF
11e9132b896a67115b8fc9fc9cddcd592b838bfa
[ "BSD-3-Clause" ]
null
null
null
// Generated from /Volumes/Shejidan/git.repositories/IF/non-iOS/../InitFile/InitFileParser.g4 by ANTLR 4.8 #include "InitFileParserListener.h" using namespace InitParser;
17.7
106
0.779661
opendragon
4de37c1987a34efbda06b44fed249896d9a9865b
15,204
cpp
C++
src/sprite.cpp
GhostInABottle/octopus_engine
50429e889493527bdc0e78b307937002e0f2c510
[ "BSD-2-Clause" ]
null
null
null
src/sprite.cpp
GhostInABottle/octopus_engine
50429e889493527bdc0e78b307937002e0f2c510
[ "BSD-2-Clause" ]
null
null
null
src/sprite.cpp
GhostInABottle/octopus_engine
50429e889493527bdc0e78b307937002e0f2c510
[ "BSD-2-Clause" ]
null
null
null
#include "../include/sprite.hpp" #include "../include/sprite_data.hpp" #include "../include/map_object.hpp" #include "../include/canvas.hpp" #include "../include/object_layer.hpp" #include "../include/object_layer_renderer.hpp" #include "../include/image_layer.hpp" #include "../include/game.hpp" #include "../include/configurations.hpp" #include "../include/utility/math.hpp" #include "../include/utility/string.hpp" #include "../include/utility/direction.hpp" #include "../include/xd/audio.hpp" #include "../include/xd/graphics.hpp" #include <algorithm> #include <iostream> #include <optional> #include <unordered_map> #include <vector> namespace detail { xd::vec4 default_color(1, 1, 1, 1); } struct Sprite::Impl { // Game instance Game& game; // Sprite data (poses, frames, etc.) std::unique_ptr<Sprite_Data> data; // Current pose name std::string current_pose_name; // Current pose state std::string current_pose_state; // Current direction Direction current_pose_direction; // Cache of tag combination to poses std::unordered_map<std::string, int> tag_map; // Currently active pose Pose* pose; // Source rectangle of current frame xd::rect src; // Current frame index int frame_index; // Used to check if enough time has passed since last frame long old_time; // Number of times the animation repeated so far int repeat_count; // Total number of frames int frame_count; // Is animation in a tween frame bool tweening; // Default color const static xd::vec4 default_color; // Is the pose finished bool finished; // Is the sprite paused bool paused; // Time when sprite got paused long pause_start; // Last frame where sound was played int last_sound_frame; // Animation speed modifier (based on object speed) float speed; // Maximum possible speed modifier const static float max_speed; // Volume of the sprite's sound effects float sfx_volume; // How fast sound volume falls off float sound_attenuation_factor; Impl(Game& game, std::unique_ptr<Sprite_Data> data) : game(game), data(std::move(data)), current_pose_direction(Direction::NONE), frame_index(0), old_time(game.ticks()), repeat_count(0), frame_count(0), tweening(false), finished(false), paused(false), pause_start(-1), last_sound_frame(-1), speed(1.0f), sfx_volume(1.0f), sound_attenuation_factor(Configurations::get<float>("audio.sound-attenuation-factor")) { set_default_pose(); } void render(xd::sprite_batch& batch, xd::vec2 pos, float opacity = 1.0f, xd::vec2 mag = xd::vec2(1.0f), xd::vec4 color = xd::vec4(1.0f), std::optional<float> angle = std::nullopt, std::optional<xd::vec2> origin = std::nullopt, bool repeat = false, xd::vec2 repeat_pos = xd::vec2()) { auto& frame = pose->frames[frame_index]; auto& image = frame.image ? frame.image : (pose->image ? pose->image : data->image); if (!image) return; xd::rect src = frame.rectangle; if (repeat) { // Sprite's src rectangle position is ignored src.x = -repeat_pos.x; src.y = -repeat_pos.y; } color.a *= opacity * frame.opacity; batch.add(image, src, pos.x, pos.y, xd::radians(angle.value_or(static_cast<float>(frame.angle))), frame.magnification * mag, color, origin.value_or(pose->origin)); } void update() { if (frame_count == 0 || finished) return; auto current_frame = &pose->frames[frame_index]; int frame_time = get_frame_time(*current_frame); auto audio = game.get_audio(); auto sound_file = current_frame->sound_file.get(); auto play_sfx = audio && sound_file && (last_sound_frame != frame_index || sound_file->stopped()); if (play_sfx) { sound_file->set_volume(current_frame->sound_volume * sfx_volume); sound_file->play(); last_sound_frame = frame_index; } if (passed_time() > frame_time) { old_time = game.ticks(); if (tweening) tweening = false; if (frame_index + 1 >= frame_count) { repeat_count++; last_sound_frame = -1; if (finished_repeating()) { finished = true; return; } } frame_index = (frame_index + 1) % frame_count; } current_frame = &pose->frames[frame_index]; if (!tweening && current_frame->tween_frame) { Frame& prev_frame = pose->frames[frame_index - 1]; current_frame->rectangle.x = prev_frame.rectangle.x; current_frame->rectangle.y = prev_frame.rectangle.y; current_frame->rectangle.w = prev_frame.rectangle.w; current_frame->rectangle.h = prev_frame.rectangle.h; old_time = game.ticks(); tweening = true; } if (tweening) { Frame& prev_frame = pose->frames[frame_index - 1]; Frame& next_frame = pose->frames[frame_index + 1]; const float time_diff = static_cast<float>(passed_time()); float alpha = time_diff / frame_time; alpha = std::min(std::max(alpha, 0.0f), 1.0f); current_frame->magnification = lerp(prev_frame.magnification, next_frame.magnification, alpha); current_frame->angle= static_cast<int>( lerp(static_cast<float>(prev_frame.angle), static_cast<float>(next_frame.angle), alpha)); current_frame->opacity= lerp(prev_frame.opacity, next_frame.opacity, alpha); } } void reset() { frame_index = 0; old_time = game.ticks(); repeat_count = 0; last_sound_frame = -1; if (pose) frame_count = pose->frames.size(); finished = false; tweening = false; } int get_frame_time(const Frame& frame) const { const int frame_time = frame.duration == -1 ? pose->duration : frame.duration; return static_cast<int>(frame_time * speed); } std::string get_filename() const { return data->filename; } bool finished_repeating() const { return pose->repeats != -1 && repeat_count >= pose->repeats; } void pause() { paused = true; pause_start = game.ticks(); } void resume() { paused = false; pause_start = -1; } long paused_time() const { if (pause_start == -1) return 0; return game.ticks() - pause_start; } long passed_time() const { return game.ticks() - old_time - paused_time(); } bool is_completed() const { return frame_count > 0 && frame_index == frame_count - 1 && passed_time() >= get_frame_time(pose->frames[frame_index]); } void set_pose(const std::string& pose_name, const std::string& state_name, Direction dir) { // Update current pose tags current_pose_name = string_utilities::capitalize(pose_name); current_pose_state = string_utilities::capitalize(state_name); current_pose_direction = dir; // Lookup pose in cache std::string tag_string; tag_string = "P:" + current_pose_name + "|S:" + current_pose_state + "|D:" + direction_to_string(dir); int matched_pose = -1; bool default_name_matched = false; if (tag_map.find(tag_string) != tag_map.end()) { matched_pose = tag_map[tag_string]; } else { // Map of pose IDs to their tag match count std::unordered_map<int, unsigned int> matches; int matches_needed = (pose_name.empty() ? 0 : 1) + (state_name.empty() ? 0 : 1) + (dir == Direction::NONE ? 0 : 1); int default_pose = -1; bool is_default = data->default_pose != "" && current_pose_name == data->default_pose; // Loop over poses incrementing poses that match for (unsigned int i = 0; i < data->poses.size(); ++i) { auto& pose = data->poses[i]; auto name_matched = current_pose_name == pose.name; if (!current_pose_name.empty() && name_matched) { matches[i]++; // Update best default pose if (is_default && compare_matches(i, default_pose, matches) > 0) { default_pose = i; default_name_matched = true; } } if (!current_pose_state.empty() && current_pose_state == pose.state) { matches[i]++; } if (dir != Direction::NONE && dir == pose.direction) { matches[i]++; } // Update best match auto comparison = compare_matches(i, matched_pose, matches); if (comparison > 0 || (comparison == 0 && name_matched)) { matched_pose = i; } if (matches[i] == matches_needed) { break; } } // Prefer default pose to other poses with same matches if (matched_pose == -1 || (default_name_matched && compare_matches(matched_pose, default_pose, matches) == 0)) { matched_pose = default_pose == -1 ? 0 : default_pose; } // Update pose cache tag_map[tag_string] = matched_pose; } // Set matched pose and reset the sprite if (pose != &data->poses[matched_pose] || finished) { pose = &data->poses[matched_pose]; reset(); } } // A pose is better than current best if there's no best yet or if it matches more tags int compare_matches(int candidate_index, int best_index, std::unordered_map<int, unsigned int>& matches) { auto candidate = matches[candidate_index]; auto best = best_index > -1 ? matches[best_index] : 0; if (candidate > best) return 1; if (best > candidate) return -1; return 0; } void set_default_pose() { if (data->default_pose.empty()) { pose = &data->poses[0]; return; } for (auto& p : data->poses) { if (p.name == data->default_pose) { pose = &p; return; } } } void update_sound_attenuation(Map_Object& object) { auto player_position{game.get_player()->get_centered_position()}; auto distance = xd::length(object.get_centered_position() - player_position); // Sound is 1 within [factor] pixels, then falls off based on distance sfx_volume = std::min(1.0f, sound_attenuation_factor / (1.0f + distance)); auto current_frame = &pose->frames[frame_index]; if (current_frame->sound_file && current_frame->sound_file->playing()) { current_frame->sound_file->set_volume(sfx_volume); } } }; const xd::vec4 Sprite::Impl::default_color(1, 1, 1, 1); const float Sprite::Impl::max_speed = 10.0f; Sprite::Sprite(Game& game, std::unique_ptr<Sprite_Data> data) : pimpl(std::make_unique<Impl>(game, std::move(data))) { pimpl->reset(); } Sprite::~Sprite() {} void Sprite::render(Map_Object& object) { if (!object.is_visible()) return; auto layer = object.get_layer(); auto& batch = layer->renderer->get_batch(); auto color = object.uses_layer_color() ? object.get_color() * layer->tint_color : object.get_color(); pimpl->render(batch, object.get_position(), layer->opacity * object.get_opacity(), object.get_magnification(), color); } void Sprite::render(xd::sprite_batch& batch, const Canvas& canvas, const xd::vec2 pos) { if (!canvas.is_visible()) return; pimpl->render(batch, pos, canvas.get_opacity(), canvas.get_magnification(), canvas.get_color(), canvas.get_angle(), canvas.get_origin()); } void Sprite::render(xd::sprite_batch& batch, const Image_Layer& image_layer, const xd::vec2 pos) { if (!image_layer.visible) return; pimpl->render(batch, pos, image_layer.opacity, xd::vec2(1.0f), // magnification xd::vec4(1.0f), // Color std::nullopt, // angle std::nullopt, // origin image_layer.repeat, image_layer.position); } void Sprite::update(Map_Object& object) { if (object.is_sound_attenuation_enabled()) { pimpl->update_sound_attenuation(object); } pimpl->update(); } void Sprite::update() { pimpl->update(); } void Sprite::reset() { pimpl->reset(); } std::string Sprite::get_filename() const { return pimpl->get_filename(); } void Sprite::set_pose(const std::string& pose_name, const std::string& state_name, Direction dir) { pimpl->set_pose(pose_name, state_name, dir); } Pose& Sprite::get_pose() { return *pimpl->pose; } xd::rect Sprite::get_bounding_box() const { return pimpl->pose->bounding_box; } std::string Sprite::get_default_pose() const { return pimpl->data->default_pose; } xd::vec2 Sprite::get_size() const { xd::vec2 size; auto& pose = *pimpl->pose; if (pose.frames.size() > 0) { auto& frame = pose.frames.front(); size = xd::vec2(frame.rectangle.w, frame.rectangle.h); } return size; } Frame& Sprite::get_frame() { return pimpl->pose->frames[pimpl->frame_index]; } const Frame& Sprite::get_frame() const { return pimpl->pose->frames[pimpl->frame_index]; } bool Sprite::is_stopped() const { return pimpl->finished; } void Sprite::stop() { pimpl->finished = true; } bool Sprite::is_paused() const { return pimpl->paused; } void Sprite::pause() { pimpl->pause(); } void Sprite::resume() { pimpl->resume(); } bool Sprite::is_completed() const { return pimpl->is_completed(); } float Sprite::get_speed() const { return pimpl->speed; } void Sprite::set_speed(float speed) { // Scale sprite speed in the opposite direction of object speed, // between 0.5 for max speed (10) and 2 for min speed (0) // but also make sure object speed 1 maps to sprite speed 1 // s-speed = s-min + (s-max - s-min) * (o-speed - o-min) / (o-max - o-min) speed = std::max(0.0f, std::min(pimpl->max_speed, speed)); if (speed <= 1) pimpl->speed = 2.0f - speed; else pimpl->speed = 1.0f - 0.5f * (speed - 1.0f) / (pimpl->max_speed - 1.0f); } bool Sprite::is_eight_directional() const { return pimpl->data->has_diagonal_directions; } float Sprite::get_sfx_volume() const { return pimpl->sfx_volume; } void Sprite::set_sfx_volume(float volume) { pimpl->sfx_volume = volume; }
32.143763
127
0.587872
GhostInABottle
4de479230edb288dc4c57ca2b364fcc1ab9474bc
195
cpp
C++
Software/CPU/myscrypt/build/cmake-3.12.3/Tests/AliasTarget/targetgenerator.cpp
duonglvtnaist/Multi-ROMix-Scrypt-Accelerator
9cb9d96c72c3e912fb7cfd5a786e50e4844a1ee8
[ "MIT" ]
107
2021-08-28T20:08:42.000Z
2022-03-22T08:02:16.000Z
Software/CPU/myscrypt/build/cmake-3.12.3/Tests/AliasTarget/targetgenerator.cpp
duonglvtnaist/Multi-ROMix-Scrypt-Accelerator
9cb9d96c72c3e912fb7cfd5a786e50e4844a1ee8
[ "MIT" ]
3
2021-09-08T02:18:00.000Z
2022-03-12T00:39:44.000Z
Software/CPU/myscrypt/build/cmake-3.12.3/Tests/AliasTarget/targetgenerator.cpp
duonglvtnaist/Multi-ROMix-Scrypt-Accelerator
9cb9d96c72c3e912fb7cfd5a786e50e4844a1ee8
[ "MIT" ]
16
2021-08-30T06:57:36.000Z
2022-03-22T08:05:52.000Z
#include <fstream> int main(int argc, char** argv) { std::ofstream fout("targetoutput.h"); if (!fout) return 1; fout << "#define TARGETOUTPUT_DEFINE\n"; fout.close(); return 0; }
15
42
0.630769
duonglvtnaist
4e2896425937add552d5ce4aedf077c28aac0cee
5,027
hpp
C++
include/nodamushi/svd/svd_reader.hpp
nodamushi/nsvd-reader
cf3a840aaac78d5791df1cf045596ec20dc03257
[ "CC0-1.0" ]
null
null
null
include/nodamushi/svd/svd_reader.hpp
nodamushi/nsvd-reader
cf3a840aaac78d5791df1cf045596ec20dc03257
[ "CC0-1.0" ]
null
null
null
include/nodamushi/svd/svd_reader.hpp
nodamushi/nsvd-reader
cf3a840aaac78d5791df1cf045596ec20dc03257
[ "CC0-1.0" ]
null
null
null
/*! @brief svd_reader @file nodamushi/svd/svd_reader.hpp */ /* * These codes are licensed under CC0. * http://creativecommons.org/publicdomain/zero/1.0/ */ #ifndef NODAMUSHI_SVD_SVD_READER_HPP #define NODAMUSHI_SVD_SVD_READER_HPP # include "nodamushi/const_string.hpp" # include "nodamushi/boxvec.hpp" # include <cassert> # include <type_traits> # include <utility> # include <stdexcept> # include <fstream> namespace nodamushi{ namespace svd{ enum class svd_error { //! unknown element UNKNOWN_ELEMENT, //! illegal value ILLEGAL_VALUE }; /** * @brief Indicates which element caused an error in processing. */ enum class svd_element { //! @brief nodamushi::svd::Device Device, //! @brief nodamushi::svd::Peripheral Peripheral, //! @brief nodamushi::svd::Register Register, //! @brief nodamushi::svd::Registers Registers, //! @brief nodamushi::svd::Cluster Cluster, //! @brief nodamushi::svd::Field Field, //! @brief nodamushi::svd::Fields Fields, //! @brief nodamushi::svd::EnumeratedValue EnumeratedValue, //! @brief nodamushi::svd::DimArrayIndex DimArrayIndex, //! @brief nodamushi::svd::WriteConstraintRange WriteConstraintRange, //! @brief nodamushi::svd::WriteConstraint WriteConstraint, //! @brief nodamushi::svd::Enumeration Enumeration, //! @brief nodamushi::svd::Interrupt Interrupt, //! @brief nodamushi::svd::AddressBlock AddressBlock, //! @brief nodamushi::svd::SAURegionsConfig SAURegionsConfig, //! @brief nodamushi::svd::SAURegionsConfigRegion SAURegionsConfigRegion, //! @brief nodamushi::svd::Cpu Cpu, }; /*! svd read marker interface. implements interface @code struct svd_reader { //! if this element is svd attribute group,return true. bool is_attribute()const; //! get this element name string_ref get_name()const; //! get trimed value string_ref get_value(); //! get next child element svd_reader next_child(); //! @return has next child operator bool(); // error handler void unknown_element(svd_element e); void illegal_value(svd_element e); }; @endcode */ struct svd_reader{}; /** * @brief file open ,read error */ struct file_read_exception:public std::invalid_argument { static bool check(const std::string& file_name,bool throw_exception) { using namespace std; ifstream ifs(file_name); if(!ifs.good()){ if(throw_exception){ string m = "File read error : "s + file_name; throw file_read_exception(file_name,m); } return false; } return true; } file_read_exception(const std::string& file,const std::string& message): invalid_argument(message), file_name(file){} std::string file_name; }; /** * @brief xml parse error */ struct xml_parse_exception:public std::runtime_error { static constexpr size_t UNKNOWN_FILE_LINE= ~(size_t)0; static xml_parse_exception make( const std::string& file,size_t file_line = UNKNOWN_FILE_LINE) { using namespace std; string m = "XML parse error occured: "s + file; return {file,m,file_line}; } xml_parse_exception(const std::string& file, const std::string& message, size_t file_line): runtime_error(message), file_name(file), line_number(file_line){} std::string file_name; size_t line_number; }; struct svd_reader_util { template<typename T> static std::pair<size_t,size_t> _trim(T& str) { size_t b = 0; const size_t len = str.length(); size_t e = len; while(b!=e){ char c = str[b]; if(c == ' ' || c == '\t' || c =='\r' || c == '\n') b++; else break; } while(b!=e){ char c = str[e-1]; if(c == ' ' || c == '\t' || c =='\r' || c == '\n') e--; else break; } return {b,e}; } //! @brief remove white spaces static void trim(std::string& str) { auto v = _trim(str); size_t b = v.first,e=v.second; if(e != str.length()) str.erase(e); if(b) str.erase(0,b); } # if __cplusplus >= 201703 //! @brief remove white spaces static void trim(std::string_view& str) { auto v = _trim(str); size_t b = v.first,e=v.second,len = e-b; std::string_view n(str.data()+b,len); str = n; } //! @brief remove white spaces static std::string_view trimc(const std::string_view& str) { auto v = _trim(str); size_t b = v.first,e=v.second,len = e-b; return {str.data()+b,len}; } //! @brief remove white spaces static std::string_view trimc(const std::string& str) { auto v = _trim(str); size_t b = v.first,e=v.second,len = e-b; return {str.data()+b,len}; } # else //! @brief remove white spaces static std::string trimc(const std::string& str) { auto v = _trim(str); size_t b = v.first,e=v.second,len = e-b; return std::string(str,b,len); } # endif }; }}// end namespace nodamushi::svd #endif // NODAMUSHI_SVD_SVD_READER_HPP
22.048246
74
0.636364
nodamushi
4e28e1857c2c272d365c80d98d350081044410df
16,044
cc
C++
src/stirling/source_connectors/dynamic_tracer/dynamic_tracing/dynamic_tracer_test.cc
marianod92/pixie
f62668aeffb471287e01b1b256ae53c98c789bfa
[ "Apache-2.0" ]
null
null
null
src/stirling/source_connectors/dynamic_tracer/dynamic_tracing/dynamic_tracer_test.cc
marianod92/pixie
f62668aeffb471287e01b1b256ae53c98c789bfa
[ "Apache-2.0" ]
null
null
null
src/stirling/source_connectors/dynamic_tracer/dynamic_tracing/dynamic_tracer_test.cc
marianod92/pixie
f62668aeffb471287e01b1b256ae53c98c789bfa
[ "Apache-2.0" ]
1
2022-03-06T14:26:16.000Z
2022-03-06T14:26:16.000Z
/* * Copyright 2018- The Pixie Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * SPDX-License-Identifier: Apache-2.0 */ #include "src/stirling/source_connectors/dynamic_tracer/dynamic_tracing/dynamic_tracer.h" #include <string> #include <vector> #include "src/common/exec/subprocess.h" #include "src/common/fs/fs_wrapper.h" #include "src/common/testing/testing.h" #include "src/stirling/testing/common.h" constexpr std::string_view kBinaryPath = "src/stirling/obj_tools/testdata/go/test_go_1_16_binary"; namespace px { namespace stirling { namespace dynamic_tracing { using ::google::protobuf::TextFormat; using ::px::stirling::bpf_tools::UProbeSpec; using ::px::stirling::testing::PIDToUPID; using ::px::testing::proto::EqualsProto; using ::px::testing::status::StatusIs; using ::testing::ElementsAreArray; using ::testing::EndsWith; using ::testing::Field; using ::testing::HasSubstr; using ::testing::SizeIs; constexpr char kServerPath[] = "src/stirling/source_connectors/socket_tracer/protocols/http2/testing/go_grpc_server/" "golang_1_16_grpc_server"; constexpr char kPod0UpdateTxt[] = R"( uid: "pod0" name: "pod0" namespace: "ns0" start_timestamp_ns: 100 container_ids: "container0" container_ids: "container1" container_names: "container0" container_names: "container1" )"; constexpr char kPod1UpdateTxt[] = R"( uid: "pod1" name: "pod1" namespace: "ns0" start_timestamp_ns: 100 )"; constexpr char kContainer0UpdateTxt[] = R"( cid: "container0" name: "container0" namespace: "ns0" start_timestamp_ns: 100 pod_id: "pod0" pod_name: "pod0" )"; constexpr char kContainer1UpdateTxt[] = R"( cid: "container1" name: "container1" namespace: "ns0" start_timestamp_ns: 100 pod_id: "pod0" pod_name: "pod0" )"; class ResolveTargetObjPathTest : public ::testing::Test { protected: void SetUp() override { auto server_path = px::testing::BazelBinTestFilePath(kServerPath).string(); ASSERT_OK(s_.Start({server_path})); md::K8sMetadataState::PodUpdate pod0_update; md::K8sMetadataState::PodUpdate pod1_update; md::K8sMetadataState::ContainerUpdate container0_update; md::K8sMetadataState::ContainerUpdate container1_update; ASSERT_TRUE(TextFormat::ParseFromString(kPod0UpdateTxt, &pod0_update)); ASSERT_TRUE(TextFormat::ParseFromString(kPod1UpdateTxt, &pod1_update)); ASSERT_TRUE(TextFormat::ParseFromString(kContainer0UpdateTxt, &container0_update)); ASSERT_TRUE(TextFormat::ParseFromString(kContainer1UpdateTxt, &container1_update)); ASSERT_OK(k8s_mds_.HandleContainerUpdate(container0_update)); ASSERT_OK(k8s_mds_.HandleContainerUpdate(container1_update)); ASSERT_OK(k8s_mds_.HandlePodUpdate(pod0_update)); ASSERT_OK(k8s_mds_.HandlePodUpdate(pod1_update)); k8s_mds_.containers_by_id()["container0"]->mutable_active_upids()->emplace( PIDToUPID(s_.child_pid())); } void TearDown() override { s_.Kill(); EXPECT_EQ(9, s_.Wait()) << "Server should have been killed."; } SubProcess s_; md::K8sMetadataState k8s_mds_; }; TEST_F(ResolveTargetObjPathTest, ResolveUPID) { ir::shared::DeploymentSpec deployment_spec; deployment_spec.mutable_upid()->set_pid(s_.child_pid()); ASSERT_OK(ResolveTargetObjPath(k8s_mds_, &deployment_spec)); EXPECT_THAT(deployment_spec.path(), EndsWith(kServerPath)); EXPECT_TRUE(fs::Exists(deployment_spec.path())); } TEST_F(ResolveTargetObjPathTest, ResolvePodProcessSuccess) { ir::shared::DeploymentSpec deployment_spec; constexpr char kDeploymentSpecTxt[] = R"( pod_process { pod: "ns0/pod0" container: "container0" process: "go_grpc_server" } )"; TextFormat::ParseFromString(kDeploymentSpecTxt, &deployment_spec); ASSERT_OK(ResolveTargetObjPath(k8s_mds_, &deployment_spec)); EXPECT_THAT(deployment_spec.path(), EndsWith(kServerPath)); EXPECT_TRUE(fs::Exists(deployment_spec.path())); } // Tests that non-matching process regexp returns no UPID. TEST_F(ResolveTargetObjPathTest, ResolvePodProcessNonMatchingProcessRegexp) { ir::shared::DeploymentSpec deployment_spec; constexpr char kDeploymentSpecTxt[] = R"( pod_process { pod: "ns0/pod0" container: "container0" process: "non-existent-regexp" } )"; TextFormat::ParseFromString(kDeploymentSpecTxt, &deployment_spec); EXPECT_THAT( ResolveTargetObjPath(k8s_mds_, &deployment_spec), StatusIs(px::statuspb::NOT_FOUND, HasSubstr("Found no UPIDs in Container: 'container0'"))); } // Tests that a given pod name prefix matches multiple Pods. TEST_F(ResolveTargetObjPathTest, ResolvePodProcessMultiplePods) { ir::shared::DeploymentSpec deployment_spec; constexpr char kDeploymentSpecTxt[] = R"( pod_process { pod: "ns0/pod" } )"; TextFormat::ParseFromString(kDeploymentSpecTxt, &deployment_spec); EXPECT_THAT(ResolveTargetObjPath(k8s_mds_, &deployment_spec), StatusIs(px::statuspb::FAILED_PRECONDITION, HasSubstr("Pod name 'ns0/pod' matches multiple Pods"))); } // Tests that empty container name results into failure when there are multiple containers in Pod. TEST_F(ResolveTargetObjPathTest, ResolvePodProcessMissingContainerName) { ir::shared::DeploymentSpec deployment_spec; constexpr char kDeploymentSpecTxt[] = R"( pod_process { pod: "ns0/pod0" } )"; TextFormat::ParseFromString(kDeploymentSpecTxt, &deployment_spec); EXPECT_THAT(ResolveTargetObjPath(k8s_mds_, &deployment_spec), StatusIs(px::statuspb::FAILED_PRECONDITION, HasSubstr("Container name not specified, but Pod 'pod0' has multiple " "containers 'container0,container1'"))); } constexpr std::string_view kLogicalProgramSpec = R"( deployment_spec { path: "$0" } tracepoints { program { language: GOLANG outputs { name: "probe_output" fields: "f1" fields: "f2" fields: "f3" fields: "f4" fields: "latency" } probes: { name: "probe0" tracepoint: { symbol: "main.MixedArgTypes" type: LOGICAL } args { id: "arg0" expr: "i1" } args { id: "arg1" expr: "i2" } args { id: "arg2" expr: "i3" } ret_vals { id: "retval0" expr: "$$0" } function_latency { id: "latency" } output_actions { output_name: "probe_output" variable_names: "arg0" variable_names: "arg1" variable_names: "arg2" variable_names: "retval0" variable_names: "latency" } } } } )"; const std::vector<std::string> kExpectedBCC = { "#include <linux/sched.h>", "#define __inline inline __attribute__((__always_inline__))", "static __inline uint64_t pl_nsec_to_clock_t(uint64_t x) {", "return div_u64(x, NSEC_PER_SEC / USER_HZ);", "}", "static __inline uint64_t pl_tgid_start_time() {", "struct task_struct* task_group_leader = ((struct " "task_struct*)bpf_get_current_task())->group_leader;", "#if LINUX_VERSION_CODE >= 328960", "return pl_nsec_to_clock_t(task_group_leader->start_boottime);", "#else", "return pl_nsec_to_clock_t(task_group_leader->real_start_time);", "#endif", "}", "struct blob32 {", " uint64_t len;", " uint8_t buf[32-9];", " uint8_t truncated;", "};", "struct blob64 {", " uint64_t len;", " uint8_t buf[64-9];", " uint8_t truncated;", "};", "struct struct_blob64 {", " uint64_t len;", " int8_t decoder_idx;", " uint8_t buf[64-10];", " uint8_t truncated;", "};", "struct pid_goid_map_value_t {", " int64_t goid;", "} __attribute__((packed, aligned(1)));", "struct probe0_argstash_value_t {", " int arg0;", " int arg1;", " int arg2;", " uint64_t time_;", "} __attribute__((packed, aligned(1)));", "struct probe_output_value_t {", " int32_t tgid_;", " uint64_t tgid_start_time_;", " uint64_t time_;", " int64_t goid_;", " int f1;", " int f2;", " int f3;", " int f4;", " int64_t latency;", "} __attribute__((packed, aligned(1)));", "BPF_HASH(pid_goid_map, uint64_t, struct pid_goid_map_value_t);", "BPF_HASH(probe0_argstash, uint64_t, struct probe0_argstash_value_t);", "BPF_PERCPU_ARRAY(probe_output_data_buffer_array, struct probe_output_value_t, 1);", "static __inline int64_t pl_goid() {", "uint64_t current_pid_tgid = bpf_get_current_pid_tgid();", "const struct pid_goid_map_value_t* goid_ptr = pid_goid_map.lookup(&current_pid_tgid);", "return (goid_ptr == NULL) ? -1 : goid_ptr->goid;", "}", "BPF_PERF_OUTPUT(probe_output);", "int probe_entry_runtime_casgstatus(struct pt_regs* ctx) {", "void* sp_ = (void*)PT_REGS_SP(ctx);", "int32_t tgid_ = bpf_get_current_pid_tgid() >> 32;", "uint64_t tgid_pid_ = bpf_get_current_pid_tgid();", "uint64_t tgid_start_time_ = pl_tgid_start_time();", "uint64_t time_ = bpf_ktime_get_ns();", "int64_t goid_ = pl_goid();", "int64_t kGRunningState = 2;", "void* goid_X_;", "bpf_probe_read(&goid_X_, sizeof(void*), sp_ + 8);", "int64_t goid;", "bpf_probe_read(&goid, sizeof(int64_t), goid_X_ + 152);", "uint32_t newval;", "bpf_probe_read(&newval, sizeof(uint32_t), sp_ + 20);", "struct pid_goid_map_value_t pid_goid_map_value = {};", "pid_goid_map_value.goid = goid;", "if (newval == kGRunningState) {", "pid_goid_map.update(&tgid_pid_, &pid_goid_map_value);", "}", "return 0;", "}", "int probe0_entry(struct pt_regs* ctx) {", "void* sp_ = (void*)PT_REGS_SP(ctx);", "int32_t tgid_ = bpf_get_current_pid_tgid() >> 32;", "uint64_t tgid_pid_ = bpf_get_current_pid_tgid();", "uint64_t tgid_start_time_ = pl_tgid_start_time();", "uint64_t time_ = bpf_ktime_get_ns();", "int64_t goid_ = pl_goid();", "int arg0;", "bpf_probe_read(&arg0, sizeof(int), sp_ + 8);", "int arg1;", "bpf_probe_read(&arg1, sizeof(int), sp_ + 24);", "int arg2;", "bpf_probe_read(&arg2, sizeof(int), sp_ + 32);", "struct probe0_argstash_value_t probe0_argstash_value = {};", "probe0_argstash_value.arg0 = arg0;", "probe0_argstash_value.arg1 = arg1;", "probe0_argstash_value.arg2 = arg2;", "probe0_argstash_value.time_ = time_;", "probe0_argstash.update(&goid_, &probe0_argstash_value);", "return 0;", "}", "int probe0_return(struct pt_regs* ctx) {", "void* sp_ = (void*)PT_REGS_SP(ctx);", "int32_t tgid_ = bpf_get_current_pid_tgid() >> 32;", "uint64_t tgid_pid_ = bpf_get_current_pid_tgid();", "uint64_t tgid_start_time_ = pl_tgid_start_time();", "uint64_t time_ = bpf_ktime_get_ns();", "int64_t goid_ = pl_goid();", "int retval0;", "bpf_probe_read(&retval0, sizeof(int), sp_ + 48);", "struct probe0_argstash_value_t* probe0_argstash_ptr = probe0_argstash.lookup(&goid_);", "if (probe0_argstash_ptr == NULL) { return 0; }", "int arg0 = probe0_argstash_ptr->arg0;", "if (probe0_argstash_ptr == NULL) { return 0; }", "int arg1 = probe0_argstash_ptr->arg1;", "if (probe0_argstash_ptr == NULL) { return 0; }", "int arg2 = probe0_argstash_ptr->arg2;", "if (probe0_argstash_ptr == NULL) { return 0; }", "uint64_t start_ktime_ns = probe0_argstash_ptr->time_;", "int64_t latency = time_ - start_ktime_ns;", "probe0_argstash.delete(&goid_);", "uint32_t probe_output_value_idx = 0;", "struct probe_output_value_t* probe_output_value = " "probe_output_data_buffer_array.lookup(&probe_output_value_idx);", "if (probe_output_value == NULL) { return 0; }", "probe_output_value->tgid_ = tgid_;", "probe_output_value->tgid_start_time_ = tgid_start_time_;", "probe_output_value->time_ = time_;", "probe_output_value->goid_ = goid_;", "probe_output_value->f1 = arg0;", "probe_output_value->f2 = arg1;", "probe_output_value->f3 = arg2;", "probe_output_value->f4 = retval0;", "probe_output_value->latency = latency;", "probe_output.perf_submit(ctx, probe_output_value, sizeof(*probe_output_value));", "return 0;", "}", }; TEST(DynamicTracerTest, Compile) { std::string input_program_str = absl::Substitute( kLogicalProgramSpec, px::testing::BazelBinTestFilePath(kBinaryPath).string()); ir::logical::TracepointDeployment input_program; ASSERT_TRUE(TextFormat::ParseFromString(input_program_str, &input_program)); ASSERT_OK_AND_ASSIGN(BCCProgram bcc_program, CompileProgram(&input_program)); ASSERT_THAT(bcc_program.uprobe_specs, SizeIs(4)); const auto& spec = bcc_program.uprobe_specs[0]; EXPECT_THAT(spec, Field(&UProbeSpec::binary_path, ::testing::EndsWith("test_go_1_16_binary"))); EXPECT_THAT(spec, Field(&UProbeSpec::symbol, "runtime.casgstatus")); EXPECT_THAT(spec, Field(&UProbeSpec::attach_type, bpf_tools::BPFProbeAttachType::kEntry)); EXPECT_THAT(spec, Field(&UProbeSpec::probe_fn, "probe_entry_runtime_casgstatus")); ASSERT_THAT(bcc_program.perf_buffer_specs, SizeIs(1)); const auto& perf_buffer_name = bcc_program.perf_buffer_specs[0].name; const auto& perf_buffer_output = bcc_program.perf_buffer_specs[0].output; EXPECT_THAT(perf_buffer_name, "probe_output"); EXPECT_THAT(perf_buffer_output, EqualsProto( R"proto( name: "probe_output_value_t" fields { name: "tgid_" type: INT32 } fields { name: "tgid_start_time_" type: UINT64 } fields { name: "time_" type: UINT64 } fields { name: "goid_" type: INT64 } fields { name: "f1" type: INT } fields { name: "f2" type: INT } fields { name: "f3" type: INT } fields { name: "f4" type: INT } fields { name: "latency" type: INT64 } )proto")); std::vector<std::string> code_lines = absl::StrSplit(bcc_program.code, "\n"); EXPECT_THAT(code_lines, ElementsAreArray(kExpectedBCC)); } } // namespace dynamic_tracing } // namespace stirling } // namespace px
35.574279
98
0.622725
marianod92
4e2ebcd08bb7b346c63e394c3e82db0e3965a34c
16,306
cpp
C++
inetcore/mshtml/src/time/timeeng/timebase.cpp
npocmaka/Windows-Server-2003
5c6fe3db626b63a384230a1aa6b92ac416b0765f
[ "Unlicense" ]
17
2020-11-13T13:42:52.000Z
2021-09-16T09:13:13.000Z
inetcore/mshtml/src/time/timeeng/timebase.cpp
sancho1952007/Windows-Server-2003
5c6fe3db626b63a384230a1aa6b92ac416b0765f
[ "Unlicense" ]
2
2020-10-19T08:02:06.000Z
2020-10-19T08:23:18.000Z
inetcore/mshtml/src/time/timeeng/timebase.cpp
sancho1952007/Windows-Server-2003
5c6fe3db626b63a384230a1aa6b92ac416b0765f
[ "Unlicense" ]
14
2020-11-14T09:43:20.000Z
2021-08-28T08:59:57.000Z
/******************************************************************************* * * Copyright (c) 1998 Microsoft Corporation * * File: timebase.cpp * * Abstract: * * * *******************************************************************************/ #include "headers.h" #include "Container.h" #include "Node.h" #include "NodeMgr.h" DeclareTag(tagTIMESink, "TIME: Engine", "TIMESink methods"); TimeSinkList::TimeSinkList() { } TimeSinkList::~TimeSinkList() { // The add does not do a addref so we do not need to clean up // anything Assert(m_sinkList.size() == 0); } HRESULT TimeSinkList::Add(ITimeSink * sink) { Assert(sink != NULL); // TODO: Handle out of memory m_sinkList.push_back(sink); return S_OK; } void TimeSinkList::Remove(ITimeSink * sink) { Assert(sink != NULL); m_sinkList.remove(sink); } void TimeSinkList::Update(CEventList * l, DWORD dwFlags) { for (ITimeSinkList::iterator i = m_sinkList.begin(); i != m_sinkList.end(); i++) { (*i)->Update(l, dwFlags); } done: return; } // ======================= // CTimeBase // ======================= DeclareTag(tagTimeBase, "TIME: Engine", "CTimeBase methods"); CSyncArcTimeBase::CSyncArcTimeBase(CSyncArcList & tbl, CTIMENode & ptnBase, TE_TIMEPOINT tetpBase, double dblOffset) : m_tbl(tbl), m_ptnBase(&ptnBase), m_tetpBase(tetpBase), m_dblOffset(dblOffset) { #if DBG m_bAttached = false; #endif Assert(tetpBase == TE_TIMEPOINT_BEGIN || tetpBase == TE_TIMEPOINT_END); } CSyncArcTimeBase::~CSyncArcTimeBase() { #if DBG Assert(!m_bAttached); #endif } HRESULT CSyncArcTimeBase::Attach() { TraceTag((tagTimeBase, "CSyncArcTimeBase(%p)::Attach()", this)); HRESULT hr; Assert(!m_bAttached); switch(m_tetpBase) { case TE_TIMEPOINT_BEGIN: hr = m_ptnBase->AddBeginTimeSink(this); if (FAILED(hr)) { goto done; } break; case TE_TIMEPOINT_END: hr = m_ptnBase->AddEndTimeSink(this); if (FAILED(hr)) { goto done; } break; default: AssertSz(false, "Invalid time point specified"); break; } #if DBG m_bAttached = true; #endif hr = S_OK; done: if (FAILED(hr)) { Detach(); } RRETURN(hr); } void CSyncArcTimeBase::Detach() { TraceTag((tagTimeBase, "CSyncArcTimeBase(%p)::Detach()", this)); Assert(!m_bAttached || m_tbl.GetNode().IsReady()); switch (m_tetpBase) { case TE_TIMEPOINT_BEGIN: m_ptnBase->RemoveBeginTimeSink(this); break; case TE_TIMEPOINT_END: m_ptnBase->RemoveEndTimeSink(this); break; default: AssertSz(false, "Invalid begin time point specified"); break; } #if DBG m_bAttached = false; #endif done: return; } void CSyncArcTimeBase::Update(CEventList * l, DWORD dwFlags) { TraceTag((tagTimeBase, "CSyncArcTimeBase(%p)::Update(%p, %x)", this, l, dwFlags)); // We better have been attached or we are in trouble Assert(m_bAttached); // We should not have been attached if the node is not ready Assert(m_tbl.GetNode().IsReady()); // If this is a timeshift and we are not a long sync arc then // ignore the update if ((dwFlags & TS_TIMESHIFT) != 0 && !IsLongSyncArc()) { goto done; } m_tbl.Update(l, *this); done: return; } double ConvertLongSyncArc(double dblTime, CTIMENode & ptnFrom, CTIMENode & ptnTo) { TraceTag((tagTimeBase, "ConvertLongSyncArc(%g, %p, %p)", dblTime, &ptnFrom, &ptnTo)); double dblRet = dblTime; dblRet = ptnFrom.CalcGlobalTimeFromParentTime(dblRet); if (dblRet == TIME_INFINITE) { goto done; } dblRet = ptnTo.CalcParentTimeFromGlobalTimeForSyncArc(dblRet); done: return dblRet; } double CSyncArcTimeBase::GetCurrTimeBase() const { TraceTag((tagTimeBase, "CSyncArcTimeBase(%p)::GetCurrTimeBase()", this)); double dblTime = TIME_INFINITE; if (!m_tbl.GetNode().IsReady()) { goto done; } switch (m_tetpBase) { case TE_TIMEPOINT_BEGIN: dblTime = m_ptnBase->GetBeginParentTime(); break; case TE_TIMEPOINT_END: dblTime = m_ptnBase->GetEndParentTime(); break; case TE_TIMEPOINT_NONE: default: AssertSz(false, "Invalid begin time point specified"); break; } if (IsLongSyncArc()) { dblTime = ConvertLongSyncArc(dblTime, *m_ptnBase, m_tbl.GetNode()); } // Make sure we add the offset after the conversion since it is in // our local time space and not the syncarc's. dblTime += m_dblOffset; done: return dblTime; } bool CSyncArcTimeBase::IsLongSyncArc() const { Assert(m_tbl.GetNode().IsReady()); Assert(m_ptnBase); return (m_ptnBase->GetParent() != m_tbl.GetNode().GetParent()); } CSyncArcList::CSyncArcList(CTIMENode & tn, bool bBeginSink) : m_tn(tn), m_bBeginSink(bBeginSink), m_lLastCookie(0), m_bAttached(false) { } CSyncArcList::~CSyncArcList() { Assert(!m_bAttached); Clear(); } HRESULT CSyncArcList::Attach() { TraceTag((tagTimeBase, "CSyncArcList(%p)::Attach()", this)); HRESULT hr; Assert(!m_bAttached); // If we are not ready then we need to delay doing this Assert(m_tn.IsReady()); SyncArcList::iterator i; for (i = m_tbList.begin(); i != m_tbList.end(); i++) { hr = THR((*i).second->Attach()); if (FAILED(hr)) { goto done; } } for (i = m_tbOneShotList.begin(); i != m_tbOneShotList.end(); i++) { hr = THR((*i).second->Attach()); if (FAILED(hr)) { goto done; } } m_bAttached = true; hr = S_OK; done: if (FAILED(hr)) { Detach(); } RRETURN(hr); } void CSyncArcList::Detach() { TraceTag((tagTimeBase, "CSyncArcList(%p)::Detach()", this)); SyncArcList::iterator i; for (i = m_tbList.begin(); i != m_tbList.end(); i++) { (*i).second->Detach(); } for (i = m_tbOneShotList.begin(); i != m_tbOneShotList.end(); i++) { (*i).second->Detach(); } m_bAttached = false; done: return; } HRESULT CSyncArcList::Add(ISyncArc & tb, bool bOneShot, long * plCookie) { TraceTag((tagTimeBase, "CSyncArcList(%p)::Add(%p, %d)", this, &tb, bOneShot)); HRESULT hr; bool bAdded; SyncArcList & salList = bOneShot?m_tbOneShotList:m_tbList; if (plCookie != NULL) { *plCookie = 0; } if (m_bAttached) { hr = THR(tb.Attach()); if (FAILED(hr)) { goto done; } } // Pre-increment ++m_lLastCookie; // @@ ISSUE : Memory failure not detected bAdded = salList.insert(SyncArcList::value_type(m_lLastCookie, &tb)).second; if (!bAdded) { hr = E_FAIL; goto done; } if (plCookie != NULL) { *plCookie = m_lLastCookie; } hr = S_OK; done: if (FAILED(hr)) { tb.Detach(); } RRETURN1(hr, E_FAIL); } bool CSyncArcList::Remove(long lCookie, bool bDelete) { TraceTag((tagTimeBase, "CSyncArcList(%p)::Remove(%#x, %d)", this, lCookie, bDelete)); bool bRet = false; SyncArcList::iterator i; i = m_tbList.find(lCookie); if (i != m_tbList.end()) { bRet = true; (*i).second->Detach(); if (bDelete) { delete (*i).second; } m_tbList.erase(i); } else { i = m_tbOneShotList.find(lCookie); if (i != m_tbOneShotList.end()) { bRet = true; (*i).second->Detach(); if (bDelete) { delete (*i).second; } m_tbOneShotList.erase(i); } } done: return bRet; } ISyncArc * CSyncArcList::Find(long lCookie) { TraceTag((tagTimeBase, "CSyncArcList(%p)::Find(%#x)", this, lCookie)); ISyncArc * ret = NULL; SyncArcList::iterator i; i = m_tbList.find(lCookie); if (i != m_tbList.end()) { ret = (*i).second; } else { i = m_tbOneShotList.find(lCookie); if (i != m_tbOneShotList.end()) { ret = (*i).second; } } done: return ret; } bool CSyncArcList::Clear() { TraceTag((tagTimeBase, "CSyncArcList(%p)::Clear()", this)); SyncArcList::iterator i; if (m_tbList.size() == 0 && m_tbOneShotList.size() == 0) { return false; } for (i = m_tbList.begin(); i != m_tbList.end(); i++) { (*i).second->Detach(); delete (*i).second; } m_tbList.clear(); for (i = m_tbOneShotList.begin(); i != m_tbOneShotList.end(); i++) { (*i).second->Detach(); delete (*i).second; } m_tbOneShotList.clear(); return true; } bool CSyncArcList::Reset() { TraceTag((tagTimeBase, "CSyncArcList(%p)::Reset()", this)); SyncArcList::iterator i; bool bRet = (m_tbOneShotList.size() > 0); for (i = m_tbOneShotList.begin(); i != m_tbOneShotList.end(); i++) { (*i).second->Detach(); delete (*i).second; } m_tbOneShotList.clear(); return bRet; } void CSyncArcList::Update(CEventList * l, ISyncArc & tb) { TraceTag((tagTimeBase, "CSyncArcList(%p)::Update(%p, %p)", this, l, &tb)); // We better have been attached or we are in trouble Assert(m_bAttached); // We should not have been attached if the node is not ready Assert(m_tn.IsReady()); m_tn.SyncArcUpdate(l, m_bBeginSink, tb); done: return; } void CSyncArcList::GetBounds(double dblTime, bool bInclusive, bool bStrict, bool bIncludeOneShot, bool bOneShotInclusive, double * pdblLower, double * pdblUpper) const { TraceTag((tagTimeBase, "CSyncArcList(%p)::GetBounds(%g, %d, %d, %d, %d)", this, dblTime, bInclusive, bStrict, bIncludeOneShot, bOneShotInclusive)); double l; double u; SyncArcList::iterator i; if (m_tbList.size() == 0 && ( m_tbOneShotList.size() == 0 || !bIncludeOneShot)) { l = TIME_INFINITE; u = TIME_INFINITE; goto done; } l = TIME_INFINITE; u = -TIME_INFINITE; for (i = m_tbList.begin(); i != m_tbList.end(); i++) { double t = (*i).second->GetCurrTimeBase(); if (bInclusive && t == dblTime) { l = t; u = t; goto done; } if (l < dblTime) { if (t > l && t < dblTime) { l = t; } } else { if (t < l) { l = t; } } if (u > dblTime) { if (t < u && t > dblTime) { u = t; } } else { if (t > u) { u = t; } } } if (bIncludeOneShot) { for (i = m_tbOneShotList.begin(); i != m_tbOneShotList.end(); i++) { double t = (*i).second->GetCurrTimeBase(); if (bOneShotInclusive && t == dblTime) { l = t; u = t; goto done; } if (l < dblTime) { if (t > l && t < dblTime) { l = t; } } else { if (t < l) { l = t; } } if (u > dblTime) { if (t < u && t > dblTime) { u = t; } } else { if (t > u) { u = t; } } } } if (bStrict) { if (l > dblTime || (l == dblTime && !bInclusive)) { l = TIME_INFINITE; } if (u < dblTime || (u == dblTime && !bInclusive)) { u = TIME_INFINITE; } } Assert(u != -TIME_INFINITE); done: if (NULL != pdblLower) { *pdblLower = l; } if (NULL != pdblUpper) { *pdblUpper = u; } } void CSyncArcList::GetSortedSet(DoubleSet & ds, bool bIncludeOneShot) { TraceTag((tagTimeBase, "CSyncArcList(%p)::GetSortedSet(%p, %d)", this, &ds, bIncludeOneShot)); SyncArcList::iterator i; for (i = m_tbList.begin(); i != m_tbList.end(); i++) { double t = (*i).second->GetCurrTimeBase(); ds.insert(t); } if (bIncludeOneShot) { for (i = m_tbOneShotList.begin(); i != m_tbOneShotList.end(); i++) { double t = (*i).second->GetCurrTimeBase(); ds.insert(t); } } } bool CSyncArcList::UpdateFromLongSyncArcs(CEventList * l) { TraceTag((tagTimeBase, "CSyncArcList(%p)::UpdateFromLongSyncArcs(%p)", this, l)); bool bRet = false; SyncArcList::iterator i; for (i = m_tbList.begin(); i != m_tbList.end(); i++) { if ((*i).second->IsLongSyncArc()) { bRet = true; Update(l, *(*i).second); } } // TODO: Currently these cannot be sync arcs so we could just not // make the call for (i = m_tbOneShotList.begin(); i != m_tbOneShotList.end(); i++) { if ((*i).second->IsLongSyncArc()) { bRet = true; Update(l, *(*i).second); } } done: return bRet; }
19.669481
82
0.436404
npocmaka
4e2fed4cb2eed30a05f51ba6d5ff98862c15acfc
1,551
cpp
C++
src/Algorithms/HypoTestPlaceHolder.cpp
blengerich/jenkins_test
512aec681577063e3d68f699d19f53374e59585a
[ "MIT" ]
24
2016-10-20T00:36:31.000Z
2020-09-06T16:40:52.000Z
src/Algorithms/HypoTestPlaceHolder.cpp
blengerich/jenkins_test
512aec681577063e3d68f699d19f53374e59585a
[ "MIT" ]
44
2016-11-11T22:41:28.000Z
2021-01-04T21:55:57.000Z
src/Algorithms/HypoTestPlaceHolder.cpp
blengerich/jenkins_test
512aec681577063e3d68f699d19f53374e59585a
[ "MIT" ]
8
2017-02-01T09:19:42.000Z
2021-11-28T14:40:43.000Z
// // Created by haohanwang on 8/27/16. // #include "HypoTestPlaceHolder.h" HypoTestPlaceHolder::HypoTestPlaceHolder() { model = shared_ptr<StatsBasic>(nullptr); } HypoTestPlaceHolder::HypoTestPlaceHolder(const unordered_map<string, string>& opts) { model = shared_ptr<StatsBasic>(nullptr); } float HypoTestPlaceHolder::getProgress() { if (model.get() == nullptr){ return 0; } else { progress = model->getProgress(); return progress; } } bool HypoTestPlaceHolder::getIsRunning() { if (model.get() == nullptr){ return true; } else{ isRunning = model->getIsRunning(); return isRunning; } } void HypoTestPlaceHolder::stop() { if (model.get() == nullptr){ } else{ model->stop(); } } void HypoTestPlaceHolder::run(shared_ptr<StatsBasic> m) { model = m; model->setUpRun(); model->run(); model->finishRun(); } void HypoTestPlaceHolder::run(shared_ptr<Chi2Test> m) { model = m; model->setUpRun(); model->run(); model->finishRun(); } void HypoTestPlaceHolder::run(shared_ptr<FisherTest> m) { model = m; model->setUpRun(); model->run(); model->finishRun(); } void HypoTestPlaceHolder::run(shared_ptr<WaldTest> m) { model = m; model->setUpRun(); model->run(); model->finishRun(); } void HypoTestPlaceHolder::setUpRun() { isRunning = true; progress = 0.0; shouldStop = false; } void HypoTestPlaceHolder::finishRun() { isRunning = false; progress = 1.0; }
19.148148
85
0.622179
blengerich
4e30a9e707bf3985b19007495a623f8a07d063ca
972
cpp
C++
Online Judges/UVA/10227/3464845_AC_16ms_0kB.cpp
moni-roy/COPC
f5918304815413c18574ef4af2e23a604bd9f704
[ "MIT" ]
4
2017-02-20T17:41:14.000Z
2019-07-15T14:15:34.000Z
Online Judges/UVA/10227/3464845_AC_16ms_0kB.cpp
moni-roy/COPC
f5918304815413c18574ef4af2e23a604bd9f704
[ "MIT" ]
null
null
null
Online Judges/UVA/10227/3464845_AC_16ms_0kB.cpp
moni-roy/COPC
f5918304815413c18574ef4af2e23a604bd9f704
[ "MIT" ]
null
null
null
#include <bits/stdc++.h> using namespace std; int t,x,y,ans,p,T,par[1000],sv[110][110]; char s[100]; int FND(int p) { if(p==par[p]) return p; return par[p]=FND(par[p]); } void make_set(int i,int j) { int u=FND(i); int v=FND(j); if(v!=u) { ans--; par[v]=u; } } bool same(int i,int j) { for(int k=0;k<T;k++) { if(sv[i][k]!=sv[j][k]) return false; } return true; } int main() { cin>>t; while(t--) { memset(sv,0,sizeof sv); cin>>p>>T; getchar(); for(int i=0;i<p;i++) par[i]=i; while(gets(s)&&sscanf(s,"%d%d",&x,&y)==2) { sv[x-1][y-1]=1; } ans=p; for(int i=0;i<p-1;i++) { for(int j=i+1;j<p;j++) { if(same(i,j)) { make_set(i,j); } } } cout<<ans<<endl; if(t) cout<<endl; } }
17.357143
49
0.383745
moni-roy
4e34d855db70714222d6fb1ef64c5fe640526ab3
4,946
cc
C++
CalibTracker/SiStripCommon/plugins/PrescaleEventFilter.cc
NTrevisani/cmssw
a212a27526f34eb9507cf8b875c93896e6544781
[ "Apache-2.0" ]
2
2017-09-29T13:32:51.000Z
2019-01-31T00:40:58.000Z
CalibTracker/SiStripCommon/plugins/PrescaleEventFilter.cc
NTrevisani/cmssw
a212a27526f34eb9507cf8b875c93896e6544781
[ "Apache-2.0" ]
26
2018-10-30T12:47:58.000Z
2022-03-29T08:39:00.000Z
CalibTracker/SiStripCommon/plugins/PrescaleEventFilter.cc
NTrevisani/cmssw
a212a27526f34eb9507cf8b875c93896e6544781
[ "Apache-2.0" ]
3
2017-06-07T15:22:28.000Z
2019-02-28T20:48:30.000Z
// -*- C++ -*- // // Package: CalibTracker/SiStripCommon // Class: PrescaleEventFilter // /**\class PrescaleEventFilter PrescaleEventFilter.cc CalibTracker/SiStripCommon/plugins/PrescaleEventFilter.cc Description: Simple class to prescale events entering the Strip Tracker Calibration Tree Implementation: Largely copied from HLTrigger/HLTcore/plugins/HLTPrescaler.cc, without the need to specify a specific trigger path */ // // Original Author: Marco Musich // Created: Wed, 29 Nov 2017 15:27:07 GMT // // // system include files #include <memory> // user include files #include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Framework/interface/stream/EDFilter.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/Utilities/interface/StreamID.h" namespace prescale { struct Efficiency { Efficiency() : eventCount_(0), acceptCount_(0) {} mutable std::atomic<unsigned int> eventCount_; mutable std::atomic<unsigned int> acceptCount_; }; } // namespace prescale // // class declaration // class PrescaleEventFilter : public edm::stream::EDFilter<edm::GlobalCache<prescale::Efficiency> > { public: explicit PrescaleEventFilter(edm::ParameterSet const& iConfig, const prescale::Efficiency* efficiency); ~PrescaleEventFilter() override; static std::unique_ptr<prescale::Efficiency> initializeGlobalCache(edm::ParameterSet const&) { return std::unique_ptr<prescale::Efficiency>(new prescale::Efficiency()); }; static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); static void globalEndJob(const prescale::Efficiency* efficiency); private: void beginStream(edm::StreamID) override; bool filter(edm::Event&, const edm::EventSetup&) override; void endStream() override; // ----------member data --------------------------- /// accept one in prescaleFactor_; 0 means never to accept an event unsigned int prescaleFactor_; /// event counter unsigned int eventCount_; /// accept counter unsigned int acceptCount_; /// initial offset unsigned int offsetCount_; unsigned int offsetPhase_; /// check for (re)initialization of the prescale bool newLumi_; /// "seed" used to initialize the prescale counter static const unsigned int prescaleSeed_ = 65537; }; // // constructors and destructor // PrescaleEventFilter::PrescaleEventFilter(const edm::ParameterSet& iConfig, const prescale::Efficiency* efficiency) : prescaleFactor_(iConfig.getParameter<unsigned int>("prescale")), eventCount_(0), acceptCount_(0), offsetCount_(0), offsetPhase_(iConfig.getParameter<unsigned int>("offset")) { //now do what ever initialization is needed } PrescaleEventFilter::~PrescaleEventFilter() {} // // member functions // // ------------ method called on each new Event ------------ bool PrescaleEventFilter::filter(edm::Event& iEvent, const edm::EventSetup& iSetup) { using namespace edm; bool needsInit(eventCount_ == 0); if (needsInit && (prescaleFactor_ != 0)) { // initialize the prescale counter to the first event number multiplied by a big "seed" offsetCount_ = ((uint64_t)(iEvent.id().event() + offsetPhase_) * prescaleSeed_) % prescaleFactor_; } const bool result((prescaleFactor_ == 0) ? false : ((eventCount_ + offsetCount_) % prescaleFactor_ == 0)); ++eventCount_; if (result) ++acceptCount_; return result; } // ------------ method called once each stream before processing any runs, lumis or events ------------ void PrescaleEventFilter::beginStream(edm::StreamID) {} //_____________________________________________________________________________ void PrescaleEventFilter::endStream() { //since these are std::atomic, it is safe to increment them // even if multiple endStreams are being called. globalCache()->eventCount_ += eventCount_; globalCache()->acceptCount_ += acceptCount_; return; } //_____________________________________________________________________________ void PrescaleEventFilter::globalEndJob(const prescale::Efficiency* efficiency) { unsigned int accept(efficiency->acceptCount_); unsigned int event(efficiency->eventCount_); edm::LogInfo("PrescaleSummary") << accept << "/" << event << " (" << 100. * accept / static_cast<double>(std::max(1u, event)) << "% of events accepted)."; return; } // ------------ method fills 'descriptions' with the allowed parameters for the module ------------ void PrescaleEventFilter::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { edm::ParameterSetDescription desc; desc.add<unsigned int>("prescale", 1); desc.add<unsigned int>("offset", 0); descriptions.add("prescaleEvent", desc); } //define this as a plug-in DEFINE_FWK_MODULE(PrescaleEventFilter);
32.754967
119
0.718358
NTrevisani
4e3543d791d949534f562cd11bd3278e14a298d5
2,771
inl
C++
dist/include/Fuji/MFHashList.inl
TurkeyMan/fuji
afd6a26c710ce23965b088ad158fe916d6a1a091
[ "BSD-2-Clause" ]
35
2015-01-19T22:07:48.000Z
2022-02-21T22:17:53.000Z
dist/include/Fuji/MFHashList.inl
TurkeyMan/fuji
afd6a26c710ce23965b088ad158fe916d6a1a091
[ "BSD-2-Clause" ]
1
2022-02-23T09:34:15.000Z
2022-02-23T09:34:15.000Z
dist/include/Fuji/MFHashList.inl
TurkeyMan/fuji
afd6a26c710ce23965b088ad158fe916d6a1a091
[ "BSD-2-Clause" ]
4
2015-05-11T03:31:35.000Z
2018-09-27T04:55:57.000Z
template<class T> const T* MFHashList<T>::operator[](const char *pHashString) const { uint32 crc = MFUtil_CrcString(pHashBuffer); uint32 id = crc%listSize; //..... } template<class T> T* MFHashList<T>::operator[](const char *pHashString) { uint32 crc = MFUtil_CrcString(pHashBuffer); uint32 id = crc%listSize; //..... } template<class T> void MFHashList<T>::Init(const char *pGroupName, uint32 maxElements) { pList = (MFHashListItem*)MFHeap_Alloc(sizeof(T)*maxElements); MFZeroMemory(pList, sizeof(T)*maxElements); } template<class T> void MFHashList<T>::Deinit() { MFHeap_Free(pList); pList = NULL; } template<class T> T* MFHashList<T>::Create(T* pItem, const char *pHashBuffer, int len = -1) { uint32 crc = len == -1 ? MFUtil_CrcString(pHashBuffer) : MFUtil_Crc(pHashBuffer, len); uint32 id = crc%listSize; //..... } template<class T> void MFHashList<T>::Destroy(const char *pHashBuffer, int len = -1) { uint32 crc = len == -1 ? MFUtil_CrcString(pHashBuffer) : MFUtil_Crc(pHashBuffer, len); uint32 id = crc%listSize; //..... // NOTE: destroying an item may make following items that were meant for this key inaccessable.. following items should be shuffled back into this space.. } template<class T> void MFHashList<T>::Destroy(uint32 hash) { uint32 id = hash%listSize; //..... // NOTE: destroying an item may make following items that were meant for this key inaccessable.. following items should be shuffled back into this space.. } template<class T> void MFHashList<T>::DestroyItem(T* pItem) { for(int a=0; a<listSize; a++) { if(pList[a].pItem == pItem) { pList[a].pItem = NULL; pList[a].hash = 0; break; } } // NOTE: destroying an item may make following items that were meant for this key inaccessable.. following items should be shuffled back into this space.. } template<class T> T* MFHashList<T>::Find(const char *pHashBuffer, int len = -1) { uint32 crc = len == -1 ? MFUtil_CrcString(pHashBuffer) : MFUtil_Crc(pHashBuffer, len); uint32 id = crc%listSize; uint32 i = id; while(pList[i].pItem) { if(crc == pList[id].hash) return pList[id].pItem; ++i; if(i == numItems) i==0; if(i == id) return NULL; } return NULL; } template<class T> void MFHashList<T>::Clear() { for(int a=0; a<listSize; a++) { pList[a].pItem = NULL; } numItems = 0; } template<class T> int MFHashList<T>::GetNumItems() { return numItems; } template<class T> int MFHashList<T>::GetMaxItems() { return listSize; } template<class T> bool MFHashList<T>::IsFull() { return numItems == listSize; } template<class T> bool MFHashList<T>::IsEmpty() { return numItems == 0; }
20.679104
156
0.653555
TurkeyMan
4e359c3dd3190a3100588fa08871b8498f7dff85
86,264
cpp
C++
tools/bpp-phyl/src/Bpp/Phyl/Mapping/SubstitutionMappingTools.cpp
danydoerr/spp_dcj
1ab9dacb1f0dc34a3ebbeed9e74226a9a53c297a
[ "MIT" ]
2
2021-08-24T16:03:30.000Z
2022-03-18T14:52:43.000Z
tools/bpp-phyl/src/Bpp/Phyl/Mapping/SubstitutionMappingTools.cpp
danydoerr/spp_dcj
1ab9dacb1f0dc34a3ebbeed9e74226a9a53c297a
[ "MIT" ]
null
null
null
tools/bpp-phyl/src/Bpp/Phyl/Mapping/SubstitutionMappingTools.cpp
danydoerr/spp_dcj
1ab9dacb1f0dc34a3ebbeed9e74226a9a53c297a
[ "MIT" ]
null
null
null
// // File: SubstitutionMappingTools.cpp // Created by: Julien Dutheil // Created on: Wed Apr 5 13:04 2006 // /* Copyright or © or Copr. Bio++ Development Team, (November 16, 2004, 2005, 2006) This software is a computer program whose purpose is to provide classes for phylogenetic data analysis. This software is governed by the CeCILL license under French law and abiding by the rules of distribution of free software. You can use, modify and/ or redistribute the software under the terms of the CeCILL license as circulated by CEA, CNRS and INRIA at the following URL "http://www.cecill.info". As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the successive licensors have only limited liability. In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or developing or reproducing the software by the user in light of its specific status of free software, that may mean that it is complicated to manipulate, and that also therefore means that it is reserved for developers and experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the software's suitability as regards their requirements in conditions enabling the security of their systems and/or data to be ensured and, more generally, to use and operate it in the same conditions as regards security. The fact that you are presently reading this means that you have had knowledge of the CeCILL license and that you accept its terms. */ #include "SubstitutionMappingTools.h" #include "UniformizationSubstitutionCount.h" #include "DecompositionReward.h" #include "ProbabilisticRewardMapping.h" #include "RewardMappingTools.h" #include "../Likelihood/DRTreeLikelihoodTools.h" #include "../Likelihood/MarginalAncestralStateReconstruction.h" #include <Bpp/Text/TextTools.h> #include <Bpp/App/ApplicationTools.h> #include <Bpp/Numeric/Matrix/MatrixTools.h> #include <Bpp/Numeric/DataTable.h> #include <Bpp/Seq/AlphabetIndex/UserAlphabetIndex1.h> using namespace bpp; // From the STL: #include <iomanip> using namespace std; /******************************************************************************/ ProbabilisticSubstitutionMapping* SubstitutionMappingTools::computeSubstitutionVectors( const DRTreeLikelihood& drtl, const vector<int>& nodeIds, SubstitutionCount& substitutionCount, bool verbose) { // Preamble: if (!drtl.isInitialized()) throw Exception("SubstitutionMappingTools::computeSubstitutionVectors(). Likelihood object is not initialized."); // A few variables we'll need: const TreeTemplate<Node> tree(drtl.getTree()); const SiteContainer* sequences = drtl.getData(); const DiscreteDistribution* rDist = drtl.getRateDistribution(); size_t nbSites = sequences->getNumberOfSites(); size_t nbDistinctSites = drtl.getLikelihoodData()->getNumberOfDistinctSites(); size_t nbStates = sequences->getAlphabet()->getSize(); size_t nbClasses = rDist->getNumberOfCategories(); size_t nbTypes = substitutionCount.getNumberOfSubstitutionTypes(); vector<const Node*> nodes = tree.getNodes(); const vector<size_t>* rootPatternLinks = &drtl.getLikelihoodData()->getRootArrayPositions(); nodes.pop_back(); // Remove root node. size_t nbNodes = nodes.size(); // We create a new ProbabilisticSubstitutionMapping object: ProbabilisticSubstitutionMapping* substitutions = new ProbabilisticSubstitutionMapping(tree, &substitutionCount, nbSites); // Store likelihood for each rate for each site: VVVdouble lik; drtl.computeLikelihoodAtNode(tree.getRootId(), lik); Vdouble Lr(nbDistinctSites, 0); Vdouble rcProbs = rDist->getProbabilities(); Vdouble rcRates = rDist->getCategories(); for (size_t i = 0; i < nbDistinctSites; i++) { VVdouble* lik_i = &lik[i]; for (size_t c = 0; c < nbClasses; c++) { Vdouble* lik_i_c = &(*lik_i)[c]; double rc = rDist->getProbability(c); for (size_t s = 0; s < nbStates; s++) { Lr[i] += (*lik_i_c)[s] * rc; } } } // Compute the number of substitutions for each class and each branch in the tree: if (verbose) ApplicationTools::displayTask("Compute joint node-pairs likelihood", true); for (size_t l = 0; l < nbNodes; ++l) { // For each node, const Node* currentNode = nodes[l]; if (nodeIds.size() > 0 && !VectorTools::contains(nodeIds, currentNode->getId())) continue; const Node* father = currentNode->getFather(); double d = currentNode->getDistanceToFather(); if (verbose) ApplicationTools::displayGauge(l, nbNodes - 1); VVdouble substitutionsForCurrentNode(nbDistinctSites); for (size_t i = 0; i < nbDistinctSites; ++i) { substitutionsForCurrentNode[i].resize(nbTypes); } // Now we've got to compute likelihoods in a smart manner... ;) VVVdouble likelihoodsFatherConstantPart(nbDistinctSites); for (size_t i = 0; i < nbDistinctSites; i++) { VVdouble* likelihoodsFatherConstantPart_i = &likelihoodsFatherConstantPart[i]; likelihoodsFatherConstantPart_i->resize(nbClasses); for (size_t c = 0; c < nbClasses; c++) { Vdouble* likelihoodsFatherConstantPart_i_c = &(*likelihoodsFatherConstantPart_i)[c]; likelihoodsFatherConstantPart_i_c->resize(nbStates); double rc = rDist->getProbability(c); for (size_t s = 0; s < nbStates; s++) { // (* likelihoodsFatherConstantPart_i_c)[s] = rc * model->freq(s); // freq is already accounted in the array (*likelihoodsFatherConstantPart_i_c)[s] = rc; } } } // First, what will remain constant: size_t nbSons = father->getNumberOfSons(); for (size_t n = 0; n < nbSons; n++) { const Node* currentSon = father->getSon(n); if (currentSon->getId() != currentNode->getId()) { const VVVdouble* likelihoodsFather_son = &drtl.getLikelihoodData()->getLikelihoodArray(father->getId(), currentSon->getId()); // Now iterate over all site partitions: unique_ptr<TreeLikelihood::ConstBranchModelIterator> mit(drtl.getNewBranchModelIterator(currentSon->getId())); VVVdouble pxy; bool first; while (mit->hasNext()) { TreeLikelihood::ConstBranchModelDescription* bmd = mit->next(); unique_ptr<TreeLikelihood::SiteIterator> sit(bmd->getNewSiteIterator()); first = true; while (sit->hasNext()) { size_t i = sit->next(); // We retrieve the transition probabilities for this site partition: if (first) { pxy = drtl.getTransitionProbabilitiesPerRateClass(currentSon->getId(), i); first = false; } const VVdouble* likelihoodsFather_son_i = &(*likelihoodsFather_son)[i]; VVdouble* likelihoodsFatherConstantPart_i = &likelihoodsFatherConstantPart[i]; for (size_t c = 0; c < nbClasses; c++) { const Vdouble* likelihoodsFather_son_i_c = &(*likelihoodsFather_son_i)[c]; Vdouble* likelihoodsFatherConstantPart_i_c = &(*likelihoodsFatherConstantPart_i)[c]; VVdouble* pxy_c = &pxy[c]; for (size_t x = 0; x < nbStates; x++) { Vdouble* pxy_c_x = &(*pxy_c)[x]; double likelihood = 0.; for (size_t y = 0; y < nbStates; y++) { likelihood += (*pxy_c_x)[y] * (*likelihoodsFather_son_i_c)[y]; } (*likelihoodsFatherConstantPart_i_c)[x] *= likelihood; } } } } } } if (father->hasFather()) { const Node* currentSon = father->getFather(); const VVVdouble* likelihoodsFather_son = &drtl.getLikelihoodData()->getLikelihoodArray(father->getId(), currentSon->getId()); // Now iterate over all site partitions: unique_ptr<TreeLikelihood::ConstBranchModelIterator> mit(drtl.getNewBranchModelIterator(father->getId())); VVVdouble pxy; bool first; while (mit->hasNext()) { TreeLikelihood::ConstBranchModelDescription* bmd = mit->next(); unique_ptr<TreeLikelihood::SiteIterator> sit(bmd->getNewSiteIterator()); first = true; while (sit->hasNext()) { size_t i = sit->next(); // We retrieve the transition probabilities for this site partition: if (first) { pxy = drtl.getTransitionProbabilitiesPerRateClass(father->getId(), i); first = false; } const VVdouble* likelihoodsFather_son_i = &(*likelihoodsFather_son)[i]; VVdouble* likelihoodsFatherConstantPart_i = &likelihoodsFatherConstantPart[i]; for (size_t c = 0; c < nbClasses; c++) { const Vdouble* likelihoodsFather_son_i_c = &(*likelihoodsFather_son_i)[c]; Vdouble* likelihoodsFatherConstantPart_i_c = &(*likelihoodsFatherConstantPart_i)[c]; VVdouble* pxy_c = &pxy[c]; for (size_t x = 0; x < nbStates; x++) { double likelihood = 0.; for (size_t y = 0; y < nbStates; y++) { Vdouble* pxy_c_x = &(*pxy_c)[y]; likelihood += (*pxy_c_x)[x] * (*likelihoodsFather_son_i_c)[y]; } (*likelihoodsFatherConstantPart_i_c)[x] *= likelihood; } } } } } else { // Account for root frequencies: for (size_t i = 0; i < nbDistinctSites; i++) { vector<double> freqs = drtl.getRootFrequencies(i); VVdouble* likelihoodsFatherConstantPart_i = &likelihoodsFatherConstantPart[i]; for (size_t c = 0; c < nbClasses; c++) { Vdouble* likelihoodsFatherConstantPart_i_c = &(*likelihoodsFatherConstantPart_i)[c]; for (size_t x = 0; x < nbStates; x++) { (*likelihoodsFatherConstantPart_i_c)[x] *= freqs[x]; } } } } // Then, we deal with the node of interest. // We first average upon 'y' to save computations, and then upon 'x'. // ('y' is the state at 'node' and 'x' the state at 'father'.) // Iterate over all site partitions: const VVVdouble* likelihoodsFather_node = &(drtl.getLikelihoodData()->getLikelihoodArray(father->getId(), currentNode->getId())); unique_ptr<TreeLikelihood::ConstBranchModelIterator> mit(drtl.getNewBranchModelIterator(currentNode->getId())); VVVdouble pxy; bool first; while (mit->hasNext()) { TreeLikelihood::ConstBranchModelDescription* bmd = mit->next(); substitutionCount.setSubstitutionModel(bmd->getSubstitutionModel()); // compute all nxy first: VVVVdouble nxy(nbClasses); for (size_t c = 0; c < nbClasses; ++c) { VVVdouble* nxy_c = &nxy[c]; double rc = rcRates[c]; nxy_c->resize(nbTypes); for (size_t t = 0; t < nbTypes; ++t) { VVdouble* nxy_c_t = &(*nxy_c)[t]; Matrix<double>* nijt = substitutionCount.getAllNumbersOfSubstitutions(d * rc, t + 1); nxy_c_t->resize(nbStates); for (size_t x = 0; x < nbStates; ++x) { Vdouble* nxy_c_t_x = &(*nxy_c_t)[x]; nxy_c_t_x->resize(nbStates); for (size_t y = 0; y < nbStates; ++y) { (*nxy_c_t_x)[y] = (*nijt)(x, y); } } delete nijt; } } // Now loop over sites: unique_ptr<TreeLikelihood::SiteIterator> sit(bmd->getNewSiteIterator()); first = true; while (sit->hasNext()) { size_t i = sit->next(); // We retrieve the transition probabilities and substitution counts for this site partition: if (first) { pxy = drtl.getTransitionProbabilitiesPerRateClass(currentNode->getId(), i); first = false; } const VVdouble* likelihoodsFather_node_i = &(*likelihoodsFather_node)[i]; VVdouble* likelihoodsFatherConstantPart_i = &likelihoodsFatherConstantPart[i]; for (size_t c = 0; c < nbClasses; ++c) { const Vdouble* likelihoodsFather_node_i_c = &(*likelihoodsFather_node_i)[c]; Vdouble* likelihoodsFatherConstantPart_i_c = &(*likelihoodsFatherConstantPart_i)[c]; const VVdouble* pxy_c = &pxy[c]; VVVdouble* nxy_c = &nxy[c]; for (size_t x = 0; x < nbStates; ++x) { double* likelihoodsFatherConstantPart_i_c_x = &(*likelihoodsFatherConstantPart_i_c)[x]; const Vdouble* pxy_c_x = &(*pxy_c)[x]; for (size_t y = 0; y < nbStates; ++y) { double likelihood_cxy = (*likelihoodsFatherConstantPart_i_c_x) * (*pxy_c_x)[y] * (*likelihoodsFather_node_i_c)[y]; for (size_t t = 0; t < nbTypes; ++t) { // Now the vector computation: substitutionsForCurrentNode[i][t] += likelihood_cxy * (*nxy_c)[t][x][y]; // <------------> <---------------> // Posterior probability | | // for site i and rate class c * | | // likelihood for this site----------------+ | // | // Substitution function for site i and rate class c----------+ } } } } } } // Now we just have to copy the substitutions into the result vector: for (size_t i = 0; i < nbSites; ++i) { for (size_t t = 0; t < nbTypes; ++t) { (*substitutions)(l, i, t) = substitutionsForCurrentNode[(*rootPatternLinks)[i]][t] / Lr[(*rootPatternLinks)[i]]; } } } if (verbose) { if (ApplicationTools::message) *ApplicationTools::message << " "; ApplicationTools::displayTaskDone(); } return substitutions; } /******************************************************************************/ ProbabilisticSubstitutionMapping* SubstitutionMappingTools::computeSubstitutionVectors( const DRTreeLikelihood& drtl, const SubstitutionModelSet& modelSet, const vector<int>& nodeIds, SubstitutionCount& substitutionCount, bool verbose) { // Preamble: if (!drtl.isInitialized()) throw Exception("SubstitutionMappingTools::computeSubstitutionVectors(). Likelihood object is not initialized."); // A few variables we'll need: const TreeTemplate<Node> tree(drtl.getTree()); const SiteContainer* sequences = drtl.getData(); const DiscreteDistribution* rDist = drtl.getRateDistribution(); size_t nbSites = sequences->getNumberOfSites(); size_t nbDistinctSites = drtl.getLikelihoodData()->getNumberOfDistinctSites(); size_t nbStates = sequences->getAlphabet()->getSize(); size_t nbClasses = rDist->getNumberOfCategories(); size_t nbTypes = substitutionCount.getNumberOfSubstitutionTypes(); vector<const Node*> nodes = tree.getNodes(); const vector<size_t>* rootPatternLinks = &drtl.getLikelihoodData()->getRootArrayPositions(); nodes.pop_back(); // Remove root node. size_t nbNodes = nodes.size(); // We create a new ProbabilisticSubstitutionMapping object: ProbabilisticSubstitutionMapping* substitutions = new ProbabilisticSubstitutionMapping(tree, &substitutionCount, nbSites); // Store likelihood for each rate for each site: VVVdouble lik; drtl.computeLikelihoodAtNode(tree.getRootId(), lik); Vdouble Lr(nbDistinctSites, 0); Vdouble rcProbs = rDist->getProbabilities(); Vdouble rcRates = rDist->getCategories(); for (size_t i = 0; i < nbDistinctSites; i++) { VVdouble* lik_i = &lik[i]; for (size_t c = 0; c < nbClasses; c++) { Vdouble* lik_i_c = &(*lik_i)[c]; double rc = rDist->getProbability(c); for (size_t s = 0; s < nbStates; s++) { Lr[i] += (*lik_i_c)[s] * rc; } } } // Compute the number of substitutions for each class and each branch in the tree: if (verbose) ApplicationTools::displayTask("Compute joint node-pairs likelihood", true); for (size_t l = 0; l < nbNodes; ++l) { // For each node, const Node* currentNode = nodes[l]; if (nodeIds.size() > 0 && !VectorTools::contains(nodeIds, currentNode->getId())) continue; const Node* father = currentNode->getFather(); double d = currentNode->getDistanceToFather(); if (verbose) ApplicationTools::displayGauge(l, nbNodes - 1); VVdouble substitutionsForCurrentNode(nbDistinctSites); for (size_t i = 0; i < nbDistinctSites; ++i) { substitutionsForCurrentNode[i].resize(nbTypes); } // Now we've got to compute likelihoods in a smart manner... ;) VVVdouble likelihoodsFatherConstantPart(nbDistinctSites); for (size_t i = 0; i < nbDistinctSites; i++) { VVdouble* likelihoodsFatherConstantPart_i = &likelihoodsFatherConstantPart[i]; likelihoodsFatherConstantPart_i->resize(nbClasses); for (size_t c = 0; c < nbClasses; c++) { Vdouble* likelihoodsFatherConstantPart_i_c = &(*likelihoodsFatherConstantPart_i)[c]; likelihoodsFatherConstantPart_i_c->resize(nbStates); double rc = rDist->getProbability(c); for (size_t s = 0; s < nbStates; s++) { // (* likelihoodsFatherConstantPart_i_c)[s] = rc * model->freq(s); // freq is already accounted in the array (*likelihoodsFatherConstantPart_i_c)[s] = rc; } } } // First, what will remain constant: size_t nbSons = father->getNumberOfSons(); for (size_t n = 0; n < nbSons; n++) { const Node* currentSon = father->getSon(n); if (currentSon->getId() != currentNode->getId()) { const VVVdouble* likelihoodsFather_son = &drtl.getLikelihoodData()->getLikelihoodArray(father->getId(), currentSon->getId()); // Now iterate over all site partitions: unique_ptr<TreeLikelihood::ConstBranchModelIterator> mit(drtl.getNewBranchModelIterator(currentSon->getId())); VVVdouble pxy; bool first; while (mit->hasNext()) { TreeLikelihood::ConstBranchModelDescription* bmd = mit->next(); unique_ptr<TreeLikelihood::SiteIterator> sit(bmd->getNewSiteIterator()); first = true; while (sit->hasNext()) { size_t i = sit->next(); // We retrieve the transition probabilities for this site partition: if (first) { pxy = drtl.getTransitionProbabilitiesPerRateClass(currentSon->getId(), i); first = false; } const VVdouble* likelihoodsFather_son_i = &(*likelihoodsFather_son)[i]; VVdouble* likelihoodsFatherConstantPart_i = &likelihoodsFatherConstantPart[i]; for (size_t c = 0; c < nbClasses; c++) { const Vdouble* likelihoodsFather_son_i_c = &(*likelihoodsFather_son_i)[c]; Vdouble* likelihoodsFatherConstantPart_i_c = &(*likelihoodsFatherConstantPart_i)[c]; VVdouble* pxy_c = &pxy[c]; for (size_t x = 0; x < nbStates; x++) { Vdouble* pxy_c_x = &(*pxy_c)[x]; double likelihood = 0.; for (size_t y = 0; y < nbStates; y++) { likelihood += (*pxy_c_x)[y] * (*likelihoodsFather_son_i_c)[y]; } (*likelihoodsFatherConstantPart_i_c)[x] *= likelihood; } } } } } } if (father->hasFather()) { const Node* currentSon = father->getFather(); const VVVdouble* likelihoodsFather_son = &drtl.getLikelihoodData()->getLikelihoodArray(father->getId(), currentSon->getId()); // Now iterate over all site partitions: unique_ptr<TreeLikelihood::ConstBranchModelIterator> mit(drtl.getNewBranchModelIterator(father->getId())); VVVdouble pxy; bool first; while (mit->hasNext()) { TreeLikelihood::ConstBranchModelDescription* bmd = mit->next(); unique_ptr<TreeLikelihood::SiteIterator> sit(bmd->getNewSiteIterator()); first = true; while (sit->hasNext()) { size_t i = sit->next(); // We retrieve the transition probabilities for this site partition: if (first) { pxy = drtl.getTransitionProbabilitiesPerRateClass(father->getId(), i); first = false; } const VVdouble* likelihoodsFather_son_i = &(*likelihoodsFather_son)[i]; VVdouble* likelihoodsFatherConstantPart_i = &likelihoodsFatherConstantPart[i]; for (size_t c = 0; c < nbClasses; c++) { const Vdouble* likelihoodsFather_son_i_c = &(*likelihoodsFather_son_i)[c]; Vdouble* likelihoodsFatherConstantPart_i_c = &(*likelihoodsFatherConstantPart_i)[c]; VVdouble* pxy_c = &pxy[c]; for (size_t x = 0; x < nbStates; x++) { double likelihood = 0.; for (size_t y = 0; y < nbStates; y++) { Vdouble* pxy_c_x = &(*pxy_c)[y]; likelihood += (*pxy_c_x)[x] * (*likelihoodsFather_son_i_c)[y]; } (*likelihoodsFatherConstantPart_i_c)[x] *= likelihood; } } } } } else { // Account for root frequencies: for (size_t i = 0; i < nbDistinctSites; i++) { vector<double> freqs = drtl.getRootFrequencies(i); VVdouble* likelihoodsFatherConstantPart_i = &likelihoodsFatherConstantPart[i]; for (size_t c = 0; c < nbClasses; c++) { Vdouble* likelihoodsFatherConstantPart_i_c = &(*likelihoodsFatherConstantPart_i)[c]; for (size_t x = 0; x < nbStates; x++) { (*likelihoodsFatherConstantPart_i_c)[x] *= freqs[x]; } } } } // Then, we deal with the node of interest. // We first average upon 'y' to save computations, and then upon 'x'. // ('y' is the state at 'node' and 'x' the state at 'father'.) // Iterate over all site partitions: const VVVdouble* likelihoodsFather_node = &(drtl.getLikelihoodData()->getLikelihoodArray(father->getId(), currentNode->getId())); unique_ptr<TreeLikelihood::ConstBranchModelIterator> mit(drtl.getNewBranchModelIterator(currentNode->getId())); VVVdouble pxy; bool first; while (mit->hasNext()) { TreeLikelihood::ConstBranchModelDescription* bmd = mit->next(); substitutionCount.setSubstitutionModel(modelSet.getSubstitutionModelForNode(currentNode->getId())); // compute all nxy first: VVVVdouble nxy(nbClasses); for (size_t c = 0; c < nbClasses; ++c) { VVVdouble* nxy_c = &nxy[c]; double rc = rcRates[c]; nxy_c->resize(nbTypes); for (size_t t = 0; t < nbTypes; ++t) { VVdouble* nxy_c_t = &(*nxy_c)[t]; Matrix<double>* nijt = substitutionCount.getAllNumbersOfSubstitutions(d * rc, t + 1); nxy_c_t->resize(nbStates); for (size_t x = 0; x < nbStates; ++x) { Vdouble* nxy_c_t_x = &(*nxy_c_t)[x]; nxy_c_t_x->resize(nbStates); for (size_t y = 0; y < nbStates; ++y) { (*nxy_c_t_x)[y] = (*nijt)(x, y); } } delete nijt; } } // Now loop over sites: unique_ptr<TreeLikelihood::SiteIterator> sit(bmd->getNewSiteIterator()); first = true; while (sit->hasNext()) { size_t i = sit->next(); // We retrieve the transition probabilities and substitution counts for this site partition: if (first) { pxy = drtl.getTransitionProbabilitiesPerRateClass(currentNode->getId(), i); first = false; } const VVdouble* likelihoodsFather_node_i = &(*likelihoodsFather_node)[i]; VVdouble* likelihoodsFatherConstantPart_i = &likelihoodsFatherConstantPart[i]; for (size_t c = 0; c < nbClasses; ++c) { const Vdouble* likelihoodsFather_node_i_c = &(*likelihoodsFather_node_i)[c]; Vdouble* likelihoodsFatherConstantPart_i_c = &(*likelihoodsFatherConstantPart_i)[c]; const VVdouble* pxy_c = &pxy[c]; VVVdouble* nxy_c = &nxy[c]; for (size_t x = 0; x < nbStates; ++x) { double* likelihoodsFatherConstantPart_i_c_x = &(*likelihoodsFatherConstantPart_i_c)[x]; const Vdouble* pxy_c_x = &(*pxy_c)[x]; for (size_t y = 0; y < nbStates; ++y) { double likelihood_cxy = (*likelihoodsFatherConstantPart_i_c_x) * (*pxy_c_x)[y] * (*likelihoodsFather_node_i_c)[y]; for (size_t t = 0; t < nbTypes; ++t) { // Now the vector computation: substitutionsForCurrentNode[i][t] += likelihood_cxy * (*nxy_c)[t][x][y]; // <------------> <---------------> // Posterior probability | | // for site i and rate class c * | | // likelihood for this site----------------+ | // | // Substitution function for site i and rate class c----------+ } } } } } } // Now we just have to copy the substitutions into the result vector: for (size_t i = 0; i < nbSites; ++i) { for (size_t t = 0; t < nbTypes; ++t) { (*substitutions)(l, i, t) = substitutionsForCurrentNode[(*rootPatternLinks)[i]][t] / Lr[(*rootPatternLinks)[i]]; } } } if (verbose) { if (ApplicationTools::message) *ApplicationTools::message << " "; ApplicationTools::displayTaskDone(); } return substitutions; } /**************************************************************************************************/ ProbabilisticSubstitutionMapping* SubstitutionMappingTools::computeSubstitutionVectorsNoAveraging( const DRTreeLikelihood& drtl, SubstitutionCount& substitutionCount, bool verbose) { // Preamble: if (!drtl.isInitialized()) throw Exception("SubstitutionMappingTools::computeSubstitutionVectorsNoAveraging(). Likelihood object is not initialized."); // A few variables we'll need: const TreeTemplate<Node> tree(drtl.getTree()); const SiteContainer* sequences = drtl.getData(); const DiscreteDistribution* rDist = drtl.getRateDistribution(); size_t nbSites = sequences->getNumberOfSites(); size_t nbDistinctSites = drtl.getLikelihoodData()->getNumberOfDistinctSites(); size_t nbStates = sequences->getAlphabet()->getSize(); size_t nbClasses = rDist->getNumberOfCategories(); size_t nbTypes = substitutionCount.getNumberOfSubstitutionTypes(); vector<const Node*> nodes = tree.getNodes(); const vector<size_t>* rootPatternLinks = &drtl.getLikelihoodData()->getRootArrayPositions(); nodes.pop_back(); // Remove root node. size_t nbNodes = nodes.size(); // We create a new ProbabilisticSubstitutionMapping object: ProbabilisticSubstitutionMapping* substitutions = new ProbabilisticSubstitutionMapping(tree, &substitutionCount, nbSites); Vdouble rcRates = rDist->getCategories(); // Compute the number of substitutions for each class and each branch in the tree: if (verbose) ApplicationTools::displayTask("Compute joint node-pairs likelihood", true); for (size_t l = 0; l < nbNodes; ++l) { // For each node, const Node* currentNode = nodes[l]; const Node* father = currentNode->getFather(); double d = currentNode->getDistanceToFather(); if (verbose) ApplicationTools::displayGauge(l, nbNodes - 1); VVdouble substitutionsForCurrentNode(nbDistinctSites); for (size_t i = 0; i < nbDistinctSites; ++i) { substitutionsForCurrentNode[i].resize(nbTypes); } // Now we've got to compute likelihoods in a smart manner... ;) VVVdouble likelihoodsFatherConstantPart(nbDistinctSites); for (size_t i = 0; i < nbDistinctSites; ++i) { VVdouble* likelihoodsFatherConstantPart_i = &likelihoodsFatherConstantPart[i]; likelihoodsFatherConstantPart_i->resize(nbClasses); for (size_t c = 0; c < nbClasses; ++c) { Vdouble* likelihoodsFatherConstantPart_i_c = &(*likelihoodsFatherConstantPart_i)[c]; likelihoodsFatherConstantPart_i_c->resize(nbStates); double rc = rDist->getProbability(c); for (size_t s = 0; s < nbStates; ++s) { // (* likelihoodsFatherConstantPart_i_c)[s] = rc * model->freq(s); // freq is already accounted in the array (*likelihoodsFatherConstantPart_i_c)[s] = rc; } } } // First, what will remain constant: size_t nbSons = father->getNumberOfSons(); for (size_t n = 0; n < nbSons; ++n) { const Node* currentSon = father->getSon(n); if (currentSon->getId() != currentNode->getId()) { const VVVdouble* likelihoodsFather_son = &drtl.getLikelihoodData()->getLikelihoodArray(father->getId(), currentSon->getId()); // Now iterate over all site partitions: unique_ptr<TreeLikelihood::ConstBranchModelIterator> mit(drtl.getNewBranchModelIterator(currentSon->getId())); VVVdouble pxy; bool first; while (mit->hasNext()) { TreeLikelihood::ConstBranchModelDescription* bmd = mit->next(); unique_ptr<TreeLikelihood::SiteIterator> sit(bmd->getNewSiteIterator()); first = true; while (sit->hasNext()) { size_t i = sit->next(); // We retrieve the transition probabilities for this site partition: if (first) { pxy = drtl.getTransitionProbabilitiesPerRateClass(currentSon->getId(), i); first = false; } const VVdouble* likelihoodsFather_son_i = &(*likelihoodsFather_son)[i]; VVdouble* likelihoodsFatherConstantPart_i = &likelihoodsFatherConstantPart[i]; for (size_t c = 0; c < nbClasses; ++c) { const Vdouble* likelihoodsFather_son_i_c = &(*likelihoodsFather_son_i)[c]; Vdouble* likelihoodsFatherConstantPart_i_c = &(*likelihoodsFatherConstantPart_i)[c]; VVdouble* pxy_c = &pxy[c]; for (size_t x = 0; x < nbStates; ++x) { Vdouble* pxy_c_x = &(*pxy_c)[x]; double likelihood = 0.; for (size_t y = 0; y < nbStates; ++y) { likelihood += (*pxy_c_x)[y] * (*likelihoodsFather_son_i_c)[y]; } (*likelihoodsFatherConstantPart_i_c)[x] *= likelihood; } } } } } } if (father->hasFather()) { const Node* currentSon = father->getFather(); const VVVdouble* likelihoodsFather_son = &drtl.getLikelihoodData()->getLikelihoodArray(father->getId(), currentSon->getId()); // Now iterate over all site partitions: unique_ptr<TreeLikelihood::ConstBranchModelIterator> mit(drtl.getNewBranchModelIterator(father->getId())); VVVdouble pxy; bool first; while (mit->hasNext()) { TreeLikelihood::ConstBranchModelDescription* bmd = mit->next(); unique_ptr<TreeLikelihood::SiteIterator> sit(bmd->getNewSiteIterator()); first = true; while (sit->hasNext()) { size_t i = sit->next(); // We retrieve the transition probabilities for this site partition: if (first) { pxy = drtl.getTransitionProbabilitiesPerRateClass(father->getId(), i); first = false; } const VVdouble* likelihoodsFather_son_i = &(*likelihoodsFather_son)[i]; VVdouble* likelihoodsFatherConstantPart_i = &likelihoodsFatherConstantPart[i]; for (size_t c = 0; c < nbClasses; ++c) { const Vdouble* likelihoodsFather_son_i_c = &(*likelihoodsFather_son_i)[c]; Vdouble* likelihoodsFatherConstantPart_i_c = &(*likelihoodsFatherConstantPart_i)[c]; VVdouble* pxy_c = &pxy[c]; for (size_t x = 0; x < nbStates; ++x) { double likelihood = 0.; for (size_t y = 0; y < nbStates; ++y) { Vdouble* pxy_c_x = &(*pxy_c)[y]; likelihood += (*pxy_c_x)[x] * (*likelihoodsFather_son_i_c)[y]; } (*likelihoodsFatherConstantPart_i_c)[x] *= likelihood; } } } } } else { // Account for root frequencies: for (size_t i = 0; i < nbDistinctSites; ++i) { vector<double> freqs = drtl.getRootFrequencies(i); VVdouble* likelihoodsFatherConstantPart_i = &likelihoodsFatherConstantPart[i]; for (size_t c = 0; c < nbClasses; ++c) { Vdouble* likelihoodsFatherConstantPart_i_c = &(*likelihoodsFatherConstantPart_i)[c]; for (size_t x = 0; x < nbStates; ++x) { (*likelihoodsFatherConstantPart_i_c)[x] *= freqs[x]; } } } } // Then, we deal with the node of interest. // We first average uppon 'y' to save computations, and then uppon 'x'. // ('y' is the state at 'node' and 'x' the state at 'father'.) // Iterate over all site partitions: const VVVdouble* likelihoodsFather_node = &drtl.getLikelihoodData()->getLikelihoodArray(father->getId(), currentNode->getId()); unique_ptr<TreeLikelihood::ConstBranchModelIterator> mit(drtl.getNewBranchModelIterator(currentNode->getId())); VVVdouble pxy; bool first; while (mit->hasNext()) { TreeLikelihood::ConstBranchModelDescription* bmd = mit->next(); substitutionCount.setSubstitutionModel(bmd->getSubstitutionModel()); // compute all nxy first: VVVVdouble nxy(nbClasses); for (size_t c = 0; c < nbClasses; ++c) { double rc = rcRates[c]; VVVdouble* nxy_c = &nxy[c]; nxy_c->resize(nbTypes); for (size_t t = 0; t < nbTypes; ++t) { VVdouble* nxy_c_t = &(*nxy_c)[t]; nxy_c_t->resize(nbStates); Matrix<double>* nijt = substitutionCount.getAllNumbersOfSubstitutions(d * rc, t + 1); for (size_t x = 0; x < nbStates; ++x) { Vdouble* nxy_c_t_x = &(*nxy_c_t)[x]; nxy_c_t_x->resize(nbStates); for (size_t y = 0; y < nbStates; ++y) { (*nxy_c_t_x)[y] = (*nijt)(x, y); } } delete nijt; } } // Now loop over sites: unique_ptr<TreeLikelihood::SiteIterator> sit(bmd->getNewSiteIterator()); first = true; while (sit->hasNext()) { size_t i = sit->next(); // We retrieve the transition probabilities and substitution counts for this site partition: if (first) { pxy = drtl.getTransitionProbabilitiesPerRateClass(currentNode->getId(), i); first = false; } const VVdouble* likelihoodsFather_node_i = &(*likelihoodsFather_node)[i]; VVdouble* likelihoodsFatherConstantPart_i = &likelihoodsFatherConstantPart[i]; RowMatrix<double> pairProbabilities(nbStates, nbStates); MatrixTools::fill(pairProbabilities, 0.); VVVdouble subsCounts(nbStates); for (size_t j = 0; j < nbStates; ++j) { subsCounts[j].resize(nbStates); for (size_t k = 0; k < nbStates; ++k) { subsCounts[j][k].resize(nbTypes); } } for (size_t c = 0; c < nbClasses; ++c) { const Vdouble* likelihoodsFather_node_i_c = &(*likelihoodsFather_node_i)[c]; Vdouble* likelihoodsFatherConstantPart_i_c = &(*likelihoodsFatherConstantPart_i)[c]; const VVdouble* pxy_c = &pxy[c]; VVVdouble* nxy_c = &nxy[c]; for (size_t x = 0; x < nbStates; ++x) { double* likelihoodsFatherConstantPart_i_c_x = &(*likelihoodsFatherConstantPart_i_c)[x]; const Vdouble* pxy_c_x = &(*pxy_c)[x]; for (size_t y = 0; y < nbStates; ++y) { double likelihood_cxy = (*likelihoodsFatherConstantPart_i_c_x) * (*pxy_c_x)[y] * (*likelihoodsFather_node_i_c)[y]; pairProbabilities(x, y) += likelihood_cxy; // Sum over all rate classes. for (size_t t = 0; t < nbTypes; ++t) { subsCounts[x][y][t] += likelihood_cxy * (*nxy_c)[t][x][y]; } } } } // Now the vector computation: // Here we do not average over all possible pair of ancestral states, // We only consider the one with max likelihood: vector<size_t> xy = MatrixTools::whichMax(pairProbabilities); for (size_t t = 0; t < nbTypes; ++t) { substitutionsForCurrentNode[i][t] += subsCounts[xy[0]][xy[1]][t] / pairProbabilities(xy[0], xy[1]); } } } // Now we just have to copy the substitutions into the result vector: for (size_t i = 0; i < nbSites; i++) { for (size_t t = 0; t < nbTypes; t++) { (*substitutions)(l, i, t) = substitutionsForCurrentNode[(*rootPatternLinks)[i]][t]; } } } if (verbose) { if (ApplicationTools::message) *ApplicationTools::message << " "; ApplicationTools::displayTaskDone(); } return substitutions; } /**************************************************************************************************/ ProbabilisticSubstitutionMapping* SubstitutionMappingTools::computeSubstitutionVectorsNoAveragingMarginal( const DRTreeLikelihood& drtl, SubstitutionCount& substitutionCount, bool verbose) { // Preamble: if (!drtl.isInitialized()) throw Exception("SubstitutionMappingTools::computeSubstitutionVectorsNoAveragingMarginal(). Likelihood object is not initialized."); // A few variables we'll need: const TreeTemplate<Node> tree(drtl.getTree()); const SiteContainer* sequences = drtl.getData(); const DiscreteDistribution* rDist = drtl.getRateDistribution(); const Alphabet* alpha = sequences->getAlphabet(); size_t nbSites = sequences->getNumberOfSites(); size_t nbDistinctSites = drtl.getLikelihoodData()->getNumberOfDistinctSites(); size_t nbStates = alpha->getSize(); size_t nbTypes = substitutionCount.getNumberOfSubstitutionTypes(); vector<const Node*> nodes = tree.getNodes(); const vector<size_t>* rootPatternLinks = &drtl.getLikelihoodData()->getRootArrayPositions(); nodes.pop_back(); // Remove root node. size_t nbNodes = nodes.size(); // We create a new ProbabilisticSubstitutionMapping object: ProbabilisticSubstitutionMapping* substitutions = new ProbabilisticSubstitutionMapping(tree, &substitutionCount, nbSites); // Compute the whole likelihood of the tree according to the specified model: Vdouble rcRates = rDist->getCategories(); // Compute the number of substitutions for each class and each branch in the tree: if (verbose) ApplicationTools::displayTask("Compute marginal ancestral states"); MarginalAncestralStateReconstruction masr(&drtl); map<int, vector<size_t> > ancestors = masr.getAllAncestralStates(); if (verbose) ApplicationTools::displayTaskDone(); // Now we just have to compute the substitution vectors: if (verbose) ApplicationTools::displayTask("Compute substitution vectors", true); for (size_t l = 0; l < nbNodes; l++) { const Node* currentNode = nodes[l]; const Node* father = currentNode->getFather(); double d = currentNode->getDistanceToFather(); vector<size_t> nodeStates = ancestors[currentNode->getId()]; // These are not 'true' ancestors ;) vector<size_t> fatherStates = ancestors[father->getId()]; // For each node, if (verbose) ApplicationTools::displayGauge(l, nbNodes - 1); VVdouble substitutionsForCurrentNode(nbDistinctSites); for (size_t i = 0; i < nbDistinctSites; ++i) { substitutionsForCurrentNode[i].resize(nbTypes); } // Here, we have no likelihood computation to do! // Then, we deal with the node of interest. // ('y' is the state at 'node' and 'x' the state at 'father'.) // Iterate over all site partitions: unique_ptr<TreeLikelihood::ConstBranchModelIterator> mit(drtl.getNewBranchModelIterator(currentNode->getId())); while (mit->hasNext()) { TreeLikelihood::ConstBranchModelDescription* bmd = mit->next(); substitutionCount.setSubstitutionModel(bmd->getSubstitutionModel()); // compute all nxy first: VVVdouble nxyt(nbTypes); for (size_t t = 0; t < nbTypes; ++t) { nxyt[t].resize(nbStates); Matrix<double>* nxy = substitutionCount.getAllNumbersOfSubstitutions(d, t + 1); for (size_t x = 0; x < nbStates; ++x) { nxyt[t][x].resize(nbStates); for (size_t y = 0; y < nbStates; ++y) { nxyt[t][x][y] = (*nxy)(x, y); } } delete nxy; } // Now loop over sites: unique_ptr<TreeLikelihood::SiteIterator> sit(bmd->getNewSiteIterator()); while (sit->hasNext()) { size_t i = sit->next(); size_t fatherState = fatherStates[i]; size_t nodeState = nodeStates[i]; if (fatherState >= nbStates || nodeState >= nbStates) for (size_t t = 0; t < nbTypes; ++t) { substitutionsForCurrentNode[i][t] = 0; } // To be conservative! Only in case there are generic characters. else for (size_t t = 0; t < nbTypes; ++t) { substitutionsForCurrentNode[i][t] = nxyt[t][fatherState][nodeState]; } } } // Now we just have to copy the substitutions into the result vector: for (size_t i = 0; i < nbSites; i++) { for (size_t t = 0; t < nbTypes; t++) { (*substitutions)(l, i, t) = substitutionsForCurrentNode[(*rootPatternLinks)[i]][t]; } } } if (verbose) { if (ApplicationTools::message) *ApplicationTools::message << " "; ApplicationTools::displayTaskDone(); } return substitutions; } /**************************************************************************************************/ ProbabilisticSubstitutionMapping* SubstitutionMappingTools::computeSubstitutionVectorsMarginal( const DRTreeLikelihood& drtl, SubstitutionCount& substitutionCount, bool verbose) { // Preamble: if (!drtl.isInitialized()) throw Exception("SubstitutionMappingTools::computeSubstitutionVectorsMarginal(). Likelihood object is not initialized."); // A few variables we'll need: const TreeTemplate<Node> tree(drtl.getTree()); const SiteContainer* sequences = drtl.getData(); const DiscreteDistribution* rDist = drtl.getRateDistribution(); size_t nbSites = sequences->getNumberOfSites(); size_t nbDistinctSites = drtl.getLikelihoodData()->getNumberOfDistinctSites(); size_t nbStates = sequences->getAlphabet()->getSize(); size_t nbClasses = rDist->getNumberOfCategories(); size_t nbTypes = substitutionCount.getNumberOfSubstitutionTypes(); vector<const Node*> nodes = tree.getNodes(); const vector<size_t>* rootPatternLinks = &drtl.getLikelihoodData()->getRootArrayPositions(); nodes.pop_back(); // Remove root node. size_t nbNodes = nodes.size(); // We create a new ProbabilisticSubstitutionMapping object: ProbabilisticSubstitutionMapping* substitutions = new ProbabilisticSubstitutionMapping(tree, &substitutionCount, nbSites); // Compute the whole likelihood of the tree according to the specified model: Vdouble rcProbs = rDist->getProbabilities(); Vdouble rcRates = rDist->getCategories(); // II) Compute the number of substitutions for each class and each branch in the tree: if (verbose) ApplicationTools::displayTask("Compute marginal node-pairs likelihoods", true); for (size_t l = 0; l < nbNodes; l++) { const Node* currentNode = nodes[l]; const Node* father = currentNode->getFather(); double d = currentNode->getDistanceToFather(); // For each node, if (verbose) ApplicationTools::displayGauge(l, nbNodes - 1); VVdouble substitutionsForCurrentNode(nbDistinctSites); for (size_t i = 0; i < nbDistinctSites; ++i) { substitutionsForCurrentNode[i].resize(nbTypes); } // Then, we deal with the node of interest. // ('y' is the state at 'node' and 'x' the state at 'father'.) VVVdouble probsNode = DRTreeLikelihoodTools::getPosteriorProbabilitiesForEachStateForEachRate(drtl, currentNode->getId()); VVVdouble probsFather = DRTreeLikelihoodTools::getPosteriorProbabilitiesForEachStateForEachRate(drtl, father->getId()); // Iterate over all site partitions: unique_ptr<TreeLikelihood::ConstBranchModelIterator> mit(drtl.getNewBranchModelIterator(currentNode->getId())); while (mit->hasNext()) { TreeLikelihood::ConstBranchModelDescription* bmd = mit->next(); substitutionCount.setSubstitutionModel(bmd->getSubstitutionModel()); // compute all nxy first: VVVVdouble nxy(nbClasses); for (size_t c = 0; c < nbClasses; ++c) { VVVdouble* nxy_c = &nxy[c]; double rc = rcRates[c]; nxy_c->resize(nbTypes); for (size_t t = 0; t < nbTypes; ++t) { VVdouble* nxy_c_t = &(*nxy_c)[t]; Matrix<double>* nijt = substitutionCount.getAllNumbersOfSubstitutions(d * rc, t + 1); nxy_c_t->resize(nbStates); for (size_t x = 0; x < nbStates; ++x) { Vdouble* nxy_c_t_x = &(*nxy_c_t)[x]; nxy_c_t_x->resize(nbStates); for (size_t y = 0; y < nbStates; ++y) { (*nxy_c_t_x)[y] = (*nijt)(x, y); } } delete nijt; } } // Now loop over sites: unique_ptr<TreeLikelihood::SiteIterator> sit(bmd->getNewSiteIterator()); while (sit->hasNext()) { size_t i = sit->next(); VVdouble* probsNode_i = &probsNode[i]; VVdouble* probsFather_i = &probsFather[i]; for (size_t c = 0; c < nbClasses; ++c) { Vdouble* probsNode_i_c = &(*probsNode_i)[c]; Vdouble* probsFather_i_c = &(*probsFather_i)[c]; VVVdouble* nxy_c = &nxy[c]; for (size_t x = 0; x < nbStates; ++x) { for (size_t y = 0; y < nbStates; ++y) { double prob_cxy = (*probsFather_i_c)[x] * (*probsNode_i_c)[y]; // Now the vector computation: for (size_t t = 0; t < nbTypes; ++t) { substitutionsForCurrentNode[i][t] += prob_cxy * (*nxy_c)[t][x][y]; // <------> <---------------> // Posterior probability | | // for site i and rate class c * | | // likelihood for this site--------------+ | // | // Substitution function for site i and rate class c-------+ } } } } } } // Now we just have to copy the substitutions into the result vector: for (size_t i = 0; i < nbSites; ++i) { for (size_t t = 0; t < nbTypes; ++t) { (*substitutions)(l, i, t) = substitutionsForCurrentNode[(*rootPatternLinks)[i]][t]; } } } if (verbose) { if (ApplicationTools::message) *ApplicationTools::message << " "; ApplicationTools::displayTaskDone(); } return substitutions; } /**************************************************************************************************/ void SubstitutionMappingTools::writeToStream( const ProbabilisticSubstitutionMapping& substitutions, const SiteContainer& sites, size_t type, ostream& out) { if (!out) throw IOException("SubstitutionMappingTools::writeToFile. Can't write to stream."); out << "Branches"; out << "\tMean"; for (size_t i = 0; i < substitutions.getNumberOfSites(); i++) { out << "\tSite" << sites.getSite(i).getPosition(); } out << endl; for (size_t j = 0; j < substitutions.getNumberOfBranches(); j++) { out << substitutions.getNode(j)->getId() << "\t" << substitutions.getNode(j)->getDistanceToFather(); for (size_t i = 0; i < substitutions.getNumberOfSites(); i++) { out << "\t" << substitutions(j, i, type); } out << endl; } } /**************************************************************************************************/ void SubstitutionMappingTools::readFromStream(istream& in, ProbabilisticSubstitutionMapping& substitutions, size_t type) { try { DataTable* data = DataTable::read(in, "\t", true, -1); vector<string> ids = data->getColumn(0); data->deleteColumn(0); // Remove ids data->deleteColumn(0); // Remove means // Now parse the table: size_t nbSites = data->getNumberOfColumns(); substitutions.setNumberOfSites(nbSites); size_t nbBranches = data->getNumberOfRows(); for (size_t i = 0; i < nbBranches; i++) { int id = TextTools::toInt(ids[i]); size_t br = substitutions.getNodeIndex(id); for (size_t j = 0; j < nbSites; j++) { substitutions(br, j, type) = TextTools::toDouble((*data)(i, j)); } } // Parse the header: for (size_t i = 0; i < nbSites; i++) { string siteTxt = data->getColumnName(i); int site = 0; if (siteTxt.substr(0, 4) == "Site") site = TextTools::to<int>(siteTxt.substr(4)); else site = TextTools::to<int>(siteTxt); substitutions.setSitePosition(i, site); } delete data; } catch (Exception& e) { throw IOException(string("Bad input file. ") + e.what()); } } /**************************************************************************************************/ vector<double> SubstitutionMappingTools::computeTotalSubstitutionVectorForSitePerBranch(const SubstitutionMapping& smap, size_t siteIndex) { size_t nbBranches = smap.getNumberOfBranches(); size_t nbTypes = smap.getNumberOfSubstitutionTypes(); Vdouble v(nbBranches); for (size_t l = 0; l < nbBranches; ++l) { v[l] = 0; for (size_t t = 0; t < nbTypes; ++t) { v[l] += smap(l, siteIndex, t); } } return v; } /**************************************************************************************************/ vector<double> SubstitutionMappingTools::computeTotalSubstitutionVectorForSitePerType(const SubstitutionMapping& smap, size_t siteIndex) { size_t nbBranches = smap.getNumberOfBranches(); size_t nbTypes = smap.getNumberOfSubstitutionTypes(); Vdouble v(nbTypes); for (size_t t = 0; t < nbTypes; ++t) { v[t] = 0; for (size_t l = 0; l < nbBranches; ++l) v[t] += smap(l, siteIndex, t); } return v; } /**************************************************************************************************/ double SubstitutionMappingTools::computeNormForSite(const SubstitutionMapping& smap, size_t siteIndex) { double sumSquare = 0; for (size_t l = 0; l < smap.getNumberOfBranches(); ++l) { double sum = 0; for (size_t t = 0; t < smap.getNumberOfSubstitutionTypes(); ++t) { sum += smap(l, siteIndex, t); } sumSquare += sum * sum; } return sqrt(sumSquare); } /**************************************************************************************************/ vector<double> SubstitutionMappingTools::computeSumForBranch(const SubstitutionMapping& smap, size_t branchIndex) { size_t nbSites = smap.getNumberOfSites(); size_t nbTypes = smap.getNumberOfSubstitutionTypes(); Vdouble v(nbTypes, 0); for (size_t i = 0; i < nbSites; ++i) { for (size_t t = 0; t < nbTypes; ++t) { v[t] += smap(branchIndex, i, t); } } return v; } /**************************************************************************************************/ vector<double> SubstitutionMappingTools::computeSumForSite(const SubstitutionMapping& smap, size_t siteIndex) { size_t nbBranches = smap.getNumberOfBranches(); size_t nbTypes = smap.getNumberOfSubstitutionTypes(); Vdouble v(nbTypes, 0); for (size_t i = 0; i < nbBranches; ++i) { for (size_t t = 0; t < nbTypes; ++t) { v[t] += smap(i, siteIndex, t); } } return v; } /**************************************************************************************************/ vector< vector<double> > SubstitutionMappingTools::getCountsPerBranch( DRTreeLikelihood& drtl, const vector<int>& ids, SubstitutionModel* model, const SubstitutionRegister& reg, double threshold, bool verbose) { SubstitutionRegister* reg2 = reg.clone(); unique_ptr<SubstitutionCount> count(new UniformizationSubstitutionCount(model, reg2)); unique_ptr<ProbabilisticSubstitutionMapping> mapping(SubstitutionMappingTools::computeSubstitutionVectors(drtl, ids, *count, false)); vector< vector<double> > counts(ids.size()); size_t nbSites = mapping->getNumberOfSites(); size_t nbTypes = mapping->getNumberOfSubstitutionTypes(); for (size_t k = 0; k < ids.size(); ++k) { vector<double> countsf(nbTypes, 0); vector<double> tmp(nbTypes, 0); size_t nbIgnored = 0; bool error = false; for (size_t i = 0; !error && i < nbSites; ++i) { double s = 0; for (size_t t = 0; t < nbTypes; ++t) { tmp[t] = (*mapping)(mapping->getNodeIndex(ids[k]), i, t); error = std::isnan(tmp[t]); if (error) goto ERROR; s += tmp[t]; } if (threshold >= 0) { if (s <= threshold) countsf += tmp; else { nbIgnored++; } } else { countsf += tmp; } } ERROR: if (error) { // We do nothing. This happens for small branches. if (verbose) ApplicationTools::displayWarning("On branch " + TextTools::toString(ids[k]) + ", counts could not be computed."); for (size_t t = 0; t < nbTypes; ++t) { countsf[t] = 0; } } else { if (nbIgnored > 0) { if (verbose) ApplicationTools::displayWarning("On branch " + TextTools::toString(ids[k]) + ", " + TextTools::toString(nbIgnored) + " sites (" + TextTools::toString(ceil(static_cast<double>(nbIgnored * 100) / static_cast<double>(nbSites))) + "%) have been ignored because they are presumably saturated."); } } counts[k].resize(countsf.size()); for (size_t j = 0; j < countsf.size(); ++j) { counts[k][j] = countsf[j]; } } return counts; } /**************************************************************************************************/ vector< vector<double> > SubstitutionMappingTools::getCountsPerBranch( DRTreeLikelihood& drtl, const vector<int>& ids, const SubstitutionModelSet& modelSet, const SubstitutionRegister& reg, double threshold, bool verbose) { SubstitutionRegister* reg2 = reg.clone(); unique_ptr<SubstitutionCount> count(new UniformizationSubstitutionCount(modelSet.getSubstitutionModel(0), reg2)); unique_ptr<ProbabilisticSubstitutionMapping> mapping(SubstitutionMappingTools::computeSubstitutionVectors(drtl, modelSet, ids, *count, false)); vector< vector<double> > counts(ids.size()); size_t nbSites = mapping->getNumberOfSites(); size_t nbTypes = mapping->getNumberOfSubstitutionTypes(); for (size_t k = 0; k < ids.size(); ++k) { vector<double> countsf(nbTypes, 0); vector<double> tmp(nbTypes, 0); size_t nbIgnored = 0; bool error = false; for (size_t i = 0; !error && i < nbSites; ++i) { double s = 0; for (size_t t = 0; t < nbTypes; ++t) { tmp[t] = (*mapping)(mapping->getNodeIndex(ids[k]), i, t); error = std::isnan(tmp[t]); if (error) goto ERROR; s += tmp[t]; } if (threshold >= 0) { if (s <= threshold) countsf += tmp; else { nbIgnored++; } } else { countsf += tmp; } } ERROR: if (error) { // We do nothing. This happens for small branches. if (verbose) ApplicationTools::displayWarning("On branch " + TextTools::toString(ids[k]) + ", counts could not be computed."); for (size_t t = 0; t < nbTypes; ++t) { countsf[t] = 0; } } else { if (nbIgnored > 0) { if (verbose) ApplicationTools::displayWarning("On branch " + TextTools::toString(ids[k]) + ", " + TextTools::toString(nbIgnored) + " sites (" + TextTools::toString(ceil(static_cast<double>(nbIgnored * 100) / static_cast<double>(nbSites))) + "%) have been ignored because they are presumably saturated."); } } counts[k].resize(countsf.size()); for (size_t j = 0; j < countsf.size(); ++j) { counts[k][j] = countsf[j]; } } return counts; } /**************************************************************************************************/ vector< vector<double> > SubstitutionMappingTools::getNormalizationsPerBranch( DRTreeLikelihood& drtl, const vector<int>& ids, const SubstitutionModel* nullModel, const SubstitutionRegister& reg, bool verbose) { size_t nbTypes = reg.getNumberOfSubstitutionTypes(); size_t nbStates = nullModel->getAlphabet()->getSize(); size_t nbSites = drtl.getNumberOfSites(); vector<int> supportedStates = nullModel->getAlphabetStates(); // compute the AlphabetIndex for each substitutionType vector<UserAlphabetIndex1 > usai(nbTypes, UserAlphabetIndex1(nullModel->getAlphabet())); for (size_t nbt = 0; nbt < nbTypes; nbt++) for (size_t i = 0; i < nbStates; i++) usai[nbt].setIndex(supportedStates[i], 0); for (size_t i = 0; i < nbStates; i++) { for (size_t j = 0; j < nbStates; j++) { if (i != j) { size_t nbt = reg.getType(i, j); if (nbt != 0) usai[nbt - 1].setIndex(supportedStates[i], usai[nbt - 1].getIndex(supportedStates[i]) + nullModel->Qij(i, j)); } } } // compute the normalization for each substitutionType vector< vector<double> > rewards(ids.size()); for (size_t k = 0; k < ids.size(); ++k) { rewards[k].resize(nbTypes); } for (size_t nbt = 0; nbt < nbTypes; nbt++) { unique_ptr<Reward> reward(new DecompositionReward(nullModel, &usai[nbt])); unique_ptr<ProbabilisticRewardMapping> mapping(RewardMappingTools::computeRewardVectors(drtl, ids, *reward, false)); for (size_t k = 0; k < ids.size(); ++k) { double s = 0; for (size_t i = 0; i < nbSites; ++i) { double tmp = (*mapping)(k, i); if (std::isnan(tmp)) { if (verbose) ApplicationTools::displayWarning("On branch " + TextTools::toString(ids[k]) + ", reward for type " + reg.getTypeName(nbt + 1) + " could not be computed."); s = 0; break; } s += tmp; } rewards[k][nbt] = s; } reward.reset(); mapping.reset(); } return rewards; } /**************************************************************************************************/ vector< vector<double> > SubstitutionMappingTools::getNormalizationsPerBranch( DRTreeLikelihood& drtl, const vector<int>& ids, const SubstitutionModelSet* nullModelSet, const SubstitutionRegister& reg, bool verbose) { size_t nbTypes = reg.getNumberOfSubstitutionTypes(); size_t nbStates = nullModelSet->getAlphabet()->getSize(); size_t nbSites = drtl.getNumberOfSites(); size_t nbModels = nullModelSet->getNumberOfModels(); // compute the AlphabetIndex for each substitutionType // compute the normalization for each substitutionType vector< vector<double> > rewards(ids.size()); for (size_t k = 0; k < ids.size(); ++k) { rewards[k].resize(nbTypes); } vector<UserAlphabetIndex1 > usai(nbTypes, UserAlphabetIndex1(nullModelSet->getAlphabet())); for (size_t nbm = 0; nbm < nbModels; nbm++) { vector<int> mids = VectorTools::vectorIntersection(ids, nullModelSet->getNodesWithModel(nbm)); if (mids.size()>0) { const SubstitutionModel* modn = nullModelSet->getSubstitutionModel(nbm); vector<int> supportedStates = modn->getAlphabetStates(); for (size_t nbt = 0; nbt < nbTypes; nbt++) for (size_t i = 0; i < nbStates; i++) usai[nbt].setIndex(supportedStates[i], 0); for (size_t i = 0; i < nbStates; i++) { for (size_t j = 0; j < nbStates; j++) { if (i != j) { size_t nbt = reg.getType(i, j); if (nbt != 0) usai[nbt - 1].setIndex(supportedStates[i], usai[nbt - 1].getIndex(supportedStates[i]) + modn->Qij(i, j)); } } } for (size_t nbt = 0; nbt < nbTypes; nbt++) { unique_ptr<Reward> reward(new DecompositionReward(nullModelSet->getSubstitutionModel(nbm), &usai[nbt])); unique_ptr<ProbabilisticRewardMapping> mapping(RewardMappingTools::computeRewardVectors(drtl, mids, *reward, false)); for (size_t k = 0; k < mids.size(); k++) { double s = 0; for (size_t i = 0; i < nbSites; ++i) { double tmp = (*mapping)(mapping->getNodeIndex(mids[k]), i); if (std::isnan(tmp)) { if (verbose) ApplicationTools::displayWarning("On branch " + TextTools::toString(mids[k]) + ", reward for type " + reg.getTypeName(nbt + 1) + " could not be computed."); s = 0; break; } else s += tmp; } rewards[VectorTools::which(ids, mids[k])][nbt] = s; } reward.reset(); mapping.reset(); } } } return rewards; } /**************************************************************************************************/ void SubstitutionMappingTools::computeCountsPerTypePerBranch( DRTreeLikelihood& drtl, const vector<int>& ids, SubstitutionModel* model, SubstitutionModel* nullModel, const SubstitutionRegister& reg, VVdouble& result, bool perTime, bool perWord, bool verbose) { vector< vector<double> > factors; result = getCountsPerBranch(drtl, ids, model, reg, -1, verbose); factors = getNormalizationsPerBranch(drtl, ids, nullModel, reg, verbose); // check if perWord const CoreWordAlphabet* wAlp=dynamic_cast<const CoreWordAlphabet*>(nullModel->getAlphabet()); float sizeWord=float((wAlp!=NULL) & !perWord ?wAlp->getLength():1); size_t nbTypes = result[0].size(); for (size_t k = 0; k < ids.size(); ++k) { for (size_t t = 0; t < nbTypes; ++t) { if (factors[k][t] != 0) result[k][t] /= (factors[k][t]*sizeWord); } } // Multiply by the lengths of the branches of the input tree if (!perTime) { const TreeTemplate<Node> tree(drtl.getTree()); for (size_t k = 0; k < ids.size(); ++k) { double l = tree.getNode(ids[k])->getDistanceToFather(); for (size_t t = 0; t < nbTypes; ++t) { result[k][t] *= l; } } } } /**************************************************************************************************/ void SubstitutionMappingTools::computeCountsPerTypePerBranch( DRTreeLikelihood& drtl, const vector<int>& ids, SubstitutionModelSet* modelSet, SubstitutionModelSet* nullModelSet, const SubstitutionRegister& reg, VVdouble& result, bool perTime, bool perWord, bool verbose) { vector< vector<double> > factors; result = getCountsPerBranch(drtl, ids, *modelSet, reg, -1, verbose); factors = getNormalizationsPerBranch(drtl, ids, nullModelSet, reg, verbose); size_t nbTypes = result[0].size(); // check if perWord const CoreWordAlphabet* wAlp=dynamic_cast<const CoreWordAlphabet*>(nullModelSet->getAlphabet()); float sizeWord=float((wAlp!=NULL) & !perWord?wAlp->getLength():1); for (size_t k = 0; k < ids.size(); ++k) { for (size_t t = 0; t < nbTypes; ++t) { if (factors[k][t] != 0) result[k][t] /= (factors[k][t]*sizeWord); } } // Multiply by the lengths of the branches of the input tree if (!perTime) { const TreeTemplate<Node> tree(drtl.getTree()); for (size_t k = 0; k < ids.size(); ++k) { double l = tree.getNode(ids[k])->getDistanceToFather(); for (size_t t = 0; t < nbTypes; ++t) { result[k][t] *= l; } } } } /**************************************************************************************************/ void SubstitutionMappingTools::computeCountsPerTypePerBranch( DRTreeLikelihood& drtl, const vector<int>& ids, SubstitutionModel* model, const SubstitutionRegister& reg, VVdouble& result, double threshold, bool verbose) { result = getCountsPerBranch(drtl, ids, model, reg, threshold, verbose); const CategorySubstitutionRegister* creg = dynamic_cast<const CategorySubstitutionRegister*>(&reg); if ((creg!=NULL) && !creg->isStationary()) { size_t nbTypes = result[0].size(); for (size_t k = 0; k < ids.size(); ++k) { vector<double> freqs = DRTreeLikelihoodTools::getPosteriorStateFrequencies(drtl, ids[k]); // Compute frequencies for types: vector<double> freqsTypes(creg->getNumberOfCategories()); for (size_t i = 0; i < freqs.size(); ++i) { size_t c = creg->getCategory(i); freqsTypes[c - 1] += freqs[i]; } // We devide the counts by the frequencies and rescale: double s = VectorTools::sum(result[k]); for (size_t t = 0; t < nbTypes; ++t) { result[k][t] /= freqsTypes[creg->getCategoryFrom(t + 1) - 1]; } double s2 = VectorTools::sum(result[k]); // Scale: result[k] = (result[k] / s2) * s; } } } /**************************************************************************************************/ void SubstitutionMappingTools::computeCountsPerSitePerBranch( DRTreeLikelihood& drtl, const vector<int>& ids, SubstitutionModel* model, const SubstitutionRegister& reg, VVdouble& result) { unique_ptr<SubstitutionCount> count(new UniformizationSubstitutionCount(model, reg.clone())); unique_ptr<ProbabilisticSubstitutionMapping> smap(SubstitutionMappingTools::computeSubstitutionVectors(drtl, ids, *count, false)); size_t nbSites = smap->getNumberOfSites(); size_t nbBr = ids.size(); VectorTools::resize2(result, nbSites, nbBr); vector<size_t> sdi(nbBr); // reverse of ids for (size_t i = 0; i < nbBr; ++i) { sdi[i] = smap->getNodeIndex(ids[i]); } for (size_t k = 0; k < nbSites; ++k) { vector<double> countsf = SubstitutionMappingTools::computeTotalSubstitutionVectorForSitePerBranch(*smap, k); Vdouble* resS=&result[k]; for (size_t i = 0; i < nbBr; ++i) (*resS)[i]= countsf[sdi[i]]; } } /**************************************************************************************************/ void SubstitutionMappingTools::computeCountsPerSitePerType( DRTreeLikelihood& drtl, const vector<int>& ids, SubstitutionModel* model, const SubstitutionRegister& reg, VVdouble& result) { unique_ptr<SubstitutionCount> count(new UniformizationSubstitutionCount(model, reg.clone())); unique_ptr<ProbabilisticSubstitutionMapping> smap(SubstitutionMappingTools::computeSubstitutionVectors(drtl, ids, *count, false)); size_t nbSites = smap->getNumberOfSites(); size_t nbTypes = smap->getNumberOfSubstitutionTypes(); VectorTools::resize2(result, nbSites, nbTypes); vector<unique_ptr<ProbabilisticRewardMapping> > rmap; for (size_t k = 0; k < nbSites; ++k) { vector<double> countsf = SubstitutionMappingTools::computeTotalSubstitutionVectorForSitePerType(*smap, k); Vdouble* resS=&result[k]; for (size_t i = 0; i < nbTypes; ++i) (*resS)[i]=countsf[i]; } } /**************************************************************************************************/ void SubstitutionMappingTools::computeCountsPerSitePerType( DRTreeLikelihood& drtl, const vector<int>& ids, SubstitutionModel* model, SubstitutionModel* nullModel, const SubstitutionRegister& reg, VVdouble& result, bool perTime, bool perWord) { unique_ptr<SubstitutionCount> count(new UniformizationSubstitutionCount(model, reg.clone())); unique_ptr<ProbabilisticSubstitutionMapping> smap(SubstitutionMappingTools::computeSubstitutionVectors(drtl, ids, *count, false)); size_t nbSites = smap->getNumberOfSites(); size_t nbTypes = smap->getNumberOfSubstitutionTypes(); size_t nbStates = nullModel->getAlphabet()->getSize(); vector<int> supportedStates = nullModel->getAlphabetStates(); VectorTools::resize2(result, nbSites, nbTypes); // compute the AlphabetIndex for each substitutionType vector<UserAlphabetIndex1 > usai(nbTypes, UserAlphabetIndex1(nullModel->getAlphabet())); for (size_t nbt = 0; nbt < nbTypes; nbt++) for (size_t i = 0; i < nbStates; i++) usai[nbt].setIndex(supportedStates[i], 0); for (size_t i = 0; i < nbStates; i++) { for (size_t j = 0; j < nbStates; j++) { if (i != j) { size_t nbt = reg.getType(i, j); if (nbt != 0) usai[nbt - 1].setIndex(supportedStates[i], usai[nbt - 1].getIndex(supportedStates[i]) + nullModel->Qij(i, j)); } } } // compute the normalization for each site for each substitutionType vector< vector<double> > rewards(nbSites); for (size_t k = 0; k < nbSites; ++k) { rewards[k].resize(nbTypes); } for (size_t nbt = 0; nbt < nbTypes; nbt++) { unique_ptr<Reward> reward(new DecompositionReward(nullModel, &usai[nbt])); unique_ptr<ProbabilisticRewardMapping> mapping(RewardMappingTools::computeRewardVectors(drtl, ids, *reward, false)); for (size_t i = 0; i < nbSites; ++i) { double s = 0; for (size_t k = 0; k < ids.size(); ++k) { double tmp = (*mapping)(mapping->getNodeIndex(ids[k]), i); if (std::isnan(tmp)) { s = 0; break; } s += tmp; } rewards[i][nbt] = s; } reward.reset(); mapping.reset(); } // Compute the sum of lengths of concerned branchs double brlen=0; if (!perTime) { const TreeTemplate<Node> tree(drtl.getTree()); for (size_t k = 0; k < ids.size(); ++k) brlen += tree.getNode(ids[k])->getDistanceToFather(); } else brlen=1; // check if perWord const CoreWordAlphabet* wAlp=dynamic_cast<const CoreWordAlphabet*>(nullModel->getAlphabet()); float sizeWord=float((wAlp!=NULL) & !perWord?wAlp->getLength():1); // output for (size_t k = 0; k < nbSites; ++k) { vector<double> countsf = SubstitutionMappingTools::computeTotalSubstitutionVectorForSitePerType(*smap, k); Vdouble& resS=result[k]; for (size_t i = 0; i < nbTypes; ++i) { resS[i] = countsf[i]/rewards[k][i]*brlen/sizeWord; } } } /**************************************************************************************************/ void SubstitutionMappingTools::computeCountsPerSitePerType( DRTreeLikelihood& drtl, const vector<int>& ids, SubstitutionModelSet* modelSet, SubstitutionModelSet* nullModelSet, const SubstitutionRegister& reg, VVdouble& result, bool perTime, bool perWord) { unique_ptr<SubstitutionCount> count(new UniformizationSubstitutionCount(modelSet->getSubstitutionModel(0), reg.clone())); unique_ptr<ProbabilisticSubstitutionMapping> smap(SubstitutionMappingTools::computeSubstitutionVectors(drtl, ids, *count, false)); size_t nbSites = smap->getNumberOfSites(); size_t nbTypes = smap->getNumberOfSubstitutionTypes(); size_t nbStates = nullModelSet->getAlphabet()->getSize(); size_t nbModels = nullModelSet->getNumberOfModels(); VectorTools::resize2(result, nbSites, nbTypes); // compute the normalization for each site for each substitutionType vector< vector<double> > rewards(nbSites); for (size_t k = 0; k < nbSites; ++k) { rewards[k].resize(nbTypes); } vector<UserAlphabetIndex1 > usai(nbTypes, UserAlphabetIndex1(nullModelSet->getAlphabet())); for (size_t nbm = 0; nbm < nbModels; nbm++) { vector<int> mids = VectorTools::vectorIntersection(ids, nullModelSet->getNodesWithModel(nbm)); if (mids.size()>0) { const SubstitutionModel* modn = nullModelSet->getSubstitutionModel(nbm); vector<int> supportedStates = modn->getAlphabetStates(); for (size_t nbt = 0; nbt < nbTypes; nbt++) for (size_t i = 0; i < nbStates; i++) usai[nbt].setIndex(supportedStates[i], 0); for (size_t i = 0; i < nbStates; i++) { for (size_t j = 0; j < nbStates; j++) { if (i != j) { size_t nbt = reg.getType(i, j); if (nbt != 0) usai[nbt - 1].setIndex(supportedStates[i], usai[nbt - 1].getIndex(supportedStates[i]) + modn->Qij(i, j)); } } } for (size_t nbt = 0; nbt < nbTypes; nbt++) { unique_ptr<Reward> reward(new DecompositionReward(nullModelSet->getSubstitutionModel(nbm), &usai[nbt])); unique_ptr<ProbabilisticRewardMapping> mapping(RewardMappingTools::computeRewardVectors(drtl, mids, *reward, false)); for (size_t i = 0; i < nbSites; ++i) { double s = 0; for (size_t k = 0; k < mids.size(); k++) { double tmp = (*mapping)(mapping->getNodeIndex(mids[k]), i); if (std::isnan(tmp)) { s = 0; break; } else s += tmp; } rewards[i][nbt] += s; } reward.reset(); mapping.reset(); } } } // Compute the sum of lengths of concerned branchs double brlen=0; if (!perTime){ const TreeTemplate<Node> tree(drtl.getTree()); for (size_t k = 0; k < ids.size(); ++k) brlen += tree.getNode(ids[k])->getDistanceToFather(); } else brlen = 1.; // check if perWord const CoreWordAlphabet* wAlp=dynamic_cast<const CoreWordAlphabet*>(nullModelSet->getAlphabet()); float sizeWord=float((wAlp!=NULL) & !perWord?wAlp->getLength():1); // output for (size_t k = 0; k < nbSites; ++k) { vector<double> countsf = SubstitutionMappingTools::computeTotalSubstitutionVectorForSitePerType(*smap, k); Vdouble& resS=result[k]; for (size_t i = 0; i < nbTypes; ++i) { resS[i] = countsf[i]/rewards[k][i]*brlen/sizeWord; } } } /**************************************************************************************************/ void SubstitutionMappingTools::computeCountsPerSitePerBranchPerType( DRTreeLikelihood& drtl, const vector<int>& ids, SubstitutionModel* model, const SubstitutionRegister& reg, VVVdouble& result) { unique_ptr<SubstitutionCount> count(new UniformizationSubstitutionCount(model, reg.clone())); unique_ptr<ProbabilisticSubstitutionMapping> smap(SubstitutionMappingTools::computeSubstitutionVectors(drtl, ids, *count, false)); size_t nbSites = smap->getNumberOfSites(); size_t nbBr = ids.size(); size_t nbTypes= reg.getNumberOfSubstitutionTypes(); VectorTools::resize3(result, nbSites, nbBr, nbTypes); for (size_t i = 0; i < nbTypes; ++i) { for (size_t j = 0; j < nbSites; ++j) { VVdouble& resS=result[j]; for (size_t k = 0; k < nbBr; ++k) { resS[k][i] = (*smap)(smap->getNodeIndex(ids[k]), j, i); } } } } /**************************************************************************************************/ void SubstitutionMappingTools::computeCountsPerSitePerBranchPerType( DRTreeLikelihood& drtl, const vector<int>& ids, SubstitutionModel* model, SubstitutionModel* nullModel, const SubstitutionRegister& reg, VVVdouble& result, bool perTime, bool perWord) { unique_ptr<SubstitutionCount> count(new UniformizationSubstitutionCount(model, reg.clone())); unique_ptr<ProbabilisticSubstitutionMapping> smap(SubstitutionMappingTools::computeSubstitutionVectors(drtl, ids, *count, false)); size_t nbSites = smap->getNumberOfSites(); size_t nbTypes = smap->getNumberOfSubstitutionTypes(); size_t nbStates = nullModel->getAlphabet()->getSize(); size_t nbBr = ids.size(); VectorTools::resize3(result, nbSites, nbBr, nbTypes); // compute the normalization for each site for each substitutionType map<int, vector< vector<double> > > rewards; for (auto id : ids) VectorTools::resize2(rewards[id], nbSites, nbTypes); vector<int> supportedStates = nullModel->getAlphabetStates(); // compute the AlphabetIndex for each substitutionType vector<UserAlphabetIndex1 > usai(nbTypes, UserAlphabetIndex1(nullModel->getAlphabet())); for (size_t nbt = 0; nbt < nbTypes; nbt++) for (size_t i = 0; i < nbStates; i++) usai[nbt].setIndex(supportedStates[i], 0); for (size_t i = 0; i < nbStates; i++) { for (size_t j = 0; j < nbStates; j++) { if (i != j) { size_t nbt = reg.getType(i, j); if (nbt != 0) usai[nbt - 1].setIndex(supportedStates[i], usai[nbt - 1].getIndex(supportedStates[i]) + nullModel->Qij(i, j)); } } } for (size_t nbt = 0; nbt < nbTypes; nbt++) { unique_ptr<Reward> reward(new DecompositionReward(nullModel, &usai[nbt])); unique_ptr<ProbabilisticRewardMapping> mapping(RewardMappingTools::computeRewardVectors(drtl, ids, *reward, false)); for (size_t i = 0; i < nbSites; ++i) { for (size_t k = 0; k < ids.size(); ++k) { double tmp = (*mapping)(mapping->getNodeIndex(ids[k]), i); if (std::isnan(tmp)) tmp = 0; rewards[ids[k]][i][nbt] = tmp; } } reward.reset(); mapping.reset(); } // check if perWord const CoreWordAlphabet* wAlp=dynamic_cast<const CoreWordAlphabet*>(nullModel->getAlphabet()); float sizeWord=float((wAlp!=NULL) & !perWord?wAlp->getLength():1); // output const TreeTemplate<Node>& tree=drtl.getTree(); for (size_t i = 0; i < nbTypes; ++i) { for (size_t j = 0; j < nbSites; ++j) { VVdouble& resS=result[j]; for (size_t k = 0; k < nbBr; ++k) { resS[k][i] = (*smap)(smap->getNodeIndex(ids[k]), j, i)/rewards[ids[k]][j][i]*(perTime?1:tree.getNode(ids[k])->getDistanceToFather())/sizeWord; } } } } /**************************************************************************************************/ void SubstitutionMappingTools::computeCountsPerSitePerBranchPerType( DRTreeLikelihood& drtl, const vector<int>& ids, SubstitutionModelSet* modelSet, SubstitutionModelSet* nullModelSet, const SubstitutionRegister& reg, VVVdouble& result, bool perTime, bool perWord) { unique_ptr<SubstitutionCount> count(new UniformizationSubstitutionCount(modelSet->getSubstitutionModel(0), reg.clone())); unique_ptr<ProbabilisticSubstitutionMapping> smap(SubstitutionMappingTools::computeSubstitutionVectors(drtl, ids, *count, false)); size_t nbSites = smap->getNumberOfSites(); size_t nbTypes = smap->getNumberOfSubstitutionTypes(); size_t nbStates = nullModelSet->getAlphabet()->getSize(); size_t nbModels = nullModelSet->getNumberOfModels(); size_t nbBr = ids.size(); VectorTools::resize3(result, nbSites, nbBr, nbTypes); // compute the normalization for each site for each substitutionType map<int, vector< vector<double> > > rewards; for (auto id : ids) VectorTools::resize2(rewards[id], nbSites, nbTypes); vector<UserAlphabetIndex1 > usai(nbTypes, UserAlphabetIndex1(nullModelSet->getAlphabet())); for (size_t nbm = 0; nbm < nbModels; nbm++) { vector<int> mids = VectorTools::vectorIntersection(ids, nullModelSet->getNodesWithModel(nbm)); if (mids.size()>0) { const SubstitutionModel* modn = nullModelSet->getSubstitutionModel(nbm); vector<int> supportedStates = modn->getAlphabetStates(); for (size_t nbt = 0; nbt < nbTypes; nbt++) for (size_t i = 0; i < nbStates; i++) usai[nbt].setIndex(supportedStates[i], 0); for (size_t i = 0; i < nbStates; i++) { for (size_t j = 0; j < nbStates; j++) { if (i != j) { size_t nbt = reg.getType(i, j); if (nbt != 0) usai[nbt - 1].setIndex(supportedStates[i], usai[nbt - 1].getIndex(supportedStates[i]) + modn->Qij(i, j)); } } } for (size_t nbt = 0; nbt < nbTypes; nbt++) { unique_ptr<Reward> reward(new DecompositionReward(nullModelSet->getSubstitutionModel(nbm), &usai[nbt])); unique_ptr<ProbabilisticRewardMapping> mapping(RewardMappingTools::computeRewardVectors(drtl, mids, *reward, false)); for (size_t i = 0; i < nbSites; ++i) { for (size_t k = 0; k < mids.size(); k++) { double tmp = (*mapping)(mapping->getNodeIndex(mids[k]), i); if (std::isnan(tmp)) tmp = 0; rewards[mids[k]][i][nbt] = tmp; } } reward.reset(); mapping.reset(); } } } // check if perWord const CoreWordAlphabet* wAlp=dynamic_cast<const CoreWordAlphabet*>(nullModelSet->getAlphabet()); float sizeWord=float((wAlp!=NULL) & !perWord?wAlp->getLength():1); // output const TreeTemplate<Node>& tree=drtl.getTree(); for (size_t i = 0; i < nbTypes; ++i) { for (size_t j = 0; j < nbSites; ++j) { VVdouble& resS=result[j]; for (size_t k = 0; k < nbBr; ++k) { resS[k][i] = (*smap)(smap->getNodeIndex(ids[k]), j, i)/rewards[ids[k]][j][i]*(perTime?1:tree.getNode(ids[k])->getDistanceToFather())/sizeWord; } } } } /**************************************************************************************************/ void SubstitutionMappingTools::outputPerSitePerBranch( const string& filename, const vector<int>& ids, const VVdouble& counts) { size_t nbSites=counts.size(); if (nbSites==0) return; size_t nbBr=counts[0].size(); ofstream file; file.open(filename.c_str()); file << "sites"; for (size_t i = 0; i < nbBr; ++i) { file << "\t" << ids[i]; } file << endl; for (size_t k = 0; k < nbSites; ++k) { const Vdouble& countS=counts[k]; file << k; for (size_t i = 0; i < nbBr; ++i) { file << "\t" << countS[i]; } file << endl; } file.close(); } /**************************************************************************************************/ void SubstitutionMappingTools::outputPerSitePerType( const string& filename, const SubstitutionRegister& reg, const VVdouble& counts) { size_t nbSites=counts.size(); if (nbSites==0) return; size_t nbTypes=counts[0].size(); ofstream file; file.open(filename.c_str()); file << "sites"; for (size_t i = 0; i < nbTypes; ++i) { file << "\t" << reg.getTypeName(i + 1); } file << endl; for (size_t k = 0; k < nbSites; ++k) { file << k; const Vdouble& resS=counts[k]; for (size_t i = 0; i < nbTypes; ++i) { file << "\t" << resS[i]; } file << endl; } file.close(); } /**************************************************************************************************/ void SubstitutionMappingTools::outputPerSitePerBranchPerType( const string& filenamePrefix, const vector<int>& ids, const SubstitutionRegister& reg, const VVVdouble& counts) { size_t nbSites=counts.size(); if (nbSites==0) return; size_t nbBr = counts[0].size(); if (nbBr==0) return; size_t nbTypes = counts[0][0].size(); ofstream file; for (size_t i = 0; i < nbTypes; ++i) { string name=reg.getTypeName(i+1); if (name=="") name=TextTools::toString(i + 1); string path = filenamePrefix + name + string(".count"); ApplicationTools::displayResult(string("Output counts of type ") + TextTools::toString(i + 1) + string(" to file"), path); file.open(path.c_str()); file << "sites"; for (size_t k = 0; k < nbBr; ++k) { file << "\t" << ids[k]; } file << endl; for (size_t j = 0; j < nbSites; ++j) { const VVdouble& resS=counts[j]; file << j; for (size_t k = 0; k < nbBr; ++k) { file << "\t" << resS[k][i]; } file << endl; } file.close(); } }
33.802508
301
0.590107
danydoerr
4e3939b19ea82d41e8b79c1b4eef53ade4cc59ed
1,266
cpp
C++
draw_rr_robot.cpp
HebiRobotics/RobotDiagrams
722040e919bd3ecf89fc5df65233aff9ce6ad6c8
[ "MIT" ]
5
2018-02-13T02:40:45.000Z
2021-04-02T01:23:12.000Z
draw_rr_robot.cpp
HebiRobotics/RobotDiagrams
722040e919bd3ecf89fc5df65233aff9ce6ad6c8
[ "MIT" ]
null
null
null
draw_rr_robot.cpp
HebiRobotics/RobotDiagrams
722040e919bd3ecf89fc5df65233aff9ce6ad6c8
[ "MIT" ]
1
2019-03-16T07:45:20.000Z
2019-03-16T07:45:20.000Z
#include "robot_diagrams_0.0.hpp" int main() { // TODO: messy! figure out the C++03 way to do this right... // NOTE: in C++11, these could be unique_ptrs... // Build robot: // Link 1: // l = 100 // theta = pi/4 // Line 2: // l = 50 // theta = pi/8 // End effector: rob_diag::Robot robot; rob_diag::Base e0(10); rob_diag::RJoint e1; rob_diag::Link e2(100, M_PI / 4); rob_diag::RJoint e3; rob_diag::Link e4(50, M_PI / 8); robot.elements_.push_back((rob_diag::RobotElement*)&e0); robot.elements_.push_back((rob_diag::RobotElement*)&e1); robot.elements_.push_back((rob_diag::RobotElement*)&e2); robot.elements_.push_back((rob_diag::RobotElement*)&e3); robot.elements_.push_back((rob_diag::RobotElement*)&e4); // Compute dimensions rob_diag::Rect bounds = robot.compute_dimensions(); double width = bounds.right_ - bounds.left_; double height = bounds.top_ - bounds.bottom_; double margin = 10; svg::Dimensions dimensions(width + margin * 2.0, height + margin * 2.0); // Draw to file: Document doc("robot.svg", svg::Layout(dimensions, svg::Layout::BottomLeft)); rob_diag::Pose origin(-bounds.left_ + margin, -bounds.bottom_ + margin, 0); robot.draw_at(doc, origin); // Save and quit doc.save(); }
30.142857
78
0.668246
HebiRobotics
4e40271d3c05cc41522e8de3a7c1b09c9e60bfde
946
cpp
C++
04 April Leetcode Challenge 2021/17 removeAdjString2.cpp
FazeelUsmani/Leetcode
aff4c119178f132c28a39506ffaa75606e0a861b
[ "MIT" ]
7
2020-12-01T14:27:57.000Z
2022-02-12T09:17:22.000Z
04 April Leetcode Challenge 2021/17 removeAdjString2.cpp
FazeelUsmani/Leetcode
aff4c119178f132c28a39506ffaa75606e0a861b
[ "MIT" ]
4
2020-11-12T17:49:22.000Z
2021-09-06T07:46:37.000Z
04 April Leetcode Challenge 2021/17 removeAdjString2.cpp
FazeelUsmani/Leetcode
aff4c119178f132c28a39506ffaa75606e0a861b
[ "MIT" ]
6
2021-05-21T03:49:22.000Z
2022-01-20T20:36:53.000Z
class Solution { public: string removeDuplicates(string s, int k) { // support variables string res; int counter, tot = s.size(), pos = 0, prevPos; pair<char, int> stack[tot]; // parsing s for (char c: s) { prevPos = pos - 1; // case 1: new insertion for empty stack or different char if (!pos || stack[prevPos].first != c) { stack[pos++] = {c, 2}; } // case 2: same character found else { counter = stack[prevPos].second; if (counter == k) tot -= k, pos--; else stack[prevPos].second++; } } // properly sizing res res.resize(tot); // building res for (int i = 0, j = 0; i < pos; i++) { auto [c, freq] = stack[i]; while (--freq) res[j++] = c; } return res; } };
29.5625
70
0.438689
FazeelUsmani
4e42b370cefd6081554867c536f6fdf68f1140fb
7,037
cc
C++
tests/checkers/checker.cc
numairmansur/crab
316e3946d3a4d92db638c54fbfa8fb7bee1ebbc7
[ "Apache-2.0" ]
4
2021-05-19T17:35:30.000Z
2021-08-17T04:03:21.000Z
tests/checkers/checker.cc
numairmansur/crab
316e3946d3a4d92db638c54fbfa8fb7bee1ebbc7
[ "Apache-2.0" ]
null
null
null
tests/checkers/checker.cc
numairmansur/crab
316e3946d3a4d92db638c54fbfa8fb7bee1ebbc7
[ "Apache-2.0" ]
1
2022-01-15T11:20:30.000Z
2022-01-15T11:20:30.000Z
#include "../program_options.hpp" #include "../common.hpp" #include <crab/checkers/base_property.hpp> #include <crab/checkers/null.hpp> #include <crab/checkers/div_zero.hpp> #include <crab/checkers/assertion.hpp> #include <crab/checkers/checker.hpp> #include <crab/analysis/dataflow/assertion_crawler.hpp> #include <crab/analysis/dataflow/assumptions.hpp> using namespace std; using namespace crab::analyzer; using namespace crab::cfg; using namespace crab::cfg_impl; using namespace crab::domain_impl; using namespace crab::checker; z_cfg_t* cfg1 (variable_factory_t &vfac) { // entry and exit block z_cfg_t* cfg = new z_cfg_t("b0","b3",PTR); // adding blocks z_basic_block_t& b0 = cfg->insert ("b0"); z_basic_block_t& b1 = cfg->insert ("b1"); z_basic_block_t& b2 = cfg->insert ("b2"); z_basic_block_t& b3 = cfg->insert ("b3"); // adding control flow b0 >> b1; b0 >> b2; b1 >> b3; b2 >> b3; // definining program variables z_var p(vfac ["p"], crab::PTR_TYPE); z_var q1(vfac ["q1"], crab::PTR_TYPE); z_var q2(vfac ["q2"], crab::PTR_TYPE); z_var r(vfac ["r"], crab::PTR_TYPE); z_var nd(vfac ["nd"], crab::INT_TYPE, 32); // adding statements b0.ptr_new_object (p , 1); // p = malloc (...); b0.ptr_new_object (q1, 2); // q1 = malloc (...); b0.ptr_new_object (q2, 3); // q2 = malloc (...); b0.havoc (nd); b1.assume (nd >= 1); b2.assume (nd <= 0); b1.ptr_store (p, q1); // *p = q1 b2.ptr_store (p, q2); // *p = q2 b3.ptr_load (r, p); // r = *p return cfg; } z_cfg_t* cfg2 (variable_factory_t &vfac) { // Definining program variables z_var i (vfac ["i"], crab::INT_TYPE, 32); z_var x (vfac ["x"], crab::INT_TYPE, 32); z_var y (vfac ["y"], crab::INT_TYPE, 32); z_var p (vfac ["p"], crab::PTR_TYPE); z_var q (vfac ["q"], crab::PTR_TYPE); // entry and exit block z_cfg_t* cfg = new z_cfg_t("entry","ret",PTR); // adding blocks z_basic_block_t& entry = cfg->insert ("entry"); z_basic_block_t& bb1 = cfg->insert ("bb1"); z_basic_block_t& bb1_t = cfg->insert ("bb1_t"); z_basic_block_t& bb1_f = cfg->insert ("bb1_f"); z_basic_block_t& bb2 = cfg->insert ("bb2"); z_basic_block_t& ret = cfg->insert ("ret"); // adding control flow entry >> bb1; bb1 >> bb1_t; bb1 >> bb1_f; bb1_t >> bb2; bb2 >> bb1; bb1_f >> ret; // adding statements entry.assign (i, 0); entry.assign (x, 1); entry.assign (y, 0); entry.ptr_null (p); bb1_t.assume (i <= 99); bb1_f.assume (i >= 100); bb2.add(x,x,y); bb2.add(y,y,1); bb2.ptr_new_object (q, 1); bb2.ptr_assign (p, q, z_number(4)); bb2.add(i, i, 1); ret.assume (x <= y); ret.assertion (i == 100); ret.assertion (i >= 200); ret.assertion (x >= y); ret.assertion (x >= 200); return cfg; } // Print invariants by traversing the cfg in dfs. template<typename Analyzer> static void print_invariants(z_cfg_ref_t cfg, Analyzer& analyser) { std::set<crab::cfg_impl::basic_block_label_t> visited; std::vector<crab::cfg_impl::basic_block_label_t> worklist; worklist.push_back(cfg.entry()); visited.insert(cfg.entry()); while (!worklist.empty()) { auto cur_label = worklist.back(); worklist.pop_back(); auto pre = analyser.get_pre (cur_label); auto post = analyser.get_post (cur_label); crab::outs() << get_label_str (cur_label) << "=" << pre << " ==> " << post << "\n"; auto const &cur_node = cfg.get_node (cur_label); for (auto const kid_label : boost::make_iterator_range(cur_node.next_blocks())) { if (visited.insert(kid_label).second) { worklist.push_back(kid_label); } } } } void check (z_cfg_ref_t cfg, variable_factory_t& vfac) { // Each checker is associated to one analyzer typedef intra_fwd_analyzer<z_cfg_ref_t, z_num_null_domain_t> null_analyzer_t; typedef intra_checker<null_analyzer_t> null_checker_t; typedef intra_fwd_analyzer<z_cfg_ref_t, z_sdbm_domain_t> num_analyzer_t; typedef intra_checker<num_analyzer_t> num_checker_t; // We can have multiple properties per analyzer typedef null_property_checker<null_analyzer_t> null_prop_null_checker_t; typedef div_zero_property_checker<num_analyzer_t> div_zero_prop_num_checker_t; typedef assert_property_checker<num_analyzer_t> assert_prop_num_checker_t; // Run liveness (optionally) and print cfg liveness<z_cfg_ref_t> live (cfg); crab::outs() << cfg << "\n"; // Run nullity analysis null_analyzer_t null_a (cfg, z_num_null_domain_t::top (), &live); null_a.run (); crab::outs() << "Analysis using " << z_num_null_domain_t::getDomainName () << "\n"; print_invariants(cfg, null_a); // for (auto &b : cfg) { // auto pre = null_a.get_pre (b.label ()); // auto post = null_a.get_post (b.label ()); // crab::outs() << get_label_str (b.label ()) << "=" // << pre // << " ==> " // << post << "\n"; // } // Run numerical analysis num_analyzer_t num_a (cfg, z_sdbm_domain_t::top (), &live); num_a.run (); crab::outs() << "Analysis using " << z_sdbm_domain_t::getDomainName () << "\n"; print_invariants(cfg, num_a); // for (auto &b : cfg) { // auto pre = num_a.get_pre (b.label ()); // auto post = num_a.get_post (b.label ()); // crab::outs() << get_label_str (b.label ()) << "=" // << pre // << " ==> " // << post << "\n"; // } // Run the checkers with several properties // A checker can take any property checker associated to same // analyzer. const int verbose = 3; { typename null_checker_t::prop_checker_ptr prop1 (new null_prop_null_checker_t (verbose)); null_checker_t checker (null_a, {prop1}); checker.run (); checker.show (crab::outs()); } { typename num_checker_t::prop_checker_ptr prop1 (new div_zero_prop_num_checker_t (verbose)); typename num_checker_t::prop_checker_ptr prop2 (new assert_prop_num_checker_t (verbose)); num_checker_t checker (num_a, {prop1, prop2}); checker.run (); checker.show (crab::outs()); } } int main (int argc, char**argv) { bool stats_enabled = false; if (!crab_tests::parse_user_options(argc,argv,stats_enabled)) { return 0; } variable_factory_t vfac; z_cfg_t* p1 = cfg1 (vfac); check (*p1, vfac); z_cfg_t* p2 = cfg2 (vfac); // To test the assertion crawler analysis crab::analyzer::assertion_crawler<z_cfg_ref_t> assert_crawler(*p2); assert_crawler.exec(); crab::outs() << "\n" << assert_crawler << "\n"; // To test the assumption analyses crab::analyzer::assumption_naive_analysis<z_cfg_ref_t> assumption_naive_analyzer(*p2); assumption_naive_analyzer.exec(); crab::outs() << "\n" << assumption_naive_analyzer << "\n"; crab::analyzer::assumption_dataflow_analysis<z_cfg_ref_t> assumption_dataflow_analyzer(*p2); assumption_dataflow_analyzer.exec(); crab::outs() << "\n" << assumption_dataflow_analyzer << "\n"; check (*p2, vfac); delete p1; delete p2; return 0; }
31.137168
95
0.647293
numairmansur
4e4483494ee43eb39abe88de55ca10a991899a6b
3,414
cpp
C++
src/libraries/core/primitives/bools/Switch/Switch.cpp
MrAwesomeRocks/caelus-cml
55b6dc5ba47d0e95c07412d9446ac72ac11d7fd7
[ "mpich2" ]
null
null
null
src/libraries/core/primitives/bools/Switch/Switch.cpp
MrAwesomeRocks/caelus-cml
55b6dc5ba47d0e95c07412d9446ac72ac11d7fd7
[ "mpich2" ]
null
null
null
src/libraries/core/primitives/bools/Switch/Switch.cpp
MrAwesomeRocks/caelus-cml
55b6dc5ba47d0e95c07412d9446ac72ac11d7fd7
[ "mpich2" ]
null
null
null
/*---------------------------------------------------------------------------*\ Copyright (C) 2011-2016 OpenFOAM Foundation ------------------------------------------------------------------------------- License This file is part of CAELUS. CAELUS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. CAELUS is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with CAELUS. If not, see <http://www.gnu.org/licenses/>. \*---------------------------------------------------------------------------*/ #include "Switch.hpp" #include "error.hpp" #include "dictionary.hpp" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // NB: values chosen such that bitwise '&' 0x1 yields the bool value // INVALID is also evaluates to false, but don't rely on that const char* CML::Switch::names[CML::Switch::INVALID+1] = { "false", "true", "off", "on", "no", "yes", "n", "y", "f", "t", "none", "true", // Is there a reasonable counterpart to "none"? "invalid" }; // * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * * // CML::Switch::switchType CML::Switch::asEnum ( const std::string& str, const bool allowInvalid ) { for (int sw = 0; sw < Switch::INVALID; ++sw) { if (str == names[sw]) { // handle aliases switch (sw) { case Switch::NO_1: case Switch::NONE: { return Switch::NO; break; } case Switch::YES_1: { return Switch::YES; break; } case Switch::FALSE_1: { return Switch::FALSE; break; } case Switch::TRUE_1: { return Switch::TRUE; break; } default: { return switchType(sw); break; } } } } if (!allowInvalid) { FatalErrorInFunction << "unknown switch word " << str << nl << abort(FatalError); } return Switch::INVALID; } CML::Switch CML::Switch::lookupOrAddToDict ( const word& name, dictionary& dict, const Switch& defaultValue ) { return dict.lookupOrAddDefault<Switch>(name, defaultValue); } // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // bool CML::Switch::valid() const { return switch_ <= Switch::NONE; } const char* CML::Switch::asText() const { return names[switch_]; } bool CML::Switch::readIfPresent(const word& name, const dictionary& dict) { return dict.readIfPresent<Switch>(name, *this); } // ************************************************************************* //
25.477612
80
0.463093
MrAwesomeRocks
4e4612470acbf6c4db4475ed560fdbad6ae8ff19
1,335
cpp
C++
src/gui/editorwidgets/qgsdummyconfigdlg.cpp
dyna-mis/Hilabeling
cb7d5d4be29624a20c8a367162dbc6fd779b2b52
[ "MIT" ]
null
null
null
src/gui/editorwidgets/qgsdummyconfigdlg.cpp
dyna-mis/Hilabeling
cb7d5d4be29624a20c8a367162dbc6fd779b2b52
[ "MIT" ]
null
null
null
src/gui/editorwidgets/qgsdummyconfigdlg.cpp
dyna-mis/Hilabeling
cb7d5d4be29624a20c8a367162dbc6fd779b2b52
[ "MIT" ]
1
2021-12-25T08:40:30.000Z
2021-12-25T08:40:30.000Z
/*************************************************************************** qgsdummyconfigdlg.cpp -------------------------------------- Date : 5.1.2014 Copyright : (C) 2014 Matthias Kuhn Email : matthias at opengis dot ch *************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #include "qgsdummyconfigdlg.h" QgsDummyConfigDlg::QgsDummyConfigDlg( QgsVectorLayer *vl, int fieldIdx, QWidget *parent, const QString &description ) : QgsEditorConfigWidget( vl, fieldIdx, parent ) { setupUi( this ); mDummyTextLabel->setText( description ); } QVariantMap QgsDummyConfigDlg::config() { return QVariantMap(); } void QgsDummyConfigDlg::setConfig( const QVariantMap &config ) { Q_UNUSED( config ); }
37.083333
117
0.445693
dyna-mis
4e49a7fefdd9e99a662c62d628dc49a1394a442a
34,868
cpp
C++
src/libs/viface/viface.cpp
francescomessina/polycube
38f2fb4ffa13cf51313b3cab9994be738ba367be
[ "ECL-2.0", "Apache-2.0" ]
337
2018-12-12T11:50:15.000Z
2022-03-15T00:24:35.000Z
src/libs/viface/viface.cpp
l1b0k/polycube
7af919245c131fa9fe24c5d39d10039cbb81e825
[ "ECL-2.0", "Apache-2.0" ]
253
2018-12-17T21:36:15.000Z
2022-01-17T09:30:42.000Z
src/libs/viface/viface.cpp
l1b0k/polycube
7af919245c131fa9fe24c5d39d10039cbb81e825
[ "ECL-2.0", "Apache-2.0" ]
90
2018-12-19T15:49:38.000Z
2022-03-27T03:56:07.000Z
/** * Copyright (C) 2015 Hewlett Packard Enterprise Development LP * * 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 "viface/private/viface.hpp" namespace viface { /*= Utilities ================================================================*/ namespace utils { vector<uint8_t> parse_mac(string const& mac) { unsigned int bytes[6]; int scans = sscanf( mac.c_str(), "%02x:%02x:%02x:%02x:%02x:%02x", &bytes[0], &bytes[1], &bytes[2], &bytes[3], &bytes[4], &bytes[5] ); if (scans != 6) { ostringstream what; what << "--- Invalid MAC address " << mac << endl; throw invalid_argument(what.str()); } vector<uint8_t> parsed(6); parsed.assign(&bytes[0], &bytes[6]); return parsed; } string hexdump(vector<uint8_t> const& bytes) { ostringstream buff; int buflen = bytes.size(); int i; int j; char c; for (i = 0, j = 0; i < buflen; i += 16) { // Print offset buff << right << setfill('0') << setw(4) << i << " "; // Print bytes in hexadecimal buff << hex; for (j = 0; j < 16; j++) { if (i + j < buflen) { c = bytes[i + j]; buff << setfill('0') << setw(2) << (int(c) & 0xFF); buff << " "; } else { buff << " "; } } buff << dec; buff << " "; // Print printable characters for (j = 0; j < 16; j++) { if (i + j < buflen) { c = bytes[i + j]; if (isprint(c)) { buff << c; } else { buff << "."; } } } buff << endl; } return buff.str(); } uint32_t crc32(vector<uint8_t> const& bytes) { static uint32_t crc_table[] = { 0x4DBDF21C, 0x500AE278, 0x76D3D2D4, 0x6B64C2B0, 0x3B61B38C, 0x26D6A3E8, 0x000F9344, 0x1DB88320, 0xA005713C, 0xBDB26158, 0x9B6B51F4, 0x86DC4190, 0xD6D930AC, 0xCB6E20C8, 0xEDB71064, 0xF0000000 }; uint32_t crc = 0; const uint8_t* data = &bytes[0]; for (uint32_t i = 0; i < bytes.size(); ++i) { crc = (crc >> 4) ^ crc_table[(crc ^ data[i]) & 0x0F]; crc = (crc >> 4) ^ crc_table[(crc ^ (data[i] >> 4)) & 0x0F]; } return crc; } } /*= Helpers ==================================================================*/ static void read_flags(int sockfd, string name, struct ifreq& ifr) { ostringstream what; // Prepare communication structure memset(&ifr, 0, sizeof(struct ifreq)); // Set interface name (void) strncpy(ifr.ifr_name, name.c_str(), IFNAMSIZ - 1); // Read interface flags if (ioctl(sockfd, SIOCGIFFLAGS, &ifr) != 0) { what << "--- Unable to read " << name << " flags." << endl; what << " Error: " << strerror(errno); what << " (" << errno << ")." << endl; throw runtime_error(what.str()); } } static uint read_mtu(string name, size_t size_bytes) { int fd = -1; int nread = -1; ostringstream what; char buffer[size_bytes + 1]; // Opens MTU file fd = open(("/sys/class/net/" + name + "/mtu").c_str(), O_RDONLY | O_NONBLOCK); if (fd < 0) { what << "--- Unable to open MTU file for '"; what << name << "' network interface." << endl; what << " Error: " << strerror(errno); what << " (" << errno << ")." << endl; goto err; } // Reads MTU value nread = read(fd, &buffer, size_bytes); buffer[size_bytes] = '\0'; // Handles errors if (nread == -1) { what << "--- Unable to read MTU for '"; what << name << "' network interface." << endl; what << " Error: " << strerror(errno); what << " (" << errno << ")." << endl; goto err; } if (close(fd) < 0) { what << "--- Unable to close MTU file for '"; what << name << "' network interface." << endl; what << " Error: " << strerror(errno); what << " (" << errno << ")." << endl; goto err; } return stoul(buffer, nullptr, 10); err: // Rollback close file descriptor close(fd); throw runtime_error(what.str()); } static string alloc_viface(string name, bool tap, struct viface_queues* queues) { int i = 0; int fd = -1; ostringstream what; /* Create structure for ioctl call * * Flags: IFF_TAP - TAP device (layer 2, ethernet frame) * IFF_TUN - TUN device (layer 3, IP packet) * IFF_NO_PI - Do not provide packet information * IFF_MULTI_QUEUE - Create a queue of multiqueue device */ struct ifreq ifr; memset(&ifr, 0, sizeof(ifr)); ifr.ifr_flags = IFF_NO_PI | IFF_MULTI_QUEUE; if (tap) { ifr.ifr_flags |= IFF_TAP; } else { ifr.ifr_flags |= IFF_TUN; } (void) strncpy(ifr.ifr_name, name.c_str(), IFNAMSIZ - 1); // Allocate queues for (i = 0; i < 2; i++) { // Open TUN/TAP device fd = open("/dev/net/tun", O_RDWR | O_NONBLOCK); if (fd < 0) { what << "--- Unable to open TUN/TAP device." << endl; what << " Name: " << name << " Queue: " << i << endl; what << " Error: " << strerror(errno); what << " (" << errno << ")." << endl; goto err; } // Register a network device with the kernel if (ioctl(fd, TUNSETIFF, (void *)&ifr) != 0) { what << "--- Unable to register a TUN/TAP device." << endl; what << " Name: " << name << " Queue: " << i << endl; what << " Error: " << strerror(errno); what << " (" << errno << ")." << endl; if (close(fd) < 0) { what << "--- Unable to close a TUN/TAP device." << endl; what << " Name: " << name << " Queue: " << i << endl; what << " Error: " << strerror(errno); what << " (" << errno << ")." << endl; } goto err; } ((int *)queues)[i] = fd; } return string(ifr.ifr_name); err: // Rollback close file descriptors for (--i; i >= 0; i--) { if (close(((int *)queues)[i]) < 0) { what << "--- Unable to close a TUN/TAP device." << endl; what << " Name: " << name << " Queue: " << i << endl; what << " Error: " << strerror(errno); what << " (" << errno << ")." << endl; } } throw runtime_error(what.str()); } static void hook_viface(string name, struct viface_queues* queues) { int i = 0; int fd = -1; ostringstream what; // Creates Tx/Rx sockets and allocates queues for (i = 0; i < 2; i++) { // Creates the socket fd = socket(AF_PACKET, SOCK_RAW, htons(ETH_P_ALL)); if (fd < 0) { what << "--- Unable to create the Tx/Rx socket channel." << endl; what << " Name: " << name << " Queue: " << i << endl; what << " Error: " << strerror(errno); what << " (" << errno << ")." << endl; goto err; } struct ifreq ifr; memset(&ifr, 0, sizeof(ifr)); (void) strncpy(ifr.ifr_name, name.c_str(), IFNAMSIZ - 1); // Obtains the network index number if (ioctl(fd, SIOCGIFINDEX, &ifr) != 0) { what << "--- Unable to get network index number."; what << " Name: " << name << " Queue: " << i << endl; what << " Error: " << strerror(errno); what << " (" << errno << ")." << endl; goto err; } struct sockaddr_ll socket_addr; memset(&socket_addr, 0, sizeof(struct sockaddr_ll)); socket_addr.sll_family = AF_PACKET; socket_addr.sll_protocol = htons(ETH_P_ALL); socket_addr.sll_ifindex = ifr.ifr_ifindex; // Binds the socket to the 'socket_addr' address if (bind(fd, (struct sockaddr*) &socket_addr, sizeof(socket_addr)) != 0) { what << "--- Unable to bind the Tx/Rx socket channel to the '"; what << name << "' network interface." << endl; what << " Queue: " << i << "." << endl; what << " Error: " << strerror(errno); what << " (" << errno << ")." << endl; goto err; } ((int *)queues)[i] = fd; } return; err: // Rollback close file descriptors for (--i; i >= 0; i--) { if (close(((int *)queues)[i]) < 0) { what << "--- Unable to close a Rx/Tx socket." << endl; what << " Name: " << name << " Queue: " << i << endl; what << " Error: " << strerror(errno); what << " (" << errno << ")." << endl; } } throw runtime_error(what.str()); } /*= Virtual Interface Implementation =========================================*/ uint VIfaceImpl::idseq = 0; VIfaceImpl::VIfaceImpl(string name, bool tap, int id) { // Check name length if (name.length() >= IFNAMSIZ) { throw invalid_argument("--- Virtual interface name too long."); } // Create queues struct viface_queues queues; memset(&queues, 0, sizeof(struct viface_queues)); /* Checks if the path name can be accessed. If so, * it means that the network interface is already defined. */ if (access(("/sys/class/net/" + name).c_str(), F_OK) == 0) { hook_viface(name, &queues); this->name = name; // Read MTU value and resize buffer this->mtu = read_mtu(name, sizeof(this->mtu)); this->pktbuff.resize(this->mtu); } else { this->name = alloc_viface(name, tap, &queues); // Other defaults this->mtu = 1500; } this->queues = queues; // Create socket channels to the NET kernel for later ioctl this->kernel_socket = -1; this->kernel_socket = socket(AF_INET, SOCK_STREAM, 0); if (this->kernel_socket < 0) { ostringstream what; what << "--- Unable to create IPv4 socket channel to the NET kernel."; what << endl; what << " Error: " << strerror(errno); what << " (" << errno << ")." << endl; throw runtime_error(what.str()); } this->kernel_socket_ipv6 = -1; this->kernel_socket_ipv6 = socket(AF_INET6, SOCK_STREAM, 0); if (this->kernel_socket_ipv6 < 0) { ostringstream what; what << "--- Unable to create IPv6 socket channel to the NET kernel."; what << endl; what << " Error: " << strerror(errno); what << " (" << errno << ")." << endl; throw runtime_error(what.str()); } // Set id if (id < 0) { this->id = this->idseq; } else { this->id = id; } this->idseq++; } VIfaceImpl::~VIfaceImpl() { if (close(this->queues.rx) || close(this->queues.tx) || close(this->kernel_socket) || close(this->kernel_socket_ipv6)) { ostringstream what; what << "--- Unable to close file descriptors for interface "; what << this->name << "." << endl; what << " Error: " << strerror(errno); what << " (" << errno << ")." << endl; throw runtime_error(what.str()); } } void VIfaceImpl::setMAC(string mac) { vector<uint8_t> mac_bin = utils::parse_mac(mac); this->mac = mac; return; } string VIfaceImpl::getMAC() const { // Read interface flags struct ifreq ifr; read_flags(this->kernel_socket, this->name, ifr); if (ioctl(this->kernel_socket, SIOCGIFHWADDR, &ifr) != 0) { ostringstream what; what << "--- Unable to get MAC addr for " << this->name << "." << endl; what << " Error: " << strerror(errno); what << " (" << errno << ")." << endl; throw runtime_error(what.str()); } // Convert binary MAC address to string ostringstream addr; addr << hex << std::setfill('0'); for (int i = 0; i < 6; i++) { addr << setw(2) << (unsigned int) (0xFF & ifr.ifr_hwaddr.sa_data[i]); if (i != 5) { addr << ":"; } } return addr.str(); } void VIfaceImpl::setIPv4(string ipv4) { // Validate format struct in_addr addr; if (!inet_pton(AF_INET, ipv4.c_str(), &addr)) { ostringstream what; what << "--- Invalid IPv4 address (" << ipv4 << ") for "; what << this->name << "." << endl; throw invalid_argument(what.str()); } this->ipv4 = ipv4; return; } string VIfaceImpl::ioctlGetIPv4(unsigned long request) const { ostringstream what; // Read interface flags struct ifreq ifr; read_flags(this->kernel_socket, this->name, ifr); if (ioctl(this->kernel_socket, request, &ifr) != 0) { what << "--- Unable to get IPv4 for " << this->name << "." << endl; what << " Error: " << strerror(errno); what << " (" << errno << ")." << endl; throw runtime_error(what.str()); } // Convert binary IP address to string char addr[INET_ADDRSTRLEN]; memset(&addr, 0, sizeof(addr)); struct sockaddr_in* ipaddr = (struct sockaddr_in*) &ifr.ifr_addr; if (inet_ntop(AF_INET, &(ipaddr->sin_addr), addr, sizeof(addr)) == NULL) { what << "--- Unable to convert IPv4 for " << this->name << "." << endl; what << " Error: " << strerror(errno); what << " (" << errno << ")." << endl; throw runtime_error(what.str()); } return string(addr); } string VIfaceImpl::getIPv4() const { return this->ioctlGetIPv4(SIOCGIFADDR); } void VIfaceImpl::setIPv4Netmask(string netmask) { // Validate format struct in_addr addr; if (!inet_pton(AF_INET, netmask.c_str(), &addr)) { ostringstream what; what << "--- Invalid IPv4 netmask (" << netmask << ") for "; what << this->name << "." << endl; throw invalid_argument(what.str()); } this->netmask = netmask; return; } string VIfaceImpl::getIPv4Netmask() const { return this->ioctlGetIPv4(SIOCGIFNETMASK); } void VIfaceImpl::setIPv4Broadcast(string broadcast) { // Validate format struct in_addr addr; if (!inet_pton(AF_INET, broadcast.c_str(), &addr)) { ostringstream what; what << "--- Invalid IPv4 address (" << broadcast << ") for "; what << this->name << "." << endl; throw invalid_argument(what.str()); } this->broadcast = broadcast; return; } string VIfaceImpl::getIPv4Broadcast() const { return this->ioctlGetIPv4(SIOCGIFBRDADDR); } void VIfaceImpl::setMTU(uint mtu) { ostringstream what; if (mtu < ETH_HLEN) { what << "--- MTU " << mtu << " too small (< " << ETH_HLEN << ")."; what << endl; throw invalid_argument(what.str()); } // Are we sure about this upper validation? // lo interface reports this number for its MTU if (mtu > 65536) { what << "--- MTU " << mtu << " too large (> 65536)." << endl; throw invalid_argument(what.str()); } this->mtu = mtu; return; } void VIfaceImpl::setIPv6(set<string> const& ipv6s) { // Validate format struct in6_addr addr6; for (auto & ipv6 : ipv6s) { if (!inet_pton(AF_INET6, ipv6.c_str(), &addr6)) { ostringstream what; what << "--- Invalid IPv6 address (" << ipv6 << ") for "; what << this->name << "." << endl; throw invalid_argument(what.str()); } } this->ipv6s = ipv6s; return; } set<string> VIfaceImpl::getIPv6() const { // Return set set<string> result; // Buffer to store string representation of the address char buff[INET6_ADDRSTRLEN]; memset(&buff, 0, sizeof(buff)); // Cast pointer to ipv6 address struct sockaddr_in6* addr; // Pointers to list head and current node struct ifaddrs *head; struct ifaddrs *node; // Get list of interfaces if (getifaddrs(&head) == -1) { ostringstream what; what << "--- Failed to get list of interface addresses." << endl; what << " Error: " << strerror(errno); what << " (" << errno << ")." << endl; throw runtime_error(what.str()); } // Iterate list for (node = head; node != NULL; node = node->ifa_next) { if (node->ifa_addr == NULL) { continue; } if (node->ifa_addr->sa_family != AF_INET6) { continue; } if (string(node->ifa_name) != this->name) { continue; } // Convert IPv6 address to string representation addr = (struct sockaddr_in6*) node->ifa_addr; if (inet_ntop(AF_INET6, &(addr->sin6_addr), buff, sizeof(buff)) == NULL) { ostringstream what; what << "--- Unable to convert IPv6 for " << this->name; what << "." << endl; what << " Error: " << strerror(errno); what << " (" << errno << ")." << endl; throw runtime_error(what.str()); } result.insert(string(buff)); } freeifaddrs(head); return result; } uint VIfaceImpl::getMTU() const { // Read interface flags struct ifreq ifr; read_flags(this->kernel_socket, this->name, ifr); if (ioctl(this->kernel_socket, SIOCGIFMTU, &ifr) != 0) { ostringstream what; what << "--- Unable to get MTU for " << this->name << "." << endl; what << " Error: " << strerror(errno); what << " (" << errno << ")." << endl; throw runtime_error(what.str()); } return ifr.ifr_mtu; } void VIfaceImpl::up() { ostringstream what; if (this->isUp()) { what << "--- Virtual interface " << this->name; what << " is already up." << endl; what << " up() Operation not permitted." << endl; throw runtime_error(what.str()); } // Read interface flags struct ifreq ifr; read_flags(this->kernel_socket, this->name, ifr); // Set MAC address if (!this->mac.empty()) { vector<uint8_t> mac_bin = utils::parse_mac(this->mac); ifr.ifr_hwaddr.sa_family = ARPHRD_ETHER; for (int i = 0; i < 6; i++) { ifr.ifr_hwaddr.sa_data[i] = mac_bin[i]; } if (ioctl(this->kernel_socket, SIOCSIFHWADDR, &ifr) != 0) { what << "--- Unable to set MAC Address (" << this->mac; what << ") for " << this->name << "." << endl; what << " Error: " << strerror(errno); what << " (" << errno << ")." << endl; throw runtime_error(what.str()); } } // Set IPv4 related // FIXME: Refactor this, it's ugly :/ struct sockaddr_in* addr = (struct sockaddr_in*) &ifr.ifr_addr; addr->sin_family = AF_INET; // Address if (!this->ipv4.empty()) { if (!inet_pton(AF_INET, this->ipv4.c_str(), &addr->sin_addr)) { what << "--- Invalid cached IPv4 address (" << this->ipv4; what << ") for " << this->name << "." << endl; what << " Something really bad happened :/" << endl; throw runtime_error(what.str()); } if (ioctl(this->kernel_socket, SIOCSIFADDR, &ifr) != 0) { what << "--- Unable to set IPv4 (" << this->ipv4; what << ") for " << this->name << "." << endl; what << " Error: " << strerror(errno); what << " (" << errno << ")." << endl; throw runtime_error(what.str()); } } // Netmask if (!this->netmask.empty()) { if (!inet_pton(AF_INET, this->netmask.c_str(), &addr->sin_addr)) { what << "--- Invalid cached IPv4 netmask (" << this->netmask; what << ") for " << this->name << "." << endl; what << " Something really bad happened :/" << endl; throw runtime_error(what.str()); } if (ioctl(this->kernel_socket, SIOCSIFNETMASK, &ifr) != 0) { what << "--- Unable to set IPv4 netmask (" << this->netmask; what << ") for " << this->name << "." << endl; what << " Error: " << strerror(errno); what << " (" << errno << ")." << endl; throw runtime_error(what.str()); } } // Broadcast if (!this->broadcast.empty()) { if (!inet_pton(AF_INET, this->broadcast.c_str(), &addr->sin_addr)) { what << "--- Invalid cached IPv4 broadcast (" << this->broadcast; what << ") for " << this->name << "." << endl; what << " Something really bad happened :/" << endl; throw runtime_error(what.str()); } if (ioctl(this->kernel_socket, SIOCSIFBRDADDR, &ifr) != 0) { what << "--- Unable to set IPv4 broadcast (" << this->broadcast; what << ") for " << this->name << "." << endl; what << " Error: " << strerror(errno); what << " (" << errno << ")." << endl; throw runtime_error(what.str()); } } // Set IPv6 related // FIXME: Refactor this, it's ugly :/ if (!this->ipv6s.empty()) { struct in6_ifreq ifr6; memset(&ifr6, 0, sizeof(struct in6_ifreq)); // Get interface index if (ioctl(this->kernel_socket, SIOGIFINDEX, &ifr) < 0) { what << "--- Unable to get interface index for ("; what << this->name << "." << endl; what << " Something really bad happened :/" << endl; throw runtime_error(what.str()); } ifr6.ifr6_ifindex = ifr.ifr_ifindex; ifr6.ifr6_prefixlen = 64; for (auto & ipv6 : this->ipv6s) { // Parse IPv6 address into IPv6 address structure if (!inet_pton(AF_INET6, ipv6.c_str(), &ifr6.ifr6_addr)) { what << "--- Invalid cached IPv6 address (" << ipv6; what << ") for " << this->name << "." << endl; what << " Something really bad happened :/" << endl; throw runtime_error(what.str()); } // Set IPv6 address if (ioctl(this->kernel_socket_ipv6, SIOCSIFADDR, &ifr6) < 0) { what << "--- Unable to set IPv6 address (" << ipv6; what << ") for " << this->name << "." << endl; what << " Error: " << strerror(errno); what << " (" << errno << ")." << endl; throw runtime_error(what.str()); } } } // Set MTU ifr.ifr_mtu = this->mtu; if (ioctl(this->kernel_socket, SIOCSIFMTU, &ifr) != 0) { what << "--- Unable to set MTU (" << this->mtu << ") for "; what << this->name << "." << endl; what << " Error: " << strerror(errno); what << " (" << errno << ")." << endl; throw runtime_error(what.str()); } this->pktbuff.resize(this->mtu); // Bring-up interface ifr.ifr_flags |= IFF_UP; if (ioctl(this->kernel_socket, SIOCSIFFLAGS, &ifr) != 0) { what << "--- Unable to bring-up interface " << this->name; what << "." << endl; what << " Error: " << strerror(errno); what << " (" << errno << ")." << endl; throw runtime_error(what.str()); } return; } void VIfaceImpl::down() const { // Read interface flags struct ifreq ifr; read_flags(this->kernel_socket, this->name, ifr); // Bring-down interface ifr.ifr_flags &= ~IFF_UP; if (ioctl(this->kernel_socket, SIOCSIFFLAGS, &ifr) != 0) { ostringstream what; what << "--- Unable to bring-down interface " << this->name; what << "." << endl; what << " Error: " << strerror(errno); what << " (" << errno << ")." << endl; throw runtime_error(what.str()); } return; } bool VIfaceImpl::isUp() const { // Read interface flags struct ifreq ifr; read_flags(this->kernel_socket, this->name, ifr); return (ifr.ifr_flags & IFF_UP) != 0; } vector<uint8_t> VIfaceImpl::receive() { // Read packet into our buffer int nread = read(this->queues.rx, &(this->pktbuff[0]), this->mtu); // Handle errors if (nread == -1) { // Nothing was read for this fd (non-blocking). // This could happen, as http://linux.die.net/man/2/select states: // // Under Linux, select() may report a socket file descriptor as // "ready for reading", while nevertheless a subsequent read // blocks. This could for example happen when data has arrived // but upon examination has wrong checksum and is discarded. // There may be other circumstances in which a file descriptor // is spuriously reported as ready. Thus it may be safer to // use O_NONBLOCK on sockets that should not block. // // I know this is not a socket, but the "There may be other // circumstances in which a file descriptor is spuriously reported // as ready" warns it, and so, it better to do this that to have // an application that frozes for no apparent reason. // if (errno == EAGAIN) { return vector<uint8_t>(0); } // Something bad happened ostringstream what; what << "--- IO error while reading from " << this->name; what << "." << endl; what << " Error: " << strerror(errno); what << " (" << errno << ")." << endl; throw runtime_error(what.str()); } // Copy packet from buffer and return vector<uint8_t> packet(nread); packet.assign(&(this->pktbuff[0]), &(this->pktbuff[nread])); return packet; } void VIfaceImpl::send(vector<uint8_t>& packet) const { ostringstream what; int size = packet.size(); if (size < ETH_HLEN) { what << "--- Packet too small (" << size << ") "; what << "too small (< " << ETH_HLEN << ")." << endl; throw invalid_argument(what.str()); } if (size > this->mtu) { what << "--- Packet too large (" << size << ") "; what << "for current MTU (> " << this->mtu << ")." << endl; throw invalid_argument(what.str()); } // Write packet to TX queue int written = write(this->queues.tx, &packet[0], size); if (written != size) { what << "--- IO error while writting to " << this->name; what << "." << endl; what << " Error: " << strerror(errno); what << " (" << errno << ")." << endl; throw runtime_error(what.str()); } return; } std::set<std::string> VIfaceImpl::listStats() { set<string> result; DIR* dir; struct dirent* ent; ostringstream what; string path = "/sys/class/net/" + this->name + "/statistics/"; // Open directory if ((dir = opendir(path.c_str())) == NULL) { what << "--- Unable to open statistics folder for interface "; what << this->name << ":" << endl; what << " " << path << endl; what << " Error: " << strerror(errno); what << " (" << errno << ")." << endl; throw runtime_error(what.str()); } // List files while ((ent = readdir(dir)) != NULL) { string entry(ent->d_name); // Ignore current, parent and hidden files if (entry[0] != '.') { result.insert(entry); } } // Close directory if (closedir(dir) != 0) { what << "--- Unable to close statistics folder for interface "; what << this->name << ":" << endl; what << " " << path << endl; what << " Error: " << strerror(errno); what << " (" << errno << ")." << endl; throw runtime_error(what.str()); } // Update cache this->stats_keys_cache = result; return result; } uint64_t VIfaceImpl::readStatFile(string const& stat) { ostringstream what; // If no cache exists, create it. if (this->stats_keys_cache.empty()) { this->listStats(); } // Check if stat is valid if (stats_keys_cache.find(stat) == stats_keys_cache.end()) { what << "--- Unknown statistic " << stat; what << " for interface " << this->name << endl; throw runtime_error(what.str()); } // Open file string path = "/sys/class/net/" + this->name + "/statistics/" + stat; ifstream statf(path); uint64_t value; // Check file open if (!statf.is_open()) { what << "--- Unable to open statistics file " << path; what << " for interface " << this->name << endl; throw runtime_error(what.str()); } // Read content into value statf >> value; // close file statf.close(); // Create entry if this stat wasn't cached if (this->stats_cache.find(stat) == this->stats_cache.end()) { this->stats_cache[stat] = 0; } return value; } uint64_t VIfaceImpl::readStat(std::string const& stat) { uint64_t value = this->readStatFile(stat); // Return value minus the cached value return value - this->stats_cache[stat]; } void VIfaceImpl::clearStat(std::string const& stat) { uint64_t value = this->readStatFile(stat); // Set current value as cache this->stats_cache[stat] = value; return; } void dispatch(set<VIface*>& ifaces, dispatcher_cb callback, int millis) { int fd = -1; int fdsread = -1; int nfds = -1; struct timeval tv; struct timeval* tvp = NULL; // Check non-empty set if (ifaces.empty()) { ostringstream what; what << "--- Empty virtual interfaces set" << endl; throw invalid_argument(what.str()); } // Setup timeout if (millis >= 0) { tvp = &tv; } // Store mapping between file descriptors and interface it belongs map<int,VIface*> reverse_id; // Create and clear set of file descriptors fd_set rfds; // Create map of file descriptors and get maximum file descriptor for // select call for (auto iface : ifaces) { // Store identity fd = iface->pimpl->getRX(); reverse_id[fd] = iface; // Get maximum file descriptor if (fd > nfds) { nfds = fd; } } nfds++; // Perform select system call while (true) { // Re-create set FD_ZERO(&rfds); for (auto iface : ifaces) { fd = iface->pimpl->getRX(); FD_SET(fd, &rfds); } // Re-set timeout if (tvp != NULL) { tv.tv_sec = millis / 1000; tv.tv_usec = (millis % 1000) * 1000; } fdsread = select(nfds, &rfds, NULL, NULL, tvp); // Check if select error if (fdsread == -1) { // A signal was caught. Return. if (errno == EINTR) { return; } // Something bad happened ostringstream what; what << "--- Unknown error in select() system call: "; what << fdsread << "." << endl; what << " Error: " << strerror(errno); what << " (" << errno << ")." << endl; throw runtime_error(what.str()); } // Check if timeout if (tvp != NULL && fdsread == 0) { return; } // Iterate all active file descriptors for reading for (auto &pair : reverse_id) { // Check if fd wasn't marked in select as available if (!FD_ISSET(pair.first, &rfds)) { continue; } // File descriptor is ready, perform read and dispatch vector<uint8_t> packet = pair.second->receive(); if (packet.size() == 0) { // Even if this is very unlikely, supposedly it can happen. // See receive() comments about this. continue; } // Dispatch packet if (!callback( pair.second->getName(), pair.second->getID(), packet)) { return; } } } } /*============================================================================ = PIMPL IDIOM BUREAUCRACY = = Starting this point there is not much relevant things... = Stop scrolling... *============================================================================*/ VIface::VIface(string name, bool tap, int id) : pimpl(new VIfaceImpl(name, tap, id)) {} VIface::~VIface() = default; string VIface::getName() const { return this->pimpl->getName(); } uint VIface::getID() const { return this->pimpl->getID(); } void VIface::setMAC(string mac) { return this->pimpl->setMAC(mac); } string VIface::getMAC() const { return this->pimpl->getMAC(); } void VIface::setIPv4(string ipv4) { return this->pimpl->setIPv4(ipv4); } string VIface::getIPv4() const { return this->pimpl->getIPv4(); } void VIface::setIPv4Netmask(string netmask) { return this->pimpl->setIPv4Netmask(netmask); } string VIface::getIPv4Netmask() const { return this->pimpl->getIPv4Netmask(); } void VIface::setIPv4Broadcast(string broadcast) { return this->pimpl->setIPv4Broadcast(broadcast); } string VIface::getIPv4Broadcast() const { return this->pimpl->getIPv4Broadcast(); } void VIface::setIPv6(set<string> const& ipv6s) { return this->pimpl->setIPv6(ipv6s); } set<string> VIface::getIPv6() const { return this->pimpl->getIPv6(); } void VIface::setMTU(uint mtu) { return this->pimpl->setMTU(mtu); } uint VIface::getMTU() const { return this->pimpl->getMTU(); } void VIface::up() { return this->pimpl->up(); } void VIface::down() const { return this->pimpl->down(); } bool VIface::isUp() const { return this->pimpl->isUp(); } vector<uint8_t> VIface::receive() { return this->pimpl->receive(); } void VIface::send(vector<uint8_t>& packet) const { return this->pimpl->send(packet); } std::set<std::string> VIface::listStats() { return this->pimpl->listStats(); } uint64_t VIface::readStat(std::string const& stat) { return this->pimpl->readStat(stat); } void VIface::clearStat(std::string const& stat) { return this->pimpl->clearStat(stat); } }
28.347967
80
0.52085
francescomessina
4e4d01653ccd5b2005f830cb05245bc5eb02fd1f
2,082
hpp
C++
zen/tuple.hpp
ZenLibraries/ZenLibraries
ae189b5080c75412cbd4f33cf6cfb51e15f6ee66
[ "Apache-2.0" ]
null
null
null
zen/tuple.hpp
ZenLibraries/ZenLibraries
ae189b5080c75412cbd4f33cf6cfb51e15f6ee66
[ "Apache-2.0" ]
2
2020-02-06T17:01:39.000Z
2020-02-12T17:50:14.000Z
zen/tuple.hpp
ZenLibraries/ZenLibraries
ae189b5080c75412cbd4f33cf6cfb51e15f6ee66
[ "Apache-2.0" ]
null
null
null
#ifndef ZEN_TUPLE_HPP #define ZEN_TUPLE_HPP #include "zen/config.h" #include "zen/meta.hpp" ZEN_NAMESPACE_START template<typename T> struct IsEmpty; template<size_t I, typename ValueT, bool IsEmpty = IsEmpty<ValueT>::value> class _TupleLeaf { ValueT value; }; template<size_t ...I> struct _TupleIndices {}; template<typename Indices, typename ...Ts> struct _TupleImpl; template<size_t ...Indices, typename ...Ts> struct _TupleImpl<_TupleIndices<Indices...>, Ts...> : public _TupleLeaf<Indices, Ts>... {}; template<size_t N, typename T> auto get(T value); /** * @brief An indexed list of types that can be populated at run-time. * * The implementation was inspired by [this article][1] and [this article][2]. * * [1]: https://ldionne.com/2015/11/29/efficient-parameter-pack-indexing/ * [2]: https://mitchnull.blogspot.com/2012/06/c11-tuple-implementation-details-part-1.html */ template<typename ...Ts> class Tuple { template<size_t N, typename T> friend auto get(T value); using Impl = _TupleImpl<Ascending<size_t, sizeof...(Ts)>, Ts...>; Impl _elements; public: template<typename T> constexpr auto append(T element) { return Tuple<Ts..., T>(get<Ascending<size_t, sizeof...(Ts)>>(), element); } }; template<size_t N, typename ...Ts> auto get(Tuple<Ts...> tuple) { return static_cast<_TupleLeaf<N, TypePackElement<N, Ts...>>&>(tuple._elements).value; } ZEN_NAMESPACE_END #if ZEN_STL #include <tuple> #else namespace std { // Structural binding declarations require std::tuple_size<T> and // std::tuple_element<N, T> to be present. The compiler will use these // templates to automatically extract elements from a given type. template <typename T> struct tuple_size; template<size_t N, typename T> struct tuple_element; } #endif #if ZEN_STL #include <tuple> namespace std { template <typename ...Ts> struct tuple_size< ::zen::Tuple<Ts...> > { static const size_t value = sizeof...(Ts); }; } #endif // of #if ZEN_STL #endif // of #ifndef ZEN_TUPLE_HPP
20.82
91
0.685879
ZenLibraries
4e4dfa73660b3973982c98467dfb425e9c4efb25
255
cpp
C++
src/fft_x86_sse41.cpp
mzient/genFFT
93e778ba6c16b989fe0eb3150e1e56fcac6f665c
[ "BSD-2-Clause" ]
3
2019-10-30T11:17:32.000Z
2019-11-04T16:38:37.000Z
src/fft_x86_sse41.cpp
mzient/genFFT
93e778ba6c16b989fe0eb3150e1e56fcac6f665c
[ "BSD-2-Clause" ]
null
null
null
src/fft_x86_sse41.cpp
mzient/genFFT
93e778ba6c16b989fe0eb3150e1e56fcac6f665c
[ "BSD-2-Clause" ]
null
null
null
#include <cassert> #include <smmintrin.h> #include <genFFT/FFTLevel.h> #include <genFFT/generic/fft_impl_generic.h> #include "dispatch_helper.h" namespace genfft { namespace impl_SSE41 { #include <genFFT/x86/fft_impl_x86.inl> DISPATCH_ALL() } }
18.214286
44
0.745098
mzient
4e4f4236e4e4e37a73a068f75f77abf5d1ba4e7a
2,125
cpp
C++
ares/ngp/kge/sprite.cpp
CasualPokePlayer/ares
58690cd5fc7bb6566c22935c5b80504a158cca29
[ "BSD-3-Clause" ]
153
2020-07-25T17:55:29.000Z
2021-10-01T23:45:01.000Z
ares/ngp/kge/sprite.cpp
CasualPokePlayer/ares
58690cd5fc7bb6566c22935c5b80504a158cca29
[ "BSD-3-Clause" ]
245
2021-10-08T09:14:46.000Z
2022-03-31T08:53:13.000Z
ares/ngp/kge/sprite.cpp
CasualPokePlayer/ares
58690cd5fc7bb6566c22935c5b80504a158cca29
[ "BSD-3-Clause" ]
44
2020-07-25T08:51:55.000Z
2021-09-25T16:09:01.000Z
//technically, the Neo Geo Pocket attempts to buffer a line of sprites in advance. //so long as the user program does not write to VRAM during display, it can render //all 64 sprites on the same line. currently, the "character over" condition when //writing to VRAM during active display is not emulated, nor is the exact timing //of the caching used by real hardware, as this information is not currently known. auto KGE::Sprite::begin(n8 y) -> void { for(auto& tile : tiles) tile.priority = 0; n8 count; n8 px; n8 py; for(auto& object : objects) { n8 ox = object.hoffset; n8 oy = object.voffset; if(object.hchain) ox += px; if(object.vchain) oy += py; px = ox; py = oy; if(!object.priority) continue; //invisible ox = (ox + hscroll); oy = y - (oy + vscroll); if(oy >= 8) continue; //out of range if(object.vflip) oy ^= 7; auto& tile = tiles[count++]; tile.x = ox; tile.y = oy; tile.character = object.character; tile.priority = object.priority; tile.palette = object.palette; tile.hflip = object.hflip; tile.code = object.code; } } auto KGE::Sprite::render(n8 x, n8 y) -> maybe<Output&> { for(auto& tile : tiles) { if(!tile.priority) continue; //invisible n8 tx = x - tile.x; n3 ty = tile.y; if(tx >= 8) continue; //out of range if(tile.hflip) tx ^= 7; if(n2 index = self.characters[tile.character][ty][tx]) { output.priority = tile.priority; if(Model::NeoGeoPocket()) { output.color = palette[tile.palette][index]; } if(Model::NeoGeoPocketColor()) { switch(self.dac.colorMode) { case 0: output.color = tile.code * 4 + index; break; case 1: output.color = tile.palette * 8 + palette[tile.palette][index]; break; } } return output; } } return {}; } auto KGE::Sprite::power() -> void { output = {}; for(auto& object : objects) object = {}; for(auto& tile : tiles) tile = {}; hscroll = 0; vscroll = 0; memory::assign(palette[0], 0, 0, 0, 0); memory::assign(palette[1], 0, 0, 0, 0); }
27.960526
86
0.603765
CasualPokePlayer