blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
3
264
content_id
stringlengths
40
40
detected_licenses
listlengths
0
85
license_type
stringclasses
2 values
repo_name
stringlengths
5
140
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringclasses
986 values
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
3.89k
681M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
23 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
145 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
10.4M
extension
stringclasses
122 values
content
stringlengths
3
10.4M
authors
listlengths
1
1
author_id
stringlengths
0
158
22010febe91c178139fba8c4a490bb499782c2d3
2f10f807d3307b83293a521da600c02623cdda82
/deps/boost/win/debug/include/boost/multiprecision/cpp_int/limits.hpp
20267cc40a4810e4ab15200f272fcb4a32243be1
[]
no_license
xpierrohk/dpt-rp1-cpp
2ca4e377628363c3e9d41f88c8cbccc0fc2f1a1e
643d053983fce3e6b099e2d3c9ab8387d0ea5a75
refs/heads/master
2021-05-23T08:19:48.823198
2019-07-26T17:35:28
2019-07-26T17:35:28
null
0
0
null
null
null
null
UTF-8
C++
false
false
130
hpp
version https://git-lfs.github.com/spec/v1 oid sha256:12b8d653f334d43b593fc7fe77d0c55a9891909c6b14fb3b0b9915c2ac50bb82 size 20489
[ "YLiLarry@gmail.com" ]
YLiLarry@gmail.com
1df21450fc881a70da40740395006f90b2427c37
e9f244a624aff647768a876b38c42ef7e88d76cc
/sample/BundleSample/BundleSample.cpp
aa9156cb1f5b148fb898c1ef47c23a9030b93c5c
[ "Zlib", "OpenSSL", "LicenseRef-scancode-unicode", "Apache-2.0", "LicenseRef-scancode-openssl", "LicenseRef-scancode-ssleay-windows", "MIT", "LicenseRef-scancode-generic-cla" ]
permissive
rudyhuyn/msix-packaging
fcb2936089405d563ae800027be6eba60c3dcb82
8e847de81290efa378aae0d7c86ece3e11a262bc
refs/heads/master
2020-04-22T16:17:45.643414
2019-04-29T21:39:28
2019-04-29T21:39:28
170,503,469
2
0
null
2019-02-13T12:21:56
2019-02-13T12:21:56
null
UTF-8
C++
false
false
9,881
cpp
// // Copyright (C) 2017 Microsoft. All rights reserved. // See LICENSE file in the project root for full license information. // #include "AppxPackaging.hpp" #include "MSIXWindows.hpp" #include <iostream> #define RETURN_IF_FAILED(a) \ { HRESULT __hr = a; \ if (FAILED(__hr)) \ { return __hr; } \ } // Stripped down ComPtr provided for those platforms that do not already have a ComPtr class. template <class T> class ComPtr { public: // default ctor ComPtr() = default; ComPtr(T* ptr) : m_ptr(ptr) { InternalAddRef(); } ~ComPtr() { InternalRelease(); } inline T* operator->() const { return m_ptr; } inline T* Get() const { return m_ptr; } inline T** operator&() { InternalRelease(); return &m_ptr; } protected: T* m_ptr = nullptr; inline void InternalAddRef() { if (m_ptr) { m_ptr->AddRef(); } } inline void InternalRelease() { T* temp = m_ptr; if (temp) { m_ptr = nullptr; temp->Release(); } } }; // Or you can use what-ever allocator/deallocator is best for your platform... LPVOID STDMETHODCALLTYPE MyAllocate(SIZE_T cb) { return std::malloc(cb); } void STDMETHODCALLTYPE MyFree(LPVOID pv) { std::free(pv); } // Helper class to free string buffers obtained from the packaging APIs. template<typename T> class Text { public: T** operator&() { return &content; } ~Text() { Cleanup(); } T* Get() { return content; } T* content = nullptr; protected: void Cleanup() { if (content) { MyFree(content); content = nullptr; } } }; int Help() { std::cout << std::endl; std::cout << "Usage:" << std::endl; std::cout << "------" << std::endl; std::cout << "\t" << "BundleSample <bundle>" << std::endl; std::cout << std::endl; std::cout << "Description:" << std::endl; std::cout << "------------" << std::endl; std::cout << "\tShow information about the packages in the the bundle." << std::endl; std::cout << std::endl; return 0; } HRESULT ShowInformationOfPackage(IAppxFile* packageFile) { Text<WCHAR> packageName; RETURN_IF_FAILED(packageFile->GetName(&packageName)); std::wcout << L"\tName: " << packageName.Get() << std::endl; ComPtr<IAppxFactory> factory; RETURN_IF_FAILED(CoCreateAppxFactoryWithHeap( MyAllocate, MyFree, MSIX_VALIDATION_OPTION::MSIX_VALIDATION_OPTION_SKIPSIGNATURE, &factory)); // Get stream of the package and package reader ComPtr<IStream> packageStream; RETURN_IF_FAILED(packageFile->GetStream(&packageStream)); ComPtr<IAppxPackageReader> packageReader; RETURN_IF_FAILED(factory->CreatePackageReader(packageStream.Get(), &packageReader)); // Get information about the package from the manifest ComPtr<IAppxManifestReader> manifest; RETURN_IF_FAILED(packageReader->GetManifest(&manifest)); ComPtr<IAppxManifestPackageId> bundlePackageId; RETURN_IF_FAILED(manifest->GetPackageId(&bundlePackageId)); // Get full name of the bundle Text<WCHAR> fullName; RETURN_IF_FAILED(bundlePackageId->GetPackageFullName(&fullName)); std::wcout << L"\tFull Name: " << fullName.Get() << std::endl; // Get AUMIDs in the package ComPtr<IAppxManifestApplicationsEnumerator> applications; RETURN_IF_FAILED(manifest->GetApplications(&applications)) BOOL hasCurrent = FALSE; RETURN_IF_FAILED(applications->GetHasCurrent(&hasCurrent)); while(hasCurrent) { ComPtr<IAppxManifestApplication> application; RETURN_IF_FAILED(applications->GetCurrent(&application)); Text<WCHAR> aumid; RETURN_IF_FAILED(application->GetAppUserModelId(&aumid)); std::wcout << L"\tAppUserModelId: " << aumid.Get() << std::endl; RETURN_IF_FAILED(applications->MoveNext(&hasCurrent)); } // Show what are the target device families of the package. ComPtr<IAppxManifestReader3> manifest3; // AppxPackaging.hpp contains a helper UuidOfImpl<I>::iid for QueryInterface. // It returns the GUID associated with the interface RETURN_IF_FAILED(manifest->QueryInterface(UuidOfImpl<IAppxManifestReader3>::iid, reinterpret_cast<void**>(&manifest3))); ComPtr<IAppxManifestTargetDeviceFamiliesEnumerator> tdfEnum; RETURN_IF_FAILED(manifest3->GetTargetDeviceFamilies(&tdfEnum)); hasCurrent = FALSE; RETURN_IF_FAILED(tdfEnum->GetHasCurrent(&hasCurrent)); while (hasCurrent) { ComPtr<IAppxManifestTargetDeviceFamily> tdf; RETURN_IF_FAILED(tdfEnum->GetCurrent(&tdf)); Text<WCHAR> tdfName; RETURN_IF_FAILED(tdf->GetName(&tdfName)); std::wcout << L"\tTarget Device Family: " << tdfName.Get() << std::endl; RETURN_IF_FAILED(tdfEnum->MoveNext(&hasCurrent)); } return S_OK; } HRESULT ShowInformationOfBundle(char* bundleName) { // Initialize the factory with full validation and applicability options. ComPtr<IAppxBundleFactory> bundleFactory; RETURN_IF_FAILED(CoCreateAppxBundleFactoryWithHeap( MyAllocate, MyFree, MSIX_VALIDATION_OPTION::MSIX_VALIDATION_OPTION_SKIPSIGNATURE, MSIX_APPLICABILITY_OPTIONS::MSIX_APPLICABILITY_OPTION_FULL, &bundleFactory)); // Create stream on the file provided. ComPtr<IStream> inputStream; RETURN_IF_FAILED(CreateStreamOnFile(const_cast<char*>(bundleName), true, &inputStream)); // Now get the bundle reader ComPtr<IAppxBundleReader> bundleReader; RETURN_IF_FAILED(bundleFactory->CreateBundleReader(inputStream.Get(), &bundleReader)); // Get basic information about this bundle from the bundle manifest ComPtr<IAppxBundleManifestReader> manifestReader; RETURN_IF_FAILED(bundleReader->GetManifest(&manifestReader)); ComPtr<IAppxManifestPackageId> bundlePackageId; RETURN_IF_FAILED(manifestReader->GetPackageId(&bundlePackageId)); // This should be the same name as the one passed into this function Text<WCHAR> name; RETURN_IF_FAILED(bundlePackageId->GetName(&name)); std::wcout << L"File: " << name.Get() << std::endl; // Get full name of the bundle Text<WCHAR> fullName; RETURN_IF_FAILED(bundlePackageId->GetPackageFullName(&fullName)); std::wcout << L"Full Name: " << fullName.Get() << std::endl; // A bundle using MSIX_APPLICABILITY_OPTION_FULL will only show the packages // that are applicable to the current platform, as well as the resources // packages with the languages of the system. Get the applicable // package by calling GetPayloadPackages ComPtr<IAppxFilesEnumerator> applicablePackages; RETURN_IF_FAILED(bundleReader->GetPayloadPackages(&applicablePackages)); BOOL hasCurrent = FALSE; RETURN_IF_FAILED(applicablePackages->GetHasCurrent(&hasCurrent)); std::wcout << L"Applicable Packages: " << std::endl; while(hasCurrent) { ComPtr<IAppxFile> applicablePackage; RETURN_IF_FAILED(applicablePackages->GetCurrent(&applicablePackage)); RETURN_IF_FAILED(ShowInformationOfPackage(applicablePackage.Get())); std::wcout << std::endl; RETURN_IF_FAILED(applicablePackages->MoveNext(&hasCurrent)); } // It is possible to see all the packages in the bundle by looking into the // information of the bundle manifest. ComPtr<IAppxBundleManifestPackageInfoEnumerator> bundleInfoEnumerator; RETURN_IF_FAILED(manifestReader->GetPackageInfoItems(&bundleInfoEnumerator)); hasCurrent = FALSE; RETURN_IF_FAILED(bundleInfoEnumerator->GetHasCurrent(&hasCurrent)); std::wcout << L"Packages In Bundle: " << std::endl; while(hasCurrent) { ComPtr<IAppxBundleManifestPackageInfo> bundlePackageInfo; RETURN_IF_FAILED(bundleInfoEnumerator->GetCurrent(&bundlePackageInfo)); Text<WCHAR> packageName; RETURN_IF_FAILED(bundlePackageInfo->GetFileName(&packageName)); ComPtr<IAppxFile> package; RETURN_IF_FAILED(bundleReader->GetPayloadPackage(packageName.Get(), &package)); RETURN_IF_FAILED(ShowInformationOfPackage(package.Get())); // Get the languages of this package. ComPtr<IAppxManifestQualifiedResourcesEnumerator> resourceEnumerator; RETURN_IF_FAILED(bundlePackageInfo->GetResources(&resourceEnumerator)); BOOL hasLanguage = FALSE; RETURN_IF_FAILED(resourceEnumerator->GetHasCurrent(&hasLanguage)); while (hasLanguage) { ComPtr<IAppxManifestQualifiedResource> resource; RETURN_IF_FAILED(resourceEnumerator->GetCurrent(&resource)); Text<WCHAR> language; RETURN_IF_FAILED(resource->GetLanguage(&language)); std::wcout << L"\tLanguage: " << language.Get() << std::endl; RETURN_IF_FAILED(resourceEnumerator->MoveNext(&hasLanguage)); } std::wcout << std::endl; RETURN_IF_FAILED(bundleInfoEnumerator->MoveNext(&hasCurrent)); } return S_OK; } int main(int argc, char* argv[]) { if (argc != 2) { return Help(); } HRESULT hr = ShowInformationOfBundle(argv[1]); if (FAILED(hr)) { std::cout << "Error: " << std::hex << hr << " while extracting the appx package" <<std::endl; Text<char> text; auto logResult = GetLogTextUTF8(MyAllocate, &text); if (0 == logResult) { std::cout << "LOG:" << std::endl << text.content << std::endl; } else { std::cout << "UNABLE TO GET LOG WITH HR=" << std::hex << logResult << std::endl; } } return 0; }
[ "36937303+msftrubengu@users.noreply.github.com" ]
36937303+msftrubengu@users.noreply.github.com
ee05712c8c08d45da17026e70ee45e29bca968f9
14f0ed3b523c71ff783b2b077939cb8affd949db
/C/Main.cpp
ee53dcaab5938ef19ed7cc26dc440f9ce64a03d3
[ "MIT" ]
permissive
AnasBrital98/Genetic-Algorithm-in-all-languages
7b6528cdb6759a6446c32a0e6956ed591454c1cb
c04efa86d2ac1c31f6070488e94f2b8ce807151f
refs/heads/master
2023-07-15T10:18:37.686818
2021-08-19T14:56:16
2021-08-19T14:56:16
391,142,662
0
1
null
null
null
null
UTF-8
C++
false
false
192
cpp
#include<stdio.h> #include<stdlib.h> #include<time.h> #include "GeneticAlgorithm.cpp" int main(int argc , char** argv) { srand(time(NULL)); GeneticAlgorithm(200,50,0.1,15); return 0; }
[ "anass.brital98@gmail.com" ]
anass.brital98@gmail.com
adc16f6e5e3ef7c77b56f1d7c35631a64f4075a4
51e329979e832fe0d710b809b2c20adc23a15670
/iocore/net/P_Connection.h
6b1ce74ef13e703994ba937318771e3dff4df84d
[]
no_license
marlinprotocol/Petrum
3a75d9ac35b2c649629c88ca2a7e3f87baab92a2
9d76d80f9f3a353c1fdc7cc7df279db2bf2031cb
refs/heads/master
2022-12-24T06:57:10.775344
2020-07-14T17:18:16
2020-07-14T17:18:16
298,849,810
5
2
null
null
null
null
UTF-8
C++
false
false
5,601
h
/** @file A brief file description @section license License 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. */ /************************************************************************** Connection.h Description: struct Connection struct Server struct ConnectionManager struct ConnectionManager ======================== struct ConnectionManager provides the interface for network or disk connections. There is a global ConnectionManager in the system (connectionManager). Connection * connect() Connection * accept() The accept call is a blocking call while connect is non-blocking. They returns a new Connection instance which is an handle to the newly created connection. The connection `q instance can be used later for read/writes using an intance of IOProcessor class. **************************************************************************/ #pragma once #include "tscore/ink_platform.h" struct NetVCOptions; // // Defines // #define NON_BLOCKING_CONNECT true #define BLOCKING_CONNECT false #define CONNECT_WITH_TCP true #define CONNECT_WITH_UDP false #define NON_BLOCKING true #define BLOCKING false #define BIND_RANDOM_PORT true #define BIND_ANY_PORT false #define ENABLE_MC_LOOPBACK true #define DISABLE_MC_LOOPBACK false #define BC_NO_CONNECT true #define BC_CONNECT false #define BC_NO_BIND true #define BC_BIND false /////////////////////////////////////////////////////////////////////// // // Connection // /////////////////////////////////////////////////////////////////////// struct Connection { SOCKET fd; ///< Socket for connection. IpEndpoint addr; ///< Associated address. bool is_bound; ///< Flag for already bound to a local address. bool is_connected; ///< Flag for already connected. int sock_type; /** Create and initialize the socket for this connection. A socket is created and the options specified by @a opt are set. The socket is @b not connected. @note It is important to pass the same @a opt to this method and @c connect. @return 0 on success, -ERRNO on failure. @see connect */ int open(NetVCOptions const &opt = DEFAULT_OPTIONS ///< Socket options. ); /** Connect the socket. The socket is connected to the remote @a addr and @a port. The @a opt structure is used to control blocking on the socket. All other options are set via @c open. It is important to pass the same @a opt to this method as was passed to @c open. @return 0 on success, -ERRNO on failure. @see open */ int connect(sockaddr const *to, ///< Remote address and port. NetVCOptions const &opt = DEFAULT_OPTIONS ///< Socket options ); /// Set the internal socket address struct. void setRemote(sockaddr const *remote_addr ///< Address and port. ) { ats_ip_copy(&addr, remote_addr); } int setup_mc_send(sockaddr const *mc_addr, sockaddr const *my_addr, bool non_blocking = NON_BLOCKING, unsigned char mc_ttl = 1, bool mc_loopback = DISABLE_MC_LOOPBACK, Continuation *c = nullptr); int setup_mc_receive(sockaddr const *from, sockaddr const *my_addr, bool non_blocking = NON_BLOCKING, Connection *sendchan = nullptr, Continuation *c = nullptr); int close(); // 0 on success, -errno on failure void apply_options(NetVCOptions const &opt); virtual ~Connection(); Connection(); Connection(Connection const &that) = delete; /// Default options. static NetVCOptions const DEFAULT_OPTIONS; /** * Move control of the socket from the argument object orig to the current object. */ void move(Connection &); protected: /** Assignment operator. * * @param that Source object. * @return @a this * * This is protected because it is not safe in the general case, but is valid for * certain subclasses. Those provide a public assignemnt that depends on this method. */ Connection &operator=(Connection const &that) = default; void _cleanup(); }; /////////////////////////////////////////////////////////////////////// // // Server // /////////////////////////////////////////////////////////////////////// struct Server : public Connection { /// Client side (inbound) local IP address. IpEndpoint accept_addr; /// If set, a kernel HTTP accept filter bool http_accept_filter; int accept(Connection *c); // // Listen on a socket. We assume the port is in host by order, but // that the IP address (specified by accept_addr) has already been // converted into network byte order // int listen(bool non_blocking, const NetProcessor::AcceptOptions &opt); int setup_fd_for_listen(bool non_blocking, const NetProcessor::AcceptOptions &opt); Server() : Connection(), http_accept_filter(false) { ink_zero(accept_addr); } };
[ "cryptkit@marlin.pro" ]
cryptkit@marlin.pro
b841a09e819fe3dd9adfa744f7c2d86114fe7186
e206517b0417f19f49b17e8e35f7fef9cd2e61c3
/sources/dll/sources/Point.cpp
236d3f78d3e66c119ed5eaef56e09d1b495e818b
[]
no_license
Bence886/LightFinder_GPU
0beaaf89bc153183ad2a9b4753caa58e69bbd224
703c082a3f2ded319f2d81295a43a7f28c1640ee
refs/heads/master
2021-04-06T00:27:01.254535
2018-05-10T15:35:53
2018-05-10T15:35:53
124,689,181
1
1
null
null
null
null
UTF-8
C++
false
false
2,484
cpp
#include "Point.h" #include <sstream> #include "math.h" CUDA_CALLABLE_MEMBER Point::Point() { } CUDA_CALLABLE_MEMBER Point::Point(float x, float y, float z) : X(x), Y(y), Z(z) { } CUDA_CALLABLE_MEMBER Point::~Point() { } CUDA_CALLABLE_MEMBER Point & Point::operator-(const Point &otherPoint) const { return Point(X - otherPoint.X, Y - otherPoint.Y, Z - otherPoint.Z); } CUDA_CALLABLE_MEMBER Point & Point::operator+(const Point &otherPoint) const { return Point(X + otherPoint.X, Y + otherPoint.Y, Z + otherPoint.Z); } CUDA_CALLABLE_MEMBER bool Point::operator==(const Point &otherPoint) const { return (X == otherPoint.X && Y == otherPoint.Y && Z == otherPoint.Z); } CUDA_CALLABLE_MEMBER Point & Point::operator=(const Point &otherPoint) { if (this == &otherPoint) { return *this; } X = otherPoint.X; Y = otherPoint.Y; Z = otherPoint.Z; return *this; } CUDA_CALLABLE_MEMBER Point & Point::operator+=(const Point & otherPoint) { this->X += otherPoint.X; this->Y += otherPoint.Y; this->Z += otherPoint.Z; return *this; } CUDA_CALLABLE_MEMBER void Point::MultiplyByLambda(float l) { X *= l; Y *= l; Z *= l; } CUDA_CALLABLE_MEMBER void Point::DevideByLambda(float l) { X /= l; Y /= l; Z /= l; } CUDA_CALLABLE_MEMBER void Point::Normalize() { float d = sqrt(X * X + Y * Y + Z * Z); if (d != 0) { DevideByLambda(fabs(d)); } } CUDA_CALLABLE_MEMBER float Point::Length() { return Distance(Point(0, 0, 0), *this); } std::string Point::ToFile() { std::stringstream ss; ss << "(" << X << ", " << Y << ", " << Z << ")"; return ss.str(); } CUDA_CALLABLE_MEMBER Point Point::GetMidlePoint(const Point & p1, const Point & p2) { Point midle; midle = p1 + p2; midle.DevideByLambda(2); return midle; } CUDA_CALLABLE_MEMBER float Point::DotProduct(const Point & p1, const Point & p2) { //http://www.lighthouse3d.com/tutorials/maths/inner-product/ return (p1.X * p2.X + p1.Y * p2.Y + p1.Z * p2.Z); } Point Point::CrossProduct(const Point & p1, const Point & p2) { //http://www.lighthouse3d.com/tutorials/maths/vector-cross-product/ Point p = Point(p1.Y * p2.Z - p1.Z * p2.Y, p1.Z * p2.X - p1.X * p2.Z, p1.X * p2.Y - p1.Y * p2.X); return p; } CUDA_CALLABLE_MEMBER float Point::Distance(const Point & p1, const Point & p2) { return sqrt((p1.X - p2.X) * (p1.X - p2.X) + (p1.Y - p2.Y) * (p1.Y - p2.Y) + (p1.Z - p2.Z) * (p1.Z - p2.Z)); } CUDA_CALLABLE_MEMBER bool Point::CompFloat(float f1, float f2, float e) { return fabs(f1 - f2) < e; }
[ "tbencet96@gmail.com" ]
tbencet96@gmail.com
0444fb12a3c592cd507628028757a58ecfafb3df
e0cd22a3dbf1589cee37c33374607ed2ce66e95e
/cpp/opensourcesrcs/ace/ace/config-hpux-10.x-g++.h
0d5cac38abfe8b5844f65bbf9f93cc62b7b7a834
[ "BSD-3-Clause" ]
permissive
CodeOpsTech/DesignPatternsCpp
1335402e2c88a4b8715430210ec153af7bb733be
2c67495ffdc65443fae98b2879f7b608e3562876
refs/heads/master
2021-01-11T19:19:48.498940
2017-07-19T02:52:56
2017-07-19T02:52:56
79,355,314
1
0
null
null
null
null
UTF-8
C++
false
false
801
h
/* -*- C++ -*- */ // config-hpux-10.x-g++.h,v 4.24 2000/03/23 21:27:02 nanbor Exp // The following configuration file is designed to work for HP // platforms running HP/UX 10.x using G++. #ifndef ACE_CONFIG_H #define ACE_CONFIG_H #include "ace/pre.h" // config-g++-common.h undef's ACE_HAS_STRING_CLASS with -frepo, so // this must appear before its #include. #define ACE_HAS_STRING_CLASS #include "ace/config-g++-common.h" // These are apparantly some things which are special to g++ on HP? They are // compiler-related settings, but not in config-g++-common.h #define ACE_HAS_BROKEN_CONVERSIONS // Compiler supports the ssize_t typedef. #define ACE_HAS_SSIZE_T #define _CLOCKID_T #include "ace/config-hpux-10.x.h" #include "ace/post.h" #endif /* ACE_CONFIG_H */
[ "ganesh@codeops.tech" ]
ganesh@codeops.tech
5584740a7a4bb46f93106431f14aaf3ac21cc530
48e8d00debd2be1bbbfebd48de6e03c090a16649
/cdb/include/tencentcloud/cdb/v20170320/model/Inbound.h
2e288b98f8bf77a87c9dbe3545e16832358decdb
[ "Apache-2.0" ]
permissive
xuliangyu1991/tencentcloud-sdk-cpp
b3ef802c0aa5010e5af42d68de84080697f717d5
f4b057e66ddb1e8761df2152f1faaa10870cc5c7
refs/heads/master
2020-06-19T03:24:04.286285
2019-06-20T07:04:49
2019-06-20T07:04:49
null
0
0
null
null
null
null
UTF-8
C++
false
false
6,124
h
/* * Copyright (c) 2017-2019 THL A29 Limited, a Tencent company. 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. */ #ifndef TENCENTCLOUD_CDB_V20170320_MODEL_INBOUND_H_ #define TENCENTCLOUD_CDB_V20170320_MODEL_INBOUND_H_ #include <string> #include <vector> #include <map> #include <tencentcloud/core/utils/rapidjson/document.h> #include <tencentcloud/core/utils/rapidjson/writer.h> #include <tencentcloud/core/utils/rapidjson/stringbuffer.h> #include <tencentcloud/core/AbstractModel.h> namespace TencentCloud { namespace Cdb { namespace V20170320 { namespace Model { /** * 安全组入站规则 */ class Inbound : public AbstractModel { public: Inbound(); ~Inbound() = default; void ToJsonObject(rapidjson::Value &value, rapidjson::Document::AllocatorType& allocator) const; CoreInternalOutcome Deserialize(const rapidjson::Value &value); /** * 获取策略,ACCEPT或者DROP * @return Action 策略,ACCEPT或者DROP */ std::string GetAction() const; /** * 设置策略,ACCEPT或者DROP * @param Action 策略,ACCEPT或者DROP */ void SetAction(const std::string& _action); /** * 判断参数 Action 是否已赋值 * @return Action 是否已赋值 */ bool ActionHasBeenSet() const; /** * 获取来源Ip或Ip段,例如192.168.0.0/16 * @return CidrIp 来源Ip或Ip段,例如192.168.0.0/16 */ std::string GetCidrIp() const; /** * 设置来源Ip或Ip段,例如192.168.0.0/16 * @param CidrIp 来源Ip或Ip段,例如192.168.0.0/16 */ void SetCidrIp(const std::string& _cidrIp); /** * 判断参数 CidrIp 是否已赋值 * @return CidrIp 是否已赋值 */ bool CidrIpHasBeenSet() const; /** * 获取端口 * @return PortRange 端口 */ std::string GetPortRange() const; /** * 设置端口 * @param PortRange 端口 */ void SetPortRange(const std::string& _portRange); /** * 判断参数 PortRange 是否已赋值 * @return PortRange 是否已赋值 */ bool PortRangeHasBeenSet() const; /** * 获取网络协议,支持udp、tcp等 * @return IpProtocol 网络协议,支持udp、tcp等 */ std::string GetIpProtocol() const; /** * 设置网络协议,支持udp、tcp等 * @param IpProtocol 网络协议,支持udp、tcp等 */ void SetIpProtocol(const std::string& _ipProtocol); /** * 判断参数 IpProtocol 是否已赋值 * @return IpProtocol 是否已赋值 */ bool IpProtocolHasBeenSet() const; /** * 获取规则限定的方向,进站规则为INPUT * @return Dir 规则限定的方向,进站规则为INPUT */ std::string GetDir() const; /** * 设置规则限定的方向,进站规则为INPUT * @param Dir 规则限定的方向,进站规则为INPUT */ void SetDir(const std::string& _dir); /** * 判断参数 Dir 是否已赋值 * @return Dir 是否已赋值 */ bool DirHasBeenSet() const; private: /** * 策略,ACCEPT或者DROP */ std::string m_action; bool m_actionHasBeenSet; /** * 来源Ip或Ip段,例如192.168.0.0/16 */ std::string m_cidrIp; bool m_cidrIpHasBeenSet; /** * 端口 */ std::string m_portRange; bool m_portRangeHasBeenSet; /** * 网络协议,支持udp、tcp等 */ std::string m_ipProtocol; bool m_ipProtocolHasBeenSet; /** * 规则限定的方向,进站规则为INPUT */ std::string m_dir; bool m_dirHasBeenSet; }; } } } } #endif // !TENCENTCLOUD_CDB_V20170320_MODEL_INBOUND_H_
[ "jimmyzhuang@tencent.com" ]
jimmyzhuang@tencent.com
ee76ea3311b35e54a341196681938829d5515d0a
e98bce72249d4d00da6f76c221f97a6675420cfd
/video_receiver_helper.h
8ff7a64624c6b59f4081f7f7adc357d7e4cde9b2
[]
no_license
asdlei99/video_receiver_helper
656756e4b6da262be537372f2f5929e1eb85cc8f
a7258a43fd4d4152550e003f9050124081bda371
refs/heads/master
2020-08-21T11:01:25.766701
2019-10-04T04:40:35
2019-10-04T04:40:35
null
0
0
null
null
null
null
UTF-8
C++
false
false
670
h
#ifndef _VIDEO_RECEIVER_HELPER_H___ #define _VIDEO_RECEIVER_HELPER_H___ #include <memory> #include <string> #include "video_receiver/video_track_receiver.h" #include "rendering_server_client/rendering_server_client.h" namespace webrtc { class MediaStreamTrackInterface; } namespace grt { //class video_track_receiver; //class sender; std::unique_ptr< video_track_receiver> set_video_renderer(webrtc::MediaStreamTrackInterface*, std::shared_ptr<grt::sender> sender, std::string const& id); void async_reset_video_renderer(std::shared_ptr<grt::sender> sender, std::string const& id); }//namespace grt #endif//_VIDEO_RECEIVER_HELPER_H___
[ "aks.dce.007@gmail.com" ]
aks.dce.007@gmail.com
f1cb3ba5a22448d47e15dc7c6e882cba16904f17
eb2f8b3271e8ef9c9b092fcaeff3ff8307f7af86
/Grade 10-12/2018 autumn/NOIP/NOIP2018提高组Day2程序包/answers/GD-0609/game/game.cpp
ab23b10f26e465ed2c357af83c40d31a749d1c6d
[]
no_license
Orion545/OI-Record
0071ecde8f766c6db1f67b9c2adf07d98fd4634f
fa7d3a36c4a184fde889123d0a66d896232ef14c
refs/heads/master
2022-01-13T19:39:22.590840
2019-05-26T07:50:17
2019-05-26T07:50:17
188,645,194
4
2
null
null
null
null
UTF-8
C++
false
false
746
cpp
#include <cstdio> #include <cstring> #include <cstdlib> const int N = 1000007, M = 5, P = 1e9 + 7; int f[N][1 << M]; int n, m, full; int main() { freopen("game.in", "r", stdin); freopen("game.out", "w", stdout); scanf("%d%d", &n, &m); if (n == 3 && m == 3) { printf("112\n"); return 0; } if (n == 5 && m == 5) { printf("7136\n"); return 0; } full = (1 << n) - 1; for (int s = 0; s <= full; s++) f[1][s] = 1; for (int i = 2; i <= m; i++) for (int s = 0; s <= full; s++) for (int s1 = 0; s1 <= full; s1++) if (((s >> 1) & s1) == (s >> 1)) f[i][s] = (f[i][s] + f[i - 1][s1]) % P; int ans = 0; for (int s = 0; s <= full; s++) ans = (ans + f[m][s]) % P; printf("%d\n", ans); fclose(stdin); fclose(stdout); return 0; }
[ "orion545@qq.com" ]
orion545@qq.com
4130f0284587b7db58d4db4cf0bf8b54d2eef0e0
11b90205f3f37db632d47f3623932fd0207bf512
/Parser.cpp
0ffbbdf109a0b24bad77655cd52a743d68a209a2
[]
no_license
yaelwb/CPUParser
d3c91438c1a300f61efb219ad3704e094acc3667
f68723f5ce87c2106f1b550b1d81a0a7c75a68a5
refs/heads/master
2021-01-25T07:34:20.745679
2013-01-06T07:26:49
2013-01-06T07:26:49
7,314,408
2
0
null
null
null
null
UTF-8
C++
false
false
11,729
cpp
#include "stdafx.h" #include "Parser.h" Parser::Parser(): m_cmd_count(0) { m_cmdMap["mov"] = CMD_2_REGS; m_cmdMap["xor"] = CMD_3_REGS; m_cmdMap["and"] = CMD_3_REGS; m_cmdMap["or"] = CMD_3_REGS; m_cmdMap["nxor"] = CMD_3_REGS; m_cmdMap["nor"] = CMD_3_REGS; m_cmdMap["nand"] = CMD_3_REGS; m_cmdMap["add"] = CMD_3_REGS; m_cmdMap["sub"] = CMD_3_REGS; m_cmdMap["mul"] = CMD_3_REGS; m_cmdMap["div"] = CMD_3_REGS; m_cmdMap["addfp"] = CMD_3_REGS_FP; m_cmdMap["subfp"] = CMD_3_REGS_FP; m_cmdMap["mulfp"] = CMD_3_REGS_FP; m_cmdMap["divfp"] = CMD_3_REGS_FP; m_cmdMap["cmpreg"] = CMD_3_REGS; m_cmdMap["not"] = CMD_2_REGS; m_cmdMap["abs"] = CMD_2_REGS; m_cmdMap["absfp"] = CMD_2_REGS_FP; m_cmdMap["sllr"] = CMD_2_REGS; m_cmdMap["slar"] = CMD_2_REGS; m_cmdMap["srlr"] = CMD_2_REGS; m_cmdMap["srar"] = CMD_2_REGS; m_cmdMap["rotlr"] = CMD_2_REGS; m_cmdMap["rotrr"] = CMD_2_REGS; m_cmdMap["ldfm"] = CMD_LDFM; m_cmdMap["stfm"] = CMD_STFM; m_cmdMap["xori"] = CMD_2_REGS_IMM; m_cmdMap["andi"] = CMD_2_REGS_IMM; m_cmdMap["ori"] = CMD_2_REGS_IMM; m_cmdMap["nxori"] = CMD_2_REGS_IMM; m_cmdMap["nori"] = CMD_2_REGS_IMM; m_cmdMap["nandi"] = CMD_2_REGS_IMM; m_cmdMap["addi"] = CMD_2_REGS_IMM; m_cmdMap["subi"] = CMD_2_REGS_IMM; m_cmdMap["muli"] = CMD_2_REGS_IMM; m_cmdMap["divi"] = CMD_2_REGS_IMM; m_cmdMap["addfpi"] = CMD_2_REGS_IMM_FP; m_cmdMap["subfpi"] = CMD_2_REGS_IMM_FP; m_cmdMap["mulfpi"] = CMD_2_REGS_IMM_FP; m_cmdMap["divfpi"] = CMD_2_REGS_IMM_FP; m_cmdMap["cmpregi"] = CMD_2_REGS_IMM; m_cmdMap["jmp"] = CMD_JUMP; m_cmdMap["bre"] = CMD_JUMP; m_cmdMap["brue"] = CMD_JUMP; m_cmdMap["brg"] = CMD_JUMP; m_cmdMap["bls"] = CMD_JUMP; m_cmdMap["btr"] = CMD_JUMP; m_cmdMap["bfs"] = CMD_JUMP; m_cmdMap["jmpr"] = CMD_REG_IMM; m_cmdMap["slli"] = CMD_REG_IMM; m_cmdMap["slai"] = CMD_REG_IMM; m_cmdMap["srli"] = CMD_REG_IMM; m_cmdMap["srai"] = CMD_REG_IMM; m_cmdMap["rotli"] = CMD_REG_IMM; m_cmdMap["rotri"] = CMD_REG_IMM; m_cmdMap["ldfh"] = CMD_LDFH; m_cmdMap["ldfl"] = CMD_LDFL; m_cmdMap["ldf"] = CMD_LDF; m_cmdMap["goto"] = CMD_GOTO; m_cmdMap["nop"] = CMD_SINGLE; m_cmdMap["clr"] = CMD_SINGLE; } int Parser::PostProcessLabels() { int cmd_idx = 0, imm_val = 0; map<int, string>::iterator it = m_unresolvedLabels.begin(); for (; it != m_unresolvedLabels.end(); it++) { cmd_idx = (*it).first; string lbl((*it).second); CmdInfo &cmdInfo = m_commands[cmd_idx]; map<string, int>::iterator it1 = m_labelsMap.find(lbl); if (it1 != m_labelsMap.end()) cmdInfo.SetImm(it1->second); } return NO_ERROR_FOUND; } int Parser::ProcessLine(string assembly_cmd) { string cmd, label; int ret = NO_ERROR_FOUND; CmdInfo cmdInfo; //eliminate whitespaces size_t start_pos = 0, end_pos = 0; string whitespaces (" \t\f\v\n\r"); eliminatePreceedingWhitespaces(assembly_cmd); eliminateSucceedingWhitespaces(assembly_cmd); //parse labels while ((end_pos = assembly_cmd.find_first_of(":")) != string::npos) { label = assembly_cmd.substr(0,end_pos); assembly_cmd.erase(0,end_pos +1); eliminatePreceedingWhitespaces(label); eliminateSucceedingWhitespaces(label); if(!label.empty() && label.find_first_not_of(whitespaces) != string::npos) m_labelsMap[label] = m_cmd_count; } eliminatePreceedingWhitespaces(assembly_cmd); if(assembly_cmd.empty()) return NO_ERROR_FOUND; //isolate command end_pos = assembly_cmd.find_first_of(whitespaces); cmd = assembly_cmd.substr(0,end_pos); assembly_cmd.erase(0,end_pos); eliminatePreceedingWhitespaces(assembly_cmd); map<string,int>::iterator it = m_cmdMap.find(cmd); if (it == m_cmdMap.end()) return UNKNOWN_CMD; int command_type = it->second; cmdInfo.SetAssemblyStr(assembly_cmd); cmdInfo.SetCommand(cmd); cmdInfo.SetCommandType(command_type); switch (command_type) { case CMD_3_REGS: ret = parse3Regs(cmdInfo); break; case CMD_2_REGS: ret = parse2Regs(cmdInfo); break; case CMD_2_REGS_IMM: ret = parse2RegsIMM(cmdInfo); break; case CMD_3_REGS_FP: ret = parse3Regs_FP(cmdInfo); break; case CMD_2_REGS_FP: ret = parse2Regs_FP(cmdInfo); break; case CMD_2_REGS_IMM_FP: ret = parse2RegsIMM_FP(cmdInfo); break; case CMD_IMM: ret = parseIMM(cmdInfo); break; case CMD_REG_IMM: ret = parseRegsIMM(cmdInfo); break; case CMD_SINGLE: break; case CMD_JUMP: ret = parseJump(cmdInfo); break; case CMD_GOTO: ret = parseGOTO(cmdInfo); break; case CMD_LDFM: ret = parseLDFM(cmdInfo); break; case CMD_STFM: ret = parseSTFM(cmdInfo); break; case CMD_LDF: ret = parseLDF(cmdInfo); cmdInfo.SetCommandType(CMD_LDFH); cmdInfo.SetCommand("ldfh"); break; default: ret = UNKNOWN_CMD; } if (ret != NO_ERROR_FOUND) return ret; if (parseRemainingChars(cmdInfo.GetAssemblyStr()) != NO_ERROR_FOUND) return ILLEGAL_CMD_STX; m_commands.push_back(cmdInfo); m_cmd_count++; if(command_type == CMD_LDF) { CmdInfo cmdInfoLow; cmdInfoLow.SetCommandType(CMD_LDFL); cmdInfoLow.SetCommand("ldfl"); cmdInfoLow.SetFloat(cmdInfo.GetFloat()); cmdInfoLow.SetR1(cmdInfo.GetR1()); m_commands.push_back(cmdInfoLow); m_cmd_count++; } return NO_ERROR_FOUND; } int Parser::parse3Regs(CmdInfo &cmdInfo) { int err = NO_ERROR_FOUND; if ((err = parseReg(cmdInfo.m_assembly_str, cmdInfo.m_r1)) == NO_ERROR_FOUND && (err = parseReg(cmdInfo.m_assembly_str, cmdInfo.m_r2)) == NO_ERROR_FOUND && (err = parseReg(cmdInfo.m_assembly_str, cmdInfo.m_r3)) == NO_ERROR_FOUND) return NO_ERROR_FOUND; return err; } int Parser::parse2Regs(CmdInfo &cmdInfo) { int err = NO_ERROR_FOUND; if ((err = parseReg(cmdInfo.m_assembly_str, cmdInfo.m_r1)) == NO_ERROR_FOUND && (err = parseReg(cmdInfo.m_assembly_str, cmdInfo.m_r2)) == NO_ERROR_FOUND) return NO_ERROR_FOUND; return err; } int Parser::parse2RegsIMM(CmdInfo &cmdInfo) { int err = NO_ERROR_FOUND; if ((err = parseReg(cmdInfo.m_assembly_str, cmdInfo.m_r1)) == NO_ERROR_FOUND && (err = parseReg(cmdInfo.m_assembly_str, cmdInfo.m_r2)) == NO_ERROR_FOUND && (err = parseIMM(cmdInfo)) == NO_ERROR_FOUND) return NO_ERROR_FOUND; return err; } int Parser::parse3Regs_FP(CmdInfo &cmdInfo) { int err = NO_ERROR_FOUND; if ((err = parseFReg(cmdInfo.m_assembly_str, cmdInfo.m_r1)) == NO_ERROR_FOUND && (err = parseFReg(cmdInfo.m_assembly_str, cmdInfo.m_r2)) == NO_ERROR_FOUND && (err = parseFReg(cmdInfo.m_assembly_str, cmdInfo.m_r3)) == NO_ERROR_FOUND) return NO_ERROR_FOUND; return err; } int Parser::parse2Regs_FP(CmdInfo &cmdInfo) { int err = NO_ERROR_FOUND; if ((err = parseFReg(cmdInfo.m_assembly_str, cmdInfo.m_r1)) == NO_ERROR_FOUND && (err = parseFReg(cmdInfo.m_assembly_str, cmdInfo.m_r2)) == NO_ERROR_FOUND) return NO_ERROR_FOUND; return err; } int Parser::parse2RegsIMM_FP(CmdInfo &cmdInfo) { int err = NO_ERROR_FOUND; if ((err = parseFReg(cmdInfo.m_assembly_str, cmdInfo.m_r1)) == NO_ERROR_FOUND && (err = parseFReg(cmdInfo.m_assembly_str, cmdInfo.m_r2)) == NO_ERROR_FOUND && (err = parseIMM(cmdInfo)) == NO_ERROR_FOUND) return NO_ERROR_FOUND; return err; } int Parser::parseIMM(CmdInfo &cmdInfo) { int n = 0; eliminatePreceedingWhitespaces(cmdInfo.m_assembly_str); eliminateSucceedingWhitespaces(cmdInfo.m_assembly_str); n = atoi(cmdInfo.m_assembly_str.c_str()); if(n > 32767 || n < -32767) return ILLEGAL_IMM_VAL; cmdInfo.SetImm(n); string numeric ("0123456789-"); size_t end_pos = cmdInfo.m_assembly_str.find_first_not_of(numeric); cmdInfo.m_assembly_str.erase(0,end_pos); return NO_ERROR_FOUND; } int Parser::parseF(CmdInfo &cmdInfo) { float f = 0; eliminatePreceedingWhitespaces(cmdInfo.m_assembly_str); eliminateSucceedingWhitespaces(cmdInfo.m_assembly_str); sscanf(cmdInfo.m_assembly_str.c_str(),"%f",&f); cmdInfo.SetFloat(f); string numeric ("0123456789.-"); size_t end_pos = cmdInfo.m_assembly_str.find_first_not_of(numeric); cmdInfo.m_assembly_str.erase(0,end_pos); return NO_ERROR_FOUND; } int Parser::parseRegsIMM(CmdInfo &cmdInfo) { int err = NO_ERROR_FOUND; if ((err = parseReg(cmdInfo.m_assembly_str, cmdInfo.m_r1)) == NO_ERROR_FOUND && (err = parseIMM(cmdInfo)) == NO_ERROR_FOUND) return NO_ERROR_FOUND; return err; } int Parser::parseJump(CmdInfo &cmdInfo) { eliminatePreceedingWhitespaces(cmdInfo.m_assembly_str); eliminateSucceedingWhitespaces(cmdInfo.m_assembly_str); cmdInfo.SetImm(atoi(cmdInfo.m_assembly_str.c_str())); string numeric ("0123456789"); size_t end_pos = cmdInfo.m_assembly_str.find_first_not_of(numeric); cmdInfo.m_assembly_str.erase(0,end_pos); return NO_ERROR_FOUND; } int Parser::parseGOTO(CmdInfo &cmdInfo) { eliminatePreceedingWhitespaces(cmdInfo.m_assembly_str); eliminateSucceedingWhitespaces(cmdInfo.m_assembly_str); map<string, int>::iterator it = m_labelsMap.find(cmdInfo.GetAssemblyStr()); if (it != m_labelsMap.end()) { cmdInfo.SetImm(it->second); cmdInfo.m_assembly_str.clear(); return NO_ERROR_FOUND; } m_unresolvedLabels[m_cmd_count] = cmdInfo.GetAssemblyStr(); cmdInfo.m_assembly_str.clear(); return NO_ERROR_FOUND; } int Parser::parseReg(string &assembly_str, int &r) { eliminatePreceedingWhitespaces(assembly_str); if(assembly_str[0] != 'R') return ILLEGAL_CMD_STX; assembly_str.erase(0,1); int n = ILLEGAL_VALUE; n = atoi(assembly_str.c_str()); if(n > 31 || n < 0) return ILLEGAL_REG_NO; r = n; int pos = ((n>9)? 2:1); assembly_str.erase(0,pos); return NO_ERROR_FOUND; } int Parser::parseFReg(string &assembly_str, int &r) { eliminatePreceedingWhitespaces(assembly_str); if(assembly_str[0] != 'F' || assembly_str[1] != 'R') return ILLEGAL_CMD_STX; assembly_str.erase(0,2); int n = ILLEGAL_VALUE; n = atoi(assembly_str.c_str()); if(n > 7 || n < 0) return ILLEGAL_REG_NO; r = n; assembly_str.erase(0,1); return NO_ERROR_FOUND; } void Parser::eliminatePreceedingWhitespaces(string &assembly_str) { size_t start_pos = 0; string whitespaces (" \t\f\v\n\r"); start_pos = assembly_str.find_first_not_of(whitespaces); if (start_pos!=string::npos) assembly_str.erase(0,start_pos); } void Parser::eliminateSucceedingWhitespaces(string &assembly_str) { string whitespaces (" \t\f\v\n\r"); size_t end_pos = assembly_str.find_last_not_of(whitespaces); if (end_pos!=string::npos) assembly_str.erase(end_pos+1); } int Parser::parseRemainingChars(string &assembly_str) { string whitespaces (" \t\f\v\n\r"); size_t start_pos = assembly_str.find_first_not_of(whitespaces); if (start_pos!=string::npos) return ILLEGAL_CMD_STX; return NO_ERROR_FOUND; } int Parser::parseLDFM(CmdInfo &cmdInfo) { int err = NO_ERROR_FOUND; if ((err = parseIMM(cmdInfo)) == NO_ERROR_FOUND && (err = parseFReg(cmdInfo.m_assembly_str, cmdInfo.m_r1)) == NO_ERROR_FOUND) return NO_ERROR_FOUND; return err; } int Parser::parseSTFM(CmdInfo &cmdInfo) { int err = NO_ERROR_FOUND; if ((err = parseFReg(cmdInfo.m_assembly_str, cmdInfo.m_r1)) == NO_ERROR_FOUND && (err = parseIMM(cmdInfo)) == NO_ERROR_FOUND) return NO_ERROR_FOUND; return err; } int Parser::parseLDF(CmdInfo &cmdInfo) { int err = NO_ERROR_FOUND; if ((err = parseFReg(cmdInfo.m_assembly_str, cmdInfo.m_r1)) == NO_ERROR_FOUND && (err = parseF(cmdInfo)) == NO_ERROR_FOUND) return NO_ERROR_FOUND; return err; } Parser::~Parser() { }
[ "yaelwb@gmail.com" ]
yaelwb@gmail.com
2b70b048f3d349d2dff00d9e1dd79cc56ebe323b
b36a8c4495fd41c5a77fdf66a7875016f4d48880
/Warmup 12 - Split String by Identical Character/Warmup 12 - Split String by Identical Character.cpp
0a71977dc1dd1cc204e61172002c736bb5d74dc3
[]
no_license
comi999/Warmup-Exercises
651b0dc010f188154ea9b850cd5135d4bf5e380d
dcfc56a5117eac689fca07347febfa08596a9f8c
refs/heads/master
2022-11-25T06:10:51.407215
2020-08-07T02:34:24
2020-08-07T02:34:24
273,102,767
0
0
null
null
null
null
UTF-8
C++
false
false
1,439
cpp
#include <iostream> #include <vector> std::vector<std::string> splitGroups(std::string s) { std::vector<std::string> result; char count = 0, current; for (int i = 0; i < s.size(); i++) { current = s[i]; while (current == *(&s[i] + count) && s[i] != '\0') count++; result.push_back(s.substr(i, count)); i += -1 + count; count = 0; } return result; } int main() { std::string a = "555"; std::string b = "5556667788"; std::string c = "aaabbbaabbab"; std::string d = "abbbcc88999&&!!!_"; std::cout << a << ":" << std::endl; std::vector<std::string> resulta = splitGroups(a); for (int i = 0; i < resulta.size(); i++) std::cout << resulta[i] << std::endl; std::cout << std::endl; std::cout << b << ":" << std::endl; std::vector<std::string> resultb = splitGroups(b); for (int i = 0; i < resultb.size(); i++) std::cout << resultb[i] << std::endl; std::cout << std::endl; std::cout << c << ":" << std::endl; std::vector<std::string> resultc = splitGroups(c); for (int i = 0; i < resultc.size(); i++) std::cout << resultc[i] << std::endl; std::cout << std::endl; std::cout << d << ":" << std::endl; std::vector<std::string> resultd = splitGroups(d); for (int i = 0; i < resultd.size(); i++) std::cout << resultd[i] << std::endl; std::cout << std::endl; while (1); }
[ "glizzyzbro@hotmail.com" ]
glizzyzbro@hotmail.com
cbb20a6ad1842e297982a55d68a7c824e4b12fec
abb5f5cec0d009fabbf72734254cac5a0a4b3a9c
/DiscreteRods/ThreadConstrained.h
f2412db4ab9c2bb48875bd0705e5102e68d116fc
[]
no_license
alexlee-gk/surgical
692ebc6295002ea44cdb86bc846730c446a48784
9c4739100aaa612aa2fb476515e651666533b3df
refs/heads/master
2021-01-16T22:49:43.863602
2011-10-17T09:20:09
2011-10-17T09:20:09
1,873,553
0
0
null
null
null
null
UTF-8
C++
false
false
5,550
h
#include <stdlib.h> #include <algorithm> #ifdef MAC #include <OpenGL/gl.h> #include <GLUT/glut.h> #include <GL/gle.h> #else #include <GL/gl.h> #include <GL/glut.h> #include <GL/gle.h> #endif #include <iostream> #include <fstream> #include <Eigen/Core> #include <Eigen/Geometry> #include <math.h> #include "thread_discrete.h" #define LIMITED_DISPLACEMENT true #define MAX_DISPLACEMENT 1 //(0.49*THREAD_RADIUS) #define MAX_ANGLE_CHANGE (0.05*M_PI) // import most common Eigen types USING_PART_OF_NAMESPACE_EIGEN class ThreadConstrained { public: ThreadConstrained(int vertices_num); int numVertices() { return num_vertices; } const double rest_length() const { return threads.front()->rest_length(); } void get_thread_data(vector<Vector3d> &absolute_points); void get_thread_data(vector<Vector3d> &absolute_points, vector<double> &absolute_twist_angles); void get_thread_data(vector<Vector3d> &absolute_points, vector<double> &absolute_twist_angles, vector<Matrix3d> &absolute_material_frames); void get_thread_data(vector<Vector3d> &absolute_points, vector<Matrix3d> &absolute_material_frames); // parameters have to be of the right size, i.e. threads.size()+1 void getConstrainedTransforms(vector<Vector3d> &positions, vector<Matrix3d> &rotations); void setConstrainedTransforms(vector<Vector3d> positions, vector<Matrix3d> rotations); void getAllTransforms(vector<Vector3d> &positions, vector<Matrix3d> &rotations); void setAllTransforms(vector<Vector3d> positions, vector<Matrix3d> rotations); // parameters have to be of the right size. void getConstrainedNormals(vector<Vector3d> &normals); void getConstrainedVerticesNums(vector<int> &vertices_num); void getConstrainedVertices(vector<Vector3d> &constrained_vertices); void getFreeVerticesNums(vector<int> &vertices_nums); void getFreeVertices(vector<Vector3d> &free_vertices); void getOperableFreeVertices(vector<int> &free_vertices_num); void getOperableVertices(vector<int> &operable_vertices_num, vector<bool> &constrained_or_free); Vector3d start_pos(); Vector3d end_pos(); Matrix3d start_rot(); Matrix3d end_rot(); void set_coeffs_normalized(double bend_coeff, double twist_coeff, double grav_coeff); void set_coeffs_normalized(const Matrix2d& bend_coeff, double twist_coeff, double grav_coeff); void minimize_energy(); void updateConstraints (vector<Vector3d> poss, vector<Matrix3d> rots); void addConstraint (int absolute_vertex_num); void removeConstraint (int absolute_vertex_num); // Returns the number of the vertex that is nearest to pos. The chosen vertex have to be a free operable vertex. int nearestVertex(Vector3d pos); Vector3d position(int absolute_vertex_num); Matrix3d rotation(int absolute_vertex_num); private: int num_vertices; vector<Thread*> threads; double zero_angle; vector<Matrix3d> rot_diff; vector<Matrix3d> rot_offset; vector<Vector3d> last_pos; vector<Matrix3d> last_rot; vector<int> constrained_vertices_nums; void intermediateRotation(Matrix3d &inter_rot, Matrix3d end_rot, Matrix3d start_rot); // Splits the thread threads[thread_num] into two threads, which are stored at threads[thread_num] and threads[thread_num+1]. Threads in threads that are stored after thread_num now have a new thread_num which is one unit more than before. The split is done at vertex vertex of thread[thread_num] void splitThread(int thread_num, int vertex_num); // Merges the threads threads[thread_num] and threads[thread_num+1] into one thread, which is stored at threads[thread_num]. Threads in threads that are stored after thread_num+1 now have a new thread_num which is one unit less than before. void mergeThread(int thread_num); // Returns the thread number that owns the absolute_vertex number. absolute_vertex must not be a constrained vertex int threadOwner(int absolute_vertex_num); // Returns the local vertex number (i.e. vertex number within a thread), given the absolute vertex number (i.e. vertex number within all vertices). int localVertex(int absolute_vertex_num); }; // Invalidates (sets to -1) the elements of v at indices 1. Indices are specified by constraintsNums. Indices in constraintsNums have to be in the range of v. void invalidateAroundConstraintsNums(vector<int> &v, vector<int> constraintsNums); // Invalidates (sets to -1) the elements of v at indices i. Indices i are specified by constraintsNums. Indices in constraintsNums have to be in the range of v. void invalidateConstraintsNums(vector<int> &v, vector<int> constraintsNums); template<typename T> void mapAdd (vector<T> &v, T num); // Last element of v1 and first element of v2 are equal to v[index]. template<typename T> void splitVector (vector<T> &v1, vector<T> &v2, vector<T> v, int index); // Last element of v1 is discarded since it is assumed to be the same as the first element of v2. template<typename T> void mergeVector (vector<T> &v, vector<T> v1, vector<T> v2); // Last element of a vector in vectors is discarded since it is assumed to be the same as the first element of the consecutive vector in vectors. The last vector in vectors is the exception. template<typename T> void mergeMultipleVector(vector<T> &v, vector<vector<T> > vectors); // Returns the position where the element was inserted. int insertSorted (vector<int> &v, int e); //Returns the position where the element was removed. Element to remove has to be in vector. int removeSorted (vector<int> &v, int e); //Returns the position of the element to be found. int find(vector<int> v, int e);
[ "alex@slave444.(none)" ]
alex@slave444.(none)
968af9e52df0733a010e19c4e0f3aa6d70ae07d7
64e06f70e6cdf2684ae0934e3edd53992db436a1
/include/lib/interface/IDay.hpp
065bbf22f137239baef346874a4ca1fe4d926a7c
[]
no_license
vglad/AdventOfCode_Framework_CPP
9c4aa1ad1704d28de0a2729b0143bd9d55a69289
ca10a04ceef308a20d3944e9346ca7c74794eb0b
refs/heads/master
2020-09-21T22:52:43.404844
2019-12-13T21:12:26
2019-12-13T21:12:26
224,961,508
2
0
null
null
null
null
UTF-8
C++
false
false
345
hpp
#pragma once namespace AoC { class IDay { public: virtual void print_header() noexcept = 0; virtual void print_results() noexcept = 0; virtual void calculate_all() noexcept = 0; virtual void calculate_part1() = 0; virtual void calculate_part2() = 0; virtual ~IDay() = default; }; }
[ "vgladun@gmail.com" ]
vgladun@gmail.com
249329a9471c85330b729a2612d5fc76704f483d
8d1c1e1bbd0ca4ca290d181f92e6af48595de71a
/Project/Graphics.cpp
80c7c0c64ddb34a1ce504f782856bfae6cb534c4
[]
no_license
gapantiru/PankyGame
2f4ceca22c715e4fc5df76d068451becfcc3fc8f
43148af732ad5b6ff6b3da3c7e2f62e4bf106b71
refs/heads/main
2023-06-16T13:42:14.488012
2021-07-15T10:23:38
2021-07-15T10:23:38
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,013
cpp
/* Graphic class * */ #include "graphics.h" #include "globals.h" #include <SDL_image.h> #include <SDL.h> Graphics::Graphics() { SDL_CreateWindowAndRenderer(globals::SCREEN_WIDTH, globals::SCREEN_HEIGHT, 0, &this->_window, &this->_renderer); SDL_SetWindowTitle(this->_window, "Panky"); } Graphics::~Graphics() { SDL_DestroyWindow(this->_window); SDL_DestroyRenderer(this->_renderer); } SDL_Surface* Graphics::loadImage(const std::string &filePath) { if (this->_spriteSheets.count(filePath) == 0) { this->_spriteSheets[filePath] = IMG_Load(filePath.c_str()); } return this->_spriteSheets[filePath]; } void Graphics::blitSurface(SDL_Texture* texture, SDL_Rect* sourceRectangle, SDL_Rect* destinationRectangle) { SDL_RenderCopy( this->_renderer, texture, sourceRectangle, destinationRectangle); } void Graphics::flip() { SDL_RenderPresent(this->_renderer); } void Graphics::clear() { SDL_RenderClear(this->_renderer); } SDL_Renderer* Graphics::getRenderer() const { return this->_renderer; }
[ "gapantiru@bitdefender.com" ]
gapantiru@bitdefender.com
da19680b2d33df94a91ed530baead95299dda7a7
85e7114ea63a080c1b9b0579e66c7a2d126cffec
/SDK/SoT_BP_CustomisableLadder_functions.cpp
de4db1fd5ab35589671a2fc15957a2e9a6e3504e
[]
no_license
EO-Zanzo/SeaOfThieves-Hack
97094307d943c2b8e2af071ba777a000cf1369c2
d8e2a77b1553154e1d911a3e0c4e68ff1c02ee51
refs/heads/master
2020-04-02T14:18:24.844616
2018-10-24T15:02:43
2018-10-24T15:02:43
154,519,316
0
2
null
null
null
null
UTF-8
C++
false
false
7,032
cpp
// Sea of Thieves (1.2.6) SDK #ifdef _MSC_VER #pragma pack(push, 0x8) #endif #include "SoT_BP_CustomisableLadder_parameters.hpp" namespace SDK { //--------------------------------------------------------------------------- //Functions //--------------------------------------------------------------------------- // Function BP_CustomisableLadder.BP_CustomisableLadder_C.GetDockableInfo // (Event, Public, HasOutParms, HasDefaults, BlueprintCallable, BlueprintEvent) // Parameters: // struct FDockableInfo ReturnValue (Parm, OutParm, ReturnParm) struct FDockableInfo ABP_CustomisableLadder_C::GetDockableInfo() { static auto fn = UObject::FindObject<UFunction>("Function BP_CustomisableLadder.BP_CustomisableLadder_C.GetDockableInfo"); ABP_CustomisableLadder_C_GetDockableInfo_Params params; UObject::ProcessEvent(fn, &params); return params.ReturnValue; } // Function BP_CustomisableLadder.BP_CustomisableLadder_C.Construct Ladder // (Public, HasDefaults, BlueprintCallable, BlueprintEvent) void ABP_CustomisableLadder_C::Construct_Ladder() { static auto fn = UObject::FindObject<UFunction>("Function BP_CustomisableLadder.BP_CustomisableLadder_C.Construct Ladder"); ABP_CustomisableLadder_C_Construct_Ladder_Params params; UObject::ProcessEvent(fn, &params); } // Function BP_CustomisableLadder.BP_CustomisableLadder_C.Get Total Height Before Cap // (Public, HasOutParms, BlueprintCallable, BlueprintEvent, BlueprintPure) // Parameters: // float Height (Parm, OutParm, ZeroConstructor, IsPlainOldData) void ABP_CustomisableLadder_C::Get_Total_Height_Before_Cap(float* Height) { static auto fn = UObject::FindObject<UFunction>("Function BP_CustomisableLadder.BP_CustomisableLadder_C.Get Total Height Before Cap"); ABP_CustomisableLadder_C_Get_Total_Height_Before_Cap_Params params; UObject::ProcessEvent(fn, &params); if (Height != nullptr) *Height = params.Height; } // Function BP_CustomisableLadder.BP_CustomisableLadder_C.Get Steps // (Public, HasOutParms, BlueprintCallable, BlueprintEvent, BlueprintPure) // Parameters: // int Num_Steps (Parm, OutParm, ZeroConstructor, IsPlainOldData) void ABP_CustomisableLadder_C::Get_Steps(int* Num_Steps) { static auto fn = UObject::FindObject<UFunction>("Function BP_CustomisableLadder.BP_CustomisableLadder_C.Get Steps"); ABP_CustomisableLadder_C_Get_Steps_Params params; UObject::ProcessEvent(fn, &params); if (Num_Steps != nullptr) *Num_Steps = params.Num_Steps; } // Function BP_CustomisableLadder.BP_CustomisableLadder_C.GetBottomLadderRungTransform // (Event, Public, HasOutParms, HasDefaults, BlueprintCallable, BlueprintEvent) // Parameters: // struct FTransform ReturnValue (Parm, OutParm, ReturnParm, IsPlainOldData) struct FTransform ABP_CustomisableLadder_C::GetBottomLadderRungTransform() { static auto fn = UObject::FindObject<UFunction>("Function BP_CustomisableLadder.BP_CustomisableLadder_C.GetBottomLadderRungTransform"); ABP_CustomisableLadder_C_GetBottomLadderRungTransform_Params params; UObject::ProcessEvent(fn, &params); return params.ReturnValue; } // Function BP_CustomisableLadder.BP_CustomisableLadder_C.GetTopLadderRungTransform // (Event, Public, HasOutParms, HasDefaults, BlueprintCallable, BlueprintEvent) // Parameters: // struct FTransform ReturnValue (Parm, OutParm, ReturnParm, IsPlainOldData) struct FTransform ABP_CustomisableLadder_C::GetTopLadderRungTransform() { static auto fn = UObject::FindObject<UFunction>("Function BP_CustomisableLadder.BP_CustomisableLadder_C.GetTopLadderRungTransform"); ABP_CustomisableLadder_C_GetTopLadderRungTransform_Params params; UObject::ProcessEvent(fn, &params); return params.ReturnValue; } // Function BP_CustomisableLadder.BP_CustomisableLadder_C.Get World Loc at Height Along Z // (Public, HasOutParms, BlueprintCallable, BlueprintEvent, BlueprintPure) // Parameters: // float Relative_Z (Parm, ZeroConstructor, IsPlainOldData) // struct FVector Return_Value (Parm, OutParm, ZeroConstructor, IsPlainOldData) void ABP_CustomisableLadder_C::Get_World_Loc_at_Height_Along_Z(float Relative_Z, struct FVector* Return_Value) { static auto fn = UObject::FindObject<UFunction>("Function BP_CustomisableLadder.BP_CustomisableLadder_C.Get World Loc at Height Along Z"); ABP_CustomisableLadder_C_Get_World_Loc_at_Height_Along_Z_Params params; params.Relative_Z = Relative_Z; UObject::ProcessEvent(fn, &params); if (Return_Value != nullptr) *Return_Value = params.Return_Value; } // Function BP_CustomisableLadder.BP_CustomisableLadder_C.SetupSpline // (Public, HasOutParms, BlueprintCallable, BlueprintEvent) // Parameters: // class USplineComponent* Spline_Component (Parm, ZeroConstructor, IsPlainOldData) // TArray<struct FVector> Positions (Parm, OutParm, ZeroConstructor, ReferenceParm) void ABP_CustomisableLadder_C::SetupSpline(class USplineComponent* Spline_Component, TArray<struct FVector>* Positions) { static auto fn = UObject::FindObject<UFunction>("Function BP_CustomisableLadder.BP_CustomisableLadder_C.SetupSpline"); ABP_CustomisableLadder_C_SetupSpline_Params params; params.Spline_Component = Spline_Component; UObject::ProcessEvent(fn, &params); if (Positions != nullptr) *Positions = params.Positions; } // Function BP_CustomisableLadder.BP_CustomisableLadder_C.UserConstructionScript // (Event, Public, BlueprintCallable, BlueprintEvent) void ABP_CustomisableLadder_C::UserConstructionScript() { static auto fn = UObject::FindObject<UFunction>("Function BP_CustomisableLadder.BP_CustomisableLadder_C.UserConstructionScript"); ABP_CustomisableLadder_C_UserConstructionScript_Params params; UObject::ProcessEvent(fn, &params); } // Function BP_CustomisableLadder.BP_CustomisableLadder_C.ReceiveBeginPlay // (Event, Public, BlueprintEvent) void ABP_CustomisableLadder_C::ReceiveBeginPlay() { static auto fn = UObject::FindObject<UFunction>("Function BP_CustomisableLadder.BP_CustomisableLadder_C.ReceiveBeginPlay"); ABP_CustomisableLadder_C_ReceiveBeginPlay_Params params; UObject::ProcessEvent(fn, &params); } // Function BP_CustomisableLadder.BP_CustomisableLadder_C.ExecuteUbergraph_BP_CustomisableLadder // () // Parameters: // int EntryPoint (Parm, ZeroConstructor, IsPlainOldData) void ABP_CustomisableLadder_C::ExecuteUbergraph_BP_CustomisableLadder(int EntryPoint) { static auto fn = UObject::FindObject<UFunction>("Function BP_CustomisableLadder.BP_CustomisableLadder_C.ExecuteUbergraph_BP_CustomisableLadder"); ABP_CustomisableLadder_C_ExecuteUbergraph_BP_CustomisableLadder_Params params; params.EntryPoint = EntryPoint; UObject::ProcessEvent(fn, &params); } } #ifdef _MSC_VER #pragma pack(pop) #endif
[ "zp2kshield@gmail.com" ]
zp2kshield@gmail.com
7d8f2b61eeb86db0da46d3d844508135c2a40504
1a2cd5cda7b9eace27d7fc9a0dd307960868c0ed
/alpha/MemoryList-inl.h
b16fd00e8aa4c7e91efef58e41c77588a3d3da6a
[]
no_license
jacobwpeng/alpha
bc045e82acb0a3e107b9a16a84c84ef32241b5b8
6e1258977f78970e6c49e8377dc92d82293299a6
refs/heads/master
2022-12-10T01:20:11.431867
2022-12-06T05:36:59
2022-12-06T05:36:59
28,303,729
0
0
null
null
null
null
UTF-8
C++
false
false
4,062
h
/* * ============================================================================== * * Filename: MemoryList-inl.h * Created: 05/17/15 23:32:21 * Author: Peng Wang * Email: pw2191195@gmail.com * Description: * * ============================================================================== */ #include <alpha/MemoryList.h> #define MemoryListType \ MemoryList<T, \ typename std::enable_if<std::is_pod<T>::value && \ !std::is_pointer<T>::value>::type> template <typename T> std::unique_ptr<MemoryListType> MemoryListType::Create(char* buffer, SizeType size) { if (size < sizeof(Header)) { return nullptr; } std::unique_ptr<MemoryListType> m(new MemoryListType); m->header_ = reinterpret_cast<Header*>(buffer); m->header_->magic = kMagic; m->header_->size = 0; m->header_->buffer_size = size; m->header_->node_size = sizeof(T); m->header_->free_list = kInvalidNodeId; m->header_->free_area = (sizeof(Header) + sizeof(T) - 1) / sizeof(T); m->buffer_ = buffer; m->base_ = m->header_->free_area; return std::move(m); } template <typename T> std::unique_ptr<MemoryListType> MemoryListType::Restore(char* buffer, SizeType size) { if (size < sizeof(Header)) { return nullptr; } auto header = reinterpret_cast<Header*>(buffer); if (header->magic != kMagic || header->buffer_size < size || header->node_size != sizeof(T)) { return nullptr; } auto header_slots = (sizeof(Header) + sizeof(T) - 1) / sizeof(T); auto slots = size / sizeof(T); if (header->free_list != kInvalidNodeId && (header->free_list < header_slots || header->free_list >= slots)) { return nullptr; } if (header->free_area < header_slots || header->free_area > slots) { return nullptr; } std::unique_ptr<MemoryListType> m(new MemoryListType); m->header_ = header; m->buffer_ = buffer; m->base_ = header_slots; return std::move(m); } template <typename T> typename MemoryListType::NodeId MemoryListType::Allocate() { NodeId result; if (header_->free_list != kInvalidNodeId) { result = header_->free_list; header_->free_list = *NodeIdToNodeIdPtr(result); } else { CHECK(header_->free_area >= base_); if (header_->free_area - base_ == max_size()) { throw std::bad_alloc(); } else { result = header_->free_area; ++header_->free_area; } } ++header_->size; return result; } template <typename T> void MemoryListType::Deallocate(NodeId id) { *NodeIdToNodeIdPtr(id) = header_->free_list; header_->free_list = id; --header_->size; } template <typename T> void MemoryListType::Clear() { header_->size = 0; header_->free_list = kInvalidNodeId; header_->free_area = (sizeof(Header) + sizeof(T) - 1) / sizeof(T); } template <typename T> T* MemoryListType::Get(NodeId id) { return reinterpret_cast<T*>(NodeIdToAddress(id)); } template <typename T> const T* MemoryListType::Get(NodeId id) const { return reinterpret_cast<T*>(NodeIdToAddress(id)); } template <typename T> bool MemoryListType::empty() const { return header_->size == 0; } template <typename T> typename MemoryListType::NodeId* MemoryListType::NodeIdToNodeIdPtr(NodeId id) { assert(id != kInvalidNodeId); return reinterpret_cast<NodeId*>(NodeIdToAddress(id)); } template <typename T> char* MemoryListType::NodeIdToAddress(NodeId id) { assert(id != kInvalidNodeId); return const_cast<char*>(buffer_) + id * sizeof(T); } template <typename T> typename MemoryListType::SizeType MemoryListType::size() const { return header_->size; } template <typename T> typename MemoryListType::SizeType MemoryListType::max_size() const { auto header_slots = (sizeof(Header) + sizeof(T) - 1) / sizeof(T); return header_->buffer_size / sizeof(T) - header_slots; } #undef MemoryListType
[ "pw2191195@gmail.com" ]
pw2191195@gmail.com
73cb7c00de9e4d7e037969d6cb13ffe074e0e835
48bbc4386f073e3f9b2f9a6aae16cd3551ae0f0f
/trunk/src/AL/ConfigManager.cpp
5a88f1affcbe8126d7c944d508b1e286ecc809ce
[]
no_license
JackyPyb/RAS
98d042b3e75d395170ecec8b9c245123a2f6327e
9378268a4e7d8737af0e0f60b52241d151cba53a
refs/heads/master
2020-04-30T10:31:54.816025
2015-03-27T08:10:57
2015-03-27T08:10:57
32,208,596
0
0
null
null
null
null
UTF-8
C++
false
false
3,466
cpp
#include "ConfigManager.h" #include "common/xml/XMLConfig.h" #include "common/util/util.h" using util::conv::conv; ConfigManager::ConfigManager(): m_connectIP(""), m_connectPort(0), m_frameworkID(0), m_imageLable(""), m_moduleName(""), m_locationFilePath(""), m_ncIP(""), m_cpuNum(0.0), m_cpuMemSize(0), m_listenNum(0) { } ConfigManager::~ConfigManager() { } int ConfigManager::configWithXML(const char *configFileName) { XMLConfig *pXML = new XMLConfig(configFileName); string connectIP, connectPort, frameworkID, imageLable, moduleName, locationFilePath, ncIP, cpuNum, cpuMemSize, listenNum; int ret; //connectIP ret = pXML->getFirstNodeValue("/CONFIG/CONNECT_IP", connectIP); if(ret < 0) { delete pXML; return ret; } m_connectIP = connectIP; //connectPort ret = pXML->getFirstNodeValue("/CONFIG/CONNECT_PORT", connectPort); if(ret < 0) { delete pXML; return ret; } m_connectPort = conv<unsigned short, string>(connectPort); //frameworkID ret = pXML->getFirstNodeValue("/CONFIG/FRAMEWORK_ID", frameworkID); if(ret < 0) { delete pXML; return ret; } m_frameworkID = conv<uint32_t, string>(frameworkID); //imageLable ret = pXML->getFirstNodeValue("/CONFIG/IMAGE_LABLE", imageLable); if(ret < 0) { delete pXML; return ret; } m_imageLable = imageLable; //moduleName ret = pXML->getFirstNodeValue("/CONFIG/MODULE_NAME", moduleName); if(ret < 0) { delete pXML; return ret; } m_moduleName = moduleName; //locationFilePath ret = pXML->getFirstNodeValue("/CONFIG/LOCATION_FILE_PATH", locationFilePath); if(ret < 0) { delete pXML; return ret; } m_locationFilePath = locationFilePath; //ncIP ret = pXML->getFirstNodeValue("/CONFIG/NC_IP", ncIP); if(ret < 0) { delete pXML; return ret; } m_ncIP = ncIP; //cpuNum ret = pXML->getFirstNodeValue("/CONFIG/CPU_NUM", cpuNum); if(ret < 0) { delete pXML; return ret; } m_cpuNum = conv<double, string>(cpuNum); //cpuMemSize ret = pXML->getFirstNodeValue("/CONFIG/CPU_MEM_SIZE", cpuMemSize); if(ret < 0) { delete pXML; return ret; } m_cpuMemSize = conv<uint32_t, string>(cpuMemSize); //listenNum ret = pXML->getFirstNodeValue("/CONFIG/LISTEN_NUM", listenNum); if(ret < 0) { delete pXML; return ret; } m_listenNum = conv<uint32_t, string>(listenNum); delete pXML; return ret; } string ConfigManager::getConnectIP() const { return m_connectIP; } unsigned short ConfigManager::getConnectPort() const { return m_connectPort; } uint32_t ConfigManager::getFrameworkID() const { return m_frameworkID; } string ConfigManager::getImageLable() const { return m_imageLable; } string ConfigManager::getModuleName() const { return m_moduleName; } string ConfigManager::getLocationFilePath() const { return m_locationFilePath; } string ConfigManager::getNCIP() const { return m_ncIP; } double ConfigManager::getCPUNum() const { return m_cpuNum; } uint32_t ConfigManager::getCPUMemSize() const { return m_cpuMemSize; } uint32_t ConfigManager::getListenNum() const { return m_listenNum; }
[ "641186889@qq.com" ]
641186889@qq.com
a6de200a8c3cb4bf104de06a3630b60000eed80a
49ca052c08b6a6480337e2c0ca7963b12e44c0c1
/experiments/metastring.cpp
6353fa96811034383252f17843a3530702d04d8f
[ "BSD-2-Clause" ]
permissive
alzwded/ConstExprShenanigans
177309dff5cd5cd98626df8d66167bb12db16701
64c642691e25eb3811491c256b0716ddae70ad3e
refs/heads/master
2021-01-18T21:09:09.281278
2016-12-22T13:23:05
2016-12-22T13:23:05
53,246,611
0
0
null
null
null
null
UTF-8
C++
false
false
1,398
cpp
// THING ==================================================== #include <type_traits> template<typename T> struct ThingHelper { constexpr T value() const; }; template<> constexpr void ThingHelper<void>::value() const {} template<typename T> constexpr T ThingHelper<T>::value() const { return {}; } template<char C, typename TAIL = void> struct Thing { constexpr char head() const { return C; } template<typename Y = TAIL> constexpr Y tail() const { return ThingHelper<Y>().value(); } typedef TAIL tail_t; constexpr bool more() const { return std::is_void<TAIL>::value; } }; // PRINTY =================================================== #include <cstdio> template<typename T> struct printyHelper2 { constexpr void continuee() const; }; template<bool more> void printyHelper(char); template<typename T, bool more = true> void printy(T t) { printyHelper<t.more()>(t.head()); printyHelper2<typename T::tail_t>().continuee(); } template<> constexpr void printyHelper2<void>::continuee() const {} template<typename T> constexpr void printyHelper2<T>::continuee() const { T t; printy<T, t.more()>(t); } template<> void printyHelper<true>(char c) { printf("%c", c); } template<> void printyHelper<false>(char c) { printf("%c\n", c); } int main() { Thing<'a', Thing<'b', Thing<'c'>>> thing; printy(thing); }
[ "alzwded@gmail.com" ]
alzwded@gmail.com
367a0173a6485faf7fd476c69bed74f7c8ed525a
3b60585a87d959809fa1552e4fa22f6b612f136c
/src/LegitVulkan/RenderPassCache.h
0a98f3ea7355d1a6e641335a68ce84bf79cd26cb
[ "MIT" ]
permissive
MomoDeve/LegitEngine
c0aa07f3943caa8d9aba79d4006d5231cb82ef5d
fd6a388a4a987f387edee3e3e89a6c1b9e9d0ba5
refs/heads/master
2023-05-14T10:47:53.597949
2021-05-23T20:55:57
2021-05-23T20:55:57
370,144,413
0
0
MIT
2021-05-23T19:50:59
2021-05-23T19:50:58
null
UTF-8
C++
false
false
4,779
h
#pragma once #include <map> #include "RenderPass.h" namespace legit { class RenderPassCache { public: RenderPassCache(vk::Device _logicalDevice) : logicalDevice(_logicalDevice) { } struct RenderPassKey { RenderPassKey() { } std::vector<legit::RenderPass::AttachmentDesc> colorAttachmentDescs; legit::RenderPass::AttachmentDesc depthAttachmentDesc; bool operator < (const RenderPassKey &other) const { return std::tie(colorAttachmentDescs, depthAttachmentDesc) < std::tie(other.colorAttachmentDescs, other.depthAttachmentDesc); } }; legit::RenderPass *GetRenderPass(const RenderPassKey &key) { auto &renderPass = renderPassCache[key]; if (!renderPass) { renderPass = std::unique_ptr<legit::RenderPass>(new legit::RenderPass(logicalDevice, key.colorAttachmentDescs, key.depthAttachmentDesc)); } return renderPass.get(); } private: std::map<RenderPassKey, std::unique_ptr<legit::RenderPass>> renderPassCache; vk::Device logicalDevice; }; class FramebufferCache { public: struct PassInfo { legit::Framebuffer *framebuffer; legit::RenderPass *renderPass; }; struct Attachment { legit::ImageView *imageView; vk::ClearValue clearValue; }; PassInfo BeginPass(vk::CommandBuffer commandBuffer, const std::vector<Attachment> colorAttachments, Attachment *depthAttachment, legit::RenderPass *renderPass, vk::Extent2D renderAreaExtent) { PassInfo passInfo; FramebufferKey framebufferKey; std::vector<vk::ClearValue> clearValues; size_t attachmentsUsed = 0; for (auto attachment : colorAttachments) { clearValues.push_back(attachment.clearValue); framebufferKey.colorAttachmentViews[attachmentsUsed++] = attachment.imageView; } if (depthAttachment) { framebufferKey.depthAttachmentView = depthAttachment->imageView; clearValues.push_back(depthAttachment->clearValue); } passInfo.renderPass = renderPass; framebufferKey.extent = renderAreaExtent; framebufferKey.renderPass = renderPass->GetHandle(); legit::Framebuffer *framebuffer = GetFramebuffer(framebufferKey); passInfo.framebuffer = framebuffer; vk::Rect2D rect = vk::Rect2D(vk::Offset2D(), renderAreaExtent); auto passBeginInfo = vk::RenderPassBeginInfo() .setRenderPass(renderPass->GetHandle()) .setFramebuffer(framebuffer->GetHandle()) .setRenderArea(rect) .setClearValueCount(uint32_t(clearValues.size())) .setPClearValues(clearValues.data()); commandBuffer.beginRenderPass(passBeginInfo, vk::SubpassContents::eInline); auto viewport = vk::Viewport() .setWidth(float(renderAreaExtent.width)) .setHeight(float(renderAreaExtent.height)) .setMinDepth(0.0f) .setMaxDepth(1.0f); commandBuffer.setViewport(0, { viewport }); commandBuffer.setScissor(0, { vk::Rect2D(vk::Offset2D(), renderAreaExtent) }); return passInfo; } void EndPass(vk::CommandBuffer commandBuffer) { commandBuffer.endRenderPass(); } FramebufferCache(vk::Device _logicalDevice) : logicalDevice(_logicalDevice) { } private: struct FramebufferKey { FramebufferKey() { std::fill(colorAttachmentViews.begin(), colorAttachmentViews.end(), nullptr); depthAttachmentView = nullptr; renderPass = nullptr; } std::array<const legit::ImageView *, 8> colorAttachmentViews; const legit::ImageView *depthAttachmentView; vk::Extent2D extent; vk::RenderPass renderPass; bool operator < (const FramebufferKey &other) const { return std::tie(colorAttachmentViews, depthAttachmentView, extent.width, extent.height) < std::tie(other.colorAttachmentViews, other.depthAttachmentView, other.extent.width, other.extent.height); } }; legit::Framebuffer *GetFramebuffer(FramebufferKey key) { auto &framebuffer = framebufferCache[key]; if (!framebuffer) { std::vector<const legit::ImageView *> imageViews; for (auto imageView : key.colorAttachmentViews) { if (imageView) imageViews.push_back(imageView); } if (key.depthAttachmentView) imageViews.push_back(key.depthAttachmentView); framebuffer = std::unique_ptr<legit::Framebuffer>(new legit::Framebuffer(logicalDevice, imageViews, key.extent, key.renderPass)); } return framebuffer.get(); } std::map<FramebufferKey, std::unique_ptr<legit::Framebuffer>> framebufferCache; vk::Device logicalDevice; }; }
[ "donxenapo@gmail.com" ]
donxenapo@gmail.com
56d20517f1f7ad0f4c0ad4ceae7c232e8f8dc5d9
33d1314ced7b45381f819603e305f22b304fbd1f
/While/CalcularDobroNoIntervalo.cpp
73cfc269da240dc537eb5f00893a3a3cb60548f0
[]
no_license
LustosaJunior/Estrutura-de-Dados
b1320dca0b583434023d2ecbe47bc424f4f801ba
0b77e0ad1720f9c56f9fbf6de4f874e7226ad1e5
refs/heads/main
2023-05-01T13:46:07.151391
2021-05-21T00:07:58
2021-05-21T00:07:58
358,425,742
0
0
null
null
null
null
ISO-8859-1
C++
false
false
579
cpp
/* 62. Faça um programa que receba 10 números inteiros positivos quaisquer, calcule e mostre na tela o dobro dos valores pertencentes ao intervalo: 5< x <20. (do .. while e if)*/ #include<stdio.h> #include<conio.h> #include<locale.h> int main() { setlocale(LC_ALL, "Portuguese"); int number, x2, cont = 0; do { printf("Informe um número inteiro: "); scanf("%i", &number); if(number > 5 && number < 20){ x2 = number*2; printf("O dobro do número %i é %i\n",number, x2); } cont++; } while(cont < 10); getch(); return 0; }
[ "junior_dj_decio@hotmail.com" ]
junior_dj_decio@hotmail.com
7d9436213dc34d8b15abd0be4f24ee3602964c25
855dc81eb63aa2ce1463343580c078afc84e2934
/src/graphnode.cpp
43bd1ac54c4e08386d83bc546cf930c4be6a6cd4
[]
no_license
tusharsangam/Cpp-Memory-Management-Chatbot
e398bbc8ac8756c861768eefd68359e1f0dd12a4
d36d44d746b2018883663eb6c04fb09e4e6c4477
refs/heads/master
2021-04-21T23:00:24.428812
2020-03-24T21:43:32
2020-03-24T21:43:32
249,823,639
0
0
null
null
null
null
UTF-8
C++
false
false
1,020
cpp
#include "graphedge.h" #include "graphnode.h" GraphNode::GraphNode(int id) { _id = id; } GraphNode::~GraphNode() { //// STUDENT CODE //// //delete _chatBot; //// //// EOF STUDENT CODE } void GraphNode::AddToken(std::string token) { _answers.emplace_back(token); } void GraphNode::AddEdgeToParentNode(GraphEdge* edge) { _parentEdges.emplace_back(edge); } void GraphNode::AddEdgeToChildNode(std::unique_ptr<GraphEdge> edge) { _childEdges.emplace_back(std::move(edge)); } //// STUDENT CODE //// void GraphNode::MoveChatbotHere(ChatBot chatbot) { _chatBot = std::move(chatbot); _chatBot.SetCurrentNode(this); } void GraphNode::MoveChatbotToNewNode(GraphNode *newNode) { newNode->MoveChatbotHere(std::move(_chatBot)); //_chatBot = nullptr; // invalidate pointer at source } //// //// EOF STUDENT CODE GraphEdge *GraphNode::GetChildEdgeAtIndex(int index) { //// STUDENT CODE //// return _childEdges[index].get(); //// //// EOF STUDENT CODE }
[ "tusharsangam5@gmail.com" ]
tusharsangam5@gmail.com
44c790f88a81bfc27eaa7f9b817da1c7a8794d5c
ac140a854c180f0c6c0ff0f35518c18e32a43758
/ModernCpp/SubParagraph_5_6_3.cpp
2ec81b2b8f14dcc833e0d0944b1ec55dbbea5a27
[]
no_license
klasing/MnistExample
53bd4e6316b513889acd77a5549082863c643435
720479f6768c15fa6e63fafd415b5a2bcff3dfa9
refs/heads/master
2020-04-22T00:29:18.102857
2019-06-30T18:41:17
2019-06-30T18:41:17
169,981,063
0
0
null
null
null
null
UTF-8
C++
false
false
128
cpp
#include "pch.h" inline void subParagraph_5_6_3() { cout << "Spacing and Tabs" << endl; cout << "----------------" << endl; }
[ "klasing1959@gmail.com" ]
klasing1959@gmail.com
5cebb2e50f42a8a307fe3695ee48e9f9347442fd
8eea3d715692194bf09e3c19520ba3eb9254cb8f
/Advance_Bit.cpp
73cac607250e15f796487ec1bb6cb4350d623855
[]
no_license
ismail-ru-cse-39/Programming_Samsung_internship
9971cb6c73407c8ff7bec6e266536812dd9a9110
ba464785bc695972819f3ed1fd54adcf9c47ab87
refs/heads/master
2020-05-06T15:47:54.235235
2019-05-17T01:21:01
2019-05-17T01:21:01
180,208,766
0
0
null
null
null
null
UTF-8
C++
false
false
1,519
cpp
//Advance //Bit //solution //solved #include <stdio.h> #define SZ 110 int N, M, K,Test_case; int Ar_grid[SZ][SZ]; int Case; int Ans = 0; int Max(int a, int b) { if (a > b){ return a; } return b; } void take_input() { int i, j; scanf("%d %d %d", &N, &M, &K); for (i = 0; i < N; i++){ for (j = 0; j < M; j++){ scanf("%d", &Ar_grid[i][j]); } } } int cntzero(int i) { int j; int cnt = 0; for (j = 0; j < M; j++){ if (Ar_grid[i][j] == 0){ cnt++; } } return cnt; } int isSame(int row1, int row2){ int j; for (j = 0; j < M; j++){ if (Ar_grid[row1][j] != Ar_grid[row2][j]){ return 0; } } return 1; } void solve_case() { int i; int cnt_zero_1; int cnt_zero_2; int cnt = 0; int flag = 0; Ans = 0; for (i = 0; i < N ; i++){ cnt_zero_1 = cntzero(i); cnt = 0; if (cnt_zero_1 == K || (K>= cnt_zero_1 &&(K-cnt_zero_1)%2 == 0)){ cnt = 1; for (int j = i + 1; j < N; j++){ if (isSame(i, j)){ cnt++; /*if (cnt > 0){ flag = 1; }*/ } } Ans = Max(Ans, cnt); } } /*if (flag > 0){ Ans++; }*/ } void print_case() { printf("#%d %d\n",Case, Ans); } int main() { //freopen("in.txt", "r", stdin); freopen("in_bit.txt", "r", stdin); freopen("out.txt", "w", stdout); scanf("%d", &Test_case); for (Case = 1; Case <= Test_case; Case++){ take_input(); solve_case(); print_case(); } }
[ "shaikat.ru.39@gmail.com" ]
shaikat.ru.39@gmail.com
bc197a70da3d407451372f2b991dd4d226fd05f4
e3b7d7960949a42948b4fe0a05301c8794daf0a3
/projects/worker/server.cpp
285c1ec689000173e187dbe44c9347479b34e5c6
[]
no_license
masixian/RelayLive
d2ba6af6cddae8cc2e05507a3002d715db030f8d
41e2c167da8bd6925d0e25524e22e7eeaf06eca1
refs/heads/master
2022-05-12T01:20:38.766811
2022-03-25T06:00:40
2022-03-25T06:00:40
196,906,055
0
0
null
2019-07-15T01:59:09
2019-07-15T01:59:08
null
GB18030
C++
false
false
15,884
cpp
#include "server.h" #include "sha1.h" #include "base64.h" #include "uv.h" #include "util.h" #include "utilc.h" #include "easylog.h" #include "worker.h" #include <unordered_map> #include <sstream> using namespace util; uv_loop_t uvLoopLive; uv_tcp_t uvTcpServer; class CLiveSession : public ILiveSession { public: CLiveSession(); virtual ~CLiveSession(); virtual void AsyncSend(); //外部线程通知可以发送数据了 void OnRecv(char* data, int len); void OnSend(); //发送数据 void OnClose(); bool ParseHeader(); //解析报文头 bool ParsePath(); //解析报文头中的uri void WsAcceptKey(); //生成websocket应答的Sec-WebSocket-Accept字段 void WriteFailResponse(); //报文不合法时的应答 string strRemoteIP; //客户端IP地址 uint32_t nRemotePort; //客户端port uv_tcp_t socket; //tcp连接 char readBuff[1024*1024]; //读取客户端内容缓存 string dataCatch; //读取到的数据 bool parseHeader; //是否解析协议头 bool connected; int handlecount; string method; //解析出请求的方法 string path; //解析出请求的uri RequestParam Params; //uri中解析出参数 string version; //解析出请求的协议版本 string Connection; //报文头中的字段值 string Upgrade; //报文头中的字段值 string SecWebSocketKey; //websocket报文头中的字段值 string SecWebSocketAccept; //计算出websocket应答报文头的字段值 string xForwardedFor; //报文头中的字段值 代理流程 bool isWs; // 是否为websocket CLiveWorker *pWorker; // worker对象 CNetStreamMaker wsBuff; //协议头数据 CNetStreamMaker writeBuff; //缓存要发送的数据 bool writing; //正在发送 uv_async_t asWrite; //外部通知有视频数据可以发送 uv_async_t asClose; //外部通知关闭连接 uv_write_t writeReq; //发送请求 }; ////////////////////////////////////////////////////////////////////////// static string url_decode(string str) { int len = str.size(); string dest; for (int i=0; i<len; i++) { char c = str[i]; if (c == '+') { dest.push_back(' '); } else if (c == '%' && i<len-2 && isxdigit((int)str[i+1]) && isxdigit((int)str[i+2])) { char h1 = str[++i]; char h2 = str[++i]; char v = (h1>='a'?h1-'a'+10:(h1>='A'?h1-'A'+10:h1-'0'))*16 + (h2>='a'?h2-'a'+10:(h2>='A'?h2-'A'+10:h2-'0')); dest.push_back(v); } else { dest.push_back(str[i]); } } return dest; } static void on_close(uv_handle_t* handle) { CLiveSession *skt = (CLiveSession*)handle->data; skt->handlecount--; if(skt->handlecount == 0 && !skt->connected) { delete skt; } } static void on_uv_close(uv_handle_t* handle) { CLiveSession *skt = (CLiveSession*)handle->data; Log::warning("on close client [%s:%u]", skt->strRemoteIP.c_str(), skt->nRemotePort); skt->OnClose(); } static void on_uv_shutdown(uv_shutdown_t* req, int status) { CLiveSession *skt = (CLiveSession*)req->data; Log::warning("on shutdown client [%s:%d]", skt->strRemoteIP.c_str(), skt->nRemotePort); delete req; uv_close((uv_handle_t*)&skt->socket, on_uv_close); } static void on_uv_alloc(uv_handle_t* handle, size_t suggested_size, uv_buf_t* buf){ CLiveSession *skt = (CLiveSession*)handle->data; *buf = uv_buf_init(skt->readBuff, 1024*1024); } static void on_uv_read(uv_stream_t* stream, ssize_t nread, const uv_buf_t* buf) { CLiveSession *skt = (CLiveSession*)stream->data; if(nread < 0) { skt->connected = false; if(nread == UV_ECONNRESET || nread == UV_EOF) { //对端发送了FIN Log::warning("remote close socket [%s:%u]", skt->strRemoteIP.c_str(), skt->nRemotePort); uv_close((uv_handle_t*)&skt->socket, on_uv_close); } else { uv_shutdown_t* req = new uv_shutdown_t; req->data = skt; Log::error("Read error %s", uv_strerror((int)nread)); Log::warning("remote shutdown socket [%s:%u]", skt->strRemoteIP.c_str(), skt->nRemotePort); uv_shutdown(req, stream, on_uv_shutdown); } return; } skt->OnRecv(buf->base, (int)nread); } static void on_uv_write(uv_write_t* req, int status) { CLiveSession *skt = (CLiveSession*)req->data; skt->writing = false; skt->OnSend(); } /** 接收到客户端发送来的连接 */ static void on_connection(uv_stream_t* server, int status) { if(status != 0) { Log::error("status:%d %s", status, uv_strerror(status)); return; } CLiveSession *sess = new CLiveSession(); int ret = uv_accept(server, (uv_stream_t*)(&sess->socket)); if(ret != 0) { delete sess; return; } //socket远端ip和端口 struct sockaddr peername; int namelen = sizeof(struct sockaddr); ret = uv_tcp_getpeername(&sess->socket, &peername, &namelen); if(peername.sa_family == AF_INET) { struct sockaddr_in* sin = (struct sockaddr_in*)&peername; char addr[46] = {0}; uv_ip4_name(sin, addr, 46); sess->strRemoteIP = addr; sess->nRemotePort = sin->sin_port; } else if(peername.sa_family == AF_INET6) { struct sockaddr_in6* sin6 = (struct sockaddr_in6*)&peername; char addr[46] = {0}; uv_ip6_name(sin6, addr, 46); sess->strRemoteIP = addr; sess->nRemotePort = sin6->sin6_port; } Log::warning("new remote socket [%s:%u]", sess->strRemoteIP.c_str(), sess->nRemotePort); uv_read_start((uv_stream_t*)&sess->socket, on_uv_alloc, on_uv_read); } static void on_uv_async_write(uv_async_t* handle) { CLiveSession *skt = (CLiveSession*)handle->data; skt->OnSend(); } static void on_uv_async_close(uv_async_t* handle) { //CLiveSession *skt = (CLiveSession*)handle->data; } static void run_loop_thread(void* arg) { uv_run(&uvLoopLive, UV_RUN_DEFAULT); uv_loop_close(&uvLoopLive); } ////////////////////////////////////////////////////////////////////////// RequestParam::RequestParam() : strType("flv") , nWidth(0) , nHeight(0) , nProbSize(Settings::getValue("FFMPEG","probsize",25600)) , nProbTime(Settings::getValue("FFMPEG","probtime",1000)) , nInCatch(Settings::getValue("FFMPEG","incatch",1024*16)) , nOutCatch(Settings::getValue("FFMPEG","outcatch",1024*16)) {} CLiveSession::CLiveSession() : nRemotePort(0) , parseHeader(false) , connected(true) , handlecount(2) , isWs(false) , pWorker(NULL) , writing(false) { socket.data = this; uv_tcp_init(&uvLoopLive, &socket); asWrite.data = this; uv_async_init(&uvLoopLive, &asWrite, on_uv_async_write); asClose.data = this; uv_async_init(&uvLoopLive, &asClose, on_uv_async_close); writeReq.data = this; } CLiveSession::~CLiveSession() { Log::debug("~CLiveSession()"); } void CLiveSession::AsyncSend() { uv_async_send(&asWrite); } void CLiveSession::OnRecv(char* data, int len) { dataCatch.append(data, len); // http头解析 if(!parseHeader && dataCatch.find("\r\n\r\n") != std::string::npos) { if(!ParseHeader()) { Log::error("error request"); WriteFailResponse(); return; } parseHeader = true; if(!strcasecmp(Connection.c_str(), "Upgrade") && !strcasecmp(Upgrade.c_str(), "websocket")) { isWs = true; Log::debug("Websocket req: %s", path.c_str()); } else { Log::debug("Http req: %s", path.c_str()); } //解析请求 if(!ParsePath()) { Log::error("error path:%s", path.c_str()); WriteFailResponse(); return; } //创建worker string clientIP = xForwardedFor.empty()?strRemoteIP:xForwardedFor; pWorker = CreatLiveWorker(Params, isWs, this, clientIP); //发送应答 stringstream ss; if(isWs){ WsAcceptKey(); ss << version << " 101 Switching Protocols\r\n" "Upgrade: WebSocket\r\n" "Connection: Upgrade\r\n" "Sec-WebSocket-Accept: " << SecWebSocketAccept << "\r\n" "\r\n"; } else { string mime; if(Params.strType == "flv") mime = "video/x-flv"; else if(Params.strType == "h264") mime = "video/h264"; else if(Params.strType == "mp4") mime = "video/mp4"; ss << version << " 200 OK\r\n" "Connection: " << Connection << "\r\n" "Transfer-Encoding: chunked\r\n" "Access-Control-Allow-Origin: *\r\n" "Content-Type: " << mime << "\r\n" "Cache-Control: no-cache\r\n" "Pragma: no-cache\r\n" "Expires: -1\r\n" "\r\n"; } writeBuff.clear(); writeBuff.append_string(ss.str().c_str()); writing = true; uv_buf_t buff = uv_buf_init(writeBuff.get(), writeBuff.size()); uv_write(&writeReq, (uv_stream_t*)&socket, &buff, 1, on_uv_write); } else { if(dataCatch.find("\r\n\r\n") != std::string::npos) { Log::debug("%s", dataCatch.c_str()); } } } void CLiveSession::OnSend() { if(writing){ printf("== "); return; } char *flv = NULL; int len = pWorker->get_flv_frame(&flv); if(len == 0) return; wsBuff.clear(); writeBuff.clear(); while (len) { writeBuff.append_data(flv, len); pWorker->next_flv_frame(); len = pWorker->get_flv_frame(&flv); } len = writeBuff.size(); if(isWs) { if(len <= 125) { wsBuff.append_byte(0x82); //10000010 wsBuff.append_byte(len); } else if(len <= 65535) { wsBuff.append_byte(0x82); //10000010 wsBuff.append_byte(126); wsBuff.append_be16(len); } else { wsBuff.append_byte(0x82); //10000010 wsBuff.append_byte(127); wsBuff.append_be64(len); } } else { char chunk[20] = {0}; sprintf(chunk, "%x\r\n", len); wsBuff.append_data(chunk, strlen(chunk)); writeBuff.append_string("\r\n"); } writing = true; uv_buf_t buff[] = { uv_buf_init(wsBuff.get(), wsBuff.size()), uv_buf_init(writeBuff.get(), writeBuff.size()) }; uv_write(&writeReq, (uv_stream_t*)&socket, buff, 2, on_uv_write); } void CLiveSession::OnClose() { if(pWorker != NULL) pWorker->close(); uv_close((uv_handle_t*)&asWrite, on_close); uv_close((uv_handle_t*)&asClose, on_close); if(connected) { connected = false; uv_shutdown_t* req = new uv_shutdown_t; req->data = this; uv_shutdown(req, (uv_stream_t*)&socket, on_uv_shutdown); } } bool CLiveSession::ParseHeader() { size_t pos1 = dataCatch.find("\r\n"); //第一行的结尾 size_t pos2 = dataCatch.find("\r\n\r\n"); //头的结尾位置 string reqline = dataCatch.substr(0, pos1); //第一行的内容 vector<string> reqlines = util::String::split(reqline, ' '); if(reqlines.size() != 3) return false; method = reqlines[0].c_str(); path = reqlines[1]; version = reqlines[2].c_str(); string rawHeaders = dataCatch.substr(pos1+2, pos2-pos1); dataCatch = dataCatch.substr(pos2+4, dataCatch.size()-pos2-4); vector<string> headers = util::String::split(rawHeaders, "\r\n"); for(auto &hh : headers) { string name, value; bool b = false; for(auto &c:hh){ if(!b) { if(c == ':'){ b = true; } else { name.push_back(c); } } else { if(!value.empty() || c != ' ') value.push_back(c); } } if(!strcasecmp(name.c_str(), "Connection")) { Connection = value; } else if(!strcasecmp(name.c_str(), "Upgrade")) { Upgrade = value; } else if(!strcasecmp(name.c_str(), "Sec-WebSocket-Key")) { SecWebSocketKey = value; } else if(!strcasecmp(name.c_str(), "x-forwarded-for")) { xForwardedFor = value; } } return true; } bool CLiveSession::ParsePath() { vector<string> uri = util::String::split(path, '?'); if(uri.size() != 2) return false; vector<string> param = util::String::split(uri[1], '&'); for(auto p:param) { vector<string> kv = util::String::split(p, '='); if(kv.size() != 2) continue; if(kv[0] == "code") Params.strCode = kv[1]; else if(kv[0] == "url") Params.strUrl = url_decode(kv[1]); else if(kv[0] == "host") Params.strHost = kv[1]; else if(kv[0] == "port") Params.nPort = stoi(kv[1]); else if(kv[0] == "user") Params.strUsr = kv[1]; else if(kv[0] == "pwd") Params.strPwd = kv[1]; else if(kv[0] == "channel") Params.nChannel = stoi(kv[1]); else if(kv[0] == "type") Params.strType = kv[1]; else if(kv[0] == "hw"){ string strHw = kv[1]; if(!strHw.empty() && strHw.find('*') != string::npos) sscanf(strHw.c_str(), "%d*%d", &Params.nWidth, &Params.nHeight); } else if(kv[0] == "probsize") Params.nProbSize = stoi(kv[1]); else if(kv[0] == "probtime") Params.nProbTime = stoi(kv[1]); else if(kv[0] == "incatch") Params.nInCatch = stoi(kv[1]); else if(kv[0] == "outcatch") Params.nOutCatch = stoi(kv[1]); else if(kv[0] == "begintime") Params.strBeginTime = kv[1]; else if(kv[0] == "endtime") Params.strEndTime = kv[1]; } return true; } void CLiveSession::WsAcceptKey() { SHA1 sha1; string tmp = SecWebSocketKey + "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"; tmp = (char*)sha1.Comput((uint8_t*)tmp.c_str(), tmp.size()); SecWebSocketAccept = Base64::Encode((uint8_t*)tmp.c_str(), tmp.size()); Log::debug("%s --> %s", SecWebSocketKey.c_str(), SecWebSocketAccept.c_str()); } void CLiveSession::WriteFailResponse() { stringstream ss; ss << version << " 400 Bad request\r\n" "Connection: " << Connection << "\r\n" "Access-Control-Allow-Origin: *\r\n" "Content-Length: 0\r\n" "\r\n"; writeBuff.clear(); writeBuff.append_string(ss.str().c_str()); writing = true; uv_buf_t buff = uv_buf_init(writeBuff.get(), writeBuff.size()); uv_write(&writeReq, (uv_stream_t*)&socket, &buff, 1, on_uv_write); } ////////////////////////////////////////////////////////////////////////// void start_service(uint32_t port) { uv_loop_init(&uvLoopLive); uv_tcp_init(&uvLoopLive, &uvTcpServer); struct sockaddr_in addr; uv_ip4_addr("0.0.0.0", port, &addr); uv_tcp_bind(&uvTcpServer, (const sockaddr*)&addr, 0); uv_listen((uv_stream_t*)&uvTcpServer, 512, on_connection); uv_thread_t tid; uv_thread_create(&tid, run_loop_thread, NULL); } namespace Server { int Init(int port) { start_service(port); return 0; } int Cleanup() { return 0; } }
[ "wlla@jiangsuits.com" ]
wlla@jiangsuits.com
8cf5d9e8a44ea53679863a71b89c094a0876cb02
5102892f18f44b02b340cea85f220982eea18435
/NewFramework/ItemsManager.cpp
2ec249a1b56f82f92c93c9dfbd084a9615d79f70
[ "MIT" ]
permissive
lhthang1998/Megaman_X3_DirectX
b87ee477ac596954122e1aa838e3aa6242127632
2c695fefad81c37a7872cc79c78d0de3ff6db9ca
refs/heads/master
2021-10-10T11:07:38.695966
2019-01-10T03:38:01
2019-01-10T03:38:01
164,980,874
0
0
null
null
null
null
UTF-8
C++
false
false
790
cpp
#include "ItemsManager.h" std::vector<HP*> ItemsManager::HPItemsList; ItemsManager::ItemsManager() { } ItemsManager::~ItemsManager() { for (int i = 0; i < HPItemsList.size(); i++) { delete HPItemsList[i]; } } void ItemsManager::DropItem(HP* item) { HPItemsList.push_back(item); } void ItemsManager::DropHPItem(int x, int y) { HPItemsList.push_back(new HP(x, y)); } void ItemsManager::UpdateItems() { for (int i = 0; i < HPItemsList.size(); i++) { if (HPItemsList[i]->isDisappeared) { delete HPItemsList[i]; HPItemsList.erase(HPItemsList.begin() + i); i--; } else { HPItemsList[i]->Update(); } } //GAMELOG("HP: %d", HPItemsList.size()); } void ItemsManager::RenderItems() { for (int i = 0; i < HPItemsList.size(); i++) { HPItemsList[i]->Render(); } }
[ "lhthang.1998@gmail.com" ]
lhthang.1998@gmail.com
acf1366df106e580f8c61ce0dc8fc70ea9b1ab3f
6ced41da926682548df646099662e79d7a6022c5
/aws-cpp-sdk-lakeformation/include/aws/lakeformation/model/DeleteDataCellsFilterResult.h
1d0f9d55ed8a9552cfd74ccfe2869a76449a0e16
[ "Apache-2.0", "MIT", "JSON" ]
permissive
irods/aws-sdk-cpp
139104843de529f615defa4f6b8e20bc95a6be05
2c7fb1a048c96713a28b730e1f48096bd231e932
refs/heads/main
2023-07-25T12:12:04.363757
2022-08-26T15:33:31
2022-08-26T15:33:31
141,315,346
0
1
Apache-2.0
2022-08-26T17:45:09
2018-07-17T16:24:06
C++
UTF-8
C++
false
false
810
h
/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #pragma once #include <aws/lakeformation/LakeFormation_EXPORTS.h> namespace Aws { template<typename RESULT_TYPE> class AmazonWebServiceResult; namespace Utils { namespace Json { class JsonValue; } // namespace Json } // namespace Utils namespace LakeFormation { namespace Model { class AWS_LAKEFORMATION_API DeleteDataCellsFilterResult { public: DeleteDataCellsFilterResult(); DeleteDataCellsFilterResult(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result); DeleteDataCellsFilterResult& operator=(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result); }; } // namespace Model } // namespace LakeFormation } // namespace Aws
[ "aws-sdk-cpp-automation@github.com" ]
aws-sdk-cpp-automation@github.com
928598a20abbf1d4a85cd2aafd2a70c8f3ebb2c3
36357bbe859f79d48f9313442ccb39e78f25b347
/modules/drivers/radar/rocket_radar/driver/system-radar-software/engine/scp-src/eng-api/uhmath.h
55558e486cda46d6842fbbe201dea29eb5ecd386
[ "Apache-2.0" ]
permissive
MaxLin86/apollo
75c8a94d90daa14759c0bb0eae3085638bb9b6b5
fae1adf277c8d2b75e42119c5d52cbd1c6fb95c7
refs/heads/main
2023-03-28T18:22:36.161004
2021-03-08T07:53:25
2021-03-08T07:53:25
345,560,672
1
2
null
null
null
null
UTF-8
C++
false
false
6,779
h
#ifndef SRS_HDR_UHMATH_H #define SRS_HDR_UHMATH_H 1 // START_SOFTWARE_LICENSE_NOTICE // ------------------------------------------------------------------------------------------------------------------- // Copyright (C) 2016-2019 Uhnder, Inc. All rights reserved. // This Software is the property of Uhnder, Inc. (Uhnder) and is Proprietary and Confidential. It has been provided // under license for solely use in evaluating and/or developing code for Uhnder products. Any use of the Software to // develop code for a product not manufactured by or for Uhnder is prohibited. Unauthorized use of this Software is // strictly prohibited. // Restricted Rights Legend: Use, Duplication, or Disclosure by the Government is Subject to Restrictions as Set // Forth in Paragraph (c)(1)(ii) of the Rights in Technical Data and Computer Software Clause at DFARS 252.227-7013. // THIS PROGRAM IS PROVIDED UNDER THE TERMS OF THE UHNDER END-USER LICENSE AGREEMENT (EULA). THE PROGRAM MAY ONLY // BE USED IN A MANNER EXPLICITLY SPECIFIED IN THE EULA, WHICH INCLUDES LIMITATIONS ON COPYING, MODIFYING, // REDISTRIBUTION AND WARRANTIES. PROVIDING AFFIRMATIVE CLICK-THROUGH CONSENT TO THE EULA IS A REQUIRED PRECONDITION // TO YOUR USE OF THE PROGRAM. YOU MAY OBTAIN A COPY OF THE EULA FROM WWW.UHNDER.COM. UNAUTHORIZED USE OF THIS // PROGRAM IS STRICTLY PROHIBITED. // THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES ARE GIVEN, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING // WARRANTIES OR MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, NONINFRINGEMENT AND TITLE. RECIPIENT SHALL HAVE // THE SOLE RESPONSIBILITY FOR THE ADEQUATE PROTECTION AND BACK-UP OF ITS DATA USED IN CONNECTION WITH THIS SOFTWARE. // IN NO EVENT WILL UHNDER BE LIABLE FOR ANY CONSEQUENTIAL DAMAGES WHATSOEVER, INCLUDING LOSS OF DATA OR USE, LOST // PROFITS OR ANY INCIDENTAL OR SPECIAL DAMAGES, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS // SOFTWARE, WHETHER IN ACTION OF CONTRACT OR TORT, INCLUDING NEGLIGENCE. UHNDER FURTHER DISCLAIMS ANY LIABILITY // WHATSOEVER FOR INFRINGEMENT OF ANY INTELLECTUAL PROPERTY RIGHTS OF ANY THIRD PARTY. // ------------------------------------------------------------------------------------------------------------------- // END_SOFTWARE_LICENSE_NOTICE #include "modules/drivers/radar/rocket_radar/driver/system-radar-software/env-uhnder/coredefs/uhnder-common.h" #include "modules/drivers/radar/rocket_radar/driver/system-radar-software/engine/common/eng-api/uhtypes.h" #include "modules/drivers/radar/rocket_radar/driver/system-radar-software/env-uhnder/coredefs/uhmathtypes.h" SRS_DECLARE_NAMESPACE() static UHINLINE void fmaxabs(FLOAT* max, FLOAT val) { FLOAT aval = uh_fabsf(val); if (aval > *max) { *max = aval; } } static UHINLINE uint32_t uh_uintmin(uint32_t val_a, uint32_t val_b) { if (val_a < val_b) { return val_a; } else { return val_b; } } static UHINLINE uint32_t uh_uintmax(uint32_t val_a, uint32_t val_b) { if (val_a > val_b) { return val_a; } else { return val_b; } } static UHINLINE FLOAT deg2rad(FLOAT a) { return a * M_PI / 180.0F; } static UHINLINE FLOAT rad2deg(FLOAT a) { return a / M_PI * 180.0F; } static UHINLINE FLOAT db2mag(FLOAT db) { return powf(10.0F, db * 0.05F); } // use * 0.05 instead of / 20.0 for speed static UHINLINE FLOAT mag2db(FLOAT f) { return 20.0F * log10f(f); } static UHINLINE FLOAT rfa_to_db(FLOAT rfa, size_t num_cells) { return mag2db(uh_sqrtf(-2 * logf(float(double(rfa) / num_cells)))); } static UHINLINE int32_t uh_lroundf(FLOAT f) { return (f < 0) ? (-(int32_t)(-(f) + 0.5F)) : ((int32_t)((f) + 0.5F)); } static UHINLINE uint16_t f2qu16(FLOAT f, INT frac_bit) { FLOAT v = f * (1 << frac_bit) + 0.5F; return (uint16_t)(v < 0.0F ? 0 : v > 65535.0F ? 65535.0F : v); } static UHINLINE int16_t f2q16(FLOAT f, INT frac_bit) { FLOAT round = f < 0 ? -0.5F : 0.5F; FLOAT v = f * (1 << frac_bit) + round; return (int16_t)(v < -32768.0F ? -32768.0F : v > 32767.0F ? 32767.0F : v); } static UHINLINE uint32_t f2qu32(FLOAT f, INT frac_bit) { FLOAT v = f * (1 << frac_bit) + 0.5F; return (uint32_t)(v < 0.0F ? 0.0F : v > 4294967295.0F ? 4294967295.0F : v); } static UHINLINE int32_t f2q32(FLOAT f, INT frac_bit) { FLOAT round = f < 0 ? -0.5F : 0.5F; FLOAT v = f * (1 << frac_bit) + round; return (int32_t)(v < -2147483648.0F ? -2147483648.0F : v > 2147483647.0F ? 2147483647.0F : v); } template <class T> static UHINLINE FLOAT q2f(T v, INT frac_bit) { return (FLOAT)v / (1 << frac_bit); } static UHINLINE bool linear_interpolate_array( // Returns: true upon success, false upon failure (x not in valid range) FLOAT &y_interp, // Output: Interpolated Y value, if successful, else zero FLOAT x, // Input: Fractional X index into Y vector ( 0 <= x <= y_len-1 ) FLOAT *y, // Input: Y vector int32_t y_len) // Input: Number of entries in Y vector { y_interp = 0.0F; if ((x < 0.0F) || (x > ((FLOAT)y_len - 1.0F))) { return false; } FLOAT x1 = uh_floorf(x); int32_t x1_int = (int32_t)x1; if ((x1_int < 0) || (x1_int > (y_len - 1))) { return false; } FLOAT frac = x - x1; FLOAT y1 = y[x1_int]; if (x1_int == (y_len - 1)) { y_interp = y1; return true; } FLOAT y2 = y[x1_int + 1]; y_interp = y1 + (frac * (y2 - y1)); return true; } static UHINLINE void quadratic_interpolate(FLOAT &y, FLOAT &x, FLOAT yl, FLOAT yc, FLOAT yu) { if ((yl > yc) && (yl > yu)) { y = yl; x = -1.0F; return; } if (yu > yc) { y = yu; x = 1.0F; return; } // X coordinates FLOAT xl = -1.0F; FLOAT xc = 0.0F; FLOAT xu = 1.0F; // Quadratic interpolation FLOAT yucxuc = (yu - yc) / (xu - xc); FLOAT d2 = (yucxuc - (yl - yc) / (xl - xc)) * 2.0F / (xu - xl); FLOAT d1 = yucxuc - (d2 * (xu - xc) * 0.5F); if (d2 == 0.0F) { x = xc; y = yc; } else { x = xc - (d1 / d2); y = yc + (d1 * ((x - xc) * 0.5F)); } } static UHINLINE void quadratic_interpolate_db(cfloat &y, FLOAT &x, cfloat a, cfloat b, cfloat c) { // Values in db FLOAT yl = mag2db(a.abs()); FLOAT yc = mag2db(b.abs()); FLOAT yu = mag2db(c.abs()); FLOAT y1; quadratic_interpolate(y1, x, yl, yc, yu); y = db2mag(y1); } SRS_CLOSE_NAMESPACE() #endif // SRS_HDR_UHMATH_H
[ "maxlin86@foxmail.com" ]
maxlin86@foxmail.com
b25910d1628a01f5c583c09e6251a0b4750d521d
e2c37739e3832dfd63725c5d25cca86fdc04f89f
/week15/code/MultimediaFile.hpp
3a066bb8e7738a0a257f430552e806314fa0934b
[]
no_license
lyubolp/OOP-SI-2021
bad9229d269f0b462dbb16c44c0667b3dd9622c4
4afc1671a414bee7bb1d1c57511cfa870f8ef4ce
refs/heads/main
2023-05-27T10:33:11.952723
2021-06-11T16:17:25
2021-06-11T16:17:25
341,111,944
5
4
null
null
null
null
UTF-8
C++
false
false
904
hpp
// // Created by lyubo on 3.06.21 г.. // #ifndef CODE_MULTIMEDIAFILE_HPP #define CODE_MULTIMEDIAFILE_HPP #include <string> #include <iostream> //const, const&, unsigned, () with parameters - 4pts class MultimediaFile { //20pts public: MultimediaFile(); MultimediaFile(const std::string& name, const std::string& extension, const unsigned size); std::string get_name() const; //1pts std::string get_extension() const; //1pts unsigned get_size() const; //1pts void set_name(const std::string& new_name); //1pts void set_extension(const std::string& new_extension); //1pts void set_size(const unsigned new_size); //1pts virtual MultimediaFile* clone() const = 0; virtual void play() const; //5pts virtual ~MultimediaFile() = default; //5pts private: std::string name; std::string extension; unsigned size; }; #endif //CODE_MULTIMEDIAFILE_HPP
[ "lyubo.karev@gmail.com" ]
lyubo.karev@gmail.com
a624e116b58edf04976c18f7a91a67450d4f2fda
481cba865f0fed25c929c0c874f8ef8b58d3d06f
/src/gui/collabwebgraph.cpp
a03a656c68537242ec8f5d90cb71fc069de2b566
[ "MIT", "BSD-3-Clause" ]
permissive
lssjByron/teamsirus
d4f3af6ae75aacff9675afb3a200a9198ebef672
21f5f26f410eb0262754006d7c4a024c160e6401
refs/heads/master
2020-03-22T22:38:14.548601
2018-07-12T20:38:16
2018-07-12T20:38:16
140,762,337
0
0
null
null
null
null
UTF-8
C++
false
false
21,347
cpp
#include "collabwebgraph.h" #include "ui_collabwebgraph.h" #include "math.h" #include <iterator> #include <QList> #include <QPair> #include <QDebug> #include <QFileInfo> #include "mainwindow.h" #include <QGraphicsDropShadowEffect> #include <QPointF> #include <QObject> #include <qobjectdefs.h> #include <QStyle> #include <QDesktopWidget> #include <QSize> #include <QRect> #include <qsize.h> CollabWebGraph::CollabWebGraph(QWidget *parent) : QDialog(parent), ui(new Ui::CollabWebGraph) { ui->setupUi(this); QGraphicsDropShadowEffect* shadowEffect = new QGraphicsDropShadowEffect(); shadowEffect->setBlurRadius( 5 ); shadowEffect->setOffset(0.0); shadowEffect->setBlurRadius(25.0); ui->frame->setGraphicsEffect(shadowEffect); //this->setWindowFlags(Qt::Window | Qt:: FramelessWindowHint); //this->showMaximized(); QSize availableSize = qApp->desktop()->availableGeometry().size(); int width = availableSize.width(); int height = availableSize.height(); //width = width*.8; //height = height*.8; QSize newSize(width,height); this->setGeometry( QStyle::alignedRect( Qt::LeftToRight, Qt::AlignCenter, newSize, qApp->desktop()->availableGeometry() ) ); // qSize newSize(parentWidget()->width(),parentWidget()->height(); //this->setGeometry(QStyle::alignedRect(Qt::LeftToRight,Qt::AlignCenter, newSize,qApp->desktop()->availableGeometry())); } void CollabWebGraph::init(QList<CollabWebGraph::CollabData> allCollabData, QString pathName) { allCollaborationData = allCollabData; publicationPathName=pathName; // (1): CREATE OUR nodeReferences (a "reference sheet" of unique author names and their corresponding node number) int count=1; QList<QString> init; foreach (CollabWebGraph::CollabData collabDataItem, allCollabData) { nodeReferences.append(qMakePair(collabDataItem.authName,count)); count++; } // (1.1): //CREATE n NODES (n = allCollabData.length (ie. the number of authors that collaborated)) count = 0; QList<int> collaborationTotals; //for tallying up total number of collaborations done by each author foreach (CollabWebGraph::CollabData item, allCollabData) { QPushButton *btn = new QPushButton(QString::number(count+1), ui->widget); //Create a node for each CollabData item ie. each author (which is technically a button (that can be pressed by user to highlight node's connecting lines)) if (allCollabData.size()<20) { //SET STYLE OF NODES btn->setMinimumHeight(NODE_SIZE); btn->setMaximumHeight(NODE_SIZE); btn->setMinimumWidth(NODE_SIZE); btn->setMaximumWidth(NODE_SIZE); //btn->setFlat(true); btn->setCursor(Qt::PointingHandCursor); //btn->setFont(); btn->setStyleSheet("font-size: 24pt"); QGraphicsDropShadowEffect* shadowEffect = new QGraphicsDropShadowEffect(); //Add shadow to button shadowEffect->setBlurRadius( 5 ); shadowEffect->setOffset(0.0); shadowEffect->setBlurRadius(35.0); btn->setGraphicsEffect(shadowEffect); //Get author's name to place in ToolTip label that displays when user hovers cursor over node QString memberName = nodeReferences[count].first; btn->setToolTip(memberName); btn->setToolTipDuration(0); //END OF NODE STYLING mNodes.append(btn); count++; } else if (allCollabData.size()>=20 && allCollabData.size()<40) { //SET STYLE OF NODES btn->setMinimumHeight(NODE_SIZE/2); btn->setMaximumHeight(NODE_SIZE/2); btn->setMinimumWidth(NODE_SIZE/2); btn->setMaximumWidth(NODE_SIZE/2); //btn->setFlat(true); btn->setCursor(Qt::PointingHandCursor); //btn->setFont(); btn->setStyleSheet("font-size: 12pt"); QGraphicsDropShadowEffect* shadowEffect = new QGraphicsDropShadowEffect(); //Add shadow to button shadowEffect->setBlurRadius( 5 ); shadowEffect->setOffset(0.0); shadowEffect->setBlurRadius(35.0); btn->setGraphicsEffect(shadowEffect); //Get author's name to place in ToolTip label that displays when user hovers cursor over node QString memberName = nodeReferences[count].first; btn->setToolTip(memberName); btn->setToolTipDuration(0); //END OF NODE STYLING mNodes.append(btn); count++; } else if (allCollabData.size()>=40 && allCollabData.size()<80) { //SET STYLE OF NODES btn->setMinimumHeight(NODE_SIZE/4); btn->setMaximumHeight(NODE_SIZE/4); btn->setMinimumWidth(NODE_SIZE/4); btn->setMaximumWidth(NODE_SIZE/4); //btn->setFlat(true); btn->setCursor(Qt::PointingHandCursor); //btn->setFont(); btn->setStyleSheet("font-size: 6pt"); QGraphicsDropShadowEffect* shadowEffect = new QGraphicsDropShadowEffect(); //Add shadow to button shadowEffect->setBlurRadius( 5 ); shadowEffect->setOffset(0.0); shadowEffect->setBlurRadius(35.0); btn->setGraphicsEffect(shadowEffect); //Get author's name to place in ToolTip label that displays when user hovers cursor over node QString memberName = nodeReferences[count].first; btn->setToolTip(memberName); btn->setToolTipDuration(0); //END OF NODE STYLING mNodes.append(btn); count++; } else if (allCollabData.size()>=80 && allCollabData.size()<=160) { //SET STYLE OF NODES btn->setMinimumHeight(NODE_SIZE/8); btn->setMaximumHeight(NODE_SIZE/8); btn->setMinimumWidth(NODE_SIZE/8); btn->setMaximumWidth(NODE_SIZE/8); //btn->setFlat(true); btn->setCursor(Qt::PointingHandCursor); //btn->setFont(); btn->setStyleSheet("font-size: 3pt"); //Stylesheet styles QGraphicsDropShadowEffect* shadowEffect = new QGraphicsDropShadowEffect(); //Add shadow to button shadowEffect->setBlurRadius( 5 ); shadowEffect->setOffset(0.0); shadowEffect->setBlurRadius(35.0); btn->setGraphicsEffect(shadowEffect); //Get author's name to place in ToolTip label that displays when user hovers cursor over node QString memberName = nodeReferences[count].first; btn->setToolTip(memberName); btn->setToolTipDuration(0); //END OF NODE STYLING mNodes.append(btn); count++; } else if (allCollabData.size()>160) { ui->label_WG_title->setText("The number of collaborations found in this file has exceeded NVIZION's ability to fit all collaboration data on this screen. Unfortunately, NVIZION is unable to display this collaboration web graph for you :("); } collaborationTotals.append(item.datails.size()); } //CONNECT GENERATED NODE BUTTONS TO THE NODEPRESSED SLOT //CALL CONNECT FUNCTION INSIDE A FOREACH LOOP TO CONNECT ALL GENERATED BUTTONS foreach(QPushButton* btn, mNodes) { connect(btn,SIGNAL(clicked(bool)),this,SLOT(nodePressed())); } //CREATE EDGES (connecting lines between nodes that represent a collaboration between 2 authors) // ALGORITHM B.3.a // (2): BUILD A UNIQUE LIST OF AUTHOR NAMES THAT HAVE COLLABORATED WITH authName FOR EACH authName (building the 'authNodeConnections' QList of Qlist QStrings. bool alreadyExists=false; QList<QString> uniqueCollaborators; foreach (CollabWebGraph::CollabData collabDataItem, allCollabData) { uniqueCollaborators.clear(); //Make a temp QList of unique author names that have collab'd with authName to be appended to authNodeConnections. The order of authNodeConnections's QLists is equal to the each author's Node number. QList<QPair<QString,QString>> collabDataList = collabDataItem.datails; //Get the list of all collaborations for 'n' author for (int i=0;i<collabDataList.count();++i) //Now, go through all collaborations and add only unique collaborators to "addedAuthCollaborators". { QString collaborator = collabDataList[i].first; alreadyExists=false; //reset our "does-it-already-exist tracker" foreach(QString addedUniqueCollaborator, uniqueCollaborators) { if(QString::compare(collaborator,addedUniqueCollaborator)==0) //"0" = they're equal, ie. not unqiue, so don't add it to the authNodeConnections QList because that author already exists in the list of unqiue authors. { alreadyExists=true; break; } } if(!alreadyExists) //if it doesn't exist, then it's is a unique author name so add it to the authNodeConnections QList { uniqueCollaborators.append(collaborator); } } authNodeConnections.append(uniqueCollaborators); } /*//CONFIRM RESULTS OF ALGORITHM B.3.a VIA QDEBUG: QList<QString> debugList; for (int j=0;j<authNodeConnections.length();++j) { qDebug() << ""; qDebug() << "M" << j+1 << "node connections:"; debugList = authNodeConnections[j]; for(int i=0;i<debugList.length();++i) { qDebug() << debugList[i]; } } *///END OF RESULT CHECKINGALGORITHM B.3.a // ALGORITHM B.3.b // (3): CHANGE EACH AUTHOR NAME TO ITS CORRESPONDING NODE NUMBER USING nodeReferences (this is done for each unique author name) // for each authNodeConnections item, look up matched name in nodeReference and replace with index number QList<QString> collaborators; QList<int> authNodeConnectionNumbers; for(int i=0;i<authNodeConnections.length();++i) { authNodeConnectionNumbers.clear(); collaborators = authNodeConnections[i]; for(int j=0;j<collaborators.length();++j) { QString collaboratorName = collaborators[j]; for(int k=0;k<nodeReferences.length();++k) { if(QString::compare(collaboratorName,nodeReferences[k].first)==0) //"0" = a match has been found. Replace "collaborator" with k+1 (its corresponding node number) { authNodeConnectionNumbers.append((k+1)); break; } } } authNodeConnectionsNumbers.append(authNodeConnectionNumbers); authNodeConnections[i].clear(); //destroy redundant data from memory } /*//CONFIRM RESULTS OF ALGORITHM B.3.b VIA QDEBUG: QList<int> debugList; for (int j=0;j<authNodeConnectionsNumbers.length();++j) { qDebug() << ""; qDebug() << "(" << j+1 << ")" << "Node connections:"; qDebug() << ""; debugList = authNodeConnectionsNumbers[j]; for(int i=0;i<debugList.length();++i) { qDebug() << debugList[i]; } } *///END OF RESULT CHECKING ALGORITHM B.3.b // ALGORITHM F.2.a (continued in webgraphwidget.cpp) // (4): Building set of relationships between nodes QList<int> collabNodelist; for (int i=0;i<authNodeConnectionsNumbers.length();++i) { collabNodelist = authNodeConnectionsNumbers[i]; for(int j=0;j<collabNodelist.length();++j) { alreadyExists=false; //assume new relationship is not in nRelationships until proven otherwise for(int k=0;k<nRelationships.length();++k) { if((nRelationships[k].first==i+1 && nRelationships[k].second==collabNodelist[j]) || (nRelationships[k].first==collabNodelist[j] && nRelationships[k].second==i+1) || (collabNodelist[j] == i+1)) { alreadyExists=true; break; //this edge has been proven to already exit in nRelationships so do NOT add it } } if(!alreadyExists) //evaluates to TRUE if this edge does not exist in nRelationships; so add it { nRelationships.append(QPair<int,int>(i+1,collabNodelist[j])); } } } //eachNodeRelationships //Alg F.2.b collabNodelist.clear(); QList<QPair<int,int>> eachNode; for (int i=0;i<authNodeConnectionsNumbers.length();++i) { eachNode.clear(); collabNodelist = authNodeConnectionsNumbers[i]; for(int j=0;j<collabNodelist.length();++j) { eachNode.append(QPair<int,int>(i+1,collabNodelist[j])); //qDebug() << i+1 << "," << collabNodelist[j] ; } eachNodeRelationships.append(eachNode); //qDebug() << ""; } /* debugging Alg F.2.b for (int i=0;i<eachNodeRelationships.length();++i) { qDebug() << ""; qDebug() << "Node:" << i; for (int j=0; j<eachNodeRelationships[i].length();++j) { qDebug() << (eachNodeRelationships[i])[j].first << "," << (eachNodeRelationships[i])[j].second; } } /* OLD CODE QList<QList<QPair<int,int>>> nodeRelationships; QList<QPair<int,int>> eachNodeRelationship; QPair<int,int> coordinateData; QList<int> collabNodelist; for (int i=0;i<authNodeConnectionsNumbers.length();++i) { collabNodelist = authNodeConnectionsNumbers[i]; for(int j=0;j<collabNodelist.length();++j) { alreadyExists=false; //assume new relationship is not in nRelationships until proven otherwise for(int k=0;k<nRelationships.length();++k) { if((nRelationships[k].first==i+1 && nRelationships[k].second==collabNodelist[j]) || (nRelationships[k].first==collabNodelist[j] && nRelationships[k].second==i+1) || (collabNodelist[j] == i+1)) { alreadyExists=true; break; //this edge has been proven to already exit in nRelationships so do NOT add it } } if(!alreadyExists) //evaluates to TRUE if this edge does not exist in nRelationships; so add it { nRelationships.append(QPair<int,int>(i+1,collabNodelist[j])); } } } END OF OLD CODE */ /* //CONFIRM RESULTS OF ALGORITHM F.2 VIA QDEBUG: qDebug() << "";qDebug() << "Size of nRelationships:" << nRelationships.size();qDebug() << ""; for (int j=0;j<nRelationships.length();++j) { qDebug() << "(" << nRelationships[j].first << "," << nRelationships[j].second << ")"; } *///END OF RESULT CHECKING ALGORITHM F.2 // CALCULATING TOTAL COLLABORATIONS PARTICIPATED IN FOR EACH AUTHOR // QList<int> collaborationTotals; // for(int i=0;i<authNodeConnectionsNumbers.length();++i) // { // collaborationTotals.append(authNodeConnectionsNumbers[i].count()); // //qDebug() << collaborationTotals[i]; // } //PASS ALL NEEDED DATA TO WEBGRAPHWIDGET ui->widget->setData(mNodes,nRelationships,nodeReferences,allCollaborationData,collaborationTotals,eachNodeRelationships); for (int i=0; i<nodeReferences.length(); i++) { QPair<QString,int> node = nodeReferences[i]; int collCount = collaborationTotals[i]; QString autherName = node.first; int nodeIndex = node.second; ui->table_WebGraph_author->insertRow(ui->table_WebGraph_author->rowCount()); QTableWidgetItem *item1 = new QTableWidgetItem(); item1->setData(Qt::EditRole,nodeIndex); item1->setTextAlignment(Qt::AlignCenter); QTableWidgetItem *item2 = new QTableWidgetItem(autherName); item2->setTextAlignment(Qt::AlignCenter); QTableWidgetItem *item3 = new QTableWidgetItem(); item3->setData(Qt::EditRole,collCount); item3->setTextAlignment(Qt::AlignCenter); ui->table_WebGraph_author->setItem(ui->table_WebGraph_author->rowCount()-1, 0, item1); ui->table_WebGraph_author->setItem(ui->table_WebGraph_author->rowCount()-1, 1, item2); ui->table_WebGraph_author->setItem(ui->table_WebGraph_author->rowCount()-1, 2, item3); } publicationPathName.replace(" > ","/"); QFileInfo publicationFilename(publicationPathName); QString currentlyViewingFileName = publicationFilename.fileName(); currentlyViewingFileName.prepend("Currently Viewing: "); ui->WG_FilePath->setText(currentlyViewingFileName); } CollabWebGraph::~CollabWebGraph() { delete ui; } //CREATE SINGLE SLOT TO HANLDE ALL NODE-BUTTON PRESSES void CollabWebGraph::nodePressed() { ui->WG_Button_Reset->setEnabled(true); QPushButton* nodeBtn = qobject_cast<QPushButton*>(sender()); int nodeNum=-1; if(nodeBtn != NULL) { QString nodeNumber = nodeBtn->text(); nodeNum = nodeNumber.toInt(); //qDebug() << nodeNum; } ui->widget->passNodeClicked(nodeNum); QString authName = nodeReferences[nodeNum-1].first; authName.append(" collaborated with these members on these publications:"); ui->labal_selectedAuthor->setText(authName); ui->label_WG_title->setText((nodeReferences[nodeNum-1].first)); ui->tableWidget->clear(); //make sure only clears data while(ui->tableWidget->rowCount() > 0) { ui->tableWidget->removeRow(0); } CollabData selected = allCollaborationData[nodeNum -1]; QList<QPair<QString, QString> > details = selected.datails; for (int i=0; i<details.length(); i++) { QPair<QString, QString> data = details[i]; QString authName = data.first; QString pubTitle = data.second; ui->tableWidget->insertRow(ui->tableWidget->rowCount()); QTableWidgetItem *item1 = new QTableWidgetItem(authName); QTableWidgetItem *item2 = new QTableWidgetItem(pubTitle); ui->tableWidget->setItem((ui->tableWidget->rowCount()-1),0,item1); ui->tableWidget->setItem((ui->tableWidget->rowCount()-1),1,item2); } } void CollabWebGraph::on_pushButton_5_clicked() { this->close(); } void CollabWebGraph::on_WG_Button_Reset_clicked() { ui->WG_Button_Reset->setEnabled(false); ui->widget->resetClicked(); ui->labal_selectedAuthor->setText("Selected author collaborated with:"); ui->label_WG_title->setText(""); } // PDF Exporting void CollabWebGraph::on_pushButton_2_clicked() { QString fileName = QFileDialog::getSaveFileName(this, tr("Export File"), QDir::homePath(), tr("PDF (*.pdf)")); QPdfWriter writer(fileName); //Setup each PDF page attributes (creator of PDF, pagae orientation) writer.setCreator("NVIZION"); writer.setPageOrientation(QPageLayout::Portrait); //Setup QPainter object that paints the widgets on the pages QPainter painter; painter.begin(&writer); //paint the widgets: //First page has the visualization and title: //painter.scale(8,8); ui->widget->render(&painter); painter.scale(0.83, 0.83); ui->label_WG_title->render(&painter); //Second page has legend (which node represents which author and total collabs for each author writer.newPage(); painter.scale(6, 6); ui->table_WebGraph_author->render(&painter); } void CollabWebGraph::on_table_WebGraph_author_itemClicked(QTableWidgetItem *item) { int index = ui->table_WebGraph_author->currentColumn(); int selectedNodeNumber=-1; if(index==0) { selectedNodeNumber=item->text().toInt(); QPushButton* buttonToPush = mNodes[selectedNodeNumber-1]; buttonToPush->click(); } QString name; if(index==1) { name = item->text(); for(int i=0;i<nodeReferences.length();++i) { if(QString::compare(nodeReferences[i].first,name)==0) { QPushButton* buttonToPush = mNodes[i]; buttonToPush->click(); } } } }
[ "byron@invaware.com" ]
byron@invaware.com
929b82336368473ed024f87f8ad970bd252ee7a3
7670dcac34ec0f528482216292392496c0e2705b
/projects/Resource/code/Shader.h
55c015c79d807d735d40dd3e04640ecf9d1ba460
[ "MIT" ]
permissive
Nechrito/s0009d-lab-env
c5a3ba224b8665d6ce38245819027876510ad61b
61599401536205c344654ef2a270a010df0e2254
refs/heads/master
2023-01-10T00:16:38.692203
2020-11-04T16:47:18
2020-11-04T16:47:18
309,981,183
0
0
null
null
null
null
UTF-8
C++
false
false
1,734
h
// Copyright © 2020 Philip Lindh // All rights reserved #pragma once #include "core/app.h" #include <string> #include <Vector3.h> #include <Matrix4x4.h> #include <unordered_map> struct ShaderSources { std::string VertexSource; std::string FragmentSource; }; class Shader { public: unsigned int Id; Shader() = default; explicit Shader(const char* shaderPath); void Bind() const { glUseProgram(Id); } static void UnBind() { glUseProgram(0); } void SetValue(const std::string& name, const Matrix4x4& mat, const bool transpose = true) { glUniformMatrix4fv(GetLocation(name), 1, transpose, mat.Ptr()); } void SetValue(const std::string& name, const double value) { glUniform1f(GetLocation(name), static_cast<float>(value)); } // Cannot load doubles to shader as it uses float void SetValue(const std::string& name, Vector3 value) { glUniform3fv(GetLocation(name), 1, &value[0]); } void SetValue(const std::string& name, const int value) { glUniform1i(GetLocation(name), value); } void SetValue(const std::string& name, const float value) { glUniform1f(GetLocation(name), value); } void SetValue(const std::string& name, const bool value) { glUniform1i(GetLocation(name), value); } ~Shader() = default; private: std::string path; std::unordered_map<std::string, int> cache; // load ShaderSources Parse(const char* shaderPath) const; void LoadShader(const char* shaderPath); static unsigned int LinkShaders(unsigned int type, const std::string& source); // error void CheckCompileErrors(unsigned int shader, const std::string& alias) const; void CheckLinkErrors() const; // fetch from cache int GetLocation(const std::string& name); };
[ "philip.lindh98@hotmail.com" ]
philip.lindh98@hotmail.com
43006a72f6fc26439daaf67d775b61b77a0d8fa9
e12e16efbe58992d5dfe5e81544ee64c61f1f8e0
/integration_tests/source/3-offsets.cpp
abc311de2054d22794c2b3d1e2e535a48ea44fd6
[]
no_license
tbennun/dawn2dace
1da9c2d4251d8b7d8e6b9225fc059c47bea7080d
a0d427b1d3d741a7a97dbc1cd9088b781a8d0a13
refs/heads/master
2020-05-20T05:58:43.086563
2019-08-21T12:29:10
2019-08-21T12:29:10
185,419,592
0
0
null
2019-05-07T14:33:38
2019-05-07T14:33:38
null
UTF-8
C++
false
false
219
cpp
#include "gridtools/clang_dsl.hpp" using namespace gridtools::clang; stencil test { storage a, b; Do { vertical_region(k_start, k_end) { // copy stencil a = b[i + 1, j - 1] + b[i - 1]; } } };
[ "twicki@ethz.ch" ]
twicki@ethz.ch
4acc274b654fa572c1bf5f8cc7455f981d1313be
7a5dbfc55d2fcd43e90e14ebe3fe3fa4705a162a
/Quasics2021Code/MaeTester2022/src/main/cpp/commands/DelayForTime.cpp
54338737ef2cc61aa1973bf395a56d3d0890a315
[ "BSD-3-Clause" ]
permissive
quasics/quasics-frc-sw-2015
c71194921a3f0930bc16ae96952577ff029f8542
83aa34f475e5060e31ddf12186b48cb68430acc6
refs/heads/master
2023-08-23T07:13:23.194240
2023-08-17T23:19:51
2023-08-17T23:19:51
43,209,473
7
2
null
null
null
null
UTF-8
C++
false
false
610
cpp
// Copyright (c) FIRST and other WPILib contributors. // Open Source Software; you can modify and/or share it under the terms of // the WPILib BSD license file in the root directory of this project. #include "commands/DelayForTime.h" DelayForTime::DelayForTime(units::second_t time) : time(time) { // There are no subsystem dependencies for this command. } // Called when the command is initially scheduled. void DelayForTime::Initialize() { stopWatch.Reset(); stopWatch.Start(); } // Returns true when the command should end. bool DelayForTime::IsFinished() { return stopWatch.HasElapsed(time); }
[ "mjhealy@users.noreply.github.com" ]
mjhealy@users.noreply.github.com
977c10f0652aae0ca576880c8b19bd4d47e866ae
2019d94fe0d8b32959190d02dd1ee367f524878e
/Problem Solving/Algorithms/Implementation/15_cats_and_a_mouse.cpp
05396be65465a936e1495fe4b1cc7a7287cdc847
[]
no_license
yang4978/Hackerrank_for_Cpp
bfd9065bd4924b26b30961d4d734a7bb891fe2e2
4c3dde90bcc72a0a7e14eda545257c128db313f7
refs/heads/master
2020-05-21T06:05:26.451065
2019-08-11T15:19:13
2019-08-11T15:19:13
185,934,553
0
0
null
null
null
null
UTF-8
C++
false
false
1,665
cpp
//https://www.hackerrank.com/challenges/cats-and-a-mouse/problem #include <bits/stdc++.h> using namespace std; vector<string> split_string(string); // Complete the catAndMouse function below. string catAndMouse(int x, int y, int z) { if(abs(x-z)<abs(y-z)){ return "Cat A"; } else if(abs(x-z)>abs(y-z)){ return "Cat B"; } else return "Mouse C"; } int main() { ofstream fout(getenv("OUTPUT_PATH")); int q; cin >> q; cin.ignore(numeric_limits<streamsize>::max(), '\n'); for (int q_itr = 0; q_itr < q; q_itr++) { string xyz_temp; getline(cin, xyz_temp); vector<string> xyz = split_string(xyz_temp); int x = stoi(xyz[0]); int y = stoi(xyz[1]); int z = stoi(xyz[2]); string result = catAndMouse(x, y, z); fout << result << "\n"; } fout.close(); return 0; } vector<string> split_string(string input_string) { string::iterator new_end = unique(input_string.begin(), input_string.end(), [] (const char &x, const char &y) { return x == y and x == ' '; }); input_string.erase(new_end, input_string.end()); while (input_string[input_string.length() - 1] == ' ') { input_string.pop_back(); } vector<string> splits; char delimiter = ' '; size_t i = 0; size_t pos = input_string.find(delimiter); while (pos != string::npos) { splits.push_back(input_string.substr(i, pos - i)); i = pos + 1; pos = input_string.find(delimiter, i); } splits.push_back(input_string.substr(i, min(pos, input_string.length()) - i + 1)); return splits; }
[ "noreply@github.com" ]
yang4978.noreply@github.com
daa9c414b327ebfb3c174b5da12f684e35c25b6b
88a40203ebdbf2810a21688fb84a3f56d2ebb1b3
/cc/library/ray_tracing/occ_grid_builder.cu.cc
7dd9b89d46442ec55346ead9d09cc8ec9dd6d4b4
[]
no_license
aushani/flsf
2ae356338f08f2ba48a499fadb3eb91d6c01f66f
a1782b3accffa4ebb5f231e76a6e1d958d16b714
refs/heads/master
2020-03-28T13:08:19.554199
2018-08-23T21:47:15
2018-08-23T21:47:15
148,369,543
4
1
null
null
null
null
UTF-8
C++
false
false
2,025
cc
// Adapted from dascar #include "library/ray_tracing/occ_grid_builder.h" #include <iostream> #include <boost/assert.hpp> #include <thrust/device_ptr.h> #include "library/ray_tracing/occ_grid_location.h" #include "library/ray_tracing/device_data.cu.h" #include "library/timer/timer.h" namespace tr = library::timer; namespace library { namespace ray_tracing { OccGridBuilder::OccGridBuilder(int max_observations, float resolution, float max_range) : max_observations_(max_observations), resolution_(resolution), device_data_(new DeviceData(resolution, max_range, max_observations)) { } OccGridBuilder::~OccGridBuilder() { } size_t OccGridBuilder::ProcessData(const std::vector<Eigen::Vector3f> &hits) { // First, we need to send the data to the GPU device device_data_->CopyData(hits); // Now run ray tracing on the GPU device device_data_->RunKernel(); return device_data_->ReduceLogOdds(); } OccGrid OccGridBuilder::GenerateOccGrid(const std::vector<Eigen::Vector3f> &hits) { //library::timer::Timer t; BOOST_ASSERT(hits.size() <= max_observations_); // Check for empty data if (hits.size() == 0) { std::vector<Location> location_vector; std::vector<float> lo_vector; return OccGrid(location_vector, lo_vector, resolution_); } size_t num_updates = ProcessData(hits); // Copy result from GPU device to host //t.Start(); std::vector<Location> location_vector(num_updates); std::vector<float> lo_vector(num_updates); cudaMemcpy(location_vector.data(), device_data_->locations_reduced.GetRawPointer(), sizeof(Location) * num_updates, cudaMemcpyDeviceToHost); cudaMemcpy(lo_vector.data(), device_data_->log_odds_updates_reduced.GetRawPointer(), sizeof(float) * num_updates, cudaMemcpyDeviceToHost); cudaError_t err = cudaDeviceSynchronize(); BOOST_ASSERT(err == cudaSuccess); //printf("\tTook %5.3f to copy to host\n", t.GetMs()); return OccGrid(location_vector, lo_vector, resolution_); } } // namespace ray_tracing } // namespace library
[ "aushani@gmail.com" ]
aushani@gmail.com
45884bc75cff91ac81e5d764be1586f2cb10755c
f712ed86ac4967d8906c0c1b1b3bf36e335418e1
/constant/polyMesh/sets/planStlX7
088f55c90e400e1dfed6761ca0218e6d09804265
[]
no_license
OpenFOAMwaterResourcesGroup/sharpCrestedWeir
4950ac375a9f029f9a9c6d5a231313e7f7968f36
a51a751db66b88b5470a7f1b99d551062689b097
refs/heads/master
2021-01-19T12:42:55.143419
2019-04-08T11:20:58
2019-04-08T11:20:58
82,355,241
2
1
null
null
null
null
UTF-8
C++
false
false
3,570
/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 3.0.1 | | \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format binary; class faceSet; location "constant/polyMesh/sets"; object planStlX7; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 325 ( 33792 210946 7170 5124 14351 26640 4112 37907 228373 222229 23573 15381 212001 208930 12331 209967 39986 30770 207925 2104 228416 13377 222277 16456 38986 29770 212046 208977 6225 31826 8281 27745 20582 19562 228459 207980 111 211058 222325 9337 212091 35963 209021 28799 17536 210059 10381 1167 34963 228502 21657 18586 37019 3232 208035 222373 212136 32938 5303 25784 24762 7359 4288 228545 22727 33992 11471 222421 212181 209114 208090 40157 14557 23777 211170 15587 210151 228588 26861 38132 2295 30970 29948 212226 12547 222469 208140 8460 13582 6414 39186 228631 287 16672 212271 32047 20786 222517 19766 208185 27964 1343 228674 210243 36163 35141 28999 209226 3408 211282 4434 17752 9561 212316 10591 222565 208230 18792 5482 21871 228727 37240 25984 33157 7557 212361 34192 208275 24984 22941 222623 210335 11686 14763 228780 23981 15798 2486 209338 8639 212416 208320 211394 31170 27082 6603 38351 463 222681 39386 30170 12762 13787 228833 4587 208365 212471 16888 210427 1531 3584 19970 36363 32269 21005 29199 222739 28179 228886 208410 5661 35363 9766 211498 209450 212526 17968 18998 221752 10809 7744 22085 208455 228939 222797 227921 37462 210519 26199 34392 33372 221792 25184 212581 8818 208500 2677 211576 24185 14969 23165 11901 639 228992 227974 222855 6792 16009 31385 221850 209562 212636 4766 208545 39586 30370 38566 27303 12967 13992 211631 3760 210610 229044 1722 228027 222913 20174 17104 212691 221908 5844 29399 208600 21214 229088 36578 211686 35563 32491 28399 228080 9971 7923 222970 18174 19204 8967 212746 209674 221966 208655 22299 211741 34592 11041 210722 228133 25384 26409 223020 815 37684 2868 212792 33592 24389 6981 208710 15175 222024 23369 4945 211796 12116 14168 228186 3936 39786 30570 31595 16240 13172 209783 1913 208765 207741 222082 38786 27524 211851 228239 210834 6037 20378 29599 8102 9127 17320 35763 208820 36788 19380 28599 222136 228287 10176 211906 21443 207815 32713 18380 209875 991 222181 34792 228330 208875 25584 3056 22513 24563 211956 11256 207870 ) // ************************************************************************* //
[ "noreply@github.com" ]
OpenFOAMwaterResourcesGroup.noreply@github.com
57e0503fd12ac6cf0622c3046d3dddc5f4fd4c16
12eab058faa68f697b96ffb0ccee3b4b30577e05
/mopney.cpp
a14bf7aee400bc03af70126b51c1ce5bc4971cbe
[]
no_license
DDWC1603/lab-exercise-chapter-4-suga935
2bcb9cfe62bc138082975e1854b046ebfde8e80b
89c4b54850132fe20ba90a60e249f170f0706db7
refs/heads/master
2021-05-11T21:55:32.787254
2018-01-15T02:14:11
2018-01-15T02:14:11
117,482,055
0
0
null
null
null
null
UTF-8
C++
false
false
383
cpp
#include <iostream> using namespace std; int main(){ int i,j,rows; cout <<"\n\n display the pattern like right angle triangle using an asterisk:\n"; cout <<"---------------------------------------------------------------------\n"; cout <<"input number of rows:"; cin >>rows; for(i=1;i<=rows;i++) { for(j=1;i<=i;j++) cout << "+"; cout << endl; } }
[ "noreply@github.com" ]
DDWC1603.noreply@github.com
d371c22fa6662d20696cb24410c6349ade0001a8
04df0a0f2837c06d47ca6ced95969c61b4357386
/catkin_ws/src/world_mapper/sketch/libraries/ros_lib/loki_base_node/BusUInt16Set.h
36f854e354955d0d7245f9c5fa264e15827e0f2c
[]
no_license
basharbme/RealityVirtualVirturalizer
82fae9d8dada920ce3cf226b77dd8f0a61f359ac
f783c981554f27beee258d720962a61dd298c3a5
refs/heads/master
2022-09-19T06:30:09.326876
2020-06-01T06:55:11
2020-06-01T06:55:11
null
0
0
null
null
null
null
UTF-8
C++
false
false
4,836
h
#ifndef _ROS_SERVICE_BusUInt16Set_h #define _ROS_SERVICE_BusUInt16Set_h #include <stdint.h> #include <string.h> #include <stdlib.h> #include "ros/msg.h" namespace loki_base_node { static const char BUSUINT16SET[] = "loki_base_node/BusUInt16Set"; class BusUInt16SetRequest : public ros::Msg { public: typedef int16_t _address_type; _address_type address; typedef int8_t _command_type; _command_type command; typedef uint16_t _value_type; _value_type value; typedef int8_t _retries_type; _retries_type retries; typedef int8_t _priority_type; _priority_type priority; BusUInt16SetRequest(): address(0), command(0), value(0), retries(0), priority(0) { } virtual int serialize(unsigned char *outbuffer) const { int offset = 0; union { int16_t real; uint16_t base; } u_address; u_address.real = this->address; *(outbuffer + offset + 0) = (u_address.base >> (8 * 0)) & 0xFF; *(outbuffer + offset + 1) = (u_address.base >> (8 * 1)) & 0xFF; offset += sizeof(this->address); union { int8_t real; uint8_t base; } u_command; u_command.real = this->command; *(outbuffer + offset + 0) = (u_command.base >> (8 * 0)) & 0xFF; offset += sizeof(this->command); *(outbuffer + offset + 0) = (this->value >> (8 * 0)) & 0xFF; *(outbuffer + offset + 1) = (this->value >> (8 * 1)) & 0xFF; offset += sizeof(this->value); union { int8_t real; uint8_t base; } u_retries; u_retries.real = this->retries; *(outbuffer + offset + 0) = (u_retries.base >> (8 * 0)) & 0xFF; offset += sizeof(this->retries); union { int8_t real; uint8_t base; } u_priority; u_priority.real = this->priority; *(outbuffer + offset + 0) = (u_priority.base >> (8 * 0)) & 0xFF; offset += sizeof(this->priority); return offset; } virtual int deserialize(unsigned char *inbuffer) { int offset = 0; union { int16_t real; uint16_t base; } u_address; u_address.base = 0; u_address.base |= ((uint16_t) (*(inbuffer + offset + 0))) << (8 * 0); u_address.base |= ((uint16_t) (*(inbuffer + offset + 1))) << (8 * 1); this->address = u_address.real; offset += sizeof(this->address); union { int8_t real; uint8_t base; } u_command; u_command.base = 0; u_command.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0); this->command = u_command.real; offset += sizeof(this->command); this->value = ((uint16_t) (*(inbuffer + offset))); this->value |= ((uint16_t) (*(inbuffer + offset + 1))) << (8 * 1); offset += sizeof(this->value); union { int8_t real; uint8_t base; } u_retries; u_retries.base = 0; u_retries.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0); this->retries = u_retries.real; offset += sizeof(this->retries); union { int8_t real; uint8_t base; } u_priority; u_priority.base = 0; u_priority.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0); this->priority = u_priority.real; offset += sizeof(this->priority); return offset; } const char * getType(){ return BUSUINT16SET; }; const char * getMD5(){ return "e850399cb2d469aaedcebeeb76987c53"; }; }; class BusUInt16SetResponse : public ros::Msg { public: typedef int8_t _status_type; _status_type status; BusUInt16SetResponse(): status(0) { } virtual int serialize(unsigned char *outbuffer) const { int offset = 0; union { int8_t real; uint8_t base; } u_status; u_status.real = this->status; *(outbuffer + offset + 0) = (u_status.base >> (8 * 0)) & 0xFF; offset += sizeof(this->status); return offset; } virtual int deserialize(unsigned char *inbuffer) { int offset = 0; union { int8_t real; uint8_t base; } u_status; u_status.base = 0; u_status.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0); this->status = u_status.real; offset += sizeof(this->status); return offset; } const char * getType(){ return BUSUINT16SET; }; const char * getMD5(){ return "581cc55c12abfc219e446416014f6d0e"; }; }; class BusUInt16Set { public: typedef BusUInt16SetRequest Request; typedef BusUInt16SetResponse Response; }; } #endif
[ "aytimothy@aytimothy.xyz" ]
aytimothy@aytimothy.xyz
ab19bc012e3e4f6d9c9c9f4b8896ff5b40b49d3e
8dc84558f0058d90dfc4955e905dab1b22d12c08
/ui/aura/mus/client_surface_embedder.cc
74f31fd2e7007276b5d607f89f4ed7934282f3e2
[ "LicenseRef-scancode-unknown-license-reference", "BSD-3-Clause" ]
permissive
meniossin/src
42a95cc6c4a9c71d43d62bc4311224ca1fd61e03
44f73f7e76119e5ab415d4593ac66485e65d700a
refs/heads/master
2022-12-16T20:17:03.747113
2020-09-03T10:43:12
2020-09-03T10:43:12
263,710,168
1
0
BSD-3-Clause
2020-05-13T18:20:09
2020-05-13T18:20:08
null
UTF-8
C++
false
false
4,053
cc
// Copyright 2017 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 "ui/aura/mus/client_surface_embedder.h" #include "ui/aura/window.h" #include "ui/gfx/geometry/dip_util.h" namespace aura { ClientSurfaceEmbedder::ClientSurfaceEmbedder( Window* window, bool inject_gutter, const gfx::Insets& client_area_insets) : window_(window), inject_gutter_(inject_gutter), client_area_insets_(client_area_insets) { surface_layer_ = std::make_unique<ui::Layer>(ui::LAYER_TEXTURED); surface_layer_->SetMasksToBounds(true); // The frame provided by the parent window->layer() needs to show through // the surface layer. surface_layer_->SetFillsBoundsOpaquely(false); window_->layer()->Add(surface_layer_.get()); // Window's layer may contain content from this client (the embedder), e.g. // this is the case with window decorations provided by Window Manager. // This content should appear underneath the content of the embedded client. window_->layer()->StackAtTop(surface_layer_.get()); } ClientSurfaceEmbedder::~ClientSurfaceEmbedder() = default; void ClientSurfaceEmbedder::SetPrimarySurfaceId( const viz::SurfaceId& surface_id) { surface_layer_->SetShowPrimarySurface( surface_id, window_->bounds().size(), SK_ColorWHITE, cc::DeadlinePolicy::UseDefaultDeadline(), false /* stretch_content_to_fill_bounds */); } void ClientSurfaceEmbedder::SetFallbackSurfaceInfo( const viz::SurfaceInfo& surface_info) { fallback_surface_info_ = surface_info; surface_layer_->SetFallbackSurfaceId(surface_info.id()); UpdateSizeAndGutters(); } void ClientSurfaceEmbedder::UpdateSizeAndGutters() { surface_layer_->SetBounds(gfx::Rect(window_->bounds().size())); if (!inject_gutter_) return; gfx::Size fallback_surface_size_in_dip; if (fallback_surface_info_.is_valid()) { float fallback_device_scale_factor = fallback_surface_info_.device_scale_factor(); fallback_surface_size_in_dip = gfx::ConvertSizeToDIP( fallback_device_scale_factor, fallback_surface_info_.size_in_pixels()); } gfx::Rect window_bounds(window_->bounds()); if (!window_->transparent() && fallback_surface_size_in_dip.width() < window_bounds.width()) { right_gutter_ = std::make_unique<ui::Layer>(ui::LAYER_SOLID_COLOR); // TODO(fsamuel): Use the embedded client's background color. right_gutter_->SetColor(SK_ColorWHITE); int width = window_bounds.width() - fallback_surface_size_in_dip.width(); // The right gutter also includes the bottom-right corner, if necessary. int height = window_bounds.height() - client_area_insets_.height(); right_gutter_->SetBounds(gfx::Rect( client_area_insets_.left() + fallback_surface_size_in_dip.width(), client_area_insets_.top(), width, height)); window_->layer()->Add(right_gutter_.get()); } else { right_gutter_.reset(); } // Only create a bottom gutter if a fallback surface is available. Otherwise, // the right gutter will fill the whole window until a fallback is available. if (!window_->transparent() && !fallback_surface_size_in_dip.IsEmpty() && fallback_surface_size_in_dip.height() < window_bounds.height()) { bottom_gutter_ = std::make_unique<ui::Layer>(ui::LAYER_SOLID_COLOR); // TODO(fsamuel): Use the embedded client's background color. bottom_gutter_->SetColor(SK_ColorWHITE); int width = fallback_surface_size_in_dip.width(); int height = window_bounds.height() - fallback_surface_size_in_dip.height(); bottom_gutter_->SetBounds( gfx::Rect(0, fallback_surface_size_in_dip.height(), width, height)); window_->layer()->Add(bottom_gutter_.get()); } else { bottom_gutter_.reset(); } window_->layer()->StackAtTop(surface_layer_.get()); } const viz::SurfaceId& ClientSurfaceEmbedder::GetPrimarySurfaceIdForTesting() const { return *surface_layer_->GetPrimarySurfaceId(); } } // namespace aura
[ "arnaud@geometry.ee" ]
arnaud@geometry.ee
6adc2d367850b26fccd6c1e40dffd5edb365a761
55f746a9916cd661176ffff64999c8b02ee6ae89
/pred.h
b44b647e5122e7c1dd66b62a674f6386dc73d2b3
[]
no_license
MyNameIsKodak/kuzyhook
778fa7851ddcba267b2478f051a943307a249e9f
7e1b8d3bbe290d6fe07303d5b204203cf7c28a5a
refs/heads/master
2023-07-07T17:16:15.487295
2021-09-04T17:35:33
2021-09-04T17:35:33
null
0
0
null
null
null
null
UTF-8
C++
false
false
792
h
#pragma once class InputPrediction { public: float m_curtime; float m_frametime; struct PredictionData_t { int m_flUnpredictedFlags; vec3_t m_vecUnpredictedVelocity; vec3_t m_vecUnpredictedOrigin; } PredictionData; struct Variables_t { float m_flFrametime; float m_flCurtime; float m_flVelocityModifier; int m_fTickcount; float m_flForwardMove; float m_flSideMove; vec3_t m_vecVelocity; vec3_t m_vecOrigin; int m_fFlags; } m_stored_variables; struct viewmodel_t { float m_flViewmodelCycle; float m_flViewmodelAnimTime; } StoredViewmodel; public: void update(); void run(); void restore(); }; extern InputPrediction g_inputpred;
[ "somageller06@gmail.com" ]
somageller06@gmail.com
428f1b45860758b9e3d40f433215a77ae1352f06
a3a21d5f295fa71e7b74a23692349fd24b44c064
/worsearchunion.cpp
ceca630c2c943b35d28420b063d91b04c3e4a18c
[]
no_license
QinghangHong1/project02
9d05c0c6a40c748febfc40edc649794fb4f60de4
c397ceb2547fb3a6c1d93bca655d8e4482448353
refs/heads/master
2020-04-10T01:31:56.230740
2018-12-07T02:19:06
2018-12-07T02:19:06
160,718,495
0
0
null
null
null
null
UTF-8
C++
false
false
2,798
cpp
#include <iostream> #include <cstdlib> #include <sys/types.h> #include <dirent.h> #include <errno.h> #include <vector> #include <string> #include <fstream> #include "word.h" #include "wordsearchcount.h" using namespace std; int getdir (string dir, vector<string> &files) { DIR *dp; struct dirent *dirp; if((dp = opendir(dir.c_str())) == NULL) { cout << "Error(" << errno << ") opening " << dir << endl; return errno; } while ((dirp = readdir(dp)) != NULL) { files.push_back(string(dirp->d_name)); } closedir(dp); return 0; } int main(int argc, char* argv[]) { string dir; // vector<string> files = vector<string>(); Word word_array[1000]; int used=0; if (argc < 2){ cout << "No Directory specified; Exiting ..." << endl; return(-1); } dir = string(argv[1]); if (getdir(dir,files)!=0){ cout << "Error opening " << dir << "; Exiting ..." << endl; return(-2); } Word* head=NULL; string slash("/"); for (unsigned int i = 0;i < files.size();i++) { if(files[i][0]=='.')continue; //skip hidden files ifstream fin((string(argv[1])+slash+files[i]).c_str()); //open using absolute path // ...read the file... string word; while(true){ fin>>word; if(fin.eof()) { break;} else { word_insert(head,word,files[i]); } } fin.close(); } Word* temp=head; while(temp){ temp.sort_list(); } while(true){ string word1; string word2; cin.ignore(1000,'\n'); cout<<"Enter word: "; cin>>word1; if(word1=="-1"){ break; } cout<<"Enter word: "; cin<<word2; if(word2=="-1"){ break; } Word* search1=head; while(search1){//search word1 from the word list if(search1->get_word()==word1){ break; } search1=search1->link(); } File* f1=search1->f_head(); File* temp_f1=f1; List union_list(temp_f1); temp_f1=temp_f1->link(); while(temp_f1){//insert the files of word1 into union_file union_list.update_file(temp_f1->get_fname()); temp_f1=temp_f1->link(); } Word* search2=head; while(search2){//search word2 from word list if(search2->get_word()==word2){ break; } search2=search2->link(); } File* f2=search2->f_head(); File* temp_f2=f2; while(temp_f2){//insert the files of word2 into union_file union_list.update_file(temp_f2->get_fname()); temp_f2=temp_f2->link(); } File* union_head=union_list.get_head(); File* union_temp=union_head; while(union_temp){ cout<<union_temp->get_fname()<<endl; union_temp=union_temp->link(); } cin.ignore(1000,'\n'); } return 0; }
[ "noreply@github.com" ]
QinghangHong1.noreply@github.com
4fdcf557e3798448e4e865c750ec24128a224992
9f9ac37f22333569ae3bec78075d0918c3ad2742
/src/protocol/proto-types.cxx
fb85666838857c005630d51a1821e32a721234db
[ "MIT" ]
permissive
credativ/pg_backup_ctl-plus
602bcd0ce2bcce1653dd340e7b134c3b8f92973d
d1655f9791be9227e17b60731829bbd8572e850b
refs/heads/master
2023-03-20T22:15:21.159701
2021-03-16T18:08:53
2021-03-16T18:08:53
348,447,804
0
1
null
null
null
null
UTF-8
C++
false
false
6,709
cxx
#include <sstream> #include <boost/log/trivial.hpp> #include <pgsql-proto.hxx> #include <proto-descr.hxx> #include <server.hxx> using namespace pgbckctl; using namespace pgbckctl::pgprotocol; /* **************************************************************************** * PGProtoResultSet implementation * ***************************************************************************/ PGProtoResultSet::PGProtoResultSet() {} PGProtoResultSet::~PGProtoResultSet() {} int PGProtoResultSet::calculateRowDescrSize() { return MESSAGE_HDR_LENGTH_SIZE + sizeof(short) + row_descr_size; } int PGProtoResultSet::descriptor(ProtocolBuffer &buffer) { /* reset rows iterator to start offset */ row_iterator = data_descr.row_values.begin(); return prepareSend(buffer, PGPROTO_ROW_DESCR_MESSAGE); } int PGProtoResultSet::data(ProtocolBuffer &buffer) { /* * NOTE: calling descriptor() before data() should have * positioned the internal iterator to the first data row. */ return prepareSend(buffer, PGPROTO_DATA_DESCR_MESSAGE); } int PGProtoResultSet::prepareSend(ProtocolBuffer &buffer, int type) { int message_size = 0; switch(type) { case PGPROTO_DATA_DESCR_MESSAGE: { /* * Check if we are positioned on the last element. * If true, message_size will return 0, indicating the end of * data row messages. */ if (row_iterator == data_descr.row_values.end()) { BOOST_LOG_TRIVIAL(debug) << "result set iterator reached end of data rows"; break; } message_size = MESSAGE_HDR_SIZE + sizeof(short) + row_iterator->row_size; buffer.allocate(message_size); BOOST_LOG_TRIVIAL(debug) << "PG PROTO write data row size " << message_size << ", buffer size " << buffer.getSize(); /* * Prepare message header. */ buffer.write_byte(DescribeMessage); buffer.write_int(message_size - MESSAGE_HDR_BYTE); /* Number of columns */ buffer.write_short(row_iterator->fieldCount()); BOOST_LOG_TRIVIAL(debug) << "PG PROTO data row message has " << row_iterator->values.size() << " columns"; /* * NOTE: on the very first call to data(), we will * find the iterator positioned on the very first * data row, if descriptor() was called before. * * Just advance the iterator unless we have seen * the last data row. */ /* Loop through the column values list */ for (auto &colval : row_iterator->values) { BOOST_LOG_TRIVIAL(debug) << "PG PROTO write col data len " << colval.length << " bytes"; buffer.write_int(colval.length); buffer.write_buffer(colval.data.c_str(), colval.length); } /* * Position the data row iterator on the next data row. */ row_iterator++; break; } case PGPROTO_ROW_DESCR_MESSAGE: { message_size = calculateRowDescrSize(); buffer.allocate(message_size + MESSAGE_HDR_BYTE); BOOST_LOG_TRIVIAL(debug) << "PG PROTO buffer allocated " << buffer.getSize() << " bytes"; /* * Prepare the message header. */ buffer.write_byte(RowDescriptionMessage); buffer.write_int(message_size); buffer.write_short(row_descr.fieldCount()); BOOST_LOG_TRIVIAL(debug) << "PG PROTO row descriptor has " << row_descr.count << " fields"; /* The header is prepared now, write the message contents */ for (auto &it : row_descr.column_list) { buffer.write_buffer(it.name.c_str(), it.name.length()); buffer.write_byte('\0'); buffer.write_int(it.tableoid); buffer.write_short(it.attnum); buffer.write_int(it.typeoid); buffer.write_short(it.typelen); buffer.write_int(it.typemod); buffer.write_short(it.format); } BOOST_LOG_TRIVIAL(debug) << "PG PROTO row descriptor buffer pos " << buffer.pos(); break; } } return message_size; } void PGProtoResultSet::clear() { row_descr_size = 0; data_descr.row_values.clear(); row_descr.column_list.clear(); row_descr.count = 0; } void PGProtoResultSet::addColumn(std::string colname, int tableoid, short attnum, int typeoid, short typelen, int typemod, short format) { PGProtoColumnDescr coldef; coldef.name = colname; coldef.tableoid = tableoid; coldef.attnum = attnum; coldef.typeoid = typeoid; coldef.typemod = typemod; coldef.format = format; row_descr_size += coldef.name.length() + 1; /* NULL byte */ row_descr_size += sizeof(tableoid); row_descr_size += sizeof(attnum); row_descr_size += sizeof(typeoid); row_descr_size += sizeof(typelen); row_descr_size += sizeof(typemod); row_descr_size += sizeof(format); row_descr.column_list.push_back(coldef); } void PGProtoResultSet::addRow(std::vector<PGProtoColumnDataDescr> column_values) { PGProtoColumns columns; /* * Sanity check, number of column values should be identical to * number of column descriptors. */ if (row_descr.fieldCount() != column_values.size()) { std::ostringstream oss; oss << "number of colums(" << column_values.size() << ") do not match number in row descriptor(" << row_descr.fieldCount() << ")"; throw TCPServerFailure(oss.str()); } /* * Push column values to internal rows list * and calculate new total row size. */ for (auto &col : column_values) { columns.values.push_back(col); /* The row size includes bytes of the column value _and_ * the 4 byte length value! */ columns.row_size += (sizeof(col.length) + col.length); } /* increase row counter */ row_descr.count++; /* save columns to internal list */ data_descr.row_values.push_back(columns); } unsigned int PGProtoResultSet::rowCount() { return row_descr.count; } /* **************************************************************************** * PGProtoCmdDescr implementation * ***************************************************************************/ void PGProtoCmdDescr::setCommandTag(ProtocolCommandTag const& tag) { this->tag = tag; }
[ "bernd.helmle@credativ.de" ]
bernd.helmle@credativ.de
89702d6f979a0ffd634d0c5ddd8ab1b370479460
5b12e6a9bb6000fe14f758374e83269caf7c9c80
/BamIterator.hpp
77b3538611a43b28bcb19d4f7e468054ac6f0f49
[]
no_license
escherba/asw-utils
467a2dde329986ae02de50aa919ad5d5a5e3e7d5
27556de62e7228796bf2e105601287792cfb5cf4
refs/heads/master
2021-01-22T13:17:19.268682
2013-07-06T22:12:01
2013-07-06T22:12:01
null
0
0
null
null
null
null
UTF-8
C++
false
false
6,469
hpp
/* * ===================================================================================== * * Filename: BamIterator.hpp * * Description: A wrapper around BAM reading functions provided in samtools * * Version: 1.0 * Created: 04/08/2011 15:03:18 * Revision: none * Compiler: gcc * * Author: Eugene Scherba (es), escherba@bu.edu * Company: Boston University * * Copyright (c) 2011 Eugene Scherba * * 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. * ===================================================================================== */ class BamIterator; /* * ===================================================================================== * Class: BamHeader * Description: A wrapper around Samtools bam_header_t type * ===================================================================================== */ class BamHeader { private: bam_header_t *header; // disallow copying and asignment by declaring the copy constructor and the // assignment operator private BamHeader(const BamHeader&); BamHeader& operator=(const BamHeader&); public: /* *-------------------------------------------------------------------------------------- * Class: BamHeader * Method: BamHeader :: BamHeader * Description: Default constructor *-------------------------------------------------------------------------------------- */ BamHeader(bamFile fp) : header(bam_header_read(fp)) {} BamHeader() : header(NULL) {} /* *-------------------------------------------------------------------------------------- * Class: BamHeader * Method: BamHeader :: ~BamHeader * Description: Default destructor *-------------------------------------------------------------------------------------- */ ~BamHeader() { if (header) bam_header_destroy(header); } bam_header_t* operator->() { return header; } bam_header_t& operator*() { return *header; } friend class BamIterator; }; class BamIterator : public std::iterator<std::input_iterator_tag, bam1_t> { public: // Copy Constuctor BamIterator(const BamIterator& r) : _is_owner(false), _is_fp_owner(false), _row_number(r._row_number), _fp(r._fp), _bam(r._bam), _read_return(r._read_return) {} BamIterator() : _is_owner(false), _is_fp_owner(false), _row_number(0u), _fp(NULL), _bam(NULL), _read_return(0) {} BamIterator(char *path, BamHeader& bh) : _is_owner(true), _is_fp_owner(true), _row_number(1u), _fp(bam_open(path, "r")), _bam(bam_init1()), _read_return(0) { if (_fp == NULL) { bam_destroy1(_bam); exit(EXIT_FAILURE); } bh.header = bam_header_read(_fp); _read_return = bam_read1(_fp, _bam); if (_read_return <= 0) { _row_number = 0u; } } BamIterator(bamFile fp) : _is_owner(true), _is_fp_owner(false), _row_number(1u), _fp(fp), _bam(bam_init1()), _read_return(bam_read1(fp, _bam)) { if (_read_return <= 0) { _row_number = 0u; } } ~BamIterator() { if (_is_fp_owner) bam_close(_fp); if (_is_owner) bam_destroy1(_bam); } // -------------------------------- BamIterator& operator=(const BamIterator& r) { // Treating self-asignment (this == &r) the same as assignment _is_owner = false; _is_fp_owner = r._is_fp_owner; _row_number = r._row_number; _fp = r._fp; _bam = r._bam; _read_return = r._read_return; return *this; } BamIterator& operator++() { // pre-increment _read_return = bam_read1(_fp, _bam); if (_read_return > 0) { ++_row_number; } else { std::cerr << _row_number << " rows read" << std::endl; _row_number = 0u; } return *this; } BamIterator operator++(int) { // post-increment BamIterator tmp(*this); operator++(); return tmp; } bool operator==(const BamIterator& r) { return _row_number == r._row_number; } bool operator!=(const BamIterator& r) { return _row_number != r._row_number; } bam1_t* operator->() { return _bam; } bam1_t& operator*() { return *_bam; } protected: bool _is_owner; // whether to call bam_destroy1 upon object destruction bool _is_fp_owner; unsigned int _row_number; bamFile _fp; bam1_t* _bam; int _read_return; };
[ "escherba@gmail.com" ]
escherba@gmail.com
b389e9eaa06f5242f48810cf5a68038ed4b739c9
b439b8840237b26e42445e18a745318b4d794e27
/DCFoundation/DCFoundation/Source/Base/DCFMutableData.h
c8952bb120c65c714598c10faecddf8093ec25ca
[]
no_license
Design-Complex/DCFoundation
dbf41154b98c80abc80b85262cd824a494664514
75aebbf2bf0cfa9e536fbcce898d4cba5b8c5fe7
refs/heads/master
2021-01-20T23:37:39.030177
2015-06-24T19:41:21
2015-06-24T19:41:21
32,950,964
0
0
null
null
null
null
UTF-8
C++
false
false
382
h
// // DCFMutableData.h // DCFoundation // // Created by Rob Dotson on 6/24/15. // Copyright (c) 2015 Design Complex LLC. All rights reserved. // #ifndef _DCFMutableData_ #define _DCFMutableData_ #include <DCFoundation/DCFData.h> DCF_NAMESPACE_BEGIN class DCF_VISIBLE MutableData : public virtual DCFData { }; // DCF::Data DCF_NAMESPACE_END #endif // _DCFMutableData_
[ "rob@robdotson.info" ]
rob@robdotson.info
c0ecd8088fb93609d3ce50eb565ab3b4ad664dc3
a40e65eb1f6f494b3db0266ec1f7ed7f583927ab
/question42.cpp
6524719bcff052359bd4e354f9067dbe5e49b868
[]
no_license
Txiaobin/coding-interviews
d9dda4aca2376dc546c8370215735bb76d074158
bb7862c481e415cc76b716f369f2b9de5ecf9496
refs/heads/master
2020-06-16T18:30:40.379944
2019-08-28T01:49:08
2019-08-28T01:49:08
195,665,059
0
0
null
null
null
null
UTF-8
C++
false
false
788
cpp
/* 输入一个整型数组,数组中有正数也有负数。数组中的一个或者连续多个整数组成一个子数组,求所有子数组的和的最大值。要求时间复杂度为 O(n)。 例如:{6,-3,-2,7,-15,1,2,2},连续子向量的最大和为8(从第0个开始,到第3个为止)。 xiaobin9652@163.com; Xiaobin Tian; */ #include<vector> using namespace::std; class Solution { public: int FindGreatestSumOfSubArray(vector<int> array) { if(array.size() == 0) return 0; vector<int> sum; int max = array[0]; for(int i = 0; i < array.size(); ++i){ int temp; if(i == 0 || sum[i-1] < 0) temp = array[i]; if(i != 0 && sum[i-1]>0) temp = sum[i-1] + array[i]; sum.push_back(temp); if(temp > max) max = temp; } return max; } };
[ "xiaobin9652@163.com" ]
xiaobin9652@163.com
a41a531677a63c397a486711336a21b544fa4dac
89a30d3f12799c05430a081e1d89d453e5481557
/ex04/main.cpp
d068fb2bac22dff80a83d1c72db9febca3a7dca6
[]
no_license
sasakiyudai/cpp03
3cb1840e630a399baee741c37bd7ee6a8feb416b
a944dc8ad9066e1fdb7deb49be64aea9ca648c2b
refs/heads/master
2023-04-24T17:35:51.622589
2021-05-05T08:54:59
2021-05-05T08:54:59
355,207,763
0
0
null
null
null
null
UTF-8
C++
false
false
1,600
cpp
#include "FragTrap.hpp" #include "ScavTrap.hpp" #include "ClapTrap.hpp" #include "NinjaTrap.hpp" #include "SuperTrap.hpp" int main() { std::srand(time(NULL)); FragTrap hikakin("hikakin"); ScavTrap seikin("seiikin"); ClapTrap youtube("youtube"); NinjaTrap nikoniko("nikoniko"); NinjaTrap nikoniko2("nikoniko2"); SuperTrap superman("superman"); hikakin.rangedAttack("seikin"); seikin.takeDamage(20); seikin.meleeAttack("hikakin"); hikakin.takeDamage(20); nikoniko.meleeAttack("hikakin"); hikakin.takeDamage(20); hikakin.meleeAttack("seikin"); seikin.takeDamage(30); seikin.rangedAttack("hikakin"); hikakin.takeDamage(15); nikoniko.rangedAttack("seikin"); seikin.takeDamage(20); hikakin.meleeAttack("seikin"); seikin.takeDamage(30); seikin.rangedAttack("nikoniko"); nikoniko.takeDamage(15); nikoniko.rangedAttack("seikin"); seikin.takeDamage(20); hikakin.beRepaired(30); seikin.beRepaired(40); nikoniko.beRepaired(40); hikakin.vaulthunter_dot_exe("seikin"); seikin.challengeNewcomer(); nikoniko.ninjaShoebox(hikakin); hikakin.vaulthunter_dot_exe("seikin"); seikin.challengeNewcomer(); nikoniko.ninjaShoebox(seikin); hikakin.vaulthunter_dot_exe("seikin"); seikin.challengeNewcomer(); nikoniko.ninjaShoebox(youtube); nikoniko.ninjaShoebox(nikoniko2); superman.meleeAttack("hikakin"); superman.rangedAttack("seikin"); superman.vaulthunter_dot_exe("nikoniko"); superman.vaulthunter_dot_exe("nikoniko2"); superman.ninjaShoebox(hikakin); superman.ninjaShoebox(seikin); superman.ninjaShoebox(youtube); superman.ninjaShoebox(nikoniko2); return (0); }
[ "you@example.com" ]
you@example.com
f0087c27c6ff243fa497d195013d7c4fbe3ee195
5929805c1d19ab909974e349f9d5c443584a3bc3
/Algorithms/Randomised Algorithms/Generate numbers from 1 to 7 with equal probability.cpp
d82ef51802a825580160c60208323eb97d53345e
[]
no_license
shrish-ti/DSA-practice
ac3769d049822386f1d3cac3a20f538a07a6f20b
37a90d1092e76bd3533c540cc1c2eff957ee957a
refs/heads/master
2023-01-01T21:55:19.457085
2020-10-27T08:24:46
2020-10-27T08:24:46
291,715,728
0
0
null
null
null
null
UTF-8
C++
false
false
150
cpp
#include <bits/stdc++.h> using namespace std; int probab1to7() { int val=5*(foo()-1)+foo; if(val<22) { return val%7+1; } else return probab1to7(); }
[ "noreply@github.com" ]
shrish-ti.noreply@github.com
b4aa82a4d96b1eb00cf23e073069108ef5a038e3
2b434fd4c0efa344cbce249f0ee0efde99c26cec
/fancyHeart/fancyHeart/Classes/xls/XGate.h
b716791f845f6889bbeed9cc1dfe52c55a72741e
[ "MIT" ]
permissive
PenpenLi/cocos2d-x-3.6
03f20c247ba0ee707c9141531f73ab7c581fe6c1
fd6de11fde929718ddb8f22841d813133d96029e
refs/heads/master
2021-05-31T12:01:55.879080
2016-04-12T06:39:13
2016-04-12T06:39:13
null
0
0
null
null
null
null
UTF-8
C++
false
false
634
h
//XGate自动生成类 #ifndef __fancyHeart__XGate__ #define __fancyHeart__XGate__ #include <iostream> #include "external/json/document.h" #include "cocos2d.h" #include "extensions/cocos-ext.h" USING_NS_CC; class XGate{ private: Value v; public: static XGate* record(Value v); rapidjson::Document doc; int getId(); std::string getName(); std::string getDesc(); std::string getDesc2(); /*Administrator: 1剧情 2精英 3活动 0秘境*/ int getType(); int getAvatorId(); int getMapId(); /*Administrator: 若关卡b是从关卡a进入的则关卡b的父id为关卡a*/ int getParentId(); }; #endif // defined(__dx__Data__)
[ "fzcheng813@gmail.com" ]
fzcheng813@gmail.com
67a59a9620eb8ef0b4e25f3b9ffd347dcd110215
49f88ff91aa582e1a9d5ae5a7014f5c07eab7503
/gen/net/net_jni_headers/net/jni/X509Util_jni.h
e20565583b74720b0476f48d208a5815e79d43b7
[]
no_license
AoEiuV020/kiwibrowser-arm64
b6c719b5f35d65906ae08503ec32f6775c9bb048
ae7383776e0978b945e85e54242b4e3f7b930284
refs/heads/main
2023-06-01T21:09:33.928929
2021-06-22T15:56:53
2021-06-22T15:56:53
379,186,747
0
1
null
null
null
null
UTF-8
C++
false
false
1,606
h
// Copyright 2014 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. // This file is autogenerated by // base/android/jni_generator/jni_generator.py // For // org/chromium/net/X509Util #ifndef org_chromium_net_X509Util_JNI #define org_chromium_net_X509Util_JNI #include <jni.h> #include "../../../../../../../base/android/jni_generator/jni_generator_helper.h" // Step 1: Forward declarations. JNI_REGISTRATION_EXPORT extern const char kClassPath_org_chromium_net_X509Util[]; const char kClassPath_org_chromium_net_X509Util[] = "org/chromium/net/X509Util"; // Leaking this jclass as we cannot use LazyInstance from some threads. JNI_REGISTRATION_EXPORT base::subtle::AtomicWord g_org_chromium_net_X509Util_clazz = 0; #ifndef org_chromium_net_X509Util_clazz_defined #define org_chromium_net_X509Util_clazz_defined inline jclass org_chromium_net_X509Util_clazz(JNIEnv* env) { return base::android::LazyGetClass(env, kClassPath_org_chromium_net_X509Util, &g_org_chromium_net_X509Util_clazz); } #endif // Step 2: Constants (optional). // Step 3: Method stubs. namespace net { static void JNI_X509Util_NotifyKeyChainChanged(JNIEnv* env, const base::android::JavaParamRef<jclass>& jcaller); JNI_GENERATOR_EXPORT void Java_org_chromium_net_X509Util_nativeNotifyKeyChainChanged( JNIEnv* env, jclass jcaller) { return JNI_X509Util_NotifyKeyChainChanged(env, base::android::JavaParamRef<jclass>(env, jcaller)); } } // namespace net #endif // org_chromium_net_X509Util_JNI
[ "aoeiuv020@gmail.com" ]
aoeiuv020@gmail.com
53e4e397c8e1eeef63447fad3447cea8ede8c35c
54046ec2ff1717d752798ed47bf5dfde6f52713d
/grades.cpp
20123c91005cbaa8fa24927a828ef469dd36071d
[]
no_license
Surbhi050192/Detect-and-Remove-Collision-in-Hash-Table-using-LinkedList
aad23d4ac8be3005dbcd4a805a98aee37316e758
da8a585e01d3b9f341c697ee833fb430e323c659
refs/heads/master
2021-01-23T05:24:17.529340
2018-01-31T21:57:31
2018-01-31T21:57:31
86,302,608
0
0
null
null
null
null
UTF-8
C++
false
false
4,224
cpp
// Name: Surbhi Goel // Loginid: surbhigo // CSCI 455 PA5 // Fall 2016 /* * grades.cpp * A program to test the Table class. * How to run it: * grades [hashSize] * * the optional argument hashSize is the size of hash table to use. * if it's not given, the program uses default size (Table::HASH_SIZE) * */ #include "Table.h" #include<string> // cstdlib needed for call to atoi #include <cstdlib> #include <locale> // std::locale, std::tolower int spaceCommand (string inputCommand) { int i; int spaceCount=0; for(i=0;i<inputCommand.size();i++) { if(inputCommand[i]==' ') { spaceCount++; } } return spaceCount; } void help() { cout<<"'insert name score' -> Insert this name and score in the grade table."<<endl; cout<<"'change name newscore' -> Change the score for name"<<endl; cout<<"'lookup name' -> Print out his or her score"<<endl; cout<<"'remove name' -> Remove this student"<<endl; cout<<"'print' -> Print all the entries"<<endl; cout<<"'size' -> Prints out the number of entries"<<endl; cout<<"'stats' -> Prints out statistics about the hash table at this point"<<endl; cout<<"'help' -> Prints out a brief command summary"<<endl; cout<<"'quit' -> Exits the program"<<endl; } int performCommands(Table* &mygrades,string command,string name,int score) {//object pointer passed by reference if(command=="insert") { mygrades->insert(name,score); } else if(command=="change") { mygrades->change(name,score); } else if(command=="lookup") { mygrades->lookup(name); } else if(command=="remove") { mygrades->remove(name); } else if(command=="print") { mygrades->printAll(); } else if(command=="size") { cout<<mygrades->numEntries()<<endl; } else if(command=="stats") { mygrades->hashStats(cout); } else if(command=="help") { help(); } else if(command=="quit") { return 1; } else { help(); } return 0; } int stringToInt( const char * str ) { int i = 0; while( *str ) { i = i*10 + (*str++ - '0'); } return i; } int main(int argc, char * argv[]) { string inputCommand; string word1,word2; int word3=0; int spaceCount=0; int firstSpace,secondSpace; int exitOrNot; // gets the hash table size from the command line int hashSize = Table::HASH_SIZE; Table * grades; // Table is dynamically allocated below, so we can call // different constructors depending on input from the user. if (argc > 1) { hashSize = atoi(argv[1]); // atoi converts c-string to int if (hashSize < 1) { cout << "Command line argument (hashSize) must be a positive number" << endl; return 1; } grades = new Table(hashSize); } else { // no command line args given -- use default table size grades = new Table(); } while(1) { getline(cin,inputCommand); spaceCount=spaceCommand(inputCommand); if(spaceCount==2)//3 word command { //word1 firstSpace=inputCommand.find(" "); word1=inputCommand.substr(0,firstSpace); //second word2 inputCommand=inputCommand.substr(firstSpace+1); secondSpace=inputCommand.find(" "); word2=inputCommand.substr(0,secondSpace); //word3 inputCommand=inputCommand.substr(secondSpace+1); char *charStr = new char[inputCommand.length() + 1]; strcpy(charStr, inputCommand.c_str()); // do stuff word3 = stringToInt(charStr); delete [] charStr; ////cout<<word3; } if(spaceCount==1)//2 word command { //word1 firstSpace=inputCommand.find(" "); word1=inputCommand.substr(0,firstSpace); //second word2 inputCommand=inputCommand.substr(firstSpace+1); word2=inputCommand; } if(spaceCount==0) { word1=inputCommand; } //tolower std::locale loc; for (string::size_type i=0; i<word1.length(); ++i) word1[i] = std::tolower(word1[i],loc); for (string::size_type i=0; i<word2.length(); ++i) word2[i] = std::tolower(word2[i],loc); exitOrNot=performCommands(grades,word1,word2,word3); if(exitOrNot==1) { break; } } return 0; }
[ "surbhigo@usc.edu" ]
surbhigo@usc.edu
ea87206aaf224dfec59f15917547b6a4611a728e
1ad39267d734f4236fb93d519a856fcdee7f8cc7
/ACE_Event_Handler_Server/Client_Acceptor.h
ce45e274a6e2974b14e6e4393666cef410889e5f
[]
no_license
yoloo/ace_reactor
328db469f321a6590cb28881c46bc60c06cb2ca5
151e706eae41ea4f6be0d6571e485de2b1ba9b46
refs/heads/master
2021-01-23T12:25:50.289879
2015-06-17T00:45:29
2015-06-17T00:45:29
37,563,815
1
1
null
null
null
null
UTF-8
C++
false
false
1,112
h
#ifndef _CLIENT_ACCEPTOR_H_ #define _CLIENT_ACCEPTOR_H_ #include "Client_Service.h" /*ACE headers.*/ #include "ace/Reactor.h" #include "ace/SOCK_Acceptor.h" class ClientAcceptor : public ACE_Event_Handler { public: ClientAcceptor(); explicit ClientAcceptor( const ACE_INET_Addr & addr ); virtual ~ClientAcceptor(); public:/*Interface.*/ /*Complete some initializations of server.*/ int open(); public:/*Tools.*/ /*Set listen address.*/ void set_listen_addr( const ACE_INET_Addr & addr ); /*Get listen address.*/ ACE_INET_Addr get_listen_addr() const; public:/*Override.*/ /*Called by the reactor when an input event happens.*/ virtual int handle_input( ACE_HANDLE handle = ACE_INVALID_HANDLE ); virtual int handle_close( ACE_HANDLE handle, ACE_Reactor_Mask close_mask ); /*Called by the reactor to determine the underlying handle, such as the peer handle.*/ virtual ACE_HANDLE get_handle() const; private:/*Data members.*/ ACE_SOCK_Acceptor m_acceptor;/*Passive connection object.*/ ACE_INET_Addr m_listenAddr;/*Listen address.*/ }; #endif
[ "yoloo0624@gmail.com" ]
yoloo0624@gmail.com
6244451b2be96b658d9c50b571bd3c1b82bbca75
b1aef802c0561f2a730ac3125c55325d9c480e45
/src/ripple/beast/unity/beast_utility_unity.cpp
71de0b8ceffb3add02bc159ef1a49dd99d49c656
[]
no_license
sgy-official/sgy
d3f388cefed7cf20513c14a2a333c839aa0d66c6
8c5c356c81b24180d8763d3bbc0763f1046871ac
refs/heads/master
2021-05-19T07:08:54.121998
2020-03-31T11:08:16
2020-03-31T11:08:16
251,577,856
6
4
null
null
null
null
UTF-8
C++
false
false
141
cpp
#include <ripple/beast/utility/src/beast_Journal.cpp> #include <ripple/beast/utility/src/beast_PropertyStream.cpp>
[ "sgy-official@hotmail.com" ]
sgy-official@hotmail.com
018f5c74a9f51895d68557b5026600d9b25eecee
160506cbb73a6328fdd5d60c02bf0e305b966b08
/gstar/Master/dealCsv.cpp
1e0561afa164b95b5fb3b1b0b03dfc30a0e0e9e4
[]
no_license
paradiser/Gstar
7938b0492f7d42e70408157b25a2dcb56c4782d5
7d341c343191a615984439b6303bfe73ecfbe4df
refs/heads/master
2021-01-18T22:24:07.458062
2016-11-08T02:45:17
2016-11-08T02:45:17
72,499,182
0
0
null
null
null
null
UTF-8
C++
false
false
4,725
cpp
// // Created by wbl on 16-7-29. // #include "dealCsv.h" //const string csvfp = "/home/wbl/Desktop/1.csv"; vector<string> split(string rawString, char spliter) { vector<string> result; string tmp=""; for(int i=0;i<rawString.length();i++) { if(rawString[i]==spliter){ result.push_back(tmp); tmp=""; } else tmp += rawString[i]; } result.push_back(tmp); return result; } string join(vector<string> vec, char joiner) { string result=""; for(auto str:vec) result+=str+joiner; return result.substr(0,result.length()-1); } vector<vector<string>> readCsv(string filePath) // read a csv file, // return vector<vector<string>> contains strings if the file if success; // return vector<vector\+0<string>> contains nothing if failed. { std::vector<vector<string>> context; string line, field; ifstream in(filePath); if(in.is_open()) { while(getline(in, line)) { std::vector<string> rowContext=split(line, ','); context.push_back(rowContext); } in.close(); } else cout<<"open csv error."<<endl; return context; } bool writeCsv(string filePath, vector<vector<string>> content) // save a vector<vector<string>> variable to the filePath(param); // return success?true:false; { vector<vector<string>> old_content = readCsv(filePath); if(content==old_content) return true; ofstream out(filePath); if(out.is_open()) { int i; for(i = 0; i < content.size(); i++) { out << join(content[i], ',')<<'\n'; out.flush(); } out.close(); return true; } cerr<<"failed to write to "<<filePath<<endl; return false; } string getCsvValue(string filePath, int row, int col) // if row and col are valid index // return the string of the coordinate in the csv. { vector<vector<string>> context = readCsv(filePath); if(row<context.size()&&col<context[row].size()) { string result = context[row][col]; return result; } else{ cout<<"get value from "<<filePath<<" failed."; return ""; } } bool setCsvValue(string filePath, int row, int col, string setValue) // if row and col are valid index, // set the string at the coordinate to the setValue. { vector<vector<string>> context = readCsv(filePath); if(row<context.size()&&col<context[row].size()) { context[row][col] = setValue; return writeCsv(filePath, context); } else { cout<<"failed to set value of "<<filePath<<"."<<endl; cout<<"out of index"<<endl; return false; } } bool appendInfoToCsv(string filePath, string info) //add a row(means a record) to the end of the file. { vector<vector<string>> old_content = readCsv(filePath); vector<string> a_server; a_server = split(info, ','); old_content.push_back(a_server); return writeCsv(filePath, old_content); } bool deleteInfoFromCsv(string filePath, string keyword) //delete one row of the file by the kye word "keyword." { vector<vector<string>> old_content, content; //old-content means the content of the file, // delete one record and save the others in content. old_content = readCsv(filePath); for(auto serv:old_content) if(serv[0] != keyword) content.push_back(serv); return writeCsv(filePath, content); } int getIntValue(string filePath, string keyword, int location) { std::stringstream ss; ss << getStringValue(filePath, keyword, location); int result; ss >> result; //string -> int return result; } string getStringValue(string filePath, string keyword, int location) { vector<vector<string>> context = readCsv(filePath); for(int i = 0; i < context.size(); i ++) { if(getCsvValue(filePath, i, 0) == keyword) { return getCsvValue(filePath, i, location); } } return "false"; } bool isRecordExisting(string filePath, string keyword) { vector<vector<string>> context = readCsv(filePath); for(int i = 0; i < context.size(); i ++) { if(context[i][0] == keyword) { return true; } } return false; } //bool initCsv(string filePath) //{ // ofstream out(filePath); // if(out.is_open()) // { // out.close(); // return true; // } // else // return false; //} /*int main() { bool status = deleteInfoFromCsv(csvfp, "a1"); if(status) { vector<vector<string>> context = readCsv(csvfp); for(auto row:context) for(auto field:row) cout<<field<<endl; } return 0; } */
[ "paradiser@ubuntu.ubuntu-domain" ]
paradiser@ubuntu.ubuntu-domain
1faa28603c5cf376387be0e6e091d187f20efa50
06d0a55bfdcdf17a1cc8a914fc19e8a535720cea
/Sorting/selection_sort.cpp
9f4924fbc92832d400a165c308142a95c1b2ff31
[]
no_license
luciandinu93/CPPAlgorithms
8922492b1071e5861641ba54edd26cf495a63977
0e179e38a9c06a63c52062702a1d89d824a90f5e
refs/heads/master
2020-04-23T11:42:04.986925
2020-04-02T05:47:24
2020-04-02T05:47:24
171,145,229
0
0
null
null
null
null
UTF-8
C++
false
false
457
cpp
#include <iostream> using namespace std; void selection_sort(int *A, int n) { int temp, min = 0; for(int i = 0; i < n-1; i++) { min = i; for(int j = i + 1; j < n; j++) { if(A[min] > A[j]) min = j; } temp = A[i]; A[i] = A[min]; A[min] = temp; } } int main() { int n; cin >> n; int A[n]; for(int i = 0; i < n; i++) { cin >> A[i]; } selection_sort(A, n); for(int i = 0; i < n; i++) { cout << A[i] << " "; } cout << endl; }
[ "lucian.dinu93@yahoo.com" ]
lucian.dinu93@yahoo.com
d8ed28569bbc9fc759876880a0229199fd74ff7c
1c895c003b270c53788d6422a2c71891d3f12d9c
/dacincubator/dacincubator.hpp
87219ef8792da4d2ac87fdbb4a2ed15b2be2a57f
[]
no_license
eostry/kyubey-initial-bancor-offer-contract
203a31a4a953d14322c52aeca3085de9c05086fe
9be7f932f5496c200981c8b08fe9cb6ef7e19cfe
refs/heads/master
2020-03-30T01:27:20.858673
2018-09-27T05:20:47
2018-09-27T05:20:47
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,820
hpp
#include <eosiolib/currency.hpp> #include <eosiolib/asset.hpp> #include <math.h> #include <string> #include "kyubey.hpp" #include "utils.hpp" #define TOKEN_CONTRACT N(eosio.token) using namespace eosio; using namespace std; typedef double real_type; class dacincubator : public kyubey { public: dacincubator(account_name self) : kyubey(self), global(_self, _self), pendingtx(_self, _self) { } // @abi action void init(); // @abi action void clean(); // @abi action void test(); // @abi action void transfer(account_name from, account_name to, asset quantity, string memo); void onTransfer(account_name from, account_name to, asset quantity, string memo); // @abi table global i64 struct global { uint64_t id = 0; uint64_t defer_id = 0; uint64_t primary_key() const { return id; } EOSLIB_SERIALIZE(global, (id)(defer_id)) }; typedef eosio::multi_index<N(global), global> global_index; global_index global; // @abi table pendingtx i64 struct pendingtx { uint64_t id = 0; account_name from; account_name to; asset quantity; string memo; uint64_t primary_key() const { return id; } void release() { } EOSLIB_SERIALIZE(pendingtx, (id)(from)(to)(quantity)(memo)) }; typedef eosio::multi_index<N(pendingtx), pendingtx> pendingtx_index; pendingtx_index pendingtx; // @abi table struct rec { account_name account; asset quantity; }; // @abi action void receipt(const rec& recepit); uint64_t get_next_defer_id() { auto g = global.get(0); global.modify(g, 0, [&](auto &g) { g.defer_id += 1; }); return g.defer_id; } template <typename... Args> void send_defer_action(Args&&... args) { transaction trx; trx.actions.emplace_back(std::forward<Args>(args)...); trx.send(get_next_defer_id(), _self, false); } }; extern "C" { void apply(uint64_t receiver, uint64_t code, uint64_t action) { auto self = receiver; dacincubator thiscontract(self); if ((code == N(eosio.token)) && (action == N(transfer))) { execute_action(&thiscontract, &dacincubator::onTransfer); return; } if (code != receiver) return; switch (action) {EOSIO_API(dacincubator, (transfer)(init)(test))} } }
[ "lychees67@gmail.com" ]
lychees67@gmail.com
50994871acb87e0cb9dcbf9b063267a380f40f82
709ceec684610f302a031806eea86e375031a726
/PUBG_WeaponEquipmentSlotWidget_parameters.hpp
7e9aa3c725ddce5d8b66e21fd6f92f8455b7850e
[]
no_license
denfrost/UE4_SDK_DUMP
867df3a4fdc0a714ca04a52ba0f5d3d6dc7d6e22
05f3d9dd27c9148d3d41162db07d395074467d15
refs/heads/master
2020-03-25T08:02:35.815045
2017-12-28T03:26:29
2017-12-28T03:26:29
null
0
0
null
null
null
null
UTF-8
C++
false
false
26,223
hpp
#pragma once // PLAYERUNKNOWN'S BATTLEGROUNDS (2.4.24) SDK #ifdef _MSC_VER #pragma pack(push, 0x8) #endif #include "../SDK.hpp" namespace Classes { //--------------------------------------------------------------------------- //Parameters //--------------------------------------------------------------------------- // Function WeaponEquipmentSlotWidget.WeaponEquipmentSlotWidget_C.GetSlotItem struct UWeaponEquipmentSlotWidget_C_GetSlotItem_Params { TScriptInterface<class USlotInterface> SlotItem; // (CPF_Parm, CPF_OutParm, CPF_ZeroConstructor, CPF_IsPlainOldData) }; // Function WeaponEquipmentSlotWidget.WeaponEquipmentSlotWidget_C.GetSlotContainer struct UWeaponEquipmentSlotWidget_C_GetSlotContainer_Params { TScriptInterface<class USlotContainerInterface> SlotContainer; // (CPF_Parm, CPF_OutParm, CPF_ZeroConstructor, CPF_IsPlainOldData) }; // Function WeaponEquipmentSlotWidget.WeaponEquipmentSlotWidget_C.SetGamepadSelfPutAttachmentFocus struct UWeaponEquipmentSlotWidget_C_SetGamepadSelfPutAttachmentFocus_Params { bool bFocus; // (CPF_Parm, CPF_ZeroConstructor, CPF_IsPlainOldData) }; // Function WeaponEquipmentSlotWidget.WeaponEquipmentSlotWidget_C.InputB struct UWeaponEquipmentSlotWidget_C_InputB_Params { bool ReturnValue; // (CPF_Parm, CPF_OutParm, CPF_ZeroConstructor, CPF_ReturnParm, CPF_IsPlainOldData) }; // Function WeaponEquipmentSlotWidget.WeaponEquipmentSlotWidget_C.OnChildSlotRefreshFocus struct UWeaponEquipmentSlotWidget_C_OnChildSlotRefreshFocus_Params { }; // Function WeaponEquipmentSlotWidget.WeaponEquipmentSlotWidget_C.GetFocusingChildWidget struct UWeaponEquipmentSlotWidget_C_GetFocusingChildWidget_Params { class UUserWidget* ReturnValue; // (CPF_Parm, CPF_OutParm, CPF_ZeroConstructor, CPF_ReturnParm, CPF_IsPlainOldData) }; // Function WeaponEquipmentSlotWidget.WeaponEquipmentSlotWidget_C.Up struct UWeaponEquipmentSlotWidget_C_Up_Params { bool ReturnValue; // (CPF_Parm, CPF_OutParm, CPF_ZeroConstructor, CPF_ReturnParm, CPF_IsPlainOldData) }; // Function WeaponEquipmentSlotWidget.WeaponEquipmentSlotWidget_C.Right struct UWeaponEquipmentSlotWidget_C_Right_Params { bool ReturnValue; // (CPF_Parm, CPF_OutParm, CPF_ZeroConstructor, CPF_ReturnParm, CPF_IsPlainOldData) }; // Function WeaponEquipmentSlotWidget.WeaponEquipmentSlotWidget_C.Down struct UWeaponEquipmentSlotWidget_C_Down_Params { bool ReturnValue; // (CPF_Parm, CPF_OutParm, CPF_ZeroConstructor, CPF_ReturnParm, CPF_IsPlainOldData) }; // Function WeaponEquipmentSlotWidget.WeaponEquipmentSlotWidget_C.Left struct UWeaponEquipmentSlotWidget_C_Left_Params { bool ReturnValue; // (CPF_Parm, CPF_OutParm, CPF_ZeroConstructor, CPF_ReturnParm, CPF_IsPlainOldData) }; // Function WeaponEquipmentSlotWidget.WeaponEquipmentSlotWidget_C.GetChildRightFocusableWidget struct UWeaponEquipmentSlotWidget_C_GetChildRightFocusableWidget_Params { class UUserWidget* RightWidget; // (CPF_Parm, CPF_OutParm, CPF_ZeroConstructor, CPF_IsPlainOldData) }; // Function WeaponEquipmentSlotWidget.WeaponEquipmentSlotWidget_C.GetChildLeftFocusableWidget struct UWeaponEquipmentSlotWidget_C_GetChildLeftFocusableWidget_Params { class UUserWidget* LeftWidget; // (CPF_Parm, CPF_OutParm, CPF_ZeroConstructor, CPF_IsPlainOldData) }; // Function WeaponEquipmentSlotWidget.WeaponEquipmentSlotWidget_C.GetChildDownFocusableWidget struct UWeaponEquipmentSlotWidget_C_GetChildDownFocusableWidget_Params { class UUserWidget* DownWidget; // (CPF_Parm, CPF_OutParm, CPF_ZeroConstructor, CPF_IsPlainOldData) }; // Function WeaponEquipmentSlotWidget.WeaponEquipmentSlotWidget_C.GetChildUpFocusableWidget struct UWeaponEquipmentSlotWidget_C_GetChildUpFocusableWidget_Params { class UUserWidget* UpWidget; // (CPF_Parm, CPF_OutParm, CPF_ZeroConstructor, CPF_IsPlainOldData) }; // Function WeaponEquipmentSlotWidget.WeaponEquipmentSlotWidget_C.IsFocusable struct UWeaponEquipmentSlotWidget_C_IsFocusable_Params { bool ReturnValue; // (CPF_Parm, CPF_OutParm, CPF_ZeroConstructor, CPF_ReturnParm, CPF_IsPlainOldData) }; // Function WeaponEquipmentSlotWidget.WeaponEquipmentSlotWidget_C.FindFirstFocusableWidget struct UWeaponEquipmentSlotWidget_C_FindFirstFocusableWidget_Params { class UUserWidget* FocusableWidget; // (CPF_Parm, CPF_OutParm, CPF_ZeroConstructor, CPF_IsPlainOldData) }; // Function WeaponEquipmentSlotWidget.WeaponEquipmentSlotWidget_C.IsFocus struct UWeaponEquipmentSlotWidget_C_IsFocus_Params { bool ReturnValue; // (CPF_Parm, CPF_OutParm, CPF_ZeroConstructor, CPF_ReturnParm, CPF_IsPlainOldData) }; // Function WeaponEquipmentSlotWidget.WeaponEquipmentSlotWidget_C.SetFocus struct UWeaponEquipmentSlotWidget_C_SetFocus_Params { bool* NewFocus; // (CPF_Parm, CPF_ZeroConstructor, CPF_IsPlainOldData) bool ReturnValue; // (CPF_Parm, CPF_OutParm, CPF_ZeroConstructor, CPF_ReturnParm, CPF_IsPlainOldData) }; // Function WeaponEquipmentSlotWidget.WeaponEquipmentSlotWidget_C.On_FocusColorBG_Prepass_1 struct UWeaponEquipmentSlotWidget_C_On_FocusColorBG_Prepass_1_Params { class UWidget* BoundWidget; // (CPF_Parm, CPF_ZeroConstructor, CPF_IsPlainOldData) }; // Function WeaponEquipmentSlotWidget.WeaponEquipmentSlotWidget_C.InputA struct UWeaponEquipmentSlotWidget_C_InputA_Params { bool ReturnValue; // (CPF_Parm, CPF_OutParm, CPF_ZeroConstructor, CPF_ReturnParm, CPF_IsPlainOldData) }; // Function WeaponEquipmentSlotWidget.WeaponEquipmentSlotWidget_C.OnSpawnActorInSceneCaptureWorld struct UWeaponEquipmentSlotWidget_C_OnSpawnActorInSceneCaptureWorld_Params { class AActor* SpawnedActor; // (CPF_Parm, CPF_ZeroConstructor, CPF_IsPlainOldData) }; // Function WeaponEquipmentSlotWidget.WeaponEquipmentSlotWidget_C.GetDragDroppingEquipableItem struct UWeaponEquipmentSlotWidget_C_GetDragDroppingEquipableItem_Params { class UEquipableItem* EquipableItem; // (CPF_Parm, CPF_OutParm, CPF_ZeroConstructor, CPF_IsPlainOldData) }; // Function WeaponEquipmentSlotWidget.WeaponEquipmentSlotWidget_C.FindEquipableWeaponPosition struct UWeaponEquipmentSlotWidget_C_FindEquipableWeaponPosition_Params { struct FEquipPosition WeaponPosition; // (CPF_Parm, CPF_OutParm) }; // Function WeaponEquipmentSlotWidget.WeaponEquipmentSlotWidget_C.UpdateWeaponGunInfo struct UWeaponEquipmentSlotWidget_C_UpdateWeaponGunInfo_Params { class UWidget* BoundWidget; // (CPF_Parm, CPF_ZeroConstructor, CPF_IsPlainOldData) }; // Function WeaponEquipmentSlotWidget.WeaponEquipmentSlotWidget_C.On_AmmoIcon_Prepass_1 struct UWeaponEquipmentSlotWidget_C_On_AmmoIcon_Prepass_1_Params { class UWidget* BoundWidget; // (CPF_Parm, CPF_ZeroConstructor, CPF_IsPlainOldData) }; // Function WeaponEquipmentSlotWidget.WeaponEquipmentSlotWidget_C.GetAmmoName struct UWeaponEquipmentSlotWidget_C_GetAmmoName_Params { struct FText ItemName; // (CPF_Parm, CPF_OutParm) }; // Function WeaponEquipmentSlotWidget.WeaponEquipmentSlotWidget_C.GetAmmoIcon struct UWeaponEquipmentSlotWidget_C_GetAmmoIcon_Params { struct FSlateBrush ReturnValue; // (CPF_Parm, CPF_OutParm, CPF_ReturnParm) }; // Function WeaponEquipmentSlotWidget.WeaponEquipmentSlotWidget_C.GetHandOnUnLoadedAmmoCount struct UWeaponEquipmentSlotWidget_C_GetHandOnUnLoadedAmmoCount_Params { int Count; // (CPF_Parm, CPF_OutParm, CPF_ZeroConstructor, CPF_IsPlainOldData) }; // Function WeaponEquipmentSlotWidget.WeaponEquipmentSlotWidget_C.GetHandOnLoadedAmmoCount struct UWeaponEquipmentSlotWidget_C_GetHandOnLoadedAmmoCount_Params { int Count; // (CPF_Parm, CPF_OutParm, CPF_ZeroConstructor, CPF_IsPlainOldData) }; // Function WeaponEquipmentSlotWidget.WeaponEquipmentSlotWidget_C.On_AmmoName_Prepass_1 struct UWeaponEquipmentSlotWidget_C_On_AmmoName_Prepass_1_Params { class UWidget* BoundWidget; // (CPF_Parm, CPF_ZeroConstructor, CPF_IsPlainOldData) }; // Function WeaponEquipmentSlotWidget.WeaponEquipmentSlotWidget_C.On_AmmoInfoLayer_Prepass_1 struct UWeaponEquipmentSlotWidget_C_On_AmmoInfoLayer_Prepass_1_Params { class UWidget* BoundWidget; // (CPF_Parm, CPF_ZeroConstructor, CPF_IsPlainOldData) }; // Function WeaponEquipmentSlotWidget.WeaponEquipmentSlotWidget_C.On_WeaponHandsOnUnloadedAmmoCount_Prepass_1 struct UWeaponEquipmentSlotWidget_C_On_WeaponHandsOnUnloadedAmmoCount_Prepass_1_Params { class UWidget* BoundWidget; // (CPF_Parm, CPF_ZeroConstructor, CPF_IsPlainOldData) }; // Function WeaponEquipmentSlotWidget.WeaponEquipmentSlotWidget_C.On_WeaponHandsOnLoadedAmmoCount_Prepass_1 struct UWeaponEquipmentSlotWidget_C_On_WeaponHandsOnLoadedAmmoCount_Prepass_1_Params { class UWidget* BoundWidget; // (CPF_Parm, CPF_ZeroConstructor, CPF_IsPlainOldData) }; // Function WeaponEquipmentSlotWidget.WeaponEquipmentSlotWidget_C.On_WeaponName_Prepass_1 struct UWeaponEquipmentSlotWidget_C_On_WeaponName_Prepass_1_Params { class UWidget* BoundWidget; // (CPF_Parm, CPF_ZeroConstructor, CPF_IsPlainOldData) }; // Function WeaponEquipmentSlotWidget.WeaponEquipmentSlotWidget_C.On_KeyName_Prepass_1 struct UWeaponEquipmentSlotWidget_C_On_KeyName_Prepass_1_Params { class UWidget* BoundWidget; // (CPF_Parm, CPF_ZeroConstructor, CPF_IsPlainOldData) }; // Function WeaponEquipmentSlotWidget.WeaponEquipmentSlotWidget_C.OnUpdateWeapon struct UWeaponEquipmentSlotWidget_C_OnUpdateWeapon_Params { }; // Function WeaponEquipmentSlotWidget.WeaponEquipmentSlotWidget_C.On_WeaponCaptureImage_Prepass_1 struct UWeaponEquipmentSlotWidget_C_On_WeaponCaptureImage_Prepass_1_Params { class UWidget* BoundWidget; // (CPF_Parm, CPF_ZeroConstructor, CPF_IsPlainOldData) }; // Function WeaponEquipmentSlotWidget.WeaponEquipmentSlotWidget_C.GetItem_Bp struct UWeaponEquipmentSlotWidget_C_GetItem_Bp_Params { class UItem* Item; // (CPF_Parm, CPF_OutParm, CPF_ZeroConstructor, CPF_IsPlainOldData) }; // Function WeaponEquipmentSlotWidget.WeaponEquipmentSlotWidget_C.IsAttachmentSlotMouseOver struct UWeaponEquipmentSlotWidget_C_IsAttachmentSlotMouseOver_Params { bool MouseOver; // (CPF_Parm, CPF_OutParm, CPF_ZeroConstructor, CPF_IsPlainOldData) }; // Function WeaponEquipmentSlotWidget.WeaponEquipmentSlotWidget_C.IsSlotMouseOver_Bp struct UWeaponEquipmentSlotWidget_C_IsSlotMouseOver_Bp_Params { bool IsMouseOver; // (CPF_Parm, CPF_OutParm, CPF_ZeroConstructor, CPF_IsPlainOldData) }; // Function WeaponEquipmentSlotWidget.WeaponEquipmentSlotWidget_C.IsSlotSubOn_Bp struct UWeaponEquipmentSlotWidget_C_IsSlotSubOn_Bp_Params { bool SubOn; // (CPF_Parm, CPF_OutParm, CPF_ZeroConstructor, CPF_IsPlainOldData) }; // Function WeaponEquipmentSlotWidget.WeaponEquipmentSlotWidget_C.IsSlotOn_Bp struct UWeaponEquipmentSlotWidget_C_IsSlotOn_Bp_Params { bool IsOn; // (CPF_Parm, CPF_OutParm, CPF_ZeroConstructor, CPF_IsPlainOldData) }; // Function WeaponEquipmentSlotWidget.WeaponEquipmentSlotWidget_C.OnDrop struct UWeaponEquipmentSlotWidget_C_OnDrop_Params { struct FGeometry* MyGeometry; // (CPF_Parm, CPF_IsPlainOldData) struct FPointerEvent* PointerEvent; // (CPF_Parm) class UDragDropOperation** Operation; // (CPF_Parm, CPF_ZeroConstructor, CPF_IsPlainOldData) bool ReturnValue; // (CPF_Parm, CPF_OutParm, CPF_ZeroConstructor, CPF_ReturnParm, CPF_IsPlainOldData) }; // Function WeaponEquipmentSlotWidget.WeaponEquipmentSlotWidget_C.GetWeaponSlotEquipId struct UWeaponEquipmentSlotWidget_C_GetWeaponSlotEquipId_Params { }; // Function WeaponEquipmentSlotWidget.WeaponEquipmentSlotWidget_C.MainPrepass_1 struct UWeaponEquipmentSlotWidget_C_MainPrepass_1_Params { class UWidget* BoundWidget; // (CPF_Parm, CPF_ZeroConstructor, CPF_IsPlainOldData) }; // Function WeaponEquipmentSlotWidget.WeaponEquipmentSlotWidget_C.InitializeWeaponEquipSlot struct UWeaponEquipmentSlotWidget_C_InitializeWeaponEquipSlot_Params { }; // Function WeaponEquipmentSlotWidget.WeaponEquipmentSlotWidget_C.RefreshAttachmentSlot struct UWeaponEquipmentSlotWidget_C_RefreshAttachmentSlot_Params { }; // Function WeaponEquipmentSlotWidget.WeaponEquipmentSlotWidget_C.OnMouseButtonUp struct UWeaponEquipmentSlotWidget_C_OnMouseButtonUp_Params { struct FGeometry* MyGeometry; // (CPF_Parm, CPF_IsPlainOldData) struct FPointerEvent* MouseEvent; // (CPF_ConstParm, CPF_Parm, CPF_OutParm, CPF_ReferenceParm) struct FEventReply ReturnValue; // (CPF_Parm, CPF_OutParm, CPF_ReturnParm) }; // Function WeaponEquipmentSlotWidget.WeaponEquipmentSlotWidget_C.OnDragDetected struct UWeaponEquipmentSlotWidget_C_OnDragDetected_Params { struct FGeometry* MyGeometry; // (CPF_Parm, CPF_IsPlainOldData) struct FPointerEvent* PointerEvent; // (CPF_ConstParm, CPF_Parm, CPF_OutParm, CPF_ReferenceParm) class UDragDropOperation* Operation; // (CPF_Parm, CPF_OutParm, CPF_ZeroConstructor, CPF_IsPlainOldData) }; // Function WeaponEquipmentSlotWidget.WeaponEquipmentSlotWidget_C.OnMouseButtonDown struct UWeaponEquipmentSlotWidget_C_OnMouseButtonDown_Params { struct FGeometry* MyGeometry; // (CPF_Parm, CPF_IsPlainOldData) struct FPointerEvent* MouseEvent; // (CPF_ConstParm, CPF_Parm, CPF_OutParm, CPF_ReferenceParm) struct FEventReply ReturnValue; // (CPF_Parm, CPF_OutParm, CPF_ReturnParm) }; // Function WeaponEquipmentSlotWidget.WeaponEquipmentSlotWidget_C.GetSlotVisibility struct UWeaponEquipmentSlotWidget_C_GetSlotVisibility_Params { }; // Function WeaponEquipmentSlotWidget.WeaponEquipmentSlotWidget_C.GetWeaponIcon struct UWeaponEquipmentSlotWidget_C_GetWeaponIcon_Params { struct FSlateBrush ReturnValue; // (CPF_Parm, CPF_OutParm, CPF_ReturnParm) }; // Function WeaponEquipmentSlotWidget.WeaponEquipmentSlotWidget_C.GetWeaponInfoText struct UWeaponEquipmentSlotWidget_C_GetWeaponInfoText_Params { struct FText ReturnValue; // (CPF_Parm, CPF_OutParm, CPF_ReturnParm) }; // Function WeaponEquipmentSlotWidget.WeaponEquipmentSlotWidget_C.Construct struct UWeaponEquipmentSlotWidget_C_Construct_Params { }; // Function WeaponEquipmentSlotWidget.WeaponEquipmentSlotWidget_C.OnUpdateEquip struct UWeaponEquipmentSlotWidget_C_OnUpdateEquip_Params { }; // Function WeaponEquipmentSlotWidget.WeaponEquipmentSlotWidget_C.OnDragEnter struct UWeaponEquipmentSlotWidget_C_OnDragEnter_Params { struct FGeometry* MyGeometry; // (CPF_Parm, CPF_IsPlainOldData) struct FPointerEvent* PointerEvent; // (CPF_Parm) class UDragDropOperation** Operation; // (CPF_Parm, CPF_ZeroConstructor, CPF_IsPlainOldData) }; // Function WeaponEquipmentSlotWidget.WeaponEquipmentSlotWidget_C.OnDragLeave struct UWeaponEquipmentSlotWidget_C_OnDragLeave_Params { struct FPointerEvent* PointerEvent; // (CPF_Parm) class UDragDropOperation** Operation; // (CPF_Parm, CPF_ZeroConstructor, CPF_IsPlainOldData) }; // Function WeaponEquipmentSlotWidget.WeaponEquipmentSlotWidget_C.OnDragSlotEnter struct UWeaponEquipmentSlotWidget_C_OnDragSlotEnter_Params { int SlotIndex; // (CPF_Parm, CPF_ZeroConstructor, CPF_IsPlainOldData) }; // Function WeaponEquipmentSlotWidget.WeaponEquipmentSlotWidget_C.OnDragSlotLeave struct UWeaponEquipmentSlotWidget_C_OnDragSlotLeave_Params { }; // Function WeaponEquipmentSlotWidget.WeaponEquipmentSlotWidget_C.OnMouseEnter struct UWeaponEquipmentSlotWidget_C_OnMouseEnter_Params { struct FGeometry* MyGeometry; // (CPF_Parm, CPF_IsPlainOldData) struct FPointerEvent* MouseEvent; // (CPF_ConstParm, CPF_Parm, CPF_OutParm, CPF_ReferenceParm) }; // Function WeaponEquipmentSlotWidget.WeaponEquipmentSlotWidget_C.OnMouseLeave struct UWeaponEquipmentSlotWidget_C_OnMouseLeave_Params { struct FPointerEvent* MouseEvent; // (CPF_ConstParm, CPF_Parm, CPF_OutParm, CPF_ReferenceParm) }; // Function WeaponEquipmentSlotWidget.WeaponEquipmentSlotWidget_C.OnUpdateItem struct UWeaponEquipmentSlotWidget_C_OnUpdateItem_Params { class UItem** Item; // (CPF_Parm, CPF_ZeroConstructor, CPF_IsPlainOldData) }; // Function WeaponEquipmentSlotWidget.WeaponEquipmentSlotWidget_C.UpdateDragDropObject struct UWeaponEquipmentSlotWidget_C_UpdateDragDropObject_Params { class UTslItemDragDropOperation_C** DragDropObject; // (CPF_Parm, CPF_ZeroConstructor, CPF_IsPlainOldData) }; // Function WeaponEquipmentSlotWidget.WeaponEquipmentSlotWidget_C.SetInventory struct UWeaponEquipmentSlotWidget_C_SetInventory_Params { class UInventoryWidget_C** InventoryWidget; // (CPF_Parm, CPF_ZeroConstructor, CPF_IsPlainOldData) }; // Function WeaponEquipmentSlotWidget.WeaponEquipmentSlotWidget_C.BndEvt__UpperRail_K2Node_ComponentBoundEvent_14_RefreshFocus__DelegateSignature struct UWeaponEquipmentSlotWidget_C_BndEvt__UpperRail_K2Node_ComponentBoundEvent_14_RefreshFocus__DelegateSignature_Params { }; // Function WeaponEquipmentSlotWidget.WeaponEquipmentSlotWidget_C.BndEvt__Muzzle_K2Node_ComponentBoundEvent_16_RefreshFocus__DelegateSignature struct UWeaponEquipmentSlotWidget_C_BndEvt__Muzzle_K2Node_ComponentBoundEvent_16_RefreshFocus__DelegateSignature_Params { }; // Function WeaponEquipmentSlotWidget.WeaponEquipmentSlotWidget_C.BndEvt__LowerRail_K2Node_ComponentBoundEvent_19_RefreshFocus__DelegateSignature struct UWeaponEquipmentSlotWidget_C_BndEvt__LowerRail_K2Node_ComponentBoundEvent_19_RefreshFocus__DelegateSignature_Params { }; // Function WeaponEquipmentSlotWidget.WeaponEquipmentSlotWidget_C.BndEvt__Magazine_K2Node_ComponentBoundEvent_23_RefreshFocus__DelegateSignature struct UWeaponEquipmentSlotWidget_C_BndEvt__Magazine_K2Node_ComponentBoundEvent_23_RefreshFocus__DelegateSignature_Params { }; // Function WeaponEquipmentSlotWidget.WeaponEquipmentSlotWidget_C.BndEvt__Stock_K2Node_ComponentBoundEvent_28_RefreshFocus__DelegateSignature struct UWeaponEquipmentSlotWidget_C_BndEvt__Stock_K2Node_ComponentBoundEvent_28_RefreshFocus__DelegateSignature_Params { }; // Function WeaponEquipmentSlotWidget.WeaponEquipmentSlotWidget_C.WidgetInputBPressed struct UWeaponEquipmentSlotWidget_C_WidgetInputBPressed_Params { }; // Function WeaponEquipmentSlotWidget.WeaponEquipmentSlotWidget_C.OnWidgetInputBReleased struct UWeaponEquipmentSlotWidget_C_OnWidgetInputBReleased_Params { }; // Function WeaponEquipmentSlotWidget.WeaponEquipmentSlotWidget_C.Tick struct UWeaponEquipmentSlotWidget_C_Tick_Params { struct FGeometry* MyGeometry; // (CPF_Parm, CPF_IsPlainOldData) float* InDeltaTime; // (CPF_Parm, CPF_ZeroConstructor, CPF_IsPlainOldData) }; // Function WeaponEquipmentSlotWidget.WeaponEquipmentSlotWidget_C.OnSlotMoveUp struct UWeaponEquipmentSlotWidget_C_OnSlotMoveUp_Params { }; // Function WeaponEquipmentSlotWidget.WeaponEquipmentSlotWidget_C.OnSlotMoveDown struct UWeaponEquipmentSlotWidget_C_OnSlotMoveDown_Params { }; // Function WeaponEquipmentSlotWidget.WeaponEquipmentSlotWidget_C.SlotMoveLeft struct UWeaponEquipmentSlotWidget_C_SlotMoveLeft_Params { }; // Function WeaponEquipmentSlotWidget.WeaponEquipmentSlotWidget_C.OnSlotMoveRight struct UWeaponEquipmentSlotWidget_C_OnSlotMoveRight_Params { }; // Function WeaponEquipmentSlotWidget.WeaponEquipmentSlotWidget_C.CustomEvent_1 struct UWeaponEquipmentSlotWidget_C_CustomEvent_1_Params { }; // Function WeaponEquipmentSlotWidget.WeaponEquipmentSlotWidget_C.OnWidgetInputX struct UWeaponEquipmentSlotWidget_C_OnWidgetInputX_Params { }; // Function WeaponEquipmentSlotWidget.WeaponEquipmentSlotWidget_C.CustomEvent_2 struct UWeaponEquipmentSlotWidget_C_CustomEvent_2_Params { }; // Function WeaponEquipmentSlotWidget.WeaponEquipmentSlotWidget_C.OnInputWidgetInputB struct UWeaponEquipmentSlotWidget_C_OnInputWidgetInputB_Params { }; // Function WeaponEquipmentSlotWidget.WeaponEquipmentSlotWidget_C.ExecuteUbergraph_WeaponEquipmentSlotWidget struct UWeaponEquipmentSlotWidget_C_ExecuteUbergraph_WeaponEquipmentSlotWidget_Params { int EntryPoint; // (CPF_Parm, CPF_ZeroConstructor, CPF_IsPlainOldData) }; // Function WeaponEquipmentSlotWidget.WeaponEquipmentSlotWidget_C.OnDragLeaveWeaponSlot__DelegateSignature struct UWeaponEquipmentSlotWidget_C_OnDragLeaveWeaponSlot__DelegateSignature_Params { int SlotIndex; // (CPF_Parm, CPF_ZeroConstructor, CPF_IsPlainOldData) }; // Function WeaponEquipmentSlotWidget.WeaponEquipmentSlotWidget_C.OnDragEnterWeaponSlot__DelegateSignature struct UWeaponEquipmentSlotWidget_C_OnDragEnterWeaponSlot__DelegateSignature_Params { int SlotIndex; // (CPF_Parm, CPF_ZeroConstructor, CPF_IsPlainOldData) }; // Function WeaponEquipmentSlotWidget.WeaponEquipmentSlotWidget_C.OnReleased__DelegateSignature struct UWeaponEquipmentSlotWidget_C_OnReleased__DelegateSignature_Params { }; } #ifdef _MSC_VER #pragma pack(pop) #endif
[ "34903638+ColdStartEnthusiast@users.noreply.github.com" ]
34903638+ColdStartEnthusiast@users.noreply.github.com
304aa5a343f45e40c0f53bbcf4608bbd07a02737
c64e539f641211a7593c8552c9e38ff443982a2d
/src/qt/sendcoinsentry.cpp
6abf74a183ca3fd9b06ffbfc9c9fb8633a6fe866
[ "MIT" ]
permissive
cryptolog/ARGUS
1c38334bcf61017073e4b512936e7372f7a87a5b
fc17a26535069ee0cc12d7af5053fc5c5fc5a91d
refs/heads/master
2020-06-02T23:19:24.322324
2019-06-21T08:58:18
2019-06-21T08:58:18
191,341,107
0
0
MIT
2019-06-11T09:42:04
2019-06-11T09:42:03
null
UTF-8
C++
false
false
4,617
cpp
// Copyright (c) 2011-2013 The Bitcoin developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "sendcoinsentry.h" #include "ui_sendcoinsentry.h" #include "guiutil.h" #include "bitcoinunits.h" #include "addressbookpage.h" #include "walletmodel.h" #include "optionsmodel.h" #include "addresstablemodel.h" #include <QApplication> #include <QClipboard> SendCoinsEntry::SendCoinsEntry(QWidget *parent) : QFrame(parent), ui(new Ui::SendCoinsEntry), model(0) { ui->setupUi(this); #ifdef Q_OS_MAC ui->payToLayout->setSpacing(4); #endif #if QT_VERSION >= 0x040700 /* Do not move this to the XML file, Qt before 4.7 will choke on it */ ui->addAsLabel->setPlaceholderText(tr("Enter a label for this address to add it to your address book")); ui->payTo->setPlaceholderText(tr("Enter a ARGUSCOIN address (e.g. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)")); #endif setFocusPolicy(Qt::TabFocus); setFocusProxy(ui->payTo); GUIUtil::setupAddressWidget(ui->payTo, this); } SendCoinsEntry::~SendCoinsEntry() { delete ui; } void SendCoinsEntry::on_pasteButton_clicked() { // Paste text from clipboard into recipient field ui->payTo->setText(QApplication::clipboard()->text()); } void SendCoinsEntry::on_addressBookButton_clicked() { if(!model) return; AddressBookPage dlg(AddressBookPage::ForSending, AddressBookPage::SendingTab, this); dlg.setModel(model->getAddressTableModel()); if(dlg.exec()) { ui->payTo->setText(dlg.getReturnValue()); ui->payAmount->setFocus(); } } void SendCoinsEntry::on_payTo_textChanged(const QString &address) { if(!model) return; // Fill in label from address book, if address has an associated label QString associatedLabel = model->getAddressTableModel()->labelForAddress(address); if(!associatedLabel.isEmpty()) ui->addAsLabel->setText(associatedLabel); } void SendCoinsEntry::setModel(WalletModel *model) { this->model = model; if(model && model->getOptionsModel()) connect(model->getOptionsModel(), SIGNAL(displayUnitChanged(int)), this, SLOT(updateDisplayUnit())); connect(ui->payAmount, SIGNAL(textChanged()), this, SIGNAL(payAmountChanged())); clear(); } void SendCoinsEntry::setRemoveEnabled(bool enabled) { ui->deleteButton->setEnabled(enabled); } void SendCoinsEntry::clear() { ui->payTo->clear(); ui->addAsLabel->clear(); ui->payAmount->clear(); ui->payTo->setFocus(); // update the display unit, to not use the default ("BTC") updateDisplayUnit(); } void SendCoinsEntry::on_deleteButton_clicked() { emit removeEntry(this); } bool SendCoinsEntry::validate() { // Check input validity bool retval = true; if(!ui->payAmount->validate()) { retval = false; } else { if(ui->payAmount->value() <= 0) { // Cannot send 0 coins or less ui->payAmount->setValid(false); retval = false; } } if(!ui->payTo->hasAcceptableInput() || (model && !model->validateAddress(ui->payTo->text()))) { ui->payTo->setValid(false); retval = false; } return retval; } SendCoinsRecipient SendCoinsEntry::getValue() { SendCoinsRecipient rv; rv.address = ui->payTo->text(); rv.label = ui->addAsLabel->text(); rv.amount = ui->payAmount->value(); return rv; } QWidget *SendCoinsEntry::setupTabChain(QWidget *prev) { QWidget::setTabOrder(prev, ui->payTo); QWidget::setTabOrder(ui->payTo, ui->addressBookButton); QWidget::setTabOrder(ui->addressBookButton, ui->pasteButton); QWidget::setTabOrder(ui->pasteButton, ui->deleteButton); QWidget::setTabOrder(ui->deleteButton, ui->addAsLabel); return ui->payAmount->setupTabChain(ui->addAsLabel); } void SendCoinsEntry::setValue(const SendCoinsRecipient &value) { ui->payTo->setText(value.address); ui->addAsLabel->setText(value.label); ui->payAmount->setValue(value.amount); } void SendCoinsEntry::setAddress(const QString &address) { ui->payTo->setText(address); ui->payAmount->setFocus(); } bool SendCoinsEntry::isClear() { return ui->payTo->text().isEmpty(); } void SendCoinsEntry::setFocus() { ui->payTo->setFocus(); } void SendCoinsEntry::updateDisplayUnit() { if(model && model->getOptionsModel()) { // Update payAmount with the current unit ui->payAmount->setDisplayUnit(model->getOptionsModel()->getDisplayUnit()); } }
[ "bitminer82@gmail.com" ]
bitminer82@gmail.com
cd56f02d67dce7a596cfaf5dee7b6119a9f33f41
097b2a0f8e5cefbaff31790a359d267bd978e480
/Atcoder/ABC_s1/ABC_079/C-Train_Ticket.cpp
f37899ce059057bc72afda3204eeb6cfb96a33a9
[]
no_license
Noiri/Competitive_Programming
39667ae94d6b167b4d7b9e78a98b8cb53ff1884f
25ec787f7f5a507f9d1713a1e88f198fd495ec01
refs/heads/master
2023-08-16T17:35:15.940860
2021-09-07T20:57:59
2021-09-07T20:57:59
161,947,108
0
0
null
null
null
null
UTF-8
C++
false
false
669
cpp
#include <bits/stdc++.h> using namespace std; int main(){ string s; cin >> s; for(int bit=0; bit<(1<<3); bit++){ int tmp = (int)(s[0] - '0'); char op[3]; for(int i=0; i<3; i++){ if(bit & (1<<i)){ tmp += (int)(s[i+1] - '0'); op[i] = '+'; } else{ tmp -= (int)(s[i+1] - '0'); op[i] = '-'; } } if(tmp == 7){ cout << s[0]; for(int i=0; i<3; i++) cout << op[i] << s[i+1]; cout << "=7" << endl; return 0; } } return 0; }
[ "suleipenn@gmail.com" ]
suleipenn@gmail.com
0b7d960a83cff6a7afa126115833cf2f5753ea48
3459ad2afff7ad28c99c0e6837755aedda7f5ff1
/WarehouseControlSystem/ControlClass/externcommuincation/tcommtcpclient.cpp
937a6a83f9cfd413293504be6df4ab34c2f703ca
[]
no_license
KorolWu/WCSFinal
7fbe534114d8dae3f83f0e80897e7b3fc2683097
ea0b8cd71f8ffc9da5d43ab9c511130039a9d32a
refs/heads/master
2023-04-03T01:32:45.274632
2021-04-22T01:00:17
2021-04-22T01:00:17
360,348,654
1
1
null
null
null
null
UTF-8
C++
false
false
6,277
cpp
#include "tcommtcpclient.h" #include <QDateTime> #include "tcommtransceivermanager.h" #include "UnitClass/c_systemlogmng.h" TCommTCPclient::TCommTCPclient() { socket = nullptr; m_connectStatus = false; connect(this,&TCommTCPclient::signalSendHWdeviceData,this,&TCommTCPclient::write); connect(this,&TCommTCPclient::signalClientconnectserver,this,&TCommTCPclient::reConnection); } TCommTCPclient::~TCommTCPclient() { if(socket == nullptr) return; socket->disconnectFromHost(); socket->close(); socket = nullptr; } void TCommTCPclient::SetCommParam(ComConfigStru paramstru) { m_config = paramstru.hwTcpstru; creadTcpClient(); } int TCommTCPclient::GetNameID() { return m_config.ID; } int TCommTCPclient::GetHWtype() { return m_config.hwtype; } int TCommTCPclient::GetHWprotype() { return KTcpClient; } void TCommTCPclient::CloseComm() { if(socket == nullptr) return; socket->disconnectFromHost(); socket->close(); } uint recindex = 0; bool TCommTCPclient::creadTcpClient() { this->m_ip = m_config.name; this->m_port = m_config.port ; // if( m_config.ID == 0) // { // this->m_ip = "10.0.1.68"; // this->m_port = 1883; // } // qDebug()<<"ip "<< m_config.name << m_config.port; socket = new QTcpSocket(this); connect(socket,&QTcpSocket::disconnected,this,&TCommTCPclient::onDisconnected); connect(socket,&QTcpSocket::connected, [=]() { m_connectStatus = true; // qDebug()<<"ip "<< m_config.name << m_config.port << m_connectStatus ; m_connectstate = 1; } ); connect(socket,&QTcpSocket::readyRead, [=]() { QByteArray array = socket->readAll(); // qDebug()<<"小车收到的数据包情况:"<<QDateTime::currentDateTime() << m_config.ID << m_config.port << array.toHex()<< array.length(); //测试部分收到的数据-----------------2020/11/07 if( m_config.ID == 1) { if(!(array.length() == 10 || array.length() == 74)) { // qDebug()<< "!!!!小车收到的数据长度异常:" <<QDateTime::currentDateTime()<< array.length(); } //分析报文类型 if(array.length() >= 10) { // int16_t nbr;//指令编号 // int16_t carnbr;//小车编号 // atoi16 nbrvalue; // memcpy(nbrvalue.a,array.data(),2); // nbr = nbrvalue.x; atoi16 carrvalue; memcpy(carrvalue.a,array.data()+2,2); // carnbr = carrvalue.x; recindex++; if(array[4] == 'S' && array[5] == 'D'&&(array.size() >= 74))//详细报文数据 { //qDebug()<<"收到:WCS收到小车发送详细数据报文:" << QDateTime::currentDateTime()<< array.length() << array.toHex() <<nbr << recindex ; //解析详细数据内容 ReceCarDetailFrame detailstru;//详细数据报文 memcpy((char*)&detailstru,array.data(),74); // qDebug()<<"收到:WCS收到小车发送详细数据报文解析内容准备状态:" << QDateTime::currentDateTime()<<";长度:" <<array.length() << "ready:"<<detailstru.info.bready <<"unready:"<<detailstru.info.bunready; } else { //qDebug()<< "通讯对象中WCS收到小车发送动作数据或者粘包数据报文:"<<QDateTime::currentDateTime()<< array.length() <<array.toHex(); } } } //测试部分收到的数据-----------------2020/11/07 emit signalReadHWdeviceData(m_config.ID,m_config.hwtype,array); // qDebug()<<"收到流道数据内容"<<array.toHex() <<"id"<<m_config.ID; }); bool connect = connectServer(m_ip,m_port); emit signalHWDisconnect(m_config.ID,m_config.hwtype,m_connectStatus); return connect; } bool TCommTCPclient::connectServer(QString ip, qint16 port) { if(socket == nullptr) return false; socket->connectToHost(QHostAddress(ip),port); if(socket->waitForConnected(1000)) { return true; } else { return false; } } bool TCommTCPclient::reConnection() { if(m_connectstate) return true; m_connectStatus = connectServer(this->m_ip,this->m_port); if(m_connectStatus)//连接成功发出成功状态 { emit signalHWDisconnect(m_config.ID,m_config.hwtype,m_connectStatus); m_connectstate = 1; } else{ m_connectstate = 0; } return m_connectStatus; } uint sendcnt = 0; uint senaction = 0; int TCommTCPclient::write(QByteArray array) { if(!m_connectStatus)//连接成功发出成功状态 return 1; if(socket == nullptr) return 1; int iresultsize = 0; iresultsize = socket->write(array); if(iresultsize != 40 && m_config.ID == 1) { QString str = QString("数据发送失败当前发送成功数量:%1; send array:%2,发送时间:%3; 发送结果:iresultsize").arg(sendcnt).arg(QString(array.toHex())).arg(QDateTime::currentDateTime().toString()); qDebug()<< str<<QDateTime::currentDateTime();; GetSystemLogObj()->writeLog(str,2); } // else{ // sendcnt++; // if(m_config.ID == 1&&(!(array[32] == 0 && array[33] == 0))) // { // QString str = QString("WCS发送动作指令数据到小车ID:[%1],发送时间:%2,发送的数据16进制:%3;").arg(m_config.ID).arg(QDateTime::currentDateTime().toString()).arg(QString(array.toHex())); // qDebug() << str; // } // if(m_config.ID == 1) // { // QString str = QString("WCS发送指令数据到小车ID:[%1],发送时间:%2,发送的数据16进制:%3;").arg(m_config.ID).arg(QDateTime::currentDateTime().toString()).arg(QString(array.toHex())); // qDebug() << str; // } // } return 0; } void TCommTCPclient::onDisconnected() { m_connectstate = 0; m_connectStatus = false; emit clientDisconnect(m_config.ID,m_config.hwtype); emit signalHWDisconnect(m_config.ID,m_config.hwtype,m_connectStatus); }
[ "1050476035@qq.com" ]
1050476035@qq.com
6df7c98286000605dd0455e1d230b9a48c7cfa32
fed5d16dd3166c7c5fc1c0fab37f9bb06b164c61
/problem 8 sorting array elements by its frequency.cpp
b1bde94b2e6eae28b47baa61bd75a8dd0935e97b
[]
no_license
sushmitasah/-100daysofcodingchallenge
0f42a71900391bd549c7a32fb73069aaa7352a5f
00c9ec509af5fe6473b42e131460ee2a8b9c446c
refs/heads/master
2020-06-03T12:04:53.157692
2019-07-17T04:53:45
2019-07-17T04:53:45
191,561,575
1
0
null
null
null
null
UTF-8
C++
false
false
2,498
cpp
Problem:- /*Given an array A[] of integers, sort the array according to frequency of elements. That is elements that have higher frequency come first. If frequencies of two elements are same, then smaller number comes first. Input Format: The first line of input contains an integer T denoting the number of test cases. The description of T test cases follows. The first line of each test case contains a single integer N denoting the size of array. The second line contains N space-separated integers A1, A2, ..., AN denoting the elements of the array. Output Format: For each testcase, in a new line, print each sorted array in a seperate line. For each array its numbers should be seperated by space. Your Task: This is a function problem. You only need to complete the function sortByFreq that takes arr, and n as parameters and prints the sorted elements. Endline is provided by the driver code. Constraints: 1 = T = 70 30 = N = 130 1 = Ai = 60 Example: Input: 2 5 5 5 4 6 4 5 9 9 9 2 5 Output: 4 4 5 5 6 9 9 9 2 5 Explanation: Testcase1: The highest frequency here is 2. Both 5 and 4 have that frequency. Now since the frequencies are same then smaller element comes first. So 4 4 comes first then comes 5 5. Finally comes 6. The output is 4 4 5 5 6. Testcase2: The highest frequency here is 3. The element 9 has the highest frequency. So 9 9 9 comes first. Now both 2 and 5 have same frequency. So we print smaller element first. The output is 9 9 9 2 5. */ Solution:- //Complete this function //The array is declared globally void sortByFreq(int arr[],int n) { int hash[62]={0}; int sorted[62]={0}; for(int i=0;i<n;i++){ hash[arr[i]]++; sorted[arr[i]]++; } sort(sorted,sorted+61); for(int j=60;j>=0;j--){ for(int i=1;i<61;i++){ if(hash[i]==sorted[j]){ for(int k=1;k<=hash[i];k++){ cout<<i<<" "; } hash[i]=0; } } } } #include<iostream> #include<bits/stdc++.h> using namespace std; int main() { //code int t; cin>>t; while(t--) { int n,j,k,x; cin>>n; int a[n],c[1000]={0}; for(int i=0;i<n;i++) { cin>>a[i]; } for(int i=0;i<n;i++) { c[a[i]]++; } sort(c,c+n); for(k=999;k>=0;k--) { if(c[k]!=0) { x=c[k]; for(j=0;j<x;j++) { cout<<k<<" "; } } } cout<<"\n"; } return 0; }
[ "noreply@github.com" ]
sushmitasah.noreply@github.com
0d5e5e65119fdbbaab6dbf7738e5a67e6627ff79
f73b1c973666697607191ca08b165a485ac3c980
/src/UIMode.cpp
98d2d2749eb9ab727e829080afdf32c515c0675a
[ "BSD-2-Clause" ]
permissive
simonzty/RPi_Pico_WAV_Player
1580f593ad4e1d132364530c8ce84e4e5b8b418a
606d1cec8bfb7f5e55eab78f467c3541f0fff1fd
refs/heads/main
2023-05-01T22:20:14.745081
2021-05-05T14:15:28
2021-05-05T14:15:28
378,089,434
1
0
BSD-2-Clause
2021-06-18T08:47:13
2021-06-18T08:47:13
null
UTF-8
C++
false
false
25,953
cpp
/*------------------------------------------------------/ / UIMode /-------------------------------------------------------/ / Copyright (c) 2020-2021, Elehobica / Released under the BSD-2-Clause / refer to https://opensource.org/licenses/BSD-2-Clause /------------------------------------------------------*/ #include "UIMode.h" #include <cstdio> #include <cstring> #include "ui_control.h" #include "stack.h" #include "PlayAudio/audio_codec.h" TagRead tag; const uint8_t *BLANK_LINE = ((uint8_t *) " "); // UIMode class instances button_action_t UIMode::btn_act; //================================ // Implementation of UIMode class //================================ UIMode::UIMode(const char *name, ui_mode_enm_t ui_mode_enm, UIVars *vars) : name(name), prevMode(NULL), ui_mode_enm(ui_mode_enm), vars(vars), idle_count(0) { } void UIMode::entry(UIMode *prevMode) { this->prevMode = prevMode; idle_count = 0; if (ui_mode_enm == vars->init_dest_ui_mode) { // Reached desitination of initial UI mode vars->init_dest_ui_mode = InitialMode; } ui_clear_btn_evt(); } bool UIMode::isAudioFile(uint16_t idx) { if (file_menu_match_ext(idx, "wav", 3) || file_menu_match_ext(idx, "WAV", 3)) { set_audio_codec(PlayAudio::AUDIO_CODEC_WAV); return true; } set_audio_codec(PlayAudio::AUDIO_CODEC_NONE); return false; } const char *UIMode::getName() { return name; } ui_mode_enm_t UIMode::getUIModeEnm() { return ui_mode_enm; } uint16_t UIMode::getIdleCount() { return idle_count; } //======================================= // Implementation of UIInitialMode class //======================================= UIInitialMode::UIInitialMode(UIVars *vars) : UIMode("UIInitialMode", InitialMode, vars) { file_menu_open_dir("/"); if (file_menu_get_num() <= 1) { //power_off("Card Read Error!", 1); lcd.setMsg("Card Read Error!"); } } UIMode* UIInitialMode::update() { switch (vars->init_dest_ui_mode) { case FileViewMode: /* case PlayMode: return getUIMode(FileViewMode); break; */ default: if (idle_count++ > 100) { return getUIMode(FileViewMode); } break; } idle_count++; return this; } void UIInitialMode::entry(UIMode *prevMode) { UIMode::entry(prevMode); lcd.switchToInitial(); } void UIInitialMode::draw() { lcd.drawInitial(); } //========================================= // Implementation of UIFileViewMode class //========================================= UIFileViewMode::UIFileViewMode(UIVars *vars, stack_t *dir_stack) : UIMode("UIFileViewMode", FileViewMode, vars), dir_stack(dir_stack) { sft_val = new uint16_t[vars->num_list_lines]; for (int i = 0; i < vars->num_list_lines; i++) { sft_val[i] = 0; } } void UIFileViewMode::listIdxItems() { char str[256]; for (int i = 0; i < vars->num_list_lines; i++) { if (vars->idx_head+i >= file_menu_get_num()) { lcd.setListItem(i, ""); // delete continue; } file_menu_get_fname(vars->idx_head+i, str, sizeof(str)); uint8_t icon = file_menu_is_dir(vars->idx_head+i) ? ICON16x16_FOLDER : ICON16x16_FILE; lcd.setListItem(i, str, icon, (i == vars->idx_column)); } } uint16_t UIFileViewMode::getNumAudioFiles() { uint16_t num_tracks = 0; num_tracks += file_menu_get_ext_num("wav", 3) + file_menu_get_ext_num("WAV", 3); return num_tracks; } void UIFileViewMode::chdir() { stack_data_t item; if (vars->idx_head+vars->idx_column == 0) { // upper ("..") dirctory if (stack_get_count(dir_stack) > 0) { if (vars->fs_type == FS_EXFAT) { // This is workaround for FatFs known bug for ".." in EXFAT stack_t *temp_stack = stack_init(); while (stack_get_count(dir_stack) > 0) { stack_pop(dir_stack, &item); //printf("pop %d %d %d\n", stack_get_count(dir_stack), item.head, item.column); stack_push(temp_stack, &item); } file_menu_close_dir(); file_menu_open_dir("/"); // Root directory while (stack_get_count(temp_stack) > 1) { stack_pop(temp_stack, &item); //printf("pushA %d %d %d\n", stack_get_count(dir_stack), item.head, item.column); file_menu_sort_entry(item.head+item.column, item.head+item.column+1); file_menu_ch_dir(item.head+item.column); stack_push(dir_stack, &item); } stack_pop(temp_stack, &item); //printf("pushB %d %d %d\n", stack_get_count(dir_stack), item.head, item.column); stack_push(dir_stack, &item); stack_delete(temp_stack); } else { file_menu_ch_dir(vars->idx_head+vars->idx_column); } } else { // Already in top directory file_menu_close_dir(); file_menu_open_dir("/"); // Root directory item.head = 0; item.column = 0; stack_push(dir_stack, &item); } stack_pop(dir_stack, &item); vars->idx_head = item.head; vars->idx_column = item.column; } else { // normal directory item.head = vars->idx_head; item.column = vars->idx_column; stack_push(dir_stack, &item); file_menu_ch_dir(vars->idx_head+vars->idx_column); vars->idx_head = 0; vars->idx_column = 0; } } #if 0 UIMode *UIFileViewMode::nextPlay() { switch (USERCFG_PLAY_NEXT_ALBUM) { case UserConfig::next_play_action_t::Sequential: return sequentialSearch(false); break; case UserConfig::next_play_action_t::SequentialRepeat: return sequentialSearch(true); break; case UserConfig::next_play_action_t::Repeat: vars->idx_head = 0; vars->idx_column = 0; return getUIPlayMode(); case UserConfig::next_play_action_t::Random: return randomSearch(USERCFG_PLAY_RAND_DEPTH); break; case UserConfig::next_play_action_t::Stop: default: return this; break; } return this; } UIMode *UIFileViewMode::sequentialSearch(bool repeatFlg) { int stack_count; uint16_t last_dir_idx; printf("Sequential Search\n"); vars->idx_play = 0; stack_count = stack_get_count(dir_stack); if (stack_count < 1) { return this; } { vars->idx_head = 0; vars->idx_column = 0; chdir(); // cd ..; } vars->idx_head += vars->idx_column; vars->idx_column = 0; last_dir_idx = vars->idx_head; while (1) { { if (file_menu_get_dir_num() == 0) { break; } while (1) { vars->idx_head++; if (repeatFlg) { // [Option 1] loop back to first album (don't take ".." directory) if (vars->idx_head >= file_menu_get_num()) { vars->idx_head = 1; } } else { // [Option 2] stop at the bottom of albums if (vars->idx_head >= file_menu_get_num()) { // go back to last dir vars->idx_head = last_dir_idx; chdir(); return this; } } file_menu_sort_entry(vars->idx_head, vars->idx_head+1); if (file_menu_is_dir(vars->idx_head) > 0) { break; } } chdir(); } // Check if Next Target Dir has Audio track files if (stack_count == stack_get_count(dir_stack) && getNumAudioFiles() > 0) { break; } // Otherwise, chdir to stack_count-depth and retry again printf("Retry Sequential Search\n"); while (stack_count - 1 != stack_get_count(dir_stack)) { vars->idx_head = 0; vars->idx_column = 0; chdir(); // cd ..; } } return getUIPlayMode(); } UIMode *UIFileViewMode::randomSearch(uint16_t depth) { int i; int stack_count; printf("Random Search\n"); vars->idx_play = 0; stack_count = stack_get_count(dir_stack); if (stack_count < depth) { return this; } for (i = 0; i < depth; i++) { vars->idx_head = 0; vars->idx_column = 0; chdir(); // cd ..; } while (1) { for (i = 0; i < depth; i++) { if (file_menu_get_dir_num() == 0) { break; } while (1) { vars->idx_head = random(1, file_menu_get_num()); file_menu_sort_entry(vars->idx_head, vars->idx_head+1); if (file_menu_is_dir(vars->idx_head) > 0) { break; } } vars->idx_column = 0; chdir(); } // Check if Next Target Dir has Audio track files if (stack_count == stack_get_count(dir_stack) && getNumAudioFiles() > 0) { break; } // Otherwise, chdir to stack_count-depth and retry again printf("Retry Random Search\n"); while (stack_count - depth != stack_get_count(dir_stack)) { vars->idx_head = 0; vars->idx_column = 0; chdir(); // cd ..; } } return getUIPlayMode(); } #endif void UIFileViewMode::idxInc(void) { if (vars->idx_head >= file_menu_get_num() - vars->num_list_lines && vars->idx_column == vars->num_list_lines-1) { return; } if (vars->idx_head + vars->idx_column + 1 >= file_menu_get_num()) { return; } vars->idx_column++; if (vars->idx_column >= vars->num_list_lines) { if (vars->idx_head + vars->num_list_lines >= file_menu_get_num() - vars->num_list_lines) { vars->idx_column = vars->num_list_lines-1; vars->idx_head++; } else { vars->idx_column = 0; vars->idx_head += vars->num_list_lines; } } } void UIFileViewMode::idxDec(void) { if (vars->idx_head == 0 && vars->idx_column == 0) { return; } if (vars->idx_column == 0) { if (vars->idx_head < vars->num_list_lines) { vars->idx_column = 0; vars->idx_head--; } else { vars->idx_column = vars->num_list_lines-1; vars->idx_head -= vars->num_list_lines; } } else { vars->idx_column--; } } void UIFileViewMode::idxFastInc(void) { if (vars->idx_head >= file_menu_get_num() - vars->num_list_lines && vars->idx_column == vars->num_list_lines-1) { return; } if (vars->idx_head + vars->idx_column + 1 >= file_menu_get_num()) { return; } if (file_menu_get_num() < vars->num_list_lines) { idxInc(); } else if (vars->idx_head + vars->num_list_lines >= file_menu_get_num() - vars->num_list_lines) { vars->idx_head = file_menu_get_num() - vars->num_list_lines; idxInc(); } else { vars->idx_head += vars->num_list_lines; } } void UIFileViewMode::idxFastDec(void) { if (vars->idx_head == 0 && vars->idx_column == 0) { return; } if (vars->idx_head < vars->num_list_lines) { vars->idx_head = 0; idxDec(); } else { vars->idx_head -= vars->num_list_lines; } } UIMode *UIFileViewMode::getUIPlayMode() { if (vars->idx_play == 0) { vars->idx_play = vars->idx_head + vars->idx_column; } //file_menu_full_sort(); vars->num_tracks = getNumAudioFiles(); return getUIMode(PlayMode); } UIMode* UIFileViewMode::update() { vars->resume_ui_mode = ui_mode_enm; /* switch (vars->init_dest_ui_mode) { case PlayMode: return getUIPlayMode(); break; default: break; } */ if (ui_get_btn_evt(&btn_act)) { vars->do_next_play = None; switch (btn_act) { case ButtonCenterSingle: if (file_menu_is_dir(vars->idx_head+vars->idx_column) > 0) { // Target is Directory chdir(); listIdxItems(); } else { // Target is File if (isAudioFile(vars->idx_head + vars->idx_column)) { return getUIPlayMode(); } } break; case ButtonCenterDouble: // upper ("..") dirctory vars->idx_head = 0; vars->idx_column = 0; chdir(); listIdxItems(); break; case ButtonCenterTriple: //return randomSearch(USERCFG_PLAY_RAND_DEPTH); break; case ButtonCenterLong: //return getUIMode(ConfigMode); break; case ButtonCenterLongLong: break; case ButtonPlusSingle: idxDec(); listIdxItems(); break; case ButtonPlusLong: idxFastDec(); listIdxItems(); break; case ButtonMinusSingle: idxInc(); listIdxItems(); break; case ButtonMinusLong: idxFastInc(); listIdxItems(); break; default: break; } idle_count = 0; } /* switch (vars->do_next_play) { case ImmediatePlay: vars->do_next_play = None; return randomSearch(USERCFG_PLAY_RAND_DEPTH); break; case TimeoutPlay: if (idle_count > USERCFG_PLAY_TM_NXT_PLY*OneSec) { vars->do_next_play = None; return nextPlay(); } break; default: break; } */ /* if (idle_count > USERCFG_GEN_TM_PWROFF*OneSec) { return getUIMode(PowerOffMode); } else if (idle_count > 5*OneSec) { file_menu_idle(); // for background sort } lcd.setBatteryVoltage(vars->bat_mv); */ idle_count++; return this; } void UIFileViewMode::entry(UIMode *prevMode) { UIMode::entry(prevMode); listIdxItems(); lcd.switchToListView(); } void UIFileViewMode::draw() { lcd.drawListView(); ui_clear_btn_evt(); } //==================================== // Implementation of UIPlayMode class //==================================== UIPlayMode::UIPlayMode(UIVars *vars) : UIMode("UIPlayMode", PlayMode, vars) { } UIMode* UIPlayMode::update() { vars->resume_ui_mode = ui_mode_enm; PlayAudio *codec = get_audio_codec(); if (ui_get_btn_evt(&btn_act)) { switch (btn_act) { case ButtonCenterSingle: codec->pause(!codec->isPaused()); break; case ButtonCenterDouble: vars->idx_play = 0; codec->stop(); vars->do_next_play = None; return getUIMode(FileViewMode); break; case ButtonCenterTriple: vars->do_next_play = ImmediatePlay; return getUIMode(FileViewMode); break; case ButtonCenterLong: //return getUIMode(ConfigMode); break; case ButtonCenterLongLong: break; case ButtonPlusSingle: case ButtonPlusLong: PlayAudio::volumeUp(); break; case ButtonMinusSingle: case ButtonMinusLong: PlayAudio::volumeDown(); break; default: break; } idle_count = 0; } /*if (codec->isPaused() && idle_count > USERCFG_GEN_TM_PWROFF*OneSec) { return getUIMode(PowerOffMode); } else */if (!codec->isPlaying()) { idle_count = 0; while (++vars->idx_play < file_menu_get_num()) { if (isAudioFile(vars->idx_play)) { play(); return this; } } vars->idx_play = 0; codec->stop(); vars->do_next_play = TimeoutPlay; return getUIMode(FileViewMode); } lcd.setVolume(PlayAudio::getVolume()); //lcd.setBitRate(codec->bitRate()); lcd.setPlayTime(codec->elapsedMillis()/1000, codec->totalMillis()/1000, codec->isPaused()); float levelL, levelR; codec->getLevel(&levelL, &levelR); lcd.setAudioLevel(levelL, levelR); //lcd.setBatteryVoltage(vars->bat_mv); idle_count++; return this; } #if 0 audio_codec_enm_t UIPlayMode::getAudioCodec(MutexFsBaseFile *f) { audio_codec_enm_t audio_codec_enm = CodecNone; bool flg = false; int ofs = 0; char str[256]; while (vars->idx_play + ofs < file_menu_get_num()) { file_menu_get_obj(vars->idx_play + ofs, f); f->getName(str, sizeof(str)); char* ext_pos = strrchr(str, '.'); if (ext_pos) { if (strncmp(ext_pos, ".mp3", 4) == 0 || strncmp(ext_pos, ".MP3", 4) == 0) { audio_codec_enm = CodecMp3; flg = true; break; } else if (strncmp(ext_pos, ".wav", 4) == 0 || strncmp(ext_pos, ".WAV", 4) == 0) { audio_codec_enm = CodecWav; flg = true; break; } else if (strncmp(ext_pos, ".m4a", 4) == 0 || strncmp(ext_pos, ".M4A", 4) == 0) { audio_codec_enm = CodecAac; flg = true; break; } else if (strncmp(ext_pos, ".flac", 5) == 0 || strncmp(ext_pos, ".FLAC", 5) == 0) { audio_codec_enm = CodecFlac; flg = true; break; } } ofs++; } if (flg) { file_menu_get_fname_UTF16(vars->idx_play + ofs, (char16_t *) str, sizeof(str)/2); Serial.println(utf16_to_utf8((const char16_t *) str).c_str()); vars->idx_play += ofs; } else { vars->idx_play = 0; } return audio_codec_enm; } #endif void UIPlayMode::readTag() { char str[256]; mime_t mime; ptype_t ptype; uint64_t img_pos; size_t size; bool is_unsync; int img_cnt = 0; // Read TAG file_menu_get_fname(vars->idx_play, str, sizeof(str)); tag.loadFile(str); // copy TAG text if (tag.getUTF8Track(str, sizeof(str))) { uint16_t track = atoi(str); sprintf(str, "%d/%d", track, vars->num_tracks); } else { sprintf(str, "%d/%d", vars->idx_play, vars->num_tracks); } lcd.setTrack(str); if (tag.getUTF8Title(str, sizeof(str))) { lcd.setTitle(str); } else { // display filename if no TAG file_menu_get_fname(vars->idx_play, str, sizeof(str)); lcd.setTitle(str); /* file_menu_get_fname_UTF16(vars->idx_play, (char16_t *) str, sizeof(str)/2); lcd.setTitle(utf16_to_utf8((const char16_t *) str).c_str(), utf8); */ } if (tag.getUTF8Album(str, sizeof(str))) lcd.setAlbum(str); else lcd.setAlbum(""); if (tag.getUTF8Artist(str, sizeof(str))) lcd.setArtist(str); else lcd.setArtist(""); //if (tag.getUTF8Year(str, sizeof(str))) lcd.setYear(str); else lcd.setYear(""); uint16_t idx = 0; while (idx < file_menu_get_num()) { if (file_menu_match_ext(idx, "jpg", 3) || file_menu_match_ext(idx, "JPG", 3) || file_menu_match_ext(idx, "jpeg", 4) || file_menu_match_ext(idx, "JPEG", 4)) { file_menu_get_fname(idx, str, sizeof(str)); lcd.setImageJpeg(str); break; } idx++; } return; // copy TAG image //lcd.deleteAlbumArt(); for (int i = 0; i < tag.getPictureCount(); i++) { if (tag.getPicturePos(i, &mime, &ptype, &img_pos, &size, &is_unsync)) { if (mime == jpeg) { /*lcd.addAlbumArtJpeg(vars->idx_play, img_pos, size, is_unsync); */img_cnt++; } else if (mime == png) { /*lcd.addAlbumArtPng(vars->idx_play, img_pos, size, is_unsync); */img_cnt++; } } } // if no AlbumArt in TAG, use JPEG or PNG in current folder if (img_cnt == 0) { uint16_t idx = 0; while (idx < file_menu_get_num()) { if (file_menu_match_ext(idx, "jpg", 3) || file_menu_match_ext(idx, "JPG", 3) || file_menu_match_ext(idx, "jpeg", 4) || file_menu_match_ext(idx, "JPEG", 4)) { file_menu_get_fname(idx, str, sizeof(str)); printf("JPEG %s\n", str); //lcd.addAlbumArtJpeg(idx, 0, f.fileSize()); img_cnt++; } else if (file_menu_match_ext(idx, "png", 3) || file_menu_match_ext(idx, "PNG", 3)) { //ilcd.addAlbumArtPng(idx, 0, f.fileSize()); img_cnt++; } idx++; } } } void UIPlayMode::play() { char str[FF_MAX_LFN]; file_menu_get_fname(vars->idx_play, str, sizeof(str)); printf("%s\n", str); PlayAudio *playAudio = get_audio_codec(); readTag(); playAudio->play(str); } void UIPlayMode::entry(UIMode *prevMode) { UIMode::entry(prevMode); //if (prevMode->getUIModeEnm() != ConfigMode) { play(); //} lcd.switchToPlay(); } void UIPlayMode::draw() { lcd.drawPlay(); ui_clear_btn_evt(); } #if 0 //======================================= // Implementation of UIConfigMode class //======================================= UIConfigMode::UIConfigMode(UIVars *vars) : UIMode("UIConfigMode", ConfigMode, vars), path_stack(NULL), idx_head(0), idx_column(0) { path_stack = stack_init(); } uint16_t UIConfigMode::getNum() { return (uint16_t) userConfig.getNum() + 1; } const char *UIConfigMode::getStr(uint16_t idx) { if (idx == 0) { return "[Back]"; } return userConfig.getStr((int) idx-1); } const uint8_t *UIConfigMode::getIcon(uint16_t idx) { const uint8_t *icon = NULL; if (idx == 0) { icon = ICON16x16_LEFTARROW; } else if (!userConfig.isSelection()) { icon = ICON16x16_GEAR; } else if (userConfig.selIdxMatched(idx-1)) { icon = ICON16x16_CHECKED; } return icon; } void UIConfigMode::listIdxItems() { for (int i = 0; i < vars->num_list_lines; i++) { if (idx_head+i >= getNum()) { lcd.setListItem(i, ""); // delete continue; } lcd.setListItem(i, getStr(idx_head+i), getIcon(idx_head+i), (i == idx_column)); } } void UIConfigMode::idxInc(void) { if (idx_head >= getNum() - vars->num_list_lines && idx_column == vars->num_list_lines-1) { return; } if (idx_head + idx_column + 1 >= getNum()) { return; } idx_column++; if (idx_column >= vars->num_list_lines) { if (idx_head + vars->num_list_lines >= getNum() - vars->num_list_lines) { idx_column = vars->num_list_lines-1; idx_head++; } else { idx_column = 0; idx_head += vars->num_list_lines; } } } void UIConfigMode::idxDec(void) { if (idx_head == 0 && idx_column == 0) { return; } if (idx_column == 0) { if (idx_head < vars->num_list_lines) { idx_column = 0; idx_head--; } else { idx_column = vars->num_list_lines-1; idx_head -= vars->num_list_lines; } } else { idx_column--; } } int UIConfigMode::select() { stack_data_t stack_data; if (idx_head + idx_column == 0) { if (userConfig.leave()) { stack_pop(path_stack, &stack_data); idx_head = stack_data.head; idx_column = stack_data.column; } else { return 0; // exit from Config } } else { if (userConfig.enter(idx_head + idx_column - 1)) { stack_data.head = idx_head; stack_data.column = idx_column; stack_push(path_stack, &stack_data); idx_head = 0; idx_column = 0; } } return 1; } UIMode* UIConfigMode::update() { if (ui_get_btn_evt(&btn_act)) { vars->do_next_play = None; switch (btn_act) { case ButtonCenterSingle: if (select()) { listIdxItems(); } else { return prevMode; } break; case ButtonCenterDouble: return prevMode; break; case ButtonCenterTriple: break; case ButtonCenterLong: break; case ButtonCenterLongLong: return getUIMode(PowerOffMode); break; case ButtonPlusSingle: case ButtonPlusLong: idxDec(); listIdxItems(); break; case ButtonMinusSingle: case ButtonMinusLong: idxInc(); listIdxItems(); break; default: break; } idle_count = 0; } if (idle_count > USERCFG_GEN_TM_CONFIG*OneSec) { return prevMode; } idle_count++; return this; } void UIConfigMode::entry(UIMode *prevMode) { UIMode::entry(prevMode); listIdxItems(); lcd.switchToListView(); } void UIConfigMode::draw() { lcd.drawListView(); ui_clear_btn_evt(); } //======================================= // Implementation of UIPowerOffMode class //======================================= UIPowerOffMode::UIPowerOffMode(UIVars *vars) : UIMode("UIPowerOffMode", PowerOffMode, vars) { } UIMode* UIPowerOffMode::update() { return this; } void UIPowerOffMode::entry(UIMode *prevMode) { UIMode::entry(prevMode); lcd.switchToPowerOff(vars->power_off_msg); lcd.drawPowerOff(); ui_terminate(vars->resume_ui_mode); } void UIPowerOffMode::draw() { } #endif
[ "elehobica@gmail.com" ]
elehobica@gmail.com
0c91f12f68904989d5447ebe505c896076a2c082
a6376e1ada58384cdc0065ce5a4a96728e84f04f
/SDK/include/voreen/core/interaction/trackballnavigation.h
2b68cbcc7ee099e2aa6deb3de12cf17923834586
[]
no_license
widVE/Voreen
be02bac44896e869a6af083c61729d5e154c28f1
c8a5c66f15d31f8177eeceefa19358f905870441
refs/heads/master
2021-08-17T23:46:19.556383
2020-06-22T20:21:11
2020-06-22T20:21:11
196,454,037
0
1
null
null
null
null
UTF-8
C++
false
false
14,110
h
/*********************************************************************************** * * * Voreen - The Volume Rendering Engine * * * * Copyright (C) 2005-2013 University of Muenster, Germany. * * Visualization and Computer Graphics Group <http://viscg.uni-muenster.de> * * For a list of authors please refer to the file "CREDITS.txt". * * * * This file is part of the Voreen software package. Voreen is free software: * * you can redistribute it and/or modify it under the terms of the GNU General * * Public License version 2 as published by the Free Software Foundation. * * * * Voreen 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 in the file * * "LICENSE.txt" along with this file. If not, see <http://www.gnu.org/licenses/>. * * * * For non-commercial academic use see the license exception specified in the file * * "LICENSE-academic.txt". To get information about commercial licensing please * * contact the authors. * * * ***********************************************************************************/ #ifndef VRN_TRACKBALL_NAVIGATION_H #define VRN_TRACKBALL_NAVIGATION_H #include "tgt/event/eventlistener.h" #include "tgt/vector.h" #include "tgt/event/mouseevent.h" #include "tgt/event/touchevent.h" #include "tgt/event/touchpoint.h" #include "tgt/glcanvas.h" #include "voreen/core/interaction/voreentrackball.h" #include "voreen/core/utils/voreenpainter.h" namespace tgt { class Camera; } namespace voreen { class CameraProperty; /** * A class that makes it possible to use a trackball-metaphor to rotate, zoom, shift, roll a dataset. */ class VRN_CORE_API TrackballNavigation : public tgt::EventListener { public: enum Mode { ROTATE_MODE, ZOOM_MODE, SHIFT_MODE, ROLL_MODE }; /** * The Constructor. * * @param camera the camera property that is to be modified by the navigation * @param minDist the minimum allowed orthogonal distance to the center of the trackball * @param maxDist the maximum allowed orthogonal distance to the center of the trackball */ TrackballNavigation(CameraProperty* cameraProperty, Mode mode = ROTATE_MODE, float minDist = 0.01f); virtual ~TrackballNavigation(); void setMode(Mode mode); Mode getMode() const; bool isTracking() { return tracking_; } /** * React to a press-Event. * * @param e The event to be processed. */ virtual void mousePressEvent(tgt::MouseEvent* e); /** * React to a touch press-Event. * * @param e The event to be processed. */ virtual void touchPressEvent(tgt::TouchEvent* e); /** * React to a touch release event. * * @param e The event to be processed. */ virtual void touchReleaseEvent(tgt::TouchEvent* e); /** * React to a touch move-Event. Actually this causes rotation or zoom. * * @param e The event to be processed. */ virtual void touchMoveEvent(tgt::TouchEvent* e); /** * React to a release event. * * @param e The event to be processed. */ virtual void mouseReleaseEvent(tgt::MouseEvent* e); /** * React to a move-Event. In this case, this actually causes the object to rotate. * * @param e The event to be processed. */ virtual void mouseMoveEvent(tgt::MouseEvent* e); /** * React to a double-click-Event. * * @param e The event to be processed. */ virtual void mouseDoubleClickEvent(tgt::MouseEvent* e); /** * React to a mouse-wheel-Event. * * @param e The event to be processed. */ virtual void wheelEvent(tgt::MouseEvent* e); /** * React to a time-Event. This does a number of things: * * - If necessary auto-spin the trackball. * - If the mouse-wheel was used, switch coarseness off after a certain amount of time. * - If auto-spinning of the trackball is active, don't spin the trackball if the user has * waited too long after moving the mouse. * * @param e The event to be processed. */ virtual void timerEvent(tgt::TimeEvent* e); /** * React to key event. */ virtual void keyEvent(tgt::KeyEvent* e); /** * Returns the internally used trackball. */ VoreenTrackball* getTrackball(); /** * Let trackball react on key pressures with rotating * @param acuteness The per-keypress angle of rotation will be smaller at greater acuteness. Use acuteness = 0.f to disable key rotation. * @param left, right, up, down keycode which should cause suitable rotation * @param mod which modifiers must be set * @param pressed rotate on key-pressed-event when true, on key-release-event when false * */ void setKeyRotate(float acuteness = 10.f, tgt::KeyEvent::KeyCode left = tgt::KeyEvent::K_LEFT, tgt::KeyEvent::KeyCode right = tgt::KeyEvent::K_RIGHT, tgt::KeyEvent::KeyCode up = tgt::KeyEvent::K_UP, tgt::KeyEvent::KeyCode down = tgt::KeyEvent::K_DOWN, int mod = tgt::Event::MODIFIER_NONE, bool pressed = false); /** * Let trackball react on key presses with moving * @param acuteness The per-keypress length of movement will be smaller at greater * acuteness. Use acuteness = 0.f to disable key rotation. * @param left, right, up, down keycode which should cause suitable movement * @param mod which modifiers must be set * @param pressed move on key-pressed-event when true, on key-release-event when false */ void setKeyMove(float acuteness = 100.f, tgt::KeyEvent::KeyCode left = tgt::KeyEvent::K_LEFT, tgt::KeyEvent::KeyCode right = tgt::KeyEvent::K_RIGHT, tgt::KeyEvent::KeyCode up = tgt::KeyEvent::K_UP, tgt::KeyEvent::KeyCode down = tgt::KeyEvent::K_DOWN, int mod = tgt::Event::SHIFT, bool pressed = false); /** * Defines the mouse zoom direction. * * @param zoomInDirection specifies in which direction mouse must be moved to zoom in. * The greater the length of this vector, the longer the way the mouse must be moved * to achieve a certain zoom factor. */ void setMouseZoom(tgt::vec2 zoomInDirection); /** * Defines mouse wheel zoom acuteness. * * @param acuteness The zoom factor will be smaller at greater acuteness. Use acuteness = 0.f to disable key rotation. * @param wheelUpZoomIn zoom in on wheel up and out on wheel down when true, otherwise when false */ void setMouseWheelZoom(float acuteness = 10.f, bool wheelUpZoomIn = true); /// @param acuteness The zoom factor will be smaller at greater acuteness. Use acuteness = 0.f to disable key rotation. void setKeyZoom(float acuteness = 10.f, tgt::KeyEvent::KeyCode in = tgt::KeyEvent::K_UP, tgt::KeyEvent::KeyCode out = tgt::KeyEvent::K_DOWN, int mod = tgt::Event::CTRL, bool pressed = false); /** * Defines the mouse roll acuteness. * * @param acuteness greater the acuteness means less tiling */ void setMouseRoll(float acuteness); /** * Defines the mouse wheel roll acuteness and direction. * * @param acuteness Less tiling at greater acuteness. Use acuteness = 0.f to disable key rotation. * @param wheelUpRollLeft roll left on wheel up and right on wheel down when true, otherwise when false */ void setMouseWheelRoll(float acuteness, bool wheelUpRollLeft = true); /// @param acuteness Less tiling at greater acuteness. Use acuteness = 0.f to disable key rotation. void setKeyRoll(float acuteness = 10.f, tgt::KeyEvent::KeyCode left = tgt::KeyEvent::K_LEFT, tgt::KeyEvent::KeyCode right = tgt::KeyEvent::K_RIGHT, int mod = tgt::Event::ALT, bool pressed = false); protected: void startMouseDrag(tgt::MouseEvent* eve); void endMouseDrag(tgt::MouseEvent* eve); /// The following functions may be used to rotate the Up-Vector about /// the Strafe- and the Look-Vector. Use this with care since it may /// leave the Camera with a "strange" orientation. void rollCameraVert(float angle); void rollCameraHorz(float angle); void initializeEventHandling(); /// scale screen-coodinates of mouse to intervall [-1, 1]x[-1, 1] tgt::vec2 scaleMouse(const tgt::ivec2& coords, const tgt::ivec2& viewport) const; float getRotationAngle(float acuteness) const; float getMovementLength(float acuteness) const; float getZoomFactor(float acuteness, bool zoomIn) const; float getRollAngle(float acuteness, bool left) const; /// Resets position and orientation of the trackball's camera to the initial parameters the camera had /// when passed to the trackball. /// Projective parameters (frustum) are not touched. virtual void resetTrackball(); CameraProperty* cameraProperty_; ///< Camera property that is modified VoreenTrackball* trackball_; ///< The trackball that is modified when navigating Mode mode_; ///< current trackball mode: rotate, zoom, shift, roll /// Last mouse coordinates to allow calculation of the relative change. /// Ought to be relative coordinates within range [-1, 1]x[-1, 1]. tgt::vec2 lastMousePosition_; // Last distance between two TouchPoints to allow calculation of zoomFactor float lastDistance_; // Last connection vector between two touch points tgt::vec2 lastConnection_; //float minDistance_; ///< minimal allowed orthogonal distance to center of trackball //float maxDistance_; ///< maximal allowed orthogonal distance to center of trackball (now retrieved from camera property) int wheelCounter_; ///< Counts how many time-ticks have passed since the mouse-wheel was used. int spinCounter_; ///< Counts how many time-ticks have passed since the trackball was spun. int moveCounter_; ///< Counts how many time-ticks have passed since the user has moved the mouse. int wheelID_; int spinID_; int moveID_; int overlayTimerID_; bool spinit_; ///< Helper member to control auto-spinning of trackball. bool trackballEnabled_; ///< Is the trackball enabled? bool tracking_; ///< Are we tracking mouse move events? Only when we received a mousePressEvent before. /// used to store settings how to react on certain events float keyRotateAcuteness_ ; ///< acuteness of rotation steps of key presses tgt::KeyEvent::KeyCode keyRotateLeft_ ; ///< at which key code rotate left tgt::KeyEvent::KeyCode keyRotateRight_ ; ///< at which key code rotate right tgt::KeyEvent::KeyCode keyRotateUp_ ; ///< at which key code rotate up tgt::KeyEvent::KeyCode keyRotateDown_ ; ///< at which key code rotate down int keyRotateMod_ ; ///< at which modifiers to rotate by keys bool keyRotatePressed_ ; float keyMoveAcuteness_ ; tgt::KeyEvent::KeyCode keyMoveLeft_ ; tgt::KeyEvent::KeyCode keyMoveRight_ ; tgt::KeyEvent::KeyCode keyMoveUp_ ; tgt::KeyEvent::KeyCode keyMoveDown_ ; int keyMoveMod_ ; bool keyMovePressed_ ; tgt::vec2 mouseZoomInDirection_ ; float mouseWheelZoomAcuteness_ ; bool mouseWheelUpZoomIn_ ; float keyZoomAcuteness_ ; tgt::KeyEvent::KeyCode keyZoomIn_ ; tgt::KeyEvent::KeyCode keyZoomOut_ ; int keyZoomMod_ ; bool keyZoomPressed_ ; float mouseRollAcuteness_ ; float mouseWheelRollAcuteness_ ; bool mouseWheelUpRollLeft_ ; float keyRollAcuteness_ ; tgt::KeyEvent::KeyCode keyRollLeft_ ; tgt::KeyEvent::KeyCode keyRollRight_ ; int keyRollMod_ ; bool keyRollPressed_ ; tgt::MouseEvent::MouseButtons resetButton_ ; ///< If this button is double-clicked, reset trackball to initial /// position and orientation static const std::string loggerCat_; }; } // namespace #endif //VRN_TRACKBALL_NAVIGATION_H
[ "kalimi@wisc.edu" ]
kalimi@wisc.edu
482f4cae26b6ce88e30e5e850f9e4ff338c5e735
f8770867dcbe75666fdbd68194d88c75935ab5a6
/proves3/proves3/Point.h
c13f7195d78ed4e608cbd080e2f8142e648fbbc3
[]
no_license
weprikjm/Point2D
f85c4005d8e4da5f716aa851ef1f3cf9c3833fc3
afd6101d1d486c821eaeb0da3d251c4aaf9aca29
refs/heads/master
2020-06-10T17:06:17.693876
2015-10-05T15:55:39
2015-10-05T15:55:39
43,690,942
0
1
null
null
null
null
UTF-8
C++
false
false
310
h
class Point { public: int x,y; Point operator=(Point& p); bool operator==(Point& p)const; bool operator!=(Point& p)const; Point operator+=(Point& p); Point operator-=(Point& p); Point operator+(Point& p)const; Point operator-(Point& p)const; bool IsZero()const; void SetZero(); void Negate(); };
[ "ruben.idigora@gmail.com" ]
ruben.idigora@gmail.com
c5f4bb56552416aa9db9d99b7896dc7fc227a559
7d7301514d34006d19b2775ae4f967a299299ed6
/leetcode/tree/958.isCompleteTree.cpp
c812006aea9ade2ae62a7d4210abb205c6326bfc
[]
no_license
xmlb88/algorithm
ae83ff0e478ea01f37bc686de14f7d009d45731b
cf02d9099569e2638e60029b89fd7b384f3c1a68
refs/heads/master
2023-06-16T00:21:27.922428
2021-07-17T03:46:50
2021-07-17T03:46:50
293,984,271
1
0
null
2020-12-02T09:08:28
2020-09-09T02:44:20
C++
UTF-8
C++
false
false
917
cpp
#include <iostream> #include <vector> #include <cmath> #include <queue> #include "treeNode.h" using namespace std; bool isCompleteTree(TreeNode* root) { queue<TreeNode*> q; q.push(root); int level = 0; while (!q.empty()) { int size = q.size(); bool has_null = false, has_next = false; for (int i = 0; i < size; ++i) { TreeNode* node = q.front(); q.pop(); if ((node -> left || node -> right) && has_null) return false; if (!node -> left && node -> right) return false; if (!node -> left || !node -> right) has_null = true; if (node -> left || node -> right) has_next = true; if (node -> left) q.push(node -> left); if (node -> right) q.push(node -> right); } if (has_next && size != pow(2, level)) return false; ++level; } return true; } // TODO:
[ "xmlb@gmail.com" ]
xmlb@gmail.com
e8d9645ec32dac680bb42dfcaeb42ee8c1d50db7
7f62f204ffde7fed9c1cb69e2bd44de9203f14c8
/DboServer/Server/GameServer/BotAiCondition_ScanTarget.cpp
eeee73f2a1ef79a614ac589ab1ef799254fc5705
[]
no_license
4l3dx/DBOGLOBAL
9853c49f19882d3de10b5ca849ba53b44ab81a0c
c5828b24e99c649ae6a2953471ae57a653395ca2
refs/heads/master
2022-05-28T08:57:10.293378
2020-05-01T00:41:08
2020-05-01T00:41:08
259,094,679
3
3
null
2020-04-29T17:06:22
2020-04-26T17:43:08
null
UTF-8
C++
false
false
1,914
cpp
#include "stdafx.h" #include "BotAiCondition_ScanTarget.h" #include "ObjectManager.h" #include "char.h" #include "NtlPacketGU.h" CBotAiCondition_ScanTarget::CBotAiCondition_ScanTarget(CNpc* pBot, CBotAiCondition_ScanTarget::eBOTAI_SMARTSCAN_TYPE eSmartScantype, BYTE bySmartLevel) :CBotAiCondition(pBot, BOTCONTROL_CONDITION_SCAN_TARGET, "BOTCONTROL_CONDITION_SCAN_TARGET") { m_dwTime = 0; m_bySmartScantype = (BYTE)eSmartScantype; m_bySmartLevel = bySmartLevel; } CBotAiCondition_ScanTarget::~CBotAiCondition_ScanTarget() { } void CBotAiCondition_ScanTarget::OnEnter() { this->m_dwTime = 1000; } int CBotAiCondition_ScanTarget::OnUpdate(DWORD dwTickDiff, float fMultiple) { m_dwTime = UnsignedSafeIncrease<DWORD>(m_dwTime, dwTickDiff); if (m_dwTime >= 1000) { m_dwTime = 0; if (ScanTarget(m_bySmartScantype == BOTAI_SMARTSCAN_UNDER)) return CHANGED; } return m_status; } bool CBotAiCondition_ScanTarget::ScanTarget(bool bSmartOffence) { HOBJECT hTarget = GetBot()->ConsiderScanTarget(INVALID_WORD); if (hTarget == INVALID_HOBJECT) return false; CCharacter* pTargetBot = g_pObjectManager->GetChar(hTarget); if (!pTargetBot) return false; if (bSmartOffence) { if (GetBot()->GetLevel() - m_bySmartLevel < pTargetBot->GetLevel()) return false; } if (GetBot()->GetTargetListManager()->GetAggroCount() == 0) { pTargetBot->ResetMeAttackBot(); CNtlPacket packet(sizeof(sGU_BOT_BOTCAUTION_NFY)); sGU_BOT_BOTCAUTION_NFY* res = (sGU_BOT_BOTCAUTION_NFY *)packet.GetPacketData(); res->wOpCode = GU_BOT_BOTCAUTION_NFY; res->hBot = GetBot()->GetID(); packet.SetPacketLen(sizeof(sGU_BOT_BOTCAUTION_NFY)); GetBot()->Broadcast(&packet); } DWORD dwAggroPoint = GetBot()->GetTbldat()->wBasic_Aggro_Point + 1; GetBot()->GetTargetListManager()->AddAggro(hTarget, dwAggroPoint, false); GetBot()->GetBotController()->AddControlState_Fight(hTarget); return true; }
[ "64261665+dboguser@users.noreply.github.com" ]
64261665+dboguser@users.noreply.github.com
c4f3fbda381fbb580302b53e1f581da67aece6a8
b920e8e33d1ba49fbf04c619608f230f2ea6a23f
/nurbs2.cpp
5108a4fea66ced4d78a4cf58ae873f8358056d09
[]
no_license
qiuyingyue/project
1ae349d70bf77edd0a20fdafb3d74419c70dbfe8
909d8498cf4e4fe2a3ef26b275180858a7fe5b67
refs/heads/master
2020-12-25T17:03:41.467017
2016-01-11T15:05:25
2016-01-11T15:05:25
null
0
0
null
null
null
null
WINDOWS-1252
C++
false
false
3,624
cpp
// // nurbs2.cpp // opengltest // // Created by Victor Young on 1/10/16. // Copyright (c) 2016 Victor Young. All rights reserved. // //see http://www.glprogramming.com/red/chapter12.html #include"nurbs.h" #include <stdlib.h> #include"CGdrive.h" GLfloat ctrlpoints[5][5][3] = { { { -5, 0, 0 }, { -3, 0, 0 }, {-1, 0, 0 }, { 1, 0, 0 }, { 3, 0, 0 } }, { { -5, 0, -1 }, { -3, 0, -1 },{ -1, 0, -1 },{ 1, 0, -1 }, { 3, 0, -1 } }, { { -5, 0, -2 }, { -3, 0, -2 },{ -1, 0, -2 },{ 1, 0, -2 }, { 3, 0, -2 } }, { { -5, 0, -3 }, { -3, 0, -3 },{ -1, 0, -3 },{ 1, 0, -3 }, { 3, 0, -3 } }, { { -5, 0, -4 }, { -3, 0, -4 },{ -1, 0, -4 },{ 1, 0, -4 }, { 3, 0, -4 } } };// bool showPoints = false; float initheta = 0; GLUnurbsObj *theNurb; void init_surface(void) { int u, v; /* for (u = 0; u < 4; u++) { for (v = 0; v < 4; v++) { ctlpoints[u][v][0] = 2.0*((GLfloat)u - 1.5); ctlpoints[u][v][1] = 2.0*((GLfloat)v - 1.5); if ( (u == 1 || u == 2) && (v == 1 || v == 2)) ctlpoints[u][v][2] = 3.0; else ctlpoints[u][v][2] = -3.0; } }*/ //¿ØÖƵã } void wave(void){ initheta += 0.005; float ph1 = 3.1415 /4; float ph2 = 3.1415 / 6; //printf("%lf,", err); if (initheta > 3.1415*2)initheta = 0; for (int i = 0; i < 5; i++){ for (int j = 0; j < 5; j++){ float ratio = j / 5.0*1.5; srand(time(0)*i*j); float err = ((float)rand() / RAND_MAX); ctrlpoints[i][j][1] = sin(initheta + ph1 *j + ph2*i + err)*(1+cos(initheta + ph1 *j + ph2*i + err))*ratio; } } } void initNurbs(void) { GLfloat mat_diffuse[] = { 0.7, 0.7, 0.7, 1.0 }; GLfloat mat_specular[] = { 1.0, 1.0, 1.0, 1.0 }; GLfloat mat_shininess[] = { 100.0 }; glClearColor (0.0, 0.0, 0.0, 0.0); glMaterialfv(GL_FRONT, GL_DIFFUSE, mat_diffuse); glMaterialfv(GL_FRONT, GL_SPECULAR, mat_specular); glMaterialfv(GL_FRONT, GL_SHININESS, mat_shininess); glEnable(GL_LIGHTING); glEnable(GL_LIGHT0); glEnable(GL_DEPTH_TEST); glEnable(GL_AUTO_NORMAL); glEnable(GL_NORMALIZE); init_surface(); theNurb = gluNewNurbsRenderer(); gluNurbsProperty(theNurb, GLU_SAMPLING_TOLERANCE, 25.0); gluNurbsProperty(theNurb, GLU_DISPLAY_MODE, GLU_FILL); //gluNurbsCallback(theNurb, GLU_ERROR, // (GLvoid (*)()) nurbsError); } void drawNurb(void) { //GLfloat knots[6] = {0.0, 0.0, 0.0, 1.0, 1.0, 1.0}; GLfloat knots[10] = { 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0, 1.0 }; int i, j; //glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glPushMatrix(); glRotatef(90.0, 1.,0.,0.); //glTranslatef(5.0,0, 5.0); glScalef (0.2, 0.2, 0.2); gluBeginSurface(theNurb); /* gluNurbsSurface(theNurb, 8, knots, 8, knots, 4 * 3, 3, &ctlpoints[0][0][0], 4, 4, GL_MAP2_VERTEX_3);*/ gluNurbsSurface(theNurb, 10, knots, 10, knots, 5 * 3, 3, &ctrlpoints[0][0][0], 5, 5, GL_MAP2_VERTEX_3); //gluNurbsSurface(theNurb, 6, knots, 6, knots, 3 * 3, 3, &ctrlpoints[0][0][0], 3, 3, GL_MAP2_VERTEX_3); gluEndSurface(theNurb); if (showPoints) { glPointSize(5.0); glDisable(GL_LIGHTING); glColor3f(1.0, 1.0, 0.0); glBegin(GL_POINTS); for (i = 0; i <5; i++) { for (j = 0; j < 5; j++) { glVertex3f(ctrlpoints[i][j][0], ctrlpoints[i][j][1], ctrlpoints[i][j][2]); } } glEnd(); glEnable(GL_LIGHTING); } glPopMatrix(); }
[ "842752622@qq.com" ]
842752622@qq.com
3d4df29ce10f64949652539c76e6d6a32baae6fd
8d291265155434ea3ddda7276a343911e3c1f7b1
/Lecture 26/generic_graph.cpp
f926e314c2915e3564059e0c3e0bce493ccb332e
[]
no_license
sanjeetboora/Launchpad-Pitampura-10June
497a1d6c85ca7c3c7797416be2f134eefff72960
73a2b3d347dc2aa24eabb5871e9cd132d6715ee7
refs/heads/master
2020-06-07T07:40:55.563462
2019-08-01T12:34:11
2019-08-01T12:34:11
192,963,671
1
0
null
2019-08-01T11:32:50
2019-06-20T17:45:55
C++
UTF-8
C++
false
false
2,493
cpp
#include <iostream> #include <list> #include <map> #include <queue> #include <climits> using namespace std; template <typename T> class Graph{ map<T, list<T> > adjList; void dfsHelper(T node,map<T,bool> &visited){ cout<<node<<" "; visited[node] = true; for(auto neighbour:adjList[node]){ if(!visited[neighbour]){ dfsHelper(neighbour,visited); } } } public: void addEdge(T u,T v, bool bidir = true){ adjList[u].push_back(v); if(bidir){ adjList[v].push_back(u); } } void display(){ for(auto vertex:adjList){ cout<<vertex.first<<" -> "; for(auto neighbour:vertex.second){ cout<<neighbour<<","; } cout<<endl; } } void bfs(T src){ queue<T> q; map<T,bool> visited; q.push(src); visited[src] = true; while(!q.empty()){ T temp = q.front(); cout<<temp<<" "; q.pop(); for(auto neighbour:adjList[temp]){ if(!visited[neighbour]){ q.push(neighbour); visited[neighbour] = true; } } } cout<<endl; } void bfs_shortestPath(T src){ queue<T> q; map<T,int> dist; for(auto vertex:adjList){ dist[vertex.first] = INT_MAX; } dist[src] = 0; q.push(src); while(!q.empty()){ T temp = q.front(); q.pop(); for(auto neighbour:adjList[temp]){ if(dist[neighbour]==INT_MAX){ dist[neighbour] = dist[temp] + 1; q.push(neighbour); } } } for(auto vertex:adjList){ cout<<"Distance of "<<vertex.first<<" from "<<src<<" is "<<dist[vertex.first]<<endl; } } void dfs(T src){ map<T,bool> visited; dfsHelper(src,visited); cout<<endl; } bool isCyclicBFS(T src){ queue<T> q; map<T,bool> visited; map<T,T> parent; q.push(src); visited[src] = true; parent[src] = src; while(!q.empty()){ T temp = q.front(); q.pop(); for(auto neighbour:adjList[temp]){ if(visited[neighbour] and parent[temp] != neighbour){ return true; }else if(!visited[neighbour]){ q.push(neighbour); visited[neighbour] = true; parent[neighbour] = temp; } } } return false; } }; int main(){ // Graph<int> g; // g.addEdge(1,2); // g.addEdge(1,3); // g.addEdge(1,5); // g.addEdge(2,3); // g.addEdge(3,4); // g.addEdge(4,5); // g.display(); // g.bfs(1); Graph<int> g; g.addEdge(1,2); g.addEdge(1,3); g.addEdge(1,4); g.addEdge(2,3); g.addEdge(3,5); g.addEdge(4,5); g.addEdge(5,6); cout<<g.isCyclicBFS(1)<<endl; // g.display(); // g.bfs_shortestPath(1); // g.dfs(1); return 0; }
[ "pranav.khandelwal@lifcare.in" ]
pranav.khandelwal@lifcare.in
943ffac4260a69a32c3d8c3900b5c09571053eec
68113737651a9856a703860e8e81e4c9da5073cf
/Chess/Camera.h
6c3a18df25145cbba43db7ea34d09667bba634ae
[]
no_license
stefano9o/chess_game
2983dbfc30283d025e42f34eb017b9d46b8bdb3a
e00cbbe1654a24fc056290ad8f202de49e4b9bdb
refs/heads/master
2021-01-17T23:55:30.448921
2017-03-13T20:08:32
2017-03-13T20:08:32
84,234,777
0
0
null
null
null
null
UTF-8
C++
false
false
2,133
h
#ifndef CAMERA_H #define CAMERA_H // Std. Includes #include <vector> // GL Includes #include <GL\glew.h> #include <glm/glm.hpp> #include <glm/gtc/matrix_transform.hpp> // Defines several possible options for camera movement. Used as abstraction to stay away from window-system specific input methods enum Camera_Movement { FORWARD, BACKWARD, LEFT, RIGHT }; // An abstract camera class that processes input and calculates the corresponding Eular Angles, Vectors and Matrices for use in OpenGL class Camera{ public: // Constructor with vectors Camera(glm::vec3 position = glm::vec3(0.0f, 0.0f, 0.0f), glm::vec3 up = glm::vec3(0.0f, 1.0f, 0.0f), GLfloat yaw = -90.0f, GLfloat pitch = 0.0f); // Constructor with scalar values Camera(GLfloat posX, GLfloat posY, GLfloat posZ, GLfloat upX, GLfloat upY, GLfloat upZ, GLfloat yaw, GLfloat pitch); // Returns the view matrix calculated using Eular Angles and the LookAt Matrix glm::mat4 getViewMatrix(); // Processes input received from any keyboard-like input system. Accepts input parameter in the form of camera defined ENUM (to abstract it from windowing systems) void processKeyboard(Camera_Movement direction, GLfloat deltaTime); // Processes input received from a mouse input system. Expects the offset value in both the x and y direction. void processMouseMovement(GLfloat xoffset, GLfloat yoffset, GLboolean constrainPitch = true); // Processes input received from a mouse scroll-wheel event. Only requires input on the vertical wheel-axis void processMouseScroll(GLfloat yoffset); GLfloat getZoom(); glm::vec3 getPosition(); void updateCamera(glm::vec3 position = glm::vec3(0.0f, 0.0f, 0.0f), glm::vec3 up = glm::vec3(0.0f, 1.0f, 0.0f), GLfloat yaw = -90.0f, GLfloat pitch = 0.0f); private: // Calculates the front vector from the Camera's (updated) Eular Angles void updateCameraVectors(); // Camera Attributes glm::vec3 position; glm::vec3 front; glm::vec3 up; glm::vec3 right; glm::vec3 worldUp; // Eular Angles GLfloat yaw; GLfloat pitch; // Camera options GLfloat movementSpeed; GLfloat mouseSensitivity; GLfloat zoom; }; #endif
[ "stefano.galeano@gmail.com" ]
stefano.galeano@gmail.com
037613bd2d78379c84cfaac6b7a28e62a83d89cb
9c9632cc91135b1bc7222f60bda99a5da4018f85
/02.Product/Cloud/Cpp/Devmgr/tags/dev_crs_net/V4.2.5/build/linux/sredisdll/include/sredisdll.h
7312f9fb957b378a084484b43669cf897dd88d3a
[]
no_license
lltxwdk/testgame
eb71624141f85f6aabcae85b417ab6aa286403fb
1cc55d9d2a25594818cfe365c0dcc0b476e9053e
refs/heads/master
2022-08-01T05:24:48.024701
2020-05-24T05:07:59
2020-05-24T05:07:59
187,604,627
0
0
null
null
null
null
GB18030
C++
false
false
5,701
h
// The following ifdef block is the standard way of creating macros which make exporting // from a DLL simpler. All files within this DLL are compiled with the SREDISDLL_EXPORTS // symbol defined on the command line. this symbol should not be defined on any project // that uses this DLL. This way any other project whose source files include this file see // SREDISDLL_API functions as being imported from a DLL, whereas this DLL sees symbols // defined with this macro as being exported. #ifndef __SR_REDISDLL_I_H__ #define __SR_REDISDLL_I_H__ #include <vector> #include <set> #include <string.h> #include <string> #include <map> using namespace std; #ifdef __cplusplus extern "C" { #endif #ifdef LINUX #define __stdcall #endif #ifdef SREDISDLL_EXPORTS #define SREDISDLL_API __declspec(dllexport) #else #define SREDISDLL_API #endif // This class is exported from the sredisdll.dll namespace ISREDIS { typedef struct CNETMPLOAD { int deviceid; unsigned long long load; }CNetMpLoad; typedef struct CVALUESCORE { char value[256]; char score[256]; }ValueScores; typedef struct CHKEYS { char filed[256]; }CHKeys; typedef struct CDEVICEID { int deviceid; }CDeviceID; //串口观察者接口 class ICsredisSink { public: }; typedef struct REDIS_DATA_ITEM_ { int type; std::string str; REDIS_DATA_ITEM_& operator=(const REDIS_DATA_ITEM_ &data) { type = data.type; str = data.str; return *this; } }RedisDataItem; typedef std::vector<RedisDataItem> RedisReplyData; typedef RedisReplyData RedisReplyArray; typedef std::string REDISKEY; typedef std::string REDISVALUE; typedef std::vector<REDISKEY> REDISVKEYS; typedef REDISVKEYS REDISFILEDS; typedef std::vector<REDISVALUE> REDISVALUES; typedef std::vector<std::string> REDISVDATA; typedef std::set<std::string> REDISSETDATA; typedef std::map<std::string, RedisDataItem> RedisReplyKeyValuePair; class ICsredis { public: // TODO: add your methods here. virtual bool connect(const char* host, int port = 6379) = 0; virtual bool isconnectok() = 0; virtual void disconnect() = 0; virtual void flushall() = 0; //获取指定key值 virtual char* getvalue(const char* key) = 0; //获取指定key值 virtual char* getvalue(const char* key, const char* number) = 0; //获取指定key值 virtual bool setvalue(const char* key, const char* value) = 0; //设置指定key值 virtual bool setvalue(const char* key, const char* score, const char* number) = 0; //设定key sort set值 virtual bool sethashvalue(const char* key, const char* score, const char* number) = 0; //设定key sort set值 virtual char* gethashvalue(const char* key, const char* score) = 0; virtual bool selectdb(const int dbnum) = 0; //切换数据库 virtual bool pingpong() = 0; // 探测连接是否正常 virtual bool deletevalue(const char* key) = 0; //删除值 virtual bool deletevalue(const char* key, const char* number) = 0; //删除值 virtual bool deletehashvalue(const char* key, const char* number) = 0; //删除值 virtual bool existsvalue(const char* key) = 0; //判断值是否存在 virtual long long getdbnum(const char* key) = 0; //获取指定数据库关键词内容长度 virtual int getdbdata(const char* key, int start, int stop, CNetMpLoad** load, const int getvcnum) = 0; //获取指定数据库关键词内容 virtual int getzsetdata(const char* key, int start, int stop, ValueScores** valuescores, const int getvcnum) = 0; //获取指定数据库关键词zset内容 virtual int getdbdata(const char* key, char* id, unsigned long long& load) = 0; //获取指定数据库关键词内容 virtual int getdbdata(const char* key, CDeviceID** id, const int getvcnum) = 0; //获取指定数据库关键词内容 virtual long long gethashfiledsnum(const char* key) = 0; //获取指定数据库关键词内容长度 virtual int gethashdbdata(const char* key, CHKeys** fileds, const int filedsnum) = 0; //获取指定数据库关键词内容 virtual bool listLPush(const char* key, const char* value) = 0;// virtual char* listRPop(const char* key) = 0; virtual long long listLLen(const char* key) = 0; virtual bool hashHMSet(const string& key, const REDISVDATA& vData) = 0; // HMSET virtual bool hashHMGet(const string& key, const REDISFILEDS& fileds, RedisReplyArray& rArray) = 0; // HMGET virtual bool hashHMGet(const string& key, const REDISFILEDS& fileds, RedisReplyKeyValuePair& mPair) = 0; // HMGET //virtual bool hashHGetAll(const string& key, RedisReplyArray& rArray) = 0; // HGETALL virtual bool hashHGetAll(const char* key, RedisReplyArray& rArray) = 0; virtual ~ICsredis(){} }; /** * @function CreateIRedis * @abstract 创建对象 * @param * @pSink * @return ISREDIS* */ SREDISDLL_API ICsredis* CreateIRedis(ICsredisSink* pcSink); /** * @function CreateRedisInstanceList * @abstract 创建对象 * @param * @pSink * @return ISREDIS* */ SREDISDLL_API ICsredis** CreateRedisInstanceList(ICsredisSink* pcSink, unsigned int uiRedisConnNum); /** * @function DeleteIRedis * @abstract 删除对象 * @param * @return 无 */ SREDISDLL_API void DeleteIRedis(ICsredis* pIRedis); /** * @function DeleteRedisInstanceList * @abstract 删除对象 * @param * @return 无 */ SREDISDLL_API void DeleteRedisInstanceList(ICsredis** pIRedis, unsigned int uiRedisConnNum); } #ifdef __cplusplus } #endif #endif //__SR_REDISDLL_I_H__
[ "375563752@qq.com" ]
375563752@qq.com
de9b1777207cbdb3fe3e0b4d2bfd789680d545fd
a949ca5fd781f526ad292992fd47f4b8bd973d9e
/RAVULA/ARRAY/1.LINEAR SEARCH.cpp
b4d278a342700662fbb84b24ac9b5c268e70443d
[ "MIT" ]
permissive
scortier/Complete-DSA-Collection
8f20e56b18e4a552aebd04964e8365e01eba5433
925a5cb148d9addcb32192fe676be76bfb2915c7
refs/heads/main
2023-05-14T14:24:21.678887
2021-06-06T18:59:01
2021-06-06T18:59:01
307,963,617
4
1
null
null
null
null
UTF-8
C++
false
false
1,533
cpp
// QUARANTINE DAYS..;) #include <bits/stdc++.h> using namespace std; #define endl "\n" #define test long long int tt;cin>>tt;while(tt--) #define rep(i,a,b) for(long long int i=a;i<b;i++) #define rev(i,a,b) for(long long int i=b-1;i>=a;i--) #define reep(i,a,b) for(long long int i=a;i<=b;i++) #define ll long long int #define pb push_back #define mp make_pair #define f first #define s second #define MOD 1000000007 #define PI acos(-1.0) #define assign(x,val) memset(x,val,sizeof(x)) #define prec(val, dig) fixed << setprecision(dig) << val #define vec vector < ll > #define vecpi vector < pair < ll, ll > > #define pi pair < ll , ll > #define lower(str) transform(str.begin(), str.end(), str.begin(), ::tolower); #define upper(str) transform(str.begin(), str.end(), str.begin(), ::toupper); #define mk(arr,n,type) type *arr=new type[n]; const int maxm = 2e6 + 10; void fast() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); #ifndef ONLINE_JUDGE freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif } /**********====================########################=================***********/ // TC:O(N) // SC:O(N) due to array int linearSearch(int a[], int n, int target) { for (int i = 0; i < n; i++) { if (a[i] == target) return i; } return -1; } int32_t main() { fast(); int n, t; cin >> n >> t; int arr[n]; rep(i, 0, n) cin >> arr[i]; cout << linearSearch(arr, n, t); return 0; }
[ "onlytoaditya@gmail.com" ]
onlytoaditya@gmail.com
b81b6d3f967d2b98682cc6784fa228a8ade24925
957a80ea22c5abb4f4670b250d55534d9db99108
/src/library/compiler/reduce_arity.h
75978588d42e0bc25ddd1e2328c2afef80b91f4f
[ "Apache-2.0" ]
permissive
GaloisInc/lean
aa1e64d604051e602fcf4610061314b9a37ab8cd
f1ec117a24459b59c6ff9e56a1d09d9e9e60a6c0
refs/heads/master
2020-06-15T06:35:09.807322
2017-09-05T15:13:07
2017-09-05T15:13:07
75,319,626
2
1
Apache-2.0
2018-10-11T20:36:04
2016-12-01T18:15:04
C++
UTF-8
C++
false
false
750
h
/* Copyright (c) 2016 Microsoft Corporation. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Author: Leonardo de Moura */ #pragma once #include "kernel/environment.h" #include "library/compiler/procedure.h" namespace lean { /** \brief Try to reduce the arity of auxiliary declarations in procs. It assumes all but the last entry are auxiliary declarations. \remark This procedure assumes rec_fn_macro has already been eliminated. The procedure erase_irrelevant can be used to accomplish that. \remark This step does not rely on type information. That is, the input expressions don't need to be type checkable. */ void reduce_arity(environment const & env, buffer<procedure> & procs); }
[ "leonardo@microsoft.com" ]
leonardo@microsoft.com
85b4638ab6121c25772d841d1e885976c205db22
144138ef6a25005fba1ff74ce20d490bbc5edc97
/examples/node_modules/canvas/src/Canvas.h
f5b3740aa3c49de797fe0ddc58a7f93e66e036f1
[ "MIT", "WTFPL", "BSD-2-Clause" ]
permissive
tmcw/k-means
642965268ead937f10f3bb04b530b62cdc4e0375
7b8c4e40354ba46c381d1346c65bb4e647ba7604
refs/heads/master
2021-01-10T21:27:14.320170
2015-05-19T02:19:49
2015-05-19T02:19:49
5,286,199
15
3
null
null
null
null
UTF-8
C++
false
false
2,269
h
// // Canvas.h // // Copyright (c) 2010 LearnBoost <tj@learnboost.com> // #ifndef __NODE_CANVAS_H__ #define __NODE_CANVAS_H__ #include <v8.h> #include <node.h> #include <node_object_wrap.h> #include <node_version.h> #include <cairo/cairo.h> using namespace v8; using namespace node; /* * Maxmimum states per context. * TODO: remove/resize */ #ifndef CANVAS_MAX_STATES #define CANVAS_MAX_STATES 64 #endif /* * Canvas types. */ typedef enum { CANVAS_TYPE_IMAGE, CANVAS_TYPE_PDF } canvas_type_t; /* * Canvas. */ class Canvas: public node::ObjectWrap { public: int width; int height; canvas_type_t type; static Persistent<FunctionTemplate> constructor; static void Initialize(Handle<Object> target); static Handle<Value> New(const Arguments &args); static Handle<Value> ToBuffer(const Arguments &args); static Handle<Value> GetType(Local<String> prop, const AccessorInfo &info); static Handle<Value> GetWidth(Local<String> prop, const AccessorInfo &info); static Handle<Value> GetHeight(Local<String> prop, const AccessorInfo &info); static void SetWidth(Local<String> prop, Local<Value> val, const AccessorInfo &info); static void SetHeight(Local<String> prop, Local<Value> val, const AccessorInfo &info); static Handle<Value> StreamPNGSync(const Arguments &args); static Handle<Value> StreamJPEGSync(const Arguments &args); static Local<Value> Error(cairo_status_t status); #if NODE_VERSION_AT_LEAST(0, 6, 0) static void ToBufferAsync(uv_work_t *req); static void ToBufferAsyncAfter(uv_work_t *req); #else static #if NODE_VERSION_AT_LEAST(0, 5, 4) void #else int #endif EIO_ToBuffer(eio_req *req); static int EIO_AfterToBuffer(eio_req *req); #endif inline bool isPDF(){ return CANVAS_TYPE_PDF == type; } inline cairo_surface_t *surface(){ return _surface; } inline void *closure(){ return _closure; } inline uint8_t *data(){ return cairo_image_surface_get_data(_surface); } inline int stride(){ return cairo_image_surface_get_stride(_surface); } Canvas(int width, int height, canvas_type_t type); void resurface(Handle<Object> canvas); private: ~Canvas(); cairo_surface_t *_surface; void *_closure; }; #endif
[ "tom@macwright.org" ]
tom@macwright.org
6b993bfe7c387e1fbab7c68d7ea51e0d7445c668
4352b5c9e6719d762e6a80e7a7799630d819bca3
/tutorials/eulerVortex.twitch/eulerVortex.cyclic.twitch.test.test/processor0/3.86/e
363b0f75a1ce3c072ff18fc5cac325b11ad9931a
[]
no_license
dashqua/epicProject
d6214b57c545110d08ad053e68bc095f1d4dc725
54afca50a61c20c541ef43e3d96408ef72f0bcbc
refs/heads/master
2022-02-28T17:20:20.291864
2019-10-28T13:33:16
2019-10-28T13:33:16
184,294,390
1
0
null
null
null
null
UTF-8
C++
false
false
49,000
/*--------------------------------*- C++ -*----------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org \\ / A nd | Version: 6 \\/ M anipulation | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class volScalarField; location "3.86"; object e; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [0 2 -2 0 0 0 0]; internalField nonuniform List<scalar> 5625 ( 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.31 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.31 1006.31 1006.31 1006.31 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.31 1006.31 1006.31 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.31 1006.31 1006.31 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.3 1006.31 1006.31 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.31 1006.31 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.3 1006.31 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.28 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.31 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.28 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.28 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 ) ; boundaryField { emptyPatches_empt { type empty; } top_cyc { type cyclic; } bottom_cyc { type cyclic; } inlet_cyc { type cyclic; } outlet_cyc { type cyclic; } procBoundary0to1 { type processor; value nonuniform List<scalar> 75 ( 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.31 1006.3 1006.3 1006.3 1006.3 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 ) ; } procBoundary0to1throughinlet_cyc { type processorCyclic; value nonuniform List<scalar> 75 ( 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 ) ; } procBoundary0to2 { type processor; value nonuniform List<scalar> 75 ( 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.3 1006.3 1006.31 1006.31 1006.31 1006.32 1006.31 ) ; } procBoundary0to2throughbottom_cyc { type processorCyclic; value nonuniform List<scalar> 75 ( 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 1006.29 ) ; } } // ************************************************************************* //
[ "tdg@debian" ]
tdg@debian
4cca9237f2ba51519a370b62f8504b5177ea13ab
400d08ce40087beb18f59eefef794b403527aea6
/test/test_detred_opadd.cpp
51b096115d8c81aab482f122fef9958d44fd87d0
[ "BSD-3-Clause" ]
permissive
sukhaj/CilkpubV2
dd96e979f23579578d7820b4e00c9ffaf5509f29
b494e0e463222c5571153eb1176664892df356b9
refs/heads/master
2021-05-15T10:49:50.837422
2017-10-24T02:59:54
2017-10-25T03:14:19
108,214,215
0
1
null
null
null
null
UTF-8
C++
false
false
6,754
cpp
/* test_detred_opadd.cpp -*-C++-*- * ************************************************************************* * * Copyright (C) 2013, Intel Corporation * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * Neither the name of Intel Corporation nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY * WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. *************************************************************************/ #include <assert.h> #include <cstdio> #include <cstdlib> // TBD: Hack for now, until we fix this for real. #define CILK_IGNORE_REDUCER_ALIGNMENT #include <cilk/reducer_opadd.h> #include <cilkpub/detred_opadd.h> #include "cilktest_harness.h" using namespace cilkpub; template <typename T> inline void tfprint(FILE* f, DetRedIview<T>& iview) { iview.fprint(f); } inline void tfprint(FILE* f, const pedigree& ped) { ped.fprint(f, ""); } // void tfprint(FILE* f, det_reducer_opadd<double>* detred) // { // // detred->fprint(f); // } inline void pass_test() { if (CILKTEST_NUM_ERRORS() == 0) { CILKTEST_REMARK(1, "%s\n", "....PASSED"); } else { CILKTEST_REMARK(1, "%s\n", "....FAILED"); } } static bool within_tol(double sum, double expected) { return ((sum - expected) * (sum - expected)) < 1.0e-12; } static bool within_tol(int sum, int expected) { return (sum == expected); } #define COMPLEX_ADD void test_det_reducer_recursive_helper(cilk::reducer_opadd<double>* normal_red, det_reducer_opadd<double>* det_red, int start, int end) { if ((end - start) <= 100) { for (int j = start; j < end; ++j) { #ifdef COMPLEX_ADD double tmp = 2.54312 / (1.0 * (j+2)); #else double tmp = 1.0; #endif (*normal_red) += tmp; (*det_red) += tmp; } } else { int mid = (start + end)/2; _Cilk_spawn test_det_reducer_recursive_helper(normal_red, det_red, start, mid); if (mid % 10 == 3) { #ifdef COMPLEX_ADD double tmp = 1.32; #else double tmp = 1.0; #endif (*normal_red) += tmp; (*det_red) += tmp; } test_det_reducer_recursive_helper(normal_red, det_red, mid, end); _Cilk_sync; } } void test_det_reducer_helper(double* normal_ans, double* det_ans, int NUM_TRIALS, bool scope_test) { double starting_val = 1.321; int LOOP_WIDTH = 10000; for (int i = 0; i < NUM_TRIALS; ++i) { cilk::reducer_opadd<double> normal_red(starting_val); pedigree_scope current_scope; det_reducer_opadd<double>* det_red; if (scope_test) { current_scope = pedigree_scope::current(); det_red = new det_reducer_opadd<double>(starting_val, current_scope); } else { det_red = new det_reducer_opadd<double>(starting_val); } CILKTEST_PRINT(3, "Detred Initial View: ", det_red, "\n"); _Cilk_for(int j = 0; j < LOOP_WIDTH; ++j) { double tmp = 2.45312 * j; normal_red += tmp; *det_red += tmp; } CILKTEST_PRINT(4, "Detred Initial View: ", det_red, "\n"); // NOTE: In order to get the exact same results between two // different calls, I need to spawn this function. Otherwise, // the initial pedigree of the first update to the reducer is // shifted by the initial rank of function. // // (Really, this is a hack. What we need here is the same // notion of a scoped pedigree that we used for DPRNG.) test_det_reducer_recursive_helper(&normal_red, det_red, 0, LOOP_WIDTH); normal_ans[i] = normal_red.get_value(); det_ans[i] = det_red->get_value(); CILKTEST_REMARK(3, "Iteration %d: \n", i); CILKTEST_PRINT(3, "Detred View: ", det_red, "\n"); delete det_red; } } void test_det_reducer() { CILKTEST_REMARK(2, "test_det_reducer()..."); const int NUM_TRIALS = 15; double normal_ans[NUM_TRIALS]; double det_ans[NUM_TRIALS]; _Cilk_spawn test_det_reducer_helper(normal_ans, det_ans, NUM_TRIALS, false); _Cilk_sync; test_det_reducer_helper(normal_ans, det_ans, NUM_TRIALS, false); test_det_reducer_helper(normal_ans, det_ans, NUM_TRIALS, true); CILKTEST_REMARK(2, "\nReducer: normal ans = %g, det ans = %g\n", normal_ans[0], det_ans[0]); for (int i = 1; i < NUM_TRIALS; ++i) { CILKTEST_REMARK(2, "....Reducer diff: normal = %11g, det = %g\n", (normal_ans[i] - normal_ans[0]), (det_ans[i] - det_ans[0])); TEST_ASSERT(within_tol(det_ans[i], normal_ans[i])); TEST_ASSERT(det_ans[i] == det_ans[0]); } pass_test(); } int main(int argc, char* argv[]) { CILKTEST_PARSE_TEST_ARGS(argc, argv); CILKTEST_BEGIN("Determinsitic reducer test"); test_det_reducer(); return CILKTEST_END("Determinsitic reducer test"); }
[ "jsukha@CHAR.localdomain" ]
jsukha@CHAR.localdomain
1a7a4b42dc989d21ffab293af44a63c9260fe8ee
379d9b87abaa7781d3af96b0c295f106ab18c0d0
/vector.cpp
4f4602ace9af555113c930c0c80e6f06fe7b5363
[]
no_license
JkUzumaki/C-_02_2020
b2417737b74b5c662e3864699f23dfef797dfd4c
376961b114d0834b92cdeb9e39cac17f84e3687a
refs/heads/master
2020-12-28T18:39:52.629901
2020-02-28T07:39:49
2020-02-28T07:39:49
238,444,254
0
0
null
null
null
null
UTF-8
C++
false
false
2,688
cpp
// Self implementation of // the Vector Class in C++ #include <bits/stdc++.h> using namespace std; class vectorClass { // arr is the integer pointer // which stores the address of our vector int* arr; // capacity is the total storage // capacity of the vector int capacity; // current is the number of elements // currently present in the vector int current; public: // Default constructor to initialise // an initial capacity of 1 element and // allocating storage using dynamic allocation vectorClass() { arr = new int[1]; capacity = 1; current = 0; } // Function to add an element at the last void push(int data) { // if the number of elements is equal to the capacity, // that means we don't have space // to accommodate more elements. // We need to double the capacity if (current == capacity) { int* temp = new int[2 * capacity]; // copying old array elements to new array for (int i = 0; i < capacity; i++) { temp[i] = arr[i]; } // deleting previous array delete[] arr; capacity *= 2; arr = temp; } // Inserting data arr[current] = data; current++; } // function to add element at any index void push(int data, int index) { // if index is equal to capacity then this // function is same as push defined above if (index == capacity) push(data); else arr[index] = data; } // function to extract element at any index int get(int index) { // if index is within the range if (index < current) return arr[index]; } // function to delete last element void pop() { current--; } // function to get size of the vector int size() { return current; } // function to get capacity of the vector int getcapacity() { return capacity; } // function to print array elements void print() { for (int i = 0; i < current; i++) { cout << arr[i] << " "; } cout << endl; } }; // Driver code int main() { vectorClass v; v.push(10); v.push(20); v.push(30); v.push(40); v.push(50); cout << "Vector size : " << v.size() << endl; cout << "Vector capacity : " << v.getcapacity() << endl; cout << "Vector elements : "; v.print(); v.push(100, 1); cout << "\nAfter updating 1st index" << endl; cout << "Vector elements : "; v.print(); cout << "Element at 1st index : " << v.get(1) << endl; v.pop(); cout << "\nAfter deleting last element" << endl; cout << "Vector size : " << v.size() << endl; cout << "Vector capacity : " << v.getcapacity() << endl; cout << "Vector elements : "; v.print(); return 0; }
[ "jaikumar.1415@yahoo.com" ]
jaikumar.1415@yahoo.com
a0169f15c930ce2382be60f4932f5a746de33e85
a968f6f83fffd1170410f36dd9ec36fc67f4e968
/ifttt.ino
3d5beb3f52b7f8b39226671c7db5b58c96a68ae8
[]
no_license
ayman2104/led-kelpa-kelip-with-google-assistant
5c40ff25a9808dd4b79363d30d535eb4e4ad9ecc
32aa965b9d6dd5863cac7996e01868aff7627f62
refs/heads/master
2022-11-19T05:08:00.429336
2020-07-25T09:45:00
2020-07-25T09:45:00
282,414,781
0
0
null
null
null
null
UTF-8
C++
false
false
316
ino
#define BLYNK_PRINT Serial #include <ESP8266WiFi.h> #include <BlynkSimpleEsp8266.h> char auth[] = "ex0IgXxw_4-kWFvccqNMcgg9EEAqY_xC"; char ssid[] = "Delce22"; char pass[] = "kimcher22"; void setup() { Serial.begin(9600); Blynk.begin(auth, ssid, pass); } void loop() { Blynk.run(); }
[ "noreply@github.com" ]
ayman2104.noreply@github.com
c995c4f4a54b9abf6f68b9caef72e775fd282752
6d6ff3721a863e4fb980603f7045fedf43673af5
/include/wdp/Depth.h
97a0ae72c73d8b706b8ab916864bc1d94fb5c3b9
[ "BSL-1.0" ]
permissive
lewis-revill/wheele-depth-perception
833f31ed42fb2b67335b8fd99e833779a2832c6d
9f92df089847e8d5b412dc50f21f301a68324312
refs/heads/master
2022-08-29T09:37:57.474273
2020-05-30T17:32:21
2020-05-30T17:32:21
263,041,932
0
0
null
null
null
null
UTF-8
C++
false
false
1,839
h
//===-------- Depth.h - Depth Perception Algorithms -------------*- C++ -*-===// // // Copyright © 2020 Lewis Revill // // Use, modification and distribution are subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt). // // SPDX-License-Identifier: BSL-1.0 // //===----------------------------------------------------------------------===// // // This file defines functions which implement extraction of depth information // from stereo images. // //===----------------------------------------------------------------------===// #ifndef WDP_DEPTH_H #define WDP_DEPTH_H #include "Coordinates.h" #include "Search.h" #include <cmath> namespace wdp { struct DepthParameters { double FocalLength; double PixelScale; double CameraDisplacement; }; template <typename LHSImage, typename RHSImage> double getDepth(const LHSImage &LHSImg, const RHSImage &RHSImg, Coordinates C, const SearchParameters &SearchParams, const DepthParameters &DepthParams) { // LHSImg and RHSImg input arguments must be 2D images. boost::function_requires<boost::gil::RandomAccess2DImageConcept<LHSImage>>(); boost::function_requires<boost::gil::RandomAccess2DImageConcept<RHSImage>>(); const Offset CentreOffset = getCentreOffset(LHSImg, C); double TrueXCentreOffset = CentreOffset.x * DepthParams.PixelScale; double Hypotenuse = sqrt(DepthParams.FocalLength * DepthParams.FocalLength + TrueXCentreOffset * TrueXCentreOffset); const Offset O = getOffset(LHSImg, RHSImg, C, SearchParams); double TrueXOffset = -O.x * DepthParams.PixelScale; double ScaleFactor = DepthParams.CameraDisplacement / TrueXOffset; return ScaleFactor * Hypotenuse; } } // namespace wdp #endif // WDP_DEPTH_H
[ "lewis.revill@embecosm.com" ]
lewis.revill@embecosm.com
472c889d379e6909ea101e25377f0b852f79a430
f981bca58ad38cb0d79eff19f9e56fb58a5c8efe
/Stepper1/Stepper1.ino
c4554b0faeaece7648c969db2b1ef544fc65f8a7
[]
no_license
andresmonsalvo/Arduino
5b57487aeaa8506aa59416d6a56caf61c92a81d2
f999b2744cd4114ca2d389496a0cf0911011b977
refs/heads/main
2023-05-24T12:11:14.439127
2021-06-02T00:27:05
2021-06-02T00:27:05
369,952,662
0
0
null
null
null
null
UTF-8
C++
false
false
352
ino
#include <Stepper.h> int stepsPerRevolution=2048; int motSpeed=3; int dt=500; Stepper myStepper(stepsPerRevolution, 8,10,9,11); void setup() { // put your setup code here, to run once: Serial.begin(9600); myStepper.setSpeed(motSpeed); } void loop() { myStepper.step(stepsPerRevolution); delay(dt); myStepper.step(-stepsPerRevolution); delay(dt); }
[ "andresmonsalvo@yahoo.ca" ]
andresmonsalvo@yahoo.ca
5aa5904da88ef161fa340740b3d2428bf52a864a
8295c24e35f48205a308a64a216e673790be0f21
/01cpp/day1_2.cpp
a8460ced96fde7836a367c43b59866f19cdd0844
[]
no_license
kev-zheng/advent2016
e6da8e13a492735079c1007f3dcda4ddd456717b
56d6a3b6c818948dd1690b6c513ed1df63b9efd9
refs/heads/master
2021-01-12T07:31:37.981359
2016-12-29T20:00:51
2016-12-29T20:00:51
76,972,137
0
0
null
null
null
null
UTF-8
C++
false
false
2,826
cpp
#include <iostream> #include <string> #include <vector> #include <typeinfo> #include <cmath> using namespace std; int main(){ string instructions; vector <char> directions; vector <int> distances; int currentX = 0; int currentY = 0; int currentDirection = 1; int distance; int totalDistance; int posX = 1000; int posY = 1000; int bunnyDistance; cout << "Enter data: " << endl; while(cin >> instructions){ if(instructions[instructions.size()] == ','){ instructions.pop_back(); } directions.push_back(instructions[0]); instructions.erase(0,1); distances.push_back(atoi(instructions.c_str())); if(cin.peek() == '\n'){ break; } } vector <int> gridLine(2000,0); vector < vector <int> > grid; for(int i = 0;i < 2000;i++){ grid.push_back(gridLine); } grid[posX][posY] = 1; for(int i = 0;i < directions.size();i++){ if(directions[i] == 'L'){ currentDirection += 1; currentDirection %= 4; } else if(directions[i] == 'R'){ currentDirection += 3; currentDirection %= 4; } switch(currentDirection){ case 0: currentX += distances[i]; for(int d = 0;d < distances[i];d++){ posX++; grid[posX][posY] += 1; if(grid[posX][posY] == 2){ cout << "crossed " << posX << " " << posY << endl; bunnyDistance = abs(posX - 1000) + abs(posY - 1000); cout << bunnyDistance << endl; break; } } break; case 1: currentY += distances[i]; for(int d = 0;d < distances[i];d++){ posY++; grid[posX][posY] += 1; if(grid[posX][posY] == 2){ cout << "crossed " << posX << " " << posY << endl; bunnyDistance = abs(posX - 1000) + abs(posY - 1000); cout << bunnyDistance << endl; break; } } break; case 2: currentX -= distances[i]; for(int d = 0;d < distances[i];d++){ posX--; grid[posX][posY] += 1; if(grid[posX][posY] == 2){ cout << "crossed " << posX << " " << posY << endl; bunnyDistance = abs(posX - 1000) + abs(posY - 1000); cout << bunnyDistance << endl; break; } } break; case 3: currentY -= distances[i]; for(int d = 0;d < distances[i];d++){ posY--; grid[posX][posY] += 1; if(grid[posX][posY] == 2){ cout << "crossed " << posX << " " << posY << endl; bunnyDistance = abs(posX - 1000) + abs(posY - 1000); cout << bunnyDistance << endl; break; } } break; } cout << "X: " << posX << endl; cout << "Y: " << posY << endl; } totalDistance = abs(currentX) + abs(currentY); cout << "Total Distance: " << totalDistance << " blocks away." << endl; cout << "Bunny HQ: " << bunnyDistance << " blocks away. " << endl; return 0; }
[ "Kevin@MacBook-Pro-4.local" ]
Kevin@MacBook-Pro-4.local
82f57646a4c7f09646be0abcecfbf5fd2e13b246
9607d81d6126b04c75e197440a15c325a69d97a1
/TradingSDI/TradingSDI/ADD_overview.cpp
3f4a2696b880f9a212b9fca94ec7383f79751fcf
[]
no_license
FX-Misc/prasantsingh-trading
0f6ef3ddac2fcb65002d6c1031ea0557c1155d9a
755670edd6f964915a4f8c3675f2274b70d01c50
refs/heads/master
2021-05-05T17:18:47.658007
2017-01-19T11:06:16
2017-01-19T11:06:16
null
0
0
null
null
null
null
UTF-8
C++
false
false
4,387
cpp
// ADD_overview.cpp : implementation file // #include "stdafx.h" #include "TradingSDI.h" #include "ADD_overview.h" #include "afxdialogex.h" #include "tabControl.h" IMPLEMENT_DYNAMIC(ADD_overview, CDialogEx) ADD_overview::ADD_overview(CWnd* pParent /*=NULL*/) : CDialogEx(ADD_overview::IDD, pParent) { m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); m_bInit = false; p1=NULL; p2=NULL; p3=NULL; p4=NULL; } ADD_overview::~ADD_overview() { } void ADD_overview::DoDataExchange(CDataExchange* pDX) { CDialogEx::DoDataExchange(pDX); DDX_Control(pDX, IDC_TAB1, m_ctrlTAB); } BEGIN_MESSAGE_MAP(ADD_overview, CDialogEx) ON_WM_PAINT() ON_WM_QUERYDRAGICON() //}}AFX_MSG_MAP // ON_WM_MOVE() ON_WM_CLOSE() ON_WM_DESTROY() //ON_WM_SHOWWINDOW() ON_NOTIFY(NM_CLICK, IDC_TAB1, &ADD_overview::OnNMClickTab1) END_MESSAGE_MAP() BOOL ADD_overview::OnInitDialog() { CDialogEx::OnInitDialog(); // Set the icon for this dialog. The framework does this automatically // when the application's main window is not a dialog SetIcon(m_hIcon, TRUE); // Set big icon SetIcon(m_hIcon, FALSE); // Set small icon //// TODO: Add extra initialization here //p1 = new overview(); //p1->Create(IDD_TAB1,m_ctrlTAB.GetWindow(IDD_TAB1)); //p2 = new Tab2(); //p2->Create(IDD_TAB2,m_ctrlTAB.GetWindow(IDD_TAB2)); //p3= new tab3(); //p3->Create(IDD_TAB3,m_ctrlTAB.GetWindow(IDD_TAB3)); //p4= new tab4(); //p4->Create(IDD_TAB4,m_ctrlTAB.GetWindow(IDD_TAB4)); // m_ctrlTAB.AddTabPane(L"OverView",p1); //m_ctrlTAB.AddTabPane(L"TradeCheck",p2); //m_ctrlTAB.AddTabPane(L"TradeWiseAnalysis",p3); //m_ctrlTAB.AddTabPane(L"StandingPosition",p4); //// TODO: Add extra initialization here m_ctrlTAB.InitDialogs(); m_ctrlTAB.InsertItem(0,L"OverView"); m_ctrlTAB.InsertItem(1,L"TradeCheck"); m_ctrlTAB.InsertItem(2,L"TradeWiseAnalysis"); m_ctrlTAB.InsertItem(3,L"StandingPosition"); //m_ctrlTAB.ActivateTabDialogs(); return TRUE; // return TRUE unless you set the focus to a control } // If you add a minimize button to your dialog, you will need the code below // to draw the icon. For MFC applications using the document/view model, // this is automatically done for you by the framework. void ADD_overview::OnPaint() { if (IsIconic()) { CPaintDC dc(this); // device context for painting SendMessage(WM_ICONERASEBKGND, reinterpret_cast<WPARAM>(dc.GetSafeHdc()), 0); // Center icon in client rectangle int cxIcon = GetSystemMetrics(SM_CXICON); int cyIcon = GetSystemMetrics(SM_CYICON); CRect rect; GetClientRect(&rect); int x = (rect.Width() - cxIcon + 1) / 2; int y = (rect.Height() - cyIcon + 1) / 2; // Draw the icon dc.DrawIcon(x, y, m_hIcon); } else { CDialogEx::OnPaint(); } } // The system calls this function to obtain the cursor to display while the user drags // the minimized window. HCURSOR ADD_overview::OnQueryDragIcon() { return static_cast<HCURSOR>(m_hIcon); } //void ADD_overview::OnMove(int x, int y) //{ // m_ctrlTAB.OnMove(x,y); //} //void ADD_overview::OnShowWindow(BOOL bShow, UINT nStatus) //{ // m_ctrlTAB.SetDefaultPane(1); // //} // ADD_overview message handlers void ADD_overview::OnClose() { // TODO: Add your message handler code here and/or call default m_ctrlTAB.OnClose(); CDialogEx::OnClose(); } BOOL ADD_overview::PreTranslateMessage(MSG* pMsg) { // TODO: Add your specialized code here and/or call the base class return CDialogEx::PreTranslateMessage(pMsg); } void ADD_overview::OnDestroy() { p1->OnClose(); p2->OnClose(); p3->OnClose(); p4->OnClose(); delete(p3); delete(p4); //m_ctrlTAB.OnDestroy(); CDialogEx::OnDestroy(); // TODO: Add your message handler code here } //void ADD_overview::OnShowWindow(BOOL bShow, UINT nStatus) //{ // CDialogEx::OnShowWindow(bShow, nStatus); // // // TODO: Add your message handler code here //} void ADD_overview::OnNMClickTab1(NMHDR *pNMHDR, LRESULT *pResult) { // TODO: Add your control notification handler code here //p1->ShowWindow(SW_SHOW); *pResult = 0; }
[ "prasantsingh01@hotmail.com" ]
prasantsingh01@hotmail.com
1e6adf16ee17a9a8d8f54d686683db04c9cef38b
6676867d1b645bd6d8fc7c79d85d7e943a3a3550
/ROS/skinny/src_does_not_compile/victor/src/victor_node.cpp
99bd7da1437840332680c036f4fac47194c1d69f
[]
no_license
Razorbotz/RMC-Code-20-21
88604410293c5edb7a877365aa8bbf2a9cb4141b
f1a5a9c99a3af840188f8dc3a680c0453600ee02
refs/heads/master
2023-07-18T03:44:26.445419
2021-05-11T18:08:24
2021-05-11T18:08:24
336,593,274
3
0
null
null
null
null
UTF-8
C++
false
false
3,632
cpp
#include <string> #include <iostream> #include <chrono> #include <thread> #include <unistd.h> #define Phoenix_No_WPI // remove WPI dependencies #include <ctre/Phoenix.h> #include <ctre/phoenix/platform/Platform.h> #include <ctre/phoenix/unmanaged/Unmanaged.h> #include <ros/ros.h> #include <ros/console.h> #include <std_msgs/Float32.h> #include <std_msgs/Empty.h> #include "messages/VictorOut.h" using namespace ctre::phoenix; using namespace ctre::phoenix::platform; using namespace ctre::phoenix::motorcontrol; using namespace ctre::phoenix::motorcontrol::can; bool GO=false; void stopCallback(std_msgs::Empty empty){ std::cout << "STOP" << std::endl; GO=false; } void goCallback(std_msgs::Empty empty){ std::cout << "GO" << std::endl; GO=true; } VictorSPX* victorSPX; void speedCallback(const std_msgs::Float32 speed){ std::cout << speed.data << std::endl; victorSPX->Set(ControlMode::PercentOutput, speed.data); } int main(int argc,char** argv){ std::cout << "Starting talon 3" << std::endl; ros::init(argc,argv,"talon_node"); ros::NodeHandle nodeHandleP("~"); ros::NodeHandle nodeHandle; int success; std::string message; success=nodeHandleP.getParam("message", message); std::cout << success << "message " << message << std::endl; int motorNumber=0; success=nodeHandleP.getParam("motor_number", motorNumber); std::cout << success << "motor_number: " << motorNumber << std::endl; std::string infoTopic; success=nodeHandleP.getParam("info_topic", infoTopic); std::cout << success << "info_topic: " << infoTopic << std::endl; std::string speedTopic; success=nodeHandleP.getParam("speed_topic", speedTopic); std::cout << success << "speed_topic: " << speedTopic << std::endl; bool invertMotor=false; success=nodeHandleP.getParam("invert_motor", invertMotor); std::cout << success << "invert_motor: " << invertMotor << std::endl; ctre::phoenix::platform::can::SetCANInterface("can0"); victorSPX=new VictorSPX(motorNumber); victorSPX->SetInverted(invertMotor); victorSPX->Set(ControlMode::PercentOutput, 0); StatusFrame statusFrame; messages::VictorOut victorOut; ros::Publisher victorOutPublisher=nodeHandle.advertise<messages::VictorOut>(infoTopic.c_str(),1); ros::Subscriber speedSubscriber=nodeHandle.subscribe(speedTopic.c_str(),1,speedCallback); ros::Subscriber stopSubscriber=nodeHandle.subscribe("STOP",1,stopCallback); ros::Subscriber goSubscriber=nodeHandle.subscribe("GO",1,goCallback); auto start = std::chrono::high_resolution_clock::now(); while(ros::ok()){ if(GO)ctre::phoenix::unmanaged::FeedEnable(100); auto finish = std::chrono::high_resolution_clock::now(); if(std::chrono::duration_cast<std::chrono::nanoseconds>(finish-start).count() > 250000000){ int deviceID=victorSPX->GetDeviceID(); double busVoltage=victorSPX->GetBusVoltage(); bool isInverted=victorSPX->GetInverted(); double motorOutputVoltage=victorSPX->GetMotorOutputVoltage(); double motorOutputPercent=victorSPX->GetMotorOutputPercent(); victorOut.deviceID=deviceID; victorOut.busVoltage=busVoltage; victorOut.outputVoltage=motorOutputVoltage; victorOut.outputPercent=motorOutputPercent; victorOutPublisher.publish(victorOut); start = std::chrono::high_resolution_clock::now(); } usleep(20); ros::spinOnce(); } }
[ "andrewburroughs17@gmail.com" ]
andrewburroughs17@gmail.com
1a3b60a5efab91fa77b99e409904690a655762a9
28dba754ddf8211d754dd4a6b0704bbedb2bd373
/Codeforces/ProblemSet/33D.cpp
41502b6f254c683e85fa14a302d9a088e8d533f3
[]
no_license
zjsxzy/algo
599354679bd72ef20c724bb50b42fce65ceab76f
a84494969952f981bfdc38003f7269e5c80a142e
refs/heads/master
2023-08-31T17:00:53.393421
2023-08-19T14:20:31
2023-08-19T14:20:31
10,140,040
0
1
null
null
null
null
UTF-8
C++
false
false
1,251
cpp
/* * Author : Yang Zhang */ #include <map> #include <set> #include <list> #include <cmath> #include <queue> #include <stack> #include <bitset> #include <vector> #include <cstdio> #include <string> #include <sstream> #include <cstdlib> #include <cstring> #include <iostream> #include <algorithm> using namespace std; #define PB push_back #define MP make_pair #define SZ(v) ((int)(v).size()) #define abs(x) ((x) > 0 ? (x) : -(x)) typedef long long LL; struct Point { LL x, y; }p[1111]; struct Circle { LL x, y, r; }c[1111]; bool adj[1005][1005]; int n, m, k; int main() { freopen("in", "r", stdin); cin >> n >> m >> k; for (int i = 0; i < n; i++) cin >> p[i].x >> p[i].y; for (int i = 0; i < m; i++) cin >> c[i].r >> c[i].x >> c[i].y; memset(adj, 0, sizeof(adj)); for (int i = 0; i < n; i++) for (int j = 0; j < m; j++) { LL dx = (p[i].x - c[j].x) * (p[i].x - c[j].x); LL dy = (p[i].y - c[j].y) * (p[i].y - c[j].y); if (dx + dy < c[j].r * c[j].r) adj[i][j] = true; } for (int i = 0; i < k; i++) { int a, b; cin >> a >> b; a--; b--; int ret = 0; for (int j = 0; j < m; j++) ret += adj[a][j] ^ adj[b][j]; cout << ret << endl; } return 0; }
[ "zjsxzy@gmail.com" ]
zjsxzy@gmail.com
14c5bfbd6b79c3d51df3272baf2b606cbccf3536
394fd2a44126ae5607c30a58fe5593db1c6e5a02
/src/QFrameDisplay.cpp
9fc74e400994cfb7241bf2a7e5d919aa20c7f3f8
[]
no_license
thx8411/qastrocam-g2
653b98463609737ab328f63929690f27d7f100eb
c1453cc8bc2e7719db21bae5bffe3340c66b42e0
refs/heads/master
2021-01-17T11:35:54.403879
2016-04-01T20:33:07
2016-04-01T20:33:07
40,839,897
2
0
null
null
null
null
UTF-8
C++
false
false
1,918
cpp
/****************************************************************** Qastrocam Copyright (C) 2003-2009 Franck Sicard Qastrocam-g2 Copyright (C) 2009-2013 Blaise-Florentin Collin This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License v2 as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *******************************************************************/ #include <Qt/qcolor.h> #include <Qt/qpen.h> #include <Qt/qpainter.h> #include <QtGui/QPaintEvent> #include "QFrameDisplay.hpp" #include "QCamFrame.hpp" QFrameDisplay::QFrameDisplay(QWidget * parent,const char * label) : QWidget(parent) { painter_ = new QPainter(); pen_=new QPen(); pen_->setStyle(Qt::DotLine); pen_->setColor(QColor(255,0,0)); setAttribute(Qt::WA_NoBackground); } QFrameDisplay::~QFrameDisplay() { delete pen_; delete painter_; } void QFrameDisplay::frame(const QCamFrame &frame) { frame_=frame; setMinimumSize(frame_.size()); resize(frame_.size()); update(); } void QFrameDisplay::paintEvent(QPaintEvent * ev) { if (!frame_.empty()) { painter_->begin(this); painter_->setPen(*pen_); painter_->setClipRegion(ev->region()); painter_->drawImage(0,0,frame_.colorImage()); painter_->drawLine(width()/2,0, width()/2,height()); painter_->drawLine(0,height()/2, width(),height()/2); painter_->end(); } }
[ "thx8411@c1ec87e9-771e-51c6-fe90-2aeb2be771a7" ]
thx8411@c1ec87e9-771e-51c6-fe90-2aeb2be771a7
f6ec07fcc96903e42e5b71b3a7cd07be0a8669d8
97f5bdd44c74c8480bac6ce6d235d1fd284e0316
/inexlib/ourex/dcmtk/dcmimage/include/dcmtk/dcmimage/dihsvpxt.h
5ee994ba5f1d41835ff5ab1039f35eb414acc68a
[ "LicenseRef-scancode-warranty-disclaimer", "Apache-2.0", "BSD-3-Clause", "BSD-4.3TAHOE", "xlock", "IJG", "LicenseRef-scancode-other-permissive" ]
permissive
gbarrand/wall
b991d7cdf410d9fa8730407e0b56b27c5220e843
930a708134b3db2fc77d006d9bd4ccea7ebcdee1
refs/heads/master
2021-07-11T15:07:35.453757
2018-12-21T12:28:57
2018-12-21T12:28:57
162,569,670
0
0
null
null
null
null
UTF-8
C++
false
false
10,351
h
/* * * Copyright (C) 1996-2010, OFFIS e.V. * All rights reserved. See COPYRIGHT file for details. * * This software and supporting documentation were developed by * * OFFIS e.V. * R&D Division Health * Escherweg 2 * D-26121 Oldenburg, Germany * * * Module: dcmimage * * Author: Joerg Riesmeier * * Purpose: DicomHSVPixelTemplate (Header) * * Last Update: $Author: barrand $ * Update Date: $Date: 2013/07/02 07:15:11 $ * CVS/RCS Revision: $Revision: 1.2 $ * Status: $State: Exp $ * * CVS/RCS Log at end of file * */ #ifndef DIHSVPXT_H #define DIHSVPXT_H #include "dcmtk/config/osconfig.h" #include "dcmtk/dcmimage/dicopxt.h" #include "dcmtk/dcmimgle/diinpx.h" /* gcc 3.4 needs this */ /*---------------------* * class declaration * *---------------------*/ /** Template class to handle HSV pixel data */ template<class T1, class T2> class DiHSVPixelTemplate : public DiColorPixelTemplate<T2> { public: /** constructor * ** @param docu pointer to DICOM document * @param pixel pointer to input pixel representation * @param status reference to status variable * @param planeSize number of pixels in a plane * @param bits number of bits per sample */ DiHSVPixelTemplate(const DiDocument *docu, const DiInputPixel *pixel, EI_Status &status, const unsigned long planeSize, const int bits) : DiColorPixelTemplate<T2>(docu, pixel, 3, status) { if ((pixel != NULL) && (this->Count > 0) && (status == EIS_Normal)) convert(OFstatic_cast(const T1 *, pixel->getData()) + pixel->getPixelStart(), planeSize, bits); } /** destructor */ virtual ~DiHSVPixelTemplate() { } private: /** convert input pixel data to intermediate representation * ** @param pixel pointer to input pixel data * @param planeSize number of pixels in a plane * @param bits number of bits per sample */ void convert(const T1 *pixel, const unsigned long planeSize, const int bits) { if (DiColorPixelTemplate<T2>::Init(pixel)) //G.Barrand { /*G.Barrand register*/ T2 *r = this->Data[0]; /*G.Barrand register*/ T2 *g = this->Data[1]; /*G.Barrand register*/ T2 *b = this->Data[2]; const T2 maxvalue = OFstatic_cast(T2, DicomImageClass::maxval(bits)); const T1 offset = OFstatic_cast(T1, DicomImageClass::maxval(bits - 1)); // use the number of input pixels derived from the length of the 'PixelData' // attribute), but not more than the size of the intermediate buffer const unsigned long count = (this->InputCount < this->Count) ? this->InputCount : this->Count; if (this->PlanarConfiguration) { /* G_Barrand_register const T1 *h = pixel; G_Barrand_register const T1 *s = h + this->InputCount; G_Barrand_register const T1 *v = s + this->InputCount; for (i = count; i != 0; --i) convertValue(*(r++), *(g++), *(b++), removeSign(*(h++), offset), removeSign(*(s++), offset), removeSign(*(v++), offset), maxvalue); */ /*G.Barrand register*/ unsigned long l; /*G.Barrand register*/ unsigned long i = count; /*G.Barrand register*/ const T1 *h = pixel; /*G.Barrand register*/ const T1 *s = h + planeSize; /*G.Barrand register*/ const T1 *v = s + planeSize; while (i != 0) { /* convert a single frame */ for (l = planeSize; (l != 0) && (i != 0); --l, --i) { convertValue(*(r++), *(g++), *(b++), removeSign(*(h++), offset), removeSign(*(s++), offset), removeSign(*(v++), offset), maxvalue); } /* jump to next frame start (skip 2 planes) */ h += 2 * planeSize; s += 2 * planeSize; v += 2 * planeSize; } } else { /*G.Barrand register*/ const T1 *p = pixel; /*G.Barrand register*/ T2 h; /*G.Barrand register*/ T2 s; /*G.Barrand register*/ T2 v; /*G.Barrand register*/ unsigned long i; for (i = count; i != 0; --i) { h = removeSign(*(p++), offset); s = removeSign(*(p++), offset); v = removeSign(*(p++), offset); convertValue(*(r++), *(g++), *(b++), h, s, v, maxvalue); } } } } /** convert a single HSV value to RGB */ void convertValue(T2 &red, T2 &green, T2 &blue, const T2 hue, const T2 saturation, const T2 value, const T2 maxvalue) { /* * conversion algorithm taken from Foley et al.: 'Computer Graphics: Principles and Practice' (1990) */ if (saturation == 0) { red = value; green = value; blue = value; } else { const double h = (OFstatic_cast(double, hue) * 6) / (OFstatic_cast(double, maxvalue) + 1); // '... + 1' to assert h < 6 const double s = OFstatic_cast(double, saturation) / OFstatic_cast(double, maxvalue); const double v = OFstatic_cast(double, value) / OFstatic_cast(double, maxvalue); const T2 hi = OFstatic_cast(T2, h); const double hf = h - hi; const T2 p = OFstatic_cast(T2, maxvalue * v * (1 - s)); const T2 q = OFstatic_cast(T2, maxvalue * v * (1 - s * hf)); const T2 t = OFstatic_cast(T2, maxvalue * v * (1 - s * (1 - hf))); switch (hi) { case 0: red = value; green = t; blue = p; break; case 1: red = q; green = value; blue = p; break; case 2: red = p; green = value; blue = t; break; case 3: red = p; green = q; blue = value; break; case 4: red = t; green = p; blue = value; break; case 5: red = value; green = p; blue = q; break; default: DCMIMAGE_WARN("invalid value for 'hi' while converting HSV to RGB"); } } } }; #endif /* * * CVS/RCS Log: * $Log: dihsvpxt.h,v $ * Revision 1.2 2013/07/02 07:15:11 barrand * *** empty log message *** * * Revision 1.1.1.1 2013/04/16 19:23:56 barrand * * * Revision 1.25 2010-10-14 13:16:29 joergr * Updated copyright header. Added reference to COPYRIGHT file. * * Revision 1.24 2010-03-01 09:08:46 uli * Removed some unnecessary include directives in the headers. * * Revision 1.23 2009-11-25 14:31:21 joergr * Removed inclusion of header file "ofconsol.h". * * Revision 1.22 2009-10-14 10:25:14 joergr * Fixed minor issues in log output. Also updated copyright date (if required). * * Revision 1.21 2009-10-13 14:08:33 uli * Switched to logging mechanism provided by the "new" oflog module * * Revision 1.20 2006-08-15 16:35:01 meichel * Updated the code in module dcmimage to correctly compile when * all standard C++ classes remain in namespace std. * * Revision 1.19 2005/12/08 16:01:39 meichel * Changed include path schema for all DCMTK header files * * Revision 1.18 2004/04/21 10:00:31 meichel * Minor modifications for compilation with gcc 3.4.0 * * Revision 1.17 2003/12/23 11:48:23 joergr * Adapted type casts to new-style typecast operators defined in ofcast.h. * Removed leading underscore characters from preprocessor symbols (reserved * symbols). Updated copyright header. * Replaced post-increment/decrement operators by pre-increment/decrement * operators where appropriate (e.g. 'i++' by '++i'). * * Revision 1.16 2002/06/26 16:18:10 joergr * Enhanced handling of corrupted pixel data and/or length. * Corrected decoding of multi-frame, planar images. * * Revision 1.15 2001/11/09 16:47:01 joergr * Removed 'inline' specifier from certain methods. * * Revision 1.14 2001/06/01 15:49:30 meichel * Updated copyright header * * Revision 1.13 2000/04/28 12:39:32 joergr * DebugLevel - global for the module - now derived from OFGlobal (MF-safe). * * Revision 1.12 2000/04/27 13:15:13 joergr * Dcmimage library code now consistently uses ofConsole for error output. * * Revision 1.11 2000/03/08 16:21:52 meichel * Updated copyright header. * * Revision 1.10 2000/03/03 14:07:52 meichel * Implemented library support for redirecting error messages into memory * instead of printing them to stdout/stderr for GUI applications. * * Revision 1.9 1999/09/17 14:03:45 joergr * Enhanced efficiency of some "for" loops. * * Revision 1.8 1999/04/28 12:47:04 joergr * Introduced new scheme for the debug level variable: now each level can be * set separately (there is no "include" relationship). * * Revision 1.7 1999/02/03 16:54:27 joergr * Moved global functions maxval() and determineRepresentation() to class * DicomImageClass (as static methods). * * Revision 1.6 1999/01/20 14:46:15 joergr * Replaced invocation of getCount() by member variable Count where possible. * * Revision 1.5 1998/11/27 13:51:50 joergr * Added copyright message. * * Revision 1.4 1998/05/11 14:53:16 joergr * Added CVS/RCS header to each file. * * */
[ "guy.barrand@gmail.com" ]
guy.barrand@gmail.com
7f0766975f6d910a4a909a1e762c0ab85402c537
e13bddc546916ecba5b10721050d091da6df3993
/helper.h
7a2a11a422842ce7d1fd5684e0024697b211ef4d
[ "MIT" ]
permissive
aldemirenes/hagen
c7c278e1ea6f32f224d1edf2966869484061ce01
e88385275fb9da82a6a132cd1e9a8f1cbacf3289
refs/heads/master
2021-04-27T18:36:14.526000
2018-02-21T15:41:02
2018-02-21T15:49:54
122,342,697
1
1
null
null
null
null
UTF-8
C++
false
false
866
h
#ifndef __HELPER__H__ #define __HELPER__H__ #include <iostream> #include <string> #include <fstream> #include <jpeglib.h> #include <GL/glew.h> #include <GLFW/glfw3.h> #include "glm/glm.hpp" // GL Math library header #include "glm/gtc/matrix_transform.hpp" #include "glm/gtc/type_ptr.hpp" #include "glm/gtx/rotate_vector.hpp" extern GLuint idProgramShader; extern GLuint idFragmentShader; extern GLuint idVertexShader; extern GLuint idJpegTexture; using namespace std; void initShaders(); GLuint initVertexShader(const string& filename); GLuint initFragmentShader(const string& filename); bool readDataFromFile(const string& fileName, string &data); void initTexture(char *filename,int *w, int *h); struct Camera { glm::vec3 position; glm::vec3 gaze; glm::vec3 up; void rotateAroundUp(float); void rotateAroundRight(float); }; #endif
[ "aldemirenes@live.com" ]
aldemirenes@live.com
00beb681504f109e0f1ddec767cfeddab1d67135
47de1c3720ee7df453ce7904e1767798bbc5f1c7
/src/mavencore/maven/Date.h
49c42ad05ea64b259cea1a4be7270e53067e785f
[]
no_license
elliotchance/maven
28a20058d8b83c0b364680f573b329941ad0573a
ea189bf5cea7cacf15ecfe071762d5560323d0ab
refs/heads/master
2021-01-10T21:01:14.871430
2010-05-04T08:20:32
2010-05-04T08:20:32
null
0
0
null
null
null
null
UTF-8
C++
false
false
377
h
#ifndef MAVENCORE_MAVEN_DATE #define MAVENCORE_MAVEN_DATE 1 #include "../mavencore.h" namespace maven { class Date extends maven::Object { public_variable mshort year; public_variable mbyte month; public_variable mbyte day; public_variable mbyte hour; public_variable mbyte minute; public_variable mbyte second; public_constructor Date(); }; } #endif
[ "elliot@chancemedia.com" ]
elliot@chancemedia.com
cd0a7558331d64c19e76f9b7c92347d366fa5179
7bb00eea506d129c94cede3001d437f4ebc4b16f
/20180327/Source/Api/ApiStd.cpp
d6e6a73e0efabece9527814af15750b126f5a3cf
[]
no_license
jhd41/ToolFrame
3e5c82b5a5c41e1ba844b93c3df6dfc5a41572d9
250c7d4371eca95acc1a579f2b861a1c94dfe9e4
refs/heads/master
2020-03-15T03:04:58.371922
2018-05-03T03:01:10
2018-05-03T03:03:05
131,933,829
1
0
null
null
null
null
GB18030
C++
false
false
6,373
cpp
#include "ApiStd.h" #include "ToolStd.h" void ApiStd::Trace( const std::string& msg ) { #if MACRO_TARGET_VER == MACRO_VER_DEBUG std::cout<<msg<<std::endl; #endif // MACRO_VER_DEBUG } void ApiStd::OutPut( const std::string& msg ) { std::cout<<msg<<std::endl; } void ApiStd::OutPutCerr( const std::string& msg ) { std::cerr << msg << std::endl; } time_t ApiStd::GetNowTime() { return time(nullptr); } size_t ApiStd::GetFileLength( const std::string& sFileName ) { if (sFileName.empty())return 0; std::ifstream fStream; //打开文件 if (!ToolFrame::OpenFile(fStream,sFileName))return 0; return ToolFrame::GetFileLength(fStream); } bool ApiStd::LoadFile( const std::string& sFileName,void* pBuffer,size_t uLength ) { if (sFileName.empty())return false; if (!pBuffer)return false; if (uLength <=0)return false; std::ifstream fStream; //打开文件 if (!ToolFrame::OpenFile(fStream,sFileName,std::ios::in|std::ios::binary))return false; //检测文件长度 UINT uFileLen = ToolFrame::GetFileLength(fStream); if(uFileLen == 0)return false; //申请空间读取 if (uLength < uFileLen)return false; //读取 fStream.read((char*)pBuffer, uFileLen); fStream.close(); return true; } bool ApiStd::SaveFile( const std::string& sFileName,const void* pBuffer,size_t uLength) { if (sFileName.empty())return false; if (!pBuffer)return false; if (uLength <=0)return false; //得到BUFF内存 std::ofstream fStream; //打开文件 //打开文件 if (!ToolFrame::OpenFile(fStream,sFileName,std::ios::out|std::ios::binary))return false; //写入 fStream.write((const char*)pBuffer,uLength); fStream.close(); return true; } bool ApiStd::IsFileExist( const std::string& sFileName ) { if (sFileName.empty())return false; std::ifstream fStream; //打开文件 fStream.open(sFileName.c_str()); return !!fStream; } bool ApiStd::CopyFile( const std::string& sPathSrc,const std::string& sPathDes ) { if (sPathSrc.empty())return false; if (sPathDes.empty())return false; std::ifstream fInput; if (!ToolFrame::OpenFile(fInput,sPathSrc,std::ios::binary))return false;//打开源文件 std::ofstream fOutPut; if (!ToolFrame::OpenFile(fOutPut,sPathDes,std::ios::binary))return false;//创建目标文件 return ToolFrame::CopyFile(fOutPut,fInput); } bool ApiStd::RemoveFile( const std::string& sFileName ) { if (sFileName.empty())return false; return 0 == ::remove(sFileName.c_str()); } bool ApiStd::RenameFile( const std::string& sPathSrc,const std::string& sPathDes ) { if (sPathSrc.empty())return false; if (sPathDes.empty())return false; return 0 == ::rename(sPathSrc.c_str(),sPathDes.c_str()); } bool ApiStd::MakePathVector( VectorString& vDes,const std::string& sPath ) { if (sPath.empty())return false; ToolFrame::SplitString(vDes,sPath,"/"); if (vDes.empty())return false; if (ToolFrame::GetBack(vDes).empty()) ToolFrame::EraseBack(vDes); return true; } std::string ApiStd::AbsPathToRelativePath( const std::string& sPath,const std::string& sCmpPath ) { if (sPath.empty())return ToolFrame::EmptyString(); VectorString vCmpPath; if (!MakePathVector(vCmpPath,StardPath(sCmpPath)))return ToolFrame::EmptyString(); return AbsPathToRelativePath(sPath,vCmpPath); } bool ApiStd::AbsPathToRelativePath( VectorString& vDes,const VectorString& vPath,const std::string& sCmpPath ) { if (vPath.empty())return false; if (ToolFrame::IsSelf(vDes,vPath))return false; VectorString vCmpPath; if (!MakePathVector(vCmpPath,StardPath(sCmpPath)))return false; VectorString::const_iterator itr; foreach(itr,vPath){ ToolFrame::PushBack(vDes,AbsPathToRelativePath(StardPath(*itr),vCmpPath)); if ( ToolFrame::EmptyString() == ToolFrame::GetBack(vDes)) return false; } return true; } std::string ApiStd::AbsPathToRelativePath( const std::string& sAbsPath,const VectorString& vCmpPath ) { if (sAbsPath.empty())return ToolFrame::EmptyString(); VectorString vAbsPath; if (!MakePathVector(vAbsPath,sAbsPath))return ToolFrame::EmptyString(); if (vAbsPath.empty() || vCmpPath.empty())return ToolFrame::EmptyString(); // aa/bb/c // aa/c/d/c //思路:找到路径不一样的地方,之后添加 被比较路径剩余部分 个 ../ 然后将绝对路径中剩下不同地方一起写入即可 //找到不一样的地方 size_t uDiff = -1; size_t uMax = ToolFrame::Min(vAbsPath.size(),vCmpPath.size()); for (size_t uIndex = 0;uIndex<uMax;++uIndex) { if (vAbsPath[uIndex] != vCmpPath[uIndex])break; uDiff = uIndex; } if (uDiff <= 0)return ToolFrame::EmptyString(); std::stringstream sStream; //被比较路径剩余部分 for(size_t uIndex = uDiff + 1;uIndex<vCmpPath.size();++uIndex){ sStream<<"../"; } //如果是当前目录 if (uDiff + 1 >= vCmpPath.size()) sStream<<"./"; //添加绝对路径不同部分 for(size_t uIndex = uDiff + 1;uIndex<vAbsPath.size();++uIndex){ sStream<<vAbsPath[uIndex]; if (uIndex != vAbsPath.size() - 1) sStream<<"/"; } return sStream.str(); } std::string ApiStd::StardPath( const std::string& sPath ) { if (sPath.empty())return ToolFrame::EmptyString(); std::string s = sPath; ToolFrame::Replace(s,"\\","/");//Linux下只能读取"/"而不是"\" return s; } std::string ApiStd::TrimPath( const std::string& sPath ) { if (sPath.empty())return ToolFrame::EmptyString(); std::stringstream sStream;//返回值 //如果sPath是绝对路径开头先添加进去 if (ToolFrame::IsBeginWith(sPath,"/")) { sStream<<"/"; } //然后拼接调整文件夹 { VectorString vDes; std::string s = sPath; ToolFrame::Replace(s,"\\","/"); VectorString vString; ToolFrame::SplitString(vString,s,"/"); VectorString::const_iterator itr; foreach(itr,vString){ const std::string& sDirName = *itr; if (sDirName == "") { continue; } if (sDirName == ".") { continue; } if (sDirName == "..") { if (vDes.empty() || vDes.back() == "..") { vDes.push_back(".."); }else { vDes.pop_back(); } continue; } vDes.push_back(sDirName); } if (!vString.empty() && vString.back() == "") { vDes.push_back(""); } //参考自 ToolFrame::ToString { bool bAttch= false; VectorString::const_iterator itr; foreach(itr,vDes){ if (bAttch)sStream << "/"; bAttch = true; sStream << *itr; } } } return sStream.str(); }
[ "jhd41@sina.com" ]
jhd41@sina.com
5ba95213d2bf67114ed9ba9e9d6c0c5030692243
ef187d259d33e97c7b9ed07dfbf065cec3e41f59
/work/atcoder/arc/arc063/D/answers/70562_amekin.cpp
e5030c1e4d972a33893292b681b042b3af5e6b75
[]
no_license
kjnh10/pcw
847f7295ea3174490485ffe14ce4cdea0931c032
8f677701bce15517fb9362cc5b596644da62dca8
refs/heads/master
2020-03-18T09:54:23.442772
2018-07-19T00:26:09
2018-07-19T00:26:09
134,586,379
0
0
null
null
null
null
UTF-8
C++
false
false
948
cpp
#define _USE_MATH_DEFINES #include <cstdio> #include <iostream> #include <sstream> #include <fstream> #include <iomanip> #include <algorithm> #include <cmath> #include <complex> #include <string> #include <vector> #include <list> #include <queue> #include <stack> #include <set> #include <map> #include <bitset> #include <numeric> #include <limits> #include <climits> #include <cfloat> #include <functional> #include <iterator> using namespace std; const int INF = INT_MAX / 2; int main() { int n, t; cin >> n >> t; vector<int> a(n); for(int i=0; i<n; ++i) cin >> a[i]; int aMin = INF; int diffMax = -INF; int cnt = 0; for(int i=0; i<n; ++i){ int diff = a[i] - aMin; if(diff == diffMax){ ++ cnt; } else if(diffMax < diff){ diffMax = diff; cnt = 1; } aMin = min(aMin, a[i]); } cout << cnt << endl; return 0; }
[ "kojinho10@gmail.com" ]
kojinho10@gmail.com
af055a368092d7521478d465d60346b2531911c9
452be58b4c62e6522724740cac332ed0fe446bb8
/src/cobalt/speech/sandbox/speech_sandbox.h
966ee3271282d609d6b6f65c0eb24776d06e7fe9
[ "Apache-2.0" ]
permissive
blockspacer/cobalt-clone-cab7770533804d582eaa66c713a1582f361182d3
b6e802f4182adbf6a7451a5d48dc4e158b395107
0b72f93b07285f3af3c8452ae2ceaf5860ca7c72
refs/heads/master
2020-08-18T11:32:21.458963
2019-10-17T13:09:35
2019-10-17T13:09:35
215,783,613
1
1
null
null
null
null
UTF-8
C++
false
false
2,051
h
// Copyright 2016 The Cobalt 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. #ifndef COBALT_SPEECH_SANDBOX_SPEECH_SANDBOX_H_ #define COBALT_SPEECH_SANDBOX_SPEECH_SANDBOX_H_ #include <memory> #include <string> #include "base/files/file_path.h" #include "base/threading/thread.h" #include "cobalt/dom/dom_settings.h" #include "cobalt/speech/sandbox/audio_loader.h" #include "cobalt/speech/speech_recognition.h" #include "cobalt/trace_event/scoped_trace_to_file.h" namespace cobalt { namespace speech { namespace sandbox { // This class is for speech sandbox application to experiment with voice search. // It takes a wav audio as audio input for a fake microphone, and starts/stops // speech recognition. class SpeechSandbox { public: // The constructor takes a file path string for an audio input and a log path // for tracing. SpeechSandbox(const std::string& file_path_string, const base::FilePath& trace_log_path); ~SpeechSandbox(); private: void StartRecognition(const dom::DOMSettings::Options& dom_settings_options); void OnLoadingDone(const uint8* data, int size); std::unique_ptr<trace_event::ScopedTraceToFile> trace_to_file_; std::unique_ptr<network::NetworkModule> network_module_; std::unique_ptr<AudioLoader> audio_loader_; scoped_refptr<SpeechRecognition> speech_recognition_; DISALLOW_IMPLICIT_CONSTRUCTORS(SpeechSandbox); }; } // namespace sandbox } // namespace speech } // namespace cobalt #endif // COBALT_SPEECH_SANDBOX_SPEECH_SANDBOX_H_
[ "trofimov_d_a@magnit.ru" ]
trofimov_d_a@magnit.ru
d9d91288f9d7b3c31be719ef5437b0dad244d364
0a443dbaeab480c5d05c9553d5aea9fc0c0a2af8
/src/util.h
570cded79eaa890e7bfa9f43338b5f4774044591
[]
no_license
thuskey/sidescroller
3cce32ee13d9f0bdf6198e8af581d9666a67cfa7
f5988a550a7deb9fd52691f157af75b9527a5257
refs/heads/master
2021-01-15T12:49:08.732698
2012-06-24T04:04:15
2012-06-24T04:04:15
null
0
0
null
null
null
null
UTF-8
C++
false
false
267
h
#ifndef UTIL_H #define UTIL_H #include <string> namespace Base64 { char *Decode(char *str, int *dbufsz); char *Encode(char *str); char *CleanString(char *str); }; void ParseRGB(const char *str, int *r, int *g, int *b); #endif // UTIL_H
[ "zxmarcos@gmail.com" ]
zxmarcos@gmail.com
1bd16073ec8a1f3521e2a2a1ae3837f03a502ac0
5253d4c4b2467c856d3490fc95f4a069bd3dbf8a
/lab4q4.cpp
960f3a1e89979c601592a1a869fc1cbdbc95421b
[]
no_license
Anujith123/lab-4
f30b4cd4fe174ab0e6fb859179610f6e5df2ec0a
368ff5b93fd80c421a345e96f656bff294750afe
refs/heads/master
2020-03-27T03:43:20.325241
2018-08-23T17:10:54
2018-08-23T17:10:54
145,884,453
0
0
null
null
null
null
UTF-8
C++
false
false
287
cpp
//include library #include<iostream> using namespace std; //using main function int main() { // declaring variables float x; //enter value cout<<"enter the number of days: \n"; cin >>x; //calculation cout<<"in years = "<<x/365.25<<"\nin weeks ="<<x/7<<"\nin days="<<x<<"\n"; return 0; }
[ "noreply@github.com" ]
Anujith123.noreply@github.com
2c0fde64edb5f672aa14b73fd0df0bbd5ac5e5e4
0f448094cf44550aa932011475a26360501b73b7
/include/boost/asio/execution/detail/as_receiver.hpp
3eefa5382f205b5411c256937211db34f0a3dfd0
[]
no_license
DaiJason/asio
0b1ca3bd3eba0143c6b9f509a26b03e8a32bd51a
b462d8fef2b64af3718c23141ec457821f5d44c1
refs/heads/master
2022-11-10T21:31:39.046058
2020-07-01T14:53:39
2020-07-01T14:53:39
276,620,049
0
0
null
2020-07-02T10:43:39
2020-07-02T10:43:39
null
UTF-8
C++
false
false
3,168
hpp
// // execution/detail/as_receiver.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2020 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // 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) // #ifndef BOOST_ASIO_EXECUTION_DETAIL_AS_RECEIVER_HPP #define BOOST_ASIO_EXECUTION_DETAIL_AS_RECEIVER_HPP #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> #include <boost/asio/detail/type_traits.hpp> #include <boost/asio/traits/set_done_member.hpp> #include <boost/asio/traits/set_error_member.hpp> #include <boost/asio/traits/set_value_member.hpp> #include <boost/asio/detail/push_options.hpp> namespace boost { namespace asio { namespace execution { namespace detail { template <typename Function, typename> struct as_receiver { Function f_; template <typename F> explicit as_receiver(BOOST_ASIO_MOVE_ARG(F) f) : f_(BOOST_ASIO_MOVE_CAST(F)(f)) { } void set_value() BOOST_ASIO_NOEXCEPT_IF(noexcept(declval<Function&>()())) { f_(); } template <typename E> void set_error(E) BOOST_ASIO_NOEXCEPT { std::terminate(); } void set_done() BOOST_ASIO_NOEXCEPT { } }; template <typename T> struct is_as_receiver : false_type { }; template <typename Function, typename T> struct is_as_receiver<as_receiver<Function, T> > : true_type { }; } // namespace detail } // namespace execution namespace traits { #if !defined(BOOST_ASIO_HAS_DEDUCED_SET_VALUE_MEMBER_TRAIT) template <typename Function, typename T> struct set_value_member< boost::asio::execution::detail::as_receiver<Function, T>, void()> { BOOST_ASIO_STATIC_CONSTEXPR(bool, is_valid = true); #if defined(BOOST_ASIO_HAS_NOEXCEPT) BOOST_ASIO_STATIC_CONSTEXPR(bool, is_noexcept = noexcept(declval<Function&>()())); #else // defined(BOOST_ASIO_HAS_NOEXCEPT) BOOST_ASIO_STATIC_CONSTEXPR(bool, is_noexcept = true); #endif // defined(BOOST_ASIO_HAS_NOEXCEPT) typedef void result_type; }; #endif // !defined(BOOST_ASIO_HAS_DEDUCED_SET_VALUE_MEMBER_TRAIT) #if !defined(BOOST_ASIO_HAS_DEDUCED_SET_ERROR_MEMBER_TRAIT) template <typename Function, typename T, typename E> struct set_error_member< boost::asio::execution::detail::as_receiver<Function, T>, E> { BOOST_ASIO_STATIC_CONSTEXPR(bool, is_valid = true); BOOST_ASIO_STATIC_CONSTEXPR(bool, is_noexcept = true); typedef void result_type; }; #endif // !defined(BOOST_ASIO_HAS_DEDUCED_SET_ERROR_MEMBER_TRAIT) #if !defined(BOOST_ASIO_HAS_DEDUCED_SET_DONE_MEMBER_TRAIT) template <typename Function, typename T> struct set_done_member< boost::asio::execution::detail::as_receiver<Function, T> > { BOOST_ASIO_STATIC_CONSTEXPR(bool, is_valid = true); BOOST_ASIO_STATIC_CONSTEXPR(bool, is_noexcept = true); typedef void result_type; }; #endif // !defined(BOOST_ASIO_HAS_DEDUCED_SET_DONE_MEMBER_TRAIT) } // namespace traits } // namespace asio } // namespace boost #include <boost/asio/detail/pop_options.hpp> #endif // BOOST_ASIO_EXECUTION_DETAIL_AS_RECEIVER_HPP
[ "chris@kohlhoff.com" ]
chris@kohlhoff.com
ca24226c5692fc523964e6e54bdc5448b8b18dd6
6f25c6660e770db7aa6c917834fa87ff3c784af3
/cocos2d/cocos/2d/CCFontAtlas.h
56a76bca29da441334d65c99a37b148f7ef82c07
[ "MIT" ]
permissive
lfeng1420/BrickGame
7c6808f7212211ad7dc12592063e505c95fdfadb
e4961a7454ae1adece6845c64a6ba8ac59856d68
refs/heads/master
2020-12-11T08:50:19.812761
2019-10-11T15:06:59
2019-10-11T15:06:59
49,433,572
42
14
null
null
null
null
UTF-8
C++
false
false
4,063
h
/**************************************************************************** Copyright (c) 2013 Zynga Inc. Copyright (c) 2013-2014 Chukong Technologies Inc. http://www.cocos2d-x.org 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 _CCFontAtlas_h_ #define _CCFontAtlas_h_ #include "base/CCPlatformMacros.h" #include "base/CCRef.h" #include "CCStdC.h" #include <string> #include <unordered_map> NS_CC_BEGIN //fwd class Font; class Texture2D; class EventCustom; class EventListenerCustom; struct FontLetterDefinition { unsigned short letteCharUTF16; float U; float V; float width; float height; float offsetX; float offsetY; int textureID; bool validDefinition; int xAdvance; int clipBottom; }; class CC_DLL FontAtlas : public Ref { public: static const int CacheTextureWidth; static const int CacheTextureHeight; static const char* EVENT_PURGE_TEXTURES; /** * @js ctor */ FontAtlas(Font &theFont); /** * @js NA * @lua NA */ virtual ~FontAtlas(); void addLetterDefinition(const FontLetterDefinition &letterDefinition); bool getLetterDefinitionForChar(char16_t letteCharUTF16, FontLetterDefinition &outDefinition); bool prepareLetterDefinitions(const std::u16string& utf16String); inline const std::unordered_map<ssize_t, Texture2D*>& getTextures() const{ return _atlasTextures;} void addTexture(Texture2D *texture, int slot); float getCommonLineHeight() const; void setCommonLineHeight(float newHeight); Texture2D* getTexture(int slot); const Font* getFont() const; /** listen the event that renderer was recreated on Android/WP8 It only has effect on Android and WP8. */ void listenRendererRecreated(EventCustom *event); /** Removes textures atlas. It will purge the textures atlas and if multiple texture exist in the FontAtlas. */ void purgeTexturesAtlas(); /** sets font texture parameters: - GL_TEXTURE_MIN_FILTER = GL_LINEAR - GL_TEXTURE_MAG_FILTER = GL_LINEAR */ void setAntiAliasTexParameters(); /** sets font texture parameters: - GL_TEXTURE_MIN_FILTER = GL_NEAREST - GL_TEXTURE_MAG_FILTER = GL_NEAREST */ void setAliasTexParameters(); private: void relaseTextures(); std::unordered_map<ssize_t, Texture2D*> _atlasTextures; std::unordered_map<unsigned short, FontLetterDefinition> _fontLetterDefinitions; float _commonLineHeight; Font * _font; // Dynamic GlyphCollection related stuff int _currentPage; unsigned char *_currentPageData; int _currentPageDataSize; float _currentPageOrigX; float _currentPageOrigY; float _letterPadding; bool _makeDistanceMap; int _fontAscender; EventListenerCustom* _rendererRecreatedListener; bool _antialiasEnabled; bool _rendererRecreate; }; NS_CC_END #endif /* defined(__cocos2d_libs__CCFontAtlas__) */
[ "lfeng1420@hotmail.com" ]
lfeng1420@hotmail.com
3303c86e8479e67e404c7e8934d4b5574a83d3b1
f5371e78a69065c7f12ad3c599b3ca72adf7b691
/src/app/gui.cpp
b3c0c954b29dcb3c0a49fd14df60753854b3897d
[]
no_license
LennyHEVS/RealTime
568e1cb2a03a0e16dd8d4ac0fdb0fca1f2c4f128
e4ddf853fc6c2dd32d0c2256c52e048208d93104
refs/heads/master
2023-02-02T09:42:49.813805
2020-12-20T17:02:47
2020-12-20T17:02:47
317,564,799
0
0
null
null
null
null
UTF-8
C++
false
false
5,823
cpp
#include <string.h> #include <assert.h> #include "trace/trace.h" #include "ui-gen/resources_manager.h" #include "ui-gen/gui.h" #include "gui.h" #define TOUCH_THREAD_STACK_SIZE 2048 namespace oscilloscope { GListener gl; Gui::Gui() : _pGuiObserver(nullptr), _redLedOn(false), _xAxisPixelsPerField(0) { } void Gui::initialize() { // Initialize the uGFX library gfxInit(); // Initialize the display guiInit(); guiShowPage(DP_OSCILLOSCOPE); // Some custom drawing options { // Set title background gwinSetBgColor(ghLabelTitle, RGB2COLOR(12, 12, 12)); gwinClear(ghLabelTitle); _xAxisPixelsPerField = gwinGetWidth(ghGraph) / observer().getTDivCount(); GGraphStyle graphStyle = { { GGRAPH_POINT_DOT, 3, GFX_WHITE }, // Point { GGRAPH_LINE_NONE, 1, GFX_WHITE }, // Line (change to GGRAPH_LINE_SOLIDE to show it) { GGRAPH_LINE_NONE, 0, GFX_BLACK }, // X axis { GGRAPH_LINE_NONE, 0, GFX_BLACK }, // Y axis { GGRAPH_LINE_DASH, 4, GFX_GRAY, _xAxisPixelsPerField }, // X grid { GGRAPH_LINE_NONE, 0, GFX_GRAY, 50 }, // Y grid GWIN_GRAPH_STYLE_POSITIVE_AXIS_ARROWS // Flags }; // Set graph style gwinSetBgColor(ghGraph, RGB2COLOR(100, 100, 100)); gwinClear(ghGraph); gwinGraphSetStyle(ghGraph, &graphStyle); // Disable red LED setRedLed(false); } // We want to listen for widget events geventListenerInit(&gl); gwinAttachListener(&gl); } bool Gui::registerObserver(interface::GuiObserver * pGuiObserver) { if (!_pGuiObserver and pGuiObserver) { _pGuiObserver = pGuiObserver; return true; } return false; } void Gui::start() { createTouchThread(); startBehavior(); } void Gui::drawGraphPoints(uint16_t * values, uint16_t count, float xScale /* = 1 */) { const coord_t Y_SPACE = 4; // Keep a little space left on top and bottom const coord_t MAX_WIDTH = gwinGetWidth(ghGraph); const coord_t MAX_HEIGHT = gwinGetHeight(ghGraph) - (2 * Y_SPACE); if (ghGraph) { uint32_t MAX = count; point * const points = (point *)gfxAlloc(sizeof(point) * MAX); if (points) { gwinClear(ghGraph); // Draw grid gwinGraphDrawAxis(ghGraph); gwinGraphStartSet(ghGraph); // Push values into point array for (uint32_t i = 0; i < MAX; i++) { points[i].x = i * xScale; points[i].y = values[i] * MAX_HEIGHT / 4096; // Scaling points[i].y += Y_SPACE; // y axis offset //points[i].y = 0.5*i; // Generate fake data // Check if we run out of boundaries if (points[i].x > MAX_WIDTH) { MAX = i; // Adjust amount of points to draw break; } } // Draw signal values gwinGraphDrawPoints(ghGraph, points, MAX); gfxFree(points); } } } bool Gui::isRedLedEnabled() const { return _redLedOn; } void Gui::setRedLed(bool enable) { _redLedOn = enable; if (enable) { gwinImageOpenFile(ghRedLed, gstudioGetImageFilePath(ledredon)); } else { gwinImageOpenFile(ghRedLed, gstudioGetImageFilePath(ledredoff)); } } bool Gui::isOscilloscopePageEnabled() const { return gwinGetVisible(ghPageContainerDp_oscilloscope); } void Gui::setTimeDivisionText(std::string text) { gwinSetText(ghLabelTimeDiv, text.c_str(), true); } void Gui::setFreqGenWaveformText(std::string text) { gwinSetText(ghLabelSignalForm, text.c_str(), true); } void Gui::setFreqGenFrequencyText(std::string text) { gwinSetText(ghLabelSignalFrequ, text.c_str(), true); } XFEventStatus Gui::processEvent() { #if (PORT_IDF_STM32CUBE != 0) GEN(XFNullTransition); gfxYield(); // Switch to next thread #endif return XFEventStatus::Consumed; } static DECLARE_THREAD_STACK(touchThread, TOUCH_THREAD_STACK_SIZE); DECLARE_THREAD_FUNCTION(touchThreadHandler, arg) { GEvent * pe; Gui & gui = *(Gui *)arg; while (TRUE) { pe = geventEventWait(&gl, TIME_INFINITE); assert(pe); // May indicate that thread stack is too small! switch(pe->type) { case GEVENT_GWIN_BUTTON: { GHandle buttonHandle = ((GEventGWinButton*)pe)->gwin; if (buttonHandle == ghPushButtonTrigger) { Trace::out("Trigger button pressed"); gui.setRedLed(!gui.isRedLedEnabled()); } else if (buttonHandle == ghPushButtonTimePlus) { gui.onButtonTimePlusPressed(); } else if (buttonHandle == ghPushButtonTimeMinus) { gui.onButtonTimeMinusPressed(); } } break; default: break; } } #if (GFX_USE_OS_RAW32 != GFXOFF) return 0; #endif // GFX_USE_OS_RAW32 } void Gui::createTouchThread() { gfxThreadCreate(touchThread, TOUCH_THREAD_STACK_SIZE, 3 /*makeFreeRtosPriority(osPriorityNormal)*/, &touchThreadHandler, this); } void Gui::onButtonTimePlusPressed() { _pGuiObserver->onButtonTimePlusPressed(); } void Gui::onButtonTimeMinusPressed() { _pGuiObserver->onButtonTimeMinusPressed(); } } // namespace oscilloscope
[ "lenny.favre@students.hevs.ch" ]
lenny.favre@students.hevs.ch
a8fa877067e044a21f25010e9bfa9c3187623b45
8cc95381e7c810f0ee4921fb2e6140748dd3ea57
/100_199/100_is_same_tree.h
335e67776f67288732c9e4a6093fc7edff5c1f8e
[]
no_license
wangchenwc/leetcode_cpp
5691fd6091050cd09ececfa94c02497f78b88293
6c0c847f25710781f40a2817cb0e0152002f1755
refs/heads/master
2020-04-22T02:36:02.836904
2018-11-08T06:13:00
2018-11-08T06:13:00
null
0
0
null
null
null
null
UTF-8
C++
false
false
685
h
// // 100_is_same_tree.h // cpp_code // // Created by zhongyingli on 2018/7/11. // Copyright © 2018 zhongyingli. All rights reserved. // #ifndef _00_is_same_tree_h #define _00_is_same_tree_h //Definition for a binary tree node. struct TreeNode { int val; TreeNode *left; TreeNode *right; TreeNode(int x) : val(x), left(NULL), right(NULL) {} }; class Solution { public: bool isSameTree(TreeNode* p, TreeNode* q) { if(!p && !q) return true; if(!p || !q) return false; return (p->val==q->val) && isSameTree(p->left, q->left) && isSameTree(p->right, q->right); } }; #endif /* _00_is_same_tree_h */
[ "lizhongying@ofo.com" ]
lizhongying@ofo.com
8c1ec4445099e162a772d5db5ec84d9e358dafa2
21b99ea7396881e8a56f41b53e5672e689c805a7
/omnetpp-5.2.1/tools/macosx/include/osgEarthUtil/TMSPackager
1a170568066bfb5e20b7666541432052046b35b3
[]
no_license
mohammedalasmar/omnetpp-data-transport-model-ndp
7bf8863091345c0c7ce5b5e80052dc739baa8700
cbede62fc2b375e8e0012421a4d60f70f1866d69
refs/heads/master
2023-06-27T06:17:57.433908
2020-10-09T11:30:02
2020-10-09T11:30:02
194,747,934
2
2
null
2021-08-02T17:03:56
2019-07-01T21:54:32
HTML
UTF-8
C++
false
false
6,227
/* -*-c++-*- */ /* osgEarth - Dynamic map generation toolkit for OpenSceneGraph * Copyright 2008-2013 Pelican Mapping * http://osgearth.org * * osgEarth is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see <http://www.gnu.org/licenses/> */ #ifndef OSGEARTHUTIL_TMS_PACKAGER_H #define OSGEARTHUTIL_TMS_PACKAGER_H #include <osgEarthUtil/Common> #include <osgEarth/ImageLayer> #include <osgEarth/ElevationLayer> #include <osgEarth/Profile> #include <osgEarth/TaskService> namespace osgEarth { namespace Util { /** * Utility that reads tiles from an ImageLayer or ElevationLayer and stores * the resulting data in a disk-based TMS (Tile Map Service) repository. * * See: http://wiki.osgeo.org/wiki/Tile_Map_Service_Specification */ class OSGEARTHUTIL_EXPORT TMSPackager { public: /** * Constructs a new packager. * @param profile Profile of packaged tile data (required) */ TMSPackager( const Profile* outProfile, osgDB::Options* imageWriteOptions); /** dtor */ virtual ~TMSPackager() { } /** * Whether to dump out progress messages * default = false */ void setVerbose( bool value ) { _verbose = value; } bool getVerbose() const { return _verbose; } /** * Whether to abort if a tile writing error is encountered * default = true */ void setAbortOnError( bool value ) { _abortOnError = value; } bool getAbortOnError() const { return _abortOnError; } /** * Maximum level of detail of tiles to package */ void setMaxLevel( unsigned value ) { _maxLevel = value; } unsigned getMaxLevel() const { return _maxLevel; } /** * Whether to overwrite files that already exist in the repo * default = false */ void setOverwrite( bool value ) { _overwrite = value; } bool getOverwrite() const { return _overwrite; } /** * Whether to package empty image tiles. An empty tile is a tile * that is fully transparent. By default, the packager discards * them and does not subdivide past them. * default = false */ void setKeepEmptyImageTiles( bool value ) { _keepEmptyImageTiles = value; } bool getKeepEmptyImageTiles() const { return _keepEmptyImageTiles; } /** * Whether to subdivide single color image tiles. An single color tile is a tile * that is filled with a single color. By default, the packager does not subdivide past them. * default = false */ void setSubdivideSingleColorImageTiles( bool value ) { _subdivideSingleColorImageTiles = value; } bool getSubdivideSingleColorImageTiles() const { return _subdivideSingleColorImageTiles; } /** * Bounding box to package */ void addExtent( const GeoExtent& value ); /** * Result structure for method calls */ struct Result { Result(int tasks=0) : ok(true), taskCount(tasks) { } Result(const std::string& m) : message(m), ok(false), taskCount(0) { } operator bool() const { return ok; } bool ok; std::string message; int taskCount; }; /** * Packages an image layer as a TMS repository. * @param layer Image layer to export * @param rootFolder Root output folder of TMS repo * @param imageExtension (optional) Force an image type extension (e.g., "jpg") */ Result package( ImageLayer* layer, const std::string& rootFolder, osgEarth::ProgressCallback* progress=0L, const std::string& imageExtension="png" ); /** * Packages an elevation layer as a TMS repository. * @param layer Image layer to * @param rootFolder Root output folder of TMS repo */ Result package( ElevationLayer* layer, const std::string& rootFolder, osgEarth::ProgressCallback* progress=0L ); protected: int packageImageTile( ImageLayer* layer, const TileKey& key, const std::string& rootDir, const std::string& extension, osgEarth::TaskRequestVector& tasks, Threading::MultiEvent* semaphore, osgEarth::ProgressCallback* progress, unsigned& out_maxLevel ); int packageElevationTile( ElevationLayer* layer, const TileKey& key, const std::string& rootDir, const std::string& extension, osgEarth::TaskRequestVector& tasks, Threading::MultiEvent* semaphore, osgEarth::ProgressCallback* progress, unsigned& out_maxLevel ); bool shouldPackageKey( const TileKey& key ) const; protected: bool _verbose; bool _abortOnError; bool _overwrite; bool _keepEmptyImageTiles; bool _subdivideSingleColorImageTiles; unsigned _maxLevel; std::vector<GeoExtent> _extents; osg::ref_ptr<const Profile> _outProfile; osg::ref_ptr<osgDB::Options> _imageWriteOptions; }; } } // namespace osgEarth::Util #endif // OSGEARTHUTIL_TMS_PACKAGER_H
[ "mohammedzsalasmar@gmail.com" ]
mohammedzsalasmar@gmail.com
ce2f8056236e9e2a6ab5aa43dd2c7b1db8395cbd
41578b9248dc2f5671fbf6c793f88ae61f75014e
/TFT_Dispaly/Nova-Touch/Module-Development/scaleSetup/June-21/scaleSetup-12-06-21/commonGlobal.h
4304a1936948dabebdb5ca52ce9575bcb801f179
[]
no_license
axisElectronics/Axis_Company_Project
89fb56de1c1cd0d5044a36b64369127e01cba1d2
089e3e0c63ce9156e888738fd9262124c9345c1c
refs/heads/master
2023-08-26T19:41:18.505678
2021-11-08T09:33:26
2021-11-08T09:33:26
null
0
0
null
null
null
null
UTF-8
C++
false
false
20,657
h
#ifndef __COMMONGLOBAL_H #define __COMMONGLOBAL_H #include "headerFiles.h" #include <FS.h> #include <SPIFFS.h> /********* MACROs Decalration ***********/ // Serial_1 will be used for getting data from Arduino NANO for Keypad data. #define RXD1 32 #define TXD1 33 // Serial_2 will be used for getting Weighing Scale data from machine. #define RXD2 16 #define TXD2 17 #define rgb565(r,g,b) { digitHandler->digitColor[0] = r; digitHandler->digitColor[1] = g; digitHandler->digitColor[2] = b; } #define findDotPosition( buf, dotpos) { while(buf[dotpos++] != '.'); dotpos--; } /*************************** Defines ***************************/ #define basicImages(classX) { \ classX.weighingMode(); \ classX.batterySymbl(); \ classX.stableSymbl(0); \ classX.zeroSymbl(0); \ classX.tareweightSymbl(0); \ } #define parshDateformat( dest, src ) { \ if ( src[1] == '/' ) { \ dest[0] = '0'; \ dest[1] = src[0]; \ dest[2] = '/'; \ \ if ( src[3] == '/' ) { \ dest[3] = '0'; \ dest[4] = src[2]; \ dest[5] = src[3]; \ dest[6] = src[6]; \ dest[7] = src[7]; \ dest[8] = '\0'; \ }else if ( src[4] == '/' ){\ dest[3] = src[2]; \ dest[4] = src[3]; \ dest[5] = src[4]; \ dest[6] = src[7]; \ dest[7] = src[8]; \ dest[8] = '\0'; \ } \ }else if ( src[2] == '/' ) {\ dest[0] = src[0]; \ dest[1] = src[1]; \ dest[2] = '/'; \ \ if( src[4] == '/' ){ \ dest[3] = '0'; \ dest[4] = src[3]; \ dest[5] = src[4]; \ dest[6] = src[5]; \ dest[7] = src[6]; \ dest[8] = '\0'; \ }else if( src[5] == '/' )\ { \ dest[3] = src[3]; \ dest[4] = src[4]; \ dest[5] = src[5]; \ dest[6] = src[6]; \ dest[7] = src[7]; \ dest[8] = '\0'; \ } \ } \ } #define parshTimeFormat(dest, src) { \ if ( src[1] == ':' ) { \ dest[0] = '0'; \ dest[1] = src[0]; \ dest[2] = ':'; \ }else if( src[2] == ':' ) \ { \ dest[0] = src[0]; \ dest[1] = src[1]; \ dest[2] = ':'; \ } \ \ if ( src[3] == ':' ) { \ dest[3] = '0'; \ dest[4] = src[2]; \ dest[5] = '\0'; \ }else if ( src[4] == ':' ){ \ dest[3] = src[2]; \ dest[4] = src[3]; \ dest[5] = '\0'; \ }else if( src[5] == ':' ){ \ dest[3] = src[3]; \ dest[4] = src[4]; \ dest[5] = '\0'; \ } \ } #define Enable_Text_Font() { \ tft.setTextSize( 1 ); \ tft.setFreeFont( (const GFXfont *)EUROSTILE_B20 ); \ tft.setTextColor(TFT_WHITE, TFT_BLACK); \ } #define eliminateLeadingZeros(buf, dotpos, cnt) { \ for(uint8_t i=0; i < dotpos-1; i++) \ { \ if( buf[i] == '0') \ ++cnt; \ else \ { \ break; \ } \ } \ \ } #define bufferWithoutDot(dest, src) { \ for(uint8_t i=0, j=0; i < 7; ++i) \ { \ if( src[i] != '.' ) \ dest[j++] = src[i]; \ } \ } #define convertDoubleToCharArray(d_val, c_val) { \ char temp[8]; \ dtostrf(d_val,7,3,temp); \ memset(c_val, '0', 7); \ uint8_t idx = 0; \ findDotPosition(temp, idx); \ idx = dotpos - idx; \ strcpy( &c_val[idx], temp); \ for(uint8_t i=0; i < 7; i++ ) { if( c_val[i] == 32 ) c_val[i] = 48; } \ c_val[7] = '\0'; \ } #define AdjustDot( buf ) { \ if( !(strstr(buf, ".") ) ) \ { \ char temp[7] = {0}; \ uint8_t dotcnt = 0; \ memset(temp, '0', 7); \ findDotPosition( buf, dotcnt ); \ strcpy( &temp[digitHandler->dotpos - dotcnt], buf ); \ strcpy( buf, (const char *)temp); \ } \ }//End-AdjustDot /* ============================================================== Commands ============================================================= 1 @ CMD_STARTDATA : -------------------- >> get continuous data from Machine. 2 @ CMD_STOPDATA : ------------------- >> stop data coming from Weight machine >> stop continuous data from machine SO that we didnot overflow buffer. 3 @ CMD_GETTARE : ----------------- >> get TARE data from Machine */ #define CMD_STARTDATA { \ String StartCMD = "\2DT#1\3"; \ Serial2.print( StartCMD ); \ } #define CMD_STOPDATA { \ String StopCMD = "\2DT#0\3"; \ Serial2.print(StopCMD); \ } #define CMD_ZERODATA { \ String StopCMD = "\2Z\3"; \ Serial2.print(StopCMD); \ } #define CMD_AUTOTARE { \ String StopCMD = "\2T\3"; \ Serial2.print(StopCMD); \ } #define CMD_GETTARE { \ String StartCMD = "\2GT\3"; \ Serial2.print( StartCMD ); \ } #define STOP_SERIAL1 Serial1.end(); #define START_SERIAL1 Serial1.begin(9600, SERIAL_8N1, RXD1, TXD1); // keypad #define STOP_SERIAL2 Serial2.end(); #define START_SERIAL2 Serial2.begin(9600, SERIAL_8N1, RXD2, TXD2); // Weight Mechine #define EMPTY_SERIALBUFFER { \ while ( Serial2.available() ) Serial2.read(); \ while ( Serial1.available() ) Serial1.read(); \ while ( Serial.available() ) Serial.read(); \ } #define WQ 0 #define TQ 5 #define TareWeight 6 #define StopWeightData 12 #define StartWeightData 13 #define GetTareWeightData 14 #define Field_three_Touch ( ( (xAxis > 300) && (xAxis < 480) ) && ( ( yAxis > 160 ) && ( yAxis < 240 ) ) ) #define Field_Two_Touch ( ( (xAxis > 0) && (xAxis < 216) ) && ( ( yAxis > 160 ) && ( yAxis < 240 ) ) ) #define Taretouch_Auto ( ( (xAxis > 405) && (xAxis < 480) ) && ( ( yAxis > 259 ) && ( yAxis < 313 ) ) ) #define Zerotouch ( ( (xAxis > 300) && (xAxis < 385) ) && ( ( yAxis > 259 ) && ( yAxis < 313 ) ) ) #define ESC_Touch ( ( (xAxis > 0) && (xAxis < 85) ) && ( ( yAxis > 259 ) && ( yAxis < 313 ) ) ) #define makeCustomColor( red, green , blue ) (((red & 0xf8)<<8) + ((green & 0xfc)<<3)+(blue>>3)) /******************************************************************************************** Below MACROs are used to identify The Touch of STARTUP window. User has few options Which are Listed below. @ Weight Mode : After Touching This option, User is allowed to use functionality of Weighing Mechine. @ Pricing Mode : After Touching This option, User is allowed to use functionality of Pricing Mechine. @ Counting Mode : After Touching This option, User is allowed to use functionality of Counting Mechine. @ Check Weighing Mode : After Touching This option, User is allowed to use functionality of Check Weighing Mechine. @ Setting Mode : Setting Mode Allowed to User to change machine functionality as per Requirements. After machine is configured by user. Next user can choose among 4 Modes. @ Go Back -->>> Which is not Implimented Yet. *********************************************************************************************/ #define x1Weighing 15 #define x2Weighing 108 #define y1Weighing 70 #define y2Weighing 230 #define xWeighingMode ( ( xAxis >= x1Weighing ) && (xAxis <= x2Weighing ) ) #define yWeighingMode ( ( yAxis >= y1Weighing ) && ( yAxis <= y2Weighing ) ) #define WeighingModeTouchEnable() ( xWeighingMode && yWeighingMode ) //#define WeighingModeTouchEnable() ( ( (xAxis > 15) && (xAxis < 108) ) && ( ( yAxis > 70 ) && ( yAxis < 230 ) ) ) /**********************************************************************************************/ #define x1Counting 135 #define x2Counting 222 #define y1Counting 70 #define y2Counting 230 #define xCountingMode ( ( xAxis >= x1Counting ) && ( xAxis <= x2Counting ) ) #define yCountingMode ( ( yAxis >= y1Counting ) && ( yAxis <= y2Counting ) ) #define CountingModeTouchEnable() ( xCountingMode && yCountingMode ) /**********************************************************************************************/ #define x1Priceing 251 #define x2Priceing 345 #define y1Priceing 70 #define y2Priceing 230 #define xPriceingMode ( ( xAxis >= x1Priceing ) && ( xAxis <= x2Priceing ) ) #define yPriceingMode ( ( yAxis >= y1Priceing ) && ( yAxis <= y2Priceing ) ) #define PriceingModeTouchEnable() ( xPriceingMode && yPriceingMode ) /**********************************************************************************************/ #define x1Checking 377 #define x2Checking 470 #define y1Checking 70 #define y2Checking 230 #define xCheckingMode ( ( xAxis >= x1Checking ) && ( xAxis <= x2Checking ) ) #define yCheckingMode ( ( yAxis >= y1Checking ) && ( yAxis <= y2Checking ) ) #define CheckingModeTouchEnable() ( xCheckingMode && yCheckingMode ) /**********************************************************************************************/ #define x1Setting 13 #define x2Setting 270 #define y1Setting 252 #define y2Setting 303 #define xSetting ( ( xAxis >= x1Setting ) && ( xAxis <= x2Setting ) ) #define ySetting ( ( yAxis >= y1Setting ) && ( yAxis <= y2Setting ) ) #define SettingTouchEnable() ( xSetting && ySetting ) /**********************************************************************************************/ #define x1GoBack 258 #define x2GoBack 460 #define y1GoBack 252 #define y2GoBack 303 #define xGoBack ( ( xAxis >= x1GoBack ) && ( xAxis <= x2GoBack ) ) #define yGoBack ( ( yAxis >= y1GoBack ) && ( yAxis <= y2GoBack ) ) /**********************************************************************************************/ enum _machine { keep_running = 0, WeighingMachine = 1, CountingMachine, PricingMachine, CheckWeighing, Settings, Go_Back }; struct task_list { char CmdName[16]; char (*Task)(void); }; char CmdWrite( struct task_list *CmdTaskHandler ); #define GROSS 0 #define NET 1 #define TARE 2 #define PRICE 1 #define perPCS 2 class WeighingHandle : public settings { public : uint8_t flags; double FromMachine[3]; char FromMachineArray[3][10]; char maxvalue[10]; char minvalue[10]; struct _imageAttri { bool (*ModeHeader)(void); bool (*stableUnstableFlag)(bool showHide); bool (*tareFlag)(bool showHide); bool (*zeroFlag)(bool showHide); }; struct _showDigits { int8_t selectWindow; int8_t digitFontSize; const void *digitFontStyle; char preValue[3][10]; char currentValue[10]; uint8_t dotPosition; uint16_t fontDigitColor; uint16_t backDigitColor; int8_t cntBlankRect; bool spclFlag = 0; } showDigits; struct _digithandler { enum _machine machineMode; struct _imageAttri imageCallback; struct s_setting *basesetting; } handler; struct rtcvar { uint8_t hour; uint8_t minute; uint8_t second; uint8_t mday; uint8_t mon; uint16_t year; uint8_t wday; } RTCHandler; void drawJpeg(const char *filename, int xpos, int ypos); void jpegRender(int xpos, int ypos); void jpegInfo(); /****************************************** >>>> common function <<<< ******************************************/ void initTFTHandler( ); void initWeighingTFT( ); String handleFlags( char *Weight ); void windowOne( ); void windowTwo( ); void windowThree( ); /* Basic images required for all 4 Modes */ bool weighingMode(); bool BootingImage(); bool startUPImage(); bool numKeypad(); bool tareweightSymbl(uint8_t flag); bool batterySymbl(); bool zeroSymbl(uint8_t flag); bool stableSymbl(uint8_t flag); bool cross(uint16_t x, uint16_t y); void readyAxisScales(); /****************************************** >>>> Weight function <<<< ******************************************/ int8_t startWeighing(); String _readbufWeight( ); void _updateTareWeight( char *Temp ); void _updateGrossWeight( ); void _updateNetWeight( char *Temp ); void _updateWindow( uint8_t win ); void handleTareCommand( char *Weight ); bool printStringWeight( ); int8_t handleTouchFuncationality_Weight(); bool weightStripImage(); /****************************************** >>>> Price computing function <<<< ******************************************/ int8_t startPriceComputing(); void _updateWindowPricing( uint8_t win ); void _updateTotalWeight( char *Temp ); void _updateWeightPrice(); void _updateWeightperPrice( char *Temp ); int8_t handleTouchFuncationality_PRICE(); String _readbufPrice( ); bool printStringPrice( ); bool priceStripImage(); /****************************************** >>>> COUNT computing function <<<< ******************************************/ int8_t startCountComputing(); void _updateWindowCOUNT( uint8_t win ); void _updateTotalWeightCOUNT( char *Temp ); void updateTotalPcsWindow(); void _updateWeightCOUNT(); void _updateWeightperCOUNT( char *Temp ); int8_t handleTouchFuncationality_COUNT(); String _readbufCOUNT( ); bool printStringCOUNT( ); bool countStripImage(); /****************************************** >>>> Check Weighing function <<<< ******************************************/ int8_t startCheckWeighing(); void _updateWindowCHECK( uint8_t win ); int8_t handleTouchFuncationality_CHECK(); String _readbufCHECK( ); void _updateWeightWindowCHECK( char *Temp, uint8_t win); void _updateTotalWeightCHECK( char *Temp ); void _maxWin(char * maxValue ); void _minWin(char * minValue ); bool printStringCHECK( ); void windowOneCHECK( ); /******************************************* >>>> RTC Module <<<<< *******************************************/ void intitRTC(); void updateRTCVariable(); void setRTCValue(); }; char nullfunc(); #define x1Zero 343 #define x2Zero 415 #define y1Zero 240 #define y2Zero 304 #define xZero ( ( xAxis >= x1Zero ) && (xAxis <= x2Zero ) ) #define yZero ( ( yAxis >= y1Zero ) && ( yAxis <= y2Zero ) ) /**********************************************************************************************/ #define x1One 255 #define x2One 320 #define y1One 150 #define y2One 210 #define xOne ( ( xAxis >= x1One ) && ( xAxis <= x2One ) ) #define yOne ( ( yAxis >= y1One ) && ( yAxis <= y2One ) ) /**********************************************************************************************/ #define x1Two 345 #define x2Two 415 #define y1Two 150 #define y2Two 210 #define xTwo ( ( xAxis >= x1Two ) && (xAxis <= x2Two ) ) #define yTwo ( ( yAxis >= y1Two ) && ( yAxis <= y2Two ) ) /**********************************************************************************************/ #define x1Three 429 #define x2Three 480 #define y1Three 150 #define y2Three 210 #define xThree ( ( xAxis >= x1Three ) && (xAxis <= x2Three ) ) #define yThree ( ( yAxis >= y1Three ) && ( yAxis <= y2Three ) ) /**********************************************************************************************/ #define x1Four 255 #define x2Four 320 #define y1Four 70 #define y2Four 120 #define xFour ( ( xAxis >= x1Four ) && (xAxis <= x2Four ) ) #define yFour ( ( yAxis >= y1Four ) && ( yAxis <= y2Four ) ) /**********************************************************************************************/ #define x1Five 345 #define x2Five 415 #define y1Five 70 #define y2Five 120 #define xFive ( ( xAxis >= x1Five ) && (xAxis <= x2Five ) ) #define yFive ( ( yAxis >= y1Five ) && ( yAxis <= y2Five ) ) /**********************************************************************************************/ #define x1Six 429 #define x2Six 480 #define y1Six 70 #define y2Six 120 #define xSix ( ( xAxis >= x1Six ) && (xAxis <= x2Six ) ) #define ySix ( ( yAxis >= y1Six ) && ( yAxis <= y2Six ) ) /**********************************************************************************************/ #define x1Seven 255 #define x2Seven 320 #define y1Seven 0 #define y2Seven 50 #define xSeven ( ( xAxis >= x1Seven ) && (xAxis <= x2Seven ) ) #define ySeven ( ( yAxis >= y1Seven ) && ( yAxis <= y2Seven ) ) /**********************************************************************************************/ #define x1Eight 345 #define x2Eight 415 #define y1Eight 0 #define y2Eight 50 #define xEight ( ( xAxis >= x1Eight ) && (xAxis <= x2Eight ) ) #define yEight ( ( yAxis >= y1Eight ) && ( yAxis <= y2Eight ) ) /**********************************************************************************************/ #define x1Nine 429 #define x2Nine 480 #define y1Nine 0 #define y2Nine 50 #define xNine ( ( xAxis >= x1Nine ) && (xAxis <= x2Nine ) ) #define yNine ( ( yAxis >= y1Nine ) && ( yAxis <= y2Nine ) ) /**********************************************************************************************/ #define x1Dot 255 #define x2Dot 320 #define y1Dot 240 #define y2Dot 303 #define xDot ( ( xAxis >= x1Dot ) && ( xAxis <= x2Dot ) ) #define yDot ( ( yAxis >= y1Dot ) && ( yAxis <= y2Dot ) ) /******************************************************************************/ #define x1Del 165 #define x2Del 240 #define y1Del 240 #define y2Del 304 #define xDel ( ( xAxis >= x1Del ) && ( xAxis <= x2Del ) ) #define yDel ( ( yAxis >= y1Del ) && ( yAxis <= y2Del ) ) /******************************************************************************/ #define x1Clear 165 #define x2Clear 240 #define y1Clear 150 #define y2Clear 210 #define xClear ( ( xAxis >= x1Clear ) && ( xAxis <= x2Clear ) ) #define yClear ( ( yAxis >= y1Clear ) && ( yAxis <= y2Clear ) ) /******************************************************************************/ #define x1Ent 429 #define x2Ent 480 #define y1Ent 240 #define y2Ent 304 #define xEnt ( ( xAxis >= x1Ent ) && ( xAxis <= x2Ent ) ) #define yEnt ( ( yAxis >= y1Ent ) && ( yAxis <= y2Ent ) ) /******************************************************************************/ #define x1Del 255 #define x2Del 320 #define y1Del 240 #define y2Del 303 #define xDel ( ( xAxis >= x1Del ) && ( xAxis <= x2Del ) ) #define yDel ( ( yAxis >= y1Del ) && ( yAxis <= y2Del ) ) /******************************************************************************/ #endif
[ "viveky1794@gmail.com" ]
viveky1794@gmail.com
0c5d6b45c2530fa80f2c1883d157ecb67937f87a
e34b28b281a189888f1481c58b37c8faf2757988
/LeetCode/LeetCode_079.cpp
c02f489e6ea4436d0471c19b24fc9ce0db96dc9f
[]
no_license
reversed/C
aebafda0615c594a844dee1bb12fc683b9cd0c65
f6edb643723457276d8542eb7b583addfb6f1a7f
refs/heads/master
2020-04-10T22:05:26.689390
2019-06-22T02:56:26
2019-06-22T02:57:23
68,095,558
0
0
null
null
null
null
UTF-8
C++
false
false
1,365
cpp
class Solution { public: bool dfs(vector<vector<char>>& board, vector<vector<bool>>& map, int x, int y, string& word) { if (word.empty()) return true; if (x >= board.size() || x < 0) return false; if (y >= board[0].size() || y < 0) return false; if (map[x][y] == true) return false; char c = word.back(); if (board[x][y] != c) return false; map[x][y] = true; word.pop_back(); vector<pair<int, int>> step { {-1, 0}, {1, 0}, {0, -1}, {0, 1} }; for (auto p : step) { int tx = p.first + x; int ty = p.second + y; if (dfs(board, map, tx, ty, word)) return true; } map[x][y] = false; word.push_back(c); return false; } bool exist(vector<vector<char>>& board, string word) { if (word.empty()) return true; int row = board.size(); if (row == 0) return false; int col = board[0].size(); reverse(word.begin(), word.end()); vector<vector<bool>> access_map(row, vector(col, false)); for (int i = 0; i < row; ++i) { for (int j = 0; j < col; ++j) { if (dfs(board, access_map, i, j, word)) return true; } } return false; } };
[ "leichen.usst@gmail.com" ]
leichen.usst@gmail.com
bad01930753395f97a78056585ca48f4aba219f3
91783ac35f1303247826c984e648f4ba495055bc
/chapter7.cpp
fa3cfcf32fcad001e9b0a3fa899597f58301dfe3
[]
no_license
JkeeZander/HLPL1HEYH2J
bf838d8913b80b421933496826e16683b4f6d8f2
95821b6283696f92875cf3cdf3f61a3062c98935
refs/heads/main
2023-04-25T11:28:39.957321
2021-05-11T21:39:00
2021-05-11T21:39:00
339,593,553
0
1
null
null
null
null
UTF-8
C++
false
false
6,798
cpp
#include "std_lib_facilities.h" constexpr char number = '8'; constexpr char quit = 'q'; constexpr char print = ';'; constexpr char name = 'a'; constexpr char let = '#'; const string square = "sqrt"; //chapter 7 drill 7 const string power = "pow"; //chapter 7 drill 9 const string declkey = "#"; //chaoter 7 drill 10 const string quitkey = "quit"; //chapter 7 drill 11 double expression(); class Variable { public: string name; double value; }; vector<Variable> var_table; bool is_declared(string var){ for (const auto& v : var_table) if (v.name == var) return true; return false; } double define_name (string var, double val){ if (is_declared(var)) error(var, " declared twice"); var_table.push_back(Variable{var,val}); return val; } double get_value(string s){ for(const auto& v : var_table) if (v.name == s) return v.value; error("get: undefined variable", s); } void set_value(string s, double d){ for (auto& v : var_table) if(v.name == s){ v.value = d; return; } error("set: undefined variable", s); } class Token{ public: char kind; double value; string name; Token(): kind(0) {} Token(char ch): kind(ch), value(0) {} Token(char ch, double val): kind(ch), value(val) {} Token(char ch, string n): kind(ch), name(n) {} }; class Token_stream { public: Token_stream(); Token get(); void putback(Token t); void ignore(char c); private: bool full; Token buffer; }; Token_stream::Token_stream() :full(false), buffer(0) {} void Token_stream::putback(Token t){ if (full) error("putback() into full buffer"); buffer = t; full = true; } Token Token_stream::get(){ if (full){ full = false; return buffer; } char ch; cin >> ch; switch (ch){ case print: case '(': case ')': case '+': case '-': case '*': case '/': case '%': case '=': return Token(ch); case '.': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': { cin.putback (ch); double val; cin >> val; return Token(number, val); } default: { if (isalpha(ch)){ string s; s += ch; while (cin.get(ch) && (isalpha(ch) || isdigit(ch))) s+=ch; cin.putback(ch); if (s == declkey) return Token{let}; else if(s == quitkey) return Token(quit); //using same technique as with let to make string possible. else if(s == square) return Token('s'); //reading square returns token s that will be used for defining square method else if(s == power) return Token ('p'); //power for power function. else if (is_declared(s)) return Token(number, get_value(s)); return Token{name,s}; } error("Bad token"); } } } void Token_stream::ignore(char c){ if (full && c == buffer.kind){ full = false; return; } full = false; char ch = 0; while (cin>>ch) if (ch==c) return; } Token_stream ts; double primary(){ Token t = ts.get(); switch (t.kind){ case '(': { double d = expression(); t = ts.get(); if (t.kind != ')') error ("')' expected"); return d; } case number: return t.value; case '-': return - primary(); case '+': return primary(); case 's': //defining square function ALso chapter 7 drill 7 { char ch1; double toBeSquared; if(cin>>ch1 && ch1 == '('){ toBeSquared =expression(); } else error("The function starts with (!"); //eror checking if(ts.get().kind == ')'){ if(toBeSquared >=0) return sqrt(toBeSquared); else error(" argument cannot be smaller than 0!"); //error check if the value is negative since the square root cannot be found. Chapter 7 drill 8 } else error(" ) is needed for the end of the function!"); //eror check } case 'p': { char ch1; double toBePowered; int power; if(cin>>ch1 && ch1 =='('){ toBePowered = primary(); if(cin>>ch1 && ch1 ==','){ power = narrow_cast<int>(primary()); //using narrow cast to make sure that no info is lost/damaged seriously and making it integer since the task is to use integer for power funciton. Chapter 7 drill 9 } else error(" , is needed between arguments"); //error checking } else error("Enter ( first"); //error checking if(cin>>ch1 && ch1 ==')'){ return pow(toBePowered,power); } else error(") needed at the end of pow");//error checking } default: error("primary expected"); } } double term(){ double left = primary(); Token t = ts.get(); while(true){ switch (t.kind){ case '*': left *= primary(); t = ts.get(); break; case '/': { double d = primary(); if (d == 0) error ("divide by zero"); left /= d; t = ts.get(); break; } case '%': { double d = primary(); if (d == 0) error ("%: Zero oszto"); left = fmod (left, d); t = ts.get(); break; /* int i1 = narrow_cast<int>(left); int i2 = narrow_cast<int>(primary()); if (i2 == 0) error ("%: Zero oszto"); left = i1 % i2; t = ts.get(); break; */ } default: ts.putback(t); return left; } } } double expression(){ double left = term(); Token t = ts.get(); while (true){ switch(t.kind){ case '+': left += term(); t = ts.get(); break; case '-': left -= term(); t = ts.get(); break; default: ts.putback(t); return left; } } } void clean_up_mess(){ ts.ignore(print); } double declaration(){ Token t = ts.get(); if (t.kind != name) error("name expected in declaration"); string var_name = t.name; Token t2 = ts.get(); if (t2.kind != '=') error("= missing in declaration of ", var_name); double d = expression(); define_name(var_name, d); return d; } double statement(){ Token t = ts.get(); switch(t.kind){ case let: return declaration(); default: ts.putback(t); return expression(); } } void calculate(){ /* double val = 0; while (cin) try { Token t = ts.get(); while (t.kind == print) t = ts.get(); if (t.kind == quit) return; ts.putback(t); cout << "=" << statement() << endl; */ while (cin) try { Token t = ts.get(); while (t.kind == print) t = ts.get(); if (t.kind == quit) return; ts.putback(t); cout << "=" << statement() << endl; } catch (exception& e) { cerr << e.what() << endl; clean_up_mess(); } } int main() try { cout<<"Welcome to our simple calculator. Please enter expressions using floating-point numbers."<<endl; cout<<"The operators available are: +,-,*,/,%,sqrt(argument),pow(argument)"<<endl; define_name("pi", 3.1415926535); define_name("e", 2.7182818284); define_name("k",1000); //chapter 7 ,drill 6 calculate(); return 0; } catch (exception& e){ cerr << e.what() << endl; return 1; } catch (...) { cerr << "exception\n"; return 2; }
[ "noreply@github.com" ]
JkeeZander.noreply@github.com
5a160ce85e1b0c75b3d8eb4af849020c7e13ef86
7cd9751c057fcb36b91f67e515aaab0a3e74a709
/src/time_data/DT_Calculator_Exponential.cc
50022cf0071c8d3d0230b2ae963ccf50e4928db4
[ "MIT" ]
permissive
pgmaginot/DARK_ARTS
5ce49db05f711835e47780677f0bf02c09e0f655
f04b0a30dcac911ef06fe0916921020826f5c42b
refs/heads/master
2016-09-06T18:30:25.652859
2015-06-12T19:00:40
2015-06-12T19:00:40
20,808,459
0
0
null
null
null
null
UTF-8
C++
false
false
597
cc
#include "DT_Calculator_Exponential.h" DT_Calculator_Exponential::DT_Calculator_Exponential(const Input_Reader& input_reader) : V_DT_Calculator( input_reader ), m_ratio{input_reader.get_time_start_exponential_ratio() } , m_step_max{ int(ceil( log(m_dt_max/m_dt_min) / log(m_ratio) )) } { } double DT_Calculator_Exponential::calculate_dt(const int step, const double dt_old, const double adapt_criteria) { double dt; if(step ==0) { dt = m_dt_min; } else { dt = dt_old*m_ratio; } if( dt > m_dt_max) dt = m_dt_max; return dt; }
[ "pmaginot@tamu.edu" ]
pmaginot@tamu.edu
8cf26146ccce5b3c26d6f702f4a1f5c4c0dc3de7
c1ff870879152fba2b54eddfb7591ec322eb3061
/plugins/render/ogreRender/3rdParty/ogre/RenderSystems/GLES/include/EGL/OgreEGLContext.h
85a9b426e284c84ea5b472c970d4f3a48ab7120a
[ "LicenseRef-scancode-free-unknown", "MIT" ]
permissive
MTASZTAKI/ApertusVR
1a9809fb7af81c3cd7fb732ed481ebe4ce66fefa
424ec5515ae08780542f33cc4841a8f9a96337b3
refs/heads/0.9
2022-12-11T20:03:42.926813
2019-10-11T09:29:45
2019-10-11T09:29:45
73,708,854
188
55
MIT
2022-12-11T08:53:21
2016-11-14T13:48:00
C++
UTF-8
C++
false
false
2,402
h
/* ----------------------------------------------------------------------------- This source file is part of OGRE (Object-oriented Graphics Rendering Engine) For the latest info, see http://www.ogre3d.org/ Copyright (c) 2008 Renato Araujo Oliveira Filho <renatox@gmail.com> Copyright (c) 2000-2014 Torus Knot Software Ltd 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 __EGLContext_H__ #define __EGLContext_H__ #include "OgreGLESContext.h" namespace Ogre { class EGLSupport; class _OgrePrivate EGLContext: public GLESContext { protected: ::EGLConfig mConfig; const EGLSupport* mGLSupport; ::EGLSurface mDrawable; ::EGLContext mContext; EGLDisplay mEglDisplay; public: EGLContext(EGLDisplay eglDisplay, const EGLSupport* glsupport, ::EGLConfig fbconfig, ::EGLSurface drawable); virtual ~EGLContext(); virtual void _createInternalResources(EGLDisplay eglDisplay, ::EGLConfig glconfig, ::EGLSurface drawable, ::EGLContext shareContext); virtual void _destroyInternalResources(); virtual void setCurrent(); virtual void endCurrent(); virtual GLESContext* clone() const = 0; EGLSurface getDrawable() const; }; } #endif
[ "peter.kovacs@sztaki.mta.hu" ]
peter.kovacs@sztaki.mta.hu