blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
2
247
content_id
stringlengths
40
40
detected_licenses
listlengths
0
57
license_type
stringclasses
2 values
repo_name
stringlengths
4
111
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
58
visit_date
timestamp[ns]date
2015-07-25 18:16:41
2023-09-06 10:45:08
revision_date
timestamp[ns]date
1970-01-14 14:03:36
2023-09-06 06:22:19
committer_date
timestamp[ns]date
1970-01-14 14:03:36
2023-09-06 06:22:19
github_id
int64
3.89k
689M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
25 values
gha_event_created_at
timestamp[ns]date
2012-06-07 00:51:45
2023-09-14 21:58:52
gha_created_at
timestamp[ns]date
2008-03-27 23:40:48
2023-08-24 19:49:39
gha_language
stringclasses
159 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
7
10.5M
extension
stringclasses
111 values
filename
stringlengths
1
195
text
stringlengths
7
10.5M
a9eb496173c56844ec5eef1edf4d2c42b6dd17fe
3ff1fe3888e34cd3576d91319bf0f08ca955940f
/tke/include/tencentcloud/tke/v20180525/model/UpdateImageCacheRequest.h
36240990f2ac01e264bacd922ff2e364f0b1aeb6
[ "Apache-2.0" ]
permissive
TencentCloud/tencentcloud-sdk-cpp
9f5df8220eaaf72f7eaee07b2ede94f89313651f
42a76b812b81d1b52ec6a217fafc8faa135e06ca
refs/heads/master
2023-08-30T03:22:45.269556
2023-08-30T00:45:39
2023-08-30T00:45:39
188,991,963
55
37
Apache-2.0
2023-08-17T03:13:20
2019-05-28T08:56:08
C++
UTF-8
C++
false
false
9,751
h
UpdateImageCacheRequest.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_TKE_V20180525_MODEL_UPDATEIMAGECACHEREQUEST_H_ #define TENCENTCLOUD_TKE_V20180525_MODEL_UPDATEIMAGECACHEREQUEST_H_ #include <string> #include <vector> #include <map> #include <tencentcloud/core/AbstractModel.h> #include <tencentcloud/tke/v20180525/model/ImageRegistryCredential.h> namespace TencentCloud { namespace Tke { namespace V20180525 { namespace Model { /** * UpdateImageCache请求参数结构体 */ class UpdateImageCacheRequest : public AbstractModel { public: UpdateImageCacheRequest(); ~UpdateImageCacheRequest() = default; std::string ToJsonString() const; /** * 获取镜像缓存Id * @return ImageCacheId 镜像缓存Id * */ std::string GetImageCacheId() const; /** * 设置镜像缓存Id * @param _imageCacheId 镜像缓存Id * */ void SetImageCacheId(const std::string& _imageCacheId); /** * 判断参数 ImageCacheId 是否已赋值 * @return ImageCacheId 是否已赋值 * */ bool ImageCacheIdHasBeenSet() const; /** * 获取镜像缓存名称 * @return ImageCacheName 镜像缓存名称 * */ std::string GetImageCacheName() const; /** * 设置镜像缓存名称 * @param _imageCacheName 镜像缓存名称 * */ void SetImageCacheName(const std::string& _imageCacheName); /** * 判断参数 ImageCacheName 是否已赋值 * @return ImageCacheName 是否已赋值 * */ bool ImageCacheNameHasBeenSet() const; /** * 获取镜像仓库凭证数组 * @return ImageRegistryCredentials 镜像仓库凭证数组 * */ std::vector<ImageRegistryCredential> GetImageRegistryCredentials() const; /** * 设置镜像仓库凭证数组 * @param _imageRegistryCredentials 镜像仓库凭证数组 * */ void SetImageRegistryCredentials(const std::vector<ImageRegistryCredential>& _imageRegistryCredentials); /** * 判断参数 ImageRegistryCredentials 是否已赋值 * @return ImageRegistryCredentials 是否已赋值 * */ bool ImageRegistryCredentialsHasBeenSet() const; /** * 获取用于制作镜像缓存的容器镜像列表 * @return Images 用于制作镜像缓存的容器镜像列表 * */ std::vector<std::string> GetImages() const; /** * 设置用于制作镜像缓存的容器镜像列表 * @param _images 用于制作镜像缓存的容器镜像列表 * */ void SetImages(const std::vector<std::string>& _images); /** * 判断参数 Images 是否已赋值 * @return Images 是否已赋值 * */ bool ImagesHasBeenSet() const; /** * 获取镜像缓存的大小。默认为20 GiB。取值范围参考[云硬盘类型](https://cloud.tencent.com/document/product/362/2353)中的高性能云盘类型的大小限制。 * @return ImageCacheSize 镜像缓存的大小。默认为20 GiB。取值范围参考[云硬盘类型](https://cloud.tencent.com/document/product/362/2353)中的高性能云盘类型的大小限制。 * */ uint64_t GetImageCacheSize() const; /** * 设置镜像缓存的大小。默认为20 GiB。取值范围参考[云硬盘类型](https://cloud.tencent.com/document/product/362/2353)中的高性能云盘类型的大小限制。 * @param _imageCacheSize 镜像缓存的大小。默认为20 GiB。取值范围参考[云硬盘类型](https://cloud.tencent.com/document/product/362/2353)中的高性能云盘类型的大小限制。 * */ void SetImageCacheSize(const uint64_t& _imageCacheSize); /** * 判断参数 ImageCacheSize 是否已赋值 * @return ImageCacheSize 是否已赋值 * */ bool ImageCacheSizeHasBeenSet() const; /** * 获取镜像缓存保留时间天数,过期将会自动清理,默认为0,永不过期。 * @return RetentionDays 镜像缓存保留时间天数,过期将会自动清理,默认为0,永不过期。 * */ uint64_t GetRetentionDays() const; /** * 设置镜像缓存保留时间天数,过期将会自动清理,默认为0,永不过期。 * @param _retentionDays 镜像缓存保留时间天数,过期将会自动清理,默认为0,永不过期。 * */ void SetRetentionDays(const uint64_t& _retentionDays); /** * 判断参数 RetentionDays 是否已赋值 * @return RetentionDays 是否已赋值 * */ bool RetentionDaysHasBeenSet() const; /** * 获取安全组Id * @return SecurityGroupIds 安全组Id * */ std::vector<std::string> GetSecurityGroupIds() const; /** * 设置安全组Id * @param _securityGroupIds 安全组Id * */ void SetSecurityGroupIds(const std::vector<std::string>& _securityGroupIds); /** * 判断参数 SecurityGroupIds 是否已赋值 * @return SecurityGroupIds 是否已赋值 * */ bool SecurityGroupIdsHasBeenSet() const; private: /** * 镜像缓存Id */ std::string m_imageCacheId; bool m_imageCacheIdHasBeenSet; /** * 镜像缓存名称 */ std::string m_imageCacheName; bool m_imageCacheNameHasBeenSet; /** * 镜像仓库凭证数组 */ std::vector<ImageRegistryCredential> m_imageRegistryCredentials; bool m_imageRegistryCredentialsHasBeenSet; /** * 用于制作镜像缓存的容器镜像列表 */ std::vector<std::string> m_images; bool m_imagesHasBeenSet; /** * 镜像缓存的大小。默认为20 GiB。取值范围参考[云硬盘类型](https://cloud.tencent.com/document/product/362/2353)中的高性能云盘类型的大小限制。 */ uint64_t m_imageCacheSize; bool m_imageCacheSizeHasBeenSet; /** * 镜像缓存保留时间天数,过期将会自动清理,默认为0,永不过期。 */ uint64_t m_retentionDays; bool m_retentionDaysHasBeenSet; /** * 安全组Id */ std::vector<std::string> m_securityGroupIds; bool m_securityGroupIdsHasBeenSet; }; } } } } #endif // !TENCENTCLOUD_TKE_V20180525_MODEL_UPDATEIMAGECACHEREQUEST_H_
5ce0e3d5fb49a36819419b241bd24b5ce1e18774
ac15e9cbf344d0b401dc9c3101b0d608d3e7b933
/OVERLOADING OPERATORS/e1Complex.h
35d019c595411fe6070a87c1a2a91b9129030b62
[]
no_license
stefan-djordjevic/c_pluplus_short_tasks
f60b582d83b6a8a4d7b135edb6ad4ef8abfed864
6229d244ff7a12234de0459a6252334f539b0fb9
refs/heads/master
2023-05-25T12:51:12.691280
2021-06-14T13:59:36
2021-06-14T13:59:36
239,331,410
0
0
null
null
null
null
UTF-8
C++
false
false
1,010
h
e1Complex.h
#ifndef e1Complex #define e1Complex class Complex { double real, imag; public: Complex(); Complex(double, double); Complex(const Complex &); ~Complex() {} const double &getReal() const; const double &getImag() const; void setReal(const double); void setImag(const double); void setCmplx(const double, const double); Complex &operator = (const Complex &); friend Complex operator + (const Complex &, const Complex &); friend Complex operator + (const int &, const Complex &); friend Complex operator - (const Complex &, const Complex &); friend Complex operator - (const int &, const Complex &); friend Complex operator * (const Complex &, const Complex &); friend Complex operator * (const Complex &, const double); friend Complex operator / (const Complex &, const Complex &); friend Complex operator / (const int &, const Complex &); friend Complex operator ~ (const Complex &); friend double abs(const Complex &); void print() const; }; #endif
09b4e7403d9fd8bce7ed86343e3610d9b7a5a6aa
722e1fffdacae6407a2e581f22b4cbf56f152873
/Test/CmdMess/stdafx.h
8d53783814a6d26cac14369661660a950c87eb32
[ "MIT" ]
permissive
cryptobuks/QuantumGate
64fe891a0c1c0cfdffc43adbbadc9414656de8ff
e3200b558399b6c6eca0e0cbeddeaa06f7ea92b3
refs/heads/master
2020-11-26T02:22:42.421702
2019-12-16T22:57:51
2019-12-16T22:57:51
null
0
0
null
null
null
null
UTF-8
C++
false
false
830
h
stdafx.h
// This file is part of the QuantumGate project. For copyright and // licensing information refer to the license file(s) in the project root. // stdafx.h : include file for standard system include files, // or project specific include files that are used frequently, but // are changed infrequently // #pragma once #include "targetver.h" #include <stdio.h> #include <tchar.h> #include <iostream> #include <regex> #if defined(_DEBUG) #if !defined(_WIN64) #pragma comment (lib, "QuantumGate32D.lib") #else #pragma comment (lib, "QuantumGate64D.lib") #endif #else #if !defined(_WIN64) #pragma comment (lib, "QuantumGate32.lib") #else #pragma comment (lib, "QuantumGate64.lib") #endif #endif // Undefine conflicting macro from Windows SDK for gsl #pragma push_macro("max") #undef max #include <gsl/gsl> #pragma pop_macro("max")
7dea724f47bd1edce30c439f466b3cce70ea6dc4
d51e6bdbcf75a9b7f8195b79a4bfe20feeb845c0
/ViaEpd.h
d67acd41e07d5a9292cf779e15a069b825df6de4
[]
no_license
anthonytchen/LC_DPK
8a60ef23f5978ff67374d3331e1d2ceee7c0f8aa
d0db31b703157084d7b87a0715509c041b49a34a
refs/heads/master
2020-04-12T15:27:44.908445
2017-01-24T15:52:29
2017-01-24T15:52:29
32,207,143
0
2
null
null
null
null
UTF-8
C++
false
false
509
h
ViaEpd.h
/* The header file for viable epidermis */ #ifndef _H_VIAEPD_ #define _H_VIAEPD_ #include "Comp.h" class ViaEpd : public Comp { public: // double m_mass_in, m_mass_out; // mass transferred in and out of VE public: ViaEpd(void) {}; ~ViaEpd(void) {}; void Init(double, double, double, int, int, CoordSys, BdyCond, BdyCond, BdyCond, BdyCond); void createGrids(Chemical, double, double); // I/O functions void saveCoord(const char [], const char []); }; #endif
d677de1dcc4fdc22b9e1ea7cf403c73b98c6d12d
83bacfbdb7ad17cbc2fc897b3460de1a6726a3b1
/third_party/WebKit/Source/modules/imagebitmap/WindowImageBitmapFactories.cpp
841fa2309c54f0b170e7af4305877c22215d6498
[ "BSD-3-Clause", "LGPL-2.0-or-later", "LicenseRef-scancode-warranty-disclaimer", "LGPL-2.1-only", "GPL-1.0-or-later", "GPL-2.0-only", "LGPL-2.0-only", "BSD-2-Clause", "LicenseRef-scancode-other-copyleft", "Apache-2.0" ]
permissive
cool2528/miniblink49
d909e39012f2c5d8ab658dc2a8b314ad0050d8ea
7f646289d8074f098cf1244adc87b95e34ab87a8
refs/heads/master
2020-06-05T03:18:43.211372
2019-06-01T08:57:37
2019-06-01T08:59:56
192,294,645
2
0
Apache-2.0
2019-06-17T07:16:28
2019-06-17T07:16:27
null
UTF-8
C++
false
false
8,906
cpp
WindowImageBitmapFactories.cpp
/* * Copyright (c) 2013, Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following disclaimer * in the documentation and/or other materials provided with the * distribution. * * Neither the name of Google Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "config.h" #include "modules/imagebitmap/WindowImageBitmapFactories.h" #include "bindings/core/v8/ExceptionState.h" #include "bindings/core/v8/ScriptPromiseResolver.h" #include "core/dom/ExceptionCode.h" #include "core/dom/ExecutionContext.h" #include "core/fileapi/Blob.h" #include "core/frame/ImageBitmap.h" #include "core/frame/LocalDOMWindow.h" #include "core/html/HTMLCanvasElement.h" #include "core/html/HTMLImageElement.h" #include "core/html/HTMLVideoElement.h" #include "core/html/ImageData.h" #include "core/workers/WorkerGlobalScope.h" #include "modules/canvas2d/CanvasRenderingContext2D.h" #include "platform/SharedBuffer.h" #include "platform/graphics/BitmapImage.h" #include "platform/graphics/ImageSource.h" #include "public/platform/WebSize.h" #include <v8.h> namespace blink { static LayoutSize sizeFor(HTMLImageElement* image) { if (ImageResource* cachedImage = image->cachedImage()) return cachedImage->imageSizeForLayoutObject(image->layoutObject(), 1.0f); // FIXME: Not sure about this. return LayoutSize(); } static IntSize sizeFor(HTMLVideoElement* video) { if (WebMediaPlayer* webMediaPlayer = video->webMediaPlayer()) return webMediaPlayer->naturalSize(); return IntSize(); } static ScriptPromise fulfillImageBitmap(ScriptState* scriptState, PassRefPtrWillBeRawPtr<ImageBitmap> imageBitmap) { RefPtrWillBeRawPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver::create(scriptState); ScriptPromise promise = resolver->promise(); if (imageBitmap) { resolver->resolve(imageBitmap); } else { resolver->reject(ScriptValue(scriptState, v8::Null(scriptState->isolate()))); } return promise; } ScriptPromise WindowImageBitmapFactories::createImageBitmap(ScriptState* scriptState, EventTarget& eventTarget, HTMLImageElement* image, ExceptionState& exceptionState) { LayoutSize s = sizeFor(image); return createImageBitmap(scriptState, eventTarget, image, 0, 0, s.width(), s.height(), exceptionState); } ScriptPromise WindowImageBitmapFactories::createImageBitmap(ScriptState* scriptState, EventTarget& eventTarget, HTMLImageElement* image, int sx, int sy, int sw, int sh, ExceptionState& exceptionState) { // This variant does not work in worker threads. ASSERT(eventTarget.toDOMWindow()); if (!image->cachedImage()) { exceptionState.throwDOMException(InvalidStateError, "No image can be retrieved from the provided element."); return ScriptPromise(); } if (image->cachedImage()->image()->isSVGImage()) { exceptionState.throwDOMException(InvalidStateError, "The image element contains an SVG image, which is unsupported."); return ScriptPromise(); } if (!sw || !sh) { exceptionState.throwDOMException(IndexSizeError, String::format("The source %s provided is 0.", sw ? "height" : "width")); return ScriptPromise(); } if (!image->cachedImage()->image()->currentFrameHasSingleSecurityOrigin()) { exceptionState.throwSecurityError("The source image contains image data from multiple origins."); return ScriptPromise(); } Document* document = eventTarget.toDOMWindow()->document(); if (!image->cachedImage()->passesAccessControlCheck(document->securityOrigin()) && document->securityOrigin()->taintsCanvas(image->src())) { exceptionState.throwSecurityError("Cross-origin access to the source image is denied."); return ScriptPromise(); } // FIXME: make ImageBitmap creation asynchronous crbug.com/258082 return fulfillImageBitmap(scriptState, ImageBitmap::create(image, IntRect(sx, sy, sw, sh))); } ScriptPromise WindowImageBitmapFactories::createImageBitmap(ScriptState* scriptState, EventTarget& eventTarget, HTMLVideoElement* video, ExceptionState& exceptionState) { IntSize s = sizeFor(video); return createImageBitmap(scriptState, eventTarget, video, 0, 0, s.width(), s.height(), exceptionState); } ScriptPromise WindowImageBitmapFactories::createImageBitmap(ScriptState* scriptState, EventTarget& eventTarget, HTMLVideoElement* video, int sx, int sy, int sw, int sh, ExceptionState& exceptionState) { // This variant does not work in worker threads. ASSERT(eventTarget.toDOMWindow()); if (video->networkState() == HTMLMediaElement::NETWORK_EMPTY) { exceptionState.throwDOMException(InvalidStateError, "The provided element has not retrieved data."); return ScriptPromise(); } if (video->readyState() <= HTMLMediaElement::HAVE_METADATA) { exceptionState.throwDOMException(InvalidStateError, "The provided element's player has no current data."); return ScriptPromise(); } if (!sw || !sh) { exceptionState.throwDOMException(IndexSizeError, String::format("The source %s provided is 0.", sw ? "height" : "width")); return ScriptPromise(); } if (!video->hasSingleSecurityOrigin()) { exceptionState.throwSecurityError("The source video contains image data from multiple origins."); return ScriptPromise(); } if (!video->webMediaPlayer()->didPassCORSAccessCheck() && eventTarget.toDOMWindow()->document()->securityOrigin()->taintsCanvas(video->currentSrc())) { exceptionState.throwSecurityError("Cross-origin access to the source video is denied."); return ScriptPromise(); } // FIXME: make ImageBitmap creation asynchronous crbug.com/258082 return fulfillImageBitmap(scriptState, ImageBitmap::create(video, IntRect(sx, sy, sw, sh))); } ScriptPromise WindowImageBitmapFactories::createImageBitmap(ScriptState* scriptState, EventTarget& eventTarget, CanvasRenderingContext2D* context, ExceptionState& exceptionState) { return createImageBitmap(scriptState, eventTarget, context->canvas(), exceptionState); } ScriptPromise WindowImageBitmapFactories::createImageBitmap(ScriptState* scriptState, EventTarget& eventTarget, CanvasRenderingContext2D* context, int sx, int sy, int sw, int sh, ExceptionState& exceptionState) { return createImageBitmap(scriptState, eventTarget, context->canvas(), sx, sy, sw, sh, exceptionState); } ScriptPromise WindowImageBitmapFactories::createImageBitmap(ScriptState* scriptState, EventTarget& eventTarget, HTMLCanvasElement* canvas, ExceptionState& exceptionState) { return createImageBitmap(scriptState, eventTarget, canvas, 0, 0, canvas->width(), canvas->height(), exceptionState); } ScriptPromise WindowImageBitmapFactories::createImageBitmap(ScriptState* scriptState, EventTarget& eventTarget, HTMLCanvasElement* canvas, int sx, int sy, int sw, int sh, ExceptionState& exceptionState) { // This variant does not work in worker threads. ASSERT(eventTarget.toDOMWindow()); if (!canvas->originClean()) { exceptionState.throwSecurityError("The canvas element provided is tainted with cross-origin data."); return ScriptPromise(); } if (!sw || !sh) { exceptionState.throwDOMException(IndexSizeError, String::format("The source %s provided is 0.", sw ? "height" : "width")); return ScriptPromise(); } // FIXME: make ImageBitmap creation asynchronous crbug.com/258082 return fulfillImageBitmap(scriptState, canvas->isPaintable() ? ImageBitmap::create(canvas, IntRect(sx, sy, sw, sh)) : nullptr); } } // namespace blink
ee0f664a9eeab7cbe9ae69cf1d11093816a39070
d2490ebcb141b77224e43d5438b6700f501aa281
/Segment trees/rahul/chefcan.cpp
8b1dfd86d13aaa6a58f14149b0b123b31cdf616a
[]
no_license
swimmingturtle165/Coding
de51aa87dce71eb68eaea3c695b69f10ac9f514c
257aedc3eb40eef2a0ab4a7c31432e3e8f77a8da
refs/heads/main
2023-08-15T06:00:50.950875
2021-10-10T17:44:56
2021-10-10T17:44:56
null
0
0
null
null
null
null
UTF-8
C++
false
false
3,814
cpp
chefcan.cpp
#include<bits/stdc++.h> using namespace std; class Pair{ public : int temp; int price; int min; int max; Pair() { } Pair(int x,int y,int z ,int z1) { temp=x; price=y; min=z; max=z1; } }; void buildTree(Pair* tree,int n,int q,int k,int l,int r,long index,int left,int right) { if(left>right) { return; } if(left==right) { //setting nodes in the lowest level int c,p,min=q,max=q+1; cin>>c>>p; if(c>=l && c<=r) { min=1; if(k<l) { max=c-l; } else if(k>r) { max=min+r-c-1; } } else if(c>r ) { //k must be less than r to make this possible else temp wont ever fit in the required range if(k<=r) { min=c-r; if(k<l) { max=min+c-l-1; } } else { min=q+1; max=q+1; //so that these are nodes are never considered } } else if(c<l ) { //k must be greater than l to make this possible else temp wont ever fit in the required range if(k>=l) { min=l-c; if(k>r) { max=min+r-l-1; } } else { min=q+1; max=q+1; //so that these are nodes are never considered } } cout<<c<<" *** "<<p<<"--"<<min<<" * "<<max<<" * "<<index<<endl; Pair temp(c,p,min,max); tree[index]=temp; return; } int mid=(left+right)/2; buildTree(tree,n,q,k,l,r,2*index,left,mid); buildTree(tree,n,q,k,l,r,2*index+1,mid+1,right); Pair temp; temp.price=min(tree[2*index].price,tree[2*index+1].price); temp.temp=0; temp.min=min(tree[2*index].min,tree[2*index+1].min); temp.max=max(tree[2*index].max,tree[2*index+1].max); tree[index]=temp; cout<<temp.temp<<" *** "<<temp.price<<"--"<<temp.min<<" * "<<temp.max<<" * "<<index<<endl; } int solution(Pair* tree,int query,int index) { //3 cases //1->No Overlap (qend<start ||qstart>end ) return infinity(Worst answer) if(query<tree[index].min ||query >tree[index].max) { return INT_MAX; } //2->Complete Overlap (qstart<=start &qend=>end) return tree[index] at the node else if(query>=tree[index].min ||query<=tree[index].max) { return tree[index].price; } //3->Partial Overlap Call both Sides return the best result else { long leftAns=solution(tree,query,2*index); long rightAns=solution(tree,query,2*index+1); return min(leftAns,rightAns); } } int main() { long t; cin>>t; while(t--) { long n,q,k,l,r; cin>>n>>q>>k>>l>>r; Pair *tree=new Pair[4*n+1]; buildTree(tree,n,q,k,l,r,1,0,n-1); // for(int i = 1 ; i <4*n+1;i++) // { // cout<<tree[i].price<<" "; // } for(int i =1;i<=q;i++) { long ans=solution(tree,i,1); if(ans!=INT_MAX) { cout<<ans<<" ********* "; } else { cout<<"-1"<<" ********* "; } } cout<<endl; } }
9725c8d09192b386afee7bc3a9c820cb5bcae1d1
de644b254b17a28f82e9212d80872a3d9eca2149
/test/host/extension/MOAIAttrProcessingNode.cpp
85a11f4c7061836714d671e312cb7f9816644459
[ "MIT" ]
permissive
pixpil/gii
506bee02b11eb412016b583d807dcfcc485e189c
ba6d94ada86d82bacae06f165567a02585264440
refs/heads/master
2021-12-03T06:30:31.503481
2021-11-24T03:02:49
2021-11-24T03:02:49
431,331,021
4
1
null
null
null
null
UTF-8
C++
false
false
2,436
cpp
MOAIAttrProcessingNode.cpp
#include <moai-sim/pch.h> #include "MOAIAttrProcessingNode.h" int MOAIAttrProcessingNode::_reserveAttrs ( lua_State* L ) { MOAI_LUA_SETUP ( MOAIAttrProcessingNode, "UN" ); u32 size = state.GetValue < u32 >( 2, 0 ); self->mVanillaAttributes.Init ( size ); self->mVanillaAttributes.Fill ( 0.0f ); self->mProcessedAttributes.Init ( size ); self->mProcessedAttributes.Fill ( 0.0f ); return 0; } int MOAIAttrProcessingNode::_setProcessor ( lua_State* L ) { MOAI_LUA_SETUP ( MOAIAttrProcessingNode, "UF" ); self->mProcessorFunc.SetRef ( *self, state, 2 ); return 0; } bool MOAIAttrProcessingNode::ApplyAttrOp ( u32 attrID, MOAIAttrOp& attrOp, u32 op ) { attrID = UNPACK_ATTR(attrID); if ( attrID < this->mProcessedAttributes.Size () && attrID < this->mVanillaAttributes.Size () ) { // this->mVanillaAttributes[attrID] = attrOp.Apply ( this->mVanillaAttributes [ attrID ], op, MOAIAttrOp::ATTR_READ_WRITE, MOAIAttrOp::ATTR_TYPE_FLOAT ); if (op == MOAIAttrOp::SET) { float val = attrOp.Apply ( this->mVanillaAttributes [ attrID ], op, MOAIAttrOp::ATTR_READ_WRITE, MOAIAttrOp::ATTR_TYPE_FLOAT ); this->mVanillaAttributes [ attrID ] = val; if (this->mProcessorFunc) { MOAIScopedLuaState state = MOAILuaRuntime::Get().State(); // call user lua function to get massaged value if (this->mProcessorFunc.PushRef(state)) { this->PushLuaUserdata(state); state.Push(attrID); state.Push(val); state.DebugCall(3, 1); val = state.GetValue<float>(-1, val); } } this->mProcessedAttributes [ attrID ] = val; } else { attrOp.Apply ( this->mProcessedAttributes [ attrID ], op, MOAIAttrOp::ATTR_READ_WRITE, MOAIAttrOp::ATTR_TYPE_FLOAT ); } return true; } return false; } MOAIAttrProcessingNode::MOAIAttrProcessingNode() { RTTI_SINGLE (MOAINode) } MOAIAttrProcessingNode::~MOAIAttrProcessingNode() { } //----------------------------------------------------------------// void MOAIAttrProcessingNode::RegisterLuaClass ( MOAILuaState& state ) { MOAINode::RegisterLuaClass ( state ); } //----------------------------------------------------------------// void MOAIAttrProcessingNode::RegisterLuaFuncs ( MOAILuaState& state ) { MOAINode::RegisterLuaFuncs ( state ); luaL_Reg regTable [] = { { "reserveAttrs", _reserveAttrs }, { "setProcessor", _setProcessor }, { NULL, NULL } }; luaL_register ( state, 0, regTable ); }
53970e7ed48b6add0104bfae65df9dde7d1c8db4
550e2a54dcc11f7a034ba9e08d245ff098b58df5
/Example/detection_old.h
f90b7dc9b7141cdfa1f33f773820dea4a33e261c
[]
no_license
gstewart9727/RoboticRecovery
7732236d56bc188f84e54ddc8678247b168c9f87
57095abb378ecb4bc4d24f9391e37a23d0c96516
refs/heads/master
2021-07-12T14:19:53.695646
2021-02-28T02:12:44
2021-02-28T02:12:44
233,936,158
1
0
null
null
null
null
UTF-8
C++
false
false
963
h
detection_old.h
// Filename : detection.h // Version : 0.0.1 // Version Date : 02/25/2020 // Programmer : Gabriel Stewart // Description : This file contains the header information for the detection class #ifndef DETECTION_H #define DETECTION_H #include "global.h" #include "gstCamera.h" #include "glDisplay.h" #include "detectNet.h" #include "commandLine.h" #include <signal.h> using namespace std; class Detection { public: // Create method for accessing instance of class static Detection* getInstance(int argc, char** argv); // Declare getters/setters protected: gstCamera* camera; detectNet* net; glDisplay* display; float* imgRGBA; detectNet::Detection* detections; std::string cameraIndex; private: static Detection* instance; void LiveDetection(const uint32_t overlayFlags); Detection(int argc, char** argv); ~Detection(); }; #endif
5cb50c69e55d25fc7fcf2946629bef9aca14c663
714ba40913184bc5a65a527bf30667c83e26ae30
/CppCli-WPF-App/DocumentBuilder/DocumentBuilder.h
6b1989e0a230fed951d74f296d203e7ce3f1eefc
[]
no_license
Isira/Remote-Code-Management-Facility
8366782b77c38cb49b0e821802a9c87948cac9dc
7fa15889c667f1902dd6108d68f57a82ff878e86
refs/heads/master
2016-09-06T09:19:12.823711
2015-06-25T19:31:52
2015-06-25T19:31:52
38,068,687
0
0
null
null
null
null
WINDOWS-1252
C++
false
false
2,523
h
DocumentBuilder.h
#ifndef DOCUMENTBUILDER_H #define DOCUMENTBUILDER_H ////////////////////////////////////////////////////////////////////////////////////// // DocumentBuilder.h - Build an XmlDocument // // // ver 1.0 // // ---------------------------------------------------------------------------------// // copyright © Isira Samarasekera, 2015 // // All rights granted provided that this notice is retained // // ---------------------------------------------------------------------------------// // Language: Visual C++, Visual Studio Ultimate 2013 // // Platform: Mac Book Pro, Core i5, Windows 8.1 // // Application: Project #2 – XmlDocument,2015 // // Author: Isira Samarasekera, Syracuse University // // issamara@syr.edu // ////////////////////////////////////////////////////////////////////////////////////// /* * Module Operations: * ================== * Build a internal parse tree for an XmlDocument * * Public Interface: * ================= * DocumentBuilder builder; * XmlDocument doc("LectureNote.xml",XmlDocument::filename); * builder.build(doc); * * Required Files: * =============== * Display.h, Display.cpp * XmlDocument.h , XmlDocument.cpp *xmlElementParts.h xmlElementParts.cpp * AbstractXmlElement.h AbstractXmlElement.cpp * * Build Command: * ============== * cl /EHa /DTEST_DOCUMENTBUILDER DocumentBuilder.cpp * * Maintenance History: * ==================== * ver 1.0 : 20 Mar 15 * - first release */ #include "../XmlDocument/XmlDocument.h" #include "../XmlElementParts/xmlElementParts.h" #include "../XmlElement/AbstractXmlElement.h" #include <stack> namespace XmlProcessing { class DocumentBuilder { public: // Given a file or a string build XmlDocument for it void build(XmlDocument& document); private: std::stack<std::shared_ptr<XmlProcessing::AbstractXmlElement>> _elementStack; void parse(XmlParts part); bool isProcIns(XmlParts xmlPart); bool isDeclare(XmlParts xmlPart); bool isComment(XmlParts xmlPart); bool isElement(XmlParts xmlPart); bool isEndElement(XmlParts xmlPart); bool isTextElement(XmlParts xmlPart); std::shared_ptr<AbstractXmlElement> createTaggedElement(XmlParts xmlPart); std::shared_ptr<AbstractXmlElement> createXMLDeclaration(XmlParts xmlPart); std::shared_ptr<AbstractXmlElement> createProcessingInstructor(XmlParts xmlPart); std::shared_ptr<AbstractXmlElement> createComment(XmlParts xmlPart); }; } #endif
a52485dd1d6dab7dee2dc155e0aeaff5f4193947
31d0daa95de8ac4ab8d2bc5c522b7c239243215f
/SNI/ui_stu_accessport.h
0aade59f04095874a4c7d6bb47dc8e224c6dabff
[]
no_license
Modolet/SuperNewIC
c26b5241848fc243ff98102f00851af3be8fd5df
0c2fc6f3f3b04f0e209305b18d2cfce659f054a8
refs/heads/master
2022-11-24T02:27:57.926848
2020-07-29T01:20:59
2020-07-29T01:20:59
249,493,090
0
0
null
null
null
null
UTF-8
C++
false
false
13,263
h
ui_stu_accessport.h
/******************************************************************************** ** Form generated from reading UI file 'stu_accessport.ui' ** ** Created by: Qt User Interface Compiler version 5.15.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef UI_STU_ACCESSPORT_H #define UI_STU_ACCESSPORT_H #include <QtCore/QVariant> #include <QtWidgets/QApplication> #include <QtWidgets/QCheckBox> #include <QtWidgets/QComboBox> #include <QtWidgets/QGridLayout> #include <QtWidgets/QLabel> #include <QtWidgets/QPlainTextEdit> #include <QtWidgets/QPushButton> #include <QtWidgets/QSpacerItem> #include <QtWidgets/QWidget> QT_BEGIN_NAMESPACE class Ui_Stu_AccessPort { public: QGridLayout *gridLayout_3; QPlainTextEdit *plainTextEdit_receiveDisplay; QWidget *widget; QGridLayout *gridLayout; QLabel *label_baudRate_2; QLabel *label_dataBits; QComboBox *comboBox_parity; QComboBox *comboBox_stopBits; QComboBox *comboBox_dataBits; QComboBox *comboBox_baudRate; QPushButton *pushButton_clearReceive; QSpacerItem *verticalSpacer; QCheckBox *checkBox_openSerial; QComboBox *comboBox_serialSelect; QLabel *label_stopBits; QLabel *label_baudRate; QLabel *label_parity; QCheckBox *checkBox_16Show; QWidget *widget_2; QGridLayout *gridLayout_2; QLabel *label; QPlainTextEdit *plainTextEdit_singleSend; QPushButton *pushButton_send; QPushButton *pushButton_clearSend; QCheckBox *checkBox_16Send; void setupUi(QWidget *Stu_AccessPort) { if (Stu_AccessPort->objectName().isEmpty()) Stu_AccessPort->setObjectName(QString::fromUtf8("Stu_AccessPort")); Stu_AccessPort->resize(599, 496); gridLayout_3 = new QGridLayout(Stu_AccessPort); gridLayout_3->setObjectName(QString::fromUtf8("gridLayout_3")); plainTextEdit_receiveDisplay = new QPlainTextEdit(Stu_AccessPort); plainTextEdit_receiveDisplay->setObjectName(QString::fromUtf8("plainTextEdit_receiveDisplay")); plainTextEdit_receiveDisplay->setReadOnly(true); gridLayout_3->addWidget(plainTextEdit_receiveDisplay, 0, 0, 1, 1); widget = new QWidget(Stu_AccessPort); widget->setObjectName(QString::fromUtf8("widget")); gridLayout = new QGridLayout(widget); gridLayout->setObjectName(QString::fromUtf8("gridLayout")); label_baudRate_2 = new QLabel(widget); label_baudRate_2->setObjectName(QString::fromUtf8("label_baudRate_2")); QSizePolicy sizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); sizePolicy.setHorizontalStretch(0); sizePolicy.setVerticalStretch(0); sizePolicy.setHeightForWidth(label_baudRate_2->sizePolicy().hasHeightForWidth()); label_baudRate_2->setSizePolicy(sizePolicy); gridLayout->addWidget(label_baudRate_2, 0, 0, 1, 1); label_dataBits = new QLabel(widget); label_dataBits->setObjectName(QString::fromUtf8("label_dataBits")); gridLayout->addWidget(label_dataBits, 4, 0, 1, 1); comboBox_parity = new QComboBox(widget); comboBox_parity->addItem(QString()); comboBox_parity->addItem(QString()); comboBox_parity->addItem(QString()); comboBox_parity->setObjectName(QString::fromUtf8("comboBox_parity")); gridLayout->addWidget(comboBox_parity, 5, 1, 1, 1); comboBox_stopBits = new QComboBox(widget); comboBox_stopBits->addItem(QString()); comboBox_stopBits->addItem(QString()); comboBox_stopBits->addItem(QString()); comboBox_stopBits->setObjectName(QString::fromUtf8("comboBox_stopBits")); gridLayout->addWidget(comboBox_stopBits, 3, 1, 1, 1); comboBox_dataBits = new QComboBox(widget); comboBox_dataBits->addItem(QString()); comboBox_dataBits->addItem(QString()); comboBox_dataBits->addItem(QString()); comboBox_dataBits->addItem(QString()); comboBox_dataBits->setObjectName(QString::fromUtf8("comboBox_dataBits")); gridLayout->addWidget(comboBox_dataBits, 4, 1, 1, 1); comboBox_baudRate = new QComboBox(widget); comboBox_baudRate->addItem(QString()); comboBox_baudRate->addItem(QString()); comboBox_baudRate->addItem(QString()); comboBox_baudRate->addItem(QString()); comboBox_baudRate->addItem(QString()); comboBox_baudRate->addItem(QString()); comboBox_baudRate->addItem(QString()); comboBox_baudRate->addItem(QString()); comboBox_baudRate->setObjectName(QString::fromUtf8("comboBox_baudRate")); gridLayout->addWidget(comboBox_baudRate, 2, 1, 1, 1); pushButton_clearReceive = new QPushButton(widget); pushButton_clearReceive->setObjectName(QString::fromUtf8("pushButton_clearReceive")); QSizePolicy sizePolicy1(QSizePolicy::Minimum, QSizePolicy::Fixed); sizePolicy1.setHorizontalStretch(0); sizePolicy1.setVerticalStretch(10); sizePolicy1.setHeightForWidth(pushButton_clearReceive->sizePolicy().hasHeightForWidth()); pushButton_clearReceive->setSizePolicy(sizePolicy1); gridLayout->addWidget(pushButton_clearReceive, 9, 0, 1, 1); verticalSpacer = new QSpacerItem(20, 100, QSizePolicy::Minimum, QSizePolicy::Fixed); gridLayout->addItem(verticalSpacer, 8, 0, 1, 1); checkBox_openSerial = new QCheckBox(widget); checkBox_openSerial->setObjectName(QString::fromUtf8("checkBox_openSerial")); checkBox_openSerial->setChecked(false); gridLayout->addWidget(checkBox_openSerial, 6, 0, 1, 1); comboBox_serialSelect = new QComboBox(widget); comboBox_serialSelect->setObjectName(QString::fromUtf8("comboBox_serialSelect")); gridLayout->addWidget(comboBox_serialSelect, 1, 0, 1, 2); label_stopBits = new QLabel(widget); label_stopBits->setObjectName(QString::fromUtf8("label_stopBits")); gridLayout->addWidget(label_stopBits, 3, 0, 1, 1); label_baudRate = new QLabel(widget); label_baudRate->setObjectName(QString::fromUtf8("label_baudRate")); gridLayout->addWidget(label_baudRate, 2, 0, 1, 1); label_parity = new QLabel(widget); label_parity->setObjectName(QString::fromUtf8("label_parity")); gridLayout->addWidget(label_parity, 5, 0, 1, 1); checkBox_16Show = new QCheckBox(widget); checkBox_16Show->setObjectName(QString::fromUtf8("checkBox_16Show")); gridLayout->addWidget(checkBox_16Show, 7, 0, 1, 1); gridLayout_3->addWidget(widget, 0, 1, 1, 1); widget_2 = new QWidget(Stu_AccessPort); widget_2->setObjectName(QString::fromUtf8("widget_2")); QSizePolicy sizePolicy2(QSizePolicy::Preferred, QSizePolicy::Preferred); sizePolicy2.setHorizontalStretch(0); sizePolicy2.setVerticalStretch(1); sizePolicy2.setHeightForWidth(widget_2->sizePolicy().hasHeightForWidth()); widget_2->setSizePolicy(sizePolicy2); gridLayout_2 = new QGridLayout(widget_2); gridLayout_2->setObjectName(QString::fromUtf8("gridLayout_2")); label = new QLabel(widget_2); label->setObjectName(QString::fromUtf8("label")); gridLayout_2->addWidget(label, 0, 0, 1, 1); plainTextEdit_singleSend = new QPlainTextEdit(widget_2); plainTextEdit_singleSend->setObjectName(QString::fromUtf8("plainTextEdit_singleSend")); gridLayout_2->addWidget(plainTextEdit_singleSend, 1, 0, 2, 1); pushButton_send = new QPushButton(widget_2); pushButton_send->setObjectName(QString::fromUtf8("pushButton_send")); sizePolicy.setHeightForWidth(pushButton_send->sizePolicy().hasHeightForWidth()); pushButton_send->setSizePolicy(sizePolicy); gridLayout_2->addWidget(pushButton_send, 1, 1, 1, 1); pushButton_clearSend = new QPushButton(widget_2); pushButton_clearSend->setObjectName(QString::fromUtf8("pushButton_clearSend")); sizePolicy.setHeightForWidth(pushButton_clearSend->sizePolicy().hasHeightForWidth()); pushButton_clearSend->setSizePolicy(sizePolicy); gridLayout_2->addWidget(pushButton_clearSend, 2, 1, 1, 1); checkBox_16Send = new QCheckBox(widget_2); checkBox_16Send->setObjectName(QString::fromUtf8("checkBox_16Send")); gridLayout_2->addWidget(checkBox_16Send, 3, 0, 1, 1); gridLayout_3->addWidget(widget_2, 1, 0, 1, 2); retranslateUi(Stu_AccessPort); comboBox_baudRate->setCurrentIndex(2); comboBox_serialSelect->setCurrentIndex(-1); QMetaObject::connectSlotsByName(Stu_AccessPort); } // setupUi void retranslateUi(QWidget *Stu_AccessPort) { Stu_AccessPort->setWindowTitle(QCoreApplication::translate("Stu_AccessPort", "Form", nullptr)); label_baudRate_2->setText(QCoreApplication::translate("Stu_AccessPort", "\344\270\262\345\217\243\351\200\211\346\213\251", nullptr)); label_dataBits->setText(QCoreApplication::translate("Stu_AccessPort", "\346\225\260\346\215\256\344\275\215", nullptr)); comboBox_parity->setItemText(0, QCoreApplication::translate("Stu_AccessPort", "\346\227\240", nullptr)); comboBox_parity->setItemText(1, QCoreApplication::translate("Stu_AccessPort", "\345\245\207\346\243\200\351\252\214", nullptr)); comboBox_parity->setItemText(2, QCoreApplication::translate("Stu_AccessPort", "\345\201\266\346\240\241\351\252\214", nullptr)); comboBox_stopBits->setItemText(0, QCoreApplication::translate("Stu_AccessPort", "1", nullptr)); comboBox_stopBits->setItemText(1, QCoreApplication::translate("Stu_AccessPort", "1.5", nullptr)); comboBox_stopBits->setItemText(2, QCoreApplication::translate("Stu_AccessPort", "2", nullptr)); comboBox_dataBits->setItemText(0, QCoreApplication::translate("Stu_AccessPort", "8", nullptr)); comboBox_dataBits->setItemText(1, QCoreApplication::translate("Stu_AccessPort", "7", nullptr)); comboBox_dataBits->setItemText(2, QCoreApplication::translate("Stu_AccessPort", "6", nullptr)); comboBox_dataBits->setItemText(3, QCoreApplication::translate("Stu_AccessPort", "5", nullptr)); comboBox_baudRate->setItemText(0, QCoreApplication::translate("Stu_AccessPort", "1200", nullptr)); comboBox_baudRate->setItemText(1, QCoreApplication::translate("Stu_AccessPort", "2400", nullptr)); comboBox_baudRate->setItemText(2, QCoreApplication::translate("Stu_AccessPort", "4800", nullptr)); comboBox_baudRate->setItemText(3, QCoreApplication::translate("Stu_AccessPort", "9600", nullptr)); comboBox_baudRate->setItemText(4, QCoreApplication::translate("Stu_AccessPort", "19200", nullptr)); comboBox_baudRate->setItemText(5, QCoreApplication::translate("Stu_AccessPort", "38400", nullptr)); comboBox_baudRate->setItemText(6, QCoreApplication::translate("Stu_AccessPort", "57600", nullptr)); comboBox_baudRate->setItemText(7, QCoreApplication::translate("Stu_AccessPort", "115200", nullptr)); comboBox_baudRate->setCurrentText(QCoreApplication::translate("Stu_AccessPort", "4800", nullptr)); pushButton_clearReceive->setText(QCoreApplication::translate("Stu_AccessPort", "\346\270\205\351\231\244\346\216\245\345\217\227", nullptr)); checkBox_openSerial->setText(QCoreApplication::translate("Stu_AccessPort", "\346\211\223\345\274\200\344\270\262\345\217\243", nullptr)); label_stopBits->setText(QCoreApplication::translate("Stu_AccessPort", "\345\201\234\346\255\242\344\275\215", nullptr)); label_baudRate->setText(QCoreApplication::translate("Stu_AccessPort", "\346\263\242\347\211\271\347\216\207", nullptr)); label_parity->setText(QCoreApplication::translate("Stu_AccessPort", "\345\245\207\345\201\266\346\240\241\351\252\214\344\275\215", nullptr)); checkBox_16Show->setText(QCoreApplication::translate("Stu_AccessPort", "16\350\277\233\345\210\266\346\230\276\347\244\272", nullptr)); #if QT_CONFIG(tooltip) label->setToolTip(QString()); #endif // QT_CONFIG(tooltip) label->setText(QCoreApplication::translate("Stu_AccessPort", "\346\225\260\346\215\256\345\217\221\351\200\201\357\274\232", nullptr)); pushButton_send->setText(QCoreApplication::translate("Stu_AccessPort", "\345\217\221\351\200\201", nullptr)); pushButton_clearSend->setText(QCoreApplication::translate("Stu_AccessPort", "\346\270\205\351\231\244\345\217\221\351\200\201", nullptr)); checkBox_16Send->setText(QCoreApplication::translate("Stu_AccessPort", "16\350\277\233\345\210\266\345\217\221\351\200\201", nullptr)); } // retranslateUi }; namespace Ui { class Stu_AccessPort: public Ui_Stu_AccessPort {}; } // namespace Ui QT_END_NAMESPACE #endif // UI_STU_ACCESSPORT_H
319cb37a6348a6948a71b03ea88e6a62a9df2dda
4b59575b5eace9a086d3efc188042c940e31337c
/aiohttp/streams/buffering/AnalogReadSerial/AnalogReadSerial.ino
1200c654ced24cea4c5cdbe5d3c171c1607cd6a2
[]
no_license
andrewcgaitskell/WebSocketServer
41d130d8b65922c153d3f61219618a24a8785c6f
9aa8f1fc799918ff3dc57f6d1d583e7e00dcfb01
refs/heads/main
2023-07-01T19:20:50.800361
2021-08-10T13:27:02
2021-08-10T13:27:02
341,242,851
0
0
null
null
null
null
UTF-8
C++
false
false
766
ino
AnalogReadSerial.ino
/* AnalogReadSerial Reads an analog input on pin 0, prints the result to the Serial Monitor. Graphical representation is available using Serial Plotter (Tools > Serial Plotter menu). Attach the center pin of a potentiometer to pin A0, and the outside pins to +5V and ground. This example code is in the public domain. https://www.arduino.cc/en/Tutorial/BuiltInExamples/AnalogReadSerial */ #define samplesLength 115200 void setup() { analogReadResolution(10); analogSetAttenuation(ADC_0db); Serial.begin(115200); } void loop() { int measures[samplesLength]; int i = 0; while (i <= samplesLength) { measures[i++] = analogRead(34); } for(int i = 0; i <= samplesLength; i++) { Serial.println(measures[i]); } delay(10000); }
2230ccaaef388903d9aa48203ebf8d6390fae819
babea1ba2b113cfa596d6ed2be20773d83f2357b
/Medium/C++/Subsets(78).cpp
4d61a303a6a6e352bcbdfd572af1947fb1e12487
[ "MIT" ]
permissive
assaultpunisher/Leet_Code
0a7af54c9683db334b274c4709cfdd018f8d12cc
72f53c7368cd4869005544a584da38e7b665c3f4
refs/heads/main
2023-05-05T18:45:20.871658
2021-05-27T12:36:29
2021-05-27T12:36:29
null
0
0
null
null
null
null
UTF-8
C++
false
false
489
cpp
Subsets(78).cpp
class Solution { public: vector<vector<int>> all_subsets; void generate(vector<int> &subset, int i, vector<int> &nums) { if (i == nums.size()) { all_subsets.push_back(subset); return ; } generate(subset, i + 1, nums); subset.push_back(nums[i]); generate(subset, i + 1, nums); subset.pop_back(); } vector<vector<int>> subsets(vector<int>& nums) { vector<int> empty; generate(empty,0,nums); return all_subsets; } };
1cd1e76d809e8c12133a8c7be8312ca516046d79
39e287e8f0a2a015c6ae34023eae05b0063fa050
/factory_bak.cpp
e0e1d8ced971000f9a889b2bfd071519c88e15a1
[]
no_license
zhenliang153/DesignPattern
5458b726c95d2fa9dfddff1eec6d852ccca39c98
e8ba43dbcaa094334475badd2aa9bfa65f0bcb52
refs/heads/master
2022-06-14T12:00:31.509643
2020-05-09T13:57:39
2020-05-09T13:57:39
262,582,142
0
0
null
null
null
null
UTF-8
C++
false
false
1,638
cpp
factory_bak.cpp
#include <iostream> /* Factory construct! ConcreteFactory construct! CreateProduct! Product construct! ConcreteProduct construct! ConcreteProduct destruct! Product destruct! ConcreteFactory destruct! Factory construct! */ //工厂模式 class Product { //屏蔽构造函数 protected: Product() { std::cout << "Product construct!" << std::endl; } public: //父类的析构函数不是虚函数,这种情况下,将只会调用A的析构函数而不会调用子类的析构函数。 //父类的析构函数是普通的虚函数,这种情况下,会很正常,从子类一直析构到基类,最后完成析构。 virtual ~Product() = 0; }; Product::~Product() { std::cout << "Product destruct!" << std::endl; } class ConcreteProduct: public Product { public: ConcreteProduct() { std::cout << "ConcreteProduct construct!" << std::endl; } ~ConcreteProduct() { std::cout << "ConcreteProduct destruct!" << std::endl; } }; class Factory { protected: Factory() { std::cout << "Factory construct!" << std::endl; } public: virtual ~Factory() = 0; virtual Product* CreateProduct() = 0; }; Factory::~Factory() { std::cout << "Factory construct!" << std::endl; } class ConcreteFactory: public Factory { public: ConcreteFactory() { std::cout << "ConcreteFactory construct!" << std::endl; } ~ConcreteFactory() { std::cout << "ConcreteFactory destruct!" << std::endl; } Product* CreateProduct() { std::cout << "CreateProduct!" << std::endl; return new ConcreteProduct(); } }; int main(void) { Factory* f = new ConcreteFactory(); Product* p = f->CreateProduct(); delete p; delete f; return 0; }
de821427b467359d26c7c9b4f8a5373a87f89125
2439bf5aed566a52ce7f69e0cbd09cfc55a9a91e
/Source/Game_One/Private/EPickupBehavior.cpp
15609748276180faa9855cea2009ec6c94e5ee74
[]
no_license
PeatMonkey/Game_one
48c5a83cc13c219d2896e265d8b03a34340461e2
37e9212032be1c152248867ac01f38a093651483
refs/heads/master
2021-01-13T07:59:20.790383
2017-07-11T17:43:09
2017-07-11T17:43:09
71,696,286
1
0
null
null
null
null
UTF-8
C++
false
false
135
cpp
EPickupBehavior.cpp
// Fill out your copyright notice in the Description page of Project Settings. #include "Game_One.h" #include "EPickupBehavior.h"
17448eee60d9713e2dd0b7d4915400278d48cbc8
dbd4f07f0646a03138e7a686d17b25d3e2747a74
/pycwt1d.cpp
63e99feb1fba85387dbf88a438e9f675875d2400
[]
no_license
astrojhgu/pycwt1d
0393268521f610dd54145855ce0359f6b4a5aa2d
0e9ba59d12ca947fd8212af9b36d5ecbaf9f4cd0
refs/heads/master
2020-04-06T15:24:43.886692
2018-11-14T16:18:26
2018-11-14T16:18:26
157,577,539
0
0
null
null
null
null
UTF-8
C++
false
false
4,483
cpp
pycwt1d.cpp
#include <iostream> #include <vector> #include <boost/ref.hpp> #include <boost/utility.hpp> #include <boost/python/suite/indexing/vector_indexing_suite.hpp> #include <boost/python/module.hpp> #include <boost/python/class.hpp> #include <boost/python/operators.hpp> #include <boost/python/def.hpp> #include <boost/python/pure_virtual.hpp> #include <boost/python/copy_const_reference.hpp> #include <boost/operators.hpp> #include <boost/python/numpy.hpp> #include <boost/python/list.hpp> #include <exception> #define private public using namespace boost; using namespace boost::python; using namespace boost::python::numpy; #include <cwt1d_wavelets.hpp> using namespace std; using namespace cwt1d; typedef dog<double> pydog; typedef morlet<double> pymorlet; typedef paul<double> pypaul; typedef wavelet_func<double> wf; namespace { class initializer{ public: initializer() { //boost::python::numeric::array::set_module_and_type("numpy","ndarray"); Py_Initialize(); numpy::initialize(); } }_init; } boost::python::numpy::ndarray pycwt(const boost::python::numpy::ndarray& x,const boost::python::numpy::ndarray& s,const wavelet_func<double>& wf) { boost::python::object shape(x.attr("shape")); int ndim=extract<int>(shape.attr("__len__")()); if(ndim!=1) { throw std::exception(); } int ndata=extract<int>(shape[0]); blitz::Array<double,1> x1(ndata); for(int i=0;i<ndata;++i) { x1(i)=extract<double>(x[i]); } shape=s.attr("shape"); ndim=extract<int>(shape.attr("__len__")()); if(ndim!=1) { throw std::exception(); } int nscales=extract<int>(shape[0]); blitz::Array<double,1> s1(nscales); for(int i=0;i<nscales;++i) { s1(i)=extract<double>(s[i]); } blitz::Array<complex<double>,2> y(cwt(x1,s1,wf)); boost::python::list l; for(int i=0;i<nscales;++i) { boost::python::list l1; for(int j=0;j<ndata;++j) { l1.append(y(i,j)); } l.append(l1); } return boost::python::numpy::array(l); } boost::python::numpy::ndarray pyicwt(const boost::python::numpy::ndarray& x,const boost::python::numpy::ndarray& s,const wavelet_func<double>& wf) { boost::python::object shape(x.attr("shape")); int ndim=extract<int>(shape.attr("__len__")()); if(ndim!=2) { throw std::exception(); } int ndata=extract<int>(shape[1]); int nscales=extract<int>(shape[0]); blitz::Array<complex<double>,2> x1(nscales,ndata); for(int i=0;i<nscales;++i) { for(int j=0;j<ndata;++j) { x1(i,j)=extract<complex<double> >(x[boost::python::make_tuple(i,j)]); } } shape=s.attr("shape"); ndim=extract<int>(shape.attr("__len__")()); if(ndim!=1) { throw std::exception(); } if(nscales!=extract<int>(shape[0])) { throw std::exception(); } blitz::Array<double,1> s1(nscales); for(int i=0;i<nscales;++i) { s1(i)=extract<double>(s[i]); } blitz::Array<double,1> result1(icwt(x1,s1,wf)); boost::python::list l; for(int i=0;i<ndata;++i) { l.append(result1(i)); } return boost::python::numpy::array(l); //return result; } boost::python::numpy::ndarray generate_log_scales(double min_scale,double max_scale,int num_scales) { boost::python::list l; double lmin_scale=log(min_scale); double lmax_scale=log(max_scale); for(int i=0;i<num_scales;++i) { double s=exp(lmin_scale+(lmax_scale-lmin_scale)/(num_scales-1)*i); l.append(s); } return boost::python::numpy::array(l); // return result; } double pycalc_norm(int dl,const boost::python::numpy::ndarray& s,const wavelet_func<double>& wf) { boost::python::object shape(s.attr("shape")); int ndim=extract<int>(shape.attr("__len__")()); if(ndim!=1) { throw std::exception(); } int nscales=extract<int>(shape[0]); blitz::Array<double,1> s1(nscales); for(int i=0;i<nscales;++i) { s1(i)=extract<double>(s[i]); } return calc_norm(dl,s1,wf); } BOOST_PYTHON_MODULE(cwtcore) { class_<wf,boost::noncopyable>("wf",no_init) .def("wavelet_f",&wf::wavelet_f); class_<pydog,bases<wf> >("dog") .def(init<>()) .def(init<int>()); class_<pymorlet,bases<wf> >("morlet") .def(init<>()) .def(init<double>()); class_<pypaul,bases<wf> >("paul") .def(init<>()) .def(init<double>()); def("cwt",pycwt); def("icwt",pyicwt); def("calc_norm",pycalc_norm); def("generate_log_scales",generate_log_scales); }
a263af98e1db6304c680105a1b4eb7d3cbe16012
cf39d542c643caaac0748042df5ef6654cf90d6f
/src/test_rev.cpp
dca191fd669ad093346302512e163635a36692aa
[]
no_license
brianx7/po
fd963f859fd249b4994f5b5c533e37c69240929a
ddd379125da8d455c202af6158d42d2b75270c58
refs/heads/master
2021-01-13T14:54:38.009339
2014-05-12T14:11:09
2014-05-12T14:11:09
null
0
0
null
null
null
null
UTF-8
C++
false
false
608
cpp
test_rev.cpp
#include <gtest/gtest.h> void my_reverse( char* str ) { if (0 == str) { return; } unsigned int len(0); char* end = str; while (*end++ != 0) ++len; end -= 2; // back up end pointer by 2 while (str < end) { char temp = *str; *str = *end; *end = temp; ++str; --end; } } TEST(rev_test, simple_test) { char mstr[6]; mstr[0] = 'h'; mstr[1] = 'e'; mstr[2] = 'l'; mstr[3] = 'l'; mstr[4] = 'o'; mstr[5] = 0; ASSERT_STREQ(mstr, "hello"); my_reverse(mstr); ASSERT_STREQ( mstr, "olleh"); }
4fbd5fd649105caa8340cafc8b3fc3637c1d3606
05233d48abce0aad17209a129c0252590b0b8537
/PokerMonteCarlo/PokerMonteCarlo/HumanPlayer.cpp
311e472f27b08dcad76e99132fc7dafce4c56142
[]
no_license
corbinbaker/PokerMonteCarlo
b52c28a6e66c63b5e1ab2ebc9c12f94c7cc803e5
87364b8ed3a5f58585763dfa85d8b676c1ebacd9
refs/heads/master
2020-03-11T17:15:42.161379
2018-04-21T01:53:20
2018-04-21T01:53:20
130,141,918
0
0
null
null
null
null
UTF-8
C++
false
false
1,267
cpp
HumanPlayer.cpp
#include "HumanPlayer.h" #include "Player.h" #include "Hand.h" #include "BetHistory.h" #include <string> #include <iostream> using namespace std; int HumanPlayer::getBet(Hand opponent, BetHistory bh, int bet2player, bool canRaise, int pot) { /*This is a derived class of Player that presents domain information to the current human player through I/O and then allows the player to input their bet. Code should be implemented both to communicate to the game player the current status of the game (i.e. current hands showing, pot, bet history, etc.) and to validate the bets of the human player before returning the proper bet value. This uses the getBet() method.*/ int currentBet = 0; //if bet = 0 --> fold TODO: REWORK HUMAN PLAYER STRUCTURE //if userinput does not select any valid input they fold //io block for action calls: string input; cin >> input; if (input == "call"){ //call currentBet = bet2player; } else if (input == "bet") { //bet //get players bet int inbet = 0; currentBet = bet2player + inbet; } else if (input == "quit") { //quit currentBet = -1; } return currentBet; } void HumanPlayer::getInput() { } void HumanPlayer::call() { } void HumanPlayer::bet() { } void HumanPlayer::quit() { }
b6a435190d3308993924d5e0f47a5f74a944affe
0ae39e4f9744046848868cd58598f3f489fb22b4
/Products/Tools/Projucer/Source/Application/jucer_Main.cpp
fd1df4398fbb74a63c8936218a0770ee9fa6ab0a
[]
no_license
gogirogi/RS-MET
b908509ddd7390d05476ffce9c9cbb30e95439e8
d767896f542d8e00e803ad09d20c05b2f25c2c71
refs/heads/master
2021-08-19T21:56:36.416451
2017-11-27T14:11:52
2017-11-27T14:11:52
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,455
cpp
jucer_Main.cpp
/* ============================================================================== This file is part of the JUCE library. Copyright (c) 2015 - ROLI Ltd. Permission is granted to use this software under the terms of either: a) the GPL v2 (or any later version) b) the Affero GPL v3 Details of these licenses can be found at: www.gnu.org/licenses JUCE 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. ------------------------------------------------------------------------------ To release a closed-source product which uses JUCE, commercial licenses are available: visit www.juce.com for more information. ============================================================================== */ #include "../jucer_Headers.h" #include "jucer_Application.h" #include "jucer_OpenDocumentManager.h" #include "../Code Editor/jucer_SourceCodeEditor.h" #include "../Utility/jucer_FilePathPropertyComponent.h" #include "../Project/jucer_TreeItemTypes.h" #include "../Utility/jucer_UTF8Component.h" #include "../Utility/jucer_SVGPathDataComponent.h" #include "../Utility/jucer_FloatingToolWindow.h" #include "../Utility/jucer_DialogLookAndFeel.h" #include "../LiveBuildEngine/projucer_MessageIDs.h" #include "../LiveBuildEngine/projucer_CppHelpers.h" #include "../LiveBuildEngine/projucer_SourceCodeRange.h" #include "../LiveBuildEngine/projucer_ClassDatabase.h" #include "../LiveBuildEngine/projucer_DiagnosticMessage.h" #include "../LiveBuildEngine/projucer_CompileEngineDLL.h" #include "../LiveBuildEngine/projucer_CompileEngineClient.h" #include "../LiveBuildEngine/projucer_ActivityListComponent.h" #include "../LiveBuildEngine/projucer_BuildTabStatusComp.h" #include "../LiveBuildEngine/projucer_ComponentListComp.h" #include "../LiveBuildEngine/projucer_CompileEngineServer.h" #include "jucer_ProjucerLicenses.h" juce_ImplementSingleton (ProjucerLicenses); struct ProjucerAppClasses { #include "../Code Editor/jucer_LiveBuildCodeEditor.h" #include "../LiveBuildEngine/projucer_ErrorListComponent.h" }; #include "jucer_LoginForm.h" #include "jucer_EulaDialogue.h" #include "jucer_CommandLine.h" #include "../Project/jucer_ProjectContentComponent.cpp" #include "jucer_Application.cpp" START_JUCE_APPLICATION (ProjucerApplication)
e2d96d22b96b4e8af5348abe1f38d9586122cbb4
4a086f911a411bc93af2fbcbaacf474fd47a0b68
/rob_micro.cc
11f5af664ed4cfeec5b8ca894e45b0a03c086cfe
[]
no_license
dsheffie/rob-micro
315c1b4e4a3a518874b8a4b593029786eb57236f
5730456d48d0e647dab0050fcca6be9438c78a07
refs/heads/master
2023-05-04T21:09:49.901499
2021-05-24T14:18:33
2021-05-24T14:18:33
320,096,285
0
0
null
null
null
null
UTF-8
C++
false
false
4,760
cc
rob_micro.cc
#include <iostream> #include <algorithm> #include <vector> #include <ostream> #include <fstream> #include <cstdlib> #include <cstdio> #include <cassert> #include <cstring> #include <cmath> #include <unistd.h> #include <sys/mman.h> #include <sys/time.h> #include "perf.hh" #define PROT (PROT_READ | PROT_WRITE) #define MAP (MAP_ANONYMOUS|MAP_PRIVATE|MAP_POPULATE) static const void* failed_mmap = reinterpret_cast<void *>(-1); typedef int64_t (*ubench_t)(void*,void*,int64_t); struct codegen_opts { enum class filler {nop, add, jmp}; int unroll; bool xor_ptr; filler filler_op; codegen_opts() : unroll(16), xor_ptr(false), filler_op(filler::nop) {} }; struct list { list *next = nullptr; }; inline double timestamp() { struct timeval tv; gettimeofday(&tv, nullptr); return tv.tv_sec + 1e-6*static_cast<double>(tv.tv_usec); } template<typename T> void swap(T &x, T &y) { T t = x; x = y; y = t; } template <typename T> void shuffle(T *arr, size_t len) { for(size_t i = 0; i < len; i++) { size_t j = i + (rand() % (len-i)); swap(arr[i], arr[j]); } } static uint8_t *rawb = nullptr; static size_t pgsz = 0; static list* head = nullptr, *mid = nullptr; #ifdef __amd64__ #include "codegen_amd64.hh" #elif __aarch64__ #include "codegen_aarch64.hh" #else #error "wtf is this architecture" #endif double avg_time(int num_nops, int64_t iterations, codegen_opts &opts) { ubench_t my_bench = make_code(rawb, pgsz, num_nops, opts); if(my_bench == nullptr) { return 0.0; } int64_t c = 0; cycle_counter cc; cc.enable_counter(); cc.reset_counter(); uint64_t start = cc.read_counter(); c = my_bench(reinterpret_cast<void*>(head->next), reinterpret_cast<void*>(mid->next), iterations); uint64_t stop = cc.read_counter(); double links = static_cast<double>(c); double avg_cycles = (stop-start)/links; return avg_cycles; } int main(int argc, char *argv[]) { static_assert(sizeof(list)==sizeof(void*), "must be pointer sized"); char hostname[256] = {0}; void *ptr = nullptr; bool xor_ptr = false; bool use_nops = true; size_t len = 1UL<<22; int max_ops = 300; int tries = 8; int c; codegen_opts opts; std::vector<double> results; srand(time(nullptr)); while ((c = getopt (argc, argv, "l:m:n:t:x:")) != -1) { switch(c) { case 'l': len = 1UL << (atoi(optarg)); break; case 'n': use_nops = (atoi(optarg) != 0); break; case 'm': max_ops = atoi(optarg); break; case 't': tries = atoi(optarg); break; case 'x': xor_ptr = (atoi(optarg) != 0); default: break; } } std::cout << "len = " << len << ", max_ops = " << max_ops << ", tries = " << tries << ", xor_ptr = " << xor_ptr << ", use_nops = " << use_nops << "\n"; opts.xor_ptr = xor_ptr; opts.filler_op = use_nops ? codegen_opts::filler::nop : codegen_opts::filler::add; results.resize(tries); pgsz = 32*getpagesize(); rawb = reinterpret_cast<uint8_t*>(mmap(NULL, pgsz, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_ANON|MAP_PRIVATE, -1, 0)); assert(reinterpret_cast<void*>(-1) != rawb); gethostname(hostname,sizeof(hostname)); size_t *arr = nullptr; list *nodes = nullptr; int rc = posix_memalign((void**)&arr, 64, len*sizeof(size_t)); assert(rc == 0); ptr = mmap(nullptr, len*sizeof(list), PROT, MAP|MAP_HUGETLB, -1, 0); if(ptr == failed_mmap) { std::cerr << "unable to use hugepages, trying with " << getpagesize() << " byte pages\n"; ptr = mmap(nullptr, len*sizeof(list), PROT, MAP, -1, 0); } assert(ptr != failed_mmap); nodes = reinterpret_cast<list*>(ptr); for(size_t i = 0; i < len; i++) { arr[i] = i; } shuffle(arr, len); for(size_t i = 0; i < (len-1); i++) { nodes[arr[i]].next = &nodes[arr[i+1]]; } nodes[arr[len-1]].next = &nodes[arr[0]]; head = &nodes[arr[0]]; mid = &nodes[arr[len/2]]; free(arr); if(xor_ptr) { for(size_t i = 0; i < len; i++) { uint64_t p = reinterpret_cast<uint64_t>(nodes[i].next) ^ 0x13371337; nodes[i].next = reinterpret_cast<list*>(p); } } std::string out_name = std::string(hostname) + std::string(".txt"); std::ofstream out(out_name.c_str()); for(int num_nops=1; num_nops <= max_ops; num_nops++) { for(int t = 0; t < tries; ++t) { results[t] = avg_time(num_nops,len, opts); } std::sort(results.begin(), results.end()); double avg = results[tries/2]; std::cout << num_nops << " insns, " << avg << " cycles\n"; out << num_nops << " insns, " << avg << " cycles\n"; out.flush(); } out.close(); munmap(rawb, pgsz); munmap(ptr, sizeof(list)*len); return 0; }
37ab685be34fd318cab455b2ac08921b3d59522d
820e07724a8f2eb66d7fa5e41c308d49da0052ff
/cpp-demo/cpp17_06_structured_bindings.cpp
1f3327605c15f1d095ca224ace9ac93fb55525b8
[]
no_license
YueHub/demo
d476fb8c431d49ae69582310664468d94eee1186
33adbee2dff4a6e843764c94683c12335e88f7d2
refs/heads/master
2023-03-11T17:22:23.505567
2021-01-20T14:30:02
2021-01-20T14:30:02
143,633,359
20
20
null
2023-02-09T01:25:12
2018-08-05T17:23:20
C++
UTF-8
C++
false
false
520
cpp
cpp17_06_structured_bindings.cpp
#include <iostream> #include <tuple> using namespace std; tuple<int, double, string> f() { return make_tuple(1, 2.3, "456"); } int main() { int arr[2] = {1,2}; // 创建 e[2] // 复制 arr 到 e,然后 a1 指代 e[0],b1 指代 e[1] auto [a1, b1] = arr; cout << a1 << ", " << b1 << endl; // a2 指代 arr[0], b2 指代 arr[1] auto& [a2, b2] = arr; cout << a2 << ", " << b2 << endl; // 结构化绑定 tuple auto [x, y, z] = f(); cout << x << ", " << y << ", " << z << endl; return 0; }
735fec317a22a05cc684bcecfb81be33bee8880c
7771841a9e555460b94b0a172a56f2236d7be6e7
/firmware/settings.h
3e8c30368fa57a8a6682aad97c68c92041a8f4b6
[]
no_license
mar0x/patch_mate
1a6516ab549f6f803b9d2df61148ffb5abd3552f
a300e2afb4c3ac5081d79ca1d6c615046088d2b2
refs/heads/master
2022-06-01T11:31:50.892143
2021-12-28T21:33:31
2022-05-14T19:27:27
170,820,428
0
0
null
null
null
null
UTF-8
C++
false
false
585
h
settings.h
#pragma once #include "config.h" #include "debug.h" namespace patch_mate { struct settings_t { uint8_t midi_channel = 0; uint8_t midi_loop_ctrl_in[10] = { 128, 128, 128, 128, 128, 128, 128, 128, 128, 128 }; uint8_t midi_loop_ctrl_out[10] = { 128, 128, 128, 128, 128, 128, 128, 128, 128, 128 }; uint8_t midi_out_prog = 0; uint8_t midi_fwd = 0; uint8_t usb_debug = 0; uint16_t mute_delay_ms = 50; uint8_t hide_cursor_delay_s = 5; uint8_t prog_start = 1; uint8_t chan_start = 1; uint8_t echo = 0; uint8_t not_used_yet[2] = {0, 0}; }; }
179ed4d826a827b11166337c1eccb22225648cf4
501a495595fd9ff9fd46ac838a55f274a99a9494
/al5d_low_level_driver/src/LowLevelDriver/SerialCommunicationHandler.cpp
92ee5e5fac5714e30d4fb6558b78e98be2cd19eb
[ "MIT" ]
permissive
User-TGK/franka_robot_control
f11dd08aa9927757f60ece95f221148428021ddc
48d62b2056aca2226cbe5ac3914f01bef3659f49
refs/heads/master
2020-04-04T12:22:38.523372
2018-11-02T21:44:37
2018-11-02T21:44:37
155,924,297
3
0
null
null
null
null
UTF-8
C++
false
false
2,099
cpp
SerialCommunicationHandler.cpp
#include <exception> #include <ros/ros.h> #include <SerialBlockingReader.hpp> #include <SerialCommunicationHandler.hpp> namespace RobotControl { namespace Al5dLowLevelDriver { SerialCommunicationHandler::SerialCommunicationHandler(const std::string& serialPortPath) : port(ioservice, serialPortPath) { port.set_option(boost::asio::serial_port_base::baud_rate(9600)); port.set_option(boost::asio::serial_port::flow_control(boost::asio::serial_port::flow_control::none)); port.set_option(boost::asio::serial_port::parity(boost::asio::serial_port::parity::none)); port.set_option(boost::asio::serial_port::stop_bits(boost::asio::serial_port::stop_bits::one)); port.set_option(boost::asio::serial_port::character_size(boost::asio::serial_port::character_size(8))); if(!port.is_open()) { throw std::runtime_error("UNABLE TO ESTABLISH SERIAL CONNECTION WITH SERIAL DEVICE SSC32U."); } } SerialCommunicationHandler::~SerialCommunicationHandler() { } bool SerialCommunicationHandler::write(const std::string& message) { if(!port.is_open()) { throw std::runtime_error("SERIAL DEVICE SSC32U HAS CLOSED THE CONNECTION."); } boost::asio::streambuf b; std::ostream os(&b); os << message; boost::asio::write(port, b.data()); os.flush(); ROS_DEBUG("WROTE SSC32U SERIAL COMMAND: %s", message.c_str()); return true; } std::string SerialCommunicationHandler::timedRead(long timeout) { if(!port.is_open()) { throw std::runtime_error("SERIAL DEVICE SSC32U HAS CLOSED THE CONNECTION."); } SerialBlockingReader reader(port, timeout); char c; std::string rsp; while(reader.readChar(c) && c != '\n' && rsp != "+" && rsp != ".") { rsp += c; } if(rsp == "." || rsp == "+") { ROS_DEBUG("READ SSC32U SERIAL FEEDBACK: %s", rsp.c_str()); return rsp; } if(c != '\n') { // Timeout throw std::runtime_error("UNABLE TO READ DATA FROM SSC32U WITHIN DEADLINE TIMER DURATION."); } ROS_DEBUG("READ SSC32U SERIAL FEEDBACK: %s", rsp.c_str()); return rsp; } }// namespace RobotControl }// namespace Al5dLowLevelDriver
436df665fd789c1ab6df6d1524342c9620e725db
a92b18defb50c5d1118a11bc364f17b148312028
/src/prod/src/ServiceModel/ApplicationAggregatedHealthState.h
3897326b63ac01488f1fa3c62f118de011992695
[ "MIT" ]
permissive
KDSBest/service-fabric
34694e150fde662286e25f048fb763c97606382e
fe61c45b15a30fb089ad891c68c893b3a976e404
refs/heads/master
2023-01-28T23:19:25.040275
2020-11-30T11:11:58
2020-11-30T11:11:58
301,365,601
1
0
MIT
2020-11-30T11:11:59
2020-10-05T10:05:53
null
UTF-8
C++
false
false
2,946
h
ApplicationAggregatedHealthState.h
// ------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License (MIT). See License.txt in the repo root for license information. // ------------------------------------------------------------ #pragma once namespace ServiceModel { class ApplicationAggregatedHealthState : public Serialization::FabricSerializable , public Common::IFabricJsonSerializable , public Common::ISizeEstimator , public IPageContinuationToken { public: ApplicationAggregatedHealthState(); ApplicationAggregatedHealthState( std::wstring const & applicationName, FABRIC_HEALTH_STATE aggregatedHealthState); ApplicationAggregatedHealthState(ApplicationAggregatedHealthState const & other) = default; ApplicationAggregatedHealthState & operator = (ApplicationAggregatedHealthState const & other) = default; ApplicationAggregatedHealthState(ApplicationAggregatedHealthState && other) = default; ApplicationAggregatedHealthState & operator = (ApplicationAggregatedHealthState && other) = default; virtual ~ApplicationAggregatedHealthState(); __declspec(property(get=get_ApplicationName)) std::wstring const& ApplicationName; std::wstring const& get_ApplicationName() const { return applicationName_; } __declspec(property(get=get_AggregatedHealthState)) FABRIC_HEALTH_STATE AggregatedHealthState; FABRIC_HEALTH_STATE get_AggregatedHealthState() const { return aggregatedHealthState_; } Common::ErrorCode ToPublicApi( __in Common::ScopedHeap & heap, __out FABRIC_APPLICATION_HEALTH_STATE & publicApplicationAggregatedHealthState) const; Common::ErrorCode FromPublicApi( FABRIC_APPLICATION_HEALTH_STATE const & publicApplicationAggregatedHealthState); void WriteTo(__in Common::TextWriter&, Common::FormatOptions const &) const; std::wstring ToString() const; // // IPageContinuationToken methods // std::wstring CreateContinuationToken() const override; FABRIC_FIELDS_02(applicationName_, aggregatedHealthState_); BEGIN_JSON_SERIALIZABLE_PROPERTIES() SERIALIZABLE_PROPERTY(Constants::Name, applicationName_) SERIALIZABLE_PROPERTY_ENUM(Constants::AggregatedHealthState, aggregatedHealthState_) END_JSON_SERIALIZABLE_PROPERTIES() BEGIN_DYNAMIC_SIZE_ESTIMATION() DYNAMIC_SIZE_ESTIMATION_MEMBER(applicationName_) DYNAMIC_ENUM_ESTIMATION_MEMBER(aggregatedHealthState_) END_DYNAMIC_SIZE_ESTIMATION() private: std::wstring applicationName_; FABRIC_HEALTH_STATE aggregatedHealthState_; }; using ApplicationAggregatedHealthStateList = std::vector<ApplicationAggregatedHealthState>; }
fb4811729f344d42d18069d62c9ce3c5bdd655ba
36ca6651ec7182424fc9d48728330d388a6d6322
/src/Vector.hpp
9a66ed1ff99b86689e085acd04be8f156c71188a
[]
no_license
Aeomanate/QuadTree
789a73e5d53c8a50f88db84ac9f3334ee075660e
d1fee0dcbf4e0cd2d61affcda6b788a5515dc95b
refs/heads/master
2023-06-11T11:08:26.844024
2021-06-25T18:23:52
2021-06-25T18:23:52
375,404,146
0
0
null
null
null
null
UTF-8
C++
false
false
725
hpp
Vector.hpp
// // Created by Aeomanate on 01.06.2021. // #ifndef QUADTREE_VECTOR_HPP #define QUADTREE_VECTOR_HPP template<typename T> class Vector2 { public: T x, y; explicit Vector2<T>(T X = T(), T Y = T()) : x(X) , y(Y) { } Vector2<T>& operator+=(Vector2<T> const& other) { x += other.x; y += other.y; return *this; } Vector2<T>& operator/=(T t) { x /= t; y /= t; return *this; } }; template<typename T> Vector2<T> operator+(Vector2<T> lhs, Vector2<T> const& rhs) { lhs += rhs; return lhs; } template<typename T> Vector2<T> operator/(Vector2<T> vec, T t) { vec /= t; return vec; } #endif // QUADTREE_VECTOR_HPP
0cf6f3af48989d07e43a543dac15206c16919dea
4dcf67322ddbd89c98aef64aa970f603c3b35ffc
/Roteiros/Roteiro_03/FolhaPagamento/Funcionario.hpp
874f35f1ca7a1db4a1ed4364678c70735c79dc09
[]
no_license
Gabriel-Alexandre/Linguagem-CPP
d7f856953b4e092a0b4a891fed23ce939be9a74d
f44e5e020cfc9635e514d41bfc4f25fe33fa1771
refs/heads/master
2023-06-09T15:28:13.449004
2021-07-01T21:42:28
2021-07-01T21:42:28
362,910,606
1
0
null
null
null
null
UTF-8
C++
false
false
267
hpp
Funcionario.hpp
#ifndef FUNCIONARIO_H #define FUNCIONARIO_H #include <string> class Funcionario { protected: std::string nome; int matricula; public: Funcionario(std::string nome, int matricula); std::string getNome(); virtual double calculaSalario() = 0; }; #endif
c71eea681c658157fd6bf3e0149f4a402971c9e7
b5098842c7b8748dc690e93c3fd7cd315d40b1df
/solutions/2_POO/cloud_of_points_v2/test_cloud_of_points.cpp
6e5e24c8e3ab0019bb3eec77ca79fee8f8ee8f34
[]
no_license
Macs1718/CPlusPlus14
1d915e405513c22efb808406f1765554c0802a8c
42b6efe783225f8ea0e82cc5ce051627ecd9d522
refs/heads/master
2021-05-10T17:24:23.474454
2018-06-20T13:31:36
2018-06-20T13:31:36
118,608,527
2
1
null
null
null
null
UTF-8
C++
false
false
355
cpp
test_cloud_of_points.cpp
# include "cloud_of_points.hpp" using namespace Geometry; int main() { CloudOfPoints cld( { {1.,0.,0.}, {0.,1.,0.} } ); CloudOfPoints cld2( { {0.,0.,1.}, {1.,0.,1.} } ); CloudOfPoints cld3 = cld + cld2; std::cout << cld << "\n" << std::string(cld) << std::endl; std::cout << std::string(cld3) << std::endl; return EXIT_SUCCESS; }
a405e79e35660001f23576c36ee6ffff7f39d2d8
30f7a368ab5aa4359c8dfc8aec823f88e43f33ab
/ch4-computation/6-the-smallest-and-largest.cpp
20db0d4d6546593b5fd743b1981295ff1d13b0d6
[]
no_license
samueltang-x/programming-principles-and-practice-using-cpp
5d9e0c46641b6c7632cd7e3fde0c8d2aa8295531
2a931d9843d6fd34ef4e0dc7870425af692a188f
refs/heads/master
2020-05-16T21:48:21.843899
2019-05-03T15:58:17
2019-05-03T15:58:17
183,317,975
0
0
null
null
null
null
UTF-8
C++
false
false
507
cpp
6-the-smallest-and-largest.cpp
#include "std_lib_facilities.h" int main() { cout << "Enter a number: (terminating with | if want to exit)\n"; double smallest{0}, largest{0}, temp; while (cin >> temp) { if ( temp < smallest ) { smallest = temp; cout << temp << ": the samllest so far\n"; } else if ( temp > largest ) { largest = temp; cout << temp << ": the largest so far\n"; } else { cout << temp << '\n'; } } return 0; }
3125dcacde48db747d0132cfc1a6c42da3a5584f
197f92a6e5a71e804c8397fb72961a953984866a
/source/EditOrderCustomFrm.cpp
90caea7507b2c85edc8dc0e86930065b05f20ad4
[]
no_license
AtlaClient/AtlaClient-old
f26fb416d68035ada0a8a5cccb822d4fde8253de
ebcc965a68a909955f9f30851010b59d9784568c
refs/heads/master
2020-03-29T15:21:35.274756
2013-11-24T16:37:48
2013-11-24T16:37:48
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,883
cpp
EditOrderCustomFrm.cpp
//--------------------------------------------------------------------------- #include <vcl.h> #pragma hdrstop #include "util.h" #include "orders.h" #include "EditOrderCustomFrm.h" //--------------------------------------------------------------------------- #pragma package(smart_init) #pragma resource "*.dfm" TEditOrderCustomForm *EditOrderCustomForm; //--------------------------------------------------------------------------- __fastcall TEditOrderCustomForm::TEditOrderCustomForm(TComponent* Owner, AOrderCustom *_ord) : TForm(Owner),ord(_ord) { edText->Text=ord->text; cbCommented->Checked=ord->commented; cbRepeating->Checked=ord->repeating; } //--------------------------------------------------------------------------- void __fastcall TEditOrderCustomForm::bnOkClick(TObject *Sender) { ord->text=edText->Text; ord->commented=cbCommented->Checked; ord->repeating=cbRepeating->Checked; } //--------------------------------------------------------------------------- void __fastcall TEditOrderCustomForm::bnCancelClick(TObject *Sender) { ord=0; } //--------------------------------------------------------------------------- void __fastcall TEditOrderCustomForm::bnConvertCommentClick( TObject *Sender) { bnOkClick(this); AOrderComment *neword=new AOrderComment; neword->text=ord->text; neword->repeating=ord->repeating; ord=(AOrderCustom*)neword; ModalResult=mbOK; } void __fastcall TEditOrderCustomForm::bnConvertOrderClick(TObject *Sender) { bnOkClick(this); AnsiString str=ord->WriteTemplate(); AOrder *neword=ParseOrder(str); if(!neword) return; if(neword->type==O_CUSTOMORDER){ //dynamic_cast<AOrderCustom*>(neword)){ delete neword; return; } ord=(AOrderCustom*)neword; ModalResult=mbOK; } //---------------------------------------------------------------------------
3918a6d88e3bba2002d72f13bd66f37cade4fe2f
461188dca96f46443a951cb74504f3ac171b3792
/LuaAV/modules/space/src/quat.h
a28b27880951cf6d6f8d2bb770da8ee415b78920
[]
no_license
italoadler/LuaAV
f1e7d713c3efd6b0e2ac607f32df1cc71bbc22be
f2a7fbc6bb4c5d7c0668a6a49135a617f638f2b4
refs/heads/master
2021-01-15T18:26:40.264978
2017-07-25T17:20:25
2017-07-25T17:20:25
null
0
0
null
null
null
null
UTF-8
C++
false
false
11,254
h
quat.h
#ifndef INC_QUAT_H #define INC_QUAT_H #include <math.h> #define QUAT_ACCURACY_MAX (1.000001) #define QUAT_ACCURACY_MIN (0.999999) #define QUAT_EPSILON (0.000001) #define QUAT_RAD2DEG (57.29577951308) #define QUAT_DEG2RAD (0.01745329252) #define QUAT_DEG2RAD_BY2 (0.00872664626) #define QUAT_PIBY2 (1.57079632679) class Quat { public: Quat(double w = 1.0, double x = 0.0, double y = 0.0, double z = 0.0); Quat(Quat * src); double w; double x; double y; double z; int normcount; static int normrate; void normcheck(); void normalize(); void reset(); void multiply(Quat * q2); // in-place void multiply(Quat * q2, Quat * result); void inverse(Quat * result); void fromQuat(double w, double x, double y, double z); void fromQuat(float w, float x, float y, float z); void fromAxisAngle(double theta, double x1, double y1, double z1); void fromAxisAngle(float theta, float x1, float y1, float z1); void fromEuler(double a, double e, double b); void fromEuler(float a, float e, float b); void toMatrix(double * matrix); // 4x4 matrix as double[16] void toMatrix(float * matrix); // 4x4 matrix as double[16] void toAxisAngle(float * aa, float * ax, float * ay, float * az); // axis angle as double[4] void toAxisAngle(double * aa, double * ax, double * ay, double * az); // axis angle as double[4] void toEuler(double * e); // euler angles as double[3] void toEuler(float * e); // euler angles as double[3] void toVectorX(double * x, double * y, double * z); // vector as double[3] void toVectorX(float * x, float * y, float * z); // vector as double[3] void toVectorY(double * x, double * y, double * z); // vector as double[3] void toVectorY(float * x, float * y, float * z); // vector as double[3] void toVectorZ(double * x, double * y, double * z); // vector as double[3] void toVectorZ(float * x, float * y, float * z); // vector as double[3] void rotateVector(double * src, double * dst); void rotateVector(float * src, float * dst); void rotateVectorTransposed(float * src, float * dst); void rotateby(Quat * q2); // in-place }; inline Quat :: Quat(double w, double x, double y, double z) : w(w), x(x), y(y), z(z), normcount(0) {} inline Quat :: Quat(Quat * src) { w = src->w; x = src->x; y = src->y; z = src->z; } inline void Quat :: normcheck() { if (normcount++ > normrate) normalize(); } inline void Quat :: reset() { w = 1.0; // identity quaternion x = y = z = 0.0; } inline void Quat :: normalize() { normcount = 0; double unit = w*w + x*x + y*y + z*z; if (unit*unit < QUAT_EPSILON) { // unit too close to epsilon, set to default transform w = 1.0; x = y = z = 0.0; return; } if (unit > QUAT_ACCURACY_MAX || unit < QUAT_ACCURACY_MIN) { double invmag = 1.0/sqrt(unit); w *= invmag; x *= invmag; y *= invmag; z *= invmag; } } // assumes both are already normalized! inline void Quat :: multiply(Quat * q1, Quat * q2) { normcheck(); w = q1->w*q2->w - q1->x*q2->x - q1->y*q2->y - q1->z*q2->z; x = q1->w*q2->x + q1->x*q2->w + q1->y*q2->z - q1->z*q2->y; y = q1->w*q2->y + q1->y*q2->w + q1->z*q2->x - q1->x*q2->z; z = q1->w*q2->z + q1->z*q2->w + q1->x*q2->y - q1->y*q2->x; } inline void Quat :: multiply(Quat * q1) { Quat * q = new Quat(this); multiply(q1, q); delete q; } inline void Quat :: rotateby(Quat * dq) { Quat * q = new Quat(this); // multiply(q, dq); multiply(dq, q); delete q; } inline void Quat :: inverse(Quat * result) { normalize(); result->w = w; result->x = -x; result->y = -y; result->z = -z; } inline void Quat :: fromQuat(double w, double x, double y, double z) { this->w = w; this->x = x; this->y = y; this->z = z; } inline void Quat :: fromQuat(float w, float x, float y, float z) { this->w = w; this->x = x; this->y = y; this->z = z; } inline void Quat :: fromAxisAngle(double theta, double x1, double y1, double z1) { double t2 = theta * 0.00872664626; // * 0.5 * 180/PI double sinft2 = sin(t2); w = cos(t2); x = x1 * sinft2; y = y1 * sinft2; z = z1 * sinft2; normalize(); } inline void Quat :: fromAxisAngle(float theta, float x1, float y1, float z1) { float t2 = theta * 0.00872664626f; // * 0.5 * 180/PI float sinft2 = sinf(t2); w = cosf(t2); x = x1 * sinft2; y = y1 * sinft2; z = z1 * sinft2; normalize(); } inline void Quat :: fromEuler(double az, double el, double ba) { //http://vered.rose.utoronto.ca/people/david_dir/GEMS/GEMS.html //Converting from Euler angles to a quaternion is slightly more tricky, as the order of operations //must be correct. Since you can convert the Euler angles to three independent quaternions by //setting the arbitrary axis to the coordinate axes, you can then multiply the three quaternions //together to obtain the final quaternion. //So if you have three Euler angles (a, b, c), then you can form three independent quaternions //Qx = [ cos(a/2), (sin(a/2), 0, 0)] //Qy = [ cos(b/2), (0, sin(b/2), 0)] //Qz = [ cos(c/2), (0, 0, sin(c/2))] //And the final quaternion is obtained by Qx * Qy * Qz. double c1 = cos(az * QUAT_DEG2RAD_BY2); double c2 = cos(el * QUAT_DEG2RAD_BY2); double c3 = cos(ba * QUAT_DEG2RAD_BY2); double s1 = sin(az * QUAT_DEG2RAD_BY2); double s2 = sin(el * QUAT_DEG2RAD_BY2); double s3 = sin(ba * QUAT_DEG2RAD_BY2); // equiv quat_multiply(&Qy, &Qx, &Q1); // since many terms are zero double tw = c1*c2; double tx = c1*s2; double ty = s1*c2; double tz = - s1*s2; // equiv quat_multiply(&Q1, &Qz, &Q2); // since many terms are zero w = tw*c3 - tz*s3; x = tx*c3 + ty*s3; y = ty*c3 - tx*s3; z = tw*s3 + tz*c3; normalize(); } inline void Quat :: fromEuler(float az, float el, float ba) { //http://vered.rose.utoronto.ca/people/david_dir/GEMS/GEMS.html //Converting from Euler angles to a quaternion is slightly more tricky, as the order of operations //must be correct. Since you can convert the Euler angles to three independent quaternions by //setting the arbitrary axis to the coordinate axes, you can then multiply the three quaternions //together to obtain the final quaternion. //So if you have three Euler angles (a, b, c), then you can form three independent quaternions //Qx = [ cos(a/2), (sin(a/2), 0, 0)] //Qy = [ cos(b/2), (0, sin(b/2), 0)] //Qz = [ cos(c/2), (0, 0, sin(c/2))] //And the final quaternion is obtained by Qx * Qy * Qz. float c1 = cosf(az * QUAT_DEG2RAD_BY2); float c2 = cosf(el * QUAT_DEG2RAD_BY2); float c3 = cosf(ba * QUAT_DEG2RAD_BY2); float s1 = sinf(az * QUAT_DEG2RAD_BY2); float s2 = sinf(el * QUAT_DEG2RAD_BY2); float s3 = sinf(ba * QUAT_DEG2RAD_BY2); // equiv quat_multiply(&Qy, &Qx, &Q1); // since many terms are zero float tw = c1*c2; float tx = c1*s2; float ty = s1*c2; float tz = - s1*s2; // equiv quat_multiply(&Q1, &Qz, &Q2); // since many terms are zero w = tw*c3 - tz*s3; x = tx*c3 + ty*s3; y = ty*c3 - tx*s3; z = tw*s3 + tz*c3; normalize(); } inline void Quat :: toMatrix(double * m) { m[0] = 1.0 - 2.0*y*y - 2.0*z*z; m[1] = 2.0*x*y - 2.0*z*w; m[2] = 2.0*x*z + 2.0*y*w; m[3] = 0.0; m[4] = 2.0*x*y + 2.0*z*w; m[5] = 1.0 - 2.0*x*x - 2.0*z*z; m[6] = 2.0*y*z - 2.0*x*w; m[7] = 0.0; m[8] = 2.0*x*z - 2.0*y*w; m[9] = 2.0*y*z + 2.0*x*w; m[10] = 1.0 - 2.0*x*x - 2.0*y*y; m[11] = 0.0; m[12] = m[13] = m[14] = 0.0; m[15] = 1.0; } inline void Quat :: toMatrix(float * m) { m[0] = 1.f - 2.0f*y*y - 2.0f*z*z; m[1] = 2.f*x*y - 2.0f*z*w; m[2] = 2.f*x*z + 2.0f*y*w; m[3] = 0.f; m[4] = 2.f*x*y + 2.0f*z*w; m[5] = 1.f - 2.0f*x*x - 2.0f*z*z; m[6] = 2.f*y*z - 2.0f*x*w; m[7] = 0.f; m[8] = 2.f*x*z - 2.0f*y*w; m[9] = 2.f*y*z + 2.0f*x*w; m[10] = 1.f - 2.0f*x*x - 2.0f*y*y; m[11] = 0.f; m[12] = m[13] = m[14] = 0.0f; m[15] = 1.f; } inline void Quat :: toAxisAngle(float * aa, float * ax, float * ay, float * az) { float unit = w*w; if (unit > QUAT_ACCURACY_MAX || unit < QUAT_ACCURACY_MIN) { float invSinAngle = 1.f/sqrt(1.f - unit); *aa = acosf(w) * 114.59155902616; // * 2 * 180 / pi *ax = x * invSinAngle; *ay = y * invSinAngle; *az = z * invSinAngle; } else { *aa = 0.f; *ax = x; *ay = y; *az = z; } } inline void Quat :: toAxisAngle(double * aa, double * ax, double * ay, double * az) { double unit = w*w; if (unit > QUAT_ACCURACY_MAX || unit < QUAT_ACCURACY_MIN) { double invSinAngle = 1.0/sqrt(1.0 - unit); *aa = acos(w) * 114.59155902616; // * 2 * 180 / pi *ax = x * invSinAngle; *ay = y * invSinAngle; *az = z * invSinAngle; } else { *aa = 0.0; *ax = x; *ay = y; *az = z; } } inline void Quat :: toEuler(double * e) { // http://www.mathworks.com/access/helpdesk/help/toolbox/aeroblks/quaternionstoeulerangles.html double sqw = w*w; double sqx = x*x; double sqy = y*y; double sqz = z*z; e[0] = QUAT_RAD2DEG * asin(-2.0 * (x*z - w*y)); e[1] = QUAT_RAD2DEG * atan2(2.0 * (y*z + w*x),(sqw - sqx - sqy + sqz)); e[3] = QUAT_RAD2DEG * atan2(2.0 * (x*y + w*z), (sqw + sqx - sqy - sqz)); } inline void Quat :: toEuler(float * e) { // http://www.mathworks.com/access/helpdesk/help/toolbox/aeroblks/quaternionstoeulerangles.html float sqw = w*w; float sqx = x*x; float sqy = y*y; float sqz = z*z; e[0] = QUAT_RAD2DEG * asinf(-2.0f * (x*z - w*y)); e[1] = QUAT_RAD2DEG * atan2f(2.0f * (y*z + w*x),(sqw - sqx - sqy + sqz)); e[3] = QUAT_RAD2DEG * atan2f(2.0f * (x*y + w*z), (sqw + sqx - sqy - sqz)); } inline void Quat :: toVectorX(double * vx, double * vy, double * vz) { *vx = 1.0 - 2.0*y*y - 2.0*z*z; *vy = 2.0*x*y + 2.0*z*w; *vz = 2.0*x*z - 2.0*y*w; } inline void Quat :: toVectorY(double * vx, double * vy, double * vz) { *vx = 2.0*x*y - 2.0*z*w; *vy = 1.0 - 2.0*x*x - 2.0*z*z; *vz = 2.0*y*z + 2.0*x*w; } inline void Quat :: toVectorZ(double * vx, double * vy, double * vz) { *vx = 2.0*x*z + 2.0*y*w; *vy = 2.0*y*z - 2.0*x*w; *vz = 1.0 - 2.0*x*x - 2.0*y*y; } inline void Quat :: toVectorX(float * vx, float * vy, float * vz) { *vx = 1.0f - 2.0f*y*y - 2.0f*z*z; *vy = 2.0f*x*y + 2.0f*z*w; *vz = 2.0f*x*z - 2.0f*y*w; } inline void Quat :: toVectorY(float * vx, float * vy, float * vz) { *vx = 2.0f*x*y - 2.0f*z*w; *vy = 1.0f - 2.0f*x*x - 2.0f*z*z; *vz = 2.0f*y*z + 2.0f*x*w; } inline void Quat :: toVectorZ(float * vx, float * vy, float * vz) { *vx = 2.0f*x*z + 2.0f*y*w; *vy = 2.0f*y*z - 2.0f*x*w; *vz = 1.0f - 2.0f*x*x - 2.0f*y*y; } inline void Quat :: rotateVector(double * src, double * dst) { double matrix[16]; toMatrix(matrix); dst[0] = src[0] * matrix[0] + src[1] * matrix[1] + src[2] * matrix[2]; dst[1] = src[0] * matrix[4] + src[1] * matrix[5] + src[2] * matrix[6]; dst[2] = src[0] * matrix[8] + src[1] * matrix[9] + src[2] * matrix[10]; } inline void Quat :: rotateVectorTransposed(float * src, float * dst) { float matrix[16]; toMatrix(matrix); dst[0] = src[0] * matrix[0] + src[1] * matrix[4] + src[2] * matrix[8]; dst[1] = src[0] * matrix[1] + src[1] * matrix[5] + src[2] * matrix[9]; dst[2] = src[0] * matrix[2] + src[1] * matrix[6] + src[2] * matrix[10]; } inline void Quat :: rotateVector(float * src, float * dst) { float matrix[16]; toMatrix(matrix); dst[0] = src[0] * matrix[0] + src[1] * matrix[1] + src[2] * matrix[2]; dst[1] = src[0] * matrix[4] + src[1] * matrix[5] + src[2] * matrix[6]; dst[2] = src[0] * matrix[8] + src[1] * matrix[9] + src[2] * matrix[10]; } #endif
da48c5285243f8bf93d29205ba2ef71a07bc2f74
ab4c33df512a280756b611291fa8e74f23801d2f
/ex05-06/Product.cpp
e2b4d341cf9d15b13e8187aba52c87c252bee095
[]
no_license
meirl1/cpluspluslab
a496b05c602b896a4a6c979acefd22630571c6ea
8c7a15cab9763eb2b3ccd91ead5398f7aa196bbb
refs/heads/master
2023-04-22T03:50:32.466918
2021-05-18T13:27:11
2021-05-18T13:27:11
343,748,724
1
1
null
2021-03-04T19:13:13
2021-03-02T11:20:44
C++
UTF-8
C++
false
false
426
cpp
Product.cpp
#include "Product.h" #include <cstring> #include <iostream> using namespace std; void Product::init(char* n, int q, float p) { if (strlen(n) > 9) throw string("error: name too long\n"); strcpy_s(name, 9, n); if (q < 0 || q>100) throw q; quantity = q; if (p < 0) throw p; price = p; } ostream& operator<<(ostream& os, Product p) { os << p.name << '\t'; os << p.quantity << '\t'; os << p.price << '\n'; return os; }
db4fcaf09e7dbf03f4e4cd8a7889241fcad085d8
8c6abc0671bf5b7f4bc4d3555002fa8f93c7f262
/beanselect/mcuworker.h
bc9bbcb7decd3a4730b8fd2ff7d959a09960f84d
[]
no_license
TERRIOR/greenbean
76ff6ebcbd3f6605b719474a4a2db6ad2d9e67fd
a215749f2b555e5e205158ae4d833b27a651bee8
refs/heads/master
2020-03-28T19:23:32.744972
2019-05-06T02:54:12
2019-05-06T02:54:12
148,971,287
0
0
null
null
null
null
UTF-8
C++
false
false
895
h
mcuworker.h
/** *@projectName beanselect *@documentname mcuworker.h *@author zzJun *@date 20180910 *@brief 管理单片机工作线程的worker类 **/ #ifndef MCUWORKER_H #define MCUWORKER_H #include <iostream> #include <QObject> #include <QMutex> #include <QDebug> #include <QThread> #include <windows.h> #pragma comment(lib, "Gdi32.lib") #pragma comment(lib,"user32.lib") class mcuworker: public QObject { Q_OBJECT public: mcuworker(); //请求工作 void requestWork(); //结束工作 void abort(); signals: //已经请求 void workRequested(); //已经结束工作 void finished(); void send(); public slots: void doWork();//do something private : bool _abort;//abort:停止 用于停止程序的运行 bool _working;//是否工作的判断的变量 QMutex inmutex;//类里变量的锁 }; #endif // MCUWORKER_H
4088c696a929fb4575f75d9e134f0c899fa14738
8c5f16b6e5616f7e823a502d7235d1e7bd1c8825
/homework/6-5.cpp
4c8fb5c217b50ccdc73fe294172e2ab9d86061da
[]
no_license
TouwaErioH/VHDL-files
4c437bb7a060fb16f2dda38c7abfcd36b1d5af15
09032ac75250b279937299779a521e087d5c7cb0
refs/heads/master
2020-03-14T16:44:36.604261
2019-06-26T08:15:31
2019-06-26T08:15:31
131,704,035
1
2
null
null
null
null
UTF-8
C++
false
false
425
cpp
6-5.cpp
#include <stdio.h> #include <stdlib.h> #include <ctype.h> int main() { int min,max; int n; scanf("%d",&n); if(isalnum==0) { exit(0); } else if(isalnum!=0&&isalpha==0) { exit(0); } if(n==-1) { exit(0); } min=n; max=n; while(1) { scanf("%d",&n); if(n==-1) { break; } else if(n>max) { max=n; } if(n<min) { min=n; } } printf("max=%d, min=%d",max,min); return 0; }
b8838ad7458202ad3d0ed61baf39e08429ad89fa
7103e83f6572963f62551cbefa3864b62a11df7d
/chap8_RecursionAndDynamicProgramming/8.11_Coins.cpp
e8f602e1c6566c3ffb840aaac383948b1cdbb183
[]
no_license
yesiah/ctci
ce1499c803c693fcc2d5f5e9127e15a703fba22f
bd0c735f1476901786d83cefe83b57a5550d15b3
refs/heads/master
2022-12-13T20:46:33.166565
2020-09-08T13:20:04
2020-09-08T13:20:04
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,089
cpp
8.11_Coins.cpp
// LC #518 #include <algorithm> #include <iostream> #include <map> #include <vector> #include <utility> #include "printer.hpp" #include "timer.hpp" // DP solution, this is insane...... int changeDP(int amount, std::vector<int>& coins) { std::vector<int> dp(amount + 1, 0); dp[0] = 1; for (int coin : coins) { for (int i = coin; i <= amount; ++i) { dp[i] += dp[i - coin]; } } return dp[amount]; } int changeDP(int amount, std::vector<int>&& coins) { return changeDP(amount, coins); } // Recursive solution, much slower and takes more space int changeRecursive(int amount, std::vector<int>& coins, int coinsBack, std::multimap<int, std::pair<int, int>>& prevCombination) { if (amount == 0) return 1; if (coinsBack == 0) return amount % coins[0] == 0; auto prevAns = prevCombination.equal_range(amount); for (auto it = prevAns.first; it != prevAns.second; ++it) { if (it->second.first != coinsBack) continue; return it->second.second; } int res = 0; for (int i = 0; i < amount / coins[coinsBack] + 1; ++i) res += changeRecursive(amount - i * coins[coinsBack], coins, coinsBack - 1, prevCombination); prevCombination.insert( std::make_pair(amount, std::pair<int, int>(coinsBack, res))); return res; } int changeRecursive(int amount, std::vector<int>& coins) { if (coins.empty()) return 0; std::multimap<int, std::pair<int, int>> prevCombination; // <amount, <coinsBack, answer>> std::sort(coins.begin(), coins.end()); return changeRecursive(amount, coins, coins.size() - 1, prevCombination); } int changeRecursive(int amount, std::vector<int>&& coins) { return changeRecursive(amount, coins); } int main(int argc, const char *argv[]) { tic(us, "Recursive: "); std::cout << changeRecursive(1000, std::vector<int>{3,5,7,8,9,10,11}) << std::endl; toc(); tic(us, "DP: "); std::cout << changeDP(1000, std::vector<int>{3,5,7,8,9,10,11}) << std::endl; toc(); return 0; }
4528f586bea0c419ba7f41e5ae13f02d1135bcbb
30e87cc45c81efb878541c0d31c55a7be58131b0
/Arrays/sort_012.cpp
74cb3ab90260c3e34e6fb181cdc056517089731c
[]
no_license
shivamgohri/ds_codes
d4df844e89e47758ae97bb98128b9efb0d0c1433
c7cd8d3cf9e0dc99bfa11c38c4ee6b0346ba3bc0
refs/heads/master
2021-05-26T23:30:30.968567
2020-12-12T15:03:34
2020-12-12T15:03:34
254,187,638
0
0
null
null
null
null
UTF-8
C++
false
false
382
cpp
sort_012.cpp
#include <iostream> using namespace std; int main(){ int n; cin>>n; int* arr = new int[n](); for(int i=0; i<n; i++){ cin>> arr[i]; } int l=0, m=0, h=n-1; while(m<=h){ if(arr[m] == 0){ swap(arr[l], arr[m]); l++; m++; } else if(arr[m]==1){ m++; } else{ swap(arr[m], arr[h]); h--; } } for(int i=0; i<n; i++){ cout<<arr[i]<<" "; } }
ea8d6d2ac89384c6d87fa7cff10e248976cf8d4f
c202deddfc88af90de949730d4deebfc5b647f8c
/src/lib/isa/Opcode.hpp
95e9893062add662022821a9cdf4f07e52f3a133
[]
no_license
parsa/iato
11523df0aa73290c3eb70129b25e4e9d1c3f95bf
28d75c28fa96be6aad43d07b9f8e1ca1d42192dd
refs/heads/master
2020-04-26T16:34:05.303929
2019-03-06T20:46:33
2019-03-06T20:46:33
173,683,631
0
0
null
null
null
null
UTF-8
C++
false
false
48,789
hpp
Opcode.hpp
// --------------------------------------------------------------------------- // - Opcode.hpp - // - iato:isa library - instruction operands and opcode definitions - // --------------------------------------------------------------------------- // - (c) inria 2002-2004 - // --------------------------------------------------------------------------- // - authors Amaury Darsch 2002:2004 - // - Pierre Villalon 2002:2003 - // - Andre Seznec 2002:2004 - // --------------------------------------------------------------------------- // - This program 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. - // - - // - 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 version 2 for more details - // --------------------------------------------------------------------------- #ifndef IATO_OPCODE_HPP #define IATO_OPCODE_HPP namespace iato { /// instruction opcode type enum t_iopc { U_INVALID, // invalid decoded instruction A_ADD, // A01 : add r1 = r2, r3 A_ADD_1, // A01 : add r1 = r2, r3, 1 A_SUB, // A01 : sub r1 = r2, r3 A_SUB_1, // A01 : sub r1 = r2, r3, 1 A_ADDP4, // A01 : addp4 r1 = r2, r3 A_AND, // A01 : and r1 = r2, r3 A_ANDCM, // A01 : andcm r1 = r2, r3 A_OR, // A01 : or r1 = r2, r3 A_XOR, // A01 : xor r1 = r2, r3 A_SHLADD, // A02 : shladd r1 = r2, count, r3 A_SHLADDP4, // A02 : shladdp4 r1 = r2, count, r3 A_SUB_I, // A03 : sub r1 = immv, r3 A_AND_I, // A03 : and r1 = immv, r3 A_ANDCM_I, // A03 : andcm r1 = immv, r3 A_OR_I, // A03 : or r1 = immv, r3 A_XOR_I, // A03 : xor r1 = immv, r3 A_ADDS_I, // A04 : adds r1 = immv, r3 A_ADDP4_I, // A04 : addp4 r1 = immv, r3 A_ADDL_I, // A05 : addl r1 = immv, r3 A_CMP_LT_RR, // A06 : cmp.lt p1, p2 = r2, r3 A_CMP_LTU_RR, // A06 : cmp.ltu p1, p2 = r2, r3 A_CMP_EQ_RR, // A06 : cmp.eq p1, p2 = r2, r3 A_CMP_LT_UNC_RR, // A06 : cmp.lt.unc p1, p2 = r2, r3 A_CMP_LTU_UNC_RR, // A06 : cmp.ltu.unc p1, p2 = r2, r3 A_CMP_EQ_UNC_RR, // A06 : cmp.eq.unc p1, p2 = r2, r3 A_CMP_EQ_AND_RR, // A06 : cmp.eq.and p1, p2 = r2, r3 A_CMP_EQ_OR_RR, // A06 : cmp.eq.or p1, p2 = r2, r3 A_CMP_EQ_OR_ANDCM_RR, // A06 : cmp.eq.or.andcm p1, p2 = r2, r3 A_CMP_NE_AND_RR, // A06 : cmp.ne.and p1, p2 = r2, r3 A_CMP_NE_OR_RR, // A06 : cmp.ne.or p1, p2 = r2, r3 A_CMP_NE_OR_ANDCM_RR, // A06 : cmp.ne.or.andcm p1, p2 = r2, r3 A_CMP4_LT_RR, // A06 : cmp4.lt p1, p2 = r2, r3 A_CMP4_LTU_RR, // A06 : cmp4.ltu p1, p2 = r2, r3 A_CMP4_EQ_RR, // A06 : cmp4.eq p1, p2 = r2, r3 A_CMP4_LT_UNC_RR, // A06 : cmp4.lt.unc p1, p2 = r2, r3 A_CMP4_LTU_UNC_RR, // A06 : cmp4.ltu.unc p1, p2 = r2, r3 A_CMP4_EQ_UNC_RR, // A06 : cmp4.eq.unc p1, p2 = r2, r3 A_CMP4_EQ_AND_RR, // A06 : cmp4.eq.and p1, p2 = r2, r3 A_CMP4_EQ_OR_RR, // A06 : cmp4.eq.or p1, p2 = r2, r3 A_CMP4_EQ_OR_ANDCM_RR, // A06 : cmp4.eq.or.andcm p1, p2 = r2, r3 A_CMP4_NE_AND_RR, // A06 : cmp4.ne.and p1, p2 = r2, r3 A_CMP4_NE_OR_RR, // A06 : cmp4.ne.or p1, p2 = r2, r3 A_CMP4_NE_OR_ANDCM_RR, // A06 : cmp4.ne.or.andcm p1, p2 = r2, r3 A_CMP_GT_AND_ZR, // A07 : cmp.gt.and p1, p2 = r0, r3 A_CMP_GT_OR_ZR, // A07 : cmp.gt.or p1, p2 = r0, r3 A_CMP_GT_OR_ANDCM_ZR, // A07 : cmp.gt.or.andcm p1, p2 = r0, r3 A_CMP_LE_AND_ZR, // A07 : cmp.le.and p1, p2 = r0, r3 A_CMP_LE_OR_ZR, // A07 : cmp.le.or p1, p2 = r0, r3 A_CMP_LE_OR_ANDCM_ZR, // A07 : cmp.le.or.andcm p1, p2 = r0, r3 A_CMP_GE_AND_ZR, // A07 : cmp.ge.and p1, p2 = r0, r3 A_CMP_GE_OR_ZR, // A07 : cmp.ge.or p1, p2 = r0, r3 A_CMP_GE_OR_ANDCM_ZR, // A07 : cmp.ge.or.andcm p1, p2 = r0, r3 A_CMP_LT_AND_ZR, // A07 : cmp.lt.and p1, p2 = r0, r3 A_CMP_LT_OR_ZR, // A07 : cmp.lt.or p1, p2 = r0, r3 A_CMP_LT_OR_ANDCM_ZR, // A07 : cmp.lt.or.andcm p1, p2 = r0, r3 A_CMP4_GT_AND_ZR, // A07 : cmp4.gt.and p1, p2 = r0, r3 A_CMP4_GT_OR_ZR, // A07 : cmp4.gt.or p1, p2 = r0, r3 A_CMP4_GT_OR_ANDCM_ZR, // A07 : cmp4.gt.or.andcm p1, p2 = r0, r3 A_CMP4_LE_AND_ZR, // A07 : cmp4.le.and p1, p2 = r0, r3 A_CMP4_LE_OR_ZR, // A07 : cmp4.le.or p1, p2 = r0, r3 A_CMP4_LE_OR_ANDCM_ZR, // A07 : cmp4.le.or.andcm p1, p2 = r0, r3 A_CMP4_GE_AND_ZR, // A07 : cmp4.ge.and p1, p2 = r0, r3 A_CMP4_GE_OR_ZR, // A07 : cmp4.ge.or p1, p2 = r0, r3 A_CMP4_GE_OR_ANDCM_ZR, // A07 : cmp4.ge.or.andcm p1, p2 = r0, r3 A_CMP4_LT_AND_ZR, // A07 : cmp4.lt.and p1, p2 = r0, r3 A_CMP4_LT_OR_ZR, // A07 : cmp4.lt.or p1, p2 = r0, r3 A_CMP4_LT_OR_ANDCM_ZR, // A07 : cmp4.lt.or.andcm p1, p2 = r0, r3 A_CMP_LT_IR, // A08 : cmp.lt p1, p2 = immv, r3 A_CMP_LTU_IR, // A08 : cmp.ltu p1, p2 = immv, r3 A_CMP_EQ_IR, // A08 : cmp.eq p1, p2 = immv, r3 A_CMP_LT_UNC_IR, // A08 : cmp.lt.unc p1, p2 = immv, r3 A_CMP_LTU_UNC_IR, // A08 : cmp.ltu.unc p1, p2 = immv, r3 A_CMP_EQ_UNC_IR, // A08 : cmp.eq.unc p1, p2 = immv, r3 A_CMP_EQ_AND_IR, // A08 : cmp.eq.and p1, p2 = immv, r3 A_CMP_EQ_OR_IR, // A08 : cmp.eq.or p1, p2 = immv, r3 A_CMP_EQ_OR_ANDCM_IR, // A08 : cmp.eq.or.andcm p1, p2 = immv, r3 A_CMP_NE_AND_IR, // A08 : cmp.ne.and p1, p2 = immv, r3 A_CMP_NE_OR_IR, // A08 : cmp.ne.or p1, p2 = immv, r3 A_CMP_NE_OR_ANDCM_IR, // A08 : cmp.ne.or.andcm p1, p2 = immv, r3 A_CMP4_LT_IR, // A08 : cmp4.lt p1, p2 = immv, r3 A_CMP4_LTU_IR, // A08 : cmp4.ltu p1, p2 = immv, r3 A_CMP4_EQ_IR, // A08 : cmp4.eq p1, p2 = immv, r3 A_CMP4_LT_UNC_IR, // A08 : cmp4.lt.unc p1, p2 = immv, r3 A_CMP4_LTU_UNC_IR, // A08 : cmp4.ltu.unc p1, p2 = immv, r3 A_CMP4_EQ_UNC_IR, // A08 : cmp4.eq.unc p1, p2 = immv, r3 A_CMP4_EQ_AND_IR, // A08 : cmp4.eq.and p1, p2 = immv, r3 A_CMP4_EQ_OR_IR, // A08 : cmp4.eq.or p1, p2 = immv, r3 A_CMP4_EQ_OR_ANDCM_IR, // A08 : cmp4.eq.or.andcm p1, p2 = immv, r3 A_CMP4_NE_AND_IR, // A08 : cmp4.ne.and p1, p2 = immv, r3 A_CMP4_NE_OR_IR, // A08 : cmp4.ne.or p1, p2 = immv, r3 A_CMP4_NE_OR_ANDCM_IR, // A08 : cmp4.ne.or.andcm p1, p2 = immv, r3 A_PADD1, // A09 : padd1 r1 = r2, r3 A_PADD2, // A09 : padd2 r1 = r2, r3 A_PADD4, // A09 : padd4 r1 = r2, r3 A_PADD1_SSS, // A09 : padd1.sss r1 = r2, r3 A_PADD2_SSS, // A09 : padd2.sss r1 = r2, r3 A_PADD1_UUU, // A09 : padd1.uuu r1 = r2, r3 A_PADD2_UUU, // A09 : padd2.uuu r1 = r2, r3 A_PADD1_UUS, // A09 : padd1.uus r1 = r2, r3 A_PADD2_UUS, // A09 : padd2.uus r1 = r2, r3 A_PSUB1, // A09 : psub1 r1 = r2, r3 A_PSUB2, // A09 : psub2 r1 = r2, r3 A_PSUB4, // A09 : psub4 r1 = r2, r3 A_PSUB1_SSS, // A09 : psub1.sss r1 = r2, r3 A_PSUB2_SSS, // A09 : psub2.sss r1 = r2, r3 A_PSUB1_UUU, // A09 : psub1.uuu r1 = r2, r3 A_PSUB2_UUU, // A09 : psub2.uuu r1 = r2, r3 A_PSUB1_UUS, // A09 : psub1.uus r1 = r2, r3 A_PSUB2_UUS, // A09 : psub2.uus r1 = r2, r3 A_PAVG1, // A09 : pavg1 r1 = r2, r3 A_PAVG2, // A09 : pavg2 r1 = r2, r3 A_PAVG1_RAZ, // A09 : pavg1.raz r1 = r2, r3 A_PAVG2_RAZ, // A09 : pavg2.raz r1 = r2, r3 A_PAVGSUB1, // A09 : pavgsub1 r1 = r2, r3 A_PAVGSUB2, // A09 : pavgsub2 r1 = r2, r3 A_PCMP1_EQ, // A09 : pcmp1.eq r1 = r2, r3 A_PCMP2_EQ, // A09 : pcmp2.eq r1 = r2, r3 A_PCMP4_EQ, // A09 : pcmp4.eq r1 = r2, r3 A_PCMP1_GT, // A09 : pcmp1.gt r1 = r2, r3 A_PCMP2_GT, // A09 : pcmp2.gt r1 = r2, r3 A_PCMP4_GT, // A09 : pcmp4.gt r1 = r2, r3 A_PSHLADD2, // A10 : pshladd2 r1 = r2, count2, r3 A_PSHRADD2, // A10 : pshradd2 r1 = r2, count2, r3 M_LD1, // M01 : ld1 r1 = [r3] M_LD2, // M01 : ld2 r1 = [r3] M_LD4, // M01 : ld4 r1 = [r3] M_LD8, // M01 : ld8 r1 = [r3] M_LD1_S, // M01 : ld1.s r1 = [r3] M_LD2_S, // M01 : ld2.s r1 = [r3] M_LD4_S, // M01 : ld4.s r1 = [r3] M_LD8_S, // M01 : ld8.s r1 = [r3] M_LD1_A, // M01 : ld1.a r1 = [r3] M_LD2_A, // M01 : ld2.a r1 = [r3] M_LD4_A, // M01 : ld4.a r1 = [r3] M_LD8_A, // M01 : ld8.a r1 = [r3] M_LD1_SA, // M01 : ld1.sa r1 = [r3] M_LD2_SA, // M01 : ld2.sa r1 = [r3] M_LD4_SA, // M01 : ld4.sa r1 = [r3] M_LD8_SA, // M01 : ld8.sa r1 = [r3] M_LD1_BIAS, // M01 : ld1.bias r1 = [r3] M_LD2_BIAS, // M01 : ld2.bias r1 = [r3] M_LD4_BIAS, // M01 : ld4.bias r1 = [r3] M_LD8_BIAS, // M01 : ld8.bias r1 = [r3] M_LD1_ACQ, // M01 : ld1.acq r1 = [r3] M_LD2_ACQ, // M01 : ld2.acq r1 = [r3] M_LD4_ACQ, // M01 : ld4.acq r1 = [r3] M_LD8_ACQ, // M01 : ld8.acq r1 = [r3] M_LD8_FILL, // M01 : ld8.fill r1 = [r3] M_LD1_C_CLR, // M01 : ld1.c.clr r1 = [r3] M_LD2_C_CLR, // M01 : ld2.c.clr r1 = [r3] M_LD4_C_CLR, // M01 : ld4.c.clr r1 = [r3] M_LD8_C_CLR, // M01 : ld8.c.clr r1 = [r3] M_LD1_C_NC, // M01 : ld1.c.nc r1 = [r3] M_LD2_C_NC, // M01 : ld2.c.nc r1 = [r3] M_LD4_C_NC, // M01 : ld4.c.nc r1 = [r3] M_LD8_C_NC, // M01 : ld8.c.nc r1 = [r3] M_LD1_C_CLR_ACQ, // M01 : ld1.c.clr.acq r1 = [r3] M_LD2_C_CLR_ACQ, // M01 : ld2.c.clr.acq r1 = [r3] M_LD4_C_CLR_ACQ, // M01 : ld4.c.clr.acq r1 = [r3] M_LD8_C_CLR_ACQ, // M01 : ld8.c.clr.acq r1 = [r3] M_LD1_UPD_R, // M02 : ld1 r1 = [r3], r2 M_LD2_UPD_R, // M02 : ld2 r1 = [r3], r2 M_LD4_UPD_R, // M02 : ld4 r1 = [r3], r2 M_LD8_UPD_R, // M02 : ld8 r1 = [r3], r2 M_LD1_S_UPD_R, // M02 : ld1.s r1 = [r3], r2 M_LD2_S_UPD_R, // M02 : ld2.s r1 = [r3], r2 M_LD4_S_UPD_R, // M02 : ld4.s r1 = [r3], r2 M_LD8_S_UPD_R, // M02 : ld8.s r1 = [r3], r2 M_LD1_A_UPD_R, // M02 : ld1.a r1 = [r3], r2 M_LD2_A_UPD_R, // M02 : ld2.a r1 = [r3], r2 M_LD4_A_UPD_R, // M02 : ld4.a r1 = [r3], r2 M_LD8_A_UPD_R, // M02 : ld8.a r1 = [r3], r2 M_LD1_SA_UPD_R, // M02 : ld1.sa r1 = [r3], r2 M_LD2_SA_UPD_R, // M02 : ld2.sa r1 = [r3], r2 M_LD4_SA_UPD_R, // M02 : ld4.sa r1 = [r3], r2 M_LD8_SA_UPD_R, // M02 : ld8.sa r1 = [r3], r2 M_LD1_BIAS_UPD_R, // M02 : ld1.bias r1 = [r3], r2 M_LD2_BIAS_UPD_R, // M02 : ld2.bias r1 = [r3], r2 M_LD4_BIAS_UPD_R, // M02 : ld4.bias r1 = [r3], r2 M_LD8_BIAS_UPD_R, // M02 : ld8.bias r1 = [r3], r2 M_LD1_ACQ_UPD_R, // M02 : ld1.acq r1 = [r3], r2 M_LD2_ACQ_UPD_R, // M02 : ld2.acq r1 = [r3], r2 M_LD4_ACQ_UPD_R, // M02 : ld4.acq r1 = [r3], r2 M_LD8_ACQ_UPD_R, // M02 : ld8.acq r1 = [r3], r2 M_LD8_FILL_UPD_R, // M02 : ld8.fill r1 = [r3], r2 M_LD1_C_CLR_UPD_R, // M02 : ld1.c.clr r1 = [r3], r2 M_LD2_C_CLR_UPD_R, // M02 : ld2.c.clr r1 = [r3], r2 M_LD4_C_CLR_UPD_R, // M02 : ld4.c.clr r1 = [r3], r2 M_LD8_C_CLR_UPD_R, // M02 : ld8.c.clr r1 = [r3], r2 M_LD1_C_NC_UPD_R, // M02 : ld1.c.nc r1 = [r3], r2 M_LD2_C_NC_UPD_R, // M02 : ld2.c.nc r1 = [r3], r2 M_LD4_C_NC_UPD_R, // M02 : ld4.c.nc r1 = [r3], r2 M_LD8_C_NC_UPD_R, // M02 : ld8.c.nc r1 = [r3], r2 M_LD1_C_CLR_ACQ_UPD_R, // M02 : ld1.c.clr.acq r1 = [r3], r2 M_LD2_C_CLR_ACQ_UPD_R, // M02 : ld2.c.clr.acq r1 = [r3], r2 M_LD4_C_CLR_ACQ_UPD_R, // M02 : ld4.c.clr.acq r1 = [r3], r2 M_LD8_C_CLR_ACQ_UPD_R, // M02 : ld8.c.clr.acq r1 = [r3], r2 M_LD1_UPD_I, // M03 : ld1 r1 = [r3], imm9 M_LD2_UPD_I, // M03 : ld2 r1 = [r3], imm9 M_LD4_UPD_I, // M03 : ld4 r1 = [r3], imm9 M_LD8_UPD_I, // M03 : ld8 r1 = [r3], imm9 M_LD1_S_UPD_I, // M03 : ld1.s r1 = [r3], imm9 M_LD2_S_UPD_I, // M03 : ld2.s r1 = [r3], imm9 M_LD4_S_UPD_I, // M03 : ld4.s r1 = [r3], imm9 M_LD8_S_UPD_I, // M03 : ld8.s r1 = [r3], imm9 M_LD1_A_UPD_I, // M03 : ld1.a r1 = [r3], imm9 M_LD2_A_UPD_I, // M03 : ld2.a r1 = [r3], imm9 M_LD4_A_UPD_I, // M03 : ld4.a r1 = [r3], imm9 M_LD8_A_UPD_I, // M03 : ld8.a r1 = [r3], imm9 M_LD1_SA_UPD_I, // M03 : ld1.sa r1 = [r3], imm9 M_LD2_SA_UPD_I, // M03 : ld2.sa r1 = [r3], imm9 M_LD4_SA_UPD_I, // M03 : ld4.sa r1 = [r3], imm9 M_LD8_SA_UPD_I, // M03 : ld8.sa r1 = [r3], imm9 M_LD1_BIAS_UPD_I, // M03 : ld1.bias r1 = [r3], imm9 M_LD2_BIAS_UPD_I, // M03 : ld2.bias r1 = [r3], imm9 M_LD4_BIAS_UPD_I, // M03 : ld4.bias r1 = [r3], imm9 M_LD8_BIAS_UPD_I, // M03 : ld8.bias r1 = [r3], imm9 M_LD1_ACQ_UPD_I, // M03 : ld1.acq r1 = [r3], imm9 M_LD2_ACQ_UPD_I, // M03 : ld2.acq r1 = [r3], imm9 M_LD4_ACQ_UPD_I, // M03 : ld4.acq r1 = [r3], imm9 M_LD8_ACQ_UPD_I, // M03 : ld8.acq r1 = [r3], imm9 M_LD8_FILL_UPD_I, // M03 : ld8.fill r1 = [r3], imm9 M_LD1_C_CLR_UPD_I, // M03 : ld1.c.clr r1 = [r3], imm9 M_LD2_C_CLR_UPD_I, // M03 : ld2.c.clr r1 = [r3], imm9 M_LD4_C_CLR_UPD_I, // M03 : ld4.c.clr r1 = [r3], imm9 M_LD8_C_CLR_UPD_I, // M03 : ld8.c.clr r1 = [r3], imm9 M_LD1_C_NC_UPD_I, // M03 : ld1.c.nc r1 = [r3], imm9 M_LD2_C_NC_UPD_I, // M03 : ld2.c.nc r1 = [r3], imm9 M_LD4_C_NC_UPD_I, // M03 : ld4.c.nc r1 = [r3], imm9 M_LD8_C_NC_UPD_I, // M03 : ld8.c.nc r1 = [r3], imm9 M_LD1_C_CLR_ACQ_UPD_I, // M03 : ld1.c.clr.acq r1 = [r3], imm9 M_LD2_C_CLR_ACQ_UPD_I, // M03 : ld2.c.clr.acq r1 = [r3], imm9 M_LD4_C_CLR_ACQ_UPD_I, // M03 : ld4.c.clr.acq r1 = [r3], imm9 M_LD8_C_CLR_ACQ_UPD_I, // M03 : ld8.c.clr.acq r1 = [r3], imm9 M_ST1, // M04 : st1 [r3] = r1 M_ST2, // M04 : st2 [r3] = r1 M_ST4, // M04 : st4 [r3] = r1 M_ST8, // M04 : st8 [r3] = r1 M_ST1_REL, // M04 : st1.rel [r3] = r1 M_ST2_REL, // M04 : st2.rel [r3] = r1 M_ST4_REL, // M04 : st4.rel [r3] = r1 M_ST8_REL, // M04 : st8.rel [r3] = r1 M_ST8_SPILL, // M04 : st8.spill [r3] = r1 M_ST1_UPD_I, // M05 : st1 [r3] = r1, imm9 M_ST2_UPD_I, // M05 : st2 [r3] = r1, imm9 M_ST4_UPD_I, // M05 : st4 [r3] = r1, imm9 M_ST8_UPD_I, // M05 : st8 [r3] = r1, imm9 M_ST1_REL_UPD_I, // M05 : st1.rel [r3] = r1, imm9 M_ST2_REL_UPD_I, // M05 : st2.rel [r3] = r1, imm9 M_ST4_REL_UPD_I, // M05 : st4.rel [r3] = r1, imm9 M_ST8_REL_UPD_I, // M05 : st8.rel [r3] = r1, imm9 M_ST8_SPILL_UPD_I, // M05 : st8.spill [r3] = r1, imm9 M_LDFS, // M06 : ldfs f1 = [r3] M_LDFD, // M06 : ldfd f1 = [r3] M_LDF8, // M06 : ldf8 f1 = [r3] M_LDFE, // M06 : ldfe f1 = [r3] M_LDFS_S, // M06 : ldfs.s f1 = [r3] M_LDFD_S, // M06 : ldfd.s f1 = [r3] M_LDF8_S, // M06 : ldf8.s f1 = [r3] M_LDFE_S, // M06 : ldfe.s f1 = [r3] M_LDFS_A, // M06 : ldfs.a f1 = [r3] M_LDFD_A, // M06 : ldfd.a f1 = [r3] M_LDF8_A, // M06 : ldf8.a f1 = [r3] M_LDFE_A, // M06 : ldfe.a f1 = [r3] M_LDFS_SA, // M06 : ldfs.sa f1 = [r3] M_LDFD_SA, // M06 : ldfd.sa f1 = [r3] M_LDF8_SA, // M06 : ldf8.sa f1 = [r3] M_LDFE_SA, // M06 : ldfe.sa f1 = [r3] M_LDF_FILL, // M06 : ldf.fill f1 = [r3] M_LDFS_C_CLR, // M06 : ldfs.c.clr f1 = [r3] M_LDFD_C_CLR, // M06 : ldfd.c.clr f1 = [r3] M_LDF8_C_CLR, // M06 : ldf8.c.clr f1 = [r3] M_LDFE_C_CLR, // M06 : ldfe.c.clr f1 = [r3] M_LDFS_C_NC, // M06 : ldfs.c.nc f1 = [r3] M_LDFD_C_NC, // M06 : ldfd.c.nc f1 = [r3] M_LDF8_C_NC, // M06 : ldf8.c.nc f1 = [r3] M_LDFE_C_NC, // M06 : ldfe.c.nc f1 = [r3] M_LDFS_UPD_R, // M07 : ldfs f1 = [r3], r2 M_LDFD_UPD_R, // M07 : ldfd f1 = [r3], r2 M_LDF8_UPD_R, // M07 : ldf8 f1 = [r3], r2 M_LDFE_UPD_R, // M07 : ldfe f1 = [r3], r2 M_LDFS_S_UPD_R, // M07 : ldfs.s f1 = [r3], r2 M_LDFD_S_UPD_R, // M07 : ldfd.s f1 = [r3], r2 M_LDF8_S_UPD_R, // M07 : ldf8.s f1 = [r3], r2 M_LDFE_S_UPD_R, // M07 : ldfe.s f1 = [r3], r2 M_LDFS_A_UPD_R, // M07 : ldfs.a f1 = [r3], r2 M_LDFD_A_UPD_R, // M07 : ldfd.a f1 = [r3], r2 M_LDF8_A_UPD_R, // M07 : ldf8.a f1 = [r3], r2 M_LDFE_A_UPD_R, // M07 : ldfe.a f1 = [r3], r2 M_LDFS_SA_UPD_R, // M07 : ldfs.sa f1 = [r3], r2 M_LDFD_SA_UPD_R, // M07 : ldfd.sa f1 = [r3], r2 M_LDF8_SA_UPD_R, // M07 : ldf8.sa f1 = [r3], r2 M_LDFE_SA_UPD_R, // M07 : ldfe.sa f1 = [r3], r2 M_LDF_FILL_UPD_R, // M07 : ldf.fill f1 = [r3], r2 M_LDFS_C_CLR_UPD_R, // M07 : ldfs.c.clr f1 = [r3], r2 M_LDFD_C_CLR_UPD_R, // M07 : ldfd.c.clr f1 = [r3], r2 M_LDF8_C_CLR_UPD_R, // M07 : ldf8.c.clr f1 = [r3], r2 M_LDFE_C_CLR_UPD_R, // M07 : ldfe.c.clr f1 = [r3], r2 M_LDFS_C_NC_UPD_R, // M07 : ldfs.c.nc f1 = [r3], r2 M_LDFD_C_NC_UPD_R, // M07 : ldfd.c.nc f1 = [r3], r2 M_LDF8_C_NC_UPD_R, // M07 : ldf8.c.nc f1 = [r3], r2 M_LDFE_C_NC_UPD_R, // M07 : ldfe.c.nc f1 = [r3], r2 M_LDFS_UPD_I, // M08 : ldfs f1 = [r3], imm9 M_LDFD_UPD_I, // M08 : ldfd f1 = [r3], imm9 M_LDF8_UPD_I, // M08 : ldf8 f1 = [r3], imm9 M_LDFE_UPD_I, // M08 : ldfe f1 = [r3], imm9 M_LDFS_S_UPD_I, // M08 : ldfs.s f1 = [r3], imm9 M_LDFD_S_UPD_I, // M08 : ldfd.s f1 = [r3], imm9 M_LDF8_S_UPD_I, // M08 : ldf8.s f1 = [r3], imm9 M_LDFE_S_UPD_I, // M08 : ldfe.s f1 = [r3], imm9 M_LDFS_A_UPD_I, // M08 : ldfs.a f1 = [r3], imm9 M_LDFD_A_UPD_I, // M08 : ldfd.a f1 = [r3], imm9 M_LDF8_A_UPD_I, // M08 : ldf8.a f1 = [r3], imm9 M_LDFE_A_UPD_I, // M08 : ldfe.a f1 = [r3], imm9 M_LDFS_SA_UPD_I, // M08 : ldfs.sa f1 = [r3], imm9 M_LDFD_SA_UPD_I, // M08 : ldfd.sa f1 = [r3], imm9 M_LDF8_SA_UPD_I, // M08 : ldf8.sa f1 = [r3], imm9 M_LDFE_SA_UPD_I, // M08 : ldfe.sa f1 = [r3], imm9 M_LDF_FILL_UPD_I, // M08 : ldf.fill f1 = [r3], imm9 M_LDFS_C_CLR_UPD_I, // M08 : ldfs.c.clr f1 = [r3], imm9 M_LDFD_C_CLR_UPD_I, // M08 : ldfd.c.clr f1 = [r3], imm9 M_LDF8_C_CLR_UPD_I, // M08 : ldf8.c.clr f1 = [r3], imm9 M_LDFE_C_CLR_UPD_I, // M08 : ldfe.c.clr f1 = [r3], imm9 M_LDFS_C_NC_UPD_I, // M08 : ldfs.c.nc f1 = [r3], imm9 M_LDFD_C_NC_UPD_I, // M08 : ldfd.c.nc f1 = [r3], imm9 M_LDF8_C_NC_UPD_I, // M08 : ldf8.c.nc f1 = [r3], imm9 M_LDFE_C_NC_UPD_I, // M08 : ldfe.c.nc f1 = [r3], imm9 M_STFS, // M09 : stfs [r3] = f2 M_STFD, // M09 : stfd [r3] = f2 M_STF8, // M09 : stf8 [r3] = f2 M_STFE, // M09 : stfe [r3] = f2 M_STF_SPILL, // M09 : stf.fill [r3] = f2 M_STFS_UPD_I, // M10 : stfs [r3] = f2, imm9 M_STFD_UPD_I, // M10 : stfd [r3] = f2, imm9 M_STF8_UPD_I, // M10 : stf8 [r3] = f2, imm9 M_STFE_UPD_I, // M10 : stfe [r3] = f2, imm9 M_STF_SPILL_UPD_I, // M10 : stf.fill [r3] = f2, imm9 M_LDFPS, // M11 : ldfps f1, f2 = [r3] M_LDFPD, // M11 : ldfpd f1, f2 = [r3] M_LDFP8, // M11 : ldfp8 f1, f2 = [r3] M_LDFPS_S, // M11 : ldfps.s f1, f2 = [r3] M_LDFPD_S, // M11 : ldfpd.s f1, f2 = [r3] M_LDFP8_S, // M11 : ldfp8.s f1, f2 = [r3] M_LDFPS_A, // M11 : ldfps.a f1, f2 = [r3] M_LDFPD_A, // M11 : ldfpd.a f1, f2 = [r3] M_LDFP8_A, // M11 : ldfp8.a f1, f2 = [r3] M_LDFPS_SA, // M11 : ldfps.sa f1, f2 = [r3] M_LDFPD_SA, // M11 : ldfpd.sa f1, f2 = [r3] M_LDFP8_SA, // M11 : ldfp8.sa f1, f2 = [r3] M_LDFPS_C_CLR, // M11 : ldfps.c.clr f1, f2 = [r3] M_LDFPD_C_CLR, // M11 : ldfpd.c.clr f1, f2 = [r3] M_LDFP8_C_CLR, // M11 : ldfp8.c.clr f1, f2 = [r3] M_LDFPS_C_NC, // M11 : ldfps.c.nc f1, f2 = [r3] M_LDFPD_C_NC, // M11 : ldfpd.c.nc f1, f2 = [r3] M_LDFP8_C_NC, // M11 : ldfp8.c.nc f1, f2 = [r3] M_LDFPS_UPD, // M12 : ldfps f1, f2 = [r3], 8 M_LDFPD_UPD, // M12 : ldfpd f1, f2 = [r3], 16 M_LDFP8_UPD, // M12 : ldfp8 f1, f2 = [r3], 16 M_LDFPS_S_UPD, // M12 : ldfps.s f1, f2 = [r3], 8 M_LDFPD_S_UPD, // M12 : ldfpd.s f1, f2 = [r3], 16 M_LDFP8_S_UPD, // M12 : ldfp8.s f1, f2 = [r3], 16 M_LDFPS_A_UPD, // M12 : ldfps.a f1, f2 = [r3], 8 M_LDFPD_A_UPD, // M12 : ldfpd.a f1, f2 = [r3], 16 M_LDFP8_A_UPD, // M12 : ldfp8.a f1, f2 = [r3], 16 M_LDFPS_SA_UPD, // M12 : ldfps.sa f1, f2 = [r3], 8 M_LDFPD_SA_UPD, // M12 : ldfpd.sa f1, f2 = [r3], 16 M_LDFP8_SA_UPD, // M12 : ldfp8.sa f1, f2 = [r3], 16 M_LDFPS_C_CLR_UPD, // M12 : ldfps.c.clr f1, f2 = [r3], 8 M_LDFPD_C_CLR_UPD, // M12 : ldfpd.c.clr f1, f2 = [r3], 16 M_LDFP8_C_CLR_UPD, // M12 : ldfp8.c.clr f1, f2 = [r3], 16 M_LDFPS_C_NC_UPD, // M12 : ldfps.c.nc f1, f2 = [r3], 8 M_LDFPD_C_NC_UPD, // M12 : ldfpd.c.nc f1, f2 = [r3], 16 M_LDFP8_C_NC_UPD, // M12 : ldfp8.c.nc f1, f2 = [r3], 16 M_LFETCH, // M13 : lfetch [r3] M_LFETCH_EXCL, // M13 : lfetch.excl [r3] M_LFETCH_FAULT, // M13 : lfetch.fault [r3] M_LFETCH_FAULT_EXCL, // M13 : lfetch.fault.excl [r3] M_LFETCH_UPD_R, // M14 : lfetch [r3],r2 M_LFETCH_EXCL_UPD_R, // M14 : lfetch.excl [r3],r2 M_LFETCH_FAULT_UPD_R, // M14 : lfetch.fault [r3],r2 M_LFETCH_FAULT_EXCL_UPD_R, // M14 : lfetch.fault.excl [r3],r2 M_LFETCH_UPD_I, // M15 : lfetch [r3],imm9 M_LFETCH_EXCL_UPD_I, // M15 : lfetch.excl [r3],imm9 M_LFETCH_FAULT_UPD_I, // M15 : lfetch.fault [r3],imm9 M_LFETCH_FAULT_EXCL_UPD_I, // M15 : lfetch.fault.excl [r3],imm9 M_CMPXCHG1_ACQ, // M16 : cmpxchg1.acq r1 = [r3], r2, ar.ccv M_CMPXCHG2_ACQ, // M16 : cmpxchg2.acq r1 = [r3], r2, ar.ccv M_CMPXCHG4_ACQ, // M16 : cmpxchg4.acq r1 = [r3], r2, ar.ccv M_CMPXCHG8_ACQ, // M16 : cmpxchg8.acq r1 = [r3], r2, ar.ccv M_CMPXCHG1_REL, // M16 : cmpxchg1.rel r1 = [r3], r2, ar.ccv M_CMPXCHG2_REL, // M16 : cmpxchg2.rel r1 = [r3], r2, ar.ccv M_CMPXCHG4_REL, // M16 : cmpxchg4.rel r1 = [r3], r2, ar.ccv M_CMPXCHG8_REL, // M16 : cmpxchg8.rel r1 = [r3], r2, ar.ccv M_XCHG1, // M16 : xchg1 r1 = [r3], r2 M_XCHG2, // M16 : xchg2 r1 = [r3], r2 M_XCHG4, // M16 : xchg4 r1 = [r3], r2 M_XCHG8, // M16 : xchg8 r1 = [r3], r2 M_FETCHADD4_ACQ, // M17 : fetchadd4.acq r1 = [r3], inc3 M_FETCHADD8_ACQ, // M17 : fetchadd8.acq r1 = [r3], inc3 M_FETCHADD4_REL, // M17 : fetchadd4.rel r1 = [r3], inc3 M_FETCHADD8_REL, // M17 : fetchadd8.rel r1 = [r3], inc3 M_SETF_SIG, // M18 : setf.sig f1 = r2 M_SETF_EXP, // M18 : setf.exp f1 = r2 M_SETF_S, // M18 : setf.s f1 = r2 M_SETF_D, // M18 : setf.d f1 = r2 M_GETF_SIG, // M19 : getf.sig r1 = f2 M_GETF_EXP, // M19 : getf.exp r1 = f2 M_GETF_S, // M19 : getf.s r1 = f2 M_GETF_D, // M19 : getf.d r1 = f2 M_CHK_S_M, // M20 : chk.s.m r2, target25 M_CHK_S, // M21 : chk.s f2, target25 M_CHK_A_NC_I, // M22 : chk.a.nc r1, target25 M_CHK_A_CLR_I, // M22 : chk.a.clr r1, target25 M_CHK_A_NC_F, // M23 : chk.a.nc f1, target25 M_CHK_A_CLR_F, // M23 : chk.a.clr f1, target25 M_INVALA, // M24 : invala M_FWB, // M24 : fwb M_MF, // M24 : mf M_MF_A, // M24 : mf.a M_SRLZ_D, // M24 : srlz.d M_SRLZ_I, // M24 : srlz.i M_SYNC_I, // M24 : sync.i M_FLUSHRS, // M25 : flushrs M_LOADRS, // M25 : loadrs M_INVALA_E, // M26 : invala.e r1 M_INVALA_E_F, // M27 : invala.e f1 M_FC, // M28 : fc r3 M_PTC_E, // M28 : ptc.e r3 M_MOV_TO_AR_R, // M29 : mov.m ar3 = r2 M_MOV_TO_AR_I, // M30 : mov.m ar3 = imm8 M_MOV_FROM_AR, // M31 : mov.m r1 = ar3 M_MOV_TO_CR, // M32 : mov cr2 = r1 M_MOV_FROM_CR, // M33 : mov r1 = cr3 M_ALLOC, // M34 : alloc r1 = ar.pfs, i,l,o,r M_MOV_TO_PSR_L, // M35 : mov psr.l = r2 M_MOV_TO_PSR_UM, // M35 : mov psr.um = r2 M_MOV_FROM_PSR, // M36 : mov r1 = psr M_MOV_FROM_PSR_UM, // M36 : mov r1 = psr.um M_BREAK, // M37 : break.m immv M_NOP, // M37 : nop.m immv M_PROBE_R_R, // M38 : probe.r r1 = r3, r2 M_PROBE_W_R, // M38 : probe.w r1 = r3, r2 M_PROBE_R_I, // M39 : probe.r r1 = r3, imm2 M_PROBE_W_I, // M39 : probe.w r1 = r3, imm2 M_PROBE_RW_FAULT, // M40 : probe.rw.fault r3, imm2 M_PROBE_R_FAULT, // M40 : probe.r.fault r3, imm2 M_PROBE_W_FAULT, // M40 : probe.w.fault r3, imm2 M_ITC_D, // M41 : itc.d r2 M_ITC_I, // M41 : itc.i r2 M_MOV_TO_IR, // M42 : mov ind[r3] = r2 M_ITR_D, // M43 : itr.d ind[r3] = r2 M_ITR_C, // M43 : itr.i ind[r3] = r2 M_MOV_FROM_IR, // M43 : mov r1 = ind[r3] M_SUM, // M44 : sum imm24 M_RUM, // M44 : rum imm24 M_SSM, // M44 : ssm imm24 M_RSM, // M44 : rsm imm24 M_PTC_L, // M45 : ptc.l r3, r2 M_PTC_G, // M45 : ptc.g r3, r2 M_PTC_GA, // M45 : ptc.ga r3, r2 M_PTR_D, // M45 : ptr.d r3, r2 M_PTR_I, // M45 : ptr.i r3, r2 M_THASH, // M46 : thash r1 = r3 M_TTAG, // M46 : ttag r1 = r3 M_TPA, // M46 : tpa r1 = r3 M_TAK, // M46 : tak r1 = r3 I_PMPYSHR2, // I01 : pmpyshr2 r1 = r2, r3, count2 I_PMPYSHR2_U, // I01 : pmpyshr2.u r1 = r2, r3, count2 I_PMPY2_R, // I02 : pmpy2.r r1 = r2, r3 I_PMPY2_L, // I02 : pmpy2.l r1 = r2, r3 I_MIX1_R, // I02 : mix1.r r1 = r2, r3 I_MIX2_R, // I02 : mix2.r r1 = r2, r3 I_MIX4_R, // I02 : mix4.r r1 = r2, r3 I_MIX1_L, // I02 : mix1.l r1 = r2, r3 I_MIX2_L, // I02 : mix2.l r1 = r2, r3 I_MIX4_L, // I02 : mix4.l r1 = r2, r3 I_PACK2_USS, // I02 : pack2.uss r1 = r2, r3 I_PACK2_SSS, // I02 : pack2.sss r1 = r2, r3 I_PACK4_SSS, // I02 : pack4.sss r1 = r2, r3 I_UNPACK1_H, // I02 : unpack1.h r1 = r2, r3 I_UNPACK2_H, // I02 : unpack2.h r1 = r2, r3 I_UNPACK4_H, // I02 : unpack4.h r1 = r2, r3 I_UNPACK1_L, // I02 : unpack1.l r1 = r2, r3 I_UNPACK2_L, // I02 : unpack2.l r1 = r2, r3 I_UNPACK4_L, // I02 : unpack4.l r1 = r2, r3 I_PMIN1_U, // I02 : pmin1.u r1 = r2, r3 I_PMAX1_U, // I02 : pmax1.u r1 = r2, r3 I_PMIN2, // I02 : pmin2 r1 = r2, r3 I_PMAX2, // I02 : pmax2 r1 = r2, r3 I_PSAD1, // I02 : psad1 r1 = r2, r3 I_MUX1, // I03 : mux1 r1 = r2, mbtype4 I_MUX2, // I04 : mux2 r1 = r2, mbtype8 I_PSHR2, // I05 : pshr2 r1 = r3, r2 I_PSHR4, // I05 : pshr4 r1 = r3, r2 I_SHR, // I05 : shr r1 = r3, r2 I_PSHR2_U, // I05 : pshr2.u r1 = r3, r2 I_PSHR4_U, // I05 : pshr4.u r1 = r3, r2 I_SHR_U, // I05 : shr.u r1 = r3, r2 I_PSHR2_I, // I06 : pshr2 r1 = r3, count5 I_PSHR4_I, // I06 : pshr4 r1 = r3, count5 I_PSHR2_U_I, // I06 : pshr2.u r1 = r3, count5 I_PSHR4_U_I, // I06 : pshr4.u r1 = r3, count5 I_PSHL2, // I07 : pshl2 r1 = r2, r3 I_PSHL4, // I07 : pshl4 r1 = r2, r3 I_SHL, // I07 : shl r1 = r2, r3 I_PSHL2_I, // I08 : pshl2 r1 = r2, count5 I_PSHL4_I, // I08 : pshl4 r1 = r2, count5 I_POPCNT, // I09 : popcnt r1 = r3 I_SHRP, // I10 : shrp r1 = r2, r3, count6 I_EXTR, // I11 : extr r1 = r3, pos6, len6 I_EXTR_U, // I11 : extr.u r1 = r3, pos6, len6 I_DEP_Z, // I12 : dep.z r1 = r2, pos6, len6 I_DEP_Z_I, // I13 : dep.z r1 = imm8, pos6, len6 I_DEP_I, // I14 : dep r1 = imm1,r3,pos6,len6 I_DEP, // I15 : dep r1 = r2, r3, pos6,len4 I_TBIT_Z, // I16 : tbit.z p1, p2 = r3, pos6 I_TBIT_Z_UNC, // I16 : tbit.z.unc p1, p2 = r3, pos6 I_TBIT_Z_AND, // I16 : tbit.z.and p1, p2 = r3, pos6 I_TBIT_NZ_AND, // I16 : tbit.nz.and p1, p2 = r3, pos6 I_TBIT_Z_OR, // I16 : tbit.z.or p1, p2 = r3, pos6 I_TBIT_NZ_OR, // I16 : tbit.nz.or p1, p2 = r3, pos6 I_TBIT_Z_OR_ANDCM, // I16 : tbit.z.or.andcm p1, p2 = r3, pos6 I_TBIT_NZ_OR_ANDCM, // I16 : tbit.nz.or.andcm p1, p2 = r3, pos6 I_TNAT_Z, // I17 : tnat.z p1, p2 = r3 I_TNAT_Z_UNC, // I17 : tnat.z.unc p1, p2 = r3 I_TNAT_Z_AND, // I17 : tnat.z.and p1, p2 = r3 I_TNAT_NZ_AND, // I17 : tnat.nz.and p1, p2 = r3 I_TNAT_Z_OR, // I17 : tnat.z.or p1, p2 = r3 I_TNAT_NZ_OR, // I17 : tnat.nz.or p1, p2 = r3 I_TNAT_Z_OR_ANDCM, // I17 : tnat.z.or.andcm p1, p2 = r3 I_TNAT_NZ_OR_ANDCM, // I17 : tnat.nz.or.andcm p1, p2 = r3 I_BREAK, // I19 : break.i immv I_NOP, // I19 : nop.i immv I_CHK_S_I, // I20 : chk.s.i r2, target25 I_MOV_TO_B, // I21 : mov b1 = r2, tag13 I_MOV_RET_TO_B, // I21 : mov.ret b1 = r2, tag13 I_MOV_FROM_B, // I22 : mov r1 = b2 I_MOV_TO_PR, // I23 : mov pr = r2, mask17 I_MOV_TO_PR_ROT, // I24 : mov pr.rot = imm44 I_MOV_FROM_IP, // I25 : mov r1 = ip I_MOV_FROM_PR, // I25 : mov r1 = pr I_MOV_TO_AR_R, // I26 : mov.i ar3 = r2 I_MOV_TO_AR_I, // I27 : mov.i ar3 = imm8 I_MOV_FROM_AR, // I28 : mov.i r1 = ar3 I_ZXT1, // I29 : zxt1 r1 = r3 I_ZXT2, // I29 : zxt2 r1 = r3 I_ZXT4, // I29 : zxt4 r1 = r3 I_SXT1, // I29 : sxt1 r1 = r3 I_SXT2, // I29 : sxt2 r1 = r3 I_SXT4, // I29 : sxt4 r1 = r3 I_CZX1_L, // I29 : czx1.l r1 = r3 I_CZX2_L, // I29 : czx2.l r1 = r3 I_CZX1_R, // I29 : czx1.r r1 = r3 I_CZX2_R, // I29 : czx2.r r1 = r3 F_FMA, // F01 : fma f1 = f3, f4, f2 F_FMA_S, // F01 : fma.s f1 = f3, f4, f2 F_FMA_D, // F01 : fma.d f1 = f3, f4, f2 F_FPMA, // F01 : fpma f1 = f3, f4, f2 F_FMS, // F01 : fms f1 = f3, f4, f2 F_FMS_S, // F01 : fms.s f1 = f3, f4, f2 F_FMS_D, // F01 : fms.d f1 = f3, f4, f2 F_FPMS, // F01 : fpms f1 = f3, f4, f2 F_FNMA, // F01 : fnma f1 = f3, f4, f2 F_FNMA_S, // F01 : fnma.s f1 = f3, f4, f2 F_FNMA_D, // F01 : fnma.d f1 = f3, f4, f2 F_FPNMA, // F01 : fpnma f1 = f3, f4, f2 F_XMA_L, // F02 : xma.l f1 = f3, f4, f2 F_XMA_H, // F02 : xma.h f1 = f3, f4, f2 F_XMA_HU, // F02 : xma.hu f1 = f3, f4, f2 F_FSELECT, // F03 : fselect f1 = f3, f4, f2 F_FCMP_EQ, // F04 : fcmp.eq p1, p2 = f2, f3 F_FCMP_LT, // F04 : fcmp.lt p1, p2 = f2, f3 F_FCMP_LE, // F04 : fcmp.le p1, p2 = f2, f3 F_FCMP_UNORD, // F04 : fcmp.unord p1, p2 = f2, f3 F_FCMP_EQ_UNC, // F04 : fcmp.eq_unc p1, p2 = f2, f3 F_FCMP_LT_UNC, // F04 : fcmp.lt_unc p1, p2 = f2, f3 F_FCMP_LE_UNC, // F04 : fcmp.le_unc p1, p2 = f2, f3 F_FCMP_UNORD_UNC, // F04 : fcmp.unord_unc p1, p2 = f2, f3 F_FCLASS_M, // F05 : fclass.m p1, p2 = f2, fclass9 F_FCLASS_M_UNC, // F05 : fclass.m.unc p1, p2 = f2, fclass9 F_FRCPA, // F06 : frcpa f1, p2 = f2, f3 F_FRSQRTA, // F07 : frsqrta f1, p2 = f3 F_FPRSQRTA, // F07 : fprsqrta f1, p2 = f3 F_FMIN, // F08 : fmin f1 = f2, f3 F_FMAX, // F08 : fmax f1 = f2, f3 F_FAMIN, // F08 : famin f1 = f2, f3 F_FAMAX, // F08 : famax f1 = f2, f3 F_FPMIN, // F08 : fpmin f1 = f2, f3 F_FPMAX, // F08 : fpmax f1 = f2, f3 F_FPAMIN, // F08 : fpamin f1 = f2, f3 F_FPAMAX, // F08 : fpamax f1 = f2, f3 F_FPCMP_EQ, // F08 : fpcmp.eq f1 = f2, f3 F_FPCMP_LT, // F08 : fpcmp.lt f1 = f2, f3 F_FPCMP_LE, // F08 : fpcmp.le f1 = f2, f3 F_FPCMP_UNORD, // F08 : fpcmp.unord f1 = f2, f3 F_FPCMP_NEQ, // F08 : fpcmp.neq f1 = f2, f3 F_FPCMP_NLT, // F08 : fpcmp.nlt f1 = f2, f3 F_FPCMP_NLE, // F08 : fpcmp.nle f1 = f2, f3 F_FPCMP_ORD, // F08 : fpcmp.ord f1 = f2, f3 F_FMERGE_S, // F09 : fmerge.s f1 = f2, f3 F_FMERGE_NS, // F09 : fmerge.ns f1 = f2, f3 F_FMERGE_SE, // F09 : fmerge.se f1 = f2, f3 F_FMIX_LR, // F09 : fmix.lr f1 = f2, f3 F_FMIX_R, // F09 : fmix.r f1 = f2, f3 F_FMIX_L, // F09 : fmix.l f1 = f2, f3 F_FSXT_R, // F09 : fsxt.r f1 = f2, f3 F_FSXT_L, // F09 : fsxt.l f1 = f2, f3 F_FPACK, // F09 : fpack f1 = f2, f3 F_FSWAP, // F09 : fswap f1 = f2, f3 F_FSWAP_NL, // F09 : fswap.nl f1 = f2, f3 F_FSWAP_NR, // F09 : fswap.nr f1 = f2, f3 F_FAND, // F09 : fand f1 = f2, f3 F_FANDCM, // F09 : fandcm f1 = f2, f3 F_FOR, // F09 : for f1 = f2, f3 F_FXOR, // F09 : fxor f1 = f2, f3 F_FPMERGE_S, // F09 : fpmerge.s f1 = f2, f3 F_FPMERGE_NS, // F09 : fpmerge.ns f1 = f2, f3 F_FPMERGE_SE, // F09 : fpmerge.se f1 = f2, f3 F_FCVT_FX, // F10 : fcvt.fx f1 = f2 F_FCVT_FXU, // F10 : fcvt.fxu f1 = f2 F_FCVT_FX_TRUNC, // F10 : fcvt.fx f1 = f2 F_FCVT_FXU_TRUNC, // F10 : fcvt.fxu.trunc f1 = f2 F_FPCVT_FX, // F10 : fpcvt.fx f1 = f2 F_FPCVT_FXU, // F10 : fpcvt.fxu f1 = f2 F_FPCVT_FX_TRUNC, // F10 : fpcvt.fx f1 = f2 F_FPCVT_FXU_TRUNC, // F10 : fpcvt.fxu.trunc f1 = f2 F_FCVT_XF, // F11 : fcvt.xf f1 = f2 F_FSETC, // F12 : fsetc amask7, omask7 F_FCLRF, // F13 : fclrf F_FCHKF, // F14 : fchkf target25 F_BREAK, // F15 : break.f immv F_NOP, // F15 : nop.f immv B_COND_IP, // B01 : br.cond <ip relative branch> B_WEXIT_IP, // B01 : br.wexit <ip relative branch> B_WTOP_IP, // B01 : br.wtop <ip relative branch> B_CLOOP_IP, // B02 : br.cloop <ip relative branch> B_CEXIT_IP, // B02 : br.cexit <ip relative branch> B_CTOP_IP, // B02 : br.ctop <ip relative branch> B_CALL_IP, // B03 : br.call b1=<ip rel branch> B_COND, // B04 : br.cond b2 B_IA, // B04 : br.ia b1 B_RET, // B04 : br.ret b0 B_CALL, // B05 : br.call b1 = b2 B_BRP_IP, // B06 : brp <ip rel predict>, tag B_BRP, // B07 : brp b2, tag13 B_BRP_RET, // B07 : brp.ret b2, tag13 B_COVER, // B08 : cover B_CLRRRB, // B08 : clrrrb B_CLRRRB_PR, // B08 : clrrrb.pr B_RFI, // B08 : rfi B_BSW_0, // B08 : bsw.0 B_BSW_1, // B08 : bsw.1 B_EPC, // B08 : epc B_BREAK, // B09 : break.b immv B_NOP, // B09 : nop.b immv X_BREAK, // X01 : break.x immv X_NOP, // X01 : nop.x immv X_MOVL, // X02 : movl r1 = immv X_BRL_COND, // X03 : brl.cond target64 X_BRL_CALL, // X04 : brl.call b1 = target64 OPCODE_MAX // leave this one at the end }; /// move to branch hint enum t_mhint {MSPTK, MNONE, MDPTK}; /// move and branch predict important completer enum t_ihint {INONE, IIMP}; /// ip-relative predict hint enum t_bphint {BPSPTK, BPLOOP, BPDPTK, BPEXIT}; /// load hints enum t_ldhint {LDNONE, LDNT1, LDNTA}; /// store hints enum t_sthint {STNONE, STNTA}; /// branch prefetch hint enum t_phint {FEW, MANY}; /// branch direction hint enum t_bhint {SPTK, SPNT, DPTK, DPNT}; /// branch cache deallocation hint enum t_chint {NONE, CLR}; /// line prefetch hint enum t_lfhint {LFNONE, LFNT1, LFNT2, LFNTA}; /// floating-point status field completer enum t_fpcomp {S0, S1, S2, S3}; /// floating point classes enum t_fpclass {NAT, QNAN, SNAN, POS, NEG, ZERO, UNORM, NORM, INF}; /// floating point instruction precision control completer enum t_fpipc {NONEPC, S, D}; } #endif
94c491f41d774a597d73227dec0f263d570a47fe
fc0b1c947b9485a54bad5f61d11993e750e7338f
/trunk/Study/Manager/MBaseObject.h
eb4e94d62be54b3464b956981256f0c301aaec05
[]
no_license
garammaru68/DX2DGame
3f552607e50d1b66316627790bbc7b64a76a057f
6456beb5bf4df5242589d65d3f5fd15ab2ced48b
refs/heads/main
2023-01-12T02:54:56.172711
2020-11-19T03:14:41
2020-11-19T03:14:41
314,122,498
0
0
null
null
null
null
UTF-8
C++
false
false
226
h
MBaseObject.h
#pragma once #include "MStd.h" class MBaseObject { public: virtual bool Init() = 0; virtual bool Frame() = 0; virtual bool Render() = 0; virtual bool Release() = 0; public: MBaseObject() {} virtual ~MBaseObject() {} };
e6fe8cd504807e8f80b90f328f24cf265ad14ea2
37d6909e8d5d50c9672064cbf9e3b921fab94741
/Programmers/멀쩡한 사각형.cpp
718e73b31b62b9f6c08a3a8c2849dfb5ab57126e
[]
no_license
lee-jisung/Algorithm-study
97e795c6cb47d1f4f716719f490031479d0578ca
d42470cd24b3984dc15992089d34dbe2ae6bb70d
refs/heads/master
2021-06-28T05:49:12.417367
2021-04-01T13:53:43
2021-04-01T13:53:43
225,784,579
3
0
null
null
null
null
UTF-8
C++
false
false
945
cpp
멀쩡한 사각형.cpp
#include <iostream> /* 대각선으로 선을 그었을 때, 사용하지 못하는 사각형의 규칙이 생성 => w, h의 최대 공약수 만큼 반복해서 나타남 => 반복되는 사각형에서 잘리는 사각형의 개수 => w + h - 1임 => 따라서 반복되는 사각형들에서 사용하지 못하는 사각형 개수는 gcd * (w / gcd + h / gcd - 1) ==> w + h - gcd로 나타낼 수 있음 // 참고: https://leedakyeong.tistory.com/entry/%ED%94%84%EB%A1%9C%EA%B7%B8%EB%9E%98%EB%A8%B8%EC%8A%A4-%EB%A9%80%EC%A9%A1%ED%95%9C-%EC%82%AC%EA%B0%81%ED%98%95-in-python */ using namespace std; long long gcd(long long a, long long b){ if(b == 0) return a; return gcd(b, a % b); } long long solution(int w, int h) { long long answer = 0, g, W, H; W = w; H = h; g = gcd(W, H); long long tmp = (W + H - g); answer = (W * H) - tmp; return answer; }
358ac496a562638cf4d0601631504cd06bf6fd9b
782e8b221d2d106a15a17e60e8620c7fed278429
/cachelib/navy/admission_policy/tests/RejectRandomAPTest.cpp
a1f9c2092da0275dde3f5605aa7ec8536eb4ecbf
[ "Apache-2.0" ]
permissive
ilkerhalil/CacheLib
d02985bba68af40c036fc12411efe317487c50de
d131b686ac135ea873dc4bb62e9133858eaad238
refs/heads/main
2023-08-18T07:39:27.272731
2021-09-11T02:49:48
2021-09-11T02:50:55
405,455,233
1
0
Apache-2.0
2021-09-11T18:33:55
2021-09-11T18:33:54
null
UTF-8
C++
false
false
1,514
cpp
RejectRandomAPTest.cpp
/* * Copyright (c) Facebook, Inc. and its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include <gmock/gmock.h> #include <gtest/gtest.h> #include "cachelib/navy/admission_policy/RejectRandomAP.h" namespace facebook { namespace cachelib { namespace navy { namespace tests { TEST(RejectRandomAP, Basic) { RejectRandomAP::Config config; config.probability = 0.9; RejectRandomAP ap{std::move(config)}; uint32_t rejected = 0; uint32_t accepted = 0; for (int i = 0; i < 100; i++) { if (ap.accept(makeHK("key"), makeView("value"))) { accepted++; } else { rejected++; } } EXPECT_GT(85, rejected); EXPECT_LT(15, accepted); } TEST(RejectRandomAP, Prob1) { RejectRandomAP::Config config; config.probability = 1.0; RejectRandomAP ap{std::move(config)}; for (int i = 0; i < 100; i++) { EXPECT_TRUE(ap.accept(makeHK("key"), makeView("value"))); } } } // namespace tests } // namespace navy } // namespace cachelib } // namespace facebook
f67981e0f05ff125f0309d516e5d0aa068ab907d
f40157ee092b0d2e2ee20fe33638b46cc447f607
/Test_MyBar/playerdefinitions.h
a74c6e96a90830d4d273c673e8920c26c363aafe
[]
no_license
InnerVex/TimeMachine
82433863dd6aca41152b1ec80c20470cf6a16309
2e74de63b919d58dc16aad5bb5f6bc3c0ef5ad79
refs/heads/master
2021-01-24T11:19:36.103993
2016-12-09T20:34:11
2016-12-09T20:34:11
70,243,093
0
0
null
2016-12-08T15:14:43
2016-10-07T12:07:37
Objective-C
UTF-8
C++
false
false
319
h
playerdefinitions.h
#pragma once struct SourceData { SourceData(std::string _path, qint32 _sourceStartTime, qint32 _sourceEndTime) : path(_path), sourceStartTime(_sourceStartTime), sourceEndTime(_sourceEndTime){} SourceData(){} std::string path; long sourceStartTime; long sourceEndTime; };
6eff1c895ba4173b9a8bd9cae7d7e9ca23b34c6c
531666c9b98068a39053dff728ba992374c13ef9
/Strom/Def.h
b5c6dd5299722209718e36978ec3d04aa12c005e
[]
no_license
janivanecky/Strom
2f38f9230284da0a00c452607982dfe7da245e17
ad048a0aea2620344be68904ac79ac79fa3ca089
refs/heads/master
2020-07-22T00:52:53.687191
2019-09-08T23:04:28
2019-09-08T23:04:28
207,021,705
2
0
null
null
null
null
UTF-8
C++
false
false
3,476
h
Def.h
// Authors: Dusan Drevicky, David Pribula, Jan Ivanecky #pragma once #include <stdint.h> #include "../Math.h" #include <cassert> #include <stack> #include <queue> typedef uint32_t uint32; typedef uint16_t uint16; typedef uint8_t uint8; typedef int32_t int32; typedef int16_t int16; typedef int8_t int8; #define MAX_BUDS_FROM_INTERNODE 2 #define MAX_SHADOW_DEPTH 4 struct WorldConstants { float basicLength; float basicWidth; float fullLightExposure; float shadowConstantA; float shadowConstantB; float canopyHeight; uint32 voxelsPerEdge; uint32 voxelSize; }; struct TreeParameters { float phyllotacticAngle; float branchingAngle; float deflectionAngle; float tropismAngle; float widthPower; float shedThreshold; float resourceThreshold; float resourceToLightRatio; uint32_t tropismMinOrder; uint32_t apicalControlMaxOrder; float defaultOrientationWeight; float environmentOrientationWeight; float tropismOrientationWeight; float lambda; float verticalBudPreference; float horizontalBudPreference; float upwardBudPreference; }; struct Bud; struct Internode { Vector3 startingPosition; Vector3 endingPosition; float width; float resource; float light; uint32 descendantInternodesCount; // Number of all of the descendant internodes (variable is used in shedding) uint32 nextLateralInternodesCount; uint32 ID; uint32 order; int32 accessCounter; bool isEnqueued; Internode *previous; Internode *nextInternodes[5]; Bud *buds[MAX_BUDS_FROM_INTERNODE]; }; struct Bud { Vector3 position; Vector3 direction; Vector3 lastLateralDirection; float lightExposure; int32 age; Internode *internode; uint32 ID; }; template <typename T> struct TBuffer { T *items; uint32 size; uint32 count; T& operator[](uint32 index) { return this->items[index]; } }; namespace Buffer { template <typename T> void Init(TBuffer<T> *buffer, uint32 size) { buffer->items = (T *)malloc(sizeof(T) * size); buffer->count = 0; buffer->size = size; } template <typename T> void Add(TBuffer<T> *buffer, T item) { assert(buffer->count < buffer->size); buffer->items[buffer->count++] = item; } template <typename T> void Release(TBuffer<T> *buffer) { free(buffer->items); } } struct TreeShell { WorldConstants constants; TreeParameters parameters; uint32_t internodeCount; uint32_t connectionCount; Internode *internodes; uint32_t *parentIndices; uint32_t *budIndices; float *parentBranchPart; float *endWidths; TBuffer<Bud *> budsBuffer; }; struct TreeMesh { void *vertices; uint32 vertexCount; uint32 vertexStride; uint32 *indices; uint32 indexCount; }; struct Voxel { Vector3i coordinate; // An unsigned (if it is valid) integer coordinate into the 3D model of the VoxelSpace (positively offset) Vector3 worldSpaceCenterPosition; // Position of the center of the voxel in the world shared with the tree. Used for environment vector calculation. }; // x coordinate then y then y // saves only in unsigned values (add half of length to X and Z (Y) always unsigned ). struct VoxelSpace { Voxel *voxels; float *shadowValues; uint32 voxelSize; uint32 voxelsPerEdge; float shadowConstantA; float shadowConstantB; }; struct Tree { Internode* root; TBuffer<Bud *> budsBuffer; VoxelSpace voxelSpace; TreeParameters parameters; WorldConstants constants; uint32 maxInternodesFromBud; uint32 iteration; uint32 shedTotal; uint32 internodeCount; float maxResourceInTerminalInternode; };
278d1918e379cda025b3f4b06c8683b5903419ca
9de0cec678bc4a3bec2b4adabef9f39ff5b4afac
/TENDER/TenderSupplies/AliAnalysisTaskVZEROEqFactorTask.cxx
ed3bed99aba2d1cbea6d61788664667efadc2437
[]
permissive
alisw/AliPhysics
91bf1bd01ab2af656a25ff10b25e618a63667d3e
5df28b2b415e78e81273b0d9bf5c1b99feda3348
refs/heads/master
2023-08-31T20:41:44.927176
2023-08-31T14:51:12
2023-08-31T14:51:12
61,661,378
129
1,150
BSD-3-Clause
2023-09-14T18:48:45
2016-06-21T19:31:29
C++
UTF-8
C++
false
false
9,008
cxx
AliAnalysisTaskVZEROEqFactorTask.cxx
/************************************************************************** * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * * * * Author: The ALICE Off-line Project. * * Contributors are mentioned in the code where appropriate. * * * * Permission to use, copy, modify and distribute this software and its * * documentation strictly for non-commercial purposes is hereby granted * * without fee, provided that the above copyright notice appears in all * * copies and that both the copyright notice and this permission notice * * appear in the supporting documentation. The authors make no claims * * about the suitability of this software for any purpose. It is * * provided "as is" without express or implied warranty. * **************************************************************************/ // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ // // AliAnalysisTaskVZEROEqFactorTask.cxx, February 12th 2014 // --- David Dobrigkeit Chinellato // // This task is meant to set correct VZERO equalization factors in AliESDRun // so that AliCentrality makes use of the correct values. NB This task has to // be executed prior to AliCentrality for this to work properly! It is meant // to be used as a Tender. // // Comments, Suggestions, Bug reports: Please send them to: // --- daviddc@ifi.unicamp.br // // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ class TTree; class TParticle; class TVector3; //class AliMCEventHandler; //class AliMCEvent; //class AliStack; class AliESDVertex; class AliAODVertex; class AliESDv0; class AliAODv0; #include <Riostream.h> #include "TList.h" #include "TH1.h" #include "TH2.h" #include "TH3.h" #include "TFile.h" #include "THnSparse.h" #include "TVector3.h" #include "TCanvas.h" #include "TMath.h" #include "TLegend.h" //#include "AliLog.h" #include "AliAnalysisTaskSE.h" #include "AliESDEvent.h" #include "AliAODEvent.h" #include "AliV0vertexer.h" #include "AliCascadeVertexer.h" #include "AliESDpid.h" #include "AliESDRun.h" #include "AliESDtrack.h" #include "AliESDtrackCuts.h" #include "AliInputEventHandler.h" #include "AliAnalysisManager.h" #include "AliMCEventHandler.h" #include "AliMCEvent.h" #include "AliStack.h" #include "AliCFContainer.h" #include "AliMultiplicity.h" #include "AliAODMCParticle.h" #include "AliESDcascade.h" #include "AliAODcascade.h" #include "AliESDUtils.h" #include "AliGenEventHeader.h" #include "AliAnalysisUtils.h" #include "AliAnalysisTaskVZEROEqFactorTask.h" #include "AliCDBManager.h" #include "AliCDBStorage.h" #include "AliCDBEntry.h" #include "AliVZEROCalibData.h" using std::cout; using std::endl; ClassImp(AliAnalysisTaskVZEROEqFactorTask) AliAnalysisTaskVZEROEqFactorTask::AliAnalysisTaskVZEROEqFactorTask() : AliAnalysisTaskSE(), fListHist(0), fEqFactors(0), fCalibData(0), fRunNumber(0), fHistEventCounter(0), fisAOD(kFALSE) //------------------------------------------------ // Tree Variables { // Dummy Constructor } AliAnalysisTaskVZEROEqFactorTask::AliAnalysisTaskVZEROEqFactorTask(const char *name) : AliAnalysisTaskSE(name), fListHist(0), fEqFactors(0), fCalibData(0), fRunNumber(0), fHistEventCounter(0), fisAOD(kFALSE) { // Constructor DefineOutput(1, TList::Class()); } AliAnalysisTaskVZEROEqFactorTask::~AliAnalysisTaskVZEROEqFactorTask() { //------------------------------------------------ // DESTRUCTOR //------------------------------------------------ if (fListHist){ delete fListHist; fListHist = 0x0; } } //________________________________________________________________________ void AliAnalysisTaskVZEROEqFactorTask::UserCreateOutputObjects() { //------------------------------------------------ // Output: Empty at the moment //------------------------------------------------ fListHist = new TList(); fListHist->SetOwner(); // See http://root.cern.ch/root/html/TCollection.html#TCollection:SetOwner if(! fHistEventCounter ) { //Histogram Output: Event-by-Event // --- Single "Events Processed" Counter at this stage fHistEventCounter = new TH1D( "fHistEventCounter", ";Evt. Sel. Step;Count",4,0,4); fHistEventCounter->GetXaxis()->SetBinLabel(1, "Processed"); fHistEventCounter->GetXaxis()->SetBinLabel(2, "Has ESD"); fHistEventCounter->GetXaxis()->SetBinLabel(3, "Has ESDRun"); fHistEventCounter->GetXaxis()->SetBinLabel(4, "Rewrote EqFactors"); fListHist->Add(fHistEventCounter); } //List of Histograms PostData(1, fListHist); }// end UserCreateOutputObjects //________________________________________________________________________ void AliAnalysisTaskVZEROEqFactorTask::UserExec(Option_t *) { // Main loop // Called for each event AliESDEvent *lESDevent = 0x0; AliAODEvent *lAODevent = 0x0; // Connect to the InputEvent // After these lines, we should have an ESD/AOD event + the number of V0s in it. // Appropriate for ESD analysis! //Count Processed Events fHistEventCounter->Fill(0.5); if(fisAOD) { lAODevent = dynamic_cast<AliAODEvent*>( InputEvent() ); if (!lAODevent) { AliError("AOD event not available \n"); return; } } else { lESDevent = dynamic_cast<AliESDEvent*>( InputEvent() ); if (!lESDevent) { AliError("ESD event not available \n"); return; } } fHistEventCounter->Fill(1.5); //Acquire ESDRun object - Will be needed to invoke AliESDEvent::SetVZEROEqFactors Int_t runNumber=-1; // const AliESDRun *lESDRun; if(fisAOD) { runNumber = lAODevent->GetRunNumber(); } else { // lESDRun = lESDevent->GetESDRun(); // if (!lESDRun) { // AliError("ERROR: lESDRun not available, won't be able to write Equalization Factors! Exiting. \n"); // return; // } runNumber = lESDevent->GetRunNumber(); } fHistEventCounter->Fill(2.5); //CDB Processing only necessary if Run Number changed! Check for change (no need to redo this every event) if( runNumber != fRunNumber ){ AliWarning("Run Changed! Reloading CDB values!"); //Load CDB Entries - Mirroring AliVZEROReconstructor AliCDBManager *cdbmanager = AliCDBManager::Instance(); cdbmanager->SetDefaultStorage("raw://"); cdbmanager->SetRun(runNumber); if(!cdbmanager) AliFatal("No CDB Manager !"); AliCDBEntry *entry7 = cdbmanager->Get("VZERO/Calib/EqualizationFactors"); if (!entry7) AliFatal("VZERO equalization factors are not found in OCDB !"); fEqFactors = (TH1F*)entry7->GetObject(); //Load Calibration object fCalibData fCalibData = GetCalibData(); // Mirror AliVZEROReconstructor Functionality fRunNumber = runNumber; //New Run } if(!fCalibData) AliFatal("No VZERO CalibData Object found!"); Float_t factors[64]; Float_t factorSum = 0; for(Int_t i = 0; i < 64; ++i) { factors[i] = fEqFactors->GetBinContent(i+1)*fCalibData->GetMIPperADC(i); factorSum += factors[i]; } for(Int_t i = 0; i < 64; ++i) { factors[i] *= (64./factorSum); } // Set the equalized factors if(fisAOD) { lAODevent->SetVZEROEqFactors(factors); } else { lESDevent->SetVZEROEqFactors(factors); } fHistEventCounter->Fill(3.5); // Post output data. PostData(1, fListHist); } //________________________________________________________________________ void AliAnalysisTaskVZEROEqFactorTask::Terminate(Option_t *) { // Draw result to the screen // Called once at the end of the query TList *cRetrievedList = 0x0; cRetrievedList = (TList*)GetOutputData(1); if(!cRetrievedList){ Printf("ERROR - AliAnalysisTaskVZEROEqFactorTask : ouput data container list not available\n"); return; } fHistEventCounter = dynamic_cast<TH1D*> ( cRetrievedList->FindObject("fHistEventCounter") ); if (!fHistEventCounter) { Printf("ERROR - AliAnalysisTaskVZEROEqFactorTask : fHistEventCounter not available"); return; } TCanvas *canCheck = new TCanvas("AliAnalysisTaskVZEROEqFactorTask","V0 Multiplicity",10,10,510,510); canCheck->cd(1)->SetLogy(); fHistEventCounter->SetMarkerStyle(22); fHistEventCounter->DrawCopy("E"); } //_____________________________________________________________________________ AliVZEROCalibData* AliAnalysisTaskVZEROEqFactorTask::GetCalibData() const { // Gets calibration object for VZERO set AliCDBManager *man = AliCDBManager::Instance(); AliCDBEntry *entry=0; entry = man->Get("VZERO/Calib/Data"); AliVZEROCalibData *calibdata = 0; if (entry) calibdata = (AliVZEROCalibData*) entry->GetObject(); if (!calibdata) AliFatal("No calibration data from calibration database !"); return calibdata; }
744ea2dd43a11ef2f2c081dfce4391d6792802cc
070775dcf7b91efdc84e3f7c12fad4708cccf441
/10-2string容器/test.cpp
3cef63a4c04f384bc7eb6cec52fb161487717581
[]
no_license
514467952/c-about
9df501480ddbf734ea4146bd47333ec39d44091f
7af295b7882b2d7c91bf5565df3accb70d67929b
refs/heads/master
2020-06-15T07:43:44.323190
2020-01-21T01:57:35
2020-01-21T01:57:35
195,238,626
1
0
null
null
null
null
GB18030
C++
false
false
3,320
cpp
test.cpp
#include<iostream> #include<string> using namespace std; #include<stdexcept> void test01() { string str;//默认构造 string str2(str);//拷贝构造 string str3 = str; string str4 = "abcd"; string str5(10, 'a'); cout << str4 << endl; cout << str5 << endl; //基本赋值 str = "hello"; str2 = str4; //string &assign(const char *s,int n)//把字符串s的前n个字符赋给当前的字符串 str3.assign("abcdef", 4); cout << str3 << endl; //string &assign(const string *s,int start,int n)//将s从start开始n个字符赋值给字符串 string str6; str6.assign(str, 1, 3);//ell ? hel 从0索引 cout << str6 << endl; } void test02() { string s = "hello world"; for (int i = 0; i < s.size(); i++) { //cout << s[i] << endl; cout << s.at(i) << endl; } //[]和at区别?[]访问越界,直接挂掉 at会抛出异常 try { //cout << s[100] << endl; cout << s.at(100) << endl; } catch (out_of_range& e) { cout << e.what() << endl; } catch (...) { cout << "越界异常" << endl; } } void test03() { //拼接 string s1 = "我"; string s2 = "爱北京"; s1+=s2; cout << s1<< endl; s1.append("天安门"); cout << s1 << endl; //find查找 string s = "abcdefg"; int pos = s.find("bcf");//找不到返回-1 cout << "pos=" << pos << endl; int pos2 = s.rfind("bc");//rfind和find结果一样,内部查找方式不一样 cout << "pos2=" << pos2 << endl; //替换 string s3 = "hello"; s3.replace(1, 3, "1111");//替换从pos开始n个字符为字符串str cout << s3 << endl; //he1111o } void test04() { string s1 = "bbc"; string s2 = "abc"; if (s1.compare(s2) == 0) { cout << "s1等于s2" << endl; } else if (s1.compare(s2)==1) { cout << "s1大于s2" << endl; } else { cout << "s1小于s2" << endl; } } void test05() { string s1 = "abcde"; string s2 = s1.substr(1, 3); cout <<"s2="<< s2 << endl; //需求,查找一个邮件的用户名 string email = "zhangtao@sina.com"; int pos=email.find("@");// cout << "pos" << pos << endl; string userName = email.substr(0, pos); cout << "用户名" << userName << endl; } void test06() { string s1 = "hello"; s1.insert(1, "111"); cout << s1 << endl;//h111ello //删除111 s1.erase(1, 3); cout << s1 << endl; } /* string和c-style字符串转换 */ void func(string s) { cout << s << endl; } void func2(char *s) { cout << s << endl; } void test07() { string s = "abc"; //string->char * const char *p = s.c_str(); func(p);//const char *隐式类型转换为string //const char *->string string s2(p); //func2(s2);//string 不能隐式类型转换成char * } void test08() { string s = "abcdefg"; char &a = s[2]; char &b = s[3]; a = '1'; b = '2'; cout << s << endl; cout << (int *)s.c_str() << endl; s = "pppppppppppppppp"; /*a='1'; b = '2';*/ cout << s << endl; cout << (int *)s.c_str() << endl; } /* 写一个函数,函数内部string字符串中的所有小写字母都变成大写字母 */ void test09() { string s = "abCdEfg"; for (int i = 0; i < s.size(); i++) { //s[i] = toupper(s[i]); //全变小写 s[i] = tolower(s[i]); } cout << s << endl; } int main() { //test01(); //test02(); //test03(); ///test04(); //test05(); ///test06(); //test07(); //test08(); test09(); system("pause"); return 0; }
a168a1db2ce07bbc89b9bf3426897503a4b5f9da
8d81f8a15efd9a4d0f11ac3fe64d822eb98bd37d
/4_pkuacm/1009EdgeDetection.cpp
61ea1f5d1c52abb5d365afdb09d1737046bb6f3b
[]
no_license
wyxmails/MyCode
b32a14d3b3a63dd9b3049d266231728419ed60d1
641abffc65b52b6f4a279432a8c4037a3b6a900c
refs/heads/master
2020-12-25T17:24:03.304677
2016-08-28T14:05:10
2016-08-28T14:05:10
18,900,363
2
0
null
null
null
null
UTF-8
C++
false
false
5,331
cpp
1009EdgeDetection.cpp
#include <iostream> #include <map> #include <stdio.h> #include <stdlib.h> using namespace std; typedef struct desc{ long start; long end; long value; }desc; int main(int argc,char*argv[]){ long long keyarr[1001]; int valarr[1001]; map<long long,int> mapkv; long long width,number,count,pairnum; int tmpvalue,value,maxval; bool flag; desc outunit; desc tmpout; cin>>width; while(width){ cout << width << endl; mapkv.clear(); count = 0; if(width==1){ flag = false; cin>>value>>number; count = number; tmpvalue = value; cin>>value>>number; while(value&&number){ flag = true; cout << "0 " << count-1 << endl; cout << abs(tmpvalue-value) << " 2" << endl; count = number; tmpvalue = value; cin>>value>>number; } if(flag&&count>1){ cout << "0 " << count-1 << endl; cout << "0 0" << endl; cin>>width; continue; }else{ cout << "0 " << count << endl; cout << "0 0" << endl; cin>>width; continue; } } cin>>value>>number; long i=0; if(number>width+1) pairnum = number-width; else pairnum = 1; while(value||number){ count += number; keyarr[i] = count; valarr[i] = value; for(long j=pairnum;j<=keyarr[i];++j) mapkv[j]=valarr[i]; i++; cin>>value>>number; if(number>width+1) pairnum=keyarr[i-1]+number-width; else pairnum=keyarr[i-1]+1; for(long j=keyarr[i-1]+1;j<pairnum&&j<=keyarr[i-1]+width+1;++j){ mapkv[j] = value; } } pairnum = i; if(pairnum==1){ cout << "0 " << count << endl; cin>>width; continue; } if(keyarr[0]>width+1){ if(keyarr[0]%width){ cout << "0 " << keyarr[0]-width-1 << endl; outunit.start = keyarr[0]-width; outunit.end = keyarr[0]-width-1; }else{ cout << "0 " << keyarr[0]-width << endl; outunit.start = keyarr[0]-width+1; outunit.end = keyarr[0]-width; } }else{ outunit.start = 1; outunit.end = 0; } outunit.value = 256; for(i=0;i<pairnum;++i){ if(i==pairnum-1){ if(keyarr[i]>outunit.end){ if(outunit.value){ cout << outunit.value << " " <<outunit.end-outunit.start+1 << endl; cout << "0 " << keyarr[i]-outunit.end << endl; }else{ cout << outunit.value << " " << keyarr[i]-outunit.start+1 << endl; } }else{ cout << outunit.value << " " <<outunit.end-outunit.start+1 << endl; } break; } if(i!=pairnum-1&&keyarr[i]-width-1>outunit.end&&mapkv.find(outunit.end+1)==mapkv.end()){ cout <<outunit.value << " " << outunit.end-outunit.start+1 << endl; outunit.start = outunit.end+1; outunit.end = keyarr[i]-width-1; cout << "0 " << outunit.end-outunit.start+1 << endl; outunit.start = outunit.end+1; } for(long j=outunit.end+1;j<=keyarr[i]+width+1;++j){ if(mapkv.find(j)==mapkv.end()) break; tmpvalue = 0; if(j%width==1){ if(j>width){ if(mapkv.find(j-width)!=mapkv.end()) tmpvalue = max(tmpvalue,abs(mapkv[j]-mapkv[j-width])); if(mapkv.find(j-width+1)!=mapkv.end()) tmpvalue = max(tmpvalue,abs(mapkv[j]-mapkv[j-width+1])); } if(j<count-width){ if(mapkv.find(j+width)!=mapkv.end()) tmpvalue = max(tmpvalue,abs(mapkv[j]-mapkv[j+width])); if(mapkv.find(j+width+1)!=mapkv.end()) tmpvalue = max(tmpvalue,abs(mapkv[j]-mapkv[j+width+1])); } if(mapkv.find(j+1)!=mapkv.end()) tmpvalue = max(tmpvalue,abs(mapkv[j]-mapkv[j+1])); }else if(j%width==0){ if(j>width){ if(mapkv.find(j-width)!=mapkv.end()) tmpvalue = max(tmpvalue,abs(mapkv[j]-mapkv[j-width])); if(mapkv.find(j-width-1)!=mapkv.end()) tmpvalue = max(tmpvalue,abs(mapkv[j]-mapkv[j-width-1])); } if(j<=count-width){ if(mapkv.find(j+width)!=mapkv.end()) tmpvalue = max(tmpvalue,abs(mapkv[j]-mapkv[j+width])); if(mapkv.find(j+width-1)!=mapkv.end()) tmpvalue = max(tmpvalue,abs(mapkv[j]-mapkv[j+width-1])); } if(mapkv.find(j-1)!=mapkv.end()) tmpvalue = max(tmpvalue,abs(mapkv[j]-mapkv[j-1])); }else{ if(mapkv.find(j+1)!=mapkv.end()&&mapkv.find(j)!=mapkv.end()) tmpvalue = max(abs(mapkv[j]-mapkv[j+1]),tmpvalue); if(mapkv.find(j-1)!=mapkv.end()) tmpvalue = max(abs(mapkv[j]-mapkv[j-1]),tmpvalue); if(j>width){ if(mapkv.find(j-width)!=mapkv.end()) tmpvalue = max(tmpvalue,abs(mapkv[j]-mapkv[j-width])); if(mapkv.find(j-width+1)!=mapkv.end()) tmpvalue = max(tmpvalue,abs(mapkv[j]-mapkv[j-width+1])); if(mapkv.find(j-width-1)!=mapkv.end()) tmpvalue = max(tmpvalue,abs(mapkv[j]-mapkv[j-width-1])); } if(j<count-width){ if(mapkv.find(j+width)!=mapkv.end()) tmpvalue = max(tmpvalue,abs(mapkv[j]-mapkv[j+width])); if(mapkv.find(j+width+1)!=mapkv.end()) tmpvalue = max(tmpvalue,abs(mapkv[j]-mapkv[j+width+1])); if(mapkv.find(j+width-1)!=mapkv.end()) tmpvalue = max(tmpvalue,abs(mapkv[j]-mapkv[j+width-1])); } } if(outunit.value<=255&&tmpvalue!=outunit.value){ cout << outunit.value << " " << outunit.end-outunit.start+1 << endl; outunit.start = j; outunit.end = j; outunit.value = tmpvalue; }else{ outunit.value = tmpvalue; outunit.end = j; } } } cout << "0 0" << endl; cin>>width; } cout << "0" << endl; return 0; }
db110a241504618f5f040b63dc4fec444d584470
4549d18dee3acf0a93274a42282bc7be4c6b6b1a
/AtCoder/arc080_a/13313862_AC_13ms_640kB.cpp
bb5f9d385c79005d8280b00cd3177113204d862e
[]
no_license
syed-jafrul-husen/Competitive-Programming-Code
c57ae56ab95b7b04de7be37835a2388bc75a57b8
bd64a1399b69272f6ffc3bb5bb36c40690c0c818
refs/heads/main
2023-08-23T23:30:14.311320
2021-10-15T14:31:13
2021-10-15T14:31:13
417,528,981
0
0
null
null
null
null
UTF-8
C++
false
false
463
cpp
13313862_AC_13ms_640kB.cpp
#include<bits/stdc++.h> using namespace std; int main() { int n,i,y=0,y2=0,y3=0; scanf("%d",&n); int a[n]; for(i=0; i<n; i++) { scanf("%d",&a[i]); if(a[i]%4==0) ++y; else if(a[i]%2==0) ++y2; else if(a[i]%2!=0) ++y3; } if(y2==0 && y3<=y+1) printf("Yes\n"); else if(y2>0 && y3<=y) printf("Yes\n"); else printf("No\n"); return 0; }
f0f60bc7ec367fa281ebdc64e13ab555868b688e
373035950bdc8956cc0b74675aea2d1857263129
/cpp/test-harness/ta1/scripts/setup-client-harness-scripts.h
56a4a00555710c6e6f3ab605a0f074a9dcc07575
[ "BSD-2-Clause", "BSD-3-Clause" ]
permissive
limkokholefork/SPARTA
5d122cd2e920775d61a5404688aabbafa164f22e
6eeb28b2dd147088b6e851876b36eeba3e700f16
refs/heads/master
2021-11-11T21:09:38.366985
2017-06-02T16:21:48
2017-06-02T16:21:48
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,218
h
setup-client-harness-scripts.h
//***************************************************************** // Copyright 2015 MIT Lincoln Laboratory // Project: SPAR // Authors: OMD // Description: Builds the set of scripts the client harness can // handle. // // Modifications: // Date Name Modification // ---- ---- ------------ // 26 Sep 2012 omd Original Version //***************************************************************** #ifndef CPP_TEST_HARNESS_TA1_SCRIPTS_SETUP_CLIENT_HARNESS_SCRIPTS_H_ #define CPP_TEST_HARNESS_TA1_SCRIPTS_SETUP_CLIENT_HARNESS_SCRIPTS_H_ class ClientSUTProtocolStack; class GeneralLogger; class MasterHarnessProtocolStack; class ScriptsFromFile; class SUTRunningMonitor; /// Given a ScriptsFromFile instance this sets up the set of scripts the client /// harness needs to be able to parse out of a configuration file and run. The /// protocol and logger items are necessary for some of the factory functors. void SetupClientHarnessScripts( ClientSUTProtocolStack* protocol_stack, MasterHarnessProtocolStack* network_stack, SUTRunningMonitor* sut_monitor, ScriptsFromFile* scripts_from_file); #endif
c4070a0be1f59b184b83232302880768fa03aa96
997f9e841c17dc42a1df80d0034bdc53c71ecfd3
/FfmpegDecodecEncodec/FfmpegDecodecBase.h
6812b8b6957b5872b38160ce84734efb35b8adc9
[]
no_license
xichyw1314807xn/FfmpegOk
3887c2bc96f8f8269f57d34ca435e2f12c70ed92
5a14053bff8bbae0816effb85859850ef74a52e0
refs/heads/master
2021-01-10T01:19:03.287923
2016-02-17T05:34:18
2016-02-17T05:34:18
51,818,268
0
0
null
null
null
null
UTF-8
C++
false
false
147
h
FfmpegDecodecBase.h
#pragma once class FfmpegDecodecBase { public: FfmpegDecodecBase(); ~FfmpegDecodecBase(); virtual void decodec(); virtual void encodec(); };
e4e62cc5dff4a1a8d25888e0e1e7ee9b644475ee
893f530dc43b9272ae1c4ae5a69923f3510d3ced
/Telescope-goto-esp32-arduino/src/common/Protocols/AppProtocol/AppProtocol.h
eaa43867c6ae98f3853e6bd73ff65737090ed3c4
[]
no_license
FabianKoehnen/Telescope-goto
8e8a033a868b4e27bee9cd3dbe6ff422d37c5e23
a955dd389596f9ad7d10b7e126b224c7d7c038e1
refs/heads/main
2023-01-22T17:16:31.358717
2020-12-10T10:27:52
2020-12-10T10:32:44
302,269,589
3
1
null
2020-11-20T08:34:07
2020-10-08T07:54:30
C++
UTF-8
C++
false
false
978
h
AppProtocol.h
#ifndef __AppProtocol_h__ #define __AppProtocol_h__ #include <vector> #include "../../Logger.h" #include "../IProtocol.h" #include "./AppProtocolRequestHandler/AppProtocolRequestHandler.h" #include "AppProtocolRequest/Date/Date.h" #include "AppProtocolRequest/Time/Time.h" #include "AppProtocolRequest/UtcOffset/UtcOffset.h" #include "AppProtocolRequest/Latitude/Latitude.h" #include "AppProtocolRequest/Longitude/Longitude.h" #include "AppProtocolRequest/CalibrationDec/CalibrationDec.h" #include "AppProtocolRequest/CalibrationRa/CalibrationRa.h" #include "AppProtocolRequest/Move/Move.h" class AppProtocol: public IProtocol{ private: AppProtocolRequestHandler &requestHandler; std::vector<std::string> extractComand(std::string rawMsg); std::string getComandType(std::string comand); std::string getComandPayload(std::string comand); public: AppProtocol(AppProtocolRequestHandler &requestHandler); std::string interpret(std::string msg); }; #endif
217da86636b3310ea67a3465e109978b6819339b
843bf30616705b5ce817d1a27cbace44b5f980e1
/mooon/include/mooon/sys/log.h
51f11a854ff04c861c16bd8c38fd6de0b268f946
[]
no_license
eyjian/mooon
971d7ffcae167cd67675d8e2262d13db0de18841
80e8e74c1b26f6ab41ce6df8f4e09e4f45d8b57c
refs/heads/master
2022-02-01T22:12:18.055955
2021-12-23T10:41:44
2021-12-23T10:41:44
27,848,358
69
59
null
null
null
null
UTF-8
C++
false
false
17,586
h
log.h
/** * 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. * * Author: jian yi, eyjian@qq.com */ #ifndef MOOON_SYS_LOG_H #define MOOON_SYS_LOG_H #include <mooon/sys/config.h> #include <mooon/utils/print_color.h> #include <stdio.h> SYS_NAMESPACE_BEGIN class ILogger; /** 不要修改下面的常量值,而应当通过对应的方法去修改 * 这些常量值主要是方便多模块共享,故放在这个公有头文件当中 */ enum { LOG_LINE_SIZE_MIN = 256, /** 日志行最小长度 */ LOG_LINE_SIZE_MAX = 32768, /** 日志行最大长度(32K) ,最大不能超过64K,因为使用2字节无符号整数存储的 */ DEFAULT_LOG_FILE_SIZE = 524288000, /** 默认的单个日志文件大小(500MB) */ DEFAULT_LOG_FILE_BACKUP_NUMBER = 10 /** 默认的日志文件备份个数 */ }; /** 定义日志级别 */ typedef enum { LOG_LEVEL_DETAIL = 0, LOG_LEVEL_DEBUG = 1, LOG_LEVEL_INFO = 2, LOG_LEVEL_WARN = 3, LOG_LEVEL_ERROR = 4, LOG_LEVEL_FATAL = 5, LOG_LEVEL_STATE = 6, /** 仅输出状态数据 */ LOG_LEVEL_TRACE = 7, LOG_LEVEL_RAW = 8, /** 裸日志,传入什么输出什么 */ LOG_LEVEL_BIN = 9 }log_level_t; /** 通过日志级别名得到日志级别 */ extern log_level_t get_log_level(const char* level_name); // 通过日志级别得到日志级别名,如果传入错误的日志级别,则返回NULL // 有效的日志名为(全大写): // DETAIL, DEBUG, INFO, WARN, ERROR, FATAL, STATE, TRACE extern const char* get_log_level_name(log_level_t log_level); // 根据程序文件得到日志文件名,结果不包含目录 // 如果suffix为空: // 1) 假设程序文件名为mooon,则返回结果为mooon.log // 2) 假设程序文件名为mooon.exe,则返回结果为mooon.log // // 如果suffix不为空,假设为6789: // 1) 假设程序文件名为mooon,则返回结果为mooon_6789.log // 2) 假设程序文件名为mooon.exe,则返回结果为mooon_6789.log extern std::string get_log_filename(const std::string& suffix=std::string("")); // 根据程序文件得到日志文件的目录路径,不包含日志文件名 extern std::string get_log_dirpath(bool enable_program_path=true); // 根据程序文件得到日志文件路径,返回结果包含目录和文件名 // 假设程序文件所在路径为:/data/mooon/bin/test, // 同时存在目录/data/mooon/log,则日志自动放在该目录下, // 否则当enable_program_path为true时,日志放在/data/mooon/bin目录下。 // 如果不存在目录/data/mooon/log,且enable_program_path为false,则函数返回空字符串 extern std::string get_log_filepath(bool enable_program_path=true, const std::string& suffix=std::string("")); // 根据环境变量名MOOON_LOG_LEVEL来设置日志级别 // 如果没有设置环境变量MOOON_LOG_LEVEL,则set_log_level_by_env()什么也不做 // 日志文件名只能为下列值: // DETAIL, DEBUG, INFO, WARN, ERROR, FATAL, STATE, TRACE // 如果非这些值,则默认为INFO extern void set_log_level_by_env(ILogger* logger); // 根据环境变量名MOOON_LOG_SCREEN控制是否在屏幕上打印日志,只会值为1时才会屏幕上打印日志 extern void enable_screen_log_by_env(ILogger* logger); // 根据环境变量名MOOON_LOG_TRACE控制是否记录trace日志 extern void enable_trace_log_by_env(ILogger* logger); // 根据环境变量名MOOON_LOG_FILESIZE控制单个日志文件大小 extern void set_log_filesize_by_env(ILogger* logger); // 根据环境变量名MOOON_LOG_BACKUP控制日志文件备份个数 extern void set_log_backup_by_env(ILogger* logger); /** * 日志器接口,提供常见的写日志功能 */ class ILogger { public: /** 空虚拟析构函数,以屏蔽编译器告警 */ virtual ~ILogger() {} virtual int get_log_level() const { return -1; } virtual std::string get_log_dir() const { return std::string(""); } virtual std::string get_log_filename() const { return std::string(""); } virtual std::string get_log_filepath() const { return std::string(""); } virtual std::string get_log_shortname() const { return std::string(""); } /* 不包含后缀的文件名 */ /** 是否允许同时在标准输出上打印日志 */ virtual void enable_screen(bool enabled) {} /** 是否允许二进制日志,二进制日志必须通过它来打开 */ virtual void enable_bin_log(bool enabled) {} /** 是否允许跟踪日志,跟踪日志必须通过它来打开 */ virtual void enable_trace_log(bool enabled) {} /** 是否允许祼日志,祼日志必须通过它来打开 */ virtual void enable_raw_log(bool enabled, bool record_time=false) {} /** 是否自动在一行后添加结尾的点号,如果最后已经有点号或换符符,则不会再添加 */ virtual void enable_auto_adddot(bool enabled) {} /** 是否自动添加换行符,如果已经有换行符,则不会再自动添加换行符 */ virtual void enable_auto_newline(bool enabled) {} /** 设置日志级别,跟踪日志级别不能通过它来设置 */ virtual void set_log_level(log_level_t log_level) {} /** 设置单个文件的最大建议大小 */ virtual void set_single_filesize(uint32_t filesize) {} /** 设置日志文件备份个数,不包正在写的日志文件 */ virtual void set_backup_number(uint16_t backup_number) {} /** 是否允许二进制日志 */ virtual bool enabled_bin() { return false; } /** 是否允许Detail级别日志 */ virtual bool enabled_detail() { return false; } /** 是否允许Debug级别日志 */ virtual bool enabled_debug() { return false; } /** 是否允许Info级别日志 */ virtual bool enabled_info() { return false; } /** 是否允许Warn级别日志 */ virtual bool enabled_warn() { return false; } /** 是否允许Error级别日志 */ virtual bool enabled_error() { return false; } /** 是否允许Fatal级别日志 */ virtual bool enabled_fatal() { return false; } /** 是否允许输出状态日志 */ virtual bool enabled_state() { return false; } /** 是否允许Trace级别日志 */ virtual bool enabled_trace() { return false; } /** 是否允许Raw级别日志 */ virtual bool enabled_raw() { return false; } virtual void vlog_detail(const char* filename, int lineno, const char* module_name, const char* format, va_list& args) {} // 由于隐含了this参数(总是1个参数),所以format为第5个参数,...从第6个参数开始 virtual void log_detail(const char* filename, int lineno, const char* module_name, const char* format, ...) __attribute__((format(printf, 5, 6))) {} virtual void vlog_debug(const char* filename, int lineno, const char* module_name, const char* format, va_list& args) {} virtual void log_debug(const char* filename, int lineno, const char* module_name, const char* format, ...) __attribute__((format(printf, 5, 6))) {} virtual void vlog_info(const char* filename, int lineno, const char* module_name, const char* format, va_list& args) {} virtual void log_info(const char* filename, int lineno, const char* module_name, const char* format, ...) __attribute__((format(printf, 5, 6))) {} virtual void vlog_warn(const char* filename, int lineno, const char* module_name, const char* format, va_list& args) {} virtual void log_warn(const char* filename, int lineno, const char* module_name, const char* format, ...) __attribute__((format(printf, 5, 6))) {} virtual void vlog_error(const char* filename, int lineno, const char* module_name, const char* format, va_list& args) {} virtual void log_error(const char* filename, int lineno, const char* module_name, const char* format, ...) __attribute__((format(printf, 5, 6))) {} virtual void vlog_fatal(const char* filename, int lineno, const char* module_name, const char* format, va_list& args) {} virtual void log_fatal(const char* filename, int lineno, const char* module_name, const char* format, ...) __attribute__((format(printf, 5, 6))) {} virtual void vlog_state(const char* filename, int lineno, const char* module_name, const char* format, va_list& args) {} virtual void log_state(const char* filename, int lineno, const char* module_name, const char* format, ...) __attribute__((format(printf, 5, 6))) {} virtual void vlog_trace(const char* filename, int lineno, const char* module_name, const char* format, va_list& args) {} virtual void log_trace(const char* filename, int lineno, const char* module_name, const char* format, ...) __attribute__((format(printf, 5, 6))) {} /** 写裸日志 */ virtual void vlog_raw(const char* format, va_list& ap) {} virtual void log_raw(const char* format, ...) __attribute__((format(printf, 2, 3))) {} /** 写二进制日志 */ virtual void log_bin(const char* filename, int lineno, const char* module_name, const char* log, uint16_t size) {} }; ////////////////////////////////////////////////////////////////////////// // 日志宏,方便记录日志 extern ILogger* g_logger; // 只是声明,不是定义,不能赋值哦! extern bool g_null_print_screen; // 当g_logger为空时是否打屏,默认为true #define __MYLOG_DETAIL(logger, module_name, format, ...) \ do { \ if (NULL == logger) { \ if (::mooon::sys::g_null_print_screen) { \ fprintf(stderr, "[DETAIL][%s:%d]", __FILE__, __LINE__); \ fprintf(stderr, format, ##__VA_ARGS__); \ } \ } \ else if (logger->enabled_detail()) { \ logger->log_detail(__FILE__, __LINE__, module_name, format, ##__VA_ARGS__); \ } \ } while(false) // C++11要求PRINT_COLOR_NONE前和PRINT_COLOR_DARY_GRAY后保留一个空格,否则编译报警: // invalid suffix on literal; C++11 requires a space between literal and identifier [-Wliteral-suffix] #define __MYLOG_DEBUG(logger, module_name, format, ...) \ do { \ if (NULL == logger) { \ if (::mooon::sys::g_null_print_screen) { \ fprintf(stderr, PRINT_COLOR_DARY_GRAY "[DEBUG][%s:%d]" PRINT_COLOR_NONE, __FILE__, __LINE__); \ fprintf(stderr, format, ##__VA_ARGS__); \ } \ } \ else if (logger->enabled_debug()) { \ logger->log_debug(__FILE__, __LINE__, module_name, format, ##__VA_ARGS__); \ } \ } while(false) #define __MYLOG_INFO(logger, module_name, format, ...) \ do { \ if (NULL == logger) { \ if (::mooon::sys::g_null_print_screen) { \ fprintf(stderr, "[INFO][%s:%d]", __FILE__, __LINE__); \ fprintf(stderr, format, ##__VA_ARGS__); \ } \ } \ else if (logger->enabled_info()) { \ logger->log_info(__FILE__, __LINE__, module_name, format, ##__VA_ARGS__); \ } \ } while(false) #define __MYLOG_WARN(logger, module_name, format, ...) \ do { \ if (NULL == logger) { \ if (::mooon::sys::g_null_print_screen) { \ fprintf(stderr, PRINT_COLOR_YELLOW "[WARN][%s:%d]" PRINT_COLOR_NONE, __FILE__, __LINE__); \ fprintf(stderr, format, ##__VA_ARGS__); \ } \ } \ else if (logger->enabled_warn()) { \ logger->log_warn(__FILE__, __LINE__, module_name, format, ##__VA_ARGS__); \ } \ } while(false) #define __MYLOG_ERROR(logger, module_name, format, ...) \ do { \ if (NULL == logger) { \ if (::mooon::sys::g_null_print_screen) { \ fprintf(stderr, PRINT_COLOR_RED "[ERROR][%s:%d]" PRINT_COLOR_NONE, __FILE__, __LINE__); \ fprintf(stderr, format, ##__VA_ARGS__); \ } \ } \ else if (logger->enabled_error()) { \ logger->log_error(__FILE__, __LINE__, module_name, format, ##__VA_ARGS__); \ } \ } while(false) #define __MYLOG_FATAL(logger, module_name, format, ...) \ do { \ if (NULL == logger) { \ if (::mooon::sys::g_null_print_screen) { \ fprintf(stderr, PRINT_COLOR_BROWN "[FATAL][%s:%d]" PRINT_COLOR_NONE, __FILE__, __LINE__); \ fprintf(stderr, format, ##__VA_ARGS__); \ } \ } \ else if (logger->enabled_fatal()) { \ logger->log_fatal(__FILE__, __LINE__, module_name, format, ##__VA_ARGS__); \ } \ } while(false) #define __MYLOG_STATE(logger, module_name, format, ...) \ do { \ if (NULL == logger) { \ if (::mooon::sys::g_null_print_screen) { \ fprintf(stderr, "[STATE][%s:%d]", __FILE__, __LINE__); \ fprintf(stderr, format, ##__VA_ARGS__); \ } \ } \ else if (logger->enabled_state()) { \ logger->log_state(__FILE__, __LINE__, module_name, format, ##__VA_ARGS__); \ } \ } while(false) #define __MYLOG_TRACE(logger, module_name, format, ...) \ do { \ if (NULL == logger) { \ if (::mooon::sys::g_null_print_screen) { \ fprintf(stderr, "[TRACE][%s:%d]", __FILE__, __LINE__); \ fprintf(stderr, format, ##__VA_ARGS__); \ } \ } \ else if (logger->enabled_trace()) { \ logger->log_trace(__FILE__, __LINE__, module_name, format, ##__VA_ARGS__); \ } \ } while(false) #define __MYLOG_RAW(logger, format, ...) \ do { \ if (NULL == logger) { \ if (::mooon::sys::g_null_print_screen) { \ fprintf(stderr, format, ##__VA_ARGS__); \ } \ } \ else if (logger->enabled_raw()) { \ logger->log_raw(format, ##__VA_ARGS__); \ } \ } while(false) #define __MYLOG_BIN(logger, module_name, log, size) \ do { \ if ((logger != NULL) && logger->enabled_bin()) \ logger->log_bin(__FILE__, __LINE__, module_name, log, size); \ } while(false) #define __MYLOG_DETAIL_ENABLE(logger) (((NULL == logger) && ::mooon::sys::g_null_print_screen) || ((logger != NULL) && (logger->enabled_detail()))) #define __MYLOG_DEBUG_ENABLE(logger) (((NULL == logger) && ::mooon::sys::g_null_print_screen) || ((logger != NULL) && (logger->enabled_debug()))) #define __MYLOG_INFO_ENABLE(logger) (((NULL == logger) && ::mooon::sys::g_null_print_screen) || ((logger != NULL) && (logger->enabled_info()))) #define __MYLOG_ERROR_ENABLE(logger) (((NULL == logger) && ::mooon::sys::g_null_print_screen) || ((logger != NULL) && (logger->enabled_error()))) #define __MYLOG_WARN_ENABLE(logger) (((NULL == logger) && ::mooon::sys::g_null_print_screen) || ((logger != NULL) && (logger->enabled_warn()))) #define __MYLOG_FATAL_ENABLE(logger) (((NULL == logger) && ::mooon::sys::g_null_print_screen) || ((logger != NULL) && (logger->enabled_fatal()))) #define __MYLOG_STATE_ENABLE(logger) (((NULL == logger) && ::mooon::sys::g_null_print_screen) || ((logger != NULL) && (logger->enabled_state()))) #define __MYLOG_TRACE_ENABLE(logger) (((NULL == logger) && ::mooon::sys::g_null_print_screen) || ((logger != NULL) && (logger->enabled_trace()))) #define __MYLOG_RAW_ENABLE(logger) (((NULL == logger) && ::mooon::sys::g_null_print_screen) || ((logger != NULL) && (logger->enabled_raw()))) #define __MYLOG_BIN_ENABLE(logger) (((NULL == logger) && ::mooon::sys::g_null_print_screen) || ((logger != NULL) && (logger->enabled_bin()))) #define MYLOG_ENABLE() (::mooon::sys::g_logger != NULL) #define MYLOG_BIN(log, size) __MYLOG_BIN(::mooon::sys::g_logger, NULL, log, size) #define MYLOG_RAW(format, ...) __MYLOG_RAW(::mooon::sys::g_logger, format, ##__VA_ARGS__) #define MYLOG_TRACE(format, ...) __MYLOG_TRACE(::mooon::sys::g_logger, NULL, format, ##__VA_ARGS__) #define MYLOG_STATE(format, ...) __MYLOG_STATE(::mooon::sys::g_logger, NULL, format, ##__VA_ARGS__) #define MYLOG_FATAL(format, ...) __MYLOG_FATAL(::mooon::sys::g_logger, NULL, format, ##__VA_ARGS__) #define MYLOG_ERROR(format, ...) __MYLOG_ERROR(::mooon::sys::g_logger, NULL, format, ##__VA_ARGS__) #define MYLOG_WARN(format, ...) __MYLOG_WARN(::mooon::sys::g_logger, NULL, format, ##__VA_ARGS__) #define MYLOG_INFO(format, ...) __MYLOG_INFO(::mooon::sys::g_logger, NULL, format, ##__VA_ARGS__) #define MYLOG_DEBUG(format, ...) __MYLOG_DEBUG(::mooon::sys::g_logger, NULL, format, ##__VA_ARGS__) #define MYLOG_DETAIL(format, ...) __MYLOG_DETAIL(::mooon::sys::g_logger, NULL, format, ##__VA_ARGS__) #define MYLOG_DETAIL_ENABLE() __MYLOG_DETAIL_ENABLE(::mooon::sys::g_logger) #define MYLOG_DEBUG_ENABLE() __MYLOG_DEBUG_ENABLE(::mooon::sys::g_logger) #define MYLOG_INFO_ENABLE() __MYLOG_INFO_ENABLE(::mooon::sys::g_logger) #define MYLOG_ERROR_ENABLE() __MYLOG_ERROR_ENABLE(::mooon::sys::g_logger) #define MYLOG_WARN_ENABLE() __MYLOG_WARN_ENABLE(::mooon::sys::g_logger) #define MYLOG_FATAL_ENABLE() __MYLOG_FATAL_ENABLE(::mooon::sys::g_logger) #define MYLOG_STATE_ENABLE() __MYLOG_STATE_ENABLE(::mooon::sys::g_logger) #define MYLOG_TRACE_ENABLE() __MYLOG_TRACE_ENABLE(::mooon::sys::g_logger) #define MYLOG_RAW_ENABLE() __MYLOG_RAW_ENABLE(::mooon::sys::g_logger) #define MYLOG_BIN_ENABLE() __MYLOG_BIN_ENABLE(::mooon::sys::g_logger) SYS_NAMESPACE_END #endif // MOOON_SYS_LOG_H
e987a89a9ec55bd5a476762539e28c97e192915f
826c2762805e39ac1c080091e7f4f642fb41e19a
/ouniverse_2021_whitebox_ue4_source_BAK/2021-3-26/App/Private/Log.cpp
32f36d726fa911c3965b7dcb38771386f17d4968
[]
no_license
legendofceo/ouniverse_ue_cpp_source_deprecated_pre2022
fe625f69210c9c038202b8305495bdf373657ea8
729f12569f805ce74e602f8b13bab0ac318358a5
refs/heads/main
2023-08-12T19:14:39.216646
2021-10-17T16:19:29
2021-10-17T16:19:29
null
0
0
null
null
null
null
UTF-8
C++
false
false
570
cpp
Log.cpp
// Fill out your copyright notice in the Description page of Project Settings. #include "Log.h" void FLogger::SetID(FString InID) { ID = InID; } void FLogger::Write(TEnumAsByte<ELogStatus> Status, TEnumAsByte<ELogVerb> Verbosity, uint8 Indent, bool DataList, FString Text) { FLogEntry NewEntry = FLogEntry(); NewEntry.Status = Status; NewEntry.Verbosity = Verbosity; NewEntry.Indent = Indent; NewEntry.Text = Text; NewEntry.DataList = DataList; NewEntry.Time = FPlatformTime::Seconds(); Entries.Add(NewEntry); UE_LOG(AppLog, Warning, TEXT("%s"), *Text); }
6e0f599e81779c0f7a4626fe8bf640304528ff50
2ea58e27a079135fc976c5ba8765e101049748e0
/headers/DelaunayTriangulation.hh
f74c9fff03e169aac9e13588713ca9a8be22af02
[]
no_license
deutzia/art
1dae62a685f308e2df939223561f63744a6b076e
a6abaf66f68532bc04e0907062b5bb41ec9094ab
refs/heads/master
2021-05-07T17:05:55.204726
2018-02-28T15:52:55
2018-02-28T15:52:55
108,647,734
1
0
null
null
null
null
UTF-8
C++
false
false
830
hh
DelaunayTriangulation.hh
#pragma once #include <algorithm> #include <functional> #include <iomanip> #include <set> #include <vector> #include <SFML/Graphics.hpp> #include "Block.hh" #include "Tools.hh" class DelaunayTriangulation: public Block { private: std::vector<sf::Vector2f> points; // neighbours are kept sorted counterclockwise std::vector<std::set<uint32_t, std::function<bool(uint32_t, uint32_t)>>> neighbours; public: Input<std::vector<sf::Vector2f>>* in_points; Output<std::vector<Triangle>>* out_triangles; private: bool InCircle(uint32_t, uint32_t, uint32_t, uint32_t); void AddEdge(uint32_t, uint32_t); void RemoveEdge(uint32_t, uint32_t); std::vector<uint32_t> ConvexHull(uint32_t, uint32_t); void Delaunay(uint32_t, uint32_t); protected: virtual void Compute() override; public: DelaunayTriangulation(std::string _name); };
b8e494b8cba1a8b252f067bf8441497784e27129
0d3c2375997c4a7f85590bef056954cd98551ebc
/auction/code/bids.h
126d2b63a712a254ec54dd9769f8051c8e0879ec
[]
no_license
jenniferdavid/task_scheduler
fdea6cad30dba32977d20068b1a0ffed950e9534
7f3f102a28a4f8432b74901ab3b7a6477d2b18a3
refs/heads/master
2020-12-24T18:12:36.101015
2015-06-26T16:54:53
2015-06-26T16:54:53
38,122,735
0
0
null
null
null
null
UTF-8
C++
false
false
490
h
bids.h
#ifndef BIDS_H #define BIDS_H #include <string> // // Bids Received During Auction // extern int nBids; extern const int MaxBids; // Names of bidders extern std::string bidBidder[]; // Bid Amounts extern double bidAmounts[]; // Names of items extern std::string bidItems[]; // Time at which bid was placed extern int bidHours[]; extern int bidMinutes[]; extern int bidSeconds[]; /** * Read all bids from the indicated file */ void readBids (std::string fileName); #endif
1374a710b633f607eb28c1172fecc2d15a80120b
cc91a1c30f6c5a176b225bdbf96c7bfd6dfeca52
/external/vulkancts/framework/vulkan/vkShaderToSpirV.hpp
684312911d5098d01d91071eb720590810654b7c
[ "Apache-2.0" ]
permissive
KhronosGroup/VK-GL-CTS
d07b2611dc3a258b5be4ff87c1fe55623f32bac1
a745d5c29c5609cb7805f59444520a7700cf39d1
refs/heads/main
2023-08-31T19:34:48.447202
2023-08-25T13:17:54
2023-08-25T13:17:54
50,466,830
454
267
Apache-2.0
2023-09-02T20:49:14
2016-01-26T23:29:28
C++
UTF-8
C++
false
false
2,928
hpp
vkShaderToSpirV.hpp
#ifndef _VKSHADERTOSPIRV_HPP #define _VKSHADERTOSPIRV_HPP /*------------------------------------------------------------------------- * Vulkan CTS Framework * -------------------- * * Copyright (c) 2015 Google Inc. * * 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. * *//*! * \file * \brief Shading language (GLSL/HLSL) to SPIR-V. *//*--------------------------------------------------------------------*/ #include "vkDefs.hpp" #include "vkPrograms.hpp" #include "gluShaderProgram.hpp" #include <ostream> namespace vk { /*--------------------------------------------------------------------*//*! * \brief Compile GLSL program to SPIR-V binary * \param src * \param dst * \param buildInfo * \return True if compilation and linking succeeded, false otherwise * * If deqp was built without glslang (and thus compiler is not available) * tcu::NotSupportedError will be thrown instead. * * \note No linking is currently supported so src may contain source * for only one shader stage. *//*--------------------------------------------------------------------*/ bool compileGlslToSpirV (const GlslSource& src, std::vector<deUint32>* dst, glu::ShaderProgramInfo* buildInfo); /*--------------------------------------------------------------------*//*! * \brief Compile HLSL program to SPIR-V binary * \param src * \param dst * \param buildInfo * \return True if compilation and linking succeeded, false otherwise * * If deqp was built without glslang (and thus compiler is not available) * tcu::NotSupportedError will be thrown instead. * * \note No linking is currently supported so src may contain source * for only one shader stage. *//*--------------------------------------------------------------------*/ bool compileHlslToSpirV (const HlslSource& src, std::vector<deUint32>* dst, glu::ShaderProgramInfo* buildInfo); /*--------------------------------------------------------------------*//*! * \brief Strip SPIR-V binary * \param src * \param dst * * Removes OpName and OpMemberName opcodes from SPIR-V binary * * If deqp was built without glslang (and thus compiler is not available) * tcu::NotSupportedError will be thrown instead. *//*--------------------------------------------------------------------*/ void stripSpirVDebugInfo (const size_t numSrcInstrs, const deUint32* srcInstrs, std::vector<deUint32>* dst); } // vk #endif // _VKSHADERTOSPIRV_HPP
668849d56a00216b5a4ef0033f89c2e340857b94
eae7a6314b343ba4be97fe11dc151542a62b31f6
/C++ Codes/piece.cpp
be4219d892b7458cbff5bde30919ce8f554c42f6
[]
no_license
Teo-Roussel/TDLOG-2021-ECHECS
67bf46bb0323f349705d81a9d0394fce698f3ba5
c3756af4c781c80c636e0c9f1652aaeb1f28815c
refs/heads/main
2023-03-07T06:09:06.635391
2021-02-20T13:48:11
2021-02-20T13:48:11
328,960,271
1
0
null
null
null
null
UTF-8
C++
false
false
2,439
cpp
piece.cpp
#include "piece.h" map<string, int> init_mapOfValues() { std::map<std::string, int> map; map.insert(std::make_pair("vide", 0)); map.insert(std::make_pair("roi", 20000)); map.insert(std::make_pair("dame", 900)); map.insert(std::make_pair("tour", 500)); map.insert(std::make_pair("cavalier", 320)); map.insert(std::make_pair("fou", 330)); map.insert(std::make_pair("pion", 100)); return map; } map<int, int> init_mapOfValues_() { std::map<int, int> map; map.insert(std::make_pair(6, 0)); map.insert(std::make_pair(4, 20000)); map.insert(std::make_pair(3, 900)); map.insert(std::make_pair(0, 500)); map.insert(std::make_pair(1, 320)); map.insert(std::make_pair(2, 330)); map.insert(std::make_pair(5, 100)); return map; } // ===========| Empty constructor |============= Piece::Piece(){ id = 6; is_white = false; // the piece is not white, since she is empty // to know if a piece is black or white, we can't limit a test on a piece // to a test on the boolean 'is_white'. We have also to know if the piece is non empty } Piece::Piece(int piece_id, bool player_color){ if (piece_id < 0 || piece_id > 6) throw "piece_id should verify : 0 <= piece_id <= 6"; id = piece_id; is_white = player_color; } Piece::Piece(string name, bool player_color){ is_white = player_color; bool id_found = false; for (int i=0; i<7 && !id_found; i++) if (name_array[i] == name) { id = i; id_found = true; } if (!id_found) throw "the name is not correct"; } string Piece::getName() const { return name_array[id]; } bool Piece::isWhite() const{return is_white;} int Piece::getId() const {return id;} bool Piece::operator==(const Piece& piece) const{ return (id == piece.id && is_white== piece.is_white); } bool Piece::operator!=(const Piece& piece) const{ return (id != piece.id || is_white != piece.is_white); } std::string const name_array_affichage[7] = {"tour", "cava", "fou ", "dame", "roi ", "pion", "vide"}; std::ostream & operator<<(std::ostream &os, const Piece &piece) { os << ((piece.id == 6) ? " v " : (piece.is_white ? ( name_array_affichage[piece.getId()] + " Blanc" ): (name_array_affichage[piece.getId()] + " Noir"))); return os; }
cafcfe5072121e0a7b038c3a3d866c5f92ffad94
bc8a89a4911fc31c1ae50944889f5a81c0e4832f
/10115.cpp
05ee2d14965b9039b894ae155d543c073cca9228
[]
no_license
thierrychou/uva_online_judge
44616c1368176b16871a3cecbaff8c220e53680e
8a8a1493dec163c46a816785c66cfc65af6abc65
refs/heads/master
2023-03-28T12:12:10.499713
2021-03-21T12:23:33
2021-03-21T12:23:33
349,991,527
0
0
null
null
null
null
UTF-8
C++
false
false
679
cpp
10115.cpp
#include <cstdio> #include <cstring> #include <iostream> #include <string> int r; char rule_find[11][81]; char rule_replace[11][81]; int main() { while(scanf("%d", &r)!=EOF) { if(r==0) break; getchar(); for(int i=0; i<r; ++i) { gets(rule_find[i]); gets(rule_replace[i]); } std::string text; getline(std::cin, text); for(int i=0; i<r; ++i) { size_t pos; size_t len = strlen(rule_find[i]); while((pos = text.find(rule_find[i])) != std::string::npos) { text.replace(pos, len, rule_replace[i]); } } printf("%s\n", text.c_str()); } }
d9ea46c5168cb146db5b0bd2184c22168ddf503f
7df0ba90e096d987fe55e89bf64f92985cb03906
/Modules/PhotoacousticsLib/MitkSpectralUnmixing/SpectralUnmixingAppTimeEval.cpp
1c484128bae91ce17d097ca805810a1e936d627f
[ "BSD-3-Clause", "LicenseRef-scancode-free-unknown" ]
permissive
SVRTK/MITK
04eb6a54292a6da7c445cdf5a275b9b4addf6e21
52252d60e42702e292d188e30f6717fe50c23962
refs/heads/master
2022-06-04T20:47:10.398158
2020-04-27T10:29:27
2020-04-27T10:29:27
259,278,772
0
0
BSD-3-Clause
2020-04-27T10:19:57
2020-04-27T10:19:56
null
UTF-8
C++
false
false
10,760
cpp
SpectralUnmixingAppTimeEval.cpp
/*============================================================================ The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center (DKFZ) All rights reserved. Use of this source code is governed by a 3-clause BSD license that can be found in the LICENSE file. ============================================================================*/ //#include <boost> #include <chrono> #include <mitkCommon.h> #include "mitkPALinearSpectralUnmixingFilter.h" #include "mitkPASpectralUnmixingFilterBase.h" #include "mitkPASpectralUnmixingFilterVigra.h" #include "mitkPASpectralUnmixingSO2.h" #include <mitkCommandLineParser.h> #include <mitkException.h> #include <mitkIOUtil.h> #include <mitkUIDGenerator.h> #include <itksys/SystemTools.hxx> #include "mitkPreferenceListReaderOptionsFunctor.h" struct InputParameters { std::string inputPath; std::string outputPath; int numberOfInputs; }; InputParameters parseInput(int argc, char *argv[]) { MITK_INFO << "Parsing arguments..."; mitkCommandLineParser parser; parser.setCategory("MITK-Photoacoustics"); parser.setTitle("Mitk Spectral Unmixing App"); parser.setDescription("Batch processing for spectral unmixing."); parser.setContributor("Computer Assisted Medical Interventions, DKFZ"); parser.setArgumentPrefix("--", "-"); parser.beginGroup("Required parameters"); parser.addArgument("inputPath", "i", mitkCommandLineParser::Directory, "Input folder (directory)", "input folder", us::Any(), false, false, false, mitkCommandLineParser::Input); parser.addArgument("outputPath", "o", mitkCommandLineParser::Directory, "Input save folder (directory)", "input save folder", us::Any(), false, false, false, mitkCommandLineParser::Output); parser.addArgument("numberOfInputs", "n", mitkCommandLineParser::Int, "Number of Input files", "number of inputs", us::Any(), false); parser.endGroup(); InputParameters input; std::map<std::string, us::Any> parsedArgs = parser.parseArguments(argc, argv); if (argc == 0) exit(-1); for (int i = 0; i < argc; ++i) { MITK_INFO << argv[i]; } if (parsedArgs.count("inputPath")) { input.inputPath = us::any_cast<std::string>(parsedArgs["inputPath"]); } else { MITK_ERROR << "Error: No inputPath"; mitkThrow() << "Error: No inputPath"; } if (parsedArgs.count("outputPath")) { input.outputPath = us::any_cast<std::string>(parsedArgs["outputPath"]); } else { MITK_ERROR << "Error: No outputPath"; mitkThrow() << "Error: No outputPath"; } if (parsedArgs.count("numberOfInputs")) { input.numberOfInputs = us::any_cast<int>(parsedArgs["numberOfInputs"]); } else { MITK_ERROR << "Error: No number of Inputs"; mitkThrow() << "Error: No number of Inputs"; } MITK_INFO << "Parsing arguments...[Done]"; return input; } mitk::pa::SpectralUnmixingFilterBase::Pointer GetFilterInstance(std::string algorithm) { mitk::pa::SpectralUnmixingFilterBase::Pointer spectralUnmixingFilter; if (algorithm == "QR") { spectralUnmixingFilter = mitk::pa::LinearSpectralUnmixingFilter::New(); dynamic_cast<mitk::pa::LinearSpectralUnmixingFilter *>(spectralUnmixingFilter.GetPointer()) ->SetAlgorithm(mitk::pa::LinearSpectralUnmixingFilter::AlgortihmType::HOUSEHOLDERQR); } else if (algorithm == "SVD") { spectralUnmixingFilter = mitk::pa::LinearSpectralUnmixingFilter::New(); dynamic_cast<mitk::pa::LinearSpectralUnmixingFilter *>(spectralUnmixingFilter.GetPointer()) ->SetAlgorithm(mitk::pa::LinearSpectralUnmixingFilter::AlgortihmType::JACOBISVD); } else if (algorithm == "LU") { spectralUnmixingFilter = mitk::pa::LinearSpectralUnmixingFilter::New(); dynamic_cast<mitk::pa::LinearSpectralUnmixingFilter *>(spectralUnmixingFilter.GetPointer()) ->SetAlgorithm(mitk::pa::LinearSpectralUnmixingFilter::AlgortihmType::FULLPIVLU); } else if (algorithm == "NNLS") { spectralUnmixingFilter = mitk::pa::SpectralUnmixingFilterVigra::New(); dynamic_cast<mitk::pa::SpectralUnmixingFilterVigra *>(spectralUnmixingFilter.GetPointer()) ->SetAlgorithm(mitk::pa::SpectralUnmixingFilterVigra::VigraAlgortihmType::LARS); } else if (algorithm == "WLS") { spectralUnmixingFilter = mitk::pa::SpectralUnmixingFilterVigra::New(); dynamic_cast<mitk::pa::SpectralUnmixingFilterVigra *>(spectralUnmixingFilter.GetPointer()) ->SetAlgorithm(mitk::pa::SpectralUnmixingFilterVigra::VigraAlgortihmType::WEIGHTED); /*std::vector<int> weigthVec = {39, 45, 47}; for (int i = 0; i < 3; ++i) { dynamic_cast<mitk::pa::SpectralUnmixingFilterVigra *>(spectralUnmixingFilter.GetPointer()) ->AddWeight(weigthVec[i]); }*/ } return spectralUnmixingFilter; } void add_weight(int weights, mitk::pa::SpectralUnmixingFilterBase::Pointer m_SpectralUnmixingFilter) { std::vector<int> weigthVec = { 30, 32, 33, 35, 37, 38, 40, 41, 43, 44, 45, 46, 47, 47, 47, 47, 47, 46, 46, 45, 44, 44, 43, 42, 42, 41 }; for (int i = 0; i < weights; ++i) { dynamic_cast<mitk::pa::SpectralUnmixingFilterVigra *>(m_SpectralUnmixingFilter.GetPointer()) ->AddWeight(weigthVec[i]); } } int main(int argc, char *argv[]) { auto input = parseInput(argc, argv); std::string inputDir = input.inputPath; std::string outputDir = input.outputPath; unsigned int N = input.numberOfInputs; /* //maybee try with "itk system tools" //auto test = itksys::SystemTools::GetFilenameName(argv[0]).c_str(); //MITK_INFO << "test: " << test; / +++ temporary solution BEGIN +++ std::vector<std::string> files; std::string file; for (int i = 1; i < 34; ++i) { if (i < 10) { file = "E:/NHDATA/sdmas_beamformed/merged/static-oxy_sdmas_00" + std::to_string(i) + "_merged.nrrd"; } else { file = "E:/NHDATA/sdmas_beamformed/merged/static-oxy_sdmas_0" + std::to_string(i) + "_merged.nrrd"; } files.push_back(file); } / +++ temporary solution END +++ std::vector<std::string> files; std::string file; for (int i = 0; i < 7; ++i) { file = "E:/NHCAMI/cami-experimental/PAI/spectralUnmixing/inSilico/paImages/selection/noiselevel1_rep1000_wavelength_selction_data_" + std::to_string(i) + ".nrrd"; files.push_back(file); } std::vector<std::string> files; std::string file; file = "E:/NHCAMI/cami-experimental/PAI/spectralUnmixing/inSilico/paImages/selection/noiselevel1_rep1000_wavelength_selction_data.nrrd"; files.push_back(file);*/ std::vector<std::string> algorithms = { "QR", "LU", "SVD", "NNLS", "WLS" }; int repetition = 6000; for (unsigned alg = 0; alg < 5; ++alg) { ofstream myerrorfile; myerrorfile.open("E:/NHDATA/time/time_evaluation_" + std::to_string(repetition)+"_" + algorithms[alg] + "_new02.txt"); int ctr = 0; for(int i = 2; i < 27; ++i) { myerrorfile << std::to_string(i) + "\t"; std::string file; if (i < 10) file = "E:/NHDATA/time/input/time_0" + std::to_string(i) + ".nrrd"; else file = "E:/NHDATA/time/input/time_" + std::to_string(i) + ".nrrd"; auto m_inputImage = mitk::IOUtil::Load<mitk::Image>(file); MITK_INFO << "File: " << i; for (int j = 0; j < repetition; ++j) { std::chrono::steady_clock::time_point _start; _start = std::chrono::steady_clock::now(); mitk::pa::SpectralUnmixingFilterBase::Pointer m_SpectralUnmixingFilter = GetFilterInstance(algorithms[alg]); m_SpectralUnmixingFilter->SetInput(m_inputImage); m_SpectralUnmixingFilter->AddOutputs(2); m_SpectralUnmixingFilter->Verbose(false); m_SpectralUnmixingFilter->RelativeError(false); m_SpectralUnmixingFilter->AddChromophore(mitk::pa::PropertyCalculator::ChromophoreType::OXYGENATED); m_SpectralUnmixingFilter->AddChromophore(mitk::pa::PropertyCalculator::ChromophoreType::DEOXYGENATED); for (int wl = 0; wl < i; ++wl) { m_SpectralUnmixingFilter->AddWavelength(700 + wl * 10); } if (alg == 4) { add_weight(i, m_SpectralUnmixingFilter); } m_SpectralUnmixingFilter->Update(); auto output1 = m_SpectralUnmixingFilter->GetOutput(0); auto output2 = m_SpectralUnmixingFilter->GetOutput(1); m_SpectralUnmixingFilter = nullptr; std::chrono::steady_clock::time_point _end(std::chrono::steady_clock::now()); myerrorfile << std::chrono::duration_cast<std::chrono::duration<double>>(_end - _start).count() << "\t"; /*std::string unmixingOutputHbO2 = "E:/NHDATA/time/output/time_" + std::to_string(i) + ".nrrd"; std::string unmixingOutputHb = "E:/NHDATA/time/output/time_" + std::to_string(i) + ".nrrd"; mitk::IOUtil::Save(output1, unmixingOutputHbO2); mitk::IOUtil::Save(output2, unmixingOutputHb); //auto m_sO2 = mitk::pa::SpectralUnmixingSO2::New(); //m_sO2->Verbose(false); //auto output1 = m_SpectralUnmixingFilter->GetOutput(0); //auto output2 = m_SpectralUnmixingFilter->GetOutput(1); //std::string unmixingOutputHbO2 ="E:/NHDATA/time/input/time_" + std::to_string(i) + ".nrrd"; //std::string unmixingOutputHb = outputDir + "/SUOutput/" + "Hb_" + algorithms[alg] + "_" + str_ctr + ".nrrd"; //mitk::IOUtil::Save(output1, unmixingOutputHbO2); //mitk::IOUtil::Save(output2, unmixingOutputHb); //m_sO2->SetInput(0, output1); //m_sO2->SetInput(1, output2); //m_sO2->Update(); //mitk::Image::Pointer sO2 = m_sO2->GetOutput(0); //sO2->SetSpacing(output1->GetGeometry()->GetSpacing()); //std::string outputSo2 = outputDir + "/So2/" + algorithms[alg] + "/So2_" + algorithms[alg] + "_" + str_ctr + ".nrrd"; //std::string outputSo2 = outputDir + "/" + algorithms[alg] + "_sel_" + str_ctr + ".nrrd"; //std::string outputSo2 = outputDir + "/" + algorithms[alg] + "_sel.nrrd"; //mitk::IOUtil::Save(sO2, outputSo2); //std::string outputSo2 = "E:/NHDATA/time/output/time_" + std::to_string(i) + algorithms[alg] + ".nrrd"; //mitk::IOUtil::Save(sO2, outputSo2);*/ } myerrorfile << "\n"; } myerrorfile.close(); } MITK_INFO << "Spectral Unmixing DONE"; }
f37f50e350118d4184076adebf5e920a6868cf60
cc16d9f71b69e10b35a16e4693a13eb9f5e09da9
/lib/RequestHandler.h
06d6352295de92cdba0117718506367191dc98a4
[]
no_license
dadarek/HTTP-Server
5b15b5e2a205e6d8b9a31e70c7302617238a0b28
179e96d0e99d20e953b97824588ce24a246149d6
refs/heads/master
2021-01-02T09:08:17.184727
2012-05-03T19:44:24
2012-05-03T19:44:24
null
0
0
null
null
null
null
UTF-8
C++
false
false
180
h
RequestHandler.h
#ifndef REQUEST_HANDLER_H #define REQUEST_HANDLER_H class RequestHandler { public: virtual ~RequestHandler() { } virtual void handle( int connection ) = 0; }; #endif
76aa20b4ccb07a6e9d29f26029e3ca0086bbc939
d4b89555ae0f158b1e616f66fb1e04b1e6623c77
/inc/tp_image_utils_functions/ReduceColors.h
f1d788a74f6e23a53a763e0c7be90c185f129978
[ "MIT" ]
permissive
tdp-libs/tp_image_utils_functions
fa4fb9fe68ecf414355df55a1d77e6ced37f26df
bd5e466e13ea4e92d811ea5eca3eabc06c871c95
refs/heads/master
2022-07-04T08:56:44.274781
2022-06-14T09:47:17
2022-06-14T09:47:17
168,352,161
0
2
null
null
null
null
UTF-8
C++
false
false
789
h
ReduceColors.h
#ifndef tp_image_utils_functions_ReduceColors_h #define tp_image_utils_functions_ReduceColors_h #include "tp_image_utils_functions/Globals.h" #include "tp_image_utils/ByteMap.h" namespace tp_image_utils_functions { //################################################################################################## //! Reduce the number of colors in an image /*! This will produce an image with a reduced color palette. \param src - The source image; \return A copy of the source image rendered with. */ tp_image_utils::ColorMap reduceColors(const tp_image_utils::ColorMap& src, int colorCount); //################################################################################################## tp_image_utils::ByteMap reduceColors(const tp_image_utils::ByteMap& src); } #endif
0e37d7519130df5b807a01b66805277db85ac1ae
a214c4fd5e7cddbf54ea4893a37a3130f579c2d6
/Tetris/src/MenuState.cpp
b209ee38e1628e59475632203afe4ad30c2be84d
[]
no_license
LouiseBC/Tetris
00c1bdd641bef1cbf4abd751fc3eba51f29ccc9b
ee9e89c6d6d65c732838952b67d294249270964d
refs/heads/master
2020-05-23T09:07:56.006860
2017-05-12T13:16:34
2017-05-12T13:16:34
80,435,774
0
0
null
null
null
null
UTF-8
C++
false
false
2,555
cpp
MenuState.cpp
#include "MenuState.hpp" #include "MainState.hpp" #include "Engine.hpp" bool MenuState::init(Engine* gam, Graphics* graphs) { game = gam; graphics = graphs; set_text("Press Enter to Start"); set_playopt_text("1P", "AI"); selection = SDL_Rect{ humanPos.x - 3, humanPos.y - 3, humanPos.w + 6, humanPos.h + 3 }; return true; } void MenuState::handle_input(SDL_Event& event) { if (event.type == SDL_QUIT) game->setQuit(); if (event.type == SDL_KEYDOWN) { if (event.key.keysym.sym == SDLK_ESCAPE) game->setQuit(); if (event.key.keysym.sym == SDLK_RETURN) game->changeState(std::unique_ptr<GameState>(new MainState(gameType))); if (event.key.keysym.sym == SDLK_RIGHT || event.key.keysym.sym == SDLK_LEFT) change_gametype(); } } void MenuState::change_gametype() { int xDiff = aiPos.x - humanPos.x; int wDiff = aiPos.w - humanPos.w; // Current setting: Human if (gameType == true) { selection.x += xDiff; selection.w += wDiff; gameType = false; } // Current setting: AI else { selection.x -= xDiff; selection.w -= wDiff; gameType = true; } } void MenuState::update(const float& dt) { } void MenuState::set_text(const std::string msg) { text = graphics->renderText(msg, fontPath, fontColour, 25); int W; int H; SDL_QueryTexture(text, NULL, NULL, &W, &H); textPos = SDL_Rect{ static_cast<int>(graphics::WINDOW_WIDTH*0.5 - W*0.5), static_cast<int>(graphics::WINDOW_HEIGHT*0.35 - H*0.5), W, H }; } void MenuState::set_playopt_text(const std::string msg, const std::string msg2) { playHuman = graphics->renderText(msg, fontPath, fontColour, 25); playAI = graphics->renderText(msg2, fontPath, fontColour, 25); int W; int H; SDL_QueryTexture(playHuman, NULL, NULL, &W, &H); humanPos = SDL_Rect{ 160, 250, W, H }; SDL_QueryTexture(playAI, NULL, NULL, &W, &H); aiPos = SDL_Rect{ humanPos.x+humanPos.w + 30, humanPos.y, W, H }; } void MenuState::render() { graphics->clear(); SDL_SetRenderDrawColor(graphics->renderer(), 251, 188, 5, 255); SDL_RenderFillRect(graphics->renderer(), &selection); SDL_RenderCopy(graphics->renderer(), text, NULL, &textPos); SDL_RenderCopy(graphics->renderer(), playHuman, NULL, &humanPos); SDL_RenderCopy(graphics->renderer(), playAI, NULL, &aiPos); graphics->present(); }
b2919710802aa486e0c2952ed3125d32e3a17483
7f46711b34706b107b7bc22e4b591f7ca216d127
/LegendDataEditor/LegendDataEditor/Sqlite/Table/SQLiteSubRegion.h
e2496a3fe7e0777df9a45eb2d958e4ae0cda3189
[]
no_license
Hengle/GameEditor
a58fc96ab79be6c7a36369e50d10081c4884d782
241751352b4c92747914c039ff31dba1973e70ea
refs/heads/master
2023-04-01T02:07:23.283248
2021-03-24T12:43:25
2021-03-24T12:43:25
null
0
0
null
null
null
null
UTF-8
C++
false
false
782
h
SQLiteSubRegion.h
#ifndef _SQLITE_SUB_REGION_H_ #define _SQLITE_SUB_REGION_H_ #include "SQLiteTable.h" #include "SQLiteTableData.h" class SubRegionData : public SQLiteTableData { public: static string COL_ID; static string COL_NAME; static string COL_MAP_ID; static string COL_POSITION; static string COL_SIZE; public: int mID; string mName; int mMapID; Vector2i mPosition; Vector2i mSize; public: SubRegionData() { REGISTE_PARAM(mID, COL_ID); REGISTE_PARAM(mName, COL_NAME); REGISTE_PARAM(mMapID, COL_MAP_ID); REGISTE_PARAM(mPosition, COL_POSITION); REGISTE_PARAM(mSize, COL_SIZE); } }; class SQLiteSubRegion : public SQLiteTable { public: SQLiteSubRegion(SQLite* sqlite) :SQLiteTable("SceneMapSubRegion", sqlite){} bool update(const SubRegionData& data); }; #endif
5a7150cef18e6939dab595c87dcdb16550f01811
69b84f8184263b38af9af765bfdf664676df9ca8
/TrainingGL/src/Scene.cpp
494d918248cd16687f3720ccec2ae6368d3fce46
[]
no_license
balajeerc/SolarGL
c850699e844fdd408006885ede2dea4c16ef7649
f2f59a28aaedb07d4c57f8b63581087a113bd451
refs/heads/master
2020-06-03T18:32:24.501634
2013-06-28T07:56:00
2013-06-28T07:56:00
null
0
0
null
null
null
null
UTF-8
C++
false
false
4,105
cpp
Scene.cpp
#include "AppClock.h" #include "ResourceManager.h" #include "Scene.h" namespace SolarGL { Scene::Scene() { } Scene::~Scene() { std::map<std::string, Model*>::iterator iter; for(iter=_models.begin(); iter!=_models.end(); ++iter) { Model* iterModel = iter->second; delete iterModel; } } void Scene::prepare() { _camera.setPerspective(45.f, 640.f/480.f, 1.f, 100.f); _camera.lookAt(vec3(0.f, 10.f, 30.f), //camera location vec3(0.f, 0.f, 0.f), //target location vec3(0.f, 1.f, -5.f)); //up direction ResourceManager* resMgr = ResourceManager::get(); //Create an instance of the PerPixel shader Shader* shader = resMgr->getShader(".\\data\\shaders\\PerPixelLighting_VS.glsl", ".\\data\\shaders\\PerPixelLighting_FS.glsl"); Shader* sunShader = resMgr->getShader(".\\data\\shaders\\SimpleImage_VS.glsl", ".\\data\\shaders\\SimpleImage_FS.glsl"); //shader = sunShader; _shaders[DYNAMIC_LIGHTING] = shader; _shaders[STATIC_LIGHTING] = sunShader; Mesh* mesh; Texture* texture; // Now we load the planets //Load the sun's mesh and texture mesh = resMgr->getMesh(".\\data\\meshes\\sun_mesh.json"); texture = resMgr->getTexture(".\\data\\images\\sunMap.jpg"); _sun = new Model(); _sun->setTexture(texture); _sun->setMesh(mesh); _sun->setShader(sunShader); _sun->rotationSpeed = 15.f; //degrees per second _models["sun"] = _sun; mesh = resMgr->getMesh(".\\data\\meshes\\earth_mesh.json"); texture = resMgr->getTexture(".\\data\\images\\earthMap.jpg"); _earth = new Model(); _earth->setTexture(texture); _earth->setMesh(mesh); _earth->setShader(shader); _earth->getNode()->moveTo(vec3(15.f, 0.f, 0.f)); _earth->getNode()->setParent(_sun->getNode()); _earth->rotationSpeed = 30.f; //degrees per second _models["earth"] = _earth; mesh = resMgr->getMesh(".\\data\\meshes\\moon_mesh.json"); texture = resMgr->getTexture(".\\data\\images\\moonMap.png"); _moon = new Model(); _moon->setTexture(texture); _moon->setMesh(mesh); _moon->setShader(shader); _moon->getNode()->setParent(_earth->getNode()); _moon->getNode()->moveTo(vec3(5.f, 3.f, 0.f)); _models["moon"] = _moon; AppClock timer; _timeAtLastFrame = timer.getTimeElapsed(); } void Scene::update(const double& timeElapsed) { std::map<std::string, Model*>::iterator iter; for(iter=_models.begin(); iter!=_models.end(); ++iter) { Model* iterModel = iter->second; double timeSinceLastFrame = timeElapsed - _timeAtLastFrame; float earthRotation = ((float)timeSinceLastFrame)*_earth->rotationSpeed; _earth->getNode()->rotate(vec3(0.f, earthRotation, 0.f)); float sunRotation = ((float)timeSinceLastFrame)*_sun->rotationSpeed; _sun->getNode()->rotate(vec3(0.f, sunRotation, 0.f)); iterModel->render(_camera.getProjectionMatrix(), _camera.getViewMatrix()); //Reset timer _timeAtLastFrame = timeElapsed; } } void Scene::toggleLightingMode() { LightingMode currentMode = _lightingMode; if(_lightingMode==DYNAMIC_LIGHTING) { _lightingMode = STATIC_LIGHTING; } else { _lightingMode = DYNAMIC_LIGHTING; } _earth->setShader(_shaders[_lightingMode]); _moon->setShader(_shaders[_lightingMode]); } }
a83118e08dd1af0bdad6b3ab99c697fede4545ab
3d59edf172b41c0dea19d2019910c66ddc739ea0
/MyProj/delegate.h
119bf443d2461ed9a46df8928475605ca74b8107
[]
no_license
shahabbadihi/airport_managementt
d61ee18feecdb0e9fdfb478a63f501cda2c0149b
b6284df6447ac94207c6b6564d23dd654fb84ef9
refs/heads/master
2022-12-18T08:49:14.817773
2020-09-03T09:42:28
2020-09-03T09:42:28
265,501,543
0
0
null
null
null
null
UTF-8
C++
false
false
416
h
delegate.h
#ifndef TEXTBOXDELEGATE_H #define TEXTBOXDELEGATE_H #include <QObject> #include <QItemDelegate> class Delegate : public QItemDelegate { Q_OBJECT public: Delegate(QObject *parent = 0); void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const override; void setEditorData(QWidget *editor, const QModelIndex &index) const override; }; #endif // TEXTBOXDELEGATE_H
7fc03d7140ec36f1c237658b2332aec784150a3b
3316da2bf9c4d6a47413d12e13d06541b21f3afd
/cacheSim.cc
1a074d08d8d8cb8fecccea319d9a6e8617176e7e
[]
no_license
maniktyg/Cache-and-Memory-Hierarchy-Design
efd5adf9bc474d44af6e5c98d1785aeb3b12d3fd
27b1e5ff9bf56dff353f0aa75d5253b8c5c63393
refs/heads/master
2020-08-05T06:12:02.182091
2016-08-26T05:28:56
2016-08-26T05:28:56
66,608,279
0
0
null
null
null
null
UTF-8
C++
false
false
3,582
cc
cacheSim.cc
#include <iostream> #include <fstream> #include <sstream> #include <string> #include "BaseCache.h" using namespace std; int main(int argc, char **argv) { string inp_line, parsed_line, memfoot_line, mem_parsed; string command; unsigned int address, data; unsigned int mem_addr, mem_data; uint32_t cacheSize_L1, associativity_L1, blockSize_L1,cacheSize_L2, associativity_L2, blockSize_L2; cacheSize_L1 = atoi(argv[1]); associativity_L1 = atoi(argv[2]); blockSize_L1 = atoi(argv[3]); cacheSize_L2 = atoi(argv[4]); associativity_L2 = atoi(argv[5]); blockSize_L2 = atoi(argv[6]); ifstream fp_inp(argv[7]); BaseCache BaseCache(cacheSize_L1, associativity_L1, blockSize_L1,cacheSize_L2, associativity_L2, blockSize_L2); ifstream memfoot_inp; memfoot_inp.open("memfoot.dat"); if(memfoot_inp.is_open()) { while(getline(memfoot_inp, memfoot_line)) { stringstream inp_mem(memfoot_line); if(getline(inp_mem,mem_parsed, ' ')) { mem_addr = stoul(mem_parsed, NULL, 16); } if(getline(inp_mem,mem_parsed, ' ')) { mem_data = stoul(mem_parsed, NULL, 16); } BaseCache.writeToMem(mem_addr, mem_data); } memfoot_inp.close(); } if(fp_inp.is_open()) { while(getline(fp_inp, inp_line)) { stringstream inp_string(inp_line); if(getline(inp_string,parsed_line, ' ')) command = parsed_line; if(getline(inp_string,parsed_line, ' ')) address = stoul(parsed_line, NULL, 16); if (!(command.compare("w"))) { if(getline(inp_string,parsed_line, ' ')) { data = stoul(parsed_line, NULL, 16); } } //Issue read/write command if (!(command.compare("w"))) { (BaseCache.write(address, data)); } if (!(command.compare("r"))) { (BaseCache.read(address, &data)); BaseCache.getMaxAccessTime(); BaseCache.getMinAccessTime(); } } fp_inp.close(); } cout <<endl; cout << "L1 Read Hits (HitRate): "<<BaseCache.getReadHits_L1()<<" ("<<BaseCache.getReadHitRate_L1()<<"%)"<<endl; cout << "L1 Read Misses (MissRate): "<<BaseCache.getReadMisses_L1() <<" ("<<BaseCache.getReadMissRate_L1()<<"%)"<<endl; cout << "L1 Write Hits (HitRate): "<<BaseCache.getWriteHits_L1()<<" ("<<BaseCache.getWriteHitRate_L1()<<"%)"<<endl; cout << "L1 Write Misses (MissRate): "<<BaseCache.getWriteMisses_L1() <<" ("<<BaseCache.getWriteMissRate_L1()<<"%)"<<endl; cout << "L1 Overall Hit Rate: "<<BaseCache.getOverallHitRate_L1() <<"%" << endl; cout << "L1 Overall Miss Rate: "<<BaseCache.getOverallMissRate_L1()<<"%"<<endl; cout <<endl; cout << "L2 Read Hits (HitRate): "<<BaseCache.getReadHits_L2()<<" ("<<BaseCache.getReadHitRate_L2()<<"%)"<<endl; cout << "L2 Read Misses (MissRate): "<<BaseCache.getReadMisses_L2() <<" ("<<BaseCache.getReadMissRate_L2()<<"%)"<<endl; cout << "L2 Write Hits (HitRate): "<<BaseCache.getWriteHits_L2()<<" ("<<BaseCache.getWriteHitRate_L2()<<"%)"<<endl; cout << "L2 Write Misses (MissRate): "<<BaseCache.getWriteMisses_L2() <<" ("<<BaseCache.getWriteMissRate_L2()<<"%)"<<endl; cout << "L2 Overall Hit Rate: "<<BaseCache.getOverallHitRate_L2() <<"%" << endl; cout << "L2 Overall Miss Rate: "<<BaseCache.getOverallMissRate_L2()<<"%"<<endl; cout <<endl; cout << "Average memory access time (AMAT) (Reads): "<<BaseCache.getHitTime()<<"ns"<<endl; cout << "Minimum access time: "<<BaseCache.getMinAccessTime()<<"ns"<<endl; cout << "Maximum access time: "<<BaseCache.getMaxAccessTime()<<"ns"<<endl; return 1; }
1722218224f87f96b75b8f154dce2d6532a4b657
d8673bfb859b4c9e822f08d6b0444c2b13d5e42e
/Test/BlackScholesSim.hpp
5a4b04e451a4179714df67f87eafbebff588962e
[]
no_license
tholuck20/FinancialMarkets
d43f8a8676bc78630e84512c2488176356c79e8f
cec7aeaf2cd0653ad8dc100024236ca984a64e51
refs/heads/master
2021-01-21T04:48:14.791783
2016-06-15T09:52:59
2016-06-15T09:52:59
47,772,572
0
0
null
null
null
null
UTF-8
C++
false
false
337
hpp
BlackScholesSim.hpp
#pragma once #include <math.h> #include <vector> #include <time.h> using namespace std; class CBlackScholesSim { public: CBlackScholesSim(void); ~CBlackScholesSim(void); vector<vector<double> > CBlackScholesSim::GenerateBSpaths(double S0,double T,double rf,double q,double v,int NS,int NT); };
44dbe066dd2ce3cdf2a627b9670ee72b707bcbe5
46471710a7d02acaa4e0a9e61a51de6c349d5cf3
/FaceCheck/sqlite3/CMPNT_h.h
735fcfc3dc467806c1d3d32f9d093d701ef8e701
[]
no_license
heyuankuo/winserver
f194e4da1db775f34357ad49e4e15b43d1f5894b
97302a8560a2fb76c4e0bfdc537f4f043004c48b
refs/heads/master
2021-01-01T06:36:50.331220
2017-07-18T10:40:25
2017-07-18T10:40:25
97,469,462
0
0
null
null
null
null
UTF-8
C++
false
false
5,176
h
CMPNT_h.h
/* this ALWAYS GENERATED file contains the definitions for the interfaces */ /* File created by MIDL compiler version 8.00.0603 */ /* at Thu Jun 22 18:12:21 2017 */ /* Compiler settings for CMPNT.idl: Oicf, W1, Zp8, env=Win32 (32b run), target_arch=X86 8.00.0603 protocol : dce , ms_ext, c_ext, robust error checks: allocation ref bounds_check enum stub_data VC __declspec() decoration level: __declspec(uuid()), __declspec(selectany), __declspec(novtable) DECLSPEC_UUID(), MIDL_INTERFACE() */ /* @@MIDL_FILE_HEADING( ) */ #pragma warning( disable: 4049 ) /* more than 64k source lines */ /* verify that the <rpcndr.h> version is high enough to compile this file*/ #ifndef __REQUIRED_RPCNDR_H_VERSION__ #define __REQUIRED_RPCNDR_H_VERSION__ 475 #endif #include "rpc.h" #include "rpcndr.h" #ifndef __RPCNDR_H_VERSION__ #error this stub requires an updated version of <rpcndr.h> #endif // __RPCNDR_H_VERSION__ #ifndef COM_NO_WINDOWS_H #include "windows.h" #include "ole2.h" #endif /*COM_NO_WINDOWS_H*/ #ifndef __CMPNT_h_h__ #define __CMPNT_h_h__ #if defined(_MSC_VER) && (_MSC_VER >= 1020) #pragma once #endif /* Forward Declarations */ #ifndef __IFaceDBOS_FWD_DEFINED__ #define __IFaceDBOS_FWD_DEFINED__ typedef interface IFaceDBOS IFaceDBOS; #endif /* __IFaceDBOS_FWD_DEFINED__ */ #ifndef __HykSqliteSys_FWD_DEFINED__ #define __HykSqliteSys_FWD_DEFINED__ #ifdef __cplusplus typedef class HykSqliteSys HykSqliteSys; #else typedef struct HykSqliteSys HykSqliteSys; #endif /* __cplusplus */ #endif /* __HykSqliteSys_FWD_DEFINED__ */ /* header files for imported files */ #include "oaidl.h" #include "ocidl.h" #ifdef __cplusplus extern "C"{ #endif /* interface __MIDL_itf_CMPNT_0000_0000 */ /* [local] */ typedef /* [public][public][public][public] */ struct __MIDL___MIDL_itf_CMPNT_0000_0000_0001 { unsigned char _name[ 16 ]; unsigned char _gender[ 8 ]; int _id; int _feat_len; BYTE *_feats; } UserInfo; typedef /* [public][public] */ struct __MIDL___MIDL_itf_CMPNT_0000_0000_0002 { UserInfo *first_user[ 100 ]; int sum_users; } UserInfos; extern RPC_IF_HANDLE __MIDL_itf_CMPNT_0000_0000_v0_0_c_ifspec; extern RPC_IF_HANDLE __MIDL_itf_CMPNT_0000_0000_v0_0_s_ifspec; #ifndef __IFaceDBOS_INTERFACE_DEFINED__ #define __IFaceDBOS_INTERFACE_DEFINED__ /* interface IFaceDBOS */ /* [unique][helpstring][uuid][object] */ EXTERN_C const IID IID_IFaceDBOS; #if defined(__cplusplus) && !defined(CINTERFACE) MIDL_INTERFACE("32bb8325-b41b-11cf-a6bb-0080c7b2d682") IFaceDBOS : public IUnknown { public: virtual HRESULT STDMETHODCALLTYPE QueryFace( /* [out] */ UserInfos **users) = 0; virtual HRESULT STDMETHODCALLTYPE InserData( /* [in] */ UserInfo *user, /* [in] */ int recoder_id) = 0; virtual HRESULT STDMETHODCALLTYPE LoadData( void) = 0; }; #else /* C style interface */ typedef struct IFaceDBOSVtbl { BEGIN_INTERFACE HRESULT ( STDMETHODCALLTYPE *QueryInterface )( IFaceDBOS * This, /* [in] */ REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); ULONG ( STDMETHODCALLTYPE *AddRef )( IFaceDBOS * This); ULONG ( STDMETHODCALLTYPE *Release )( IFaceDBOS * This); HRESULT ( STDMETHODCALLTYPE *QueryFace )( IFaceDBOS * This, /* [out] */ UserInfos **users); HRESULT ( STDMETHODCALLTYPE *InserData )( IFaceDBOS * This, /* [in] */ UserInfo *user, /* [in] */ int recoder_id); HRESULT ( STDMETHODCALLTYPE *LoadData )( IFaceDBOS * This); END_INTERFACE } IFaceDBOSVtbl; interface IFaceDBOS { CONST_VTBL struct IFaceDBOSVtbl *lpVtbl; }; #ifdef COBJMACROS #define IFaceDBOS_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define IFaceDBOS_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define IFaceDBOS_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define IFaceDBOS_QueryFace(This,users) \ ( (This)->lpVtbl -> QueryFace(This,users) ) #define IFaceDBOS_InserData(This,user,recoder_id) \ ( (This)->lpVtbl -> InserData(This,user,recoder_id) ) #define IFaceDBOS_LoadData(This) \ ( (This)->lpVtbl -> LoadData(This) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* __IFaceDBOS_INTERFACE_DEFINED__ */ #ifndef __ServerLib_LIBRARY_DEFINED__ #define __ServerLib_LIBRARY_DEFINED__ /* library ServerLib */ /* [helpstring][version][uuid] */ EXTERN_C const IID LIBID_ServerLib; EXTERN_C const CLSID CLSID_HykSqliteSys; #ifdef __cplusplus class DECLSPEC_UUID("0c092c2b-882c-11cf-a6bb-0080c7b2d682") HykSqliteSys; #endif #endif /* __ServerLib_LIBRARY_DEFINED__ */ /* Additional Prototypes for ALL interfaces */ /* end of Additional Prototypes */ #ifdef __cplusplus } #endif #endif
6efb26709b771044b957ce0a49df730aa71fe34b
bed3ac926beac0f4e0293303d7b2a6031ee476c9
/Modules/ThirdParty/GDCM/src/gdcm/Source/MessageExchangeDefinition/gdcmQueryImage.cxx
5fc30101f150de8b031ba0b72e8740c28e9fbbed
[ "IJG", "Zlib", "LicenseRef-scancode-proprietary-license", "SMLNJ", "BSD-3-Clause", "BSD-4.3TAHOE", "LicenseRef-scancode-free-unknown", "Spencer-86", "LicenseRef-scancode-llnl", "FSFUL", "Libpng", "libtiff", "LicenseRef-scancode-warranty-disclaimer", "LicenseRef-scancode-other-permissive", ...
permissive
InsightSoftwareConsortium/ITK
ed9dbbc5b8b3f7511f007c0fc0eebb3ad37b88eb
3eb8fd7cdfbc5ac2d0c2e5e776848a4cbab3d7e1
refs/heads/master
2023-08-31T17:21:47.754304
2023-08-31T00:58:51
2023-08-31T14:12:21
800,928
1,229
656
Apache-2.0
2023-09-14T17:54:00
2010-07-27T15:48:04
C++
UTF-8
C++
false
false
2,977
cxx
gdcmQueryImage.cxx
/*========================================================================= * * Copyright NumFOCUS * * 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.txt * * 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. * *=========================================================================*/ /* contains: class to construct an image-based query for c-find and c-move note that at the series and image levels, there is no distinction between the root query types. */ #include "gdcmQueryImage.h" #include "gdcmQueryPatient.h" #include "gdcmQueryStudy.h" #include "gdcmQuerySeries.h" #include "gdcmAttribute.h" namespace gdcm { std::vector<Tag> QueryImage::GetRequiredTags(const ERootType& ) const { std::vector<Tag> theReturn;//see 3.4 C.6.1.1.5 theReturn.emplace_back(0x0020, 0x0013); return theReturn; } std::vector<Tag> QueryImage::GetUniqueTags(const ERootType& ) const { std::vector<Tag> theReturn;//see 3.4 C.6.1.1.5 theReturn.emplace_back(0x0008, 0x0018); return theReturn; } std::vector<Tag> QueryImage::GetOptionalTags(const ERootType& ) const { std::vector<Tag> theReturn;//see 3.4 C.6.1.1.5 theReturn.emplace_back(0x0008, 0x0016);//SOP class UID //theReturn.push_back(Tag(0x0008, 0x3001));//alternate representation theReturn.emplace_back(0x0008, 0x001A);//related General SOP Class UID //sequence tags, not including for now //theReturn.push_back(Tag(0x0040, 0xA504)); //theReturn.push_back(Tag(0x0040, 0x0512)); //theReturn.push_back(Tag(0x0040, 0x0560)); return theReturn; } std::vector<Tag> QueryImage::GetHierachicalSearchTags(const ERootType& inRootType) const { std::vector<Tag> tags; if( inRootType == ePatientRootType ) { QueryPatient qp; tags = qp.GetUniqueTags(inRootType); } // add study level QueryStudy qst; std::vector<Tag> qsttags = qst.GetUniqueTags(inRootType); tags.insert(tags.end(), qsttags.begin(), qsttags.end()); // add series level QuerySeries qse; std::vector<Tag> qsetags = qse.GetUniqueTags(inRootType); tags.insert(tags.end(), qsetags.begin(), qsetags.end()); // add image level std::vector<Tag> utags = GetUniqueTags(inRootType); tags.insert(tags.end(), utags.begin(), utags.end()); return tags; } DataElement QueryImage::GetQueryLevel() const { const Attribute<0x0008, 0x0052> level = { "IMAGE " }; return level.GetAsDataElement(); } static const char QueryImageString[] = "Composite Object Instance (Image)"; const char *QueryImage::GetName() const { return QueryImageString; } }
90bb7b61ae38a51876fa8709e2d5fd8381bcad6c
41ec11e27d26f77e7f2df767e09020ceaa41af0f
/A3/Map.h
62752e21015a63e0a83692f46054604ada1cd336
[]
no_license
BenxinNiu/ENGI-4892
5fd173c093554281c575237d082337e1e0f0493c
00f3479327e50ab6ea56a88a19f855afe8ed9b82
refs/heads/master
2021-01-23T00:26:14.996507
2017-07-26T19:30:36
2017-07-26T19:30:36
92,812,782
1
0
null
2017-07-23T16:48:09
2017-05-30T08:30:46
C++
UTF-8
C++
false
false
5,567
h
Map.h
#include<string> #include<iostream> #include<fstream> using namespace std; template<class K, class V> class Map { public: // pre-condition: a valid key/value pair // post-condition: pair will be added to the BST, if not already present // Return true if insert succeeded, else false virtual bool insert(const K& key, const V& value) = 0; // pre-condition: a valid key // post-condition: if key was present, key/value pair is removed // Return true if remove succeeded, else false virtual bool remove(const K& key) = 0; // pre-condition: a valid key // post-condition: return the corresponding value for key, else nullptr // the BST is not changed virtual const V* search(const K& key) const = 0; // pre-condition: a valid BST // post-condition: return whether or not BST contains any items // the BST is not changed virtual bool isEmpty() const = 0; // pre-condition: a valid BST // post-condition: prints contents of BST in sorted order // the BST is not changed virtual void print() const = 0; }; // node in the tree template<class K, class V> class node{ public: node(){left=right=0;}; // default constructor node(const K& data,const V& v, node*l=0, node*r=0){ // constructor right=r; left=l; key=data; value=v; }; // void print_node() const{ // print node content const method cout<<key<<" "<<value<<endl; } node<K,V>* left, *right; K key; V value; }; //tree inhreit from Map class template<class K, class V> class BSTMap : public Map<K,V>{ public: BSTMap(){root=0;}; virtual bool insert(const K& key, const V& value) override; virtual bool remove(const K& key) override; virtual const V* search(const K& key) const override; virtual bool isEmpty() const override; virtual void print() const override{ print(root);}; void print(node<K,V>* n) const; // const method for print tree content by using recursion void deleteTarget(node<K,V>*& n); // delete a specific node which is passed as argument by reference bool in(node<K,V>*& n,const K& key, const V& value); // insert a node using recursion protected: node<K,V>* root; }; bool operator < (string a ,string b); // operator to compare string (length and alphabetical) bool operator > (string a ,string b); // operator to compare string (length and alphabetical) // target passed by reference in this method template<class K, class V> void BSTMap<K,V>:: deleteTarget(node<K,V>*& n){ node<K,V>* temp=n; //pointer to the target if(n!=0){ // target is not a null pointer if(n->right==0) // target has no right child n= n->left; else if(n->left==0) // target has no left child n= n->right; else{ temp=n->left; while(temp->right != 0) temp= temp->right; temp->right=n->right; temp=n; n=n->left; } delete temp; } } // locate the node by search key and pass to deleteTarget template<class K, class V> bool BSTMap<K,V>::remove(const K& key){ node<K,V>* n=root; node<K,V>* previous=0; while(n!=0){ if(n->key==key) break; // found the node breka loop previous = n; if(key> n->key) // keep searching update n n=n->right; else n=n->left; } if (n!=0&&n->key==key){ // if the n is present in the tree if(n==root) deleteTarget(root); else if(previous->left==n) deleteTarget(previous->left); else deleteTarget(previous->right); return true; } else if(!isEmpty()){ cout<<"dose not exist in the tree"<<endl; return false; } else return false; } // print tree content by using recursion (inorder) template<class K, class V> void BSTMap<K,V>::print(node<K,V>* n) const{ if(n!=0){ print(n->left); // go to the left most bottom n->print_node(); // print that node print(n->right); } } // see if a tree is empty template<class K, class V> bool BSTMap<K,V>::isEmpty() const{ return root==0; // if root is null then it is empty } // search a specific node by using key template<class K, class V> const V* BSTMap<K,V>::search(const K& key) const{ if (!isEmpty()){ node<K,V>* temp=root; while(temp!=0){ // loop if(temp->key==key){ //compare key return &(temp->value); //return the address of value } else if(key>temp->key) // update temp pointer for next loop temp=temp->right; else temp=temp->left; } return nullptr; // it is not in the tree } } // recursion insert template<class K, class V> bool BSTMap<K,V>::in(node<K,V>*& n,const K& key, const V& value){ if (n==nullptr){ // check if it is the right location to insert(nullptr would be the right location) n=new node<K,V>(key,value); // insert the new node return true; // insert successful } else if(key>n->key) // keep traversing the tree got to rigth side in(n->right,key,value); // recursion else if(key<n->key) // keep traversing the tree go to left side in(n->left,key,value); // recursion else return false; // unlikely to happen } // call in method to insert a pair of key and value template<class K, class V> bool BSTMap<K,V>::insert(const K& key, const V& value){ return in(root,key,value); // begin with the root of tree } // custome operator for string comparsion bool operator > (string a ,string b){ if (a.length()==b.length()) return a>b; else return a.length()>b.length(); } // custome operator for string comparsion bool operator < (string a ,string b){ if (a.length()==b.length()) return a<b; else return a.length()<b.length(); }
f2af99227f8c02ee4b0653d73dc62ed862af8bd9
dcb7e1628e94857b81be0a511646923fa80d3ec6
/dokushuc++10/dokushu10-3/dokushu10-3/main.cpp
325bf4786373e1324852be8389a04fe34141958e
[]
no_license
kentaroyusa/kenshuu
7b784cc45267ead16eb8f07a9f81bb8497a4d83e
cb9fe9925533699b6b7c5427f7f9fe6dd9f25104
refs/heads/master
2022-10-19T13:40:02.187778
2020-06-18T07:48:18
2020-06-18T07:48:18
263,549,464
0
0
null
null
null
null
UTF-8
C++
false
false
1,179
cpp
main.cpp
// // main.cpp // dokushu10-3 // // Created by Kentaro Yusa on 2020/05/28. // Copyright © 2020 Kentaro Yusa. All rights reserved. // #include <iostream> #include <new> /* Q1.new演算子が投げてくる例外のついて説明せよ 動的メモリの確保をする演算子だが、そのメモリが足りなかった場合std::bad_alloc例外が投げられる */ /* Q2.new演算子で呼び出したコンストラクターが例外を投げた場合、動的確保したメモリー領域はどうなるか説明せよ メモリー領域が適切に開放されてから、例外処理が投げられる */ class A{ public: A(){ throw 0; } }; int main() { try{ A* ptr=new A; delete ptr; } catch(int g){ std::cout<<"例外が投げられました 値:"<<g<<std::endl; } try{ int len = 5; int* array=new int[len]{0,1,2,3,4,5}; delete [] array; } catch(std::bad_array_new_length& e){ std::cout<<"長さ割り当て失敗"<<std::endl; } catch(std::bad_alloc& f){ std::cout<<"メモリ割り当て失敗"<<std::endl; } }
59483286af6fe432badefb732d780671f330a315
fbb38b3cff258b5dcd161ea2046b7fca566def5c
/problem24-LexicographicPermutation.cpp
da88cb6ec1622e55376c176c41e23b9e35aca3e2
[]
no_license
rishav2416/ProjectEuler
208633b5c7319864deae5984fab6b73184f2757f
1713c5017f5b21850bc4bf974783332f28271d83
refs/heads/master
2021-06-18T21:18:52.478923
2017-05-27T11:04:11
2017-05-27T11:04:11
null
0
0
null
null
null
null
UTF-8
C++
false
false
985
cpp
problem24-LexicographicPermutation.cpp
#include <iostream> #include <fstream> #include <sstream> #include <string> #include <stdlib.h> #include <vector> #include <algorithm> using namespace std; vector<int> findNextPerm(vector<int> input, int inputLength){ for(int k=inputLength-2;k>=0;--k){ if(input[k]<input[k+1]){ int currentMin=input[k+1];int currentMinPos=k+1; for(int m=inputLength-1;m>=k+1;--m){if(input[m]<currentMin && input[m]>input[k]){currentMin=input[m];currentMinPos=m;}} int temp=input[k];input[k]=input[currentMinPos];input[currentMinPos]=temp; sort(input.begin()+k+1,input.end()); return input; } } return input; } void stringPerm(long number) { vector<int> stringCounter;for(int k=0;k<10;++k){stringCounter.push_back(k);} for(int k=0;k<number;++k){ for(int m=0;m<10;++m){cout <<stringCounter[m];};cout<<endl; stringCounter=findNextPerm(stringCounter,10); } } int main (int argc, char * const argv[]) { stringPerm(1000000); return 0; }
8471506a7d505205801533bb861019003056e887
d650f6151d334ee8cd8c30abd72e7c3858db7e45
/GenericScan.h
8aaf26ae1c36ff98920bfb0cd055726292e3b783
[ "LicenseRef-scancode-public-domain", "LicenseRef-scancode-warranty-disclaimer", "TCL", "LicenseRef-scancode-newlib-historical", "LicenseRef-scancode-x11-opengl", "LicenseRef-scancode-mit-old-style" ]
permissive
luxigo/scanalyze
f673891a201a8aed96e1e6305e72748ae5e9cc6f
f008a179b211f69d2517557c981309084f7e0936
refs/heads/master
2020-12-11T07:45:35.424329
2014-02-13T00:40:50
2014-02-13T00:40:50
null
0
0
null
null
null
null
UTF-8
C++
false
false
3,513
h
GenericScan.h
//############################################################ // // GenericScan.h // // Kari Pulli // Mon Jun 29 11:51:05 PDT 1998 // // Store range scan information from a generic range scanner // that gives range maps. // Not much if anything is known of the scanner properties, // so orthographics scan geometry is assumed. // //############################################################ #ifndef _GENERICSCAN_H_ #define _GENERICSCAN_H_ #include "RigidScan.h" #include "Mesh.h" class KDindtree; class RangeGrid; class GenericScan : public RigidScan { private: vector<Mesh*> meshes; vector<KDindtree *> kdtree; bool bDirty; bool bNameSet; RangeGrid* myRangeGrid; KDindtree* get_current_kdtree(void); void insertMesh(Mesh *m, const crope& filename, bool bLoaded = true, bool bAlwaysLoad = true, int nRes = 0); Mesh* currentMesh (void); Mesh* getMesh (int level); inline Mesh* highestRes (void); bool readSet (const crope& fn); bool readSingleFile (const crope& fn); void _Init(); public: // default constructor: GenericScan(void); // wrapper constructor to display a single mesh: GenericScan(Mesh* mesh, const crope& name); ~GenericScan(void); // perVertex: colors and normals for every vertex (not every 3) // stripped: triangle strips instead of triangles // color: one of the enum values from RigidScan.h // colorsize: # of bytes for color virtual MeshTransport* mesh(bool perVertex = true, bool stripped = true, ColorSource color = colorNone, int colorSize = 3); int num_vertices(void); void subsample_points(float rate, vector<Pnt3> &p, vector<Pnt3> &n); void PrintVoxelInfo(); // added display voxel feature. See // GenericScan.cc for documentation - leslie RigidScan* filtered_copy(const VertexFilter& filter); virtual bool filter_inplace(const VertexFilter &filter); virtual bool filter_vertices (const VertexFilter& filter, vector<Pnt3>& p); bool closest_point(const Pnt3 &p, const Pnt3 &n, Pnt3 &cp, Pnt3 &cn, float thr = 1e33, bool bdry_ok = 0); void computeBBox(); void flipNormals(); crope getInfo (void); // smoothing void dequantizationSmoothing(int iterations, double maxDisplacement); void commitSmoothingChanges(); // file I/O methods bool read(const crope &fname); // is data worth saving? virtual bool is_modified (void); // save to given name: if default, save to existing name if there is // one, or return false if there's not virtual bool write(const crope& fname = crope()); // for saving individual meshes virtual bool write_resolution_mesh (int npolys, const crope& fname = crope(), Xform<float> xfBy = Xform<float>()); // for saving anything else virtual bool write_metadata (MetaData data); // ResolutionCtrl methods int create_resolution_absolute (int budget = 0, Decimator dec = decQslim); bool delete_resolution (int abs_res); bool load_resolution (int i); bool release_resolution (int nPolys); private: // file i/o helpers void setd (const crope& dir = crope(), bool bCreate = false); void pushd(); void popd(); crope setdir; crope pusheddir; int pushcount; Mesh* readMeshFile (const char* name); bool getXformFilename (const char* meshName, char* xfName); // color helper void setMTColor (Mesh* mesh, MeshTransport* mt, bool perVertex, ColorSource source, int colorsize); }; #endif /* _GENERICSCAN_H_ */
a018efeff145a33067ea67e974db52a3dcb7c76a
903f58e3d7f7df67de75ff8fe1e1be2558f2a003
/include/ZBE/core/tools/shared/implementations/SimpleValue.h
375b08afb20447647ac6bc76725dea88f21b5e6c
[ "Apache-2.0" ]
permissive
Degryll/ZBE
77260a88b0db3de31d7eccbf4b1be8f2729fe15f
cd3c8ee39caa9f527dab4bf5af151f6f8057b218
refs/heads/master
2023-08-31T13:30:21.590818
2023-01-05T22:01:22
2023-01-05T22:01:22
15,457,954
5
0
Apache-2.0
2019-05-20T21:31:08
2013-12-26T18:21:04
C
UTF-8
C++
false
false
8,474
h
SimpleValue.h
/** * Copyright 2012 Batis Degryll Ludo * @file SimpleValue.h * @since 2017-06-28 * @date 2017-06-28 * @author Batis Degryll Ludo * @brief Stores a value that can be modified. */ #ifndef ZBE_CORE_TOOLS_SHARED_IMPLEMENTATIONS_SIMPLEVALUE_H_ #define ZBE_CORE_TOOLS_SHARED_IMPLEMENTATIONS_SIMPLEVALUE_H_ #include <string> #include <nlohmann/json.hpp> #include "ZBE/core/tools/shared/Value.h" #include "ZBE/core/system/system.h" #include "ZBE/core/system/SysError.h" #include "ZBE/core/tools/containers/RsrcStore.h" #include "ZBE/core/tools/math/Vector.h" #include "ZBE/factories/Factory.h" namespace zbe { /** Stores a value that can be modified. */ template <typename T> class SimpleValue : public Value<T> { public: /** brief Void constructor. */ SimpleValue() : v() {} /** brief Parametrized contructor. * param value Value to store. */ SimpleValue(T value) : v(value) {} /** brief Sets the value. * param value Value to store. */ void set(T value) { v = value ; } /** brief Returns the value. * return value; */ T& get() { return v; } // TODO no funciona con vector // /** brief Modifies stored value by the param received. // * param value Value to add. // */ // void add(T value) { // v += value; // } private: T v; }; class ZBEAPI SimpleValueFtry : public Factory { public: /** \brief Builds a SimpleValue. * \param name Name for the created SimpleValue. * \param cfgId SimpleValue's configuration id. */ void create(std::string name, uint64_t cfgId); /** \brief Setup the desired tool. The tool will be complete after this step. * \param name Name of the tool. * \param cfgId Tool's configuration id. */ void setup(std::string name, uint64_t cfgId); private: RsrcStore<nlohmann::json> &configRsrc = RsrcStore<nlohmann::json>::getInstance(); RsrcStore<Value<double> > &valueDRsrc = RsrcStore<Value<double> >::getInstance(); RsrcStore<Value<float> > &valueFRsrc = RsrcStore<Value<float> >::getInstance(); RsrcStore<Value<uint64_t> > &valueURsrc = RsrcStore<Value<uint64_t> >::getInstance(); RsrcStore<Value<int64_t> > &valueIRsrc = RsrcStore<Value<int64_t> >::getInstance(); RsrcStore<Value<bool> > &valueBRsrc = RsrcStore<Value<bool> >::getInstance(); RsrcStore<Value<Vector2D> > &valueV2Rsrc = RsrcStore<Value<Vector2D> >::getInstance(); RsrcStore<Value<Vector3D> > &valueV3Rsrc = RsrcStore<Value<Vector3D> >::getInstance(); RsrcStore<Value<std::string> > &valueSRsrc = RsrcStore<Value<std::string> >::getInstance(); RsrcStore<Value<std::vector<std::string> > > &valueVSRsrc = RsrcStore<Value<std::vector<std::string> > >::getInstance(); RsrcDictionary<int64_t>& intStore = RsrcDictionary<int64_t>::getInstance(); RsrcDictionary<uint64_t>& uintStore = RsrcDictionary<uint64_t>::getInstance(); RsrcDictionary<double>& doubleStore = RsrcDictionary<double>::getInstance(); RsrcDictionary<float>& floatStore = RsrcDictionary<float>::getInstance(); RsrcDictionary<bool>& boolStore = RsrcDictionary<bool>::getInstance(); RsrcDictionary<std::string>& stringStore = RsrcDictionary<std::string>::getInstance(); template <typename T> inline void create(std::string name, nlohmann::json cfg, RsrcStore<Value<T> > &valueRsrc) { using namespace std::string_literals; for (auto item : cfg.items()) { valueRsrc.insert(name + "."s + item.key(), std::make_shared<SimpleValue<T> >()); } } template <typename T> T parseArrayElement(nlohmann::json value, RsrcDictionary<T> &literalStore) { using namespace std::string_literals; if (value.is_string()) { //auto s = value.get<std::string>(); //auto sp = valueRsrc.get(s); //auto sr = sp->get(); //return sr; return literalStore.get(value.get<std::string>()); } else if(value.is_array() && (value.size() == 1) && ((std::is_floating_point<T>::value && value.at(0).is_number_float()) ||(std::is_integral<T>::value && value.at(0).is_number_integer()) ||(std::is_same<T, bool>::value && value.at(0).is_boolean()) ||(std::is_same<T, std::string>::value && value.at(0).is_string()))) { return value.at(0).get<T>(); } else if((std::is_floating_point<T>::value && value.is_number_float()) ||(std::is_integral<T>::value && value.is_number_integer()) ||(std::is_same<T, bool>::value && value.is_boolean())) { return value.get<T>(); } else { SysError::setError("SimpleValueFtry parseArrayElement error: "s + value.get<std::string>() + " has invalid type."s); return T(); } } template <typename T> inline T parseSingleValue(nlohmann::json value, RsrcDictionary<T> &literalStore) { using namespace std::string_literals; if(value.is_array() && (value.size() == 1) && (std::is_same_v<T, std::string> == false) && (value.at(0).is_string())) { return literalStore.get(value.at(0).get<std::string>()); } else if(value.is_array() && (value.size() == 1) && ((std::is_floating_point<T>::value && value.at(0).is_number_float()) ||(std::is_integral<T>::value && value.at(0).is_number_integer()) ||(std::is_same<T, bool>::value && value.at(0).is_boolean()) ||(std::is_same<T, std::string>::value && value.at(0).is_string()))){ return value.at(0).get<T>(); } else if((std::is_floating_point<T>::value && value.is_number_float()) ||(std::is_integral<T>::value && value.is_number_integer()) ||(std::is_same<T, bool>::value && value.is_boolean())) { return value.get<T>(); } else { SysError::setError("SimpleValueFtry parseValue error: "s + value.get<std::string>() + " is invalid."s); return T(); } } template <typename T> inline void parse(std::string name, nlohmann::json cfg, RsrcStore<Value<T> > &valueRsrc, RsrcDictionary<T> &literalStore) { using namespace std::string_literals; for (auto item : cfg.items()) { //-- auto val = valueRsrc.get(name + "."s + item.key()); val->set(parseSingleValue(item.value(), literalStore)); //--- // por si generalizamos // if (item.value().is_array() && item.value().size() > 1){ // e.set<T>(id, parseMultiValue<T, item.value().size()>(item.value(), valueRsrc)); // } else { // e.set<T>(id, parseSingleValue(item.value(), valueRsrc)); // } } } inline Vector3D parseV3DValue(nlohmann::json cfg) { using namespace std::string_literals; Vector3D v3; if (cfg.is_array() && (cfg.size() == 3)) { auto c = 0; for (auto item : cfg.items()) { v3[c++] = parseArrayElement(item.value(), doubleStore); } } else { SysError::setError("SimpleValueFtry parseV3DValue error: Vector3D must be an array with three elements"s); } return v3; } inline Vector2D parseV2DValue(nlohmann::json cfg) { using namespace std::string_literals; Vector2D v2; if (cfg.is_array() && (cfg.size() == 2)) { auto c = 0; for (auto item : cfg.items()) { v2[c++] = parseArrayElement(item.value(), doubleStore); } } else { SysError::setError("SimpleValueFtry parseV2DValue error: Vector2D must be an array with two elements"s); } return v2; } inline std::vector<std::string> parseVStringValue(nlohmann::json cfg) { std::vector<std::string> vs; if (cfg.is_array()) { for (auto item : cfg.items()) { vs.emplace_back(parseArrayElement<std::string>(item.value(), stringStore)); } } return vs; } inline void parseV3D(std::string name, nlohmann::json cfg) { using namespace std::string_literals; for (auto item : cfg.items()) { auto val = valueV3Rsrc.get(name + "."s + item.key()); val->set(parseV3DValue(item.value())); } } inline void parseV2D(std::string name, nlohmann::json cfg) { using namespace std::string_literals; for (auto item : cfg.items()) { auto val = valueV2Rsrc.get(name + "."s + item.key()); val->set(parseV2DValue(item.value())); } } inline void parseVString(std::string name, nlohmann::json cfg) { using namespace std::string_literals; for (auto item : cfg.items()) { auto val = valueVSRsrc.get(name + "."s + item.key()); val->set(parseVStringValue(item.value())); } } }; } // namespace zbe #endif // ZBE_CORE_TOOLS_SHARED_IMPLEMENTATIONS_SIMPLEVALUE_H_
aa45853626bae2f5b4f9ab138e9ec456b760ea27
a3c9a1f0219fb0538030a34948e644931742ade5
/src/main/vec2vect.cpp
7c264579512739b48df0ce3b64ce2728aa37af01
[]
no_license
parnell/VarianceTestingC
3616647da1eac1b9b717605850d502c8896b2819
687eebc2618ca59a363c587f4acdef1f14496732
refs/heads/master
2020-03-30T14:37:21.740161
2017-01-18T20:45:24
2017-01-18T20:45:24
151,327,183
0
0
null
null
null
null
UTF-8
C++
false
false
559
cpp
vec2vect.cpp
#include <iostream> #include <fstream> //ifstream #include <sstream> #include <vector> using std::vector; using std::ifstream; using std::ofstream; using std::cout; using std::endl; #include <lshbox.h> #include "vec2vect.h" int main(int argc, char* argv[]) { if (argc < 3){ fprintf(stderr,"./vec2vect <infile> <outfile>\n"); return -1; } if (!strcmp(argv[1],argv[2])){ fprintf(stderr,"infile and outfile can not be the same\n"); return -1; } convertVec2Vect(argv[1], argv[2], argc > 3); return 0; }
0caa3d39a60ec5a46948a86626f98047241624fc
36f550534aa670b7669194bc3e931fe176b60182
/main.cpp
badf2d8e5c16868e479f05dcff6ec707b933a127
[]
no_license
hanabuzeid/P4-CODE-GENERATOR-4280
b123a49eac3c5cc25b7ffa654a8b3cae45b45782
98e184293da566cadf928ead8a31123df418cdc1
refs/heads/main
2023-04-24T05:29:03.142942
2021-05-11T00:13:11
2021-05-11T00:13:11
366,208,065
0
0
null
null
null
null
UTF-8
C++
false
false
1,418
cpp
main.cpp
#include <iostream> #include <string> #include <fstream> #include "parser.h" #include "semantics.h" std::ofstream file; int main(int argc, char **argv) { std::string fileName; static std::string outFileName; if (argc == 1) { std::string user; std::ofstream file; fileName = "stdin.temp"; file.open(fileName, std::ios::trunc); std::string string = ""; std::cout << "Pressing Enter will simulate EOF" << std::endl; do { std::cout << std::endl << "USER INPUT: "; getline(std::cin, user); file << user << "\n"; } while (!user.empty()); file.close(); in_file.open(fileName); } else if (argc == 2) { fileName = argv[1]; outFileName = fileName + ".asm"; fileName += ".sp21"; std::ofstream outfile; outfile.open(fileName, std::ios_base::app); outfile << " "; in_file.open(fileName); } else { std::cout << "EXCEEDED ARGUMENTS GIVEN" << std::endl; exit(EXIT_FAILURE); } if (in_file) { Node *root = parser(); codeGen(root, 0, outFileName); in_file.close(); } else { std::cout << "ERROR, CANT OPEN FILE " << fileName << " FOR READING" << std::endl; in_file.close(); exit(EXIT_FAILURE); } return 0; }
19b4041f2354f67d745b3e278307dcd1b4d2d346
387549ab27d89668e656771a19c09637612d57ed
/DRGLib UE project/Source/FSD/Private/CaveEntranceComponent.cpp
5132aaad9c3e631e80ae0e267dccf1afed59877f
[ "MIT" ]
permissive
SamsDRGMods/DRGLib
3b7285488ef98b7b22ab4e00fec64a4c3fb6a30a
76f17bc76dd376f0d0aa09400ac8cb4daad34ade
refs/heads/main
2023-07-03T10:37:47.196444
2023-04-07T23:18:54
2023-04-07T23:18:54
383,509,787
16
5
MIT
2023-04-07T23:18:55
2021-07-06T15:08:14
C++
UTF-8
C++
false
false
201
cpp
CaveEntranceComponent.cpp
#include "CaveEntranceComponent.h" UCaveEntranceComponent::UCaveEntranceComponent() { this->Direction = ECaveEntranceType::EntranceAndExit; this->Priority = ECaveEntrancePriority::Primary; }
2bf31f0c1b1819bc9a560856749c5475bd954c7a
aab7eafab5efae62cb06c3a2b6c26fe08eea0137
/preparetuplesforBDTfinalallvartrigger/ThreeSameSignMuonDatapreparetuple/bin/ALLCORMandtigterMMreleasetriggerREQ/plot3dpos.cc
0e807b552f5aee6db9f1d0a990467dafe81ed80c
[]
no_license
Sally27/B23MuNu_backup
397737f58722d40e2a1007649d508834c1acf501
bad208492559f5820ed8c1899320136406b78037
refs/heads/master
2020-04-09T18:12:43.308589
2018-12-09T14:16:25
2018-12-09T14:16:25
160,504,958
0
1
null
null
null
null
UTF-8
C++
false
false
4,994
cc
plot3dpos.cc
#include<iostream> #include "TH1F.h" #include "TCanvas.h" #include "TFile.h" #include "TTree.h" #include "TLorentzVector.h" #include "TVector3.h" #include "TBranch.h" #include "TRandom.h" #include "TBranch.h" #include "TString.h" #include<string> #include<vector> #include "THStack.h" #include "TLine.h" #include "TPaveText.h" #include <string> #include <iostream> #include <sstream> #include "TMath.h" #include <math.h> #include "TVector3.h" #include "TLorentzVector.h" #include "TObjArray.h" #include "TTreeFormula.h" #include "TH2I.h" #include "THStack.h" #include "TObjArray.h" #include "TLegend.h" #include "TLatex.h" #include "TText.h" #include "TStyle.h" #include "TROOT.h" #include "TPaveText.h" #include "TTree.h" #include "TTreeFormula.h" #include "TFile.h" #include <sstream> #include <iostream> #include "TMath.h" #include <vector> #include <string> #include "TH2F.h" #include "TH1.h" #include "TCanvas.h" #include "TProfile.h" #include "TH2D.h" #include "TGraphErrors.h" #include "TLegend.h" #include "TGraph.h" #include<vector> #include<algorithm> #include "TH3D.h" #include "TH3F.h" #include "TPad.h" using namespace std; string d2s(double d) { string ret; ostringstream os; os<<d; return os.str(); } class DataSample { public: DataSample(std::string filename, std::string treename) : _filename(filename), _treename(treename), f(NULL), t(NULL) { this->open(); } ~DataSample() { this->close(); } TString _filename; TString _treename; TFile *f; TTree *t; void open(); void close(); }; void DataSample::open() { f = new TFile(_filename); t = (TTree*)f->Get(_treename); } void DataSample::close() { if (f) if (f->IsOpen()) f->Close(); delete f; } bool setBranchStatusTTF(TTree* t, string cuts) { TObjArray* array = t->GetListOfBranches(); int n(array->GetEntries()); string name; bool ret(false); for(int i(0); i<n; ++i) { name = ((*array)[i])->GetName(); if(cuts.find(name) != string::npos) { t->SetBranchStatus(name.c_str(), 1); ret = true; } } return ret; } int plotposition3D(string filename, string cuts, string var1name, string var2name, string var3name){ TH3D th3f("th3f", "th3f", 50,-200,200,50,-200,200,50,200,200); TFile f(filename.c_str()); TTree* t = (TTree*)f.Get("DecayTree"); t->SetBranchStatus("*",0); if(cuts != "") setBranchStatusTTF(t, cuts); if(cuts == "") cuts = "1"; if(!setBranchStatusTTF(t, var1name)) { cout<<"WARNING: IN getCorrelationCoefficient, variable "<<var1name<<" not found, return 0"<<endl; return 0; } if(!setBranchStatusTTF(t, var2name)) { cout<<"WARNING: IN getCorrelationCoefficient, variable "<<var2name<<" not found, return 0"<<endl; return 0; } if(!setBranchStatusTTF(t, var3name)) { cout<<"WARNING: IN getCorrelationCoefficient, variable "<<var3name<<" not found, return 0"<<endl; return 0; } double var1(0); double var2(0); double var3(0); TTreeFormula* ttf = new TTreeFormula("ttf", cuts.c_str(), t); TTreeFormula* var1ttf = new TTreeFormula("var1ttf", var1name.c_str(), t); TTreeFormula* var2ttf = new TTreeFormula("var2ttf", var2name.c_str(), t); TTreeFormula* var3ttf = new TTreeFormula("var3ttf", var3name.c_str(), t); for(int i(0); i<t->GetEntries(); ++i) { t->GetEntry(i); cout<<var1name.c_str()<<endl; if(ttf->EvalInstance()) { cout<<"I am here"<<endl; var1 = var1ttf->EvalInstance(); var2 = var2ttf->EvalInstance(); var3 = var3ttf->EvalInstance(); cout<<var1<<endl; cout<<var2<<endl; th3f.Fill(var1, var2, var3); } } gStyle->SetCanvasPreferGL(kTRUE); TCanvas *canv= new TCanvas("canv2", "canv2", 100, 10, 850, 400); TPad *boxPad = new TPad("box", "box", 0.02, 0.02, 0.48, 0.82); TPad *box1Pad = new TPad("box1", "box1", 0.52, 0.02, 0.98, 0.82); boxPad->Draw(); box1Pad->Draw(); th3f.GetXaxis()->SetTitle(var1name.c_str()); th3f.GetYaxis()->SetTitle(var2name.c_str()); th3f.GetZaxis()->SetTitle(var3name.c_str()); th3f.SetFillColor(2); th3f.SetTitle("Position"); th3f.Draw("glbox"); //canv.Print( (filename+cleanNameString(var1name+"_vs_"+var2name)+".pdf").c_str()); canv->Print(( "3D"+var1name+"_vs_"+var2name+"_vs_"+var3name+".pdf").c_str()); t->SetBranchStatus("*",1); delete ttf; delete var1ttf; delete var2ttf; delete var3ttf; f.Close(); return 0; } int main() { //gROOT->ProcessLine(".x lhcbSally.C"); using namespace std; plotposition3D("B23SameSignMuonTotal_investigateALLCORMandtigterMMreleasetriggerREQ.root","Bplus_Corrected_Mass > 0","mu1_MuMuMu_PV_X" ,"mu1_MuMuMu_PV_Y" ,"mu1_MuMuMu_PV_Z"); //plotposition3D("B23SameSignMuonTotal_investigateALLCORMandtigterMMreleasetriggerREQ.root","Bplus_Corrected_Mass > 0","mu1_MuMuMu_SV_X" ,"mu1_MuMuMu_SV_Y" ,"mu1_MuMuMu_SV_Z"); return(1); }
6bcf3def0bcd4ed9763b1b08db3ea8d922e28ef7
35d583178ae4ea2f5360904ada0f60e989ecce7f
/code/Old_Stuff/PinballMachine/LED.ino
e4a49e7a836e0eb5ddbadc9629a2160128f6f11b
[]
no_license
valsted/Flipper
9d6c61ce6428765e01954d71814297083d2fe178
9e20d2f3172858ebb0c959979c32871ce726b501
refs/heads/main
2022-12-25T00:19:29.219503
2020-10-03T15:29:29
2020-10-03T15:29:29
300,910,618
0
0
null
null
null
null
UTF-8
C++
false
false
621
ino
LED.ino
class LED { int pin; int interval; bool on; unsigned long prevTime; public: LED(int pin, int interval) { this.pin = pin; this.interval = interval; } void Setup() { pinMode(pin, OUTPUT); on = false; prevTime = 0; } void Flash(int intensity) { unsigned long curTime = millis(); if(curTime - prevTime > interval) { prevTime = curTime; on = !on; if(on) { analogWrite(pin, intensity); } else { analogWrite(pin, 0); } } } };
c6ca20cb57dc3ccabe89cda5c00630ffaba0d53b
af73ea3bcfc821ef94d360281a3adc5e39912b19
/stemming.h
5e8728a324188d374a23d3748d8389965b6aea7d
[]
no_license
IDB-17-09AP/Vereshchagin-Crawler
c5c348ea60db134114fd0402399e98f62a54302c
dfb2f48e45981dc5e46ba9145f4902a50de1b967
refs/heads/master
2020-03-29T16:10:04.673229
2018-12-07T08:59:18
2018-12-07T08:59:18
150,101,013
0
0
null
null
null
null
UTF-8
C++
false
false
2,319
h
stemming.h
#ifndef STEMMING_H #define STEMMING_H #include <QtWidgets> class Stemming { public: static QString getStemmedForm(const QString &word); private: Stemming(); Stemming(const Stemming &other) = delete; Stemming& operator =(const Stemming &other) = delete; static bool removeEndingWord(QString &word, const QVector<QString> category, bool inGroup = false); static const QSet<QString> STOP_WORD; static const QString VOWER; static const QVector<QString> PERFECTIVE_1; static const QVector<QString> PERFECTIVE_2; static const QVector<QString> ADJECTIVE; static const QVector<QString> PARTICIPLE_1; static const QVector<QString> PARTICIPLE_2; static const QVector<QString> ADJECTIVAL_1; static const QVector<QString> ADJECTIVAL_2; static const QVector<QString> REFLEXIVE; static const QVector<QString> VERB_1; static const QVector<QString> VERB_2; static const QVector<QString> NOUN; static const QVector<QString> SUPERLATIVE; static const QVector<QString> DERIVATIONAL; }; class StemmingEng { public: static QString getStemmedForm(QString &word); private: StemmingEng(); StemmingEng(const StemmingEng &other) = delete; StemmingEng& operator =(const StemmingEng &other) = delete; static bool special(QString &word); static void changeY(QString &word); static bool isVowel(QChar ch); static bool isVowelY(QChar ch); static int firstNonVowelAfterVowel(QString &word, int start); static int getStartR1(QString &word); static int getStartR2(QString &word, int startR1); static bool replaceIfExists(QString &word, QString suffix, QString replacement, int start); static bool containsVowel(QString &word, int start, int end); static bool endsInDouble(const QString &word); static bool isShort(const QString &word); static bool isValidLIEnding(QChar ch); static void step0(QString &word); static bool step1A(QString &word); static void step1B(QString &word, int startR1); static void step1C(QString &word); static void step2(QString &word, int startR1); static void step3(QString &word, int startR1, int startR2); static void step4(QString &word, int startR2); static void step5(QString &word, int startR1, int startR2); }; #endif // STEMMING_H
6dd628a27abd663da4e06c631a5bf7d1104e5699
65123f5f0f2ac70e86c6c21f4e575c7ab4c94800
/LeetCode/C++/Easy/shuffle_array/shuffle_the_array.cpp
a1d5c3ad8c50100b30d87b28ce0b8bb787b15f74
[]
no_license
Paptop/CodePractice
84c5822d8681826595d55168b3d9e40e92625730
3e1fd09004b58538167cd5461a47407f980a52a7
refs/heads/master
2023-02-04T16:41:07.829935
2020-12-22T19:48:18
2020-12-22T19:48:18
292,788,523
0
0
null
null
null
null
UTF-8
C++
false
false
1,008
cpp
shuffle_the_array.cpp
#include <iostream> #include <algorithm> #include <vector> // 0 (0 + 3) 1 (1 + 3) 2 (2 + 3) // 0 1 2 3 4 5 //Solution not effective memory cost std::vector<int> shuffle(const std::vector<int>& nums, int n) { std::vector<int> res; for(int i = 0 ; i < n; ++i) { const int jj = i + n; res.push_back(nums[i]); res.push_back(nums[jj]); } return res; } std::vector<int> shuffle_memory(std::vector<int>& nums, int n) { std::vector<int> res; res.resize(nums.size()); for(int i = 0 ; i < n; ++i) { const int jj = i + n; res[i * 2] = nums[i]; res[i * 2 + 1] = nums[jj]; } return res; } void to_console(const std::vector<int>& arr) { for(int i : arr) { std::cout << i << " " ; } std::cout << std::endl; } int main() { std::vector<int> arr = {1, 2, 3, 4, 4, 3, 2, 1}; std::vector<int> output = shuffle_memory(arr, arr.size() / 2); to_console(output); }
dc37c38b3db3ccfac526eebb601e66c0c4855baf
d8dde07d7c9cf75f7f18a91ab1dd74a4a261a9e7
/tmpleate-2020/code/Datastructure/Heavy-Light-Decomposition.cpp
783288c5e612f26a24184407ed30c5074ec864dd
[]
no_license
tiankonguse/ACM
349109d3804e5b1a1de109ec48a2cb3b0dceaafc
ef70b8794c560cb87a6ba8f267e0cc5e9d06c31b
refs/heads/master
2022-10-09T19:58:38.805515
2022-09-30T06:59:53
2022-09-30T06:59:53
8,998,504
82
51
null
2020-11-09T05:17:09
2013-03-25T04:04:26
C++
UTF-8
C++
false
false
1,547
cpp
Heavy-Light-Decomposition.cpp
int size[N] , heavy[N] , tid[N] , Top[N] , ncnt , dep[N] , Fa[N]; // size : 子树大小 // heavy : 子树大小最大的子树(重边 // tid : 结点由重边串起来时的编号,在数据结构中维护 // Top : 结点所在重链的头 // Dep : 结点深度 // Fa : 结点父亲 void FindHE(int x , int fa , int Dep) //找重边重儿子 { heavy[x] = 0 , size[x] = 1 , dep[x] = Dep , Fa[x] = fa; for (int i = pre[x] ; ~i ; i = e[i].next) if (e[i].x != fa) { int y = e[i].x; FindHE(y , x , Dep + 1); size[x] += size[y]; if (!heavy[x] || size[y] > size[heavy[x]]) heavy[x] = y; } } void ConnectHE(int x , int anc) // 把重边串起来形成重链 { tid[x] = ++ ncnt , Top[x] = anc; update(1 , n , ncnt , a[x]); //单点更新值,顺便 if (heavy[x]) ConnectHE(heavy[x] , anc); for (int i = pre[x] ; ~i ; i = e[i].next) if (e[i].x != Fa[x] && e[i].x != heavy[x]) ConnectHE(e[i].x , e[i].x); } int query(int x , int y) // 询问 { int ans = -1 << 30; while (Top[x] != Top[y]) // 两个结点不在一条重链上 { if (dep[Top[x]] < dep[Top[y]]) swap(x , y); // 让深度大的那条链整个遍历完,tid[Top[x]]其中包含最头那条轻边 ans = max(ans , query(1 , n , tid[Top[x]] , tid[x])); x = Fa[Top[x]]; } if (dep[x] > dep[y]) swap(x , y);//在一条链上了 ans = max(ans , query(1 , n , tid[x] , tid[y])); return ans; }
1c717d6595d8ae1d1ef4fd5aeb347d21fd1313f1
6eba38c724926c1e1946231b90c3037f1411a574
/Leetcode/res/Merge Two Sorted Lists/2.cpp
cf42d3c2eee7b2fa8ff389ae9c1b77f685a1ee97
[ "MIT" ]
permissive
AllanNozomu/CompetitiveProgramming
a5a2e899ea820a5a7c7731a92f77aed502e2fd5f
ac560ab5784d2e2861016434a97e6dcc44e26dc8
refs/heads/master
2021-07-15T00:23:56.605262
2020-05-24T01:58:45
2020-05-24T01:58:45
135,915,231
1
0
null
null
null
null
UTF-8
C++
false
false
841
cpp
2.cpp
\* Author: allannozomu Runtime: 8 ms Memory: 8.7 MB*\ /** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */ class Solution { public: ListNode* mergeTwoLists(ListNode* l1, ListNode* l2) { ListNode head(-1); ListNode* actualNode = &head; while(l1 != NULL && l2 != NULL){ if (l1->val < l2->val){ actualNode->next = l1; l1 = l1->next; } else { actualNode-> next = l2; l2 = l2->next; } actualNode = actualNode->next; } if (l1 != NULL){ actualNode-> next = l1; } else if (l2 != NULL){ actualNode-> next = l2; } return head.next; } };
0c4c6c810a9006446ac65444e78e9edfe1ff58d8
e9a9a7cb9659a7b00d5668fd8029ac2e9ec4b702
/main.cpp
4377db93c4768e256cf27ccf69eed409cdcf1552
[]
no_license
brianChen0000/HW3
f0dc69ea8a6668b06e36a5dddc48f16cb4ed31b9
e70473e92a4172b94ca340ac06c97aca820b40c3
refs/heads/master
2020-05-17T05:16:42.256324
2019-04-26T00:43:07
2019-04-26T00:43:07
183,529,719
0
0
null
null
null
null
UTF-8
C++
false
false
506
cpp
main.cpp
// // main.cpp // homework2 // // Created by Mac on 2019/3/10. // Copyright © 2019年 Mac. All rights reserved. // #include <iostream> using namespace std; int main(int argc,char** argv) { int key,key1; cout<<"請輸入您的身高,體重"<<endl; cout<<"身高為:"; cin>>key; cout<<"體重為:"; cin>>key1; float key2 = (float)key/(float)100; float a = (float)key2*(float)key2; float nal = (float)key1/(float)a; cout<< (float)nal <<endl; return 0; }
800cadac66aa3deb242bfbd5d2491f8df1ba3309
fa5abe997ba16653b4d012c4536e47464e0a97f5
/functions in c/multiplication tables using functions.cpp
798a2046502e5de2eee138b82ec8897caafe0e71
[]
no_license
MeParas324/dev-c-
0666c0ce6686c17905d2f5d1d6985a153c851b08
344fd451cf2dd6cda042bb138cbcca8318095f3e
refs/heads/master
2023-07-11T12:33:56.267243
2021-08-06T05:47:46
2021-08-06T05:47:46
388,671,788
0
0
null
null
null
null
UTF-8
C++
false
false
330
cpp
multiplication tables using functions.cpp
#include<stdio.h> int get_num(void); void print_table(int num); int main() { int num; num=get_num(); print_table(num); } int get_num(void) { int n; printf("enter the number you want the table\n"); scanf("%d",&n); return n; } void print_table(int num) { for(int i=1;i<=10;i++) printf("%d X %d=%d\n",num,i,num*i); }
ea8e159c311a8f4ab2622e54cb92486490cbc2b4
697e3fd38f7ac47548825902c8bd0ded0a4fef6c
/TestCase/UITest/TextForRenderTest.cpp
86aae27b09f80e89753d4965768527684ff171c2
[]
no_license
saggita/Utility
89d8009b00d7f39ad78db5a900fc67c739916d52
46842d13ab5a4fc41ec3809d1b3fe338b6f13bc4
refs/heads/master
2021-01-23T17:09:18.917275
2015-03-20T11:35:12
2015-03-20T11:35:12
null
0
0
null
null
null
null
UTF-8
C++
false
false
456
cpp
TextForRenderTest.cpp
#include <boost/test/unit_test.hpp> #include <UnitTestAssert.h> #include <eigen3/Eigen/Dense> #include <TextForRender.h> using namespace Eigen; using namespace QGLVEXT; BOOST_AUTO_TEST_SUITE(TextForRenderTest) BOOST_AUTO_TEST_CASE(testAll){ TextForRender text; text.insert(TextWithPosition("h",1,2)); text.update(TextWithPosition("c",1,2)); ASSERT_EQ (text.size(),1); ASSERT_EQ (text.begin()->getContent(),"c"); } BOOST_AUTO_TEST_SUITE_END()
af6c40e92394c4b8c4f9993195f5f72d727b05a2
980f3788763eb527e1bdb5e0e278e146fbea12da
/vectors/include/Vector3.h
24fa03f3d4f7610ad363e7116ec4df8f8f5b5b36
[]
no_license
JeffreyMJohnson/exercises
db65cb4b58bd9233a799e74ce75189334267ff78
ed13cf25bab592232e30c60a506a3367d45366da
refs/heads/master
2021-01-25T04:57:55.575154
2015-05-05T14:57:00
2015-05-05T14:57:00
26,146,723
0
0
null
null
null
null
UTF-8
C++
false
false
926
h
Vector3.h
#pragma once #include <string> #include <math.h> #include "Utility.h" class Vector3 { public: float x, y, z; Vector3(); Vector3(float a_x, float a_y); Vector3(float a_x, float a_y, float a_z); ~Vector3(); Vector3 operator+(const Vector3& other); void operator+=(const Vector3& other); Vector3 operator-(const Vector3& other); void operator-=(const Vector3& other); Vector3& operator=(const Vector3& other); Vector3& operator*(int scalar); void operator*=(int scalar); float Magnitude(); void Normalise(); Vector3 GetNormal(); float DotProduct(Vector3& other); Vector3 CrossProduct(Vector3& other); /* returns the angle between this vector and the other given vector in radians */ float AngleBetween(Vector3& other); /* returns the angle between this vector and the other given vector in degrees */ float AngleBetweenInDegrees(Vector3& other); std::string ToString(); private: };
73372537244a6f4ac7fbda825969e841243149e5
6b2a8dd202fdce77c971c412717e305e1caaac51
/solutions_2453486_1/C++/burunduk3/a.c++
0e5594d96b417bd7115c165fd14cd0da7302230f
[]
no_license
alexandraback/datacollection
0bc67a9ace00abbc843f4912562f3a064992e0e9
076a7bc7693f3abf07bfdbdac838cb4ef65ccfcf
refs/heads/master
2021-01-24T18:27:24.417992
2017-05-23T09:23:38
2017-05-23T09:23:38
84,313,442
2
4
null
null
null
null
UTF-8
C++
false
false
2,012
a.c++
#include <cassert> #include <cstdio> int main() { int tt; assert(scanf("%d", &tt) == 1); for (int t = 1; t <= tt; t++) { char a[4][4]; bool is_dot = false, is_x = false, is_o = false; for (int i = 0; i < 4; i++) for (int j = 0; j < 4; j++) { assert(scanf(" %c", &a[i][j]) == 1); if (a[i][j] == '.') is_dot = true; } for (int i = 0; i < 4 && !is_x && !is_o; i++) { is_x = true; for (int j = 0; j < 4 && is_x; j++) if (a[i][j] != 'T' && a[i][j] != 'X') is_x = false; if (is_x) break; is_x = true; for (int j = 0; j < 4 && is_x; j++) if (a[j][i] != 'T' && a[j][i] != 'X') is_x = false; if (is_x) break; is_x = true; for (int j = 0; j < 4 && is_x; j++) if (a[j][j] != 'T' && a[j][j] != 'X') is_x = false; if (is_x) break; is_x = true; for (int j = 0; j < 4 && is_x; j++) if (a[j][3 - j] != 'T' && a[j][3 - j] != 'X') is_x = false; if (is_x) break; is_o = true; for (int j = 0; j < 4 && is_o; j++) if (a[i][j] != 'T' && a[i][j] != 'O') is_o = false; if (is_o) break; is_o = true; for (int j = 0; j < 4 && is_o; j++) if (a[j][i] != 'T' && a[j][i] != 'O') is_o = false; if (is_o) break; is_o = true; for (int j = 0; j < 4 && is_o; j++) if (a[j][3-j] != 'T' && a[j][3-j] != 'O') is_o = false; if (is_o) break; is_o = true; for (int j = 0; j < 4 && is_o; j++) if (a[j][j] != 'T' && a[j][j] != 'O') is_o = false; if (is_o) break; } if (is_x) printf("Case #%d: X won\n", t); else if (is_o) printf("Case #%d: O won\n", t); else if (is_dot) printf("Case #%d: Game has not completed\n", t); else printf("Case #%d: Draw\n", t); } return 0; }
1f326814f586b5d785b0c4ccf137d8b4fcd97e55
2748d0af8c89e0975bdfde2a24b5e567bfcac0ab
/perception/pointcloud_tools/sq_fitting/SQ_fitter_m.h
5103111f0737fc92f18c28581064510b59d2eddc
[]
no_license
shenglixu/golems
184384574958112690719c9295e9c08b75ccb093
ae516ce6d70cfd07e8806f243686536ca42d662d
refs/heads/master
2021-01-22T21:37:32.705276
2016-11-14T23:44:29
2016-11-14T23:44:29
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,666
h
SQ_fitter_m.h
/** * */ #pragma once #include <perception/pointcloud_tools/sq_fitting/SQ_fitter.h> #include <perception/pointcloud_tools/sq_fitting/SQ_fitter_t.h> #include <perception/pointcloud_tools/sq_fitting/SQ_fitter_b.h> enum MULTIPLE_SEARCH_HINT { PERPENDICULAR_TO_Z=0, CONTAINING_Z=1 }; template<typename PointT> class SQ_fitter_m : public SQ_fitter<PointT> { public: SQ_fitter_m(); ~SQ_fitter_m(); typedef typename pcl::PointCloud<PointT>::Ptr PointCloudPtr; typedef typename pcl::PointCloud<PointT> PointCloud; typedef typename pcl::PointCloud<PointT>::iterator PointCloudIter; bool fit( const int &_type, std::vector<int> _part_type, int _num_parts = 2, int _hint_search = PERPENDICULAR_TO_Z, const double &_smax = 0.05, const double &_smin = 0.01, const int &_N = 5, const double &_thresh = 0.005 ); void getPlaneAndDirection( int _hint_search, double _dim[3], double _trans[3], double _rot[3], Eigen::Vector4d &_plane, Eigen::Vector3d &_direction, double &_num_steps ); Eigen::Vector4d move_plane( Eigen::Vector4d _plane, int _i, double _stepSize ); void divide_cluster( PointCloudPtr &_cloud_1, PointCloudPtr &_cloud_2, Eigen::Vector4d _plane ); double fit_part( PointCloudPtr _part, int _type, double _smax, double _smin, int _N, double _thresh, SQ_parameters &_p ); void getFinalParams( std::vector<SQ_parameters> &_par ) { _par = pars_out_;} std::vector<SQ_parameters> pars_out_; }; #include "perception/pointcloud_tools/sq_fitting/impl/SQ_fitter_m.hpp"
7b0840e1c5b88fb7a18bbc0f112c7d75ef75f9cb
4d1170276bb928d1fa967a5cddac0210511d9282
/src/common/os/compat.hxx
9ebe393b61adda4d14c5bb4677b0044045263ded
[ "VSL-1.0" ]
permissive
resiprocate/msrp
de2fa2fb859a2609c760765f99d167929daf2cf1
44da1ee1f4cd1096f856d14578a460453b1c0d95
refs/heads/master
2016-09-10T11:17:36.498979
2005-06-13T23:28:48
2005-06-13T23:28:48
24,416,133
0
1
null
null
null
null
UTF-8
C++
false
false
4,927
hxx
compat.hxx
#if !defined(MSRP_COMPAT_HXX) #define MSRP_COMPAT_HXX #if defined(HAVE_CONFIG_H) #include "common/config.hxx" #endif #if defined(__INTEL_COMPILER ) && defined( __OPTIMIZE__ ) #undef __OPTIMIZE__ // wierd intel bug with ntohs and htons macros #endif #if defined(HAVE_SYS_INT_TYPES_H) #include <sys/int_types.h> #endif #ifdef WIN32 #include <errno.h> #include <winsock2.h> #include <io.h> #endif #ifndef WIN32 #include <sys/types.h> #include <sys/time.h> #include <sys/socket.h> #include <sys/select.h> #include <netinet/in.h> #include <arpa/inet.h> #include <unistd.h> #endif #ifdef WIN32 # include <windows.h> # include <winbase.h> # include <errno.h> # include <winsock2.h> # include <io.h> typedef unsigned long int u_int32_t; typedef long int ssize_t; #endif #if defined(TARGET_OS_MAC) /* TARGET_OS_MAC #defined in OS X SDK, "TargetConditionals.h" */ #include <netdb.h> #include <arpa/nameser_compat.h> #ifdef __MWERKS__ /* this is a <limits.h> bug filed with Apple, Radar# 3657629. */ #ifndef __SCHAR_MAX__ #define __SCHAR_MAX__ 127 #endif #endif #endif #if defined(__SUNPRO_CC) #if defined(_TIME_T) using std::time_t; #endif #include <time.h> #include <memory.h> #include <string.h> #endif #include <cstring> #if defined(WIN32) || defined(__QNX__) #define strcasecmp(a,b) stricmp(a,b) #define strncasecmp(a,b,c) strnicmp(a,b,c) #endif #ifndef WIN32 #include <pthread.h> #endif #if defined(__QNX__) || defined(__sun) typedef unsigned int u_int32_t; #endif #if !defined(T_NAPTR) #define T_NAPTR 35 #endif #if !defined(T_SRV) #define T_SRV 33 #endif #if !defined(T_AAAA) #define T_AAAA 28 #endif namespace msrp { template<typename _Tp> inline const _Tp& resipMin(const _Tp& __a, const _Tp& __b) { if (__b < __a) return __b; return __a; } template<typename _Tp> inline const _Tp& resipMax(const _Tp& __a, const _Tp& __b) { if (__a < __b) return __b; return __a; } #if defined(__DARWIN__) typedef size_t socklen_t; #endif } #if defined( WIN32 ) typedef unsigned __int64 UInt64; #else typedef unsigned long long UInt64; #endif //template "levels; ie REASONABLE and COMPLETE //reasonable allows most things such as partial template specialization, //etc...like most compilers and VC++2003+. //COMPLETE would allow template metaprogramming, template< template< > > tricks, //etc...REASONABLE should always be defined when COMPLETE is defined. #if defined(_MSC_VER) && (MSC_VER >= 1200) #define REASONABLE_TEMPLATES #endif #if !defined(__SUNPRO_CC) && !defined(__INTEL_COMPILER) #define REASONABLE_TEMPLATES #endif #endif /* ==================================================================== * The Vovida Software License, Version 1.0 * * Copyright (c) 2000 Vovida Networks, Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The names "VOCAL", "Vovida Open Communication Application Library", * and "Vovida Open Communication Application Library (VOCAL)" must * not be used to endorse or promote products derived from this * software without prior written permission. For written * permission, please contact vocal@vovida.org. * * 4. Products derived from this software may not be called "VOCAL", nor * may "VOCAL" appear in their name, without prior written * permission of Vovida Networks, Inc. * * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES * IN EXCESS OF $1,000, NOR FOR ANY 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. * * ==================================================================== * * This software consists of voluntary contributions made by Vovida * Networks, Inc. and many individuals on behalf of Vovida Networks, * Inc. For more information on Vovida Networks, Inc., please see * <http://www.vovida.org/>. * */
5df5d517a1c5b5b94d4179d08f1b5cba5ff3bc82
c88eca76f98aeaed16bfbd6051eea6c9594f5595
/framework/unit_tests/core_test/main.cc
0e04aad1bb55ade92a5f068866c7b0a5b83453a9
[ "MIT" ]
permissive
xubingyue/plain
9154acfb95e47f72221773d14eea78fdbfc6076e
28f9411de4507735da340a341211570992407a01
refs/heads/master
2020-05-19T18:23:11.562043
2019-03-26T12:29:33
2019-03-26T12:29:33
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,076
cc
main.cc
#include "gtest/gtest.h" #include "env.h" #include "pf/all.h" std::unique_ptr<pf_engine::Kernel> engine{nullptr}; class AllEnvironment : public testing::Environment { public: virtual void SetUp() { //std::cout << "SetUp" << std::endl; } virtual void TearDown() { //std::cout << "TearDown" << std::endl; } protected: std::unique_ptr<pf_engine::Application> app_; }; int32_t main(int32_t argc, char **argv) { /** pf_engine::Kernel engine; pf_engine::Application app(&engine); app.run(argc, argv); std::cout << "main" << std::endl; **/ GLOBALS["log.print"] = false; GLOBALS["default.db.open"] = true; GLOBALS["default.db.type"] = kDBEnvNull; GLOBALS["default.db.name"] = "pf_test"; GLOBALS["default.db.user"] = "root"; GLOBALS["default.db.password"] = "mysql"; auto _engine = new pf_engine::Kernel; unique_move(pf_engine::Kernel, _engine, engine); engine->init(); testing::AddGlobalTestEnvironment(new AllEnvironment); testing::InitGoogleTest(&argc, argv); int result = RUN_ALL_TESTS(); return result; }
310bfaf404b7806ec8f5c3a28d1b0cf90f1cf515
a8ca81ae173a5864163b1d08c192591fb0aa56af
/TrueLicenseApi/Helpers.cpp
491c4f5c00209fe1f6bebccf97f90be78bc2e692
[]
no_license
Celdorfpwn/fltk
be59787a5c2080df6c98789a5d06bc90e41641ee
23390e6c4efd6b96b4d237c5d1d26e244d969d13
refs/heads/master
2021-01-13T09:12:30.801440
2016-11-02T07:23:22
2016-11-02T07:23:22
69,195,001
0
0
null
null
null
null
UTF-8
C++
false
false
1,043
cpp
Helpers.cpp
#include "stdafx.h" #include "Helpers.h" namespace Helpers { LicenseFileWriter::LicenseFileWriter(string filePath) { this->filePath = filePath; } Concurrency::task<void> LicenseFileWriter::WriteHILicenseFile(http_response response) { return response.extract_json().then([&](json::value result) { std::fstream file; file.open(this->filePath, std::fstream::out); file << "[" + to_utf8string(result.at(L"productName").as_string()) + "]\n"; writeProperty(L"UserID", L"userId", file, result); writeProperty(L"Key", L"key", file, result); writeProperty(L"HW", L"hardwareKey", file, result); file << "[License]\n"; file << to_utf8string(result.at(L"licenseId").as_string() + L" = " + result.at(L"licenseKey").as_string()) + "\n"; file.close(); }); } void LicenseFileWriter::writeProperty(string_t name, string_t propertyName, std::fstream& file, json::value json) { file << to_utf8string(name + L" = " + json.at(propertyName).as_string()) + "\n"; } LicenseFileWriter::~LicenseFileWriter() { } }
934b7ffdbf5ff69851b214bd37babe6474fe638e
454e6b3d6b4906200190543a38b217362c0942aa
/include/realizations/catchment/Simple_Lumped_Model_Realization.hpp
91d5a0ceac21ecaa0f6d7e171b3185d39257f7d2
[]
no_license
zhiyuli/ngen
7bb8453d4f997976651cb405ef5bcafe70e3776a
25de1a70c9588022872b0f14504539ce48dbc433
refs/heads/master
2023-02-01T08:44:38.270059
2020-11-10T00:25:04
2020-12-09T17:53:05
null
0
0
null
null
null
null
UTF-8
C++
false
false
4,829
hpp
Simple_Lumped_Model_Realization.hpp
#ifndef SIMPLE_LUMPED_MODEL_REALIZATION_H #define SIMPLE_LUMPED_MODEL_REALIZATION_H #include "Catchment_Formulation.hpp" #include "reservoir/Reservoir.hpp" #include "hymod/include/Hymod.h" #include <unordered_map> class Simple_Lumped_Model_Realization : public realization::Catchment_Formulation { public: typedef long time_step_t; Simple_Lumped_Model_Realization( std::string id, forcing_params forcing_config, utils::StreamHandler output_stream, double storage, double max_storage, double a, double b, double Ks, double Kq, long n, const std::vector<double>& Sr, time_step_t t ); Simple_Lumped_Model_Realization(std::string id, forcing_params forcing_config, utils::StreamHandler output_stream) : Catchment_Formulation(id, forcing_config, output_stream) {}; Simple_Lumped_Model_Realization(std::string id) : Catchment_Formulation(id){}; /** * @brief Explicit move constructor * This constuctor explicitly moves a Simple_Lumped_Model_Realization * and is required to properly move the HY_CatchmentRealization forcing object */ Simple_Lumped_Model_Realization(Simple_Lumped_Model_Realization &&); /** * @brief Explicit copy constructor * This constuctor explicitly copies Simple_Lumped_Model_Realization * and is required to properly copy the HY_CatchmentRealization forcing object * as well connectet the hymod_state.Sr* to the copied cascade_backing_storage vector */ Simple_Lumped_Model_Realization(const Simple_Lumped_Model_Realization &); virtual ~Simple_Lumped_Model_Realization(); /** * Get a formatted line of output values for the given time step as a delimited string. * * For this type, the output consists of only the total discharge amount per time step; i.e., the same value * that was returned by ``get_response``. * * This method is useful for preparing calculated data in a representation useful for output files, such as * CSV files. * * The resulting string will contain calculated values for applicable output variables for the particular * formulation, as determined for the given time step. However, the string will not contain any * representation of the time step itself. * * An empty string is returned if the time step value is not in the range of valid time steps for which there * are calculated values for all variables. * * The default delimiter is a comma. * * @param timestep The time step for which data is desired. * @return A delimited string with all the output variable values for the given time step. */ std::string get_output_line_for_timestep(int timestep, std::string delimiter=",") override; /** * Execute the backing model formulation for the given time step, where it is of the specified size, and * return the total discharge. * * Function reads input precipitation from ``forcing`` member variable. It also makes use of the params struct * for ET params accessible via ``get_et_params``. * * @param t_index The index of the time step for which to run model calculations. * @param d_delta_s The duration, in seconds, of the time step for which to run model calculations. * @return The total discharge for this time step. */ double get_response(time_step_t t, time_step_t dt) override; double calc_et(double soil_m) override; virtual void create_formulation(boost::property_tree::ptree &config, geojson::PropertyMap *global = nullptr); virtual void create_formulation(geojson::PropertyMap properties); virtual std::string get_formulation_type() { return "simple_lumped"; } void add_time(time_t t, double n); protected: std::vector<std::string> REQUIRED_PARAMETERS = { "sr", "storage", "max_storage", "a", "b", "Ks", "Kq", "n", "t" }; virtual const std::vector<std::string>& get_required_parameters() { return REQUIRED_PARAMETERS; } private: std::unordered_map<time_step_t, hymod_state> state; std::unordered_map<time_step_t, hymod_fluxes> fluxes; std::unordered_map<time_step_t, std::vector<double> > cascade_backing_storage; hymod_params params; }; #endif // SIMPLE_LUMPED_MODEL_REALIZATION_H
c786539a5032527be0e2a7043bdaf25670a90dc6
3a7d140ec93581c61c9c5680cf6bbc319266f688
/Solved problems on contest/Heaters.cpp
754b61afe65f357f49eb2a46461fc7d392c9ddfb
[]
no_license
Ovishake1607066/Solved-Codeforces-problems
dcc6e33d471e4e92d1cf76b7c5aab4b0278fbf55
fe038bb365bd666b2bbcad815e9ad3206d7e0988
refs/heads/master
2022-07-17T04:12:21.628142
2020-05-13T19:20:09
2020-05-13T19:20:09
263,710,650
0
0
null
null
null
null
UTF-8
C++
false
false
1,982
cpp
Heaters.cpp
#include<bits/stdc++.h> #define ll long long #define loop for(ll i=0;i<n;i++) #define loop2 for(ll j=0;j<m1;j++) ll a2[1010]; using namespace std; int main() { ll n,r; cin>>n>>r; ll a[n+1],b,c,j=0,d=1000,e=0,f,g,w=0; loop { cin>>b; if(b==1) a[j++]=i+1; } if(j) { d=a[0]-r+1; if(d<1) d=1; f=a[0]+r-1; if(f>n) f=n; for(ll i=d; i<=f; i++) a2[i]=1; e++; } else { cout<<-1<<endl; return 0; } for(ll i=1; i<j; i++) { c=a[i]-r+1; ll y=c; if(y<1) y=1; ll v=a[i]+r-1; if(v>n) v=n; for(ll x=y; x<=v; x++) { a2[x]=1; } if(c<d) { ; } else { d=a[i]-r+1; g=a[i]+r-1; if(d<=f) w=1; else { e++; if(w) { f=a[i-1]+r-1; i--; if(g>=n) { f=n; e++; break; } continue; } else f=a[i]+r-1; if(f>=n) { f=n; if(w) e++; break; } w=0; } if(g>=n) { f=n; e++; break; } } } for(ll i=1; i<=n; i++) { //cout<<a2[i]<<endl; if(!a2[i]) { cout<<-1<<endl; return 0; } } cout<<e<<endl; }
47297d6e69fc3e0013d774e2bb12256e3b265581
c1398bf900ff9b965069cb47eb9280ddbb0574bb
/server.h
46064049bcf4395da710eed94c371eb8577e2c5c
[]
no_license
xcw0754/crossthewall
cc700f6f4f1aadc50289080e1615393a43b0747a
077d7eaedb10cb532a633d4d1070d22db2df0f97
refs/heads/master
2021-09-05T19:24:28.759992
2018-01-30T14:38:35
2018-01-30T14:38:35
119,349,983
2
0
null
null
null
null
UTF-8
C++
false
false
4,069
h
server.h
#pragma once #include <cstdlib> #include "asio/include/asio.hpp" #define BUFF_SIZE_2048 (1<<11) #define BUFF_SIZE_512 (1<<9) #define BUFF_SIZE_128 (1<<7) #define BUFF_SIZE_32 (1<<5) #define BUFF_SIZE_8 (1<<3) #define BUFF_SIZE_2 (1<<1) #define MAX_BUFF_SIZE BUFF_SIZE_2048 /* * singleton */ class Server { typedef asio::error_code AsioErr; typedef asio::ip::tcp AsioTcp; typedef std::shared_ptr<AsioTcp::socket> AsioSocketPtr; typedef std::shared_ptr<AsioTcp::acceptor> AsioAcceptorPtr; public: static Server& GetInstance() { // the only instance of Server static Server instance; return instance; } void SetListenPort(unsigned short num) { _portNumber = num; } void SetBufferSize(unsigned short size) { if(size>MAX_BUFF_SIZE) { size = MAX_BUFF_SIZE; } _bufferSize = size; } void Run() { if(_isRunning) { std::cout<<"Server is already running"<<std::endl; return; } // create a endpoint AsioTcp::endpoint endpoint(AsioTcp::v4(), _portNumber); try { // bind endpoint to acceptor _acceptorp = std::make_shared<AsioTcp::acceptor>(_service, endpoint); // reuse the address _acceptorp->set_option(asio::socket_base::reuse_address(true)); // async accept AsyncAccept(); // run service _service.run(); } catch(std::exception &e) { std::cerr<<"Something wrong:"<<e.what()<<std::endl; exit(EXIT_SUCCESS); } _isRunning = true; } private: Server(Server const &) = delete; // don't implement void operator=(Server const &) = delete; // don't implement // constructor: init some data Server() { _portNumber = 0; _isRunning = false; _acceptorp = nullptr; _bufferSize = BUFF_SIZE_128; } // be ready to accept new connection void AsyncAccept() { AsioSocketPtr sockp(new AsioTcp::socket(_service)); // in order to pass sockp to HandleAsyncAccept, // the second argument is a lambda. _acceptorp->async_accept(*sockp, [this, sockp] (const AsioErr &err) { HandleAsyncAccept(AsioSocketPtr(sockp), err); }); } // be ready to read data from connection void AsyncRead(AsioSocketPtr &sockp) { // tell sockp that call HandleAsyncRead if data comes, // and store data in _buffer. sockp->async_read_some(asio::buffer(_buffer, _bufferSize), [this, sockp] (const AsioErr &err, size_t bytes) { HandleAsyncRead(sockp, err, bytes); }); } // new connection accepted void HandleAsyncAccept(AsioSocketPtr &&sockp, const AsioErr &error) { if(error) { std::cout<<"Something wrong:"<<error.message()<<std::endl; sockp->close(); return ; } const AsioTcp::endpoint &ep = sockp->remote_endpoint(); std::cout<<"This is a new connection:"<<ep.address()<<":"<<ep.port()<<std::endl; // read data AsyncRead(sockp); // post a new async accept AsyncAccept(); } // read and print data received void HandleAsyncRead(AsioSocketPtr sockp, const AsioErr &error, size_t bytes) { if(error) { std::cout<<"Something wrong:"<<error.message()<<std::endl; sockp->close(); return ; } // print std::cout<<bytes<<" bytes received"<<std::endl; std::cout<<std::string(_buffer, _buffer+bytes)<<std::endl; // read again AsyncRead(sockp); } asio::io_service _service; AsioAcceptorPtr _acceptorp; char _buffer[MAX_BUFF_SIZE+1]; // shared buffer for all clients bool _isRunning; unsigned short _portNumber; unsigned short _bufferSize; // the number of bytes at a time };
82932f072c12a74d04b0b3b21a02433a066ad18c
076ba173f5b518977d30f4336c63b177a5a7f66d
/cases/spherical_surfers/param/env/objects/surfer__us_1o0__surftimeconst_8o0__reorientationtime_4o0/group/homogeneous/_member/agent/_behaviour/navigator/_behaviour_direction/surf/choice.h
cca9839d0e23d0ea1c81ccea6f581742c19e8f4a
[ "MIT" ]
permissive
C0PEP0D/sheld0n
a661b27ffee7b087731f0a3e9f92c2ee26d7d560
a1b9a065cfaa2e3faf5a749f14201a84baa41ce9
refs/heads/master
2023-04-28T20:53:27.684636
2023-04-18T21:20:00
2023-04-18T21:20:00
421,041,396
0
1
null
null
null
null
UTF-8
C++
false
false
1,768
h
choice.h
#ifndef C0P_PARAM_OBJECTS_SURFER__US_1O0__SURFTIMECONST_8O0__REORIENTATIONTIME_4O0_GROUP_HOMOGENEOUS_MEMBER_AGENT_BEHAVIOUR_NAVIGATOR_BEHAVIOUR_DIRECTION_SURF_CHOICE_H #define C0P_PARAM_OBJECTS_SURFER__US_1O0__SURFTIMECONST_8O0__REORIENTATIONTIME_4O0_GROUP_HOMOGENEOUS_MEMBER_AGENT_BEHAVIOUR_NAVIGATOR_BEHAVIOUR_DIRECTION_SURF_CHOICE_H #pragma once // THIS FILE SHOULD NOT BE EDITED DIRECTLY BY THE USERS. // THIS FILE WILL BE AUTOMATICALLY EDITED WHEN THE // CHOOSE COMMAND IS USED // behaviour time horizon choice #include "param/env/objects/surfer__us_1o0__surftimeconst_8o0__reorientationtime_4o0/group/homogeneous/_member/agent/_behaviour/navigator/_behaviour_direction/surf/_behaviour_time_horizon/choice.h" // choose your behaviour #include "core/env/objects/object/agent/behaviour/navigator/behaviour_direction/surf/exp/core.h" #include "param/env/objects/surfer__us_1o0__surftimeconst_8o0__reorientationtime_4o0/group/homogeneous/_member/agent/_behaviour/navigator/_behaviour_direction/surf/exp/parameters.h" namespace c0p { template<typename SurferUs1O0Surftimeconst8O0Reorientationtime4O0GroupHomogeneousMemberAgentActiveStep> using SurferUs1O0Surftimeconst8O0Reorientationtime4O0GroupHomogeneousMemberAgentBehaviourNavigatorBehaviourDirectionSurf = AgentBehaviourNavigatorBehaviourDirectionSurfExp<SurferUs1O0Surftimeconst8O0Reorientationtime4O0GroupHomogeneousMemberAgentBehaviourNavigatorBehaviourDirectionSurfExpParameters, SurferUs1O0Surftimeconst8O0Reorientationtime4O0GroupHomogeneousMemberAgentActiveStep, SurferUs1O0Surftimeconst8O0Reorientationtime4O0GroupHomogeneousMemberAgentBehaviourNavigatorBehaviourDirectionSurfBehaviourTimeHorizon<SurferUs1O0Surftimeconst8O0Reorientationtime4O0GroupHomogeneousMemberAgentActiveStep>>; } #endif
4c3bdf1f5a16e494faa93f1b8e83d7b1328e80b0
e04f52ed50f42ad255c66d7b6f87ba642f41e125
/appseed/aura/aura/os/windows_common/windows_common_multithreading.cpp
5cb35b682248d64f0ccba5de78312ef705331a4c
[]
no_license
ca2/app2018
6b5f3cfecaa56b0e8c8ec92ed26e8ce44f9b44c0
89e713c36cdfb31329e753ba9d7b9ff5b80fe867
refs/heads/main
2023-03-19T08:41:48.729250
2018-11-15T16:27:31
2018-11-15T16:27:31
98,031,531
3
0
null
null
null
null
UTF-8
C++
false
false
3,821
cpp
windows_common_multithreading.cpp
#include "framework.h" int32_t get_os_thread_priority(int32_t iCa2Priority) { if (iCa2Priority <= (int) ::multithreading::priority_none) return THREAD_PRIORITY_NORMAL; if (iCa2Priority <= (int) ::multithreading::priority_idle) return THREAD_PRIORITY_IDLE; if (iCa2Priority <= (int) ::multithreading::priority_lowest) return THREAD_PRIORITY_LOWEST; if (iCa2Priority <= (int) ::multithreading::priority_below_normal) return THREAD_PRIORITY_BELOW_NORMAL; if (iCa2Priority <= (int) ::multithreading::priority_normal) return THREAD_PRIORITY_NORMAL; if (iCa2Priority <= (int) ::multithreading::priority_above_normal) return THREAD_PRIORITY_ABOVE_NORMAL; if (iCa2Priority <= (int) ::multithreading::priority_highest) return THREAD_PRIORITY_HIGHEST; return THREAD_PRIORITY_TIME_CRITICAL; } int32_t get_os_priority_class(int32_t iCa2Priority) { if (iCa2Priority <= (int) ::multithreading::priority_none) return 0; if (iCa2Priority <= (int) ::multithreading::priority_idle) return IDLE_PRIORITY_CLASS; if (iCa2Priority <= (int) ::multithreading::priority_lowest) return BELOW_NORMAL_PRIORITY_CLASS; if (iCa2Priority <= (int) ::multithreading::priority_below_normal) return BELOW_NORMAL_PRIORITY_CLASS; if (iCa2Priority <= (int) ::multithreading::priority_normal) return NORMAL_PRIORITY_CLASS; if (iCa2Priority <= (int) ::multithreading::priority_above_normal) return ABOVE_NORMAL_PRIORITY_CLASS; if (iCa2Priority <= (int) ::multithreading::priority_highest) return HIGH_PRIORITY_CLASS; return REALTIME_PRIORITY_CLASS; } int32_t get_os_thread_scheduling_priority(int32_t nPriority) { int32_t iCa2Priority; if (nPriority <= THREAD_PRIORITY_IDLE) { iCa2Priority = ::multithreading::priority_idle; } else if (nPriority <= THREAD_PRIORITY_LOWEST) { iCa2Priority = ::multithreading::priority_lowest; } else if (nPriority <= THREAD_PRIORITY_BELOW_NORMAL) { iCa2Priority = ::multithreading::priority_below_normal; } else if (nPriority <= THREAD_PRIORITY_NORMAL) { iCa2Priority = ::multithreading::priority_normal; } else if (nPriority <= THREAD_PRIORITY_ABOVE_NORMAL) { iCa2Priority = ::multithreading::priority_above_normal; } else if (nPriority <= THREAD_PRIORITY_HIGHEST) { iCa2Priority = ::multithreading::priority_highest; } else { iCa2Priority = ::multithreading::priority_time_critical; } return iCa2Priority; } int32_t get_os_class_scheduling_priority(int32_t nPriority) { int32_t iCa2Priority; if (nPriority <= IDLE_PRIORITY_CLASS) { iCa2Priority = ::multithreading::priority_idle; } else if (nPriority <= BELOW_NORMAL_PRIORITY_CLASS) { iCa2Priority = ::multithreading::priority_below_normal; } else if (nPriority <= NORMAL_PRIORITY_CLASS) { iCa2Priority = ::multithreading::priority_normal; } else if (nPriority <= ABOVE_NORMAL_PRIORITY_CLASS) { iCa2Priority = ::multithreading::priority_above_normal; } else if (nPriority <= HIGH_PRIORITY_CLASS) { iCa2Priority = ::multithreading::priority_highest; } else { iCa2Priority = ::multithreading::priority_time_critical; } return iCa2Priority; } namespace multithreading { bool set_priority(int32_t priority) { return (::SetThreadPriority(::GetCurrentThread(), get_os_thread_priority(priority)) != 0); } int32_t priority() { return get_os_thread_scheduling_priority(::GetThreadPriority(::GetCurrentThread())); } } // namespace core int get_processor_count() { SYSTEM_INFO sysinfo; GetSystemInfo(&sysinfo); return sysinfo.dwNumberOfProcessors; }
e1154b4325887f0649080765a3484fb98e2117b1
3739599da7b81bd27f3464b32a760454a9810469
/Sources/Code/Engine/Render/include/Render/ETRenderManager.hpp
e88c2aecfbb45d8c577d2cfc6c107c82af9358bd
[]
no_license
lastcolour/GamePractice
7b965b599ff7e005b843e21d9d4ceef0902a5baf
f4d12babd84fc4bd84e29f1622027f84428f3284
refs/heads/master
2023-02-24T08:42:05.646567
2023-02-19T01:25:38
2023-02-19T01:25:38
156,078,806
14
2
null
null
null
null
UTF-8
C++
false
false
1,183
hpp
ETRenderManager.hpp
#ifndef __ET_RENDER_MANAGER_HPP__ #define __ET_RENDER_MANAGER_HPP__ #include "Render/RenderCommon.hpp" class RenderShader; class RenderFont; class RenderTexture; class RenderGeometry; class RenderFramebuffer; struct ETRenderGeometryManager { virtual ~ETRenderGeometryManager() = default; virtual std::shared_ptr<RenderGeometry> ET_createGeometry(EPrimitiveGeometryType geomType) = 0; }; struct ETRenderFontManager { virtual ~ETRenderFontManager() = default; virtual std::shared_ptr<RenderFont> ET_createFont(EFontType fontType) = 0; }; struct ETRenderTextureManager { virtual ~ETRenderTextureManager() = default; virtual std::shared_ptr<RenderTexture> ET_createFromFile(const char* fileName, ETextureDataType type) = 0; virtual std::shared_ptr<RenderTexture> ET_createTexture(ETextureDataType type, const Vec2i& size) = 0; virtual std::shared_ptr<RenderFramebuffer> ET_createFramebuffer(EFramebufferType type, const Vec2i& size) = 0; }; struct ETRenderShaderManager { virtual ~ETRenderShaderManager() = default; virtual std::shared_ptr<RenderShader> ET_createShader(const char* shaderName) = 0; }; #endif /* __ET_RENDER_MANAGER_HPP__ */
4d1f3f4d81f7d0ff6bdcb218873038ab021ee87b
4835699a1893b7b91cc600ddf3de4e5ee950e1d3
/GenStack.h
6b70a12c79dcd83961a66b44bebada99f2da4add
[]
no_license
RitaSache/Database-based-on-a-binary-search-tree
7dd00d784b85e59bb4383cc645c5456f55f57560
3954f4afec605c218f92be0e67c3829309bd7e5b
refs/heads/master
2021-04-28T03:03:21.563658
2017-11-26T08:44:24
2017-11-26T08:44:24
122,129,603
0
0
null
null
null
null
UTF-8
C++
false
false
1,886
h
GenStack.h
#include <iostream> using namespace std; template <class T> class GenStack { public: GenStack(int maxSize); ~GenStack(); //replacing char data with T data void push(T data); //T to make it a template data type. This T will be replaced with the type you pass when you instantiat a stack. T pop(); T peek(); int isFull(); int isEmpty(); int top; //index top to keep track of the top element in stack int max; T *myArray; //pointer that will act as a back in array, stack of chars. not initiallized, can be changed dynamically }; //constructor for GenStack that creates a dynamic array and fills it up with zeros template <class T> GenStack<T>::GenStack(int maxSize){ myArray = new T[maxSize]; for(int i=0; i<maxSize; i++){ myArray[i]=NULL; } max = maxSize; top = -1; } //deconstructor for GenStack that deletes objects template <class T> GenStack<T>::~GenStack() { delete [] myArray; } //push method that checks whether an array is full and adds to the stack accordingly. if full, automatically allocates more space for itself template <class T> void GenStack<T>::push(T data) { if (!isFull()) { myArray[++top] = data; } else { for(int i = 1; i < max; i++){ myArray[i-1] = myArray[i]; } myArray[top] = data; } } //pop method that checks if an array is empty and pops accordingly template <class T> T GenStack<T>::pop(){ if(!isEmpty()){ return myArray[top--]; } else { return NULL; } } //peek method that checks whether an array is empty and if not it returns the top element in the stack template <class T> T GenStack<T>::peek(){ if (!isEmpty()) { return myArray[top]; } else { return NULL; } } //checks whether the stack is full template <class T> int GenStack<T>::isFull(){ return (top == max - 1); } //checks whether the stack is empty template <class T> int GenStack<T>::isEmpty(){ return (top == -1); }
bb05341f111ab13660c764c03ad39a342d4e75f5
38026f4db0061d71a428d3619351408d7b8a586c
/Source/gui/Diff2Dlg.cpp
06b8de6ee2f652b9f4c657c6d9fda35dc5439019
[ "BSD-2-Clause" ]
permissive
gorlak/P4Win
dc0f69693babe829edafc8a02d1799066b2a179e
6986535bd9e5b0f297cacbc8ad112bb6d49a5ed3
refs/heads/master
2021-08-20T06:14:18.135928
2021-06-05T23:48:20
2021-06-05T23:48:20
89,386,061
11
4
NOASSERTION
2021-03-03T05:13:59
2017-04-25T17:03:50
C++
UTF-8
C++
false
false
13,532
cpp
Diff2Dlg.cpp
// Diff2Dlg.cpp : implementation file // #include "stdafx.h" #include "p4win.h" #include "Diff2Dlg.h" #include "MainFrm.h" #include "hlp\p4win.hh" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CDiff2Dlg dialog CDiff2Dlg::CDiff2Dlg(CWnd* pParent /*=NULL*/) : CDialog(CDiff2Dlg::IDD, pParent) { //{{AFX_DATA_INIT(CDiff2Dlg) m_Edit1 = _T(""); m_Edit2 = _T(""); m_RevNbr1 = _T(""); m_RevNbr2 = _T(""); m_Symbol1 = _T(""); m_Symbol2 = _T(""); m_RevRadio1 = 0; m_RevRadio2 = 0; m_DefaultRadio1 = GET_P4REGPTR()->GetDiff2Default1(); m_DefaultRadio2 = GET_P4REGPTR()->GetDiff2Default2(); //}}AFX_DATA_INIT m_InitRect = CRect(0,0,0,0); m_LastWidth = 0; m_IsFolders = FALSE; } void CDiff2Dlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CDiff2Dlg) DDX_Text(pDX, IDC_EDIT1, m_Edit1); DDX_Text(pDX, IDC_EDIT2, m_Edit2); DDX_Text(pDX, IDC_F_REVNBR, m_RevNbr1); DDX_Text(pDX, IDC_T_REVNBR, m_RevNbr2); DDX_Text(pDX, IDC_F_SYMBOL, m_Symbol1); DDX_Text(pDX, IDC_T_SYMBOL, m_Symbol2); DDX_Radio(pDX, IDC_USEHEADREV, m_RevRadio1); DDX_Radio(pDX, IDC_USEHEADREV2, m_RevRadio2); DDX_Radio(pDX, IDC_RADIO_1_HEAD, m_DefaultRadio1); DDX_Radio(pDX, IDC_RADIO_2_HEAD, m_DefaultRadio2); DDX_Control(pDX, IDC_F_COMBO, m_TypeCombo1); DDX_Control(pDX, IDC_T_COMBO, m_TypeCombo2); //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(CDiff2Dlg, CDialog) //{{AFX_MSG_MAP(CDiff2Dlg) ON_BN_CLICKED(IDHELP, OnHelp) ON_BN_CLICKED(IDC_USEHEADREV, OnUseHeadRev1) ON_BN_CLICKED(IDC_F_ISREVNBR, OnFIsrevnbr1) ON_BN_CLICKED(IDC_F_ISSYMBOL, OnFIssymbol1) ON_BN_CLICKED(IDC_CLIENTFILE, OnUseClientFile1) ON_BN_CLICKED(IDC_F_BROWSE, On1Browse) ON_CBN_SELCHANGE(IDC_F_COMBO, On1ComboValueChg) ON_BN_CLICKED(IDC_USEHEADREV2, OnUseHeadRev2) ON_BN_CLICKED(IDC_T_ISREVNBR, OnFIsrevnbr2) ON_BN_CLICKED(IDC_T_ISSYMBOL, OnFIssymbol2) ON_BN_CLICKED(IDC_CLIENTFILE2, OnUseClientFile2) ON_BN_CLICKED(IDC_T_BROWSE, On2Browse) ON_CBN_SELCHANGE(IDC_T_COMBO, On2ComboValueChg) ON_WM_HELPINFO() ON_WM_SIZE() ON_WM_GETMINMAXINFO() //}}AFX_MSG_MAP ON_MESSAGE(WM_BROWSECALLBACK1, On1BrowseCallBack) ON_MESSAGE(WM_BROWSECALLBACK2, On2BrowseCallBack) END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CDiff2Dlg message handlers BOOL CDiff2Dlg::OnInitDialog() { CDialog::OnInitDialog(); GetWindowRect(&m_InitRect); m_LastWidth = m_InitRect.Width(); int radio1 = m_DefaultRadio1; if (m_IsFolders) { SetWindowText(LoadStringResource(IDS_DIFF2FOLDERSCAPTION)); GetDlgItem(IDC_STATIC_1)->SetWindowText(LoadStringResource(IDS_FIRSTFOLDER)); GetDlgItem(IDC_STATIC_2)->SetWindowText(LoadStringResource(IDS_SECONDFOLDER)); GetDlgItem(IDC_CLIENTFILE)->SetWindowText(LoadStringResource(IDS_DIRHAVEREV)); GetDlgItem(IDC_CLIENTFILE2)->SetWindowText(LoadStringResource(IDS_DIRHAVEREV2)); GetDlgItem(IDC_RADIO_1_HEAD)->EnableWindow( FALSE ); GetDlgItem(IDC_RADIO_1_CLIENT)->EnableWindow( FALSE ); GetDlgItem(IDC_RADIO_1_REV)->EnableWindow( FALSE ); GetDlgItem(IDC_RADIO_2_HEAD)->EnableWindow( FALSE ); GetDlgItem(IDC_RADIO_2_CLIENT)->EnableWindow( FALSE ); GetDlgItem(IDC_RADIO_2_REV)->EnableWindow( FALSE ); GetDlgItem(IDC_RADIO_1_HEAD)->ShowWindow(SW_HIDE); GetDlgItem(IDC_RADIO_1_CLIENT)->ShowWindow(SW_HIDE); GetDlgItem(IDC_RADIO_1_REV)->ShowWindow(SW_HIDE); GetDlgItem(IDC_RADIO_2_HEAD)->ShowWindow(SW_HIDE); GetDlgItem(IDC_RADIO_2_CLIENT)->ShowWindow(SW_HIDE); GetDlgItem(IDC_RADIO_2_REV)->ShowWindow(SW_HIDE); } else { if (!m_HeadRev1) { GetDlgItem(IDC_USEHEADREV)->EnableWindow( FALSE ); if (!radio1) radio1 = 1; } if (m_HaveRev1.IsEmpty()) { radio1 = 1; GetDlgItem(IDC_USEHEADREV)->EnableWindow( FALSE ); GetDlgItem(IDC_F_ISREVNBR)->EnableWindow( FALSE ); GetDlgItem(IDC_F_ISSYMBOL)->EnableWindow( FALSE ); } else if (m_HaveRev1 == _T('0')) { GetDlgItem(IDC_CLIENTFILE)->EnableWindow( FALSE ); if (radio1 == 1) radio1 = 2; } if (m_RevNbr1 == _T('0')) m_RevNbr1.Empty(); switch(m_RevRadio1 = radio1) { case 0: break; case 1: OnUseClientFile1(); break; case 2: OnFIsrevnbr1(); break; case 3: OnFIssymbol1(); break; } int radio2 = m_DefaultRadio2; if (!m_HeadRev2) { GetDlgItem(IDC_USEHEADREV2)->EnableWindow( FALSE ); if (!radio2) radio2 = 1; } if (m_HaveRev2.IsEmpty()) { radio2 = 1; GetDlgItem(IDC_USEHEADREV2)->EnableWindow( FALSE ); GetDlgItem(IDC_T_ISREVNBR)->EnableWindow( FALSE ); GetDlgItem(IDC_T_ISSYMBOL)->EnableWindow( FALSE ); } else if (m_HaveRev2 == _T('0')) { GetDlgItem(IDC_CLIENTFILE2)->EnableWindow( FALSE ); if (radio2 == 1) radio2 = 2; } if (m_RevNbr2 == _T('0')) m_RevNbr2.Empty(); switch(m_RevRadio2 = radio2) { case 0: break; case 1: OnUseClientFile2(); break; case 2: OnFIsrevnbr2(); break; case 3: OnFIssymbol2(); break; } } GetDlgItem(IDC_F_STATIC)->ShowWindow(SW_HIDE); m_TypeCombo1.AddString(LoadStringResource(IDS_COMBO_CHGNBR)); m_TypeCombo1.AddString(LoadStringResource(IDS_COMBO_LABEL)); m_TypeCombo1.AddString(LoadStringResource(IDS_COMBO_DATE)); m_TypeCombo1.AddString(LoadStringResource(IDS_COMBO_CLIENT)); m_TypeCombo1.SetCurSel(0); GetDlgItem(IDC_T_STATIC)->ShowWindow(SW_HIDE); m_TypeCombo2.AddString(LoadStringResource(IDS_COMBO_CHGNBR)); m_TypeCombo2.AddString(LoadStringResource(IDS_COMBO_LABEL)); m_TypeCombo2.AddString(LoadStringResource(IDS_COMBO_DATE)); m_TypeCombo2.AddString(LoadStringResource(IDS_COMBO_CLIENT)); m_TypeCombo2.SetCurSel(0); UpdateData(FALSE); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } void CDiff2Dlg::OnUseHeadRev1() { GetDlgItem(IDC_F_REVNBR)->EnableWindow( FALSE ); GetDlgItem(IDC_F_SYMBOL)->EnableWindow( FALSE ); GetDlgItem(IDC_F_COMBO)->EnableWindow( FALSE ); GetDlgItem(IDC_F_BROWSE)->EnableWindow( FALSE ); } void CDiff2Dlg::OnUseClientFile1() { OnUseHeadRev1(); } void CDiff2Dlg::OnFIsrevnbr1() { GetDlgItem(IDC_F_REVNBR)->EnableWindow( TRUE ); GetDlgItem(IDC_F_SYMBOL)->EnableWindow( FALSE ); GetDlgItem(IDC_F_COMBO)->EnableWindow( FALSE ); GetDlgItem(IDC_F_BROWSE)->EnableWindow( FALSE ); GotoDlgCtrl(GetDlgItem(IDC_F_REVNBR)); } void CDiff2Dlg::OnFIssymbol1() { GetDlgItem(IDC_F_REVNBR)->EnableWindow( FALSE ); GetDlgItem(IDC_F_SYMBOL)->EnableWindow( TRUE ); GetDlgItem(IDC_F_COMBO)->EnableWindow( TRUE ); On1ComboValueChg(); GotoDlgCtrl(GetDlgItem(IDC_F_COMBO)); } void CDiff2Dlg::On1ComboValueChg() { switch(m_TypeCombo1.GetCurSel()) { default: case COMBO_CHGNBR: GetDlgItem(IDC_F_BROWSE)->EnableWindow( TRUE ); GetDlgItem(IDC_F_STATIC)->ShowWindow(SW_HIDE); break; case COMBO_LABEL: GetDlgItem(IDC_F_BROWSE)->EnableWindow( TRUE ); GetDlgItem(IDC_F_STATIC)->ShowWindow(SW_HIDE); break; case COMBO_CLIENT: GetDlgItem(IDC_F_BROWSE)->EnableWindow( TRUE ); GetDlgItem(IDC_F_STATIC)->ShowWindow(SW_HIDE); break; case COMBO_DATE: GetDlgItem(IDC_F_BROWSE)->EnableWindow( FALSE ); GetDlgItem(IDC_F_STATIC)->ShowWindow(SW_SHOW); break; } } void CDiff2Dlg::On1Browse() { HWND hWnd; switch(m_TypeCombo1.GetCurSel()) { case COMBO_CLIENT: hWnd = MainFrame()->ClientWnd(); break; case COMBO_LABEL: hWnd = MainFrame()->LabelWnd(); break; case COMBO_CHGNBR: hWnd = MainFrame()->OldChgsWnd(); break; default: hWnd = 0; break; } ::SendMessage(hWnd, WM_FETCHOBJECTLIST, (WPARAM)(this->m_hWnd), WM_BROWSECALLBACK1); GotoDlgCtrl(GetDlgItem(IDC_F_SYMBOL)); } LRESULT CDiff2Dlg::On1BrowseCallBack(WPARAM wParam, LPARAM lParam) { UpdateData(TRUE); CString *str = (CString *)lParam; m_Symbol1 = *str; UpdateData(FALSE); GotoDlgCtrl(GetDlgItem(IDC_F_SYMBOL)); return 0; } void CDiff2Dlg::OnUseHeadRev2() { GetDlgItem(IDC_T_REVNBR)->EnableWindow( FALSE ); GetDlgItem(IDC_T_SYMBOL)->EnableWindow( FALSE ); GetDlgItem(IDC_T_COMBO)->EnableWindow( FALSE ); GetDlgItem(IDC_T_BROWSE)->EnableWindow( FALSE ); } void CDiff2Dlg::OnUseClientFile2() { OnUseHeadRev2(); } void CDiff2Dlg::OnFIsrevnbr2() { GetDlgItem(IDC_T_REVNBR)->EnableWindow( TRUE ); GetDlgItem(IDC_T_SYMBOL)->EnableWindow( FALSE ); GotoDlgCtrl(GetDlgItem(IDC_T_REVNBR)); GetDlgItem(IDC_T_COMBO)->EnableWindow( FALSE ); GetDlgItem(IDC_T_BROWSE)->EnableWindow( FALSE ); } void CDiff2Dlg::OnFIssymbol2() { GetDlgItem(IDC_T_REVNBR)->EnableWindow( FALSE ); GetDlgItem(IDC_T_SYMBOL)->EnableWindow( TRUE ); GetDlgItem(IDC_T_COMBO)->EnableWindow( TRUE ); On2ComboValueChg(); GotoDlgCtrl(GetDlgItem(IDC_T_COMBO)); } void CDiff2Dlg::On2ComboValueChg() { switch(m_TypeCombo2.GetCurSel()) { default: case COMBO_CHGNBR: GetDlgItem(IDC_T_BROWSE)->EnableWindow( TRUE ); GetDlgItem(IDC_T_STATIC)->ShowWindow(SW_HIDE); break; case COMBO_LABEL: GetDlgItem(IDC_T_BROWSE)->EnableWindow( TRUE ); GetDlgItem(IDC_T_STATIC)->ShowWindow(SW_HIDE); break; case COMBO_CLIENT: GetDlgItem(IDC_T_BROWSE)->EnableWindow( TRUE ); GetDlgItem(IDC_T_STATIC)->ShowWindow(SW_HIDE); break; case COMBO_DATE: GetDlgItem(IDC_T_BROWSE)->EnableWindow( FALSE ); GetDlgItem(IDC_T_STATIC)->ShowWindow(SW_SHOW); break; } } void CDiff2Dlg::On2Browse() { HWND hWnd; switch(m_TypeCombo2.GetCurSel()) { case COMBO_CLIENT: hWnd = MainFrame()->ClientWnd(); break; case COMBO_LABEL: hWnd = MainFrame()->LabelWnd(); break; case COMBO_CHGNBR: hWnd = MainFrame()->OldChgsWnd(); break; default: hWnd = 0; break; } ::SendMessage(hWnd, WM_FETCHOBJECTLIST, (WPARAM)(this->m_hWnd), WM_BROWSECALLBACK2); GotoDlgCtrl(GetDlgItem(IDC_T_SYMBOL)); } LRESULT CDiff2Dlg::On2BrowseCallBack(WPARAM wParam, LPARAM lParam) { UpdateData(TRUE); CString *str = (CString *)lParam; m_Symbol2 = *str; UpdateData(FALSE); GotoDlgCtrl(GetDlgItem(IDC_T_SYMBOL)); return 0; } void CDiff2Dlg::OnHelp() { AfxGetApp()->WinHelp(m_IsFolders ? TASK_COMPARING_FOLDERS : ALIAS_99_COMPARING_ANY_2_FILES); } BOOL CDiff2Dlg::OnHelpInfo(HELPINFO* pHelpInfo) { OnHelp(); return TRUE; } void CDiff2Dlg::OnOK() { UpdateData(); int r1 = m_RevRadio1 ? m_RevRadio1==1 ? _tstoi(m_HaveRev1) : _tstoi(m_RevNbr1) : m_HeadRev1; int r2 = m_RevRadio2 ? m_RevRadio2==1 ? _tstoi(m_HaveRev2) : _tstoi(m_RevNbr2) : m_HeadRev2; if ((!r1 && m_RevRadio1 < 3 && m_RevRadio1 != 1) || (!r2 && m_RevRadio2 < 3 && m_RevRadio2 != 1)) { CString txt; txt.FormatMessage(IDS_CANT_DIFF_0_REV_FILES_s_n_s_n, m_Edit1, r1, m_Edit2, r2); AfxMessageBox(txt); return; } if (m_RevRadio1 == 2) { m_RevNbr1.TrimRight(); m_RevNbr1.TrimLeft(); m_RevNbr1.TrimLeft(_T("#@")); if (!m_RevNbr1.IsEmpty()) m_Edit1 += _T('#') + m_RevNbr1; } else if (m_RevRadio1 == 3) { m_Symbol1.TrimRight(); m_Symbol1.TrimLeft(); m_Symbol1.TrimLeft(_T("#@")); if (!m_Symbol1.IsEmpty()) m_Edit1 += _T('@') + m_Symbol1; } if (m_RevRadio2 == 2) { m_RevNbr2.TrimRight(); m_RevNbr2.TrimLeft(); m_RevNbr2.TrimLeft(_T("#@")); if (!m_RevNbr2.IsEmpty()) m_Edit2 += _T('#') + m_RevNbr2; } else if (m_RevRadio2 == 3) { m_Symbol2.TrimRight(); m_Symbol2.TrimLeft(); m_Symbol2.TrimLeft(_T("#@")); if (!m_Symbol2.IsEmpty()) m_Edit2 += _T('@') + m_Symbol2; } GET_P4REGPTR()->SetDiff2Default1(m_DefaultRadio1); GET_P4REGPTR()->SetDiff2Default2(m_DefaultRadio2); UpdateData(FALSE); CDialog::OnOK(); } void CDiff2Dlg::OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI) { if (m_InitRect.Height()) { lpMMI->ptMinTrackSize.x= m_InitRect.Width(); lpMMI->ptMinTrackSize.y= lpMMI->ptMaxTrackSize.y= m_InitRect.Height(); } } void CDiff2Dlg::OnSize(UINT nType, int cx, int cy) { CDialog::OnSize(nType, cx, cy); CWnd *pWnd=GetDlgItem(IDC_EDIT1); if (!pWnd || !IsWindow(pWnd->m_hWnd)) return; // Compute the change in width (dx) CRect rect; GetWindowRect(&rect); int dx = rect.Width() - m_LastWidth; // Save the new width m_LastWidth = rect.Width(); // Widen the edit and group boxes by the change in width (dx) pWnd->GetWindowRect(&rect); pWnd->SetWindowPos(NULL, 0, 0, rect.right - rect.left + dx, rect.bottom - rect.top, SWP_NOMOVE | SWP_NOZORDER); pWnd = GetDlgItem(IDC_EDIT2); pWnd->GetWindowRect(&rect); pWnd->SetWindowPos(NULL, 0, 0, rect.right - rect.left + dx, rect.bottom - rect.top, SWP_NOMOVE | SWP_NOZORDER); pWnd = GetDlgItem(IDC_STATIC1); pWnd->GetWindowRect(&rect); pWnd->SetWindowPos(NULL, 0, 0, rect.right - rect.left + dx, rect.bottom - rect.top, SWP_NOMOVE | SWP_NOZORDER); pWnd = GetDlgItem(IDC_STATIC2); pWnd->GetWindowRect(&rect); pWnd->SetWindowPos(NULL, 0, 0, rect.right - rect.left + dx, rect.bottom - rect.top, SWP_NOMOVE | SWP_NOZORDER); // Slide the buttons to the right by the change in width pWnd = GetDlgItem(IDOK); pWnd->GetWindowRect(&rect); ScreenToClient(rect); pWnd->SetWindowPos(NULL, rect.left + dx, rect.top, 0, 0, SWP_NOSIZE | SWP_NOZORDER); pWnd->InvalidateRect(NULL, TRUE); pWnd = GetDlgItem(IDCANCEL); pWnd->GetWindowRect(&rect); ScreenToClient(rect); pWnd->SetWindowPos(NULL, rect.left + dx, rect.top, 0, 0, SWP_NOSIZE | SWP_NOZORDER); pWnd->InvalidateRect(NULL, TRUE); pWnd = GetDlgItem(IDHELP); pWnd->GetWindowRect(&rect); ScreenToClient(rect); pWnd->SetWindowPos(NULL, rect.left + dx, rect.top, 0, 0, SWP_NOSIZE | SWP_NOZORDER); pWnd->InvalidateRect(NULL, TRUE); }
f4c86767a8a16c3c4c004dc7bd8c0b11cf0b21f9
2eb24e909d2e7de06f829c6be8838e09f0d83a26
/mainwindow.h
002d69f3c8dd628e060fe36b6a9cc8bb4a7dd62e
[]
no_license
minhmoc/SimulateMouseQt
f7cdb34fe3e87896ae279ba6bda6200e81fd42b5
56ffa0cd555398f38e55711fef2b42a7cf9762d3
refs/heads/master
2021-01-02T09:18:31.411151
2017-08-08T10:33:13
2017-08-08T10:33:13
99,186,168
0
0
null
null
null
null
UTF-8
C++
false
false
903
h
mainwindow.h
#ifndef MAINWINDOW_H #define MAINWINDOW_H #include <QMainWindow> namespace Ui { class MainWindow; } class MainWindow : public QMainWindow { Q_OBJECT public: explicit MainWindow(QWidget *parent = 0); MainWindow(QApplication *, QWidget *, QWidget *parent = 0); ~MainWindow(); void mousePressEvent(QMouseEvent *event); void mouseReleaseEvent(QMouseEvent *event); private: Ui::MainWindow *ui; public: void simulateMouse(QMouseEvent*); QApplication *getApp() const; void setApp(QApplication *value); private slots: void on_quit_clicked(); void on_siml_mouse_clicked(); void on_quit_pressed(); void on_lineEdit_cursorPositionChanged(int arg1, int arg2); void on_lineEdit_selectionChanged(); void on_siml_keyboard_clicked(); private: QApplication *app; QWidget *recvWidget; QMouseEvent *event; }; #endif // MAINWINDOW_H
9e4fc95cec250e268be741d3bd2e8a50465ffe63
abbda3a32dfca9649a80fe9cd139d96db5cfd3d0
/src/util/protocol/rtmp/RtmpChunkParser.cpp
8187c841e6a38ab687f980e7f74f61769796914f
[]
no_license
kaulszhang/base
71504ddb5c723b565cf881731e8b72b09a4bc790
a7793f8206bde26bd91a522d4f925fb923e6f6fc
refs/heads/master
2021-01-17T12:07:33.896641
2017-03-07T01:40:50
2017-03-07T01:40:50
84,057,340
5
2
null
null
null
null
UTF-8
C++
false
false
2,900
cpp
RtmpChunkParser.cpp
// RtmpChunkParser.cpp #include "util/Util.h" #include "util/protocol/rtmp/RtmpChunkParser.h" #include "util/protocol/rtmp/RtmpMessageContext.h" #include "util/protocol/rtmp/RtmpMessage.h" namespace util { namespace protocol { RtmpChunkParser::RtmpChunkParser( RtmpMessageContext * ctx) : ctx_(ctx) { } void RtmpChunkParser::parse( boost::asio::const_buffer const & buf) { boost::uint8_t const * b = boost::asio::buffer_cast<boost::uint8_t const *>(buf); boost::uint8_t const * e = b + boost::asio::buffer_size(buf); switch (step_) { case 0: size_ = 1; step_ = 1; break; case 1: chunk_.one_byte = *b; size_ = chunk_.size() + chunk_.msgh_size(); step_ = 2; break; case 2: { boost::uint8_t const * p = b; if (chunk_.size() == 1) { } else if (chunk_.size() == 2) { chunk_.cs_id1 = p[1]; } else { chunk_.cs_id2 = (boost::uint16_t)p[1] << 8 | p[2]; } p += chunk_.size(); if (chunk_.fmt < 3) { boost::uint32_t t = ((boost::uint32_t)p[0] << 16 | (boost::uint32_t)p[1] << 8 | p[2]); if (t == 0xffffff) { e += 4; } p += 3; } boost::uint16_t c = chunk_.cs_id(); RtmpChunkMessage & rchunk(ctx_->read.chunk(c)); boost::uint8_t t = 0; if (chunk_.fmt < 2) { boost::uint32_t l = ((boost::uint32_t)p[0] << 16 | (boost::uint32_t)p[1] << 8 | p[2]); t = p[3]; e += rchunk.left_size(l, t, ctx_->read.chunk_size()); } else { t = rchunk.message_type_id; e += rchunk.left_size(ctx_->read.chunk_size()); } ok_ = true; size_ = e - b; msg_def_ = RtmpMessage::find_msg(t); assert(msg_def_); step_ = 3; break; } default: assert(false); } } } // namespace protocol } // namespace util
b731af1bec580b99fad26bb8d41011d5656e93d6
e8ab6a8108801dfedb694557626fd847651564e2
/Dragon/src/operators/update/adam_update_op.cc
58209589c7590b4a928f9949e89ef31d8e0acc54
[ "BSD-2-Clause" ]
permissive
Spark001/Dragon-1
87f722bcb0feaec7fad29d923c60681cf9584267
310bcb5f6d9a6623bb58ed3d1ad02d1f440da474
refs/heads/master
2020-03-09T22:52:08.171500
2018-04-01T10:13:50
2018-04-01T10:13:50
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,042
cc
adam_update_op.cc
#include "operators/update/adam_update_op.h" #include "core/workspace.h" #include "utils/op_kernel.h" namespace dragon { template <class Context> void AdamUpdateOp<Context>::ComputeRunWithFloat() { m = ws()->CreateTensor("/mnt/" + Slot() + "/adam/m"); v = ws()->CreateTensor("/mnt/" + Slot() + "/adam/v"); tmp = ws()->CreateTensor("/mnt/" + Slot() + "/adam/tmp"); m->ReshapeLike(Input(0)); v->ReshapeLike(Input(0)); t++; coeff = sqrt(1. - pow(beta2, t)) / (1. - pow(beta1, t)); lr = Param("base_lr") * coeff * this->lr_mult; kernel::AdamUpdate<float, Context>(&Input(0), m, v, tmp, beta1, beta2, eps, lr); } DEPLOY_CPU(AdamUpdate); #ifdef WITH_CUDA DEPLOY_CUDA(AdamUpdate); #endif OPERATOR_SCHEMA(AdamUpdate).NumInputs(1).NumOutputs(1); NO_GRADIENT(AdamUpdate); } // namespace dragon
7bddeff639d452b15bf3e7a0ddb6b9ab3745e2e4
f30b6c91bdeae964707729399788553d703dec05
/Text fil manager/Text fil manager/filmanager.h
35e1aa4e81f305ebf2e5410fef8ce35f21a9a1ce
[]
no_license
Peter-Nil/Blue-n-Red
b1ac551b4d4cf6a0b51f6e164932a91e05145ddf
2d8f4dd99b5dd4331ad6a9cf28279c27c4a1f6c4
refs/heads/master
2020-04-06T05:00:00.844678
2014-08-04T15:48:49
2014-08-04T15:48:49
null
0
0
null
null
null
null
UTF-8
C++
false
false
276
h
filmanager.h
#ifndef FILMANAGER #define FILMANAGER #include "fil.h" #include "vector" class filmanager{ public: bool addFile(string name, string type); fil* getFile(string name, string type); fil* getFile(string name); private: vector<fil> files; vector<string> filenames; }; #endif