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
377b2ca55e64c5691e3d6a0cad5c25f079d37a00
0ef2acead56a452d88f89910e91fdf064516942b
/CG_Demo/CG_Demo/source/Cube.cpp
d8b0ee48cab759095ee9085614ebc8a2d54e4ac0
[ "MIT" ]
permissive
LDanielMedinaC/CG-at-sr
062b06e76004aa91e7a861605702ade82e9fd59e
095c95071131b356cec6ebe44124f97715df5186
refs/heads/master
2020-04-23T13:45:32.615801
2019-02-18T03:28:32
2019-02-18T03:28:32
171,208,125
0
0
null
null
null
null
UTF-8
C++
false
false
798
cpp
Cube.cpp
#include "..\header\Cube.h" Cube::Cube() { glLineWidth(3.0f); glBegin(GL_LINES); { glVertex3f(-0.5,0,0.5); glVertex3f(0.5, 0, 0.5); glVertex3f(0.5,0,0.5); glVertex3f(0.5,0,-0.5); glVertex3f(0.5,0,-0.5); glVertex3f(-0.5,0,-0.5); glVertex3f(-0.5,0,-0.5); glVertex3f(-0.5,0,0.5); glVertex3f(-0.5, -1, 0.5); glVertex3f(0.5, -1, 0.5); glVertex3f(0.5, -1, 0.5); glVertex3f(0.5, -1, -0.5); glVertex3f(0.5, -1, -0.5); glVertex3f(-0.5, -1, -0.5); glVertex3f(-0.5, -1, -0.5); glVertex3f(-0.5, -1, 0.5); glVertex3f(-0.5, 0, 0.5); glVertex3f(-0.5, -1, 0.5); glVertex3f(0.5, 0, 0.5); glVertex3f(0.5, -1, 0.5); glVertex3f(0.5, 0, -0.5); glVertex3f(0.5, -1, -0.5); glVertex3f(-0.5, 0, -0.5); glVertex3f(-0.5, -1, -0.5); }glEnd(); } Cube::~Cube() { }
6867512525d78d6c82608f5a7b72ce2013d939b3
9986a901b57342f40b6e8b0196058cf5055417ec
/0/p_rgh
c4fe42c61a4cccd33a779267ad69182775645ac4
[]
no_license
OFWaterResources/Spillway
e0cefbe38eee34519f8c0e35d27e09bf20a4c894
3cdc6b23f8566644cddf8f2ecd4b77a1bf59dd11
refs/heads/master
2021-01-20T04:36:07.433095
2017-04-28T12:15:59
2017-04-28T12:15:59
89,702,985
0
0
null
null
null
null
UTF-8
C++
false
false
2,179
p_rgh
/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: plus | | \\ / A nd | Web: www.OpenFOAM.com | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class volScalarField; object p_rgh; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [1 -1 -2 0 0 0 0]; internalField uniform 000; boundaryField { in { type totalPressure; p0 uniform 274680; //28 m upstream U U; phi phi; rho rho; psi none; gamma 1; value uniform 0; } aboveIn { type outletInlet; //zeroGradient if vector points into domain, 0 if pointing out of domain outletValue uniform 0; value uniform 0; } out { type totalPressure; p0 uniform 156960; //16 m downstream U U; phi phi; rho rho; psi none; gamma 1; value uniform 0; } aboveOut { type inletOutlet; //zeroGradient if vector points out of domain, 0 if pointing in inletValue uniform 0; value uniform 0; } fundo { type fixedFluxPressure; value uniform 0; } atmosfera { type inletOutlet; //zeroGradient if vector points out of domain, 0 if pointing in inletValue uniform 0; value uniform 0; } defaultFaces { type empty; } } // ************************************************************************* //
26e453cfa3547d7ac9631fe284656ec6e0ca070d
e000dfb2e1ddfe62598da937d2e0d40d6efff61b
/venusmmi/app/Cosmos/SNS/vapp_sns_imgviewer.h
62d989cea2cd22d7ebd7229cf3f4657b4086e912
[]
no_license
npnet/KJX_K7
9bc11e6cd1d0fa5996bb20cc6f669aa087bbf592
35dcd3de982792ae4d021e0e94ca6502d1ff876e
refs/heads/master
2023-02-06T09:17:46.582670
2020-12-24T02:55:29
2020-12-24T02:55:29
null
0
0
null
null
null
null
UTF-8
C++
false
false
14,483
h
vapp_sns_imgviewer.h
/* Copyright Statement: * -------------------- * This software is protected by Copyright and the information contained * herein is confidential. The software may not be copied and the information * contained herein may not be used or disclosed except with the written * permission of MediaTek Inc. (C) 2005 * * BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE") * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON * AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT. * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR * SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO * NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S * SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM. * * BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE * LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE, * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE, * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE. * * THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE * WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF * LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND * RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER * THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC). * *****************************************************************************/ /******************************************************************************* * Filename: * --------- * vapp_sns_imgviewer.h * * Project: * -------- * Venus * * Description: * ------------ * * * Author: * ------- * ------- * *============================================================================ * HISTORY * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!! *------------------------------------------------------------------------------ * removed! * * removed! * removed! * removed! * * removed! * removed! * removed! * * removed! * removed! * removed! * * removed! * removed! * removed! * * removed! * removed! * removed! * removed! * * removed! * removed! * removed! * * removed! * removed! * removed! * * removed! * removed! * removed! * * removed! * removed! * removed! * * removed! * removed! * removed! * * removed! * removed! * removed! * * removed! * removed! * removed! * * removed! * removed! * removed! * * removed! * removed! * removed! * * removed! * removed! * removed! * * removed! * removed! * removed! * * removed! * removed! * removed! * * removed! * removed! * removed! * * removed! * removed! * removed! * * removed! * removed! * removed! * * removed! * removed! * removed! * removed! * * removed! * removed! * removed! * * removed! * removed! * removed! * * removed! * removed! * removed! * * removed! * removed! * removed! * * removed! * removed! * removed! * * removed! * removed! * removed! * * removed! * removed! * removed! * * removed! * removed! * removed! * * removed! * removed! * removed! * * removed! * removed! * removed! * * removed! * removed! * removed! * removed! * * removed! * removed! * removed! * * removed! * removed! * removed! * * removed! * removed! * removed! * *------------------------------------------------------------------------------ * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!! *============================================================================ ****************************************************************************/ #ifndef __VAPP_SNS_IMGVIEWER__ #define __VAPP_SNS_IMGVIEWER__ /***************************************************************************** * Include *****************************************************************************/ #include "mmi_features.h" #ifdef __SOCIAL_NETWORK_SUPPORT__ #include "vapp_sns_base.h" #include "vfx_frame.h" #include "vfx_text_frame.h" #include "vcp_text_view.h" #include "vapp_sns_gprot.h" #include "vapp_sns_factory.h" #include "vapp_image_viewer_cp.h" #ifdef __cplusplus extern "C" { #endif #include "SnsSrvGprot.h" #ifdef __cplusplus } #endif #ifdef __MMI_SNS_ALBUM__ #define __SNS_TURN_ALBUM_FUNC_ON__ #endif class VappSnsBaseImgControl : public VfxControl { VFX_DECLARE_CLASS(VappSnsBaseImgControl); public: VfxSignal1 <VappSnsBaseImgControl *>m_signalClicked; protected: virtual VfxBool onPenInput(VfxPenEvent & event); private: #if defined(__MMI_MAINLCD_480X800__) #define VAPP_SNS_IMGCTRL_TAP_DISTANCE_RADIUS 20 #else #define VAPP_SNS_IMGCTRL_TAP_DISTANCE_RADIUS 10 #endif }; class VappSnsBaseImgViewer : public VappSnsBasePage, public IVappGalleryAsyncProvider { VFX_DECLARE_CLASS(VappSnsBaseImgViewer); public: VappSnsBaseImgViewer(); VappSnsBaseImgViewer(VfxU32 provider, VfxS32 aListId, VfxS32 index, VfxS32 total, VfxWChar *name, VfxChar* photoId, VfxChar* albumId, VfxBool isCommentTappable, VfxChar *userId = NULL, VfxBool supportRotate = VFX_FALSE); VappSnsBaseImgViewer(VfxU32 provider, VfxChar* photoId, VfxChar *userId = NULL, VfxBool isCommentTappable = VFX_TRUE, VfxBool supportRotate = VFX_FALSE); public: /* This signal is invoked in onExit() when image viewer was closed. So shouldn't do too many things in the callback */ VfxSignal2 <VfxS32, // [IN] current listId VfxS32> // [IN] current index m_signalGetCurrentState; public: // initialize the content provider // after provider is prepared, the total file count should be uptated virtual void prepare(); virtual VfxBool isPrepared() const; // check if content provider is dirty // if it's dirty, it should re-prepare virtual VfxBool canCheckDirty(); virtual VfxBool isDirty(); // get total file count (sum of all forlders) virtual VfxU32 getTotalFileCount(); // get file count in a list virtual VfxU32 getFileCount(VfxS32 listIndex); virtual VfxBool cancelFilePathQuery(); virtual VfxBool cancelFilePathQuery(const VcpMenuPos index); // get file path by index // note getFilePath() is an async funciton since we need to query from Internet/SN // while file is ready, provider should call FileReadyCallback to update file path info according to the index virtual void getFilePath(const VcpMenuPos index, FileReadyCallback fileReadyCB, void* userData); protected: virtual void onInit(); virtual void onDeinit(); virtual void onEnter(VfxBool isBackWard); virtual void onExit(VfxBool isBackward); virtual void onExited2(); virtual void onEntered(); virtual void onQueryRotateEx(VfxScreenRotateParam &param); virtual void onBack(); virtual void onRotate(const VfxScreenRotateParam &param); virtual void setBounds(const VfxRect &value); protected: VfxFrame *m_titleBg; VfxTextFrame *m_albumName; VfxTextFrame *m_picIdx; VfxFrame *m_descBg; VcpTextView *m_desc; VappSnsBaseImgControl *m_imgFrame; VappImageViewerComponent *m_imgViewer; VcpIndicatorPopup *m_saving; private: void onToolbarButtonTap(VfxObject *obj, VfxId id); void onDescriptionTap(VcpTextView *obj, VcpTextTapAreaEnum area, VcpRichTextFormat *format); void onDetectGesture(VappGalleryGesture gesture, VfxS32 currentPreviewIndex); void onCurrentPanelChanged(const VfxS32 currentIndex); void onHandleClicked(VappSnsBaseImgControl *obj); void handleObjectHidden(); void hideAllFrames(VfxBool isHide); void disableToolbar(VcpToolBar *toolbar, VfxBool isDisabled); void setCurrentPhotoInfo(srv_sns_photo_struct* photo); void setAlbumName(VfxWChar* name); void updateTitleIndex(); void createImageViewCp(); void saveToLocal(); srv_sns_photo_struct* LoadAlbum(VfxS32 index); void loadAlbumInfo(); void queryPicture(VfxS32 index, FileReadyCallback queryCB, void *user_data); /* For get photo information */ static mmi_ret onLoadPhotoCb(mmi_event_struct *param); /* For load album contents */ static mmi_ret onLoadAlbumListCb(mmi_event_struct *param); /* For download picture */ static mmi_ret onEvtHdlr(mmi_event_struct *param); /* For save to local */ static mmi_ret onAsyncCopyCb(mmi_event_struct *param); static mmi_ret onLoadAlbumInfoCb(mmi_event_struct *param); void handleLoadPhoto(mmi_event_struct * param); void handleLoadAlbumList(mmi_event_struct * param); void handleLoadAlbumInfo(mmi_event_struct * param); void handleEvtHdlr(mmi_event_struct *param); void updateCustomizedToolBar(VfxId updatedId); void updateCustomizedToolBarStatus(VfxId updatedId); void postToCaller(VfxS32 index, VfxChar* path, VfxS32 err, void *user_data); void setUndecodePic(); private: #define SNS_MAX_RENAME_COUNTSTR_LEN 4 /* (50) <= 4 chars */ #define SNS_MAX_RENAME_TIMES 50 #define EXTEND_TOOLBAR_BUTTON_ID_BASE 1111 #define CLR_DESC VfxColor(255, 80, 80, 80) #define IV_DEBUG_TAG 'IVwer' enum{ IV_DEBUG_REQ = 0, IV_DEBUG_RSP }; enum { #ifdef __MMI_MAINLCD_480X800__ ITEM_W = 480, ITEM_H = 800, ITEM_LAND_W = 800, ITEM_LAND_H = 480, STATUS_BAR_H = 38, TOOLBAR_H = 85, TITLE_H = 85, TITLE_LAND_H = 58, FONT_SIZE_ALBUM_NAME = 35, FONT_SIZE_PIC_COUNT = 26, FONT_SIZE_DESC = 21, ALBUM_NAME_LR_GAP = 14, ALBUM_NAME_LAND_LR_GAP = 16, ALBUM_NAME_T_GAP = 9, ALBUM_NAME_W = (ITEM_W - ALBUM_NAME_LR_GAP*2), ALBUM_NAME_LAND_W = ALBUM_NAME_W, ALBUM_NAME_H = (FONT_SIZE_ALBUM_NAME+2), PIC_COUNT_ALBUM_NAME_GAP = 1, PIC_COUNT_T_GAP = (ALBUM_NAME_T_GAP+ALBUM_NAME_H+PIC_COUNT_ALBUM_NAME_GAP), PIC_COUNT_W = ALBUM_NAME_W, PIC_COUNT_LAND_W = ITEM_LAND_W - ALBUM_NAME_LAND_W, PIC_COUNT_H = (FONT_SIZE_PIC_COUNT+2), DESC_TB_GAP = 12, DESC_LAND_T_GAP = 6, DESC_LAND_B_GAP = 12, DESC_LR_GAP = 14, DESC_LAND_LR_GAP = 16, DESC_W = (ITEM_W - DESC_LR_GAP*2), DESC_LAND_W = (ITEM_LAND_W - DESC_LAND_LR_GAP*2), DESC_MAX_H = (ITEM_H - TITLE_H*2 - DESC_TB_GAP*2), DESC_MIN_H = 100, #elif __MMI_MAINLCD_320X480__ ITEM_W = 320, ITEM_H = 480, ITEM_LAND_W = 480, ITEM_LAND_H = 320, STATUS_BAR_H = 24, TOOLBAR_H = 50, TITLE_H = 48, TITLE_LAND_H = 30, FONT_SIZE_ALBUM_NAME = 20, FONT_SIZE_PIC_COUNT = 14, FONT_SIZE_DESC = 14, ALBUM_NAME_LR_GAP = 14, ALBUM_NAME_LAND_LR_GAP = 10, ALBUM_NAME_T_GAP = 5, ALBUM_NAME_W = (ITEM_W - ALBUM_NAME_LR_GAP*2), ALBUM_NAME_LAND_W = ALBUM_NAME_W, ALBUM_NAME_H = (FONT_SIZE_ALBUM_NAME+2), PIC_COUNT_ALBUM_NAME_GAP = 1, PIC_COUNT_T_GAP = (ALBUM_NAME_T_GAP+ALBUM_NAME_H+PIC_COUNT_ALBUM_NAME_GAP), PIC_COUNT_W = ALBUM_NAME_W, PIC_COUNT_LAND_W = ITEM_LAND_W - ALBUM_NAME_LAND_W, PIC_COUNT_H = (FONT_SIZE_PIC_COUNT+2), DESC_TB_GAP = 8, DESC_LAND_T_GAP = 6, DESC_LAND_B_GAP = 8, DESC_LR_GAP = 8, DESC_LAND_LR_GAP = 10, DESC_W = (ITEM_W - DESC_LR_GAP*2), DESC_LAND_W = (ITEM_LAND_W - DESC_LAND_LR_GAP*2), DESC_MAX_H = (ITEM_H - TITLE_H*2 - DESC_TB_GAP*2), DESC_MIN_H = 74, #else ITEM_W = 240, #ifdef __MMI_MAINLCD_240X320__ ITEM_H = 320, ITEM_LAND_W = 320, #else ITEM_H = 400, ITEM_LAND_W = 400, #endif /* __MMI_MAINLCD_240X320__ */ ITEM_LAND_H = 240, STATUS_BAR_H = 24, TOOLBAR_H = 45, TITLE_H = 42, TITLE_LAND_H = 26, FONT_SIZE_ALBUM_NAME = 16, FONT_SIZE_PIC_COUNT = 14, FONT_SIZE_DESC = 13, ALBUM_NAME_LR_GAP = 5, ALBUM_NAME_LAND_LR_GAP = 5, ALBUM_NAME_T_GAP = 3, ALBUM_NAME_W = (ITEM_W - ALBUM_NAME_LR_GAP*2), ALBUM_NAME_LAND_W = ALBUM_NAME_W, ALBUM_NAME_H = (FONT_SIZE_ALBUM_NAME+2), PIC_COUNT_ALBUM_NAME_GAP = 1, PIC_COUNT_T_GAP = (ALBUM_NAME_T_GAP+ALBUM_NAME_H+PIC_COUNT_ALBUM_NAME_GAP), PIC_COUNT_W = ALBUM_NAME_W, PIC_COUNT_LAND_W = ITEM_LAND_W - ALBUM_NAME_LAND_W, PIC_COUNT_H = (FONT_SIZE_PIC_COUNT+2), DESC_TB_GAP = 5, DESC_LAND_T_GAP = 5, DESC_LAND_B_GAP = 5, DESC_LR_GAP = 5, DESC_LAND_LR_GAP = 5, DESC_W = (ITEM_W - DESC_LR_GAP*2), DESC_LAND_W = (ITEM_LAND_W - DESC_LAND_LR_GAP*2), DESC_MAX_H = (ITEM_H - TITLE_H*2 - DESC_TB_GAP*2), DESC_MIN_H = 38, #endif }; VfxBool m_disableSwitchBalloon; VfxBool m_isFg; VfxBool m_stopCallback; // Custom tool bar controller VappSnsToolBarController *m_customizedTbCtrl; VfxS32 m_jobId; VfxS32 m_downIndex; VfxS32 m_downReqId; VfxS32 m_pListId; VfxS32 m_aListId; VfxS32 m_aInfoId; VfxBool m_prepare; VfxBool m_isCommentTappable; VfxBool m_supportRotate; VfxBool m_fromAlbum; VfxS32 m_index; VfxS32 m_loadIdx; VfxS32 m_total; VfxU32 m_provider; VfxChar *m_photoId; VfxChar *m_albumId; VfxChar *m_userId; VfxChar *m_name; VfxChar *m_path; VfxChar *m_descText; void *m_gUserData; /* user data of gallery cp */ FileReadyCallback m_queryCB; srv_sns_photo_struct* m_photo; #ifdef __SNS_TURN_ALBUM_FUNC_ON__ VappGalleryViewerMediaState m_initState; #endif }; #endif /* __SOCIAL_NETWORK_SUPPORT__ */ #endif /* __VAPP_SNS_IMGVIEWER__ */
ef96adbf97efe4f3a2bb06acac78e1f374c7aa3c
4ed5d5b463602be08360d7a83b9bd2b02e30a559
/include/example/ImageProcessor.h
c36cc52b59e29e5216c098ff547ce1f723f6ef9b
[ "MIT" ]
permissive
automyinc/vnx-examples
1513fa06a233af8791dcbac9e76b386a0e9ab41b
492423bb8c8447f641e5691f45575056cab396df
refs/heads/master
2021-08-17T15:27:02.032292
2020-03-08T12:09:08
2020-03-08T12:09:08
143,607,708
0
0
null
null
null
null
UTF-8
C++
false
false
2,849
h
ImageProcessor.h
#ifndef INCLUDE_EXAMPLE_IMAGEPROCESSOR_H #define INCLUDE_EXAMPLE_IMAGEPROCESSOR_H #include <example/ImageProcessorBase.hxx> #include <automy/basic/ImageFrameF32.hxx> using namespace automy; namespace example { /* * The ImageProcessor example receives 8-bit image data and converts them to 32-bit float. */ class ImageProcessor : public ImageProcessorBase { public: /** * Typically we don't want to hard-code a module name so we pass a name through * and let the user pick one when creating an instance. */ ImageProcessor(const std::string& _vnx_name) : ImageProcessorBase(_vnx_name) { } /* * Besides the constructor all functions should be at least protected. */ protected: /** * The main() function will be called when the module is started in its own thread. */ void main() override { /* * We subscribe to our input with a max queue length of 10 ms, * which means given a frame rate of 50 Hz at most one frame is going to be * buffered in the input queue, first in first out. */ subscribe(input, 10); // Enter main processing loop Super::main(); } /** * The handle() function will be called from within Super::main() every time a * basic::ImageFrame8 sample is received. */ void handle(std::shared_ptr<const basic::ImageFrame8> value) override { const basic::Image8& src = value->image; const uint32_t width = src.width(); const uint32_t height = src.height(); /* * We create a new sample value (basic::ImageFrame8) to be published directly * instead of creating it on the stack and then having it copied when publishing. */ std::shared_ptr<basic::ImageFrameF32> out = basic::ImageFrameF32::create(); out->time = value->time; out->frame = value->frame; out->format = value->format; out->properties = value->properties; /* * In this example we convert 8 bit integer to 32 bit float. */ basic::ImageF32& dst = out->image; dst.resize(width, height); for(int y = 0; y < height; ++y) { for(int x = 0; x < width; ++x) { dst(x, y) = float(src(x, y)) * scale_factor; } } /* * We publish our sample value directly on topic 'output'. Directly means other modules * in this process will receive a const pointer to our data (ie. zero copy), so we cannot modify * the data anymore after the publish() call as doing so can cause memory corruption. */ publish(out, output); /* * After publish() we can keep the sample value "out" but we may not modify it anymore since other threads * could have and keep a pointer to the data forever. * * For example: out->image.clear(); // can cause a segfault if another module is accessing the image */ log(INFO).out << "Processed frame " << out->get_property("sequence"); } }; } // example #endif /* INCLUDE_EXAMPLE_IMAGEPROCESSOR_H */
94019817579a1b3d7fbe42af54fded8fa066252b
96cfaaa771c2d83fc0729d8c65c4d4707235531a
/RecoLocalMuon/CSCRecHitB/src/CSCStripData.h
13a1adc2d374263c63bdd2caec212136bf6777ff
[]
no_license
khotilov/cmssw
a22a160023c7ce0e4d59d15ef1f1532d7227a586
7636f72278ee0796d0203ac113b492b39da33528
refs/heads/master
2021-01-15T18:51:30.061124
2013-04-20T17:18:07
2013-04-20T17:18:07
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,480
h
CSCStripData.h
#ifndef CSCRecHitB_CSCStripData_h #define CSCRecHitB_CSCStripData_h /** \class CSCStripData * * Hold strip data while building strip hits. * * \author Dominique Fortin */ class CSCStripData { public: /* The default ctor initializes all elements of thePulseHeightMap for * which explicit digis do not exist. Thus the y's must be 0. * Use sentinel value for x and t. */ CSCStripData() : x_(-1.), ymax_(0.), t_(-1), y2_(0.), y3_(0.), y4_(0.), y5_(0.), y6_(0.), y7_(0.) {}; CSCStripData( float x, float ymax, int t, float y2, float y3, float y4, float y5, float y6, float y7) : x_(x), ymax_(ymax), t_(t), y2_(y2), y3_(y3), y4_(y4), y5_(y5), y6_(y6), y7_(y7) {}; float x() const {return x_;} float ymax() const {return ymax_;} int t() const {return t_;} float y2() const {return y2_;} float y3() const {return y3_;} float y4() const {return y4_;} float y5() const {return y5_;} float y6() const {return y6_;} float y7() const {return y7_;} bool operator<( const CSCStripData & data ) const { return ymax_ < data.ymax_; } void operator*=( float addend) { ymax_ *= addend; y2_ *= addend; y3_ *= addend; y4_ *= addend; y5_ *= addend; y6_ *= addend; y7_ *= addend; } private: float x_; float ymax_; int t_; float y2_; float y3_; float y4_; float y5_; float y6_; float y7_; }; #endif
8d473b91344e369f7e8622b7f648c359cc5aed94
3e0f0fffee8097c150a8ba303ef4b23ceec860c5
/HybridAStar/include/Reeds-Shepp/CCC.h
5db941386042dfca9c9d817f1d9870ba9da9ef42
[]
no_license
mapbufo/mapBuildingWithFocusPoint
5f01b911abff283fbf79e335300475588346d591
9a9053b85cd9df5e716f8a7caf0108aa272cc0cb
refs/heads/master
2023-01-04T02:49:14.498345
2020-10-13T17:52:49
2020-10-13T17:52:49
277,078,636
0
0
null
null
null
null
UTF-8
C++
false
false
3,599
h
CCC.h
#pragma once #include "RSPath.h" #include "FormularList.h" #include <iostream> #include <limits> #include <string> #include "RSPathElem.h" bool CCC(float x, float y, float phi, RSPath &path) { float Lmin = std::numeric_limits<float>::max(); std::vector<int> type = {RS_NOP, RS_NOP, RS_NOP, RS_NOP, RS_NOP}; path.update(type, 0.0, 0.0, 0.0, 0.0, 0.0); float t, u, v = 0.0; bool isOk = false; // normal isOk = LpRmL(x, y, phi, t, u, v); // std::cerr << t << " " << u << " " << v << " " << 0 << " " << 0 << " " << std::endl; if (isOk) { float L = std::fabs(t) + std::fabs(u) + std::fabs(v); if (Lmin > L) { Lmin = L; path.update(RSPathType["Type01"], t, u, v, 0, 0); } } // timeflip isOk = LpRmL(-x, y, -phi, t, u, v); // std::cerr << t << " " << u << " " << v << " " << 0 << " " << 0 << " " << std::endl; if (isOk) { float L = std::fabs(t) + std::fabs(u) + std::fabs(v); if (Lmin > L) { Lmin = L; path.update(RSPathType["Type01"], -t, -u, -v, 0, 0); } } // reflect isOk = LpRmL(x, -y, -phi, t, u, v); // std::cerr << t << " " << u << " " << v << " " << 0 << " " << 0 << " " << std::endl; if (isOk) { float L = std::fabs(t) + std::fabs(u) + std::fabs(v); if (Lmin > L) { Lmin = L; path.update(RSPathType["Type02"], t, u, v, 0, 0); } } // timeflip + reflect isOk = LpRmL(-x, -y, phi, t, u, v); // std::cerr << t << " " << u << " " << v << " " << 0 << " " << 0 << " " << std::endl; if (isOk) { float L = std::fabs(t) + std::fabs(u) + std::fabs(v); if (Lmin > L) { Lmin = L; path.update(RSPathType["Type02"], -t, -u, -v, 0, 0); } } // backwards // normal float xb = x * cos(phi) + y * sin(phi); float yb = x * sin(phi) - y * cos(phi); isOk = LpRmL(xb, yb, phi, t, u, v); // std::cerr << t << " " << u << " " << v << " " << 0 << " " << 0 << " " << std::endl; if (isOk) { float L = std::fabs(t) + std::fabs(u) + std::fabs(v); if (Lmin > L) { Lmin = L; path.update(RSPathType["Type01"], v, u, t, 0, 0); } } // timeflip isOk = LpRmL(-xb, yb, -phi, t, u, v); // std::cerr << t << " " << u << " " << v << " " << 0 << " " << 0 << " " << std::endl; if (isOk) { float L = std::fabs(t) + std::fabs(u) + std::fabs(v); if (Lmin > L) { Lmin = L; path.update(RSPathType["Type01"], -v, -u, -t, 0, 0); } } // reflect isOk = LpRmL(xb, -yb, -phi, t, u, v); // std::cerr << t << " " << u << " " << v << " " << 0 << " " << 0 << " " << std::endl; if (isOk) { float L = std::fabs(t) + std::fabs(u) + std::fabs(v); if (Lmin > L) { Lmin = L; path.update(RSPathType["Type02"], v, u, t, 0, 0); } } // timeflip + reflect isOk = LpRmL(-xb, -yb, phi, t, u, v); // std::cerr << t << " " << u << " " << v << " " << 0 << " " << 0 << " " << std::endl; if (isOk) { float L = std::fabs(t) + std::fabs(u) + std::fabs(v); if (Lmin > L) { Lmin = L; path.update(RSPathType["Type02"], -v, -u, -t, 0, 0); } } if (Lmin == std::numeric_limits<float>::max()) { isOk = false; } else { isOk = true; } return isOk; }
a30cf3af617bec58b77efba6cea35db7b42a44f8
7901e09d4f0827e0590fa6a7f038e7d9363e903b
/cpp_stl/cont/newkey.cpp
bb9019b3604bdbfaf162f76dd6ada15184646bb1
[]
no_license
jiesoul/c_cpp_learn
32298fa21d159d3fc9a6c0c2711700548db9e4a2
cd4e411f73222dd26d22c1110ce0af4ecc60f051
refs/heads/main
2023-03-16T15:54:54.553175
2022-06-14T05:30:51
2022-06-14T05:30:51
204,853,153
0
0
null
null
null
null
UTF-8
C++
false
false
444
cpp
newkey.cpp
// // Created by jiesoul on 2019/10/15. // namespace MyLib { template <typename Cont> inline bool replace_key(Cont& c, const typename Cont::key_type& old_key, const typename Cont::key_type& new_key) { typename Cont::iterator pos; pos = c.find(old_key); if (pos != c.end()) { c.insert(typename Cont::value_type(new_key, pos->second)); c.erase(pos); return true; } else { return false; } } }
ebb08f62dd6bfc52a30a61f3956017963aa4cc0f
514fd4f09243055e4769efb426710338048454b1
/tensorflow/core/grappler/mutable_graph_view.cc
224b720328a36e37079244acf952873ec8fc47c8
[ "Apache-2.0" ]
permissive
nnsuite/ubuntuport-tensorflow
7fa1d26f3cc282cd725bd87f2864c8ac2e76bf99
01ea2d56d3f87063f86076e45673fa49794eebb0
refs/heads/debian/c_api/1.13.1
2022-12-14T03:14:59.691723
2022-12-06T07:29:53
2022-12-07T00:46:40
202,048,406
2
8
Apache-2.0
2022-12-07T00:46:41
2019-08-13T02:36:22
C++
UTF-8
C++
false
false
13,596
cc
mutable_graph_view.cc
/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ==============================================================================*/ #include "tensorflow/core/grappler/mutable_graph_view.h" #include <algorithm> #include <utility> #include "absl/strings/str_cat.h" #include "absl/strings/substitute.h" #include "tensorflow/core/framework/graph.pb.h" #include "tensorflow/core/framework/node_def.pb.h" #include "tensorflow/core/graph/graph.h" #include "tensorflow/core/graph/tensor_id.h" #include "tensorflow/core/grappler/op_types.h" #include "tensorflow/core/grappler/utils.h" #include "tensorflow/core/lib/core/stringpiece.h" #include "tensorflow/core/platform/types.h" namespace tensorflow { namespace grappler { namespace { bool IsTensorIdPortValid(const TensorId& tensor_id) { return tensor_id.index() >= Graph::kControlSlot; } } // namespace const absl::flat_hash_set<MutableGraphView::InputPort>& MutableGraphView::GetFanout(const GraphView::OutputPort& port) const { return GetFanout(MutableGraphView::OutputPort(const_cast<NodeDef*>(port.node), port.port_id)); } absl::flat_hash_set<MutableGraphView::OutputPort> MutableGraphView::GetFanin( const GraphView::InputPort& port) const { return GetFanin(MutableGraphView::InputPort(const_cast<NodeDef*>(port.node), port.port_id)); } const MutableGraphView::OutputPort MutableGraphView::GetRegularFanin( const GraphView::InputPort& port) const { return GetRegularFanin(MutableGraphView::InputPort( const_cast<NodeDef*>(port.node), port.port_id)); } NodeDef* MutableGraphView::AddNode(NodeDef&& node) { auto* node_in_graph = graph()->add_node(); *node_in_graph = std::move(node); AddUniqueNodeOrDie(node_in_graph); AddFanouts(node_in_graph); return node_in_graph; } void MutableGraphView::UpdateFanouts(absl::string_view from_node, absl::string_view to_node) { NodeDef* from_node_ptr = GetNode(from_node); NodeDef* to_node_ptr = GetNode(to_node); if (from_node_ptr && to_node_ptr) { UpdateFanouts(from_node_ptr, to_node_ptr); } else if (!from_node_ptr) { LOG(WARNING) << absl::Substitute( "Can't update fanouts from '$0' to '$1', from node was not found.", from_node, to_node); } else { LOG(WARNING) << absl::Substitute( "Can't update fanouts from '$0' to '$1', to node was not found.", from_node, to_node); } } void MutableGraphView::UpdateFanouts(NodeDef* from_node, NodeDef* to_node) { VLOG(2) << absl::Substitute("Update fanouts from '$0' to '$1'.", from_node->name(), to_node->name()); // Update internal state with the new output_port->input_port edge. const auto add_edge = [this](const OutputPort& output_port, const InputPort& input_port) { fanouts()[output_port].insert(input_port); }; // Remove invalidated edge from the internal state. const auto remove_edge = [this](const OutputPort& output_port, const InputPort& input_port) { fanouts()[output_port].erase(input_port); }; // First we update regular fanouts. For the regular fanouts // `input_port:port_id` is the input index in NodeDef. auto regular_edges = GetFanoutEdges(*from_node, /*include_controlled_edges=*/false); // Maximum index of the `from_node` output tensor that is still used as an // input to some other node. int keep_max_regular_output_port = -1; for (const Edge& edge : regular_edges) { const OutputPort output_port = edge.src; const InputPort input_port = edge.dst; // If the `to_node` reads from the `from_node`, skip this edge (see // AddAndUpdateFanoutsWithoutSelfLoops test for an example). if (input_port.node == to_node) { keep_max_regular_output_port = std::max(keep_max_regular_output_port, input_port.port_id); continue; } // Update input at destination node. input_port.node->set_input( input_port.port_id, output_port.port_id == 0 ? to_node->name() : absl::StrCat(to_node->name(), ":", output_port.port_id)); // Remove old edge between the `from_node` and the fanout node. remove_edge(output_port, input_port); // Add an edge between the `to_node` and new fanout node. add_edge(OutputPort(to_node, output_port.port_id), input_port); } // For the control fanouts we do not know the input index in a NodeDef, // so we have to traverse all control inputs. auto control_fanouts = GetFanout(GraphView::OutputPort(from_node, Graph::kControlSlot)); if (control_fanouts.empty()) return; const string from_control_input = absl::StrCat("^", from_node->name()); const string to_control_input = absl::StrCat("^", to_node->name()); for (const InputPort& control_port : control_fanouts) { // Node can't be control dependency of itself. if (control_port.node == to_node) continue; // Find and update input corresponding to control dependency. NodeDef* node = control_port.node; for (int i = node->input_size() - 1; i >= 0; --i) { const string& input = node->input(i); if (!IsControlInput(input)) break; // we reached regular inputs if (input == from_control_input) { node->set_input(i, to_control_input); } } // Remove old edge between the `from_node` and the fanout node. remove_edge(OutputPort(from_node, Graph::kControlSlot), control_port); // Add an edge between the `to_node` and new fanout node. add_edge(OutputPort(to_node, Graph::kControlSlot), control_port); } // Because we update all regular fanouts of `from_node`, we can just copy // the value `num_regular_outputs`. max_regular_output_port()[to_node] = max_regular_output_port()[from_node]; // Check if all fanouts were updated to read from the `to_node`. if (keep_max_regular_output_port >= 0) { max_regular_output_port()[from_node] = keep_max_regular_output_port; } else { max_regular_output_port().erase(from_node); } } bool MutableGraphView::AddFanin(NodeDef* node, const TensorId& fanin) { NodeDef* fanin_node = GetNode(fanin.node()); if (fanin_node == nullptr) { return false; } int num_non_controlling_fanins = NumFanins(*node, /*include_controlling_nodes=*/false); InputPort input; input.node = node; input.port_id = fanin.index() == Graph::kControlSlot ? Graph::kControlSlot : num_non_controlling_fanins; OutputPort fanin_port(fanin_node, fanin.index()); if (!gtl::InsertIfNotPresent(&fanouts()[fanin_port], input)) { return false; } node->add_input(TensorIdToString(fanin)); if (fanin.index() > Graph::kControlSlot) { int node_input_size = node->input_size() - 1; // If there are control dependencies in node, move newly inserted fanin to // be before such control dependencies. if (num_non_controlling_fanins < node_input_size) { node->mutable_input()->SwapElements(node_input_size, num_non_controlling_fanins); } } return true; } bool MutableGraphView::AddFanin(absl::string_view node_name, const TensorId& fanin) { if (!IsTensorIdPortValid(fanin)) { return false; } NodeDef* node = GetNode(node_name); if (node == nullptr) { return false; } return AddFanin(node, fanin); } bool MutableGraphView::RemoveFanins(NodeDef* node, absl::Span<const TensorId> fanins) { bool modified = false; auto mutable_inputs = node->mutable_input(); int curr_pos = 0; int num_inputs = node->input_size(); for (int i = 0; i < num_inputs; ++i) { TensorId tensor_id = ParseTensorName(node->input(i)); bool remove_fanin = std::find(fanins.begin(), fanins.end(), tensor_id) != fanins.end(); bool update_fanin = !remove_fanin && modified; if (remove_fanin || update_fanin) { OutputPort fanin(nodes()[tensor_id.node()], tensor_id.index()); InputPort input; input.node = node; input.port_id = tensor_id.index() == Graph::kControlSlot ? Graph::kControlSlot : i; if (remove_fanin) { fanouts()[fanin].erase(input); } else { // Shift inputs to be retained. if (tensor_id.index() > Graph::kControlSlot) { fanouts()[fanin].erase(input); fanouts()[fanin].insert(InputPort(node, i)); } mutable_inputs->SwapElements(i, curr_pos++); } modified = true; } else { // Skip inputs to be retained until first modification. curr_pos++; } } if (modified) { mutable_inputs->DeleteSubrange(curr_pos, num_inputs - curr_pos); } return modified; } bool MutableGraphView::RemoveFanin(absl::string_view node_name, const TensorId& fanin) { if (!IsTensorIdPortValid(fanin)) { return false; } NodeDef* node = GetNode(node_name); if (node == nullptr) { return false; } return RemoveFanins(node, {fanin}); } bool MutableGraphView::RemoveAllFanins(absl::string_view node_name, bool keep_controlling_fanins) { NodeDef* node = GetNode(node_name); if (node == nullptr || node->input().empty()) { return false; } RemoveFaninsInternal(node, keep_controlling_fanins); if (keep_controlling_fanins) { int num_non_controlling_fanins = NumFanins(*node, /*include_controlling_nodes=*/false); if (num_non_controlling_fanins == 0) { return false; } else if (num_non_controlling_fanins < node->input_size()) { node->mutable_input()->DeleteSubrange(0, num_non_controlling_fanins); } else { node->clear_input(); } } else { node->clear_input(); } return true; } bool MutableGraphView::UpdateFanin(absl::string_view node_name, const TensorId& from_fanin, const TensorId& to_fanin) { if (from_fanin == to_fanin || !IsTensorIdPortValid(from_fanin) || !IsTensorIdPortValid(to_fanin)) { return false; } NodeDef* node = GetNode(node_name); if (node == nullptr) { return false; } bool is_from_fanin_control = from_fanin.index() == Graph::kControlSlot; bool is_to_fanin_control = to_fanin.index() == Graph::kControlSlot; // When replacing a non control dependency fanin with a control dependency, or // vice versa, remove and add, so ports can be updated properly in fanout(s). if (is_from_fanin_control || is_to_fanin_control) { bool modified = RemoveFanins(node, {from_fanin}); if (!HasFanin(*node, to_fanin)) { modified |= AddFanin(node, to_fanin); } return modified; } // In place mutation, requires no shifting of ports. NodeDef* from_fanin_node = GetNode(from_fanin.node()); NodeDef* to_fanin_node = GetNode(to_fanin.node()); if (from_fanin_node == nullptr || to_fanin_node == nullptr) { return false; } string to_fanin_string = TensorIdToString(to_fanin); int num_inputs = node->input_size(); bool modified = false; for (int i = 0; i < num_inputs; ++i) { if (ParseTensorName(node->input(i)) == from_fanin) { OutputPort from_fanin_port(from_fanin_node, from_fanin.index()); InputPort old_input; old_input.node = node; old_input.port_id = from_fanin.index() == Graph::kControlSlot ? Graph::kControlSlot : i; fanouts()[from_fanin_port].erase(old_input); OutputPort to_fanin_port(to_fanin_node, to_fanin.index()); InputPort new_input; new_input.node = node; new_input.port_id = to_fanin.index() == Graph::kControlSlot ? Graph::kControlSlot : i; fanouts()[to_fanin_port].insert(new_input); node->set_input(i, to_fanin_string); modified = true; } } return modified; } void MutableGraphView::DeleteNodes(const std::set<string>& nodes_to_delete) { for (const string& node_name_to_delete : nodes_to_delete) RemoveFaninsInternal(nodes().at(node_name_to_delete), /*keep_controlling_fanins=*/false); for (const string& node_name_to_delete : nodes_to_delete) nodes().erase(node_name_to_delete); EraseNodesFromGraph(nodes_to_delete, graph()); } void MutableGraphView::RemoveFaninsInternal(NodeDef* deleted_node, bool keep_controlling_fanins) { for (int i = 0; i < deleted_node->input_size(); ++i) { TensorId tensor_id = ParseTensorName(deleted_node->input(i)); if (keep_controlling_fanins && tensor_id.index() < 0) { break; } OutputPort fanin(nodes()[tensor_id.node()], tensor_id.index()); InputPort input; input.node = deleted_node; if (tensor_id.index() < 0) input.port_id = Graph::kControlSlot; else input.port_id = i; fanouts()[fanin].erase(input); } } } // end namespace grappler } // end namespace tensorflow
9c55022cd1cccc69b167a56119be8a223487ff22
bd836081502105e472df1d0a99881deed61ce048
/pagebuilder/PageConverter.cpp
db78dfd94ea1a4112dda1175dd1a6a4adc31c196
[]
no_license
mitkatch/BPE
9f34064778c25cc8dcb8225ed9f2252a3d431fb3
27985cb5da5045b797e67ec8c2a93e0f50ee6c09
refs/heads/master
2020-03-30T22:18:51.194908
2018-10-05T02:48:32
2018-10-05T02:48:32
151,662,346
0
0
null
null
null
null
UTF-8
C++
false
false
9,554
cpp
PageConverter.cpp
/************************************************************************ || || DATE: $Date: 2006/05/02 15:12:09 $ || SOURCE: $Source: /repository/projects/Canpx/pagebuilder/PageConverter.cpp,v $ || STATE: $State: Exp $ || ID: $Id: PageConverter.cpp,v 1.7 2006/05/02 15:12:09 nickz Exp $ || REVISION: $Revision: 1.7 $ || LOG: $Log: PageConverter.cpp,v $ || LOG: Revision 1.7 2006/05/02 15:12:09 nickz || LOG: . || LOG: || LOG: Revision 1.6 2006/04/06 17:57:30 nickz || LOG: port to RMDS || LOG: || LOG: Revision 1.5 2006/04/04 14:37:12 nickz || LOG: building... || LOG: || LOG: Revision 1.4 2006/04/04 13:19:33 nickz || LOG: ported to rmds || LOG: || LOG: Revision 1.3 2005/09/28 19:23:40 mikhailt || LOG: re-use duplicated LDAP messages || LOG: || LOG: Revision 1.2 2005/09/21 17:49:55 mikhailt || LOG: activated only when loaded() || LOG: || LOG: Revision 1.1 2005/06/29 19:00:48 mikhailt || LOG: Initial revision || LOG: ************************************************************************/ #include "PageConverter.hpp" #include "PageArrayConverter.hpp" #include "DataCache.hpp" #include "ConfigMap.hpp" #include "DataCache.hpp" #include "Formatter.hpp" #include "CellConverter.hpp" rmdsPageProducer* PageConverter::s_rmdsPageProducer = NULL; PageConverter::PageConverter(PageArrayConverter *array, const string& ldapurl, const string& pname) : _prod(NULL), _pname(pname), _chainMgr(NULL), _dynamic(false) { //"/ou=3101, ou=PageBuilder, o=moneyline.ca"; _connstr = string("/") + ldapurl; //array->connstr(); _host = array->host(); _port = array->port(); _service = s_rmdsPageProducer->service(); } PageConverter::~PageConverter() { map<string, RowConverter *>::iterator it = _grid.begin(); for (it; it != _grid.end(); it++){ RowConverter *gc = (RowConverter *)(*it).second; delete gc; } _grid.clear(); _dynamicRows.clear(); map<string, MsgGraph *>::iterator itm = _msgGraphPatternMap.begin(); for (itm; itm != _msgGraphPatternMap.end(); itm++){ MsgGraph * msg = (*itm).second; delete msg; } _msgGraphPatternMap.clear(); } void PageConverter::load(const string& url) { //string address = getPageName(_connstr); string address = _service + "." + _pname; if (!address.empty()){ if (DataCache::getCache()->addDatum(address, Datum::PAGE)) { DataPage *page = (DataPage *)DataCache::getCache()->getDatum(address); if (page) { setDataPage(page); _placeHolder = string(page->width(), ' '); } } loadLdap(_connstr, url, PageConverter::loadPageConfig); } addTimer(10*1000, 1, this); } void PageConverter::loadLdap(const string& connstr, const string& url, Loader loader) { string index = connstr + "." + url; map<string, MsgGraph *>::iterator it = _msgGraphPatternMap.find(index); if (it != _msgGraphPatternMap.end() ){ //cout << "PageConverter::loadLdap stored "<<index<<endl; MsgGraph *rset = (*it).second; (*loader)(rset, this); } else { DBConnectorLdap *_conn = new DBConnectorLdap(_host, _port); if (_conn->connect(connstr)){ if (_conn->fetch(url)){ MsgGraph * rset = _conn->search(); if (rset){ (*loader)(rset, this); } //cout << "PageConverter::loadLdap save "<<index<<endl; MsgGraph *new_rset = new MsgGraph(*rset); _msgGraphPatternMap[index] = new_rset; } } _conn->disconnect(); delete _conn; } } bool PageConverter::subscribeSourceChain(int counter, const string& rowurl) { //rowurl "rowNum=2, page=3102D, ou=PageBuilder, o=moneyline.ca" //cout <<" subscribeSourceChain "<<counter<<" from "<<rowurl<<endl; bool ret = false; char ch[15]; string newurl; sprintf(ch, "rowNum=%d,", counter); if (_chainMgr){ string address = _chainMgr->getAddressNext(); int coma1 = rowurl.find_first_of(','); if (coma1 != string::npos){ newurl = rowurl.substr(coma1 +1, rowurl.size() - (coma1 +1)); newurl = ch + newurl; //replace with dynamic rowNum } //cout << "subscribeSourceChain address "<<address<<" for "<<ch<<endl; if (address.size()){ RowConverter *gc = new RowConverter(address, this, rowurl); gc->rowNum(counter); // address = canpx2tb.CANPX_TB.APR07 DataCache::getCache()->subscribe(address, gc, Datum::GRAPH); _grid[newurl] = gc; _dynamicRows.push_back(gc); ret = true; } } return true; } bool PageConverter::subscribeSource(const string& rec, const string& row) { //rmds://PREBON.17670.APR07@prebonParser bool ret = false; string rmds = "rmds://" ; string chain = "chain://"; int rmds_id = rec.find(rmds); int chain_id = rec.find(chain); if (rmds_id != string::npos) { string address = rec.substr(rmds.size()); RowConverter *gc = new RowConverter(address, this, row); DataCache::getCache()->subscribe(address, gc, Datum::GRAPH); _grid[row] = gc; ret = true; } else if (chain_id != string::npos) { if (_chainMgr) { string request = rec.substr(chain_id + chain.size(), rec.size() - (chain_id + chain.size())); ret = _chainMgr->requestChain(request); } } else { // no source provided looks like static row RowConverter *gc = new RowConverter(rec, this, row); _grid[row] = gc; } return ret; } //static void PageConverter::loadPageConfig(MsgGraph* rset, PageConverter* pg) { int counter = 0; string rowurl; set<string> keys = rset->getKeys(""); set<string>::iterator it = keys.begin(); for (it; it != keys.end(); it++){ //cout << "loadPageConfig Keys found "<<(*it)<<endl; if ((*it).size()){ string rec, row; rowurl = (*it); rset->getAttributeValue("feedSource@" + rowurl, 0, rec); rset->getAttributeValue("rowNum@" + rowurl, 0, row); counter = Formatter::ATOF(row.c_str()); if (pg->subscribeSource(rec, rowurl) == false){ // not subscridable , static pg->loadLdap("/" +rowurl, ConfigMap::getConfig()->getValue("LDAP_SEARCH_COLUMN"), PageConverter::loadRowConfig); } } } //keep going for counter 'till end line while(pg->dynamic() && counter <= MTRS_PAGE_ROW_MAX_IND){ pg->subscribeSourceChain(counter++, rowurl); } } //static void PageConverter::loadRowConfig(MsgGraph* rset, PageConverter* pg) { set<string> keys1 = rset->getKeys(""); set<string>::iterator it1 = keys1.begin(); for (it1; it1 != keys1.end(); it1++){ //cout << "loadRowConfig Keys found "<<(*it1)<<endl; // colNum=2,rowNum=2,page=3101,ou=PageBuilder,o=moneyline.ca string tmp = (*it1); int next_coma = tmp.find_first_of(","); if (next_coma != string::npos){ string row = tmp.substr(next_coma +1, tmp.size() -(next_coma +1)); if (pg->dynamic()){ pg->addCellToDynamicRows(tmp, rset, row); }else{ pg->addCellToRow(tmp, rset, row); } } } } void PageConverter::addCellToRow(const string& key, MsgGraph *rset, const string& row) { map<string, RowConverter *>::iterator it = _grid.find(row); if (it != _grid.end()){ RowConverter *gc = (*it).second; CellConverter *cc = new CellConverter(key, rset, gc); gc->addCell(cc); } } void PageConverter::addCellToDynamicRows(const string& key, MsgGraph *rset, const string& row) { //cout<< "addCellToDynamicRows for "<<key<<endl; map<string, RowConverter *>::iterator it = _grid.find(row); if (it != _grid.end()){ RowConverter *gc = (*it).second; vector<RowConverter *>::iterator itv = std::find(_dynamicRows.begin(), _dynamicRows.end(), gc); if (itv == _dynamicRows.end()){ //it's static rows CellConverter *cc = new CellConverter(key, rset, gc); gc->addCell(cc); }else{ vector<RowConverter *>::iterator itd = _dynamicRows.begin(); for (itd; itd != _dynamicRows.end(); itd++){ RowConverter *gc = (*itd); CellConverter *cc = new CellConverter(key, rset, gc); gc->addCell(cc); } } } } void PageConverter::publishUpdate(Converter *c) { //cout << "PublishUpdate to "<<c->row()<<" "<<c->col()<<" "<<c->value()<<endl; if (_prod) _prod->updatePage(c); } string PageConverter::getPageName(const string& url) { string pagename; string page = "page="; int page_id = url.find(page); if (page_id != string::npos){ int next_coma = url.find_first_of(',', page_id); pagename = url.substr(page_id + page.size(), next_coma - (page_id + page.size())); pagename = Formatter::trim(pagename); } return pagename; } bool PageConverter::loaded() { bool loaded = true; map<string, RowConverter *>::iterator it = _grid.begin(); for (it; loaded && it != _grid.end(); it++) { RowConverter *gc = (RowConverter *)(*it).second; loaded &= gc->loaded(); } return( loaded && s_rmdsPageProducer->connected()); } set<string> PageConverter::getGridKeys() { set<string> keys; map<string, RowConverter *>::iterator it = _grid.begin(); for (it; it != _grid.end(); it++){ keys.insert((*it).first); } return keys; } int PageConverter::rowCnt() { DataPage* page = getDataPage(); return( page != NULL ? page->height() : 0 ); } void PageConverter::onTimer(TimerId id) { if ( loaded() ) { Logger::getLogger()->log(Logger::TYPE_INFO, "PageConverter::onTimer Loaded IMAGE for page: [%s]", _pname.c_str()); _prod = s_rmdsPageProducer; // Build page IMAGE and publish publishUpdate(this); } else { addTimer(1*1000, 1, this); } }
b53ab8749da7929f8687c2f3f0dd6a47fffe7af2
d053e0e8687f122d120bcd0fa1f9076deb35afa5
/Olymp/Povolzhiya/D.cpp
dd5096c6aef87df0733c702771a0ee6711fa8dab
[]
no_license
shaihitdin/CP
e8911bc543932866d6fc83eb1d48d9cf79918c61
dc90082f3ebedaccbfb0818cc68539c887f86553
refs/heads/master
2021-01-11T17:10:20.356635
2017-10-05T08:53:56
2017-10-05T08:53:56
79,729,913
1
0
null
null
null
null
UTF-8
C++
false
false
755
cpp
D.cpp
#include <bits/stdc++.h> using namespace std; #define forn(i, x, n) for (int i = int(x); i <= int(n); ++i) #define for1(i, n, x) for (int i = int(n); i >= int(x); --i) typedef long long ll; typedef pair <int, int> PII; const int N = 3e5 + 100; int d, n, len; ll a[N], res[N]; int main () { freopen ("input.txt", "r", stdin); freopen ("output.txt", "w", stdout); ios_base :: sync_with_stdio (0); cin.tie (0); cin >> d >> n >> len; forn(_, 1, d) { ll sum = 0; forn(i, 1, n) { cin >> a[i]; sum += a[i]; if (i >= len) { res[i - len + 1] += sum; sum -= a[i - len + 1]; } } } int ans = 1; forn(i, 2, n - len + 1) if (res[ans] < res[i]) ans = i; cout << ans << " " << res[ans] << "\n"; return 0; }
fa34262fe2e70652bf511b4199035bb5f8113f98
220846e017a9992e596bd1ea806d527e3aeea243
/103_Binary_Tree_Zigzag_Level_Order_Traversal.cpp
8d02d15f234eb976d0f9b4743c77f0ce406ee6f6
[]
no_license
anzhe-yang/Leetcode
bfa443b7a74ddbd441348c364ee00004173ddd86
fe9eb16136035f25f31bddb37c6b4884cd7f6904
refs/heads/master
2020-04-08T14:49:04.781848
2019-10-25T02:39:22
2019-10-25T02:39:22
159,453,173
0
0
null
null
null
null
UTF-8
C++
false
false
1,899
cpp
103_Binary_Tree_Zigzag_Level_Order_Traversal.cpp
/** 问题描述: * 给定一个二叉树,返回它的 zigzag 顺序节点值。 * 从左到右,再从右到左。 */ #include <iostream> #include <vector> #include <stack> using namespace std; struct TreeNode { int val; TreeNode *left; TreeNode *right; TreeNode(int x) : val(x) ,left(NULL), right(NULL) {} }; vector<vector<int>> zigzagLevelOrder(TreeNode* root) { /* 与102题相似。 不同地方在于利用一个位置变量index。 当是单数行,则从右往左,则index从最后的索引往前走进行赋值。 双数行就恢复为原来的赋值方法。 */ vector<vector<int>> res; if (root == NULL) return res; deque<TreeNode*> cur; cur.push_back(root); bool lr = true; while (cur.size() > 0) { int curLevelSize = cur.size(); vector<int> row(curLevelSize); for (int i = 0; i < curLevelSize; i++) { TreeNode *node = cur.front(); cur.pop_front(); int index = (lr) ? i : (curLevelSize-1-i); row[index] = node->val; if (node->left) cur.push_back(node->left); if (node->right) cur.push_back(node->right); } lr = !lr; res.push_back(row); } return res; } int main(int argc, char const *argv[]) { TreeNode *t1 = new TreeNode(1); TreeNode *t2 = new TreeNode(2); TreeNode *t3 = new TreeNode(3); TreeNode *t4 = new TreeNode(4); TreeNode *t5 = new TreeNode(5); t1->left = t2; t1->right = t3; t2->left = t4; t3->right = t5; vector<vector<int>> res = zigzagLevelOrder(t1); for (int i = 0; i < res.size(); i++) { for (int j = 0; j < res[i].size(); j++) { cout << res[i][j] << " "; } cout << endl; } return 0; }
fd75afdb0c8b7a82c6c05aa339d47de08267ba13
d29a3d35c2484e84743f1557c209e934880d2e74
/src/130SurroundedRegions/130SurroundedRegions.cpp
c574d1aea4e7d8046822226ad1249cefe7d996d5
[]
no_license
rainliu/leetcode
2e68dd4839ac55b1f16f519c67b526c7b773874c
5b31ebcbdbe0caffce0a9b4833170eb040396066
refs/heads/master
2022-07-21T05:41:23.838958
2022-07-15T20:39:59
2022-07-15T20:39:59
30,811,637
12
1
null
2022-07-15T20:40:00
2015-02-14T23:06:26
C++
UTF-8
C++
false
false
4,301
cpp
130SurroundedRegions.cpp
class UnionFind{ vector<int> id; vector<int> sz; int cnt; public: UnionFind(int N){ cnt = N; id.resize(N); sz.resize(N); for(int i=0; i<N; ++i){ id[i]=i; sz[i]=1; } } int Find(int i){ while(i!=id[i]){ id[i]=id[id[i]]; i=id[i]; } return i; } void Union(int p, int q){ int i = Find(p); int j = Find(q); if(i==j) return; else if (sz[i]<sz[j]) { id[i]=j; sz[j]+=sz[i]; }else{ id[j]=i; sz[i]+=sz[j]; } --cnt; } int Count(){ return cnt; } }; class Solution { public: void solve(vector<vector<char>>& board) { int m=board.size(); if(m==0) return; int n=board[0].size(); if(n==0) return; UnionFind uf(m*n); for(int j=0; j<m; ++j){ for(int i=0; i<n; ++i){ if(board[j][i]=='O'){ if(i==0||j==0||i==n-1||j==m-1){ uf.Union(0, j*n+i); } if(i>0&&board[j][i-1]=='O'){ uf.Union(j*n+i-1, j*n+i); } if(j>0&&board[j-1][i]=='O'){ uf.Union((j-1)*n+i, j*n+i); } } } } for(int j=0; j<m; ++j){ for(int i=0; i<n; ++i){ if(board[j][i]=='O'&&uf.Find(j*n+i)!=uf.Find(0)){ board[j][i]='X'; } } } } }; #include <sstream> #include <iostream> #include <string> #include <vector> #include <stack> #include <queue> #include <unordered_map> #include <algorithm> #include <limits> using namespace std; /* Given a 2D board containing 'X' and 'O', capture all regions surrounded by 'X'. A region is captured by flipping all 'O's into 'X's in that surrounded region. For example, X X X X X O O X X X O X X O X X After running your function, the board should be: X X X X X X X X X X X X X O X X */ struct Coord{ int i; int j; }; class Solution { public: void solve(vector<vector<char>> &board) { if(board.size()==0) return; int n = board.size(); int m = board[0].size(); queue<Coord> q; for(int i=0; i<n; ++i){ if(board[i][0 ]=='O') q.push(Coord{i,0}); if(board[i][m-1]=='O') q.push(Coord{i,m-1}); } for(int j=0; j<m; ++j){ if(board[0 ][j]=='O') q.push(Coord{0,j}); if(board[n-1][j]=='O') q.push(Coord{n-1,j}); } while(!q.empty()){ auto p = q.front(); q.pop(); int i = p.i; int j = p.j; board[i][j] = '1'; if(i-1>=0 && board[i-1][j ]=='O') q.push(Coord{i-1, j }); if(j-1>=0 && board[i ][j-1]=='O') q.push(Coord{i , j-1}); if(i+1< n && board[i+1][j ]=='O') q.push(Coord{i+1, j }); if(j+1>=0 && board[i ][j+1]=='O') q.push(Coord{i , j+1}); } for(int i=0; i<n; ++i){ for(int j=0; j<m; ++j){ if(board[i][j]=='O') board[i][j]='X'; if(board[i][j]=='1') board[i][j]='O'; } } } }; class Solution2 { public: void solve(vector<vector<char>> &board) { if(board.size()==0) return; int n = board.size(); int m = board[0].size(); for(int i=0; i<n; ++i){ if(board[i][0 ]=='O') DFS(board, n, m, i, 0); if(board[i][m-1]=='O') DFS(board, n, m, i, m-1); } for(int j=0; j<m; ++j){ if(board[0 ][j]=='O') DFS(board, n, m, 0, j); if(board[n-1][j]=='O') DFS(board, n, m, n-1, j); } for(int i=0; i<n; ++i){ for(int j=0; j<m; ++j){ if(board[i][j]=='O') board[i][j]='X'; if(board[i][j]=='1') board[i][j]='O'; } } } void DFS(vector<vector<char>> &board, int n, int m, int i, int j){ board[i][j] = '1'; if(i-1>=0 && board[i-1][j ]=='O') DFS(board, n, m, i-1, j ); if(j-1>=0 && board[i ][j-1]=='O') DFS(board, n, m, i , j-1); if(i+1< n && board[i+1][j ]=='O') DFS(board, n, m, i+1, j ); if(j+1>=0 && board[i ][j+1]=='O') DFS(board, n, m, i , j+1); } }; int main(){ Solution s; vector<char> b{'X'}; vector<vector<char>> v; v.push_back(b); s.solve(v); return 0; }
5fcaef2e7881de0ee70009cc99762b58f88193fe
7e14945b2dd27334ddec322d67953b913ddedf46
/training/my-training/old/winter-2013/8-math/C.cpp
7b3e02af50f91b7cedc7cd106b81f9d06704b2f6
[]
no_license
szefany/acm-icpc
63653dfc724eab98b33bde54416ad84eb5e2f4f6
86ccd854be545cd67bc2850e22337d3fe9f4701f
refs/heads/master
2021-06-02T02:02:10.251126
2019-09-28T13:24:22
2019-09-28T13:24:22
7,666,139
0
1
null
null
null
null
UTF-8
C++
false
false
603
cpp
C.cpp
// HDU 3032, Nim or not Nim? #include <cstdio> #include <cstring> int sg (int x) { long long result; if (x % 4 == 0) { result = x - 1; } else if (x % 4 == 3) { result = x + 1; } else { result = x; } return result; } int main () { int test_count; scanf ("%d", &test_count); while (test_count --) { int n, answer = 0; scanf ("%d", &n); for (int i = 0; i < n; ++ i) { int x; scanf ("%d", &x); answer ^= sg (x); } puts (answer ? "Alice" : "Bob"); } return 0; }
62f106fc93bf01a1e32cfad59deabeed30d69402
57e519e32dc88ceb894a1d323cd68ef48e9f74a0
/Clasa a 8-a/Din baza [10] in baza [2]/main.cpp
0412fb2d1af5ed8aee936cbe3965f400375556c0
[]
no_license
MihaiAnghelin/CPP
89e9d4c21e6ca2e48bf188a068e82f01ec669479
e034b69af3a622c4ce52865d7414fed5b1f7f2d1
refs/heads/master
2020-06-07T02:49:03.265320
2019-12-10T13:25:17
2019-12-10T13:25:17
192,903,853
2
0
null
2020-05-13T17:05:32
2019-06-20T10:58:37
C++
UTF-8
C++
false
false
266
cpp
main.cpp
#include <stdio.h> int main() { int n,a[50],indice=1; printf("N= "); scanf("%d",&n); while(n!=0) { a[indice++]=n%2; n/=2; } printf("%d\n",indice); for(int i=indice-1;i>=1;i--) { printf("%d",a[i]); } }
e1c28cf031777ff0b4236caa3d6ec8ed171d1c1d
64e7a0cf9d67467ee5d272ecddba9f79b75ccba5
/flatten.cpp
7d08c921967f2237d72e686d6a298388598e5dfb
[]
no_license
Ruixuan/leetcode
736a406669ae486ace0edc6a59d8e5d21daf8eb9
ab63651adcc970b166eed68131cf27f40d5f6be9
refs/heads/master
2021-01-23T07:26:58.594731
2014-03-10T03:50:02
2014-03-10T03:50:02
null
0
0
null
null
null
null
UTF-8
C++
false
false
681
cpp
flatten.cpp
class Solution { public: TreeNode * buildtree( TreeNode* root){ if (root == NULL) return NULL; TreeNode* tail, *right ; right = root->right; if ((root->left) != NULL){ tail = buildtree(root->left); root->right = root->left; root ->left = NULL; }else { tail = root; } //buildtree(right); if (right == NULL){// NO RIGHT SUB TREE tail->right = NULL; return tail; }else{ tail->right = right; return buildtree(right); } } void flatten( TreeNode * root){ TreeNode * curent; buildtree(root); } };
890136e4d13fa0cea3dd66c793f52d288887ac4c
c747cfbe51cc24d15e49a888072d34635833d90a
/954_ArrayofDoubledPairs.cpp
bbddd8f71eefa360fb4b7fa7d38b335bbabc62bf
[]
no_license
bigship/leetcode_solutions
18921508a8acba25013ae65864168c4c084bef37
45edfab5f1696fa9b3b59b63663aa9524de209cd
refs/heads/master
2022-08-22T05:42:37.462263
2022-08-02T20:14:50
2022-08-02T20:14:50
13,472,667
0
0
null
null
null
null
UTF-8
C++
false
false
1,547
cpp
954_ArrayofDoubledPairs.cpp
// 954. Array of Doubled Pairs /* * Given an array of integers arr of even length, return true if and only if it is possible to reorder it * such that arr[2 * i + 1] = 2 * arr[2 * i] for every 0 <= i < len(arr) / 2. Example 1: Input: arr = [3,1,3,6] Output: false Example 2: Input: arr = [2,1,2,6] Output: false Example 3: Input: arr = [4,-2,2,-4] Output: true Explanation: We can take two groups, [-2,-4] and [2,4] to form [-2,-4,2,4] or [2,4,-2,-4]. Example 4: Input: arr = [1,2,4,16,8,4] Output: false Constraints: 0 <= arr.length <= 3 * 10^4 arr.length is even. -10^5 <= arr[i] <= 10^5 */ class Solution { public: // Greedy. 把数组按元素绝对值大小排序. 对于每一个位置上的元素val, 必须要有2 * val与之配对 // 使用hashmap保存元素出现的次数, 遍历配对即可. 配对上了从cntmap中减少次数, 如果减为0了, 删除元素 bool canReorderDoubled(vector<int>& arr) { std::sort(arr.begin(), arr.end(), [](const int& a, const int& b) { return abs(a) < abs(b); }); std::unordered_map<int, int> cntmap; for (auto& v : arr) { cntmap[v]++; } for (int i = 0; i < arr.size(); i++) { int curv = arr[i]; if (cntmap.count(curv) == 0) continue; if (cntmap.count(2 * curv) == 0) { return false; } cntmap[2 * curv]--; cntmap[curv]--; if (cntmap[2 * curv] == 0) { cntmap.erase(2 * curv); } if (cntmap[curv] == 0) { cntmap.erase(curv); } } return true; } };
1930a5a6c94c8788c1a45bdef549cc6b1da2c607
0099305ea311f0947aaea14096046873bd1577ab
/array_and_matrixs/max_consecutive_ones.cpp
91dad53544237defbbd17368cb5e2db36c9476de
[ "MIT" ]
permissive
zm66260/Data_Structure_and_Algorithms
5c68ba58b4d5225b02b21a1c15ea3d91c8186310
f3e6d60a9f0ddf1a8fe943dedc089172bc8c833e
refs/heads/master
2021-05-22T13:27:29.093363
2020-04-04T08:31:50
2020-04-04T08:31:50
252,946,521
0
0
null
null
null
null
UTF-8
C++
false
false
1,141
cpp
max_consecutive_ones.cpp
// 485 max consecutive ones // Given a binary array, find the maximum number of consecutive 1s in this array. // Example 1: // Input: [1,1,0,1,1,1] // Output: 3 // Explanation: The first two digits or the last three digits are consecutive 1s. // The maximum number of consecutive 1s is 3. // Note: // The input array will only contain 0 and 1. // The length of input array is a positive integer and will not exceed 10,000 #include<vector> using namespace std; class Solution { public: int findMaxConsecutiveOnes(vector<int>& nums) { int maxlength = 0; int count = 0; for(int i = 0; i < nums.size(); i++){ count = nums[i] == 0? 0 : ++count; maxlength = max(maxlength, count); } return maxlength; // int j = 0; // int maxlength = 0; // for(int i=0; i < nums.size(); i++){ // if(nums[i] != nums[j]){ // maxlength = max(maxlength, i-j); // j = i; // } // } // int last = nums.size()-j; // return max(maxlength, last); } };
e447768ab9eb9fcafdc1823f8b20cf23b9c2789b
091afb7001e86146209397ea362da70ffd63a916
/inst/include/nt2/linalg/include/functions/simd/geesx.hpp
3d1bd65284c856fdf43d7efc3474d80c552e0afe
[]
no_license
RcppCore/RcppNT2
f156b58c08863243f259d1e609c9a7a8cf669990
cd7e548daa2d679b6ccebe19744b9a36f1e9139c
refs/heads/master
2021-01-10T16:15:16.861239
2016-02-02T22:18:25
2016-02-02T22:18:25
50,460,545
15
1
null
2019-11-15T22:08:50
2016-01-26T21:29:34
C++
UTF-8
C++
false
false
173
hpp
geesx.hpp
#ifndef NT2_LINALG_INCLUDE_FUNCTIONS_SIMD_GEESX_HPP_INCLUDED #define NT2_LINALG_INCLUDE_FUNCTIONS_SIMD_GEESX_HPP_INCLUDED #include <nt2/linalg/functions/geesx.hpp> #endif
9d6a79b5f3e68fd34175754c64b32a91d374944a
5234455aa51fb8d83c34df636ff2aad741f23df2
/Siv3DTest/PlayerBullet.h
a03b49254258a1164e143a47f7ad511732b5560b
[]
no_license
ishiiyuki/Siv3dTest
15a22c6276fd7eb3d9c2adfb50bd146f42c946f4
d41dbb4d4fe562f35b5d28f6dc486696ec3b4b07
refs/heads/main
2023-04-02T07:19:04.866817
2021-03-28T08:56:32
2021-03-28T08:56:32
325,776,815
1
0
null
2021-03-28T08:56:33
2020-12-31T10:35:36
C++
UTF-8
C++
false
false
357
h
PlayerBullet.h
#pragma once #include "Bullet.h" class PlayerBullet : public Bullet { private: public: PlayerBullet(Vec2 setPos) { pos = setPos; speed = 500.0; } ~PlayerBullet() { } bool BulletEnd() const { return pos.y < -48; } void Update(double deltaTime) ; void Draw() ; };
cfc905e24eee87581c9043815c3bf5f5962a557a
eebf0ef56f2ed3bd94d17d437b87cb142708d9c4
/Dinámica/Aibofobia/Source.cpp
00a9a3334a7e1a004bcca0f3536fc2fa6af6264c
[ "MIT" ]
permissive
Yule1223/Algorithmic-Techniques-in-Software-Engineering
a5264606006be64dfbc7e5f7462bd07243edf189
602e3d823cfc86d68a5b3f9435faef4e5c7dc788
refs/heads/main
2023-03-01T01:07:47.171880
2021-02-11T22:44:10
2021-02-11T22:44:10
338,171,421
0
0
null
null
null
null
IBM852
C++
false
false
2,228
cpp
Source.cpp
// Yule Zhang // Comentario general sobre la soluciân, // explicando câmo se resuelve el problema #include <iostream> #include <fstream> #include <vector> #include <algorithm> #include <climits> #include <list> #include "Matriz.h" using namespace std; int patin_rec(string const& patitos, int i, int j, Matriz<int>& patin) { int& res = patin[i][j]; if (res == -1) { if (i > j) res = 0; else if (i == j) res = 0; else if (patitos[i] == patitos[j]) res = patin_rec(patitos, i + 1, j - 1, patin); else res = min(patin_rec(patitos, i + 1, j, patin), patin_rec(patitos, i, j - 1, patin)) + 1; } return res; } void reconstruir(string const& patitos, Matriz<int> const& patin, int i, int j, string& sol) { if (i > j) return; if (i == j) sol.push_back(patitos[i]); else if (patitos[i] == patitos[j]) { sol.push_back(patitos[i]); reconstruir(patitos, patin, i + 1, j - 1, sol); sol.push_back(patitos[j]); } else if (patin[i][j] == patin[i + 1][j] + 1) { sol.push_back(patitos[i]); reconstruir(patitos, patin, i + 1, j, sol); sol.push_back(patitos[i]); } else { sol.push_back(patitos[j]); reconstruir(patitos, patin, i, j - 1, sol); sol.push_back(patitos[j]); } } // resuelve un caso de prueba, leyendo de la entrada la // configuraciân, y escribiendo la respuesta bool resuelveCaso() { // leer los datos de la entrada string patitos; cin >> patitos; if (!cin) return false; int n = patitos.length(); Matriz<int> patindromo(n, n, -1); cout << patin_rec(patitos, 0, n - 1, patindromo) << ' '; //cout << patindromo; // escribir sol string sol; reconstruir(patitos, patindromo, 0, n - 1, sol); cout << sol << '\n'; return true; } int main() { // ajustes para que cin extraiga directamente de un fichero #ifndef DOMJUDGE std::ifstream in("casos.txt"); auto cinbuf = std::cin.rdbuf(in.rdbuf()); #endif while (resuelveCaso()); // para dejar todo como estaba al principio #ifndef DOMJUDGE std::cin.rdbuf(cinbuf); system("PAUSE"); #endif return 0; }
1389188f7efbc67a61256ceb7df94ce731845c22
d6ab38714f7a5f0dc6d7446ec20626f8f539406a
/backend/collecting/collectedFiles/C++/edited/ethereumcpp-ethereumblob4b805926d46bf31144e053e6898cbedd3f67e023libp2pRLPXSocket.h
2539e32d22193ec1891fec32eff847dc6807279a
[ "BSL-1.0" ]
permissive
haditabatabaei/webproject
8db7178affaca835b5d66daa7d47c28443b53c3d
86b3f253e894f4368a517711bbfbe257be0259fd
refs/heads/master
2020-04-10T09:26:25.819406
2018-12-08T12:21:52
2018-12-08T12:21:52
null
0
0
null
null
null
null
UTF-8
C++
false
false
667
h
ethereumcpp-ethereumblob4b805926d46bf31144e053e6898cbedd3f67e023libp2pRLPXSocket.h
#pragma once #include "Common.h" namespace dev { namespace p2p { class RLPXSocket: public std::enable_shared_from_this<RLPXSocket> { public: RLPXSocket(ba::io_service& _ioService): m_socket(_ioService) {} ~RLPXSocket() { close(); } bool isConnected() const { return m_socket.is_open(); } void close() { try { boost::system::error_code ec; m_socket.shutdown(bi::tcp::socket::shutdown_both, ec); if (m_socket.is_open()) m_socket.close(); } catch (...){} } bi::tcp::endpoint remoteEndpoint() { boost::system::error_code ec; return m_socket.remote_endpoint(ec); } bi::tcp::socket& ref() { return m_socket; } protected: bi::tcp::socket m_socket; }; } }
b0c9e6776b26c4ba70f481543bd68be47948df1c
973c50c43f161679685d7bdcfe1e7d3433378a47
/src/starlink/constellation.h
6067525665777ce3977280a984ab2e7de3258ce7
[]
no_license
weiwoduzun0729/starlink-htsim
827d2543a2b9b4e3b867614560256ebc27bfc6bd
56a049fa0073325d3860e40d1b957e6d4fa3b530
refs/heads/main
2023-08-16T16:55:51.454624
2021-10-18T18:11:53
2021-10-18T18:11:53
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,903
h
constellation.h
// -*- c-basic-offset: 4; tab-width: 8; indent-tabs-mode: t -*- #ifndef CONSTELLATION_H #define CONSTELLATION_H class Constellation; #include "isl.h" #include "satellite.h" #include "city.h" #include "binary_heap.h" #define MAXNODES 1600 enum LinkType {UPLINK=0, DOWNLINK=1, ISL=2}; class Constellation { public: Constellation(EventList& eventlist, linkspeed_bps uplinkbitrate, mem_b uplinkqueuesize, linkspeed_bps dowlinkbitrate, mem_b downlinkqueuesize, linkspeed_bps islbitrate, mem_b islqueuesize); Satellite** sats() {return _sats;} int num_sats() const {return _num_sats;} inline Link& activate_link(Node& src, Node& dst, LinkType linktype) { return _link_factory.activate_link(src, dst, _linkbitrate[linktype], _linkqueuesize[linktype]); } inline void drop_link(Link& link) { _link_factory.drop_link(link); } void dijkstra_up_all_links(); void dijkstra_down_links_in_route(Route* route); simtime_picosec get_rtt(Route* route); void dijkstra(City& src, City& dst, simtime_picosec time); Route* find_route(City& dst); inline mem_b uplinkqueuesize() const {return _linkqueuesize[::UPLINK];} inline mem_b downlinkqueuesize() const {return _linkqueuesize[::DOWNLINK];} inline mem_b isllinkqueuesize() const {return _linkqueuesize[::ISL];} inline linkspeed_bps uplinkbitrate() const {return _linkbitrate[::UPLINK];} inline linkspeed_bps downlinkbitrate() const {return _linkbitrate[::DOWNLINK];} inline linkspeed_bps isllinkbitrate() const {return _linkbitrate[::ISL];} private: Link_factory _link_factory; Satellite *_sats[MAXNODES]; linkspeed_bps _linkbitrate[3]; mem_b _linkqueuesize[3]; int _num_sats; BinaryHeap heap; Node* _route_src; }; #endif
bb4c394f21c92ecf1f61c101280ef34034a8a8cd
703e23b27a0779811522d9c7b872c7f2cf43a059
/Nuts/Nuts/Drunkbar.cpp
89b6b79f37cc29a4b46d2da1405801cc4e0cdb32
[]
no_license
Tetchee/Nuts
2cd8422d03d812f3710448373ed8a4445c2c2bef
ec657989bf4d2e6907c23d579500090c5e4f1071
refs/heads/master
2020-04-07T22:07:37.513710
2018-11-22T23:30:14
2018-11-22T23:30:14
158,755,853
0
0
null
null
null
null
UTF-8
C++
false
false
297
cpp
Drunkbar.cpp
#include "Drunkbar.h" #include "Input.h" using namespace yam2d; Drunkbar::Drunkbar(int gameObjectType, SpriteSheet* spriteSheet, TmxMap* map) : SpriteSheetGameObject(gameObjectType, spriteSheet, 4) { } Drunkbar::~Drunkbar(void) { } void Drunkbar::update( float deltaTime ) { }
ab1d15fcc6aba3a805f7958062358b5d38ec4037
314e5cc24e4849a17f6d8937e4a482e55c7bd668
/src/engine/core/src/ui/widgets/ui_button.cpp
6b5bc16ab003f718fc803ffebd358d97c5c0309d
[ "Apache-2.0" ]
permissive
amzeratul/halley
7727e67ecbdb2cd4b6a16b694886037431898370
75b620bf65d666c0a8383fb7180fddde4397f00e
refs/heads/develop
2023-08-24T16:38:12.343749
2023-08-24T11:11:05
2023-08-24T11:11:05
43,295,328
3,716
218
Apache-2.0
2023-07-23T07:01:17
2015-09-28T10:41:31
C++
UTF-8
C++
false
false
5,992
cpp
ui_button.cpp
#include "halley/ui/widgets/ui_button.h" #include "halley/ui/ui_style.h" #include "halley/ui/ui_painter.h" #include "halley/support/logger.h" #include "halley/ui/widgets/ui_image.h" #include "halley/ui/widgets/ui_label.h" using namespace Halley; UIButton::UIButton(String id, UIStyle s, std::optional<UISizer> sizer) : UIClickable(std::move(id), s.getSprite("normal").getScaledSize(), std::move(sizer), s.getBorder("innerBorder")) { styles.emplace_back(s); sprite = styles.at(0).getSprite("normal"); setMinSize(sprite.getUncroppedSize()); } UIButton::UIButton(String id, UIStyle style, LocalisedString label) : UIButton(std::move(id), std::move(style), UISizer()) { setLabel(std::move(label)); } void UIButton::draw(UIPainter& painter) const { if (sprite.hasMaterial()) { painter.draw(sprite); } } void UIButton::update(Time t, bool moved) { const bool dirty = updateButton() | moved; if (dirty) { const auto b = sprite.getOuterBorder(); const auto topLeftBorder = Vector2f(float(b.x), float(b.y)); const auto bottomRightBorder = Vector2f(float(b.z), float(b.w)); Vector2f basePos = getPosition(); Vector2f imgBaseSize = sprite.getSize() + topLeftBorder + bottomRightBorder; if (sprite.getClip()) { auto c = sprite.getClip().value(); basePos -= c.getTopLeft(); imgBaseSize = Vector2f::min(c.getSize(), imgBaseSize); } sprite .setPos(basePos) .setScale(getSize() / imgBaseSize); } UIClickable::update(t, moved); } void UIButton::onClicked(Vector2f, KeyMods keyMods) { sendEvent(UIEvent(UIEventType::ButtonClicked, getId(), KeyCode(0), keyMods)); } void UIButton::onRightClicked(Vector2f mousePos, KeyMods keyMods) { sendEvent(UIEvent(UIEventType::ButtonRightClicked, getId(), KeyCode(0), keyMods)); } void UIButton::setInputType(UIInputType uiInput) { lastInputType = uiInput; if (canDoBorderOnly) { if (uiInput != curInputType) { curInputType = uiInput; borderOnly = !getOnlyEnabledWithInput().empty() && curInputType != UIInputType::Mouse && curInputType != UIInputType::Keyboard; doForceUpdate(); setState(State::Up); doSetState(State::Up); } } else { UIWidget::setInputType(uiInput); } } bool UIButton::canInteractWithMouse() const { return borderOnly ? false : UIClickable::canInteractWithMouse(); } bool UIButton::isFocusLocked() const { return borderOnly ? false : UIClickable::isFocusLocked(); } void UIButton::onManualControlActivate() { onClicked(getPosition(), KeyMods::None); } void UIButton::setCanDoBorderOnly(bool canDo) { canDoBorderOnly = canDo; } void UIButton::setLabel(LocalisedString text) { if (!label) { const auto& style = styles.at(0); bool existed = false; if (const auto existingLabel = tryGetWidgetAs<UILabel>(getId() + "_label")) { label = existingLabel; label->setText(std::move(text)); existed = true; } else { label = std::make_shared<UILabel>(getId() + "_label", style, std::move(text)); } if (style.hasTextRenderer("hoveredLabel")) { label->setHoverable(style.getTextRenderer("label"), style.getTextRenderer("hoveredLabel")); } if (style.hasTextRenderer("selectedLabel")) { label->setSelectable(style.getTextRenderer("label"), style.getTextRenderer("selectedLabel")); } if (style.hasTextRenderer("disabledLabel")) { label->setDisablable(style.getTextRenderer("label"), style.getTextRenderer("disabledLabel")); } if (!existed) { add(label, 1, style.getBorder("labelBorder"), UISizerAlignFlags::Centre); } } else { label->setText(std::move(text)); } } const LocalisedString& UIButton::getLabel() const { if (label) { return label->getText(); } else { static const LocalisedString dummy; return dummy; } } void UIButton::setIcon(Sprite icon) { if (!iconImage) { const auto& style = styles.at(0); iconImage = std::make_shared<UIImage>(icon); const auto iconColour = (style.hasColour("iconColour") ? style.getColour("iconColour") : Colour4f(1, 1, 1, 1)) * icon.getColour(); if (style.hasColour("hoveredIconColour")) { iconImage->setHoverable(iconColour, style.getColour("hoveredIconColour")); } if (style.hasColour("disabledIconColour")) { iconImage->setDisablable(iconColour, style.getColour("disabledIconColour")); } add(iconImage, label ? 0.0f : 1.0f, style.getBorder("iconBorder"), UISizerAlignFlags::Centre); } else { iconImage->setSprite(icon); } } void UIButton::doSetState(State state) { const auto& style = styles.at(0); if (borderOnly) { sprite = style.getSprite("borderOnly"); } else { if (!isEnabled()) { sprite = style.getSprite("disabled"); sendEventDown(UIEvent(UIEventType::SetEnabled, getId(), false)); } else if (state == State::Up) { sprite = style.getSprite("normal"); playSound(style.getString("upSound")); sendEventDown(UIEvent(UIEventType::SetEnabled, getId(), true)); sendEventDown(UIEvent(UIEventType::SetSelected, getId(), false)); sendEventDown(UIEvent(UIEventType::SetHovered, getId(), false, false)); } else if (state == State::Down) { sprite = style.getSprite("down"); playSound(style.getString("downSound")); sendEventDown(UIEvent(UIEventType::SetEnabled, getId(), true)); sendEventDown(UIEvent(UIEventType::SetSelected, getId(), true)); } else if (state == State::Hover) { sprite = style.getSprite("hover"); sendEventDown(UIEvent(UIEventType::SetEnabled, getId(), true)); sendEventDown(UIEvent(UIEventType::SetHovered, getId(), true, false)); playSound(style.getString("hoverSound")); } } } void UIButton::onStateChanged(State prev, State next) { if (isEnabled() && !borderOnly && prev != next) { const auto& style = styles.at(0); if (next == State::Up) { playSound(style.getString("upSound")); } else if (next == State::Down) { playSound(style.getString("downSound")); } else if (next == State::Hover) { playSound(style.getString("hoverSound")); } } } void UIButton::onShortcutPressed() { playSound(styles.at(0).getString("shortcutPressedSound")); }
125d64299af548945d406b1bd4223ed089f4df21
9c310296d6b2a75d9af3a45579bc3c249a7ed7e9
/src/RpcExt/RpcMessage.cpp
d50f3fd0930860ef4608d40bae3011ee20ea675d
[]
no_license
temp1352/rpcext
836abfe0c76564462bd9d50a7211e7aad8dba475
94db5a343d86af8808f876bfad45cdf9afd82a75
refs/heads/main
2023-07-18T07:12:54.845469
2021-09-12T10:10:09
2021-09-12T10:10:09
404,338,869
0
0
null
null
null
null
UTF-8
C++
false
false
3,212
cpp
RpcMessage.cpp
#include "StdAfx.h" #include "RpcMessage.h" #include "InterfaceMap.h" #include "RpcBuffer.h" // RpcMessage RpcMessage::RpcMessage() { memset(this, 0, sizeof(RPC_MESSAGE)); } RpcMessage::~RpcMessage() { Free(); } void RpcMessage::Read(RpcBuffer* pBuffer) { Free(); this->DataRepresentation = pBuffer->ReadInt32(); this->BufferLength = pBuffer->ReadInt32(); if (this->BufferLength) { this->Buffer = (BYTE*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, this->BufferLength); if (!this->Buffer) { XTL_THROW(E_OUTOFMEMORY); } pBuffer->ReadBytes(this->Buffer, this->BufferLength); } this->ProcNum = pBuffer->ReadInt32(); } void RpcMessage::Write(RpcBuffer* pBuffer) { pBuffer->WriteInt32(this->DataRepresentation); pBuffer->WriteInt32(this->BufferLength); if (this->Buffer) { pBuffer->WriteBytes(this->Buffer, this->BufferLength); } pBuffer->WriteInt32(this->ProcNum); } void RpcMessage::Attach(RPC_MESSAGE* pMessage) { ATLASSERT(pMessage); Free(); *(RPC_MESSAGE*)this = *pMessage; pMessage->Buffer = nullptr; pMessage->BufferLength = 0; } void RpcMessage::Detach(RPC_MESSAGE* pMessage) { if (pMessage->Buffer) { HeapFree(GetProcessHeap(), 0, pMessage->Buffer); } *pMessage = *this; this->Buffer = nullptr; this->BufferLength = 0; } void RpcMessage::Free() { if (this->Buffer) { HeapFree(GetProcessHeap(), 0, this->Buffer); this->Buffer = nullptr; } this->BufferLength = 0; } static const int _minMIPointerLen = sizeof(ULONG) * 2 + sizeof(IID) + sizeof(STDOBJREF) + sizeof(DUALSTRINGARRAY); HRESULT RpcMessage::GetObjList(StdObjList* pObjList) { //_logFile.WriteV(LogCategory::Misc, LogLevel::General, LogOption::Std, "RpcMessage::GetObjList - length : %d", BufferLength); BYTE* pCur = (BYTE*)Buffer; ULONG len = BufferLength; if (!pCur || len < _minMIPointerLen) { //_logFile.WriteV(LogCategory::Misc, LogLevel::General, LogOption::Std, "RpcMessage::GetObjList - len : %d", len); return S_FALSE; } auto pEnd = pCur + len - _minMIPointerLen; while (pCur < pEnd) { if (pCur[0] == 'M' && pCur[1] == 'E' && pCur[2] == 'O' && pCur[3] == 'W') { LPBYTE pStart = pCur; CAutoPtr<ObjRef> spObjRef; HRESULT hr = ObjRef::_CreateInstanceFromBuffer(pCur, &spObjRef.m_p); if (FAILED(hr)) { _logFile.WriteV(LogCategory::Misc, LogLevel::General, LogOption::Std, "RpcMessage::GetObjList - ObjRef::_CreateInstanceFromBuffer, hr : #%08x, cur : %d, %02x %02x %02x %02x", hr, pCur - Buffer, pCur[0], pCur[1], pCur[2], pCur[3]); return hr; } if (_logFile.m_outLevel > 1) { CStringA strItf; _interfaceMap.GetInterfaceName(spObjRef->m_iid, strItf); _logFile.WriteV(LogCategory::Misc, LogLevel::General, LogOption::Std, "RpcMessage::GetObjList, iid : %s, type : %d", strItf, spObjRef->m_type); } if (spObjRef->m_type == _OBJ_STANDARD || spObjRef->m_type == _OBJ_HANDLER) { hr = pObjList->Add(pStart, (StdObjRef*)spObjRef.m_p); if (FAILED(hr)) { _logFile.WriteV(LogCategory::Misc, LogLevel::General, LogOption::Std, "RpcMessage::GetObjList - pObjList->Add, hr : %08x", hr); return hr; } spObjRef.Detach(); } } else { ++pCur; } } return S_OK; }
f61cca0926bfda00148e8eca04773a426451b9f0
1405a394763bc6e997dd1f0387a49d23a0c38d22
/haxelib/native-bindings/src/HaxeAPI.h
c4ac8a0b16e070937b25fbb7398d6a16c4a01f0f
[]
no_license
josephzizys/hx-gameplay
93a7245e4393dd311bdb8aaa476f8d2bc6d95200
b8e17f373b3f124f591872e59cbb955968edcf05
refs/heads/master
2021-01-18T06:31:24.263377
2013-01-12T11:27:44
2013-01-12T11:27:44
null
0
0
null
null
null
null
UTF-8
C++
false
false
13,019
h
HaxeAPI.h
#ifndef __HAXEAPI_H__ #define __HAXEAPI_H__ #include "gameplay.h" #include <hx/CFFI.h> using namespace gameplay; #if defined _WIN32 || defined __CYGWIN__ #ifdef __GNUC__ #define DLL_PUBLIC __attribute__ ((dllexport)) #else #define DLL_PUBLIC __declspec(dllexport) #endif #else #if __GNUC__ >= 4 #define DLL_PUBLIC __attribute__ ((visibility ("default"))) #else #define DLL_PUBLIC #endif #endif /******************************************************************************* * OBJECT KINDS DECLARATION * ******************************************************************************/ DECLARE_KIND(k_OutParameter); DECLARE_KIND(k_Handle); DECLARE_KIND(k_Array); DECLARE_KIND(k_Object); DECLARE_KIND(k_Object_AnimationTarget); DECLARE_KIND(k_Object_PhysicsCollisionObject); DECLARE_KIND(k_Object_Ref); DECLARE_KIND(k_Object_ScriptTarget); DECLARE_KIND(k_Object_Transform_Listener); /******************************************************************************* * OUT PARAMETER PASSING * ******************************************************************************/ struct OutParameter { AutoGCRoot _value; OutParameter() : _value(alloc_null()) { } }; value CreateOutParameter(); value SetOutParameterValue(const value& thisObj, const value& _value); value GetOutParameterValue(const value& thisObj); /******************************************************************************* * HANDLE PASSING * ******************************************************************************/ void FreeHandle(value object); template <typename T> struct Handle { T _value; }; #define HandleToValueOrNull(_value, nullExpr) \ ( ((_value) == (nullExpr)) ? alloc_null() : HandleToValue(_value) ) template <typename T> value HandleToValue(const T& _value) { void *data = malloc(sizeof(Handle<T>)); Handle<T> *handle = static_cast<Handle<T> *>(data); handle->_value = _value; const value& result = alloc_abstract(k_Handle, data); val_gc(result, FreeHandle); return result; } template <typename T> bool ValueToHandle(value thisObj, T& _value) { if (val_is_null(thisObj)) return false; void *data = val_get_handle(thisObj, k_Handle); Handle<T> *handle = static_cast<Handle<T> *>(data); _value = handle->_value; return true; } /******************************************************************************* * NATIVE ARRAYS * ******************************************************************************/ template<typename T> void FreeArray(value object) { val_gc(object, NULL); if (!val_is_null(object)) { void *data = val_get_handle(object, k_Array); T* array = static_cast<T*>(data); SAFE_DELETE_ARRAY(array); } } template<typename TYPE> void ValueToArray(value _value, TYPE*& _array) { if (val_is_null(_value)) _array = NULL; else { void *data = val_get_handle(_value, k_Array); _array = static_cast<TYPE*>(data); } } template<typename TYPE> const value& ArrayToValue(const TYPE* _array, bool reclaim = false) { const void *data = static_cast<const void*>(_array); const value& result = alloc_abstract(k_Array, const_cast<void*>(data)); if (reclaim) val_gc(result, &FreeArray<TYPE>); return result; } /******************************************************************************* * BOXING / UNBOXING FUNCTIONS * ******************************************************************************/ float ValueToFloat(value _value); double ValueToDouble(value _value); unsigned int ValueToUint(value _value); short ValueToShort(value _value); unsigned short ValueToUshort(value _value); long ValueToLong(value _value); unsigned long ValueToUlong(value _value); size_t ValueToSizeT(value _value); const char *ValueToString(value _value); template<typename TYPE> void ValueToBuffer(value _value, TYPE*& _bufferVal) { if (val_is_null(_value)) _bufferVal = NULL; else if (val_is_buffer(_value)) _bufferVal = reinterpret_cast<TYPE *>(buffer_data(val_to_buffer(_value))); else hx_failure("Buffer expected."); } template<typename TYPE> void ValueToEnum(value _value, TYPE &_enumVal) { _enumVal = static_cast<TYPE>(val_get_int(_value)); } value StringToValue(const char *str); template<typename TYPE> value BufferToValue(const TYPE *data, unsigned long size) { if (data == NULL) return alloc_null(); const buffer& result = alloc_buffer_len(0); buffer_append_sub(result, reinterpret_cast<const char *>(data), size); return buffer_val(result); } template<typename TYPE> value EnumToValue(TYPE _enumVal) { return alloc_int(_enumVal); } /******************************************************************************* * WRAPPER TYPES * ******************************************************************************/ class HaxeScreenDisplayer { private: ScreenDisplayer *screenDisplayer; bool initialized; const value *clbkMethod; public: HaxeScreenDisplayer(); virtual ~HaxeScreenDisplayer(); void run(const value& method, void *cookie, unsigned long time); void complete(); void delegateCall(void *param); }; class HaxePhysicsController_Listener : public PhysicsController::Listener { private: AutoGCRoot clbkStatusEvent; public: HaxePhysicsController_Listener(const value& _clbkStatusEvent); void statusEvent(EventType type); }; /******************************************************************************* * GAMEPLAY OBJECT PASSING * ******************************************************************************/ template<typename TYPE, typename BASETYPE> void FreeObject(value object) { #ifdef DEBUG printf("DEBUG: Freeing garbage collected object.\n"); #endif val_gc(object, NULL); if (!val_is_null(object)) { void *handle = val_data(object); BASETYPE *base = static_cast<BASETYPE*>(handle); TYPE *pointer = static_cast<TYPE*>(base); SAFE_DELETE(pointer); } } #define CONVERSION_PROTOTYPES(type) \ value ObjectToValue(const type *pointer); \ value ObjectToValue(const type *pointer, bool dummy); \ void ValueToObject(value _value, type *&pointer); \ #define CONVERSION_PROTOTYPES_NO_FINALIZER(type) \ value ObjectToValue(const type *pointer, bool dummy); \ void ValueToObject(value _value, type *&pointer); #define CONVERSION_PROTOTYPES_REF(type) \ void ValueToObject(value _value, type *&pointer); CONVERSION_PROTOTYPES_REF(AbsoluteLayout) CONVERSION_PROTOTYPES_REF(AIAgent) CONVERSION_PROTOTYPES(AIAgent::Listener) CONVERSION_PROTOTYPES_NO_FINALIZER(AIController) CONVERSION_PROTOTYPES_NO_FINALIZER(AIMessage) CONVERSION_PROTOTYPES_REF(AIState) CONVERSION_PROTOTYPES(AIState::Listener) CONVERSION_PROTOTYPES_NO_FINALIZER(AIStateMachine) CONVERSION_PROTOTYPES_REF(Animation) CONVERSION_PROTOTYPES_REF(AnimationClip) CONVERSION_PROTOTYPES(AnimationClip::Listener) CONVERSION_PROTOTYPES_NO_FINALIZER(AnimationController) CONVERSION_PROTOTYPES_NO_FINALIZER(AnimationTarget) CONVERSION_PROTOTYPES_NO_FINALIZER(AnimationValue) CONVERSION_PROTOTYPES_REF(AudioBuffer) CONVERSION_PROTOTYPES(AudioController) CONVERSION_PROTOTYPES_NO_FINALIZER(AudioListener) CONVERSION_PROTOTYPES_REF(AudioSource) CONVERSION_PROTOTYPES(BoundingBox) CONVERSION_PROTOTYPES(BoundingSphere) CONVERSION_PROTOTYPES_REF(Bundle) CONVERSION_PROTOTYPES_REF(Button) CONVERSION_PROTOTYPES_REF(Camera) CONVERSION_PROTOTYPES_REF(CheckBox) CONVERSION_PROTOTYPES_REF(Container) CONVERSION_PROTOTYPES_REF(Control) CONVERSION_PROTOTYPES(Control::Listener) CONVERSION_PROTOTYPES_REF(Curve) CONVERSION_PROTOTYPES_REF(DepthStencilTarget) CONVERSION_PROTOTYPES_REF(Effect) CONVERSION_PROTOTYPES(FileSystem) CONVERSION_PROTOTYPES_REF(FlowLayout) CONVERSION_PROTOTYPES_REF(Font) CONVERSION_PROTOTYPES(Font::Text) CONVERSION_PROTOTYPES_REF(Form) CONVERSION_PROTOTYPES_REF(FrameBuffer) CONVERSION_PROTOTYPES(Frustum) CONVERSION_PROTOTYPES(Game) CONVERSION_PROTOTYPES_NO_FINALIZER(Gamepad) CONVERSION_PROTOTYPES(Gesture) CONVERSION_PROTOTYPES_REF(Image) CONVERSION_PROTOTYPES_REF(Joint) CONVERSION_PROTOTYPES_REF(Joystick) CONVERSION_PROTOTYPES(Keyboard) CONVERSION_PROTOTYPES_REF(Label) CONVERSION_PROTOTYPES_REF(Layout) CONVERSION_PROTOTYPES_REF(Light) CONVERSION_PROTOTYPES_NO_FINALIZER(Logger) CONVERSION_PROTOTYPES_REF(Material) CONVERSION_PROTOTYPES_REF(MaterialParameter) CONVERSION_PROTOTYPES(Matrix) CONVERSION_PROTOTYPES_REF(Mesh) CONVERSION_PROTOTYPES(MeshBatch) CONVERSION_PROTOTYPES(MeshPart) CONVERSION_PROTOTYPES_NO_FINALIZER(MeshSkin) CONVERSION_PROTOTYPES_REF(Model) CONVERSION_PROTOTYPES(Mouse) CONVERSION_PROTOTYPES_REF(Node) //CONVERSION_PROTOTYPES(Node::UserData) CONVERSION_PROTOTYPES(NodeCloneContext) CONVERSION_PROTOTYPES_REF(ParticleEmitter) CONVERSION_PROTOTYPES_REF(Pass) CONVERSION_PROTOTYPES_NO_FINALIZER(PhysicsCharacter) CONVERSION_PROTOTYPES(PhysicsCollisionObject) CONVERSION_PROTOTYPES(PhysicsCollisionObject::CollisionListener) CONVERSION_PROTOTYPES(PhysicsCollisionObject::CollisionPair) CONVERSION_PROTOTYPES_REF(PhysicsCollisionShape) CONVERSION_PROTOTYPES(PhysicsCollisionShape::Definition) CONVERSION_PROTOTYPES_NO_FINALIZER(PhysicsConstraint) CONVERSION_PROTOTYPES_NO_FINALIZER(PhysicsController) CONVERSION_PROTOTYPES(PhysicsController::HitFilter) CONVERSION_PROTOTYPES(PhysicsController::HitResult) CONVERSION_PROTOTYPES(HaxePhysicsController_Listener) CONVERSION_PROTOTYPES_NO_FINALIZER(PhysicsController::Listener) CONVERSION_PROTOTYPES_NO_FINALIZER(PhysicsFixedConstraint) CONVERSION_PROTOTYPES_NO_FINALIZER(PhysicsGenericConstraint) CONVERSION_PROTOTYPES_NO_FINALIZER(PhysicsGhostObject) CONVERSION_PROTOTYPES_NO_FINALIZER(PhysicsHingeConstraint) CONVERSION_PROTOTYPES(PhysicsRigidBody::Parameters) //CONVERSION_PROTOTYPES(PhysicsCollisionObject::PhysicsMotionState) //CONVERSION_PROTOTYPES(PhysicsCollisionObject::ScriptListener) CONVERSION_PROTOTYPES_NO_FINALIZER(PhysicsRigidBody) CONVERSION_PROTOTYPES_NO_FINALIZER(PhysicsSocketConstraint) CONVERSION_PROTOTYPES_NO_FINALIZER(PhysicsSpringConstraint) CONVERSION_PROTOTYPES_NO_FINALIZER(PhysicsVehicle) CONVERSION_PROTOTYPES_NO_FINALIZER(PhysicsVehicleWheel) CONVERSION_PROTOTYPES(Plane) CONVERSION_PROTOTYPES(Platform) CONVERSION_PROTOTYPES(Properties) CONVERSION_PROTOTYPES(Quaternion) CONVERSION_PROTOTYPES_REF(RadioButton) CONVERSION_PROTOTYPES(Ray) CONVERSION_PROTOTYPES(gameplay::Rectangle) CONVERSION_PROTOTYPES_REF(Ref) CONVERSION_PROTOTYPES_REF(RenderState) CONVERSION_PROTOTYPES_REF(RenderState::StateBlock) CONVERSION_PROTOTYPES_REF(RenderTarget) CONVERSION_PROTOTYPES_REF(Scene) //CONVERSION_PROTOTYPES(SceneLoader) //CONVERSION_PROTOTYPES(ScreenDisplayer) CONVERSION_PROTOTYPES(HaxeScreenDisplayer) CONVERSION_PROTOTYPES_NO_FINALIZER(ScriptController) CONVERSION_PROTOTYPES_NO_FINALIZER(ScriptTarget) CONVERSION_PROTOTYPES_REF(Slider) CONVERSION_PROTOTYPES(SpriteBatch) CONVERSION_PROTOTYPES(Stream) CONVERSION_PROTOTYPES_REF(Technique) CONVERSION_PROTOTYPES_REF(TextBox) CONVERSION_PROTOTYPES_REF(Texture) CONVERSION_PROTOTYPES_REF(Texture::Sampler) CONVERSION_PROTOTYPES_REF(Theme) CONVERSION_PROTOTYPES(Theme::SideRegions) CONVERSION_PROTOTYPES_NO_FINALIZER(Theme::Style) CONVERSION_PROTOTYPES_REF(Theme::ThemeImage) CONVERSION_PROTOTYPES(Theme::UVs) CONVERSION_PROTOTYPES(TimeListener) CONVERSION_PROTOTYPES(Touch) CONVERSION_PROTOTYPES(Transform) CONVERSION_PROTOTYPES(Transform::Listener) //CONVERSION_PROTOTYPES(Transform::TransformListener) CONVERSION_PROTOTYPES_NO_FINALIZER(Uniform) CONVERSION_PROTOTYPES(Vector2) CONVERSION_PROTOTYPES(Vector3) CONVERSION_PROTOTYPES(Vector4) CONVERSION_PROTOTYPES_REF(VertexAttributeBinding) CONVERSION_PROTOTYPES(VertexFormat) CONVERSION_PROTOTYPES(VertexFormat::Element) CONVERSION_PROTOTYPES_REF(VerticalLayout) value ReferenceToValue(Ref *pointer, bool free = true, bool increaseRefCount = false); void FreeReference(value object); /******************************************************************************* * (TODO) * ******************************************************************************/ #define COPY_OUTSIDE_SCOPE_PROTOTYPE(type) const value& CopyOutsideScope(const gameplay::type& obj); COPY_OUTSIDE_SCOPE_PROTOTYPE(Matrix) COPY_OUTSIDE_SCOPE_PROTOTYPE(Quaternion) COPY_OUTSIDE_SCOPE_PROTOTYPE(Vector2) COPY_OUTSIDE_SCOPE_PROTOTYPE(Vector3) COPY_OUTSIDE_SCOPE_PROTOTYPE(Vector4) #endif /* __HAXEAPI_H__ */
de2a45c3b941b540c6254c3d5b93877ae5400821
4999f0c32b73bd97b458b85f07ec6298a541c01f
/jd-2/main.cpp
308ebb650c0af3d64282c071428aaadcf6ac7e87
[]
no_license
yewmint/leisures
8fe41b45d8c6bf4174023ba1d19ba9f70a37cb92
21fda8822dd4fb23b35243c8db19f5cc2505c917
refs/heads/master
2021-07-24T06:09:24.019521
2018-10-16T06:44:02
2018-10-16T06:44:02
119,350,132
0
0
null
null
null
null
UTF-8
C++
false
false
686
cpp
main.cpp
#include <bits/stdc++.h> using namespace std; #define mp make_pair typedef pair<int, int> pii; typedef long long ll; template<typename T> ll scll(T val){ return static_cast<ll>(val); } int n; int main() { scanf("%d", &n); vector<vector<int>> goods(n, vector<int>(3, 0)); for (int i = 0; i < n; ++i){ scanf("%d%d%d", &goods[i][0], &goods[i][1], &goods[i][2]); } int ret = 0; for (int i = 0; i < n; ++i){ bool isBad = false; for (int j = 0; j < n && !isBad; ++j){ if (goods[i][0] < goods[j][0] && goods[i][1] < goods[j][1] && goods[i][2] < goods[j][2]) { ret++; isBad = true; } } } printf("%d", ret); }
64e43e1e00c4070e14ca8858b6e87409e2ef9722
c9fde4576216a22e8d5711bbe97adda1aafa2f08
/inference-engine/src/hetero_plugin/hetero_executable_network.h
6fe1ef44a320d14f2746b0efe58f4c4f490680e9
[ "Apache-2.0" ]
permissive
dliang0406/dldt
c703d6a837de3f996528fc8a9543f9530b23342c
d9b10abcebafe8b10ba81e09e433de7a366c072c
refs/heads/2018
2020-04-03T08:24:47.723353
2018-10-29T07:58:05
2018-10-29T07:58:05
155,132,108
3
1
Apache-2.0
2019-10-10T08:39:46
2018-10-29T01:03:54
C++
UTF-8
C++
false
false
2,439
h
hetero_executable_network.h
// Copyright (C) 2018 Intel Corporation // // SPDX-License-Identifier: Apache-2.0 // /** * @brief a header file for ExecutableNetwork * @file dlia_executable_network.hpp */ #pragma once #include <memory> #include <string> #include <vector> #include <map> #include <unordered_map> #include <unordered_set> #include <ie_common.h> #include <cpp/ie_plugin_cpp.hpp> #include <cpp_interfaces/impl/ie_executable_network_thread_safe_default.hpp> #include "hetero_infer_request.h" #include "cnn_network_impl.hpp" #include "hetero_async_infer_request.h" namespace HeteroPlugin { /** * @class ExecutableNetwork * @brief Interface of executable network */ class HeteroExecutableNetwork : public InferenceEngine::ExecutableNetworkThreadSafeDefault { public: typedef std::shared_ptr<HeteroExecutableNetwork> Ptr; /** * @brief constructor */ HeteroExecutableNetwork(InferenceEngine::ICNNNetwork &network, const std::map<std::string, std::string> &config, const std::vector<InferenceEngine::IExtensionPtr> &extensions, InferenceEngine::MapDeviceLoaders &deviceLoaders); virtual ~HeteroExecutableNetwork() = default; /** * this functino implements the loading of hetero network, * performs split to subgraphs and prepare intermediate blobs * * @param network * @param extensions */ void load(InferenceEngine::ICNNNetwork &network, const std::map<std::string, std::string> &config, const std::vector<InferenceEngine::IExtensionPtr> &extensions); InferenceEngine::InferRequestInternal::Ptr CreateInferRequestImpl(InferenceEngine::InputsDataMap networkInputs, InferenceEngine::OutputsDataMap networkOutputs) override; void CreateInferRequest(InferenceEngine::IInferRequest::Ptr &asyncRequest) override; private: struct NetworkDesc { std::string _device; InferenceEngine::details::CNNNetworkImplPtr _clonedNetwork; InferenceEngine::IHeteroDeviceLoader::Ptr _deviceLoader; InferenceEngine::ExecutableNetwork::Ptr network; std::unordered_set<std::string> _oNames; std::unordered_set<std::string> _iNames; }; std::vector<NetworkDesc> networks; InferenceEngine::MapDeviceLoaders &_deviceLoaders; }; } // namespace HeteroPlugin
6d851abce599decd27d0aa4a190318d2b57286c7
a54300ad38a05d3b1e41ba1ad211ed44db8da7c8
/Source/Shader/GfxShader.h
89610f53798d042c2b1e83e74e6298198870f485
[]
no_license
takasuke-ando/GfxLib_Dx11
df30966eb3d6a1e8cb67433b09ea76a8e1eee204
382a2be5e7687a12a85a93c610d7d2540f2241e9
refs/heads/master
2021-01-10T03:15:00.005834
2016-03-13T15:20:39
2016-03-13T15:20:39
53,783,327
0
0
null
null
null
null
UTF-8
C++
false
false
349
h
GfxShader.h
#pragma once #include <Util\GfxD3DPtr.h> namespace GfxLib { class Shader { public: ~Shader(); protected: Shader(); HRESULT CompileShaderFromFile( const wchar_t* filePath , LPCSTR entryPoint , LPCSTR shaderModel , ID3DBlob** ppBlobOut ); protected: D3DPtr< ID3D11Device > m_pd3dDev; }; }
e2c10e6fbb4037b6a6ab7a5c002ab4bfa334aba0
98fb49c18d109bae883cff9978ffe7d851824c3e
/CPP/TREE/tree_creation.cpp
8e56060421b0d307cfcd43022674a89492f25d8b
[]
no_license
ANKUSH-JPG/CODES
b6552c3a083ddb4be8b7f8099c7432567b860123
40265c79bdefc56c88d549accc9931dd630c1408
refs/heads/master
2023-02-20T15:21:44.847711
2021-01-25T08:34:58
2021-01-25T08:34:58
310,353,373
1
0
null
null
null
null
UTF-8
C++
false
false
3,083
cpp
tree_creation.cpp
#include<iostream> using namespace std; struct node { struct node *left; char data; struct node *right; }; struct q { int f=0; int r=-1; struct node *a[100]={NULL}; }; struct node * add_root(struct node *a[],int &f,int &r) { struct node *temp=new node; r=r+1; cout<<"ENTER CHARACTER FOR ROOT:"; cin>>temp->data; temp->left=NULL; temp->right=NULL; a[r]=temp; return temp; } struct node * add_nodes(struct node *head,struct node *a[],int &f,int &r) { while(a[f]!=NULL) { int choice; cout<<"WANT LEFT CHILD: 1.YES 2.NO"; cin>>choice; struct node *p=a[f]; f=f+1; if(choice==1) { struct node *l=new node; cout<<"ENTER DATA:"; cin>>l->data; l->left=NULL;l->right=NULL; p->left=l; // INSERT INTO QUEUE r=r+1;a[r]=l; // RIGHT PART int rchoice; cout<<"WANT RIGHT CHILD: 1.YES 2.NO"; cin>>rchoice; if(rchoice==1) { struct node *ri=new node; cout<<"ENTER DATA:"; cin>>ri->data; ri->left=NULL;ri->right=NULL; p->right=ri; // INSERT INTO QUEUE r=r+1;a[r]=ri; } } else { int rchoice; cout<<"WANT RIGHT CHILD: 1.YES 2.NO"; cin>>rchoice; if(rchoice==1) { struct node *ri=new node; cout<<"ENTER DATA:"; cin>>ri->data; ri->left=NULL;ri->right=NULL; p->right=ri; // INSERT INTO QUEUE r=r+1;a[r]=ri; } } } return head; } void preorder(struct node *p) { if(p!=NULL) { cout<<p->data<<" "; preorder(p->left); preorder(p->right); } } void inorder(struct node *p) { if(p!=NULL) { inorder(p->left); cout<<p->data<<" "; inorder(p->right); } } void postorder(struct node *p) { if(p!=NULL) { postorder(p->left); postorder(p->right); cout<<p->data<<" "; } } void levelorder(struct node *a[],int &f,int &r) { while(f!=r) { f=f+1; struct node *p=a[f]; cout<<p->data<<" "; if(p->left!=NULL) { r=r+1; a[r]=p->left; if(p->right!=NULL) { r=r+1; a[r]=p->right; } } else { if(p->right!=NULL) { r=r+1; a[r]=p->right; } } } } int main() { struct node *head=new node; struct q q1; head=add_root(q1.a,q1.f,q1.r); head=add_nodes(head,q1.a,q1.f,q1.r); cout<<"!!!!!!!!!!!!!! OK COMPLETED CREATION OF TREE !!!!!!!!!!!!!!"<<endl; while(1) { int choice; cout<<endl<<"1.PREORDER 2.INORDER 3.POSTORDER 4.LEVEL ORDER 5.EXIT"<<endl; cin>>choice; if(choice==1) preorder(head); else if(choice==2) inorder(head); else if(choice==3) postorder(head); else if(choice==4) { q1.f=-1; q1.r=-1; q1.r=q1.r+1; q1.a[q1.r]=head; levelorder(q1.a,q1.f,q1.r); } else break; } return 0; }
7e693cfb2dc378fdb6bd1ffa2e0cd1e473406bc4
ed2cd3d6b3475cde90b1dda95eb03c859517c71a
/Student_OMP_Image/src/cpp/core/04_RayTracing/moo/host/RayTracing.h
a64edd56d889252008e3dce92ddba121ea7c57dc
[]
no_license
jcornaz/hesso.gpu.exercices
926473089d096210b2538da0c76ec69f67e0794d
5de3288338f963e12d5c32d95d372834f57923d5
refs/heads/master
2021-01-21T06:52:08.018923
2018-04-04T11:48:23
2018-04-04T11:48:23
91,589,076
0
0
null
null
null
null
UTF-8
C++
false
false
813
h
RayTracing.h
#ifndef RAY_TRACING_H_ #define RAY_TRACING_H_ #include "Animable_I.h" #include "MathTools.h" #include "Sphere.h" class RayTracing: public Animable_I { public: RayTracing(int w, int h, int padding, float dt, int nbSpheres); virtual ~RayTracing(); /** * Call periodicly by the api */ virtual void process(uchar4* ptrDevPixels, int w, int h); /** * Call periodicly by the api */ virtual void animationStep(); virtual void setParallelPatern(ParallelPatern parallelPatern); virtual float getAnimationPara(); virtual string getTitle(); virtual int getW(); virtual int getH(); private: // Inputs int w; int h; int nbSpheres; Sphere** spheres; float dt; // Tools float t; //Outputs string title; }; #endif
d934694a2f4cc5979b6c9d3cb63aa5589629b969
8ab3e882303250ef5b279418d7916c7036b0a1d9
/workspace/DemonstratePMRMonotonicBufferResource/src/DemonstratePMRMonotonicBufferResource.cpp
e3cd106a28f54ef6bd31d07d411c266a8d17e203
[]
no_license
PeterSommerlad/CPPCourseExpert
eaac3a0562ef390b259031629d943f82e384b8cd
84b365c4508c7906f638199115fc2f9597319b4d
refs/heads/main
2023-06-12T00:31:38.864261
2023-05-26T15:51:29
2023-05-26T15:51:45
470,980,622
2
2
null
null
null
null
UTF-8
C++
false
false
800
cpp
DemonstratePMRMonotonicBufferResource.cpp
#include <iostream> #include <memory_resource> #include <array> #include <cstddef> #include <numeric> #include <cstdint> #include <iterator> #include <algorithm> #include <new> int use_vector_with_pmr_resource(){ using namespace std::pmr; std::array<std::byte,1000> heap{}; monotonic_buffer_resource memory{ heap.data() ,heap.size() ,null_memory_resource()}; polymorphic_allocator<std::byte> const myalloc { &memory }; vector<int64_t> v{myalloc}; try { //v.reserve(sizeof(heap)/sizeof(decltype(v)::value_type)); generate_n(std::back_inserter(v),1000,[i=0]()mutable{return i++;}); } catch (std::bad_alloc const &) { // ignore here intentionally } return std::accumulate(begin(v),end(v),0); } int main() { std::cout << use_vector_with_pmr_resource() << '\n'; }
0d6180f62ac99d64a3a3eb222ae2e4b332871076
812483619228582d4227680715b6c430f409fd56
/src/query/parser/Statement.cpp
5c83e1bb0a105933faa2efc5c99d94642ad657dd
[]
no_license
alexandervanrenen/Gamera-Database
dc309be4f74a9edbe6e6701f63e78ba3b5f089b6
77e519bb95a3d9be5d4930c969ce2525442da2bd
refs/heads/master
2021-06-13T19:47:39.964140
2017-02-19T21:17:29
2017-02-19T21:17:29
8,671,726
1
0
null
null
null
null
UTF-8
C++
false
false
2,954
cpp
Statement.cpp
#include "Statement.hpp" #include "harriet/Expression.hpp" #include "harriet/ScriptLanguage.hpp" #include "harriet/Value.hpp" #include "query/operator/PrintOperator.hpp" #include "query/operator/RootOperator.hpp" #include "query/util/GlobalRegister.hpp" #include "Visitor.hpp" using namespace std; namespace dbi { namespace script { Statement::~Statement() { } bool Statement::isLocal() const { Type t = getType(); return t==Type::kSelectStatement || t==Type::kInsertStatement || t==Type::kBlockStatement; } bool Statement::isGlobal() const { Type t = getType(); return t==Type::kSelectStatement || t==Type::kCreateTableStatement || t==Type::kInsertStatement; } SelectStatement::SelectStatement(vector<pair<string, unique_ptr<harriet::Expression>>>&& selectors, vector<TableReference>&& sources, vector<unique_ptr<harriet::Expression>>&& conditions, vector<string>&& orderBy) : projections(move(selectors)) , sources(move(sources)) , conditions(move(conditions)) , orderBy(move(orderBy)) { } SelectStatement::~SelectStatement() { } void SelectStatement::acceptVisitor(Visitor& visitor) { visitor.onPreVisit(*this); visitor.onPostVisit(*this); } CreateTableStatement::CreateTableStatement(string&& name, vector<AttributeDeclaration>&& attributes, vector<vector<string>>&& uniqueColumns) : tableName(move(name)) , attributes(move(attributes)) , uniqueColumns(move(uniqueColumns)) { } void CreateTableStatement::acceptVisitor(Visitor& visitor) { visitor.onPreVisit(*this); visitor.onPostVisit(*this); } InsertStatement::InsertStatement(string&& tableName, vector<harriet::Value>&& values) : tableName(move(tableName)) , values(move(values)) { } InsertStatement::~InsertStatement() { } void InsertStatement::acceptVisitor(Visitor& visitor) { visitor.onPreVisit(*this); visitor.onPostVisit(*this); } DropTableStatement::DropTableStatement(string&& tableName) : tableName(move(tableName)) { } DropTableStatement::~DropTableStatement() { } void DropTableStatement::acceptVisitor(Visitor& visitor) { visitor.onPreVisit(*this); visitor.onPostVisit(*this); } BlockStatement::BlockStatement(vector<unique_ptr<Statement>> statements) : statements(move(statements)) { for(auto& statement : statements) if(!statement->isLocal()) throw "non local statement in local scope"; } void BlockStatement::acceptVisitor(Visitor& visitor) { visitor.onPreVisit(*this); for(auto& iter : statements) iter->acceptVisitor(visitor); visitor.onPostVisit(*this); } RootStatement::RootStatement(vector<unique_ptr<Statement>> statements) : statements(move(statements)) { for(auto& statement : statements) if(!statement->isGlobal()) throw "non global statement in global scope"; } void RootStatement::acceptVisitor(Visitor& visitor) { visitor.onPreVisit(*this); for(auto& statement : statements) statement->acceptVisitor(visitor); visitor.onPostVisit(*this); } } }
9dbb1eab4142f11128b15bb03cf707f33117ca24
877e415f325874912759a1824a1e6ab5d65747c2
/main/CLCCParser.cpp
8c783e8213cdc59c0b223b8a0677b6270701817f
[]
no_license
teor292/ArduinoAlarmBicycleDevice
3fd808f79226618dde7c0e817c40d18f1e1d1587
7d11d7c3fcd5e2bce881eaae776313aee56c48d4
refs/heads/main
2023-06-25T17:45:41.283125
2021-07-22T15:34:13
2021-07-22T15:34:13
363,387,072
2
0
null
null
null
null
UTF-8
C++
false
false
1,058
cpp
CLCCParser.cpp
#include "CLCCParser.h" CLCC_CALL_STATE CLCCParser::Parse(SafeString& str) { const static char CLCC[] = "+CLCC:"; if (!str.startsWith(CLCC)) return CLCC_CALL_STATE::ERROR_PARSE; int index = str.indexOf(',', sizeof(CLCC)); if (-1 == index) return CLCC_CALL_STATE::ERROR_PARSE; index = str.indexOf(',', index + 1); if (-1 == index) return CLCC_CALL_STATE::ERROR_PARSE; int last_index = str.indexOf(',', index + 1); if (-1 == last_index) return CLCC_CALL_STATE::ERROR_PARSE; str.substring(str, index + 1, last_index); int value = 0; if (!str.toInt(value)) return CLCC_CALL_STATE::ERROR_PARSE; switch (value) { case 0: return CLCC_CALL_STATE::ACTIVE; case 1: return CLCC_CALL_STATE::HELD; case 2: return CLCC_CALL_STATE::DIALING; case 3: return CLCC_CALL_STATE::ALERTING; case 4: return CLCC_CALL_STATE::INCOMING; case 5: return CLCC_CALL_STATE::WAITING; case 6: return CLCC_CALL_STATE::DISCONNECT; } return CLCC_CALL_STATE::UNKNOWN; }
5b2a6646ccc6620da3bfbc501c409a7b587d34f2
4c95d6f77e325932ad500c9f0469b83bda41d920
/NodeMCU_Principal/NodeMCU_Principal.ino
c8626778373eda252118e07deb874317a65dfadf
[]
no_license
nuclicufc/ESP-Now_with_ESP8266
85b9603e5b10afa98185467068a5978d0a3738ce
321209bed39c2a1005a283d31feec9ea5ab9b75e
refs/heads/master
2022-12-30T20:52:54.320309
2020-10-16T22:41:09
2020-10-16T22:41:09
304,751,635
0
0
null
null
null
null
UTF-8
C++
false
false
2,623
ino
NodeMCU_Principal.ino
#include <ESP8266WiFi.h> #include <espnow.h> // MAC Address do NodeMCU que vai receber dados uint8_t broadcastAddress1[] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; uint8_t broadcastAddress2[] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; uint8_t broadcastAddress3[] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; // exemplo de estrutura para enviar dados // deve coincidir com a estrutura no NodeMCU que receber dados typedef struct test_struct { int x; int y; int z; } test_struct; // cria uma struct_message chamada test para armazenar variáveis para serem enviadas test_struct test; test_struct test2; test_struct test3; unsigned long lastTime = 0; unsigned long timerDelay = 2000; // send readings timer // retorno quando a mensagem é enviada void OnDataSent(uint8_t *mac_addr, uint8_t sendStatus) { char macStr[18]; Serial.print("Packet to:"); snprintf(macStr, sizeof(macStr), "%02x:%02x:%02x:%02x:%02x:%02x", mac_addr[0], mac_addr[1], mac_addr[2], mac_addr[3], mac_addr[4], mac_addr[5]); Serial.print(macStr); Serial.print(" send status: "); if (sendStatus == 0){ Serial.println("Delivery success"); } else{ Serial.println("Delivery fail"); } } void setup() { // Init Serial Monitor Serial.begin(115200); // Set device as a Wi-Fi Station WiFi.mode(WIFI_STA); WiFi.disconnect(); // Init ESP-NOW if (esp_now_init() != 0) { Serial.println("Error initializing ESP-NOW"); return; } esp_now_set_self_role(ESP_NOW_ROLE_CONTROLLER); // Uma vez que o ESPNow é inicializado com sucesso, definimos este no com principal // ele irá receber o status dos pacotes envadosg esp_now_register_send_cb(OnDataSent); // Register peer esp_now_add_peer(broadcastAddress1, ESP_NOW_ROLE_SLAVE, 1, NULL, 0); esp_now_add_peer(broadcastAddress2, ESP_NOW_ROLE_SLAVE, 1, NULL, 0); esp_now_add_peer(broadcastAddress3, ESP_NOW_ROLE_SLAVE, 1, NULL, 0); } void loop() { if ((millis() - lastTime) > timerDelay) { // Set values to send test.x = random(1, 50); test.y = random(1, 50); test.z = random(1, 50); test2.x = random(1, 50); test2.y = random(1, 50); test3.z = random(1, 50); // Envia uma mensagem para o ESPNow esp_now_send(0, (uint8_t *) &test, sizeof(test)); esp_now_send(broadcastAddress1, (uint8_t *) &test, sizeof(test)); esp_now_send(broadcastAddress2, (uint8_t *) &test2, sizeof(test2)); esp_now_send(broadcastAddress3, (uint8_t *) &test, sizeof(test3)); lastTime = millis(); } }
b6fa78e173762afebfabfd54e4e3b4cf1a84c795
22e707bcd744fb0ac7ea06f40d4864f4ec9111b8
/tests/src/empty.h
be25f8713898f290bd600beef650f10cb439f99c
[ "MIT" ]
permissive
hartcw/smacro
f6e5dc6cbe6c7918f54165146a3922af7f286065
79e336f6d828a779769638577d30886bf6019b6b
refs/heads/master
2016-09-06T14:00:32.878753
2011-08-21T08:23:26
2011-08-21T08:23:26
1,530,321
3
0
null
null
null
null
UTF-8
C++
false
false
111
h
empty.h
#ifndef EMPTY_H #define EMPTY_H namespace test { struct TestStruct { int Value; }; } #endif // EMPTY_H
227693071bbcdc72d6e141c3343db01422684f6a
655286bf8dbf1bebf74bdeff51d91c7ec995f6dc
/Seminars/program_7.cpp
f211ef35e8a577ababbadd0e7af7404581370b1c
[]
no_license
DmitriiDenisov/CPP_notes
c54ce0a1c286dfc299a00f8f12d46f47bd70d8af
4f388e7a4e7893fbd78ccd561c17a5642b3ebc70
refs/heads/master
2020-08-19T20:02:17.586843
2019-10-18T07:20:06
2019-10-18T07:20:06
215,949,517
0
0
null
null
null
null
UTF-8
C++
false
false
5,134
cpp
program_7.cpp
//Программа удаляет из массива все элементы,значения которых заканчиваются на цифру 3 или 5(исключая //элементы из массива,все следующие за ним элементы сдвигаются влево на 1 позицию,и при этом освободившийся //элемент массива зануляется.Заполнение:так как в задаче не было сказано про размер и способ заполнения массива, //то автор выбрал массив из 30 элементов и случайное заполнение элементов целыми числами из отрезка [1;50] //В программе реализована одна пользовательская функция,удаляющая "неподходящие" элементы и возвращающая //количество удаленных элементов.В результате,программа выводит элементы в две строчки(1 строка-15 элементов,2-ая - оставшиеся(под каждое значение отводится 3 позиции)) //Третьей строчкой программа выводит колчество удаленных элементов.Все результаты выводится в функции main// // Среда разработки: Microsoft Visual C++ 2012 Express // // Версия программы: 1.00 | Автор: Денисов Д.М.,ПМИ,172 // // Дата последнего изменения: 14.12.2013 #include "stdafx.h" #include <ctime> #include <cstdlib> #include <iomanip> #include <iostream> using namespace std; int ydalenie(int *arr,const int n)//пользовательская функция,удаляющая ненужные элементы.Возвращает количество удаленных элементов { int num = 0;//переменная отвечающая за количество удаленных чисел int i = 0; bool flag;//булева переменная,фиксирует,выполнялось ли условие оканчивания на 3 или 5 while (i < n)//будем идти по каждому i-му элементу и проверять,оканчивается ли он на 3 или 5 { flag = true; if ((arr[i] % 10 == 5)||(arr[i] % 10 == 3))//если оканчивается на 3 или 5 { flag = false;//переменная фиксирует заход в цикл for=>мы поймем, что это число было удалено for (int j = i ; j < n - 1 ; j++) arr[j] = arr[j + 1];//сдвиг влево } if (flag == false)//если захода не было(flag == true),то рассматриваем следующее число,то есть увеличиваем i на 1 { arr[n - 1 - num] = 0;//зануляем "освободившуюся" в следствие сдвига ячейку num++;//+1 к колчесву удаленных элементов :) } else i++;//Важный переход:если число удалилось=>сдигаем влево и число,которое мы ещё не рассматривали //теперь стоит на этом же место=>i не меняем. В случае же,если число не удалили=>i увеличиваем на 1 //то есть рассматриваем уже следующее число } return num; } int _tmain(int argc, _TCHAR* argv[]) { const int N = 30;//размерность массива int arr[N];//массив setlocale(LC_ALL, "Rus"); srand(time(NULL)); for (int i = 0 ; i < N ; i++)//случайное заполнение массива arr[i]=rand()%49+1; //cout<<"Generated numbers:";//для удобства можете включить вывод сгенерированных элементов,чтобы убедиться в верности вычислений //for (int i = 0 ; i < N ; i++) //cout<<i<<"-th number: "<<arr[i]<<endl; int kolic = ydalenie(arr,N);//присваиваем переменной kolic число удаленных чисел.Это число возвращает функция ydalenie,одновременно с этим функция удаляет ненужные элементы cout<<"Элементы (часть#1):"; for (int i = 0 ; i <= 13; i++) if (arr[i]!=0) cout<<setw(3)<<arr[i];//на каждый элемент отводится три позиции cout<<endl<<"Элементы (часть#2):"; for (int i = 14 ; i < N; i++) if (arr[i]!=0)//выводим без нулей cout<<setw(3)<<arr[i];//3 позиции на каждый элемент cout<<endl<<"Число удаленных из массива элементов="<<kolic<<endl; return 0; }
926bdedea9dc43782e5f42772ffcd2637c884562
7422ddcb551530ca248b233d85a0b6d9fc8e5597
/examples/example.cpp
36110eb2defbcb9e94fd8c6a2b495dab7bfcbdd7
[ "MIT" ]
permissive
congard/tulz
3ab5256871ff2b4361fe4e5b1d83a182c5a1cdd8
5e87189913fa96f162b3d8885a7e2df74a279a51
refs/heads/master
2023-09-01T08:51:47.576874
2023-08-26T22:34:34
2023-08-26T22:34:34
217,851,635
1
0
null
null
null
null
UTF-8
C++
false
false
4,321
cpp
example.cpp
#include <tulz/Path.h> #include <tulz/File.h> #include <tulz/StringUtils.h> #include <tulz/threading/Thread.h> #include <tulz/threading/ThreadPool.h> #include <tulz/threading/MutexLocker.h> #include <tulz/LocaleInfo.h> #include <iostream> #include <utility> #include <locale> using namespace tulz; using namespace std; void localeInfo() { cout << "=== locale info ===\n"; auto showInfoFor = [](const char *loc) { cout << "\nInfo for " << loc << "\n"; auto info = LocaleInfo::get(loc); cout << "Language code: " << info.languageCode << "\n"; cout << "Languages: "; for (auto lang: info.languages) { cout << lang << "\n"; } cout << "Country code: " << info.countryCode << "\n"; cout << "Country: " << info.country << "\n"; }; showInfoFor("cu_BG"); showInfoFor("Church Slavic_Bulgaria"); showInfoFor("English_United States.1252"); showInfoFor(locale("").name().c_str()); } void filesystem() { cout << "\n=== filesystem ===\n\n"; auto workingDirectory = Path::getWorkingDirectory(); auto newWorkingDirectory = workingDirectory; while (newWorkingDirectory.getPathName() != "tulz") { newWorkingDirectory = newWorkingDirectory.getParentDirectory(); } cout << "System path: " << Path::getSystemPath().toString() << "\n"; cout << "Working directory: " << workingDirectory.toString() << "\n"; cout << "Setting working directory to " << newWorkingDirectory.toString() << "\n"; Path::setWorkingDirectory(newWorkingDirectory); workingDirectory = Path::getWorkingDirectory(); cout << "Working directory: " << workingDirectory.toString() << "\n"; cout << "\nThis directory contains next files and directories:\n"; for (const auto &s : workingDirectory.listChildren()) { cout << s.toString() << "\n"; } // bool to string auto b2s = [](bool b) { return b ? "true" : "false"; }; auto filePath = Path(Path::join(workingDirectory.toString(), "examples", "directory", "hello.txt")); cout << "\nFile " << filePath.toString() << "\n"; cout << "exists: " << b2s(filePath.exists()) << "\n"; cout << "file: " << b2s(filePath.isFile()) << "\n"; cout << "directory: " << b2s(filePath.isDirectory()) << "\n"; cout << "absolute path: " << b2s(filePath.isAbsolute()) << "\n"; cout << "size: " << filePath.size() << "\n"; cout << "content: " + File(filePath, File::Mode::ReadText).readStr() << "\n"; } void regex() { cout << "\n=== regex ===\n\n"; string src = "apple pineapple tomato potato"; string regex = "[a-z]+o"; cout << "src: " << src << "\n"; cout << "regex: " << regex << "\n"; cout << "matches:\n"; auto matches = StringUtils::findRegex(src, regex); for (const auto &m : matches) { for (const auto &match : m.matches) { cout << match << "\n"; } } } void threading() { cout << "\n=== threading ===\n\n"; class MyRunnable: public Runnable { public: explicit MyRunnable(string name) : name(std::move(name)) {} ~MyRunnable() override { cout << "~MyRunnable (" << name << ")\n"; } void run() override { cout << "MyRunnable output begins (" << name << ")\n"; Thread::sleep(4s); cout << "MyRunnable output ends (" << name << ")\n"; } private: string name; }; ThreadPool pool; pool.setMaxThreadCount(2); pool.setExpiryTimeout(1000); pool.start([]() { cout << "Lambda 1 first message\n"; Thread::sleep(2s); cout << "Lambda 1 last message\n"; }); pool.start([](const string &arg) { cout << "Lambda 2 first message\n"; cout << "Lambda 2 arg is: '" << arg << "'\n"; Thread::sleep(3s); cout << "Lambda 2 last message\n"; }, "just a string argument"); pool.start(new MyRunnable("foo")); pool.start(new MyRunnable("bar")); while (pool.getActiveThreadCount() > 0) { pool.update(); Thread::sleep(500); } cout << "There are no active threads left in the pool\n"; pool.stop(); } int main() { localeInfo(); filesystem(); regex(); threading(); return 0; }
c863841887cbf9d5794c5e82d2bd9be3a31e7e96
b6d1df49c1ec621a02204b1100312ecbb3e76ad3
/src/mains/mapping/ply2tdp.cc
3f0fc4dd8aa8d52f701ad3a34d52057b38b20034
[]
no_license
flylong0204/projects
5271acde325cf3947fac7433077353b52fa07bc4
b1e5c918d4aeb34c36576dababc5509dbb89afd1
refs/heads/master
2017-12-06T06:35:20.926786
2017-01-24T23:53:13
2017-01-24T23:53:13
79,988,197
1
2
null
2017-01-25T06:11:23
2017-01-25T06:11:23
null
UTF-8
C++
false
false
7,276
cc
ply2tdp.cc
// ========================================================================== // Program PLY2TDP reads in reads in a PLY file generated by Noah's // Bundler codes. It extracts X,Y,Z,R,G,B information and generates // an output TDP file. // ply2tdp // ========================================================================== // Last updated on 6/27/12; 6/29/12; 9/11/13; 12/3/13 // ========================================================================== #include <iostream> #include <iomanip> #include <string> #include <vector> #include "general/filefuncs.h" #include "general/stringfuncs.h" #include "general/sysfuncs.h" #include "osg/osg3D/tdpfuncs.h" #include "math/prob_distribution.h" using std::cin; using std::cout; using std::endl; using std::string; using std::vector; // ========================================================================== int main(int argc, char *argv[]) // ========================================================================== { std::set_new_handler(sysfunc::out_of_memory); string ply_filename; vector<string> param; if (filefunc::parameter_input(argc,argv,param)) { ply_filename=param.back(); } else { cout << "Enter input PLY filename:" << endl; cin >> ply_filename; } filefunc::ReadInfile(ply_filename); cout << "filefunc::text_line.size() = " << filefunc::text_line.size() << endl; vector<double> X,Y,Z; vector<int> R,G,B; string banner="Parsing input PLY file:"; outputfunc::write_banner(banner); // int i_max=1000; int i_max=filefunc::text_line.size(); for (int i=0; i<i_max; i++) { vector<string> substrings=stringfunc::decompose_string_into_substrings( filefunc::text_line[i]); // For lazerkart ply file, substrings.size()=3: if (substrings.size()==3) { double x=stringfunc::string_to_number(substrings[0]); double y=stringfunc::string_to_number(substrings[1]); double z=stringfunc::string_to_number(substrings[2]); X.push_back(x); Y.push_back(y); Z.push_back(z); } else if (substrings.size()==6 || substrings.size()>=9) { double x=stringfunc::string_to_number(substrings[0]); double y=stringfunc::string_to_number(substrings[1]); double z=stringfunc::string_to_number(substrings[2]); // Recall Noah's initial coordinate system needs to be grossly // manipulated so that ground scenes lie approximately in XY plane: // X_Peter = -X_Noah // Y_Peter= Z_Noah // Z_Peter = Y_Noah bool gross_rotate_bundler_coords_flag=true; // bundler // bool gross_rotate_bundler_coords_flag=false; if (gross_rotate_bundler_coords_flag) { X.push_back(-x); Y.push_back(z); Z.push_back(y); } else { X.push_back(x); Y.push_back(y); Z.push_back(z); } int r,g,b; if (substrings.size()==6) { r=stringfunc::string_to_number(substrings[3]); g=stringfunc::string_to_number(substrings[4]); b=stringfunc::string_to_number(substrings[5]); } else if (substrings.size()>=9) { r=stringfunc::string_to_number(substrings[6]); g=stringfunc::string_to_number(substrings[7]); b=stringfunc::string_to_number(substrings[8]); } R.push_back(r); G.push_back(g); B.push_back(b); } } cout << "X.size() = " << X.size() << endl; cout << "Y.size() = " << Y.size() << endl; cout << "Z.size() = " << Z.size() << endl; cout << "R.size() = " << R.size() << endl; cout << "G.size() = " << G.size() << endl; cout << "B.size() = " << B.size() << endl; /* int n_output_bins=10000; prob_distribution prob_X(X,n_output_bins); prob_distribution prob_Y(Y,n_output_bins); prob_distribution prob_Z(Z,n_output_bins); prob_X.set_densityfilenamestr("X.meta"); prob_Y.set_densityfilenamestr("Y.meta"); prob_Z.set_densityfilenamestr("Z.meta"); prob_X.writeprobdists(false); prob_Y.writeprobdists(false); prob_Z.writeprobdists(false); */ string UTMzone=""; string tdp_filename=stringfunc::prefix(ply_filename)+".tdp"; tdpfunc::write_relative_xyzrgba_data( UTMzone,tdp_filename,X,Y,Z,R,G,B); /* // This next section was added in late June 2012 in order to georegister // Nick Armstrong-Crews' lazerkart point cloud to the 3D MIT building // models: // Scan through X,Y,Z vectors and eliminate any point which lie // outside reasonable intervals: banner="Eliminating outlier points:"; outputfunc::write_banner(banner); double xmin=327881; double xmax=328373; double ymin=4690774; double ymax=4692651; double zmin=-10; double zmax=50; vector<double> X_reduced,Y_reduced,Z_reduced; for (int i=0; i<X.size(); i++) { if (X[i] > xmin && X[i] < xmax) X_reduced.push_back(X[i]); if (Y[i] > ymin && Y[i] < ymax) Y_reduced.push_back(Y[i]); if (Z[i] > zmin && Z[i] < zmax) Z_reduced.push_back(Z[i]); } banner="Transforming inlier points:"; outputfunc::write_banner(banner); const threevector rotation_origin(328192,4692011,0); // double az=0; // double az= -2.36471 * PI/180; // best global fit 6/29/2012 // double az= -3.0453 * PI/180; // just Carleton St fit 7/6/2012 double az= -2.27079 * PI/180; // just Rebecca bldgs fit 7/6/2012 double el=0; double roll=0; rotation Rot; Rot=Rot.rotation_from_az_el_roll(az,el,roll); double scalefactor= 1; // double x_trans=0; // double y_trans=0; // double x_trans = 3.08188; // best global fit 6/29/2012 // double y_trans = -3.00164; // best global fit 6/29/2012 // double x_trans=3.64261; // just Carleton St fit 7/6/2012 // double y_trans=-3.00413; // just Carleton St fit 7/6/2012 double x_trans=3.41057; // just Rebecca bldgs fit 7/6/2012 double y_trans=1.32599; // just Rebecca bldgs fit 7/6/2012 double z_trans=2.53; // best global fit 6/29/2012 threevector trans(x_trans,y_trans,z_trans); vector<double> X_transformed,Y_transformed,Z_transformed; for (int i=0; i<X_reduced.size(); i++) { threevector XYZ(X_reduced[i],Y_reduced[i],Z_reduced[i]); vertex V(XYZ); V.translate(-rotation_origin); V.rotate(Rot); V.scale(rotation_origin,scalefactor); V.translate(rotation_origin); V.translate(trans); XYZ=V.get_posn(); X_transformed.push_back(XYZ.get(0)); Y_transformed.push_back(XYZ.get(1)); Z_transformed.push_back(XYZ.get(2)); } cout << "X.size() = " << X.size() << " X_reduced.size() = " << X_reduced.size() << " X_transformed.size() = " << X_transformed.size() << endl; banner="Exporting TDP file:"; outputfunc::write_banner(banner); string UTMzone=""; // string tdp_filename=stringfunc::prefix(ply_filename)+"_ztrans.tdp"; string tdp_filename=stringfunc::prefix(ply_filename)+"_reg.tdp"; // tdpfunc::write_xyz_data(tdp_filename,&X_reduced,&Y_reduced,&Z_reduced); tdpfunc::write_xyz_data( tdp_filename,&X_transformed,&Y_transformed,&Z_transformed); */ }
a5979169e0557a14cc8e932cfead5235a3be192d
6c22d7f75bcbb5ccb694406aa98579dc20aaa3aa
/fishparty/fishparty/home_button.xaml.h
156dc7f5941dec223f53c98b60b23bf9f1330bc4
[]
no_license
raltyinferno/fishparty
51479cc4e0b94a8bfd2858b7d955bd255869ff0c
22b45e693211322e670ee35f740754d871550009
refs/heads/master
2018-09-20T01:42:38.730912
2018-06-06T10:56:06
2018-06-06T10:56:06
118,066,261
0
0
null
null
null
null
UTF-8
C++
false
false
373
h
home_button.xaml.h
// // home_button.xaml.h // Declaration of the home_button class // #pragma once #include "home_button.g.h" namespace fishparty { [Windows::Foundation::Metadata::WebHostHidden] public ref class home_button sealed { public: home_button(); private: void navigate_home(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e); }; }
15fabe14240dde9937720935902f0bf0d18c6227
07fe910f4a2c7d14e67db40ab88a8c91d9406857
/game/mga/Parser.h
9d9bae9250c3ac6da50d8f5307e3bbd7a911374c
[]
no_license
SEDS/GAME
e6d7f7a8bb034e421842007614d306b3a6321fde
3e4621298624b9189b5b6b43ff002306fde23f08
refs/heads/master
2021-03-12T23:27:39.115003
2015-09-22T15:05:33
2015-09-22T15:05:33
20,278,561
1
0
null
null
null
null
UTF-8
C++
false
false
42,626
h
Parser.h
/* this ALWAYS GENERATED file contains the definitions for the interfaces */ /* File created by MIDL compiler version 8.00.0595 */ /* at Wed Jun 10 20:03:02 2015 */ /* Compiler settings for C:\Program Files (x86)\GME\Interfaces\Parser.idl: Oicf, W1, Zp8, env=Win32 (32b run), target_arch=X86 8.00.0595 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 __Parser_h__ #define __Parser_h__ #if defined(_MSC_VER) && (_MSC_VER >= 1020) #pragma once #endif /* Forward Declarations */ #ifndef __IMgaMetaParser_FWD_DEFINED__ #define __IMgaMetaParser_FWD_DEFINED__ typedef interface IMgaMetaParser IMgaMetaParser; #endif /* __IMgaMetaParser_FWD_DEFINED__ */ #ifndef __IMgaDumper_FWD_DEFINED__ #define __IMgaDumper_FWD_DEFINED__ typedef interface IMgaDumper IMgaDumper; #endif /* __IMgaDumper_FWD_DEFINED__ */ #ifndef __IMgaDumper2_FWD_DEFINED__ #define __IMgaDumper2_FWD_DEFINED__ typedef interface IMgaDumper2 IMgaDumper2; #endif /* __IMgaDumper2_FWD_DEFINED__ */ #ifndef __IMgaParser_FWD_DEFINED__ #define __IMgaParser_FWD_DEFINED__ typedef interface IMgaParser IMgaParser; #endif /* __IMgaParser_FWD_DEFINED__ */ #ifndef __IMgaParser2_FWD_DEFINED__ #define __IMgaParser2_FWD_DEFINED__ typedef interface IMgaParser2 IMgaParser2; #endif /* __IMgaParser2_FWD_DEFINED__ */ #ifndef __IMgaParser3_FWD_DEFINED__ #define __IMgaParser3_FWD_DEFINED__ typedef interface IMgaParser3 IMgaParser3; #endif /* __IMgaParser3_FWD_DEFINED__ */ /* header files for imported files */ #include "oaidl.h" #include "ocidl.h" #include "Mga.h" #include "MgaUtil.h" #ifdef __cplusplus extern "C"{ #endif /* interface __MIDL_itf_Parser_0000_0000 */ /* [local] */ #ifndef INTERFACE_VERSION #define INTERFACE_VERSION 0x000200E6 #endif //INTERFACE_VERSION typedef enum inserttype_enum { ADDITION = 0, MERGE = 1 } inserttype_enum; extern RPC_IF_HANDLE __MIDL_itf_Parser_0000_0000_v0_0_c_ifspec; extern RPC_IF_HANDLE __MIDL_itf_Parser_0000_0000_v0_0_s_ifspec; #ifndef __IMgaMetaParser_INTERFACE_DEFINED__ #define __IMgaMetaParser_INTERFACE_DEFINED__ /* interface IMgaMetaParser */ /* [unique][helpstring][dual][uuid][object] */ EXTERN_C const IID IID_IMgaMetaParser; #if defined(__cplusplus) && !defined(CINTERFACE) MIDL_INTERFACE("70C41B24-E3CE-11D3-B37A-005004D38590") IMgaMetaParser : public IDispatch { public: virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE Parse( /* [in] */ BSTR xmlfile, /* [in] */ BSTR connection) = 0; }; #else /* C style interface */ typedef struct IMgaMetaParserVtbl { BEGIN_INTERFACE HRESULT ( STDMETHODCALLTYPE *QueryInterface )( IMgaMetaParser * This, /* [in] */ REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); ULONG ( STDMETHODCALLTYPE *AddRef )( IMgaMetaParser * This); ULONG ( STDMETHODCALLTYPE *Release )( IMgaMetaParser * This); HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( IMgaMetaParser * This, /* [out] */ UINT *pctinfo); HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( IMgaMetaParser * This, /* [in] */ UINT iTInfo, /* [in] */ LCID lcid, /* [out] */ ITypeInfo **ppTInfo); HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( IMgaMetaParser * This, /* [in] */ REFIID riid, /* [size_is][in] */ LPOLESTR *rgszNames, /* [range][in] */ UINT cNames, /* [in] */ LCID lcid, /* [size_is][out] */ DISPID *rgDispId); /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( IMgaMetaParser * This, /* [annotation][in] */ _In_ DISPID dispIdMember, /* [annotation][in] */ _In_ REFIID riid, /* [annotation][in] */ _In_ LCID lcid, /* [annotation][in] */ _In_ WORD wFlags, /* [annotation][out][in] */ _In_ DISPPARAMS *pDispParams, /* [annotation][out] */ _Out_opt_ VARIANT *pVarResult, /* [annotation][out] */ _Out_opt_ EXCEPINFO *pExcepInfo, /* [annotation][out] */ _Out_opt_ UINT *puArgErr); /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *Parse )( IMgaMetaParser * This, /* [in] */ BSTR xmlfile, /* [in] */ BSTR connection); END_INTERFACE } IMgaMetaParserVtbl; interface IMgaMetaParser { CONST_VTBL struct IMgaMetaParserVtbl *lpVtbl; }; #ifdef COBJMACROS #define IMgaMetaParser_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define IMgaMetaParser_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define IMgaMetaParser_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define IMgaMetaParser_GetTypeInfoCount(This,pctinfo) \ ( (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) ) #define IMgaMetaParser_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ ( (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) ) #define IMgaMetaParser_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ ( (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) ) #define IMgaMetaParser_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ ( (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) ) #define IMgaMetaParser_Parse(This,xmlfile,connection) \ ( (This)->lpVtbl -> Parse(This,xmlfile,connection) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* __IMgaMetaParser_INTERFACE_DEFINED__ */ #ifndef __IMgaDumper_INTERFACE_DEFINED__ #define __IMgaDumper_INTERFACE_DEFINED__ /* interface IMgaDumper */ /* [unique][helpstring][dual][uuid][object] */ EXTERN_C const IID IID_IMgaDumper; #if defined(__cplusplus) && !defined(CINTERFACE) MIDL_INTERFACE("A5D0DAE6-16EE-11D4-B3C2-005004D38590") IMgaDumper : public IDispatch { public: virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE DumpProject( /* [in] */ IMgaProject *p, /* [in] */ BSTR xmlfile) = 0; virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE DumpFCOs( /* [in] */ IMgaProject *proj, /* [in] */ IMgaFCOs *p, /* [in] */ IMgaFolders *f, /* [in] */ IMgaRegNodes *r, /* [in] */ BSTR xmlfile) = 0; virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE DumpClos( /* [in] */ IMgaFCOs *fco, /* [in] */ IMgaFolders *fld, /* [in] */ BSTR xmlfile, /* [in] */ int libr_stub) = 0; virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE DumpClosR( /* [in] */ IMgaFCOs *fco, /* [in] */ IMgaFolders *fld, /* [in] */ BSTR xmlfile, /* [in] */ IMgaFCOs *topfco, /* [in] */ IMgaFolders *topfld, /* [in] */ int options, /* [in] */ BSTR abspath, /* [in] */ BSTR acceptingkinds) = 0; virtual /* [helpstring][propput] */ HRESULT STDMETHODCALLTYPE put_FormatVersion( /* [in] */ long p) = 0; }; #else /* C style interface */ typedef struct IMgaDumperVtbl { BEGIN_INTERFACE HRESULT ( STDMETHODCALLTYPE *QueryInterface )( IMgaDumper * This, /* [in] */ REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); ULONG ( STDMETHODCALLTYPE *AddRef )( IMgaDumper * This); ULONG ( STDMETHODCALLTYPE *Release )( IMgaDumper * This); HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( IMgaDumper * This, /* [out] */ UINT *pctinfo); HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( IMgaDumper * This, /* [in] */ UINT iTInfo, /* [in] */ LCID lcid, /* [out] */ ITypeInfo **ppTInfo); HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( IMgaDumper * This, /* [in] */ REFIID riid, /* [size_is][in] */ LPOLESTR *rgszNames, /* [range][in] */ UINT cNames, /* [in] */ LCID lcid, /* [size_is][out] */ DISPID *rgDispId); /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( IMgaDumper * This, /* [annotation][in] */ _In_ DISPID dispIdMember, /* [annotation][in] */ _In_ REFIID riid, /* [annotation][in] */ _In_ LCID lcid, /* [annotation][in] */ _In_ WORD wFlags, /* [annotation][out][in] */ _In_ DISPPARAMS *pDispParams, /* [annotation][out] */ _Out_opt_ VARIANT *pVarResult, /* [annotation][out] */ _Out_opt_ EXCEPINFO *pExcepInfo, /* [annotation][out] */ _Out_opt_ UINT *puArgErr); /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *DumpProject )( IMgaDumper * This, /* [in] */ IMgaProject *p, /* [in] */ BSTR xmlfile); /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *DumpFCOs )( IMgaDumper * This, /* [in] */ IMgaProject *proj, /* [in] */ IMgaFCOs *p, /* [in] */ IMgaFolders *f, /* [in] */ IMgaRegNodes *r, /* [in] */ BSTR xmlfile); /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *DumpClos )( IMgaDumper * This, /* [in] */ IMgaFCOs *fco, /* [in] */ IMgaFolders *fld, /* [in] */ BSTR xmlfile, /* [in] */ int libr_stub); /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *DumpClosR )( IMgaDumper * This, /* [in] */ IMgaFCOs *fco, /* [in] */ IMgaFolders *fld, /* [in] */ BSTR xmlfile, /* [in] */ IMgaFCOs *topfco, /* [in] */ IMgaFolders *topfld, /* [in] */ int options, /* [in] */ BSTR abspath, /* [in] */ BSTR acceptingkinds); /* [helpstring][propput] */ HRESULT ( STDMETHODCALLTYPE *put_FormatVersion )( IMgaDumper * This, /* [in] */ long p); END_INTERFACE } IMgaDumperVtbl; interface IMgaDumper { CONST_VTBL struct IMgaDumperVtbl *lpVtbl; }; #ifdef COBJMACROS #define IMgaDumper_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define IMgaDumper_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define IMgaDumper_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define IMgaDumper_GetTypeInfoCount(This,pctinfo) \ ( (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) ) #define IMgaDumper_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ ( (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) ) #define IMgaDumper_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ ( (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) ) #define IMgaDumper_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ ( (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) ) #define IMgaDumper_DumpProject(This,p,xmlfile) \ ( (This)->lpVtbl -> DumpProject(This,p,xmlfile) ) #define IMgaDumper_DumpFCOs(This,proj,p,f,r,xmlfile) \ ( (This)->lpVtbl -> DumpFCOs(This,proj,p,f,r,xmlfile) ) #define IMgaDumper_DumpClos(This,fco,fld,xmlfile,libr_stub) \ ( (This)->lpVtbl -> DumpClos(This,fco,fld,xmlfile,libr_stub) ) #define IMgaDumper_DumpClosR(This,fco,fld,xmlfile,topfco,topfld,options,abspath,acceptingkinds) \ ( (This)->lpVtbl -> DumpClosR(This,fco,fld,xmlfile,topfco,topfld,options,abspath,acceptingkinds) ) #define IMgaDumper_put_FormatVersion(This,p) \ ( (This)->lpVtbl -> put_FormatVersion(This,p) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* __IMgaDumper_INTERFACE_DEFINED__ */ #ifndef __IMgaDumper2_INTERFACE_DEFINED__ #define __IMgaDumper2_INTERFACE_DEFINED__ /* interface IMgaDumper2 */ /* [unique][helpstring][dual][uuid][object] */ EXTERN_C const IID IID_IMgaDumper2; #if defined(__cplusplus) && !defined(CINTERFACE) MIDL_INTERFACE("3813768B-5A4C-477D-BCD5-1776089948EC") IMgaDumper2 : public IMgaDumper { public: virtual HRESULT STDMETHODCALLTYPE DumpProject2( /* [in] */ IMgaProject *p, /* [in] */ BSTR xmlfile, ULONGLONG hwndParent) = 0; virtual HRESULT STDMETHODCALLTYPE DumpFCOs2( /* [in] */ IMgaProject *proj, /* [in] */ IMgaFCOs *p, /* [in] */ IMgaFolders *f, /* [in] */ IMgaRegNodes *r, /* [in] */ BSTR xmlfile, ULONGLONG hwndParent) = 0; }; #else /* C style interface */ typedef struct IMgaDumper2Vtbl { BEGIN_INTERFACE HRESULT ( STDMETHODCALLTYPE *QueryInterface )( IMgaDumper2 * This, /* [in] */ REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); ULONG ( STDMETHODCALLTYPE *AddRef )( IMgaDumper2 * This); ULONG ( STDMETHODCALLTYPE *Release )( IMgaDumper2 * This); HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( IMgaDumper2 * This, /* [out] */ UINT *pctinfo); HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( IMgaDumper2 * This, /* [in] */ UINT iTInfo, /* [in] */ LCID lcid, /* [out] */ ITypeInfo **ppTInfo); HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( IMgaDumper2 * This, /* [in] */ REFIID riid, /* [size_is][in] */ LPOLESTR *rgszNames, /* [range][in] */ UINT cNames, /* [in] */ LCID lcid, /* [size_is][out] */ DISPID *rgDispId); /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( IMgaDumper2 * This, /* [annotation][in] */ _In_ DISPID dispIdMember, /* [annotation][in] */ _In_ REFIID riid, /* [annotation][in] */ _In_ LCID lcid, /* [annotation][in] */ _In_ WORD wFlags, /* [annotation][out][in] */ _In_ DISPPARAMS *pDispParams, /* [annotation][out] */ _Out_opt_ VARIANT *pVarResult, /* [annotation][out] */ _Out_opt_ EXCEPINFO *pExcepInfo, /* [annotation][out] */ _Out_opt_ UINT *puArgErr); /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *DumpProject )( IMgaDumper2 * This, /* [in] */ IMgaProject *p, /* [in] */ BSTR xmlfile); /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *DumpFCOs )( IMgaDumper2 * This, /* [in] */ IMgaProject *proj, /* [in] */ IMgaFCOs *p, /* [in] */ IMgaFolders *f, /* [in] */ IMgaRegNodes *r, /* [in] */ BSTR xmlfile); /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *DumpClos )( IMgaDumper2 * This, /* [in] */ IMgaFCOs *fco, /* [in] */ IMgaFolders *fld, /* [in] */ BSTR xmlfile, /* [in] */ int libr_stub); /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *DumpClosR )( IMgaDumper2 * This, /* [in] */ IMgaFCOs *fco, /* [in] */ IMgaFolders *fld, /* [in] */ BSTR xmlfile, /* [in] */ IMgaFCOs *topfco, /* [in] */ IMgaFolders *topfld, /* [in] */ int options, /* [in] */ BSTR abspath, /* [in] */ BSTR acceptingkinds); /* [helpstring][propput] */ HRESULT ( STDMETHODCALLTYPE *put_FormatVersion )( IMgaDumper2 * This, /* [in] */ long p); HRESULT ( STDMETHODCALLTYPE *DumpProject2 )( IMgaDumper2 * This, /* [in] */ IMgaProject *p, /* [in] */ BSTR xmlfile, ULONGLONG hwndParent); HRESULT ( STDMETHODCALLTYPE *DumpFCOs2 )( IMgaDumper2 * This, /* [in] */ IMgaProject *proj, /* [in] */ IMgaFCOs *p, /* [in] */ IMgaFolders *f, /* [in] */ IMgaRegNodes *r, /* [in] */ BSTR xmlfile, ULONGLONG hwndParent); END_INTERFACE } IMgaDumper2Vtbl; interface IMgaDumper2 { CONST_VTBL struct IMgaDumper2Vtbl *lpVtbl; }; #ifdef COBJMACROS #define IMgaDumper2_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define IMgaDumper2_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define IMgaDumper2_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define IMgaDumper2_GetTypeInfoCount(This,pctinfo) \ ( (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) ) #define IMgaDumper2_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ ( (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) ) #define IMgaDumper2_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ ( (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) ) #define IMgaDumper2_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ ( (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) ) #define IMgaDumper2_DumpProject(This,p,xmlfile) \ ( (This)->lpVtbl -> DumpProject(This,p,xmlfile) ) #define IMgaDumper2_DumpFCOs(This,proj,p,f,r,xmlfile) \ ( (This)->lpVtbl -> DumpFCOs(This,proj,p,f,r,xmlfile) ) #define IMgaDumper2_DumpClos(This,fco,fld,xmlfile,libr_stub) \ ( (This)->lpVtbl -> DumpClos(This,fco,fld,xmlfile,libr_stub) ) #define IMgaDumper2_DumpClosR(This,fco,fld,xmlfile,topfco,topfld,options,abspath,acceptingkinds) \ ( (This)->lpVtbl -> DumpClosR(This,fco,fld,xmlfile,topfco,topfld,options,abspath,acceptingkinds) ) #define IMgaDumper2_put_FormatVersion(This,p) \ ( (This)->lpVtbl -> put_FormatVersion(This,p) ) #define IMgaDumper2_DumpProject2(This,p,xmlfile,hwndParent) \ ( (This)->lpVtbl -> DumpProject2(This,p,xmlfile,hwndParent) ) #define IMgaDumper2_DumpFCOs2(This,proj,p,f,r,xmlfile,hwndParent) \ ( (This)->lpVtbl -> DumpFCOs2(This,proj,p,f,r,xmlfile,hwndParent) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* __IMgaDumper2_INTERFACE_DEFINED__ */ #ifndef __IMgaParser_INTERFACE_DEFINED__ #define __IMgaParser_INTERFACE_DEFINED__ /* interface IMgaParser */ /* [unique][helpstring][dual][uuid][object] */ EXTERN_C const IID IID_IMgaParser; #if defined(__cplusplus) && !defined(CINTERFACE) MIDL_INTERFACE("94D6FB53-1F7C-11D4-B3D0-005004D38590") IMgaParser : public IDispatch { public: virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetXMLInfo( /* [in] */ BSTR xmlfile, /* [out] */ BSTR *Paradigm, /* [out] */ BSTR *parversion, /* [out] */ VARIANT *parguid, /* [out] */ BSTR *basename, /* [out] */ BSTR *ver) = 0; virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE ParseProject( /* [in] */ IMgaProject *p, /* [in] */ BSTR xmlfile) = 0; virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE ParseFCOs( /* [in] */ IMgaObject *here, /* [in] */ BSTR xmlfile) = 0; virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetClipXMLInfo( /* [in] */ BSTR xmlfile, /* [in] */ IMgaObject *Target, /* [out] */ VARIANT_BOOL *parguid, /* [out] */ BSTR *acckind, /* [out] */ BSTR *ver) = 0; virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE ParseClos1( /* [in] */ IMgaObject *here, /* [in] */ BSTR xmlfile) = 0; virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE ParseClos4( /* [in] */ IMgaObject *here, /* [in] */ BSTR xmlfile, /* [in] */ int options) = 0; }; #else /* C style interface */ typedef struct IMgaParserVtbl { BEGIN_INTERFACE HRESULT ( STDMETHODCALLTYPE *QueryInterface )( IMgaParser * This, /* [in] */ REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); ULONG ( STDMETHODCALLTYPE *AddRef )( IMgaParser * This); ULONG ( STDMETHODCALLTYPE *Release )( IMgaParser * This); HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( IMgaParser * This, /* [out] */ UINT *pctinfo); HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( IMgaParser * This, /* [in] */ UINT iTInfo, /* [in] */ LCID lcid, /* [out] */ ITypeInfo **ppTInfo); HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( IMgaParser * This, /* [in] */ REFIID riid, /* [size_is][in] */ LPOLESTR *rgszNames, /* [range][in] */ UINT cNames, /* [in] */ LCID lcid, /* [size_is][out] */ DISPID *rgDispId); /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( IMgaParser * This, /* [annotation][in] */ _In_ DISPID dispIdMember, /* [annotation][in] */ _In_ REFIID riid, /* [annotation][in] */ _In_ LCID lcid, /* [annotation][in] */ _In_ WORD wFlags, /* [annotation][out][in] */ _In_ DISPPARAMS *pDispParams, /* [annotation][out] */ _Out_opt_ VARIANT *pVarResult, /* [annotation][out] */ _Out_opt_ EXCEPINFO *pExcepInfo, /* [annotation][out] */ _Out_opt_ UINT *puArgErr); /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetXMLInfo )( IMgaParser * This, /* [in] */ BSTR xmlfile, /* [out] */ BSTR *Paradigm, /* [out] */ BSTR *parversion, /* [out] */ VARIANT *parguid, /* [out] */ BSTR *basename, /* [out] */ BSTR *ver); /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *ParseProject )( IMgaParser * This, /* [in] */ IMgaProject *p, /* [in] */ BSTR xmlfile); /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *ParseFCOs )( IMgaParser * This, /* [in] */ IMgaObject *here, /* [in] */ BSTR xmlfile); /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetClipXMLInfo )( IMgaParser * This, /* [in] */ BSTR xmlfile, /* [in] */ IMgaObject *Target, /* [out] */ VARIANT_BOOL *parguid, /* [out] */ BSTR *acckind, /* [out] */ BSTR *ver); /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *ParseClos1 )( IMgaParser * This, /* [in] */ IMgaObject *here, /* [in] */ BSTR xmlfile); /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *ParseClos4 )( IMgaParser * This, /* [in] */ IMgaObject *here, /* [in] */ BSTR xmlfile, /* [in] */ int options); END_INTERFACE } IMgaParserVtbl; interface IMgaParser { CONST_VTBL struct IMgaParserVtbl *lpVtbl; }; #ifdef COBJMACROS #define IMgaParser_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define IMgaParser_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define IMgaParser_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define IMgaParser_GetTypeInfoCount(This,pctinfo) \ ( (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) ) #define IMgaParser_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ ( (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) ) #define IMgaParser_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ ( (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) ) #define IMgaParser_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ ( (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) ) #define IMgaParser_GetXMLInfo(This,xmlfile,Paradigm,parversion,parguid,basename,ver) \ ( (This)->lpVtbl -> GetXMLInfo(This,xmlfile,Paradigm,parversion,parguid,basename,ver) ) #define IMgaParser_ParseProject(This,p,xmlfile) \ ( (This)->lpVtbl -> ParseProject(This,p,xmlfile) ) #define IMgaParser_ParseFCOs(This,here,xmlfile) \ ( (This)->lpVtbl -> ParseFCOs(This,here,xmlfile) ) #define IMgaParser_GetClipXMLInfo(This,xmlfile,Target,parguid,acckind,ver) \ ( (This)->lpVtbl -> GetClipXMLInfo(This,xmlfile,Target,parguid,acckind,ver) ) #define IMgaParser_ParseClos1(This,here,xmlfile) \ ( (This)->lpVtbl -> ParseClos1(This,here,xmlfile) ) #define IMgaParser_ParseClos4(This,here,xmlfile,options) \ ( (This)->lpVtbl -> ParseClos4(This,here,xmlfile,options) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* __IMgaParser_INTERFACE_DEFINED__ */ #ifndef __IMgaParser2_INTERFACE_DEFINED__ #define __IMgaParser2_INTERFACE_DEFINED__ /* interface IMgaParser2 */ /* [unique][helpstring][dual][uuid][object] */ EXTERN_C const IID IID_IMgaParser2; #if defined(__cplusplus) && !defined(CINTERFACE) MIDL_INTERFACE("E39BEA37-384D-423B-ADDF-2BB13550F577") IMgaParser2 : public IMgaParser { public: virtual HRESULT STDMETHODCALLTYPE ParseProject2( /* [in] */ IMgaProject *p, /* [in] */ BSTR xmlfile, ULONGLONG hwndParent) = 0; virtual HRESULT STDMETHODCALLTYPE ParseFCOs2( /* [in] */ IMgaObject *here, /* [in] */ BSTR xmlfile, ULONGLONG hwndParent) = 0; virtual HRESULT STDMETHODCALLTYPE GetXMLParadigm( /* [in] */ BSTR xmlfile, /* [out] */ BSTR *Paradigm) = 0; }; #else /* C style interface */ typedef struct IMgaParser2Vtbl { BEGIN_INTERFACE HRESULT ( STDMETHODCALLTYPE *QueryInterface )( IMgaParser2 * This, /* [in] */ REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); ULONG ( STDMETHODCALLTYPE *AddRef )( IMgaParser2 * This); ULONG ( STDMETHODCALLTYPE *Release )( IMgaParser2 * This); HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( IMgaParser2 * This, /* [out] */ UINT *pctinfo); HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( IMgaParser2 * This, /* [in] */ UINT iTInfo, /* [in] */ LCID lcid, /* [out] */ ITypeInfo **ppTInfo); HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( IMgaParser2 * This, /* [in] */ REFIID riid, /* [size_is][in] */ LPOLESTR *rgszNames, /* [range][in] */ UINT cNames, /* [in] */ LCID lcid, /* [size_is][out] */ DISPID *rgDispId); /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( IMgaParser2 * This, /* [annotation][in] */ _In_ DISPID dispIdMember, /* [annotation][in] */ _In_ REFIID riid, /* [annotation][in] */ _In_ LCID lcid, /* [annotation][in] */ _In_ WORD wFlags, /* [annotation][out][in] */ _In_ DISPPARAMS *pDispParams, /* [annotation][out] */ _Out_opt_ VARIANT *pVarResult, /* [annotation][out] */ _Out_opt_ EXCEPINFO *pExcepInfo, /* [annotation][out] */ _Out_opt_ UINT *puArgErr); /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetXMLInfo )( IMgaParser2 * This, /* [in] */ BSTR xmlfile, /* [out] */ BSTR *Paradigm, /* [out] */ BSTR *parversion, /* [out] */ VARIANT *parguid, /* [out] */ BSTR *basename, /* [out] */ BSTR *ver); /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *ParseProject )( IMgaParser2 * This, /* [in] */ IMgaProject *p, /* [in] */ BSTR xmlfile); /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *ParseFCOs )( IMgaParser2 * This, /* [in] */ IMgaObject *here, /* [in] */ BSTR xmlfile); /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetClipXMLInfo )( IMgaParser2 * This, /* [in] */ BSTR xmlfile, /* [in] */ IMgaObject *Target, /* [out] */ VARIANT_BOOL *parguid, /* [out] */ BSTR *acckind, /* [out] */ BSTR *ver); /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *ParseClos1 )( IMgaParser2 * This, /* [in] */ IMgaObject *here, /* [in] */ BSTR xmlfile); /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *ParseClos4 )( IMgaParser2 * This, /* [in] */ IMgaObject *here, /* [in] */ BSTR xmlfile, /* [in] */ int options); HRESULT ( STDMETHODCALLTYPE *ParseProject2 )( IMgaParser2 * This, /* [in] */ IMgaProject *p, /* [in] */ BSTR xmlfile, ULONGLONG hwndParent); HRESULT ( STDMETHODCALLTYPE *ParseFCOs2 )( IMgaParser2 * This, /* [in] */ IMgaObject *here, /* [in] */ BSTR xmlfile, ULONGLONG hwndParent); HRESULT ( STDMETHODCALLTYPE *GetXMLParadigm )( IMgaParser2 * This, /* [in] */ BSTR xmlfile, /* [out] */ BSTR *Paradigm); END_INTERFACE } IMgaParser2Vtbl; interface IMgaParser2 { CONST_VTBL struct IMgaParser2Vtbl *lpVtbl; }; #ifdef COBJMACROS #define IMgaParser2_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define IMgaParser2_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define IMgaParser2_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define IMgaParser2_GetTypeInfoCount(This,pctinfo) \ ( (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) ) #define IMgaParser2_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ ( (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) ) #define IMgaParser2_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ ( (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) ) #define IMgaParser2_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ ( (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) ) #define IMgaParser2_GetXMLInfo(This,xmlfile,Paradigm,parversion,parguid,basename,ver) \ ( (This)->lpVtbl -> GetXMLInfo(This,xmlfile,Paradigm,parversion,parguid,basename,ver) ) #define IMgaParser2_ParseProject(This,p,xmlfile) \ ( (This)->lpVtbl -> ParseProject(This,p,xmlfile) ) #define IMgaParser2_ParseFCOs(This,here,xmlfile) \ ( (This)->lpVtbl -> ParseFCOs(This,here,xmlfile) ) #define IMgaParser2_GetClipXMLInfo(This,xmlfile,Target,parguid,acckind,ver) \ ( (This)->lpVtbl -> GetClipXMLInfo(This,xmlfile,Target,parguid,acckind,ver) ) #define IMgaParser2_ParseClos1(This,here,xmlfile) \ ( (This)->lpVtbl -> ParseClos1(This,here,xmlfile) ) #define IMgaParser2_ParseClos4(This,here,xmlfile,options) \ ( (This)->lpVtbl -> ParseClos4(This,here,xmlfile,options) ) #define IMgaParser2_ParseProject2(This,p,xmlfile,hwndParent) \ ( (This)->lpVtbl -> ParseProject2(This,p,xmlfile,hwndParent) ) #define IMgaParser2_ParseFCOs2(This,here,xmlfile,hwndParent) \ ( (This)->lpVtbl -> ParseFCOs2(This,here,xmlfile,hwndParent) ) #define IMgaParser2_GetXMLParadigm(This,xmlfile,Paradigm) \ ( (This)->lpVtbl -> GetXMLParadigm(This,xmlfile,Paradigm) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* __IMgaParser2_INTERFACE_DEFINED__ */ #ifndef __IMgaParser3_INTERFACE_DEFINED__ #define __IMgaParser3_INTERFACE_DEFINED__ /* interface IMgaParser3 */ /* [unique][helpstring][dual][uuid][object] */ EXTERN_C const IID IID_IMgaParser3; #if defined(__cplusplus) && !defined(CINTERFACE) MIDL_INTERFACE("5CAB528B-474B-4C52-BE40-74FF29AFBB58") IMgaParser3 : public IMgaParser2 { public: virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Resolver( /* [retval][out] */ IMgaResolver **MgaResolver) = 0; virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_Resolver( /* [in] */ IMgaResolver *MgaResolver) = 0; }; #else /* C style interface */ typedef struct IMgaParser3Vtbl { BEGIN_INTERFACE HRESULT ( STDMETHODCALLTYPE *QueryInterface )( IMgaParser3 * This, /* [in] */ REFIID riid, /* [annotation][iid_is][out] */ _COM_Outptr_ void **ppvObject); ULONG ( STDMETHODCALLTYPE *AddRef )( IMgaParser3 * This); ULONG ( STDMETHODCALLTYPE *Release )( IMgaParser3 * This); HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )( IMgaParser3 * This, /* [out] */ UINT *pctinfo); HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )( IMgaParser3 * This, /* [in] */ UINT iTInfo, /* [in] */ LCID lcid, /* [out] */ ITypeInfo **ppTInfo); HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )( IMgaParser3 * This, /* [in] */ REFIID riid, /* [size_is][in] */ LPOLESTR *rgszNames, /* [range][in] */ UINT cNames, /* [in] */ LCID lcid, /* [size_is][out] */ DISPID *rgDispId); /* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )( IMgaParser3 * This, /* [annotation][in] */ _In_ DISPID dispIdMember, /* [annotation][in] */ _In_ REFIID riid, /* [annotation][in] */ _In_ LCID lcid, /* [annotation][in] */ _In_ WORD wFlags, /* [annotation][out][in] */ _In_ DISPPARAMS *pDispParams, /* [annotation][out] */ _Out_opt_ VARIANT *pVarResult, /* [annotation][out] */ _Out_opt_ EXCEPINFO *pExcepInfo, /* [annotation][out] */ _Out_opt_ UINT *puArgErr); /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetXMLInfo )( IMgaParser3 * This, /* [in] */ BSTR xmlfile, /* [out] */ BSTR *Paradigm, /* [out] */ BSTR *parversion, /* [out] */ VARIANT *parguid, /* [out] */ BSTR *basename, /* [out] */ BSTR *ver); /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *ParseProject )( IMgaParser3 * This, /* [in] */ IMgaProject *p, /* [in] */ BSTR xmlfile); /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *ParseFCOs )( IMgaParser3 * This, /* [in] */ IMgaObject *here, /* [in] */ BSTR xmlfile); /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *GetClipXMLInfo )( IMgaParser3 * This, /* [in] */ BSTR xmlfile, /* [in] */ IMgaObject *Target, /* [out] */ VARIANT_BOOL *parguid, /* [out] */ BSTR *acckind, /* [out] */ BSTR *ver); /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *ParseClos1 )( IMgaParser3 * This, /* [in] */ IMgaObject *here, /* [in] */ BSTR xmlfile); /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE *ParseClos4 )( IMgaParser3 * This, /* [in] */ IMgaObject *here, /* [in] */ BSTR xmlfile, /* [in] */ int options); HRESULT ( STDMETHODCALLTYPE *ParseProject2 )( IMgaParser3 * This, /* [in] */ IMgaProject *p, /* [in] */ BSTR xmlfile, ULONGLONG hwndParent); HRESULT ( STDMETHODCALLTYPE *ParseFCOs2 )( IMgaParser3 * This, /* [in] */ IMgaObject *here, /* [in] */ BSTR xmlfile, ULONGLONG hwndParent); HRESULT ( STDMETHODCALLTYPE *GetXMLParadigm )( IMgaParser3 * This, /* [in] */ BSTR xmlfile, /* [out] */ BSTR *Paradigm); /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Resolver )( IMgaParser3 * This, /* [retval][out] */ IMgaResolver **MgaResolver); /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_Resolver )( IMgaParser3 * This, /* [in] */ IMgaResolver *MgaResolver); END_INTERFACE } IMgaParser3Vtbl; interface IMgaParser3 { CONST_VTBL struct IMgaParser3Vtbl *lpVtbl; }; #ifdef COBJMACROS #define IMgaParser3_QueryInterface(This,riid,ppvObject) \ ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) #define IMgaParser3_AddRef(This) \ ( (This)->lpVtbl -> AddRef(This) ) #define IMgaParser3_Release(This) \ ( (This)->lpVtbl -> Release(This) ) #define IMgaParser3_GetTypeInfoCount(This,pctinfo) \ ( (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) ) #define IMgaParser3_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ ( (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) ) #define IMgaParser3_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ ( (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) ) #define IMgaParser3_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ ( (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) ) #define IMgaParser3_GetXMLInfo(This,xmlfile,Paradigm,parversion,parguid,basename,ver) \ ( (This)->lpVtbl -> GetXMLInfo(This,xmlfile,Paradigm,parversion,parguid,basename,ver) ) #define IMgaParser3_ParseProject(This,p,xmlfile) \ ( (This)->lpVtbl -> ParseProject(This,p,xmlfile) ) #define IMgaParser3_ParseFCOs(This,here,xmlfile) \ ( (This)->lpVtbl -> ParseFCOs(This,here,xmlfile) ) #define IMgaParser3_GetClipXMLInfo(This,xmlfile,Target,parguid,acckind,ver) \ ( (This)->lpVtbl -> GetClipXMLInfo(This,xmlfile,Target,parguid,acckind,ver) ) #define IMgaParser3_ParseClos1(This,here,xmlfile) \ ( (This)->lpVtbl -> ParseClos1(This,here,xmlfile) ) #define IMgaParser3_ParseClos4(This,here,xmlfile,options) \ ( (This)->lpVtbl -> ParseClos4(This,here,xmlfile,options) ) #define IMgaParser3_ParseProject2(This,p,xmlfile,hwndParent) \ ( (This)->lpVtbl -> ParseProject2(This,p,xmlfile,hwndParent) ) #define IMgaParser3_ParseFCOs2(This,here,xmlfile,hwndParent) \ ( (This)->lpVtbl -> ParseFCOs2(This,here,xmlfile,hwndParent) ) #define IMgaParser3_GetXMLParadigm(This,xmlfile,Paradigm) \ ( (This)->lpVtbl -> GetXMLParadigm(This,xmlfile,Paradigm) ) #define IMgaParser3_get_Resolver(This,MgaResolver) \ ( (This)->lpVtbl -> get_Resolver(This,MgaResolver) ) #define IMgaParser3_put_Resolver(This,MgaResolver) \ ( (This)->lpVtbl -> put_Resolver(This,MgaResolver) ) #endif /* COBJMACROS */ #endif /* C style interface */ #endif /* __IMgaParser3_INTERFACE_DEFINED__ */ /* Additional Prototypes for ALL interfaces */ unsigned long __RPC_USER BSTR_UserSize( unsigned long *, unsigned long , BSTR * ); unsigned char * __RPC_USER BSTR_UserMarshal( unsigned long *, unsigned char *, BSTR * ); unsigned char * __RPC_USER BSTR_UserUnmarshal(unsigned long *, unsigned char *, BSTR * ); void __RPC_USER BSTR_UserFree( unsigned long *, BSTR * ); unsigned long __RPC_USER VARIANT_UserSize( unsigned long *, unsigned long , VARIANT * ); unsigned char * __RPC_USER VARIANT_UserMarshal( unsigned long *, unsigned char *, VARIANT * ); unsigned char * __RPC_USER VARIANT_UserUnmarshal(unsigned long *, unsigned char *, VARIANT * ); void __RPC_USER VARIANT_UserFree( unsigned long *, VARIANT * ); /* end of Additional Prototypes */ #ifdef __cplusplus } #endif #endif
4b2925ed52d0c14f4f2f694939203fed4336cc73
2493f74eeab056a62c32b8b3bcb128d581568f17
/include/Parser.h
b629111f5f865d2034645262530391e9201f7267
[ "MIT" ]
permissive
mfl28/HackAssembler
eb1a7fbf9526c123a2a21c73f5ce8c7e026c4590
0655b29bdd45bc19da223c67dbf9d3b9fe8a64fe
refs/heads/master
2021-07-09T06:30:34.353204
2020-08-29T17:06:22
2020-08-29T17:06:22
184,457,374
1
2
null
null
null
null
UTF-8
C++
false
false
3,764
h
Parser.h
#pragma once #include <istream> #include <string> #include <regex> namespace HackAssembler { class Parser { public: /** * \brief Contains the different command-types: * A (address-command): "@Xxx", where Xxx is either a symbol or a decimal number * C (compute-command): "dest=comp;jump", where dest=destination, comp=computation, * jump=jump-instruction (either dest or jump may be empty) * L (label-(pseudo)-command): "(Xxx)", where Xxx is the label's name */ enum class CommandType { A, C, L }; /** * \brief Creates a new parser for a provided input-stream and gets ready to parse the * first command (if one exists). * \param inputStream The stream to be parsed */ explicit Parser(std::istream& inputStream) : inputStream_{inputStream} { updateNextCommand(); } /** * \brief Checks if there exists another command in input-stream. * \return True if another command exists, otherwise false. */ bool hasMoreCommands() const noexcept { return !nextCommand_.empty(); } /** * \brief Sets the current command to the next command encountered * in the input-stream. Must only be called if hasMoreCommands() * returns true. */ void advance(); /** * \brief Resets the parser to the beginning of the input-stream. * Switches on syntax-checking. */ void reset(); /** * \brief Gets the type of the current command. * \return A-, C-, or L-command-type */ CommandType commandType() const; /** * \brief Gets the symbol or decimal Xxx of the current command @Xxx or (Xxx). * Must only be called when the current command-type is A or L * \return symbol or decimal as a string */ std::string symbol() const; /** * \brief Gets the destination-part of a command with type C, so this function must only * be called if the current command is a C-command. * \return one of 8 possible dest-mnemonics defined in the Hack assembly language */ std::string dest() const; /** * \brief Gets the computation-part of a command with type C, so this function must only * be called if the current command is a C-command. * \return one of 28 possible comp-mnemonics defined in the Hack assembly language */ std::string comp() const; /** * \brief Gets the jump-instruction-part of a command with type C, so this function must only * be called if the current command is a C-command. * \return one of 8 possible jump-mnemonics defined in the Hack assembly language */ std::string jump() const; /** * \brief Switches syntax-checking on or off. If switched on, the parser will throw * an exception if a syntactic error is encountered while parsing the input-stream. * Syntax-checking is turned on by default after construction. * \param value True or false */ void setSyntaxChecking(bool value) { syntaxChecking_ = value; } /** * \brief Checks if syntax-checking is currently switched on. * \return True if syntax-checking is on, false otherwise. */ bool isSyntaxChecking() const { return syntaxChecking_; } private: std::istream& inputStream_; std::string currentCommand_; std::string nextCommand_; size_t currentLineNr_{}; bool syntaxChecking_{true}; void updateNextCommand(); }; }
89d04f26af7e277d1dca27b0c7fb4712b6ba4a86
80ee6883432d059defee6508c6c24be155ff6d9f
/261_GraphValidTree/solution_1.cpp
75c1cd3ee9b4e664e1917ef38b59cc8d518f6598
[]
no_license
evelyn-plee/leetcode
2398dd6dbdb5702ea2f31ebfe45c4ad7ce3790f0
5544082d680da4c4177ca8d6da3cbed8389eadb9
refs/heads/master
2021-06-03T06:38:14.603934
2020-02-20T08:45:24
2020-02-20T08:45:24
130,520,459
1
0
null
null
null
null
UTF-8
C++
false
false
855
cpp
solution_1.cpp
#include<vector> #include<iostream> using namespace std; class Solution{ public: bool validTree(int n, vector<pair<int, int>>& edges){ vector<bool> visited(n, false); vector<vector<int>> directions(n, vector<int>()); for(auto e : edges){ directions[e.first].push_back(e.second); directions[e.second].push_back(e.first); } if(!dfs(0, -1, directions, visited)) return false; for(auto a : visited){ if(!a) return false; } return true; } bool dfs(int cur, int pre, vector<vector<int>> &dir, vector<bool> &visited){ if(visited[cur]) return false; visited[cur] = true; for(auto a : dir[cur]){ if(a != pre){ if(!dfs(a, cur, dir, visited)) return false; } } return true; } };
d21905919cad2842e394c81e317b55864ec34995
bb04a9b954c0b370ac01c31e847cb9ff0705994b
/hand_software/SendMessage.h
4203e13e04f98bf69865074a9e548cda389f27bf
[]
no_license
B50RO-B51RO-Robotic-Hand/hand_software
7424a958fc78c981ca56895d0c631208e5bf6093
0a6ba78c2ba2f210edf93cfc1b605ab50bad8438
refs/heads/main
2023-03-27T07:50:15.219832
2021-03-27T16:29:53
2021-03-27T16:29:53
335,965,987
0
0
null
null
null
null
UTF-8
C++
false
false
2,857
h
SendMessage.h
#ifndef __SEND_MESSAGE_H__ #define __SEND_MESSAGE_H__ #include "Defines.h" #define MSG_CHAR_ARRAY_START 0b10000000 #define MSG_SERVO_POSITION_START 0b00000000 #define MSG_ALL_POSITIONS 0b00001000 #define MSG_ALL_LIMITS 0b00001001 #define MSG_FORCE_RAW 0b00001010 #define MAX_SINGLE_MESSAGE_LENGTH 128 namespace Send { // Construct for accessing timestamped reading bytes typedef union TimestampedRawForceBytes { struct { uint32_t timestamp; uint16_t rawForce; } stampedReading; // 6 bytes uint8_t bytes[6]; // 6 bytes }; // Send a single byte // Note - if there is no available buffer space this method will block until the byte is sent void sendMessageByte(uint8_t msg) { while (!Serial.availableForWrite()); // Wait for write to be available (note - will block) Serial.write(msg); } // Send a String message // Strings are sent in 128-character chunks // Length of String = (first_byte - MSG_CHAR_ARRAY_START) + 1 // e.g. 0b10000100 = 0b100 + 1 = 5 characters void sendString(String str) { char* chars = str.c_str(); int len = str.length(); int ind = 0; // Split the string into multiple messages if required while (len > MAX_SINGLE_MESSAGE_LENGTH) { sendMessageByte(MSG_CHAR_ARRAY_START | (MAX_SINGLE_MESSAGE_LENGTH - 1)); len -= MAX_SINGLE_MESSAGE_LENGTH; for (int i = 0; i < MAX_SINGLE_MESSAGE_LENGTH; i++) sendMessageByte(chars[ind++]); } sendMessageByte(MSG_CHAR_ARRAY_START | (len - 1)); for (int i = 0; i < len; i++) sendMessageByte(chars[ind++]); } // Individual servo position void sendServoPosition(uint8_t servo, uint8_t pos) { sendMessageByte(MSG_SERVO_POSITION_START + servo); sendMessageByte(pos); } // All servo positions void sendAllServoPositions(uint8_t* positions) { sendMessageByte(MSG_ALL_POSITIONS); for (int i=0; i<SERVO_COUNT; i++) { sendMessageByte(positions[i]); } } // All servo limits // Limits are in order as follows: // Servo 0 min, Servo 0 max, Servo 1 min, Servo 1 max, Servo 2 min, Servo 2 max, // Servo 3 min, Servo 3 max, Servo 4 min, Servo 4 max, Servo 5 min, Servo 5 max void sendAllServoLimits(uint8_t* limits) { sendMessageByte(MSG_ALL_LIMITS); for (int i=0; i<SERVO_COUNT*2; i++) { sendMessageByte(limits[i]); } } // Send a timestamp and raw force reading void sendRawForce(uint32_t timestamp, uint16_t reading) { // Create timestamped reading object TimestampedRawForceBytes tsrfBytes = {timestamp, reading}; // Get reading bytes auto bytes = tsrfBytes.bytes; // Send command and bytes sendMessageByte(MSG_FORCE_RAW); for (int i = 0; i < sizeof(TimestampedRawForceBytes); i++) { sendMessageByte(bytes[i]); } } } #endif
f246825b82e92deb1bf1f8234f628afb5fd2dba2
e22a61a0130e51d420be827447108e425fc379c7
/Google/Expogo.cpp
3c54dea9f8c0a672e603ef2a763ddc4e6e9cfbd1
[]
no_license
arminAnderson/CodingChallenges
06acedefd1a32727bd624034c05037c56240bd43
3de27adaabbbc38446e347acfba420756e687fb2
refs/heads/master
2023-04-26T20:32:50.325981
2021-05-31T08:13:17
2021-05-31T08:13:17
280,546,295
0
0
null
null
null
null
UTF-8
C++
false
false
2,569
cpp
Expogo.cpp
#include <iostream> #include <vector> using namespace std; struct Pair { int a = 0, b = 0; string d = ""; void Print() { cout << a << "," << b << endl; } bool Equals(Pair p) { return a == p.a && b == p.b; } }; void Print(string s) { cout << s << endl; } vector<Pair> Find(vector<Pair> path, Pair target, int step = 0, int sum = 0) { vector<Pair> empty, test; path[0].a = sum; if(path.size() == 0) { return empty; } if(path[path.size() - 1].Equals(target)) { return path; } if(sum > abs(target.a) + abs(target.b)) { return empty; } if(!step) { step = 1; } else { step *= 2; } sum += step; Pair np = path[path.size() - 1]; path.push_back(np); path[path.size() - 1].a += step; path[path.size() - 1].d = "E"; empty = Find(path, target, step, sum); path[path.size() - 1].a -= step * 2; path[path.size() - 1].d = "W"; test = Find(path, target, step, sum); if(empty.size() > 0 && test.size() > 0) { if(test[0].a < empty[0].a) { empty = test; } } else if(test.size() > 0) { empty = test; } path[path.size() - 1].a += step; path[path.size() - 1].b += step; path[path.size() - 1].d = "N"; test = Find(path, target, step, sum); if(empty.size() > 0 && test.size() > 0) { if(test[0].a < empty[0].a) { empty = test; } } else if(test.size() > 0) { empty = test; } path[path.size() - 1].b -= step * 2; path[path.size() - 1].d = "S"; test = Find(path, target, step, sum); if(empty.size() > 0 && test.size() > 0) { if(test[0].a < empty[0].a) { empty = test; } } else if(test.size() > 0) { empty = test; } return empty; } void PrintResult(vector<Pair> * p) { for(int i = 0; i < p->size(); ++i) { cout << (*p)[i].d; } cout << endl; } int main() { int cases; std::cin >> cases; ++cases; for(int i = 1; i < cases; ++i) { vector<Pair> dirs; Pair target; dirs.push_back(target); cin >> target.a >> target.b; vector<Pair> r = Find(dirs, target); string ret = "POSSIBLE"; if(r.size() == 0) { ret = "IMPOSSIBLE"; } else { ret = ""; } std::cout << "Case #" << i << ": "; if(ret != "") { cout << "IMPOSSIBLE" << endl; } else { PrintResult(&r); } } return 0; }
ffc390f82ced67bdd94059918e690aa9cd02ca21
666e2ff7aa1a4bcf3592331062ce774373fe6fa6
/main/video_cafe_gui/video_cafe_output.h
bf060f05a9240ceaf573accc03f71745c8a81315
[]
no_license
asyr625/mini_sip
aeffd6e5ea1dafafa817b1137859b41351fe9580
12ea4b9a03585b5c7e5b5faeeed0a5bc6a9c19cc
refs/heads/master
2021-01-20T12:06:33.212419
2015-11-24T02:33:26
2015-11-24T02:33:26
46,761,914
0
1
null
null
null
null
UTF-8
C++
false
false
8,209
h
video_cafe_output.h
#ifndef VIDEO_CAFE_OUTPUT_H #define VIDEO_CAFE_OUTPUT_H #include "sobject.h" #include "opengl_display.h" #include "opengl_window.h" #include<list> /** Video is output is a single OpenGL window. The layout is initially a grid. The user can make a video bigger by clicking it. If clicking it when it is "full screen", then layout is changed back to a grid. Modes: +----------------+ +----------------+ +----------------+ +----------------+ +-----------------+ | A . B . C | | . | | . | | . | | o | |................| | . | | . | | . | | o | | D . E . F | -> | . | -> | . | -> | . | -> | o | ->back |................| | . | | . | | . | | o | | G . H . I | | . | | . | | . | | o | +----------------+ +................+ +----------------+ +----------------+ +-----------------+ Start: 1. grid 2. (1280/1920) percent of width (do 1280/1920 percent instead?) 3. 75 percent 4. 90 percent 5. 100 percent Local video shown when mouse moves. */ class Icon_Button { public: Icon_Button(std::string texture) : max_alpha(1.0f), texture_name(texture), /*bounds( 0.0F, 0.0F, 0.0F, 0.0F),*/ icon(NULL), n90rot(0) { } void set_position(float x1, float y1, float x2, float y2, Animation_Type animation, uint64_t ms, uint64_t cur_time) { bounds.animate(x1,y1,x2,y2, animation, ms, cur_time); } void set_max_alpha(float alpha) { max_alpha = alpha; } void draw(OpenGl_Window* window, float xtransl, float z, uint64_t cur_time) { float a = max_alpha; if (alpha) { a = alpha->get_val(cur_time); if (a<0.0001) return; } if (!icon) { icon = window->load_image(texture_name); my_assert(glGetError()==GL_NO_ERROR); } window->draw_texture(icon, bounds.get_x1(cur_time) - xtransl, bounds.get_y1(cur_time), bounds.get_x2(cur_time) - xtransl, bounds.get_y2(cur_time), z, a,n90rot); } Bounds& get_bounds() { return bounds; } void rotate90(int n90) { n90rot=n90; } void fade_in() { if (alpha) { alpha = alpha->animate(250, alpha->get_val(), max_alpha, ANIMATE_STARTSTOP); }else{ alpha = new Animate(250,0.0,max_alpha, ANIMATE_STARTSTOP); } alpha->start(); } void fade_out() { if (alpha) { alpha = alpha->animate(250, alpha->get_val(), 0.0, ANIMATE_LINEAR); } else { alpha = new Animate(0.0); } alpha->start(); } bool is_shown() { return alpha && alpha->get_val() >= 0.01; } private: float max_alpha; SRef<Animate*> alpha; std::string texture_name; Bounds bounds; struct mgl_gfx * icon; int n90rot; }; class Video_Cafe_Display: public OpenGl_Display { public: Video_Cafe_Display(std::string _callId, uint32_t _ssrc, bool _fullscreen); virtual std::string get_mem_object_type() const {return "VCafeDisplay";} virtual void draw(uint64_t cur_time); bool is_disabled() { return disabled; } void set_position(float x1, float y1, float x2, float y2, Animation_Type animation=ANIMATE_CONSTANT, uint64_t anim_ms=0, uint64_t cur_time=0); Bounds& get_bounds() { return bounds; } void set_draw_on_top(bool onTop) { draw_on_top = onTop; } bool get_draw_on_top() { return draw_on_top; } void fade_in(); void fade_out(); void show_pan_tilt_zoom(); void hide_pan_tilt_zoom(); bool consume_mouse_click(float glx, float gly, int button); void calc_displayed_window_size(); void save_actual_displayed_window_size(); virtual int get_displayed_width(); virtual int get_displayed_height(); bool get_supports_pan_tilt_zoom() { return pan_tilt_zoom_supported; } /** * @return true of layout should be updated */ bool maintenance(uint64_t timeNow); private: bool disabled; bool draw_on_top; bool pan_tilt_zoom_supported; Icon_Button pan_left_button; Icon_Button pan_right_button; Icon_Button tilt_up_button; Icon_Button tilt_down_button; int displayed_width, displayed_height; int previous_width, previous_height; uint64_t last_rtcp_app_update; }; class Video_Window_Callback: public Window_Callback { public: Video_Window_Callback(OpenGl_Window* window); enum Layout_Mode {LAYOUT_GRID, LAYOUT_ZOOM1, LAYOUT_ZOOM2, LAYOUT_ZOOM3, LAYOUT_ZOOM4}; /** * @param sx Screen x coordinate of new mouse position * @param sy Screen y coordinate of new mouse position * @param glx OpenGl x coordinate of new mouse position * @param gly OpenGl y coordinate of new mouse position */ virtual bool mouse_move(int sx, int sy, float glx, float gly); virtual bool mouse_down(int sx, int sy, float glx, float gly, int button); virtual bool mouse_up(int sx, int sy, float glx, float gly, int button); virtual bool mouse_click(int sx, int sy, float glx, float gly, int button); virtual bool mouse_double_click(int sx, int sy, float glx, float gly, int button); virtual bool mouse_drag_move(int from_sx, int from_sy, float from_glx, float from_gly, int cur_sx, int cur_sy, float cur_glx, float cur_gly, int button, int delta_sx, int delta_sy, float delta_glx, float delta_gly); virtual bool mouse_drag_release(int from_sx, int from_sy, float from_glx, float from_gly, int cur_sx, int cur_sy, float cur_glx, float cur_gly, int button); virtual bool supports_touch() { return false; } virtual void touch(STouch &mt){} /** * Called when * . A new display is added or removed * . The screen has been resized (including from/to fullscreen) */ virtual void update_layout(float x1, float y1, float x2, float y2, uint64_t cur_time, Animation_Type anim); void update_layout(uint64_t cur_time, Animation_Type anim); virtual void draw(uint64_t timeNow); virtual void add_display(SRef<OpenGl_Display*> d); virtual void remove_display(SRef<OpenGl_Display*> d); SRef<Video_Cafe_Display*> get_display_at(float glx, float gly); void draw_logo(uint64_t now); private: void maintenance(uint64_t timeNow); OpenGl_Window* window; int drag_status; SRef<Video_Cafe_Display*> drag_cur_local_display; float drag_in_displayX,drag_in_displayY; Bounds bounds; Mutex display_list_lock; std::list<SRef<Video_Cafe_Display*> > videos; SRef<Video_Cafe_Display*> selected_stream; Layout_Mode layout_mode; int layout_animation_ms; uint64_t last_time_mouse_move; float last_mouseglX; float last_mouseglY; uint64_t fade_out_timer; bool display_local; Icon_Button* eit_ict_labs_button; uint64_t time_gui_start; bool show_splash; uint64_t last_dead_video_scan; Bounds logo_bounds; }; class Video_Cafe_Display_Plugin: public Video_Display_Plugin { public: Video_Cafe_Display_Plugin( SRef<Library *> lib ) : Video_Display_Plugin(lib) { } ~Video_Cafe_Display_Plugin(){} virtual std::string get_mem_object_type() const { return "VCafeDisplayPlugin"; } virtual std::string get_name() const { return "internal"; } virtual uint32_t get_version() const { return 0x00000001; } virtual std::string get_description() const { return "VCafe GUI video display"; } virtual SRef<Video_Display *> create( bool fullscreen, std::string callId, uint32_t ssrc ) const { return new Video_Cafe_Display(callId, ssrc, fullscreen ); } }; #endif // VIDEO_CAFE_OUTPUT_H
c3da084c8283c7cc53ecc25020a4be0dee0c00a4
ab570cfbba5d90e73727dca01008e43029a42eae
/hand.h
ac680e50310c6be803b33db47c5f5c9452519c92
[]
no_license
rileym65/Casino
3adfbdf4501f0c55191c031a0ffe3615b30b8cfc
6b73002fdfebbda9ca490774b941f561cb73a049
refs/heads/master
2020-08-08T22:08:40.508213
2019-10-09T13:49:34
2019-10-09T13:49:34
213,931,230
0
0
null
null
null
null
UTF-8
C++
false
false
811
h
hand.h
#ifndef _HAND_H #define _HAND_H class Hand { protected: byte straightCount; byte straightHigh; byte stFlushCount; byte stFlushHigh; int wildCount; unsigned long computeHandValue(unsigned long value); unsigned long computePaigowValue(unsigned long value); int numbers[15]; int suits[4]; byte combinations[10]; public: Hand(); ~Hand(); Card** cards; int numCards; void sort(int wild); int bjValue(); int bjCmp(Hand* h); int baccValue(); int baccCmp(Hand* h); unsigned long pokerValue(int maxCards,int wild); unsigned long paigowValue(); Hand* paigowSplit(int c1,int c2); int pokerCmp(Hand* h); int threePokerValue(int wild); int threePokerCmp(Hand* h); void display(int hidden); }; #endif
eb09850caad469c25063bd33355244de8875a4c5
4ecd9f030c10fdd05e1c3436e3f41a7a3a803d76
/pic10ahw6/Character.h
a68caa9c87b1d25f07513326ef171019652c415e
[]
no_license
jkauf8/monsterGame
26a2bc733c964e9f64e8e7c0af33b057d60f8fd4
a45857cb9b5ff4589b5a4f20b5ea9369caf3b8c0
refs/heads/main
2023-02-12T22:16:20.139213
2021-01-16T02:41:47
2021-01-16T02:41:47
330,328,581
0
0
null
null
null
null
UTF-8
C++
false
false
533
h
Character.h
//Character.h #ifndef Character_h #define Character_h #include <iostream> #include <string> #include <cstdlib> #include <ctime> using namespace std; class Character { public: Character(string newName); Character(string newName, int newHealth, int newDamage, int newArrows); void attack(Character& target); void rangedAttack(Character& target); void set_health(int newHealth); int get_health() const; string get_name() const; void display() const; private: string name; int health; int damage; int arrows; }; #endif
93f49afa411b3d51f9f1c7e150248c5666a42484
302e7dfdb90f55c8bd3c783d4d7f177111a02725
/src/arduino/smart_exp/Button.h
ef4ef5191a61d743821655021e03fec948c5f9bf
[]
no_license
lorenzo0/Smart-Experiment
9a2b3a41bd16f5126ccdca557abf428e2f961bf3
04fc184c103e7e8e6e45ea81044e921ce8a9c065
refs/heads/master
2023-01-24T05:40:21.962826
2020-12-06T17:46:57
2020-12-06T17:46:57
313,066,963
0
0
null
null
null
null
UTF-8
C++
false
false
134
h
Button.h
#ifndef __BUTTON__ #define __BUTTON__ class Button{ public: Button(int pinButton); private: int pinButton; }; #endif
dcf5202cd39d3ab5c4038e2b05cb799f8b971c73
14ce793aedf5fcc1a685ee7173e1333210b46553
/src/qtest/abuild-shlibs/data/extra-targets/lib1_1.hh
e997aaef2fe54331939ca845c44155168e9f7caa
[ "Apache-2.0", "Artistic-2.0", "LicenseRef-scancode-unknown-license-reference", "Artistic-1.0", "LicenseRef-scancode-warranty-disclaimer" ]
permissive
abuild-org/abuild
a569fca784b1a113f65c510233b9d97773c84674
54c003b2bf2e544bb25d7727fb4ba6297bc4a61e
refs/heads/master
2020-11-27T07:39:14.413974
2019-12-20T23:38:41
2019-12-20T23:38:41
229,351,827
0
0
null
null
null
null
UTF-8
C++
false
false
60
hh
lib1_1.hh
#ifndef lib1_1_hh #define lib1_1_hh void lib1_1(); #endif
81655373d9a746947781ad93ceffc12f2337a525
fe225bb412f3b0c43abe1d257658e7f433346bbf
/apps/postgresql/trans/ConfigTransaction.h
0cbda047abb85053f5c4cad763b9cc40bda213bd
[]
no_license
yeti-switch/sems
611f0bc8dfa381d5f8f15c47a7ce287a2e8366f1
f15ab5b638d7447883503d4939170067aba0f807
refs/heads/master
2023-08-18T23:09:58.940541
2023-08-16T19:37:19
2023-08-16T19:37:19
70,628,618
14
9
null
2018-04-02T10:10:05
2016-10-11T19:36:01
C++
UTF-8
C++
false
false
600
h
ConfigTransaction.h
#pragma once #include "Transaction.h" class ConfigTransaction : public Transaction { Transaction* make_clone() override { return new ConfigTransaction(*this); } PGTransactionData policy() override { return PGTransactionData(); } public: ConfigTransaction(const map<string, PGPrepareData>& prepareds, const vector<string>& search_pathes, const vector< std::unique_ptr<IQuery> > &init_queries, ITransactionHandler* handler); ConfigTransaction(const ConfigTransaction& trans); ~ConfigTransaction(){} };
8f4ea39d95391c03b7344a0658dd1c70a1ee6db1
fd872b564a34189e94510354f2e3d8af735b5e20
/mapper/include/mapper.h
d5791b763e34fcf57ac96b444d420c7e7b45fefe
[]
no_license
NickoDema/undergraduate_final_project
e55b6e58a99a72a22ec041235ba4482e634eab7e
7afb49d5a5d106a672df018f941bcd143df27aee
refs/heads/master
2022-04-25T14:28:37.739551
2020-04-19T22:28:37
2020-04-19T22:28:37
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,846
h
mapper.h
/* mapper.h * * Created on: 19.04.2017 * Email: Nicko_Dema@protonmail.com * ITMO University * Department of Computer Science and Control Systems */ #ifndef MAPPER_ #define MAPPER_ #include <ros/ros.h> #include <tf/tf.h> #include <sensor_msgs/PointCloud.h> #include <geometry_msgs/Pose.h> #include <nav_msgs/OccupancyGrid.h> #include <nav_msgs/Odometry.h> #include <tf/transform_broadcaster.h> #include <tf/transform_listener.h> #include <cmath> //map resolution constants #define CELL 0.02 //Cell boundary size #define CELL_H 0.01 #define CELL_N 67 //Maps width and height #define R_POSE 33 //Robot pose on map_ class Mapper { public: Mapper(std::string); ~Mapper(); void spin(); protected: ros::NodeHandle nh_; ros::Publisher map_pub; ros::Subscriber odom_sub; geometry_msgs::Pose last_pose; //??? static void odom_cb(const nav_msgs::Odometry&); void odom_init(); //int8_t map[CELL_N][CELL_N]; //MAP class Map_keeper { public: double x_error; double y_error; Map_keeper(int); int8_t map_[CELL_N][CELL_N]; //MAP void move(int, char); } map_keeper; class Map_builder { protected: struct Point { double x, y; Point *Next,*Prev; }; Point *Head, *Tail; double max_dist; public: Map_builder(double, double); ~Map_builder(); void add(double, double); void div_by_two(); void to_map(double,double,double,int8_t [CELL_N][CELL_N]); double get_dist(Point *, Point *); }; }; #endif /*MAPPER_*/
5de221804233b977d198c115cc4e6cf8e2ffcf10
83977dbf9fce529fbfd3e5cd29341ecef483b5b3
/Analysis_programs/projects/x/read_corr.cpp
ec48ebdb0bcb8d2878f28493bd3d6f54e4cbbe4a
[]
no_license
sunpho84/sunpho
0057bc0d42ee1a73e133dc16365f2490facb35d9
ef964e4af9079a243ddac6a1469b267693c77834
refs/heads/master
2020-04-05T22:55:18.442445
2017-02-07T09:15:17
2017-02-07T09:15:17
41,365,927
0
0
null
null
null
null
UTF-8
C++
false
false
3,869
cpp
read_corr.cpp
#include "include.h" int L=24; int njacks=15; int nind_mom; int *deg,*ind_of_lx; double *m2; typedef int coords[4]; coords size={L,L,L,L}; int V=L*L*L*L; double phase[4]={1,0.01,0.02,0.03}; //Return the index of site of coord x in a box of sides s int lx_of_coord(coords x) { int ilx=0; for(int mu=0;mu<4;mu++) ilx=ilx*size[mu]+x[mu]; return ilx; } void coord_of_lx(coords x,int ilx) { for(int mu=3;mu>=0;mu--) { x[mu]=ilx%size[mu]; ilx/=size[mu]; } } //find symmetric coord void reduced_coord(coords r,coords c) { for(int mu=0;mu<4;mu++) if(c[mu]<=size[mu]/2) r[mu]=c[mu]; else r[mu]=size[mu]-c[mu]; } //check if it is independent bool is_ind(int imom) { //get coord coords c,r; coord_of_lx(c,imom); reduced_coord(r,c); bool is=true; for(int mu=0;mu<4;mu++) { is&=(c[mu]<=size[mu]/2); //check if reduced coordinate is smaller or equal to following (excluded time) if(mu>0) for(int nu=mu+1;nu<4;nu++) is&=(r[mu]<=r[nu]); } return is; } //count the number of independent momenta void count_nind_mom() { //mark independent if it is for(int imom=0;imom<V;imom++) if(is_ind(imom)) nind_mom++; } //symmetrize a certain direction void symmetrize(jvec &corr,int mu) { for(int imom=0;imom<V;imom++) { //take coords coords c; coord_of_lx(c,imom); //take symm c[mu]=(size[mu]-c[mu])%size[mu]; int jmom=lx_of_coord(c); jack t=(corr[imom]+corr[jmom])/2; //overwrite corr[imom]=corr[jmom]=t; } } void symmetrize(jvec &corr) {for(int mu=0;mu<4;mu++) symmetrize(corr,mu);} //permute void permute(jvec &corr) { int mu[6]={1,2,3,3,1,2}; int nu[6]={2,3,1,2,3,1}; int rh[6]={3,1,2,1,2,3}; for(int imom=0;imom<V;imom++) { //take coords coords c; coord_of_lx(c,imom); int jmom[6]; jack t(njacks); t=0; for(int iperm=0;iperm<6;iperm++) { //permute coords coords d; d[0]=c[0]; d[1]=c[mu[iperm]]; d[2]=c[nu[iperm]]; d[3]=c[rh[iperm]]; //take note and average jmom[iperm]=lx_of_coord(d); t+=corr[jmom[iperm]]; } //overwrite t/=6; for(int iperm=0;iperm<6;iperm++) corr[jmom[iperm]]=t; } } //set m2 void compute_momenta() { for(int imom=0;imom<V;imom++) { //compute reduced coord coords c,r; coord_of_lx(c,imom); reduced_coord(r,c); //compute distances m2[imom]=0; for(int mu=0;mu<4;mu++) { double m=(2*r[mu]+phase[mu])*M_PI/size[mu]; m2[imom]+=m*m; } } } bool a(int imom) { //compute reduced coord coords c,r; coord_of_lx(c,imom); reduced_coord(r,c); return true;//(c[0]+c[1]+c[2]+c[3]==1); } int main() { //count the momenta count_nind_mom(); cout<<"Number of independent momenta: "<<nind_mom<<endl; debug_load=0; //load data jvec corr(V,njacks); corr.load("XspaceCorrClust",0); //compute distances m2=new double[V]; compute_momenta(); //open output ofstream out("plot.xmg"); out<<"@type xydy"<<endl; out<<"@yaxes scale Logarithmic"<<endl; //write all out<<"@s0 line type 0"<<endl; for(int imom=0;imom<V;imom++) if(a(imom)) out<<sqrt(m2[imom])<<" "<<corr[imom]<<endl; out<<"&"<<endl; //symmetrize out<<"@s1 line type 0"<<endl; symmetrize(corr); for(int imom=0;imom<V;imom++) if(a(imom)) out<<sqrt(m2[imom])+0.05*1<<" "<<corr[imom]<<endl; out<<"&"<<endl; //permute out<<"@s2 line type 0"<<endl; permute(corr); for(int imom=0;imom<V;imom++) if(a(imom)) out<<sqrt(m2[imom])+0.05*2<<" "<<corr[imom]<<endl; out<<"&"<<endl; //filter out<<"@s3 line type 0"<<endl; for(int imom=0;imom<V;imom++) if(a(imom)) if(is_ind(imom)) out<<sqrt(m2[imom])+0.05*3<<" "<<corr[imom]<<endl; out<<"&"<<endl; delete[] m2; return 0; }
a103cfd0e5635d0c0e3ba19bfd970229aa3b7738
fed18c8d3288e597a9055836bed227a58c28aaa7
/lessons/lesson_27/menu.hpp
d19e50e6d20dbaf49c6516949045bc2893f7731e
[]
no_license
cCppProsto/SDLLesson
22bc3106e0249416a522c4329de48b599039a504
22d332cf89aeeaef8431a99d9c1a148109e2e3fd
refs/heads/master
2021-06-20T19:10:21.434487
2021-03-06T05:57:42
2021-03-06T05:57:42
189,386,063
1
0
null
null
null
null
UTF-8
C++
false
false
869
hpp
menu.hpp
#ifndef _MENU_HPP_ #define _MENU_HPP_ #include <vector> #include <SDL_events.h> #include "menuSettings.hpp" class menu { enum class eItem : Uint8 { Start = 0, Settings, Authors, Exit }; friend menu::eItem operator++(menu::eItem &item); friend menu::eItem operator--(menu::eItem &item); public: menu(); ~menu(); void draw(); void process(); void handle_keyboard_event(const SDL_KeyboardEvent &aEvent); void reset_flags(); const bool &isExit()const; const bool &isGameStart()const; private: void _init_text(); void _change_state(); private: bool m_is_start{ false }; bool m_is_exit{false}; bool m_is_high_level{ true }; eItem m_current_item{ eItem::Start }; menuSettings m_settings_page; std::vector<std::string> mv_items; }; #endif /* _MENU_HPP_ */
4e47f2720a5d87ae5b4559feb3b72ecc29a77169
69b5d925a07a7f60445cb507736ee9a55b045018
/SDL 2D Game Engine/CollisionSystem.cpp
2f2745d828572b4cbe39a94933f5d0a358cd65cd
[]
no_license
CamiloOY/SDL-2D-Game-Engine
685dd3b72bc0fd69d358a1537951ebfb18ea56e5
54a723fcb42734d839206a8efb09aadd07d33450
refs/heads/master
2023-09-05T09:04:33.632433
2021-11-04T21:57:53
2021-11-04T21:57:53
379,560,939
0
0
null
null
null
null
UTF-8
C++
false
false
2,023
cpp
CollisionSystem.cpp
#include "CollisionSystem.h" #include "Components.h" #include "Game.h" void CollisionSystem::update() { for(Entity& entity_a : entities) { // Loop over all entity pairs and check if they're colliding RectCollider& collider_a = manager.getComponent<RectCollider>(entity_a); collider_a.collisions.clear(); Transform& transform_a = manager.getComponent<Transform>(entity_a); for(Entity& entity_b : entities) { if(entity_a == entity_b) { continue; } RectCollider& collider_b = manager.getComponent<RectCollider>(entity_b); Transform& transform_b = manager.getComponent<Transform>(entity_b); // Calculate the positions of the bounding boxes float rect_a_x = transform_a.position.x + collider_a.relative_x; float rect_a_y = transform_a.position.y + collider_a.relative_y; float rect_b_x = transform_b.position.x + collider_b.relative_x; float rect_b_y = transform_b.position.y + collider_b.relative_y; // Detect collisions using axis-aligned bounding boxes if(rect_a_x < rect_b_x + collider_b.w && rect_a_x + collider_a.w > rect_b_x && rect_a_y < rect_b_y + collider_b.h && rect_a_y + collider_a.h > rect_b_y) { collider_a.collisions.insert(entity_b); } } } } //TODO: Optimise this void CollisionSystem::render() { for(Entity& entity : entities) { RectCollider& collider = manager.getComponent<RectCollider>(entity); if(collider.draw_bounding_box) { Transform& transform = manager.getComponent<Transform>(entity); float rect_x = transform.position.x + collider.relative_x; float rect_y = transform.position.y + collider.relative_y; // Draw bounding boxes SDL_RenderDrawLine(Game::renderer, rect_x, rect_y, rect_x + collider.w, rect_y); SDL_RenderDrawLine(Game::renderer, rect_x, rect_y, rect_x, rect_y + collider.h); SDL_RenderDrawLine(Game::renderer, rect_x + collider.w, rect_y, rect_x + collider.w, rect_y + collider.h); SDL_RenderDrawLine(Game::renderer, rect_x, rect_y + collider.h, rect_x + collider.w, rect_y + collider.h); } } }
01a17f9f16c74efa37614fe6e8625830de70c6da
c18894a83550a8e8494787591fbe8e31cd08d31e
/MyClient/ScreenBuffer.h
d81d8db92f3ab2ccfa8ff8e630f67fe51051ad4e
[]
no_license
suha1515/D2DTool
2bb8e85b9e775e25a1011d49094dc14a4fec9c6e
49750e33a33e92695b098ee76246d4e9963f1d04
refs/heads/master
2022-02-22T11:16:14.205049
2019-10-22T02:56:22
2019-10-22T02:56:22
208,934,027
0
0
null
null
null
null
UHC
C++
false
false
341
h
ScreenBuffer.h
#pragma once class CScreenBuffer { public: CScreenBuffer(); ~CScreenBuffer(); public: void Initialize(int width,int height); void Render(); void Release(); private: //오브젝트 정점,인덱스 버퍼 IDirect3DVertexBuffer9* m_pVB; IDirect3DIndexBuffer9* m_pIB; LPDIRECT3DDEVICE9 m_pDevice; BlendVertex m_Vertex[4]; };
9dff2e1561e3f2e8c287021c867866fa36fb27f7
6890b258bec01ad71bfa6c6f8914854a3b85b98a
/Программирование/ConsoleApplication1(2)/ConsoleApplication1/Student.cpp
2eeefab7c9553c913e894caf7d3d557ce4ef0877
[]
no_license
Avdil/Semestr_3
23910ff9f91a30e08a15a1e717a2eb1687feb145
55564e43b80b3c1089c230ebc63b3ac455295cd6
refs/heads/master
2020-03-15T16:43:02.803735
2018-05-05T11:23:33
2018-05-05T11:23:33
132,241,300
0
0
null
null
null
null
UTF-8
C++
false
false
472
cpp
Student.cpp
#include <string> #include "Student.h" Student::Student() { } Student::~Student() { } void Student::set_name(std::string student_name) { Student::name = student_name; } std::string Student::get_name() { return Student::name; } void Student::set_scores(int scores[]) { for (int i = 0; i < 5; ++i) { Student::scores[i] = scores[i]; } } void Student::set_average(double ball) { Student::average = ball; } double Student::get_average() { return Student::average; }
fb19a0288bff8e3fc3d315d8e5c251abe296ab17
7953410e9112d79724a8acdd604d45a043191145
/SrProject/udpreceiver.h
79945298b6d9fd24cf024e83d79ce945f5634637
[]
no_license
ktaze1/SeniorProject
80458dbde47e38ee035d57f3e46ed7c921d30433
1aad3d0eb065f4ef2628382b42119674041dcb78
refs/heads/master
2021-06-25T20:48:28.312909
2021-02-14T21:06:31
2021-02-14T21:06:31
203,246,860
3
0
null
null
null
null
UTF-8
C++
false
false
525
h
udpreceiver.h
#ifndef UDPRECEIVER_H #define UDPRECEIVER_H #include <QWidget> #include <QDebug> #include <QTcpServer> #include "sendthread.h" QT_BEGIN_NAMESPACE class QLabel; class QUdpSocket; QT_END_NAMESPACE class udpReceiver : public QTcpServer { Q_OBJECT public: explicit udpReceiver(QObject *parent = nullptr); void serverListener(); ~udpReceiver(); protected slots: void incomingConnection(int socketDescriptor); private: QLabel *statusLabel = nullptr; QUdpSocket *udpSocket = nullptr; }; #endif
9a6e5f54d83bc0b6804185089b5c3684f5185117
d99a4f380d76755ff99841ac71494e7836065d42
/sorting.cpp
05c1d9eac41e935284c3d379afa32920954f8145
[ "MIT" ]
permissive
selavy/sorting
3dc77ea00cdfac3049b11571938d9942572cc0d2
9fe321150eed6afaf53de23d9700e202133ddbd5
refs/heads/master
2020-07-28T10:33:00.022145
2019-09-18T20:33:58
2019-09-18T20:33:58
209,394,757
0
0
null
null
null
null
UTF-8
C++
false
false
1,187
cpp
sorting.cpp
#include <iostream> #include <vector> #include <random> #include <algorithm> #include <cassert> template < class It, class Cmp = std::less<> > void unguarded_insertion_sort(It begin, It end, Cmp cmp = Cmp{}) noexcept { // pre : *(begin - 1) <= all elements in [begin, end) // post: [begin - 1, end) sorted for (; begin != end; ++begin) { It cur = begin, prev = begin - 1; while (cmp(*cur, *prev)) { std::iter_swap(cur--, prev--); } } } template <class Cont> void print(const Cont& vs) { for (auto v : vs) std::cout << v << " "; std::cout << "\n"; } int main(int argc, char** argv) { constexpr int N = 100; std::random_device rd; std::mt19937 gen(rd()); std::uniform_int_distribution<> dis(-10*N, 10*N); std::vector<int> vs; vs.reserve(N); for (int i = 0; i < N; ++i) vs.push_back(dis(gen)); assert(static_cast<int>(vs.size()) == N); assert(!std::is_sorted(vs.begin(), vs.end())); std::make_heap(vs.begin(), vs.end(), std::greater<>{}); unguarded_insertion_sort(vs.begin() + 2, vs.end()); assert(std::is_sorted(vs.begin(), vs.end())); return 0; }
790f0e95a6e4243b4456a3960b3e80f3922b400c
d856fadb1f5f25f9de4f01b40ade1da5c6000863
/RaytracingCamp2018/src/Disc.cpp
eac6bb51c40d52b34e59b2399a69f041dafa1f67
[]
no_license
shutosg/rtcamp2018
9c707622857913902f4c76283241290109aeb081
5b6238a83d585e93334a47444d3fde3b91636340
refs/heads/master
2020-03-27T20:43:58.480536
2018-09-02T14:43:49
2018-09-02T14:43:49
147,090,190
4
0
null
null
null
null
UTF-8
C++
false
false
1,590
cpp
Disc.cpp
#include "Disc.hpp" Disc::Disc() : IIntersectable() , pos(Vec(0)) , normal(Vec(0, 0, 1)) , doubleSurface(false) { } Disc::Disc(const Vec &pos, const Vec &normal, const double radius, const bool doubleSurface, Material *mat) : IIntersectable(mat) , pos(pos) , normal(normal.normalize()) , radius(radius) , doubleSurface(doubleSurface) { } Disc::Disc(const Disc &d) : Disc::Disc(d.pos, d.normal, d.radius, d.doubleSurface, new Material(*d.mat)) { } void Disc::intersect(const Ray &ray, int depth, Intersection &isect) { if (!visibleFromCamera(depth)) return; intersectPlane(ray, isect); if (isect.isHit()) { auto v = isect.point - pos; if (std::sqrt(v.dot(v)) <= radius) { // ヒットしたのでマテリアル情報を渡す *isect.mat = *mat; } else { // 半径の外なのでisectを戻す isect.t = constants::kINF; isect.point = Vec(); isect.normal = Vec(); } } } void Disc::intersectPlane(const Ray &ray, Intersection &isect) { double normalDotDir = normal.dot(ray.dir); // 裏を向いてるので交差しない if (!doubleSurface && normalDotDir < 0) return; // rayが面と垂直なので交差しない if (std::abs(normalDotDir) <= constants::kEPS) return; // 交差する auto v = pos - ray.origin; auto t = v.dot(normal) / normalDotDir; if (t >= 0) { isect.t = t; isect.point = ray.origin + ray.dir.scale(t); isect.normal = normal; } }
15ebcba31f03547f69ae93b5615332475464e8f1
d2532fef27934284f9f0d932931999825128da5a
/1-Algorithmic toolbox/week4_divide_and_conquer/5_organizing_a_lottery/points_and_segments.cpp
0edaf83059d2151f9f8b23d0ba5f8f2e452ea755
[]
no_license
mohamedabdelhakem1/UCSD-data-structures-and-algorithms-specialization
f57f3418f82906894641d53f9e2234932d9f554e
2e31939f561a60ed829e5e5f663dcd06c645c644
refs/heads/master
2020-07-03T21:18:18.895700
2019-08-13T02:00:21
2019-08-13T02:00:21
202,052,423
0
0
null
null
null
null
UTF-8
C++
false
false
1,892
cpp
points_and_segments.cpp
#include <bits/stdc++.h> using namespace std; vector<int> fast_count_segments( vector<pair <int,int > > segments, vector<int> points) { vector <pair <int, int> > pairs(segments.size() * 2 + points.size()) ; vector<int> cnt (points.size()); unordered_map <int,vector <int> > mp; int i = 0; for(pair <int, int > p : segments ) { pairs[i] = make_pair(p.first,1); i++; pairs[i] = make_pair(p.second,3); i++; } int j = 0; for(int p : points ) { if(mp.find(p) == mp.end()) { pairs[i] = make_pair(p, 2); i++; } mp[p].push_back(j); j++; } sort(pairs.begin(), pairs.end()); int cover = 0; for(pair <int, int > p : pairs) { if(p.second == 1 ) { cover++; } else if(p.second == 3) { cover--; } else { vector <int> vec = mp[p.first]; for(int k : vec) { cnt[k] = cover; } } } return cnt; } vector<int> naive_count_segments(vector<pair <int,int > > segments, vector<int> points) { vector<int> cnt(points.size()); for (size_t i = 0; i < points.size(); i++) { for (size_t j = 0; j < segments.size(); j++) { cnt[i] += (segments[j].first <= points[i] && points[i] <= segments[j].second); } } return cnt; } int main() { int n, m; cin >> n >> m; vector<pair <int,int > > segments(n); for (size_t i = 0; i < segments.size(); i++) { std::cin >> segments[i].first >> segments[i].second; } vector<int> points(m); for (size_t i = 0; i < points.size(); i++) { std::cin >> points[i]; } //use fast_count_segments vector<int> cnt1 = fast_count_segments(segments, points); for (size_t i = 0; i < cnt1.size(); i++) { std::cout << cnt1[i] << ' '; } }
625e808be19836b28fe6d9ae645b585143451e75
d1b103ef570d1f2b3b23a4c0deecc85adb3bd0fe
/leetcode_day6/Q130_surrounded_char.h
e72480923c3441e6e5eebce55354145e697c74ac
[]
no_license
maverick-zhang/Algorithms-Leetcode
da77e73bf949731a8528da39445ca50761c56513
dd4197305e9dcdb9efe6779ed69b9dbe3dbd28d9
refs/heads/master
2020-10-01T10:47:35.499791
2020-02-26T11:13:11
2020-02-26T11:13:11
227,519,712
0
0
null
null
null
null
UTF-8
C++
false
false
4,359
h
Q130_surrounded_char.h
// // Created by maverick on 2020/1/7. // #ifndef ALGORITHMS_Q130_SURROUNDED_CHAR_H #define ALGORITHMS_Q130_SURROUNDED_CHAR_H //给定一个二维的矩阵,包含 'X' 和 'O'(字母 O)。 // //找到所有被 'X' 围绕的区域,并将这些区域里所有的 'O' 用 'X' 填充。 // //示例: // //X X X X //X O O X //X X O X //X O X X //[["O","X","X","O","X"], // ["X","O","O","X","O"], // ["X","O","X","O","X"], // ["O","X","O","O","O"], // ["X","X","O","X","O"]] //[["O","X","X","O","X"], // ["X","X","X","X","O"], // ["X","X","X","O","X"], // ["O","X","X","O","O"], // ["X","X","O","X","O"]] //[["O","X","X","O","X"], // ["X","X","X","X","O"], // ["X","X","X","O","X"], // ["O","X","O","O","O"], // ["X","X","O","X","O"]] #include <vector> using namespace std; // //class Solution { //private: // vector<vector<bool>> surrounded; // bool in_area(int x, int y) // { // return x >= 0 and x < x_max and y >= 0 and y < y_max; // } // // int x_max, y_max; // // int direction[4][2] {{0, -1}, {-1, 0},{1, 0},{0, 1}}; // // bool is_surrounded (vector<vector<char>> & board, int x, int y, vector<vector<bool>> & visited) // { // visited[x][y] = true; // for (int i = 0; i < 4; ++i) { // int new_x = x + direction[i][0]; // int new_y = y + direction[i][1]; // // if (!in_area(new_x, new_y)) // return false; // // if (!surrounded[new_x][new_y]) // return false; // // if (!visited[new_x][new_y] and board[new_x][new_y] == 'O') // { // if(!is_surrounded(board, new_x, new_y, visited)) // return false; // } // // } // return true; // } // // void dfs(vector<vector<char>> & board, int x, int y) // { // board[x][y] = 'X'; // for (int i = 0; i < 4; ++i) { // int new_x = x + direction[i][0]; // int new_y = y + direction[i][1]; // if (in_area(new_x, new_y) and board[new_x][new_y] == 'O') // dfs(board, new_x, new_y); // } // // } // //public: // void solve(vector<vector<char>>& board) { // // x_max = board.size(); // if(x_max < 3) // return; // y_max = board[0].size(); // surrounded = vector<vector<bool>> (x_max, vector<bool>(y_max, true)); // for (int i = 1; i < x_max - 1; ++i) { // for (int j = 1; j < y_max - 1; ++j) { // auto visited = vector<vector<bool>>(x_max, vector<bool>(y_max, false)); // if (board[i][j] == 'O' ) // { // if (is_surrounded(board, i, j, visited)) // dfs(board, i, j); // else // surrounded[i][j] = false; // } // } // } // } //}; //改变思路,从边界开始用dfs找到所有和边界相连的O,把其改变为’#‘,这一步做完后,剩下的O即为不联通的,将其改为X //最后再把#改为O class Solution { bool in_area(int x, int y) { return x >= 0 and x < x_max and y >= 0 and y < y_max; } int x_max, y_max; int direction[4][2] {{0, -1}, {-1, 0},{1, 0},{0, 1}}; void dfs(vector<vector<char>> & board, int x, int y) { board[x][y] = '#'; for (int i = 0; i < 4; ++i) { int new_x = x + direction[i][0]; int new_y = y + direction[i][1]; if (in_area(new_x, new_y) and board[new_x][new_y] == 'O') dfs(board, new_x, new_y); } } public: void solve(vector<vector<char>>& board) { x_max = board.size(); if (x_max < 3) return; y_max = board[0].size(); for (int i = 0; i < x_max; ++i) { for (int j = 0; j < y_max; ++j) { if ((i == x_max - 1 or j == y_max - 1 or i == 0 or j == 0) and board[i][j] == 'O' ) dfs(board, i, j); } } for (int k = 0; k < x_max; ++k) { for (int i = 0; i < y_max; ++i) { if (board[k][i] == 'O') board[k][i] = 'X'; if (board[k][i] == '#') board[k][i] = 'O'; } } } }; #endif //ALGORITHMS_Q130_SURROUNDED_CHAR_H
5528078715d987a2afc9ca54325ed9cc4cd9ae89
6f874ccb136d411c8ec7f4faf806a108ffc76837
/code/Windows-classic-samples/Samples/PackageManagerFindPackagesWithPackageTypes/cpp/FindPackagesWithPackageTypesSample.cpp
19552c36abbd7c2ab27d3bb445aa1bc271ea2fb1
[ "MIT" ]
permissive
JetAr/ZDoc
c0f97a8ad8fd1f6a40e687b886f6c25bb89b6435
e81a3adc354ec33345e9a3303f381dcb1b02c19d
refs/heads/master
2022-07-26T23:06:12.021611
2021-07-11T13:45:57
2021-07-11T13:45:57
33,112,803
8
8
null
null
null
null
UTF-8
C++
false
false
2,538
cpp
FindPackagesWithPackageTypesSample.cpp
//// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF //// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO //// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A //// PARTICULAR PURPOSE. //// //// Copyright (c) Microsoft Corporation. All rights reserved #include <windows.h> #include <sddl.h> #include <algorithm> #include <collection.h> #include <iostream> #include <string> #using <Windows.winmd> using namespace Platform; using namespace Windows::ApplicationModel; using namespace Windows::Foundation; using namespace Windows::Foundation::Collections; using namespace Windows::Management::Deployment; using namespace std; void DisplayPackageInfo(Windows::ApplicationModel::Package^ package) { wcout << L"Name: " << package->Id->Name->Data() << endl; wcout << L"FullName: " << package->Id->FullName->Data() << endl; wcout << L"Version: " << package->Id->Version.Major << "." << package->Id->Version.Minor << "." << package->Id->Version.Build << "." << package->Id->Version.Revision << endl; wcout << L"Publisher: " << package->Id->Publisher->Data() << endl; wcout << L"PublisherId: " << package->Id->PublisherId->Data() << endl; wcout << L"Installed Location: " << package->InstalledLocation->Path->Data() << endl; wcout << L"IsFramework: " << (package->IsFramework ? L"True" : L"False") << endl; } [STAThread] int __cdecl main(Platform::Array<String^>^ args) { wcout << L"Copyright (c) Microsoft Corporation. All rights reserved." << endl; wcout << L"FindPackagesWithPackageTypes sample" << endl << endl; try { PackageTypes type = PackageTypes::Main | PackageTypes::Framework; auto packageManager = ref new PackageManager(); auto packages = packageManager->FindPackagesWithPackageTypes(type); int packageCount = 0; std::for_each(begin(packages), end(packages), [&packageManager, &packageCount](Package^ package) { DisplayPackageInfo(package); wcout << endl; packageCount += 1; }); } catch (AccessDeniedException^) { wcout << L"FindPackagesWithPackageTypesSample failed because access was denied. This program must be run from an elevated command prompt." << endl; return 1; } catch (Exception^ ex) { wcout << L"FindPackagesWithPackageTypesSample failed, error message: " << ex->ToString()->Data() << endl; return 1; } return 0; }
6735ad198010bb60abba97cb8e39f4753ccdfab3
0a2357ad0098bbb7b74528cb01d6decaab928ed8
/codeforces/contest165/a.cpp
66208811e95442ecb540c2e133f0390729c5661b
[]
no_license
touyou/CompetitiveProgramming
12af9e18f4fe9ce9f08f0a0f2750bcb5d1fc9ce7
419f310ccb0f24ff08d3599e5147e5a614071926
refs/heads/master
2021-06-18T09:19:01.767323
2020-07-16T03:40:08
2020-07-16T03:40:08
90,118,147
0
0
null
2020-10-13T04:32:19
2017-05-03T06:57:58
C++
UTF-8
C++
false
false
718
cpp
a.cpp
#include <cstdio> int x[200], y[200]; int ri[200], le[200], lo[200], up[200]; int main() { int n; scanf("%d",&n); for (int i=0; i<n; i++) { scanf("%d%d",&x[i],&y[i]); } for (int i=0; i<n; i++) { for (int j=i+1; j<n; j++) { if (x[i]>x[j]&&y[i]==y[j]) { le[i]++; ri[j]++; } else if (x[i]<x[j]&&y[i]==y[j]) { le[j]++; ri[i]++; } else if (y[i]>y[j]&&x[i]==x[j]) { lo[i]++; up[j]++; } else if (y[i]<y[j]&&x[i]==x[j]) { lo[j]++; up[i]++; } } } int res=0; for (int i=0; i<n; i++) if (le[i]&&ri[i]&&lo[i]&&up[i]) res++; printf("%d\n",res); }
57c3019ecb9de3b8ad12885a715874bd9cac1eac
547e62016e1fa5ea4f3fc4b4ef2030b1db7eac16
/codeforces/170/b.cpp
7e91a9bb6aa325aaeaf728e67badd5ac9f74670b
[]
no_license
withwind93/ACM_Code
f20a59052a269078b4c5248595526e108c23cff0
86ef06f068122a6afc6add83f9d8ef35f1097706
refs/heads/master
2016-09-06T16:29:47.714053
2014-03-27T12:18:33
2014-03-27T12:18:33
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,184
cpp
b.cpp
/************************************************************************* > File Name: b.cpp > Author: withwind > Mail: withwind93@gmail.com > Created Time: 2013/2/28 23:43:37 ************************************************************************/ #include <limits.h> #include <stdio.h> #include <string.h> #include <math.h> #include <stdlib.h> #include <algorithm> #include <iostream> using namespace std; char s[50][50]; int hash[26]; int main() { int i,j,k; int len; int n; scanf("%d",&n); for(i=0;i<26;i++) hash[i]=0; for(i=1;i<=n;i++) { scanf("%s",s[i]); len=strlen(s[i]); for(j=0;j<len;j++) hash[s[i][j]-'a']++; } int flag=1; for(i=0;i<26;i++) if(hash[i]==0) { flag=0; printf("%c",i+'a'); return 0; } if(flag) { char str[3]; for(int ii=0;ii<26;ii++) for(int jj=0;jj<26;jj++) { str[0]='a'+ii; str[1]='a'+jj; str[2]='\0'; int find=0; for(i=1;i<=n;i++) { len=strlen(s[i]); for(j=1;j<len;j++) { if(s[i][j-1]==str[0] && s[i][j]==str[1]) { find=1; break; } } } if(find==0) { printf("%s",str); return 0; } } } return 0; }
2812c098d2058895fc01285f8c12d0ae317d5bdf
0734bb41eeba7e5efb58fbe40e36c6768dcf42a7
/Test/SoundScene.h
79ff0d70ba36d8b9a644c10afca0b77e422b3675
[]
no_license
shh1473/Sunrin_Engine_D3D9_with_DXUT
8b958a719a55aa311319d5ee0771e5296ff822dd
c93c5b912755636713ea0404e33b1ab278b3e592
refs/heads/master
2022-01-23T06:34:27.419929
2019-07-23T16:53:26
2019-07-23T16:53:26
197,949,893
0
0
null
null
null
null
UTF-8
C++
false
false
202
h
SoundScene.h
#pragma once #include "../SunrinEngine.h" class SoundScene : public Object { public: SoundScene(); virtual ~SoundScene(); virtual void Update(); virtual void Render(); public: Sound *sound; };
85c243bf70ecdcd6620edfacdd5d9d0fb3514fc9
0c2cde2aa6e8d7834e5bd49e8022d45ce2b69dbd
/HW04_griffid5/vc10/griffid5Starbucks.h
61fb9461d4c3c5b88c44806c79b18e609eecf9fb
[]
no_license
griffid5/HW04-griffid5-2
359f429615024a1b8fc53db93a07499c95b1f5fb
eadef837b9114b644b5f686817332a1edad9e417
refs/heads/master
2020-12-24T17:26:36.935557
2012-11-01T15:21:17
2012-11-01T15:21:17
null
0
0
null
null
null
null
UTF-8
C++
false
false
470
h
griffid5Starbucks.h
/**** *Author: griffid5 (David Griffith) *Date: 10/27/2012 *purpose: */ #pragma #include <string> using namespace std; #include "Starbucks.h" class Entry { public: string identifier; double x; double y; }; class griffid5Starbucks : public Starbucks { public: griffid5Starbucks(); ~griffid5Starbucks(void); Entry* locations; // Creates a new class of the locations brought in int size; void build(Entry* c, int n); Entry* getNearest(double x, double y); };
0fe6ac672728f49fd5bc052d36b19e68e1ad77a7
4bcc9806152542ab43fc2cf47c499424f200896c
/tensorflow/lite/tools/optimize/modify_model_interface_main.cc
940c0d98b82910f551d42d383c7db0c1b16c8462
[ "Apache-2.0", "LicenseRef-scancode-generic-cla", "BSD-2-Clause" ]
permissive
tensorflow/tensorflow
906276dbafcc70a941026aa5dc50425ef71ee282
a7f3934a67900720af3d3b15389551483bee50b8
refs/heads/master
2023-08-25T04:24:41.611870
2023-08-25T04:06:24
2023-08-25T04:14:08
45,717,250
208,740
109,943
Apache-2.0
2023-09-14T20:55:50
2015-11-07T01:19:20
C++
UTF-8
C++
false
false
1,671
cc
modify_model_interface_main.cc
/* Copyright 2020 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ==============================================================================*/ #include <string> #include "tensorflow/lite/tools/optimize/modify_model_interface.h" // // Note: This is a private API, subject to change. int main(int argc, char** argv) { if (argc != 5) { printf( "Wrong number of arguments. Example: modify_model_interface_main " "${input} ${output} ${input_interface} ${output_interface}"); return 1; } const std::unordered_map<std::string, tflite::TensorType> supported_types{ {"uint8", tflite::TensorType_UINT8}, {"int8", tflite::TensorType_INT8}, {"int16", tflite::TensorType_INT16}}; tflite::TensorType input = tflite::TensorType_INT8; tflite::TensorType output = tflite::TensorType_INT8; try { input = supported_types.at(argv[3]); output = supported_types.at(argv[4]); } catch (const std::out_of_range&) { printf("Only supports uint8, int8 and int16 for input and output types"); return 1; } tflite::optimize::ModifyModelInterface(argv[1], argv[2], input, output); return 0; }
28da77729aa509775313326290a58cc4d913b525
6e6323edbb77e91b28842fabcfc66ba4e4105ace
/ED_RRiveraG1_A06/C++/cmake-build-debug/Node.h
3f1df6edaa4d16ab21ffd2668838515831b42239
[]
no_license
Riverto/ED_RRiveraG1
12e29def862c30118b01da7823b7e46966adcc0e
5ebd5e579f922cbd983632161b2d6d23b34ac740
refs/heads/master
2021-01-15T11:49:24.241098
2017-10-24T13:15:22
2017-10-24T13:15:22
99,634,985
0
2
null
null
null
null
UTF-8
C++
false
false
231
h
Node.h
// // Created by Roberto Rivera on 9/7/17. // #ifndef C_NODE_H #define C_NODE_H class Node { protected: int data; Node next; public: Node(); Node(int data); Node(int data, Node& next); }; #endif //C_NODE_H
27f53143daeb8adb9b69e43183552455264c5d53
1df0f2dd40099cdc146dc82ee353e7ea4e563af2
/shared/PointInsidePolygonTest.h
b91b71b49700fd5bad00c7489c37716aee7df5a1
[]
no_license
chuckbruno/aphid
1d0b2637414a03feee91b4c8909dd5d421d229d4
f07c216f3fda0798ee3f96cd9decb35719098b01
refs/heads/master
2021-01-01T18:10:17.713198
2017-07-25T02:37:15
2017-07-25T02:37:15
98,267,729
0
1
null
2017-07-25T05:30:27
2017-07-25T05:30:27
null
UTF-8
C++
false
false
709
h
PointInsidePolygonTest.h
/* * PointInsidePolygonTest.h * mallard * * Created by jian zhang on 8/29/13. * Copyright 2013 __MyCompanyName__. All rights reserved. * */ #pragma once #include <AllMath.h> #include <Patch.h> namespace aphid { class PointInsidePolygonTest : public Patch { public: PointInsidePolygonTest(); PointInsidePolygonTest(const Vector3F & p0, const Vector3F & p1, const Vector3F & p2, const Vector3F & p3); bool isPointInside(const Vector3F & px) const; float distanceTo(const Vector3F & origin, Vector3F & closestP, char & inside) const; static bool isPointInside(const Vector3F & px, const Vector3F & nor, Vector3F *vertices, const int nv); bool intersect(Ray & ray, Vector3F & closestP); }; }
68cc8776a554b53fb8d6ca95480323ca595eed37
42ecfef68dc4d15644708b141708437328118beb
/11000 - Bee.cpp
5766c1ed032e8ec15ba6e23bd237bbe90bb34e44
[]
no_license
Khairul-Anam-Mubin/UVa-Solutions
900321a7f25032570b620dbe3e558b9be1ec2cce
8298c8b2786d5a4d4d8f40e61d364aaac33bc4f8
refs/heads/master
2021-10-26T19:39:47.318365
2021-10-12T07:21:45
2021-10-12T07:21:45
156,956,789
0
2
null
null
null
null
UTF-8
C++
false
false
455
cpp
11000 - Bee.cpp
/*** ** Author: Khairul Anam Mubin ** Bangladesh University of Business and Technology, ** Dept. of CSE. ***/ #include <bits/stdc++.h> using namespace std; int main() { long int y,a,i,temp,b; while(scanf("%ld",&y)==1 && y>=0) { a=0; b=0; temp=0; for(i=0;i<=y;i++){ temp=(a+b)+1; a=b; b=temp; } cout<<a<<" "<<temp<<endl; } return 0; }
b197c24e72ad5a51f5905958d8c657ec90c2096e
94ca1bd63465b23db575b0f155e46661ef59c30d
/SuperHero.cpp
bb17ad49c3a93b299685d3999e736812a95b2a8f
[]
no_license
Xekep/Vitzliputzli
9b70e2a855713e639365c16180cdadde11d9443e
1b06befec4cffcdad090b7ab7ffefa5e1cdb9701
refs/heads/master
2021-01-01T06:44:39.103948
2011-10-27T08:44:20
2011-10-27T08:44:20
null
0
0
null
null
null
null
UTF-8
C++
false
false
5,718
cpp
SuperHero.cpp
#include "SuperHero.h" #include "GMap.h" #include "LevelSettings.h" #include "AdvancedGraphicFunctions.h" //--------------------------------------------------------------------------- int statesOfStepHero[4] = {0, 32, 0, 64}; int stateOfStepHero = 0; //--------------------------------------------------------------------------- #define dx 9 #define dy 1 #define dw 14 #define dh 31 //--------------------------------------------------------------------------- CollisionDetectWays MegaCollisionDetecter(int dX, int dY, const level::tilesArray &map); //--------------------------------------------------------------------------- level::GHero::GHero(std::string fileWithSprites, SDL_Rect pos) { spritesOfHeroe = fileWithSprites; heroCoordinates.x = pos.x; heroCoordinates.y = pos.y; heroCoordinates.w = pos.w; heroCoordinates.h = pos.h; heroSurface = load_image(spritesOfHeroe); spdX = 0; spdY = 16; //всегда падает jmp = 0; vrtlHeroPosition.x = 0; vrtlHeroPosition.y = 0; vrtlHeroPosition.h = 32; vrtlHeroPosition.w = 32; stateHero |= HERO_RIGHT; stateOfStepHero = 0; } //--------------------------------------------------------------------------- void level::GHero::MoveHero(const tilesArray &map) { CollisionDetectWays fPos; /******************/ fPos = MegaCollisionDetecter(heroCoordinates.x+spdX, heroCoordinates.y, map); if(spdX < 0) { if(!fPos.cLeftBottom && !fPos.cLeftTop) { heroCoordinates.x += spdX; stateOfStepHero++; if(stateOfStepHero >= 4) stateOfStepHero = 0; } else { heroCoordinates.x = map[0][heroCoordinates.x/32]->tileCoordinates.x; stateOfStepHero = 0; } } else if(spdX > 0) { if(!fPos.cRightBottom && !fPos.cRightTop) { heroCoordinates.x += spdX; stateOfStepHero++; if(stateOfStepHero >= 4) stateOfStepHero = 0; } else { heroCoordinates.x = map[0][(heroCoordinates.x+heroCoordinates.w-1)/32]->tileCoordinates.x; stateOfStepHero = 0; } } /*** TODO: в дальнейшем, когда карт будет много входы за пределы карты надо будет сделать переходом на другую карту ***/ /********************/ if(jmp < 0) jmp++; else if ((!stateHero&JUMP_HERO) || (jmp >= 0)) { jmp = 0; } fPos = MegaCollisionDetecter(heroCoordinates.x, heroCoordinates.y+(spdY+jmp), map); if((spdY+jmp) < 0) { if(!fPos.cRightTop && !fPos.cLeftTop) { heroCoordinates.y += (spdY+jmp); stateHero &= ~HERO_DOWN; stateHero |= JUMP_HERO; } else { heroCoordinates.y = map[heroCoordinates.y/32][0]->tileCoordinates.y; jmp = -spdY; stateHero &= ~JUMP_HERO; stateHero |= HERO_DOWN; } } else if((spdY+jmp) > 0) { if(!fPos.cRightBottom && !fPos.cLeftBottom) { heroCoordinates.y += (spdY+jmp); stateHero |= HERO_DOWN; stateHero &= ~JUMP_HERO; } else { heroCoordinates.y = map[(heroCoordinates.y+heroCoordinates.h-1)/32][0]->tileCoordinates.y; stateHero &= ~HERO_DOWN; stateHero &= ~JUMP_HERO; } } /*** TODO: в дальнейшем, когда карт будет много входы за пределы карты надо будет сделать переходом на другую карту ***/ } //--------------------------------------------------------------------------- void level::GHero::RePlace(SDL_KeyboardEvent evnt) { if( evnt.type == SDL_KEYDOWN ) { if(evnt.keysym.sym == SDLK_SPACE) { if(!(stateHero&(HERO_DOWN|JUMP_HERO))) { stateHero |= JUMP_HERO; jmp = -33; } } if(evnt.keysym.sym == SDLK_LEFT) { spdX = -8; stateHero |= HERO_LEFT; stateHero &= ~HERO_RIGHT; } else if(evnt.keysym.sym == SDLK_RIGHT) { spdX = 8; stateHero |= HERO_RIGHT; stateHero &= ~HERO_LEFT; } } else if( evnt.type == SDL_KEYUP ) { if((evnt.keysym.sym == SDLK_LEFT) || (evnt.keysym.sym == SDLK_RIGHT)) spdX = 0; } } //--------------------------------------------------------------------------- void level::GHero::DrawHero(SDL_Surface *scr, SDL_Rect coord) { if(stateHero&HERO_LEFT) vrtlHeroPosition.y = 32; else if(stateHero&HERO_RIGHT) vrtlHeroPosition.y = 0; vrtlHeroPosition.x = statesOfStepHero[stateOfStepHero]; SDL_Rect tempRect; tempRect.x = heroCoordinates.x - coord.x; tempRect.y = heroCoordinates.y - coord.y; SDL_BlitSurface( heroSurface, &vrtlHeroPosition, scr, &tempRect ); } //--------------------------------------------------------------------------- CollisionDetectWays MegaCollisionDetecter(int dX, int dY, const level::tilesArray &map) { CollisionDetectWays cN = {false, false, false, false}; if(map[dY/32][dX/32] != NULL) cN.cLeftTop = true; if(map[dY/32][(dX+31)/32] != NULL) cN.cRightTop = true; if(map[(dY+31)/32][dX/32] != NULL) cN.cLeftBottom = true; if(map[(dY+31)/32][(dX+31)/32] != NULL) cN.cRightBottom = true; return cN; } //---------------------------------------------------------------------------
da6ff42993eda7618d7b8faca392c83cf97f2d05
73a52d0a1325c9865896a9197730875cb6d46c61
/Framework/Geometry/inc/MantidGeometry/Instrument/ParComponentFactory.h
f394c02ddfa58d6cd6c3c2222a3578d88a449a37
[]
no_license
dezed/mantid
47b3c9f57f9adf2b6ac642ae407d26f06a0889c5
9095776c26e868a00d8126ad275626f910d66f62
refs/heads/master
2021-01-15T13:51:57.852879
2016-03-08T10:49:43
2016-03-08T10:49:43
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,480
h
ParComponentFactory.h
#ifndef MANTID_GEOMETRY_PARCOMPONENT_FACTORY_H_ #define MANTID_GEOMETRY_PARCOMPONENT_FACTORY_H_ //------------------------------------------------------------------------------ // Includes //------------------------------------------------------------------------------ #include "MantidGeometry/DllConfig.h" #ifndef Q_MOC_RUN #include <boost/shared_ptr.hpp> #endif #include <vector> #include <stdexcept> namespace Mantid { namespace Geometry { class ParameterMap; class IComponent; class IDetector; class Detector; class Instrument; /** @brief A Factory for creating Parameterized component from their respective non-parameterized objects. @author Nicholas Draper, ISIS RAL @date 20/10/2009 Copyright &copy; 2007-11 ISIS Rutherford Appleton Laboratory, NScD Oak Ridge National Laboratory & European Spallation Source This file is part of Mantid. Mantid is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. Mantid is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. File change history is stored at: <https://github.com/mantidproject/mantid> Code Documentation is available at: <http://doxygen.mantidproject.org> */ class MANTID_GEOMETRY_DLL ParComponentFactory { public: /// Create a parameterized detector from the given base component and /// ParameterMap and /// return a shared_ptr<Detector> static boost::shared_ptr<Detector> createDetector(const IDetector *base, const ParameterMap *map); /// Create a parameterized instrument from the given base and ParameterMap static boost::shared_ptr<Instrument> createInstrument(boost::shared_ptr<const Instrument> base, boost::shared_ptr<ParameterMap> map); /// Create a parameterized component from the given base component and /// ParameterMap static boost::shared_ptr<IComponent> create(boost::shared_ptr<const IComponent> base, const ParameterMap *map); }; } // Namespace Geometry } // Namespace Mantid #endif
99340ac90aef14f21f53e90f54345167a1cf5460
c44fb0847f55d5a9a187e6e9518c1fa28957c480
/AdvancedLib/CodecLib/G729A/G729AEncoder.cpp
94fa1fe3e3d1934a01df1a8ab1c31fbdbac3216d
[]
no_license
Spritutu/hiquotion_cpp
54567d5d0e62c36415d94f851ef9631932480e33
39e35053f979f7b613075c6a582fe58333c95dff
refs/heads/master
2022-03-29T13:08:54.752069
2020-01-21T05:00:19
2020-01-21T05:00:19
null
0
0
null
null
null
null
GB18030
C++
false
false
3,241
cpp
G729AEncoder.cpp
#include "stdafx.h" #include "G729AEncoder.h" CG729AEncoder::CG729AEncoder(void) { srcLen=L_FRAME*sizeof(Word16); dstLen=SERIAL_SIZE; //*sizeof(Word16); init(); } CG729AEncoder::~CG729AEncoder(void) { } void CG729AEncoder::init() { /*--------------------------------------------------------------------------* * Initialization of the coder. * *--------------------------------------------------------------------------*/ Init_Pre_Process(); Init_Coder_ld8k(); for(i=0; i<PRM_SIZE; i++) prm[i] = (Word16)0; /* To force the input and output to be time-aligned the variable SYNC has to be defined. Note: the test vectors were generated with this option disabled */ #ifdef SYNC /* Read L_NEXT first speech data */ fread(&new_speech[-L_NEXT], sizeof(Word16), L_NEXT, f_speech); #ifdef HARDW /* set 3 LSB's to zero */ for(i=0; i < L_NEXT; i++) new_speech[-L_NEXT+i] = new_speech[-L_NEXT+i] & 0xFFF8; #endif Pre_Process(&new_speech[-L_NEXT], L_NEXT); #endif } int CG729AEncoder::encode(char *src, char *dst) { if(!src || !dst) return -1; // new_speech 在 Init_Pre_Process() 中被初始化,所以 get_new_speech() 必须在 Init_Pre_Process() 之后调用 Word16 *new_speech=get_new_speech(); memcpy(new_speech, src, srcLen); #ifdef HARDW /* set 3 LSB's to zero */ for(i=0; i < L_FRAME; i++) new_speech[i] = new_speech[i] & 0xFFF8; #endif Pre_Process(new_speech, L_FRAME); Coder_ld8k(prm, syn); // prm2bits_ld8k( prm, serial); prm2bits_ld8k( prm, (unsigned char *)dst); // memcpy(dst, serial, dstLen); return 0; } // src的长度得是80,Word16是2字节,所以总长度是160 // int CG729AEncoder::encode(Word16 *src, char *dst) // { // if(!src || !dst) // return -1; // // // new_speech 在 Init_Pre_Process() 中被初始化,所以 get_new_speech() 必须在 Init_Pre_Process() 之后调用 // Word16 *new_speech=get_new_speech(); // // memcpy(new_speech, src, srcLen); // #ifdef HARDW // /* set 3 LSB's to zero */ // for(i=0; i < L_FRAME; i++) new_speech[i] = new_speech[i] & 0xFFF8; // #endif // // Pre_Process(new_speech, L_FRAME); // // Coder_ld8k(prm, syn); // // prm2bits_ld8k( prm, serial); // // memcpy(dst, serial, dstLen); // // return 0; // } // 编码 // 原长度必须是 160 的整数倍 int CG729AEncoder::encodeEx(char *src, unsigned int srcLen, char *dst) { int count=srcLen / 160; // char srcSlip[160]; // char dstSlip[10]; for(int i=0;i<count;i++) { // memcpy(srcSlip, src + i * 160, 160); // encode((char *)srcSlip, (char *)dstSlip); encode((char *)(src + i * 160), (char *)(dst + i * 10)); // memcpy(dst + i * 10, dstSlip, 10); // Sleep(1); } return 0; } // 编码 // 原长度必须是 80 的整数倍 // int CG729AEncoder::encodeEx(char *src, unsigned int srcLen, char *dst) // { // int count=srcLen / 80; // Word16 srcSlip[80]; // char dstSlip[10]; // for(int i=0;i<count;i++) // { // for(int j=0;j<80;j++) // srcSlip[j]=src[i*80+j]; // // // memcpy(srcSlip, src + i * 160, 160); // // encode((char *)srcSlip, (char *)dstSlip); // encode(srcSlip, (char *)dstSlip); // memcpy(dst + i * 10, dstSlip, 10); // // // Sleep(1); // } // // return 0; // }
4b0e500f899332f338ce0b9c2a59be4977fcd341
f7d6bd56dd9bbbf5ecf77728bd9a42921c9f2dd9
/Random.cpp
ff35e82acfe7288d512aac9e141467985c2fb8c8
[]
no_license
kernalphage/gl_play
4b7506d4523408e723c1e790120f5f813b4fbb63
90dd7e6149de534eb97cab860489925ed01fbcda
refs/heads/master
2021-04-27T19:55:34.116629
2019-05-06T15:54:00
2019-05-06T15:55:26
122,366,560
0
0
null
null
null
null
UTF-8
C++
false
false
182
cpp
Random.cpp
#include "Random.hpp" std::default_random_engine Random::generator; std::uniform_real_distribution<float> Random::distribution; std::normal_distribution<float> Random::gauss_dist;
b6f5ec1faaee3f9205255c746987f81523a40513
ddd288fbef7dc9e86dae4c1d236da631f8407b3b
/CGP600 AE2/Camera.cpp
680d90f56e2df27ef180f96dd6305837e918eba6
[]
no_license
JamesSkett/Advanced-Games-Programming
752f75575f787cb1412b3ed2dfad68c4884b2ef0
b3b72e922b95a91bfd6c89e3695f1ac97994d1a6
refs/heads/master
2021-09-03T04:32:22.330551
2018-01-05T15:28:16
2018-01-05T15:28:16
108,906,605
0
0
null
null
null
null
UTF-8
C++
false
false
5,253
cpp
Camera.cpp
#include "Camera.h" #include <windows.h> #include <stdio.h> #include <math.h> Camera::Camera(float x, float y, float z, float rotation) { m_x = x; m_y = y; m_z = z; m_camera_rotation = rotation; m_dx = sinf(XMConvertToRadians(m_camera_rotation)); m_dz = cosf(XMConvertToRadians(m_camera_rotation)); m_dy = sinf(XMConvertToRadians(m_camera_rotation)); m_isForward = true; m_isBackward = false; m_isRight = false; m_isLeft = false; } Camera::~Camera() { } void Camera::Rotate(float number_of_degrees, float objectX, float objectY, float objectZ) { /*m_camera_rotation += number_of_degrees; m_dx = sinf(XMConvertToRadians(m_camera_rotation)); m_dy = sinf(XMConvertToRadians(m_camera_rotation)); m_dz = cosf(XMConvertToRadians(m_camera_rotation));*/ float s = sinf(XMConvertToRadians(number_of_degrees)); float c = cosf(XMConvertToRadians(number_of_degrees)); m_x -= objectX; m_y -= objectZ; float xnew = (m_x * c) - (m_y * s); float znew = (m_y * s) + (m_x * c); m_x = znew; m_y = xnew; } void Camera::Forward(float distance, Scene_Node* rootNode) { float oldX = m_x; float oldZ = m_z; m_x += m_dx * distance; m_z += m_dz * distance; } void Camera::Up(float distance) { m_y += distance; } void Camera::Strafe(float distance) { //move the camera left and right based on the direction m_position += (m_right * distance); //update the cameras coordinates m_x = XMVectorGetX(m_position); m_y = XMVectorGetY(m_position); m_z = XMVectorGetZ(m_position); } void Camera::Pitch(float number_of_degrees) { m_camera_rotation += number_of_degrees; m_dx = sinf(XMConvertToRadians(m_camera_rotation)); m_dy = sinf(XMConvertToRadians(m_camera_rotation)); m_dz = cosf(XMConvertToRadians(m_camera_rotation)); m_up = XMVector3Cross(m_right, m_lookat); } void Camera::SetX(float x) { m_x = x; } void Camera::SetY(float y) { m_y = y; } void Camera::SetZ(float z) { m_z = z; } void Camera::SetYaw(float angle) { m_camYaw = angle; } void Camera::SetPitch(float angle) { m_camPitch = angle; } void Camera::SetIsForward(bool isForward) { m_isForward = isForward; } void Camera::SetIsBackward(bool isBackward) { m_isBackward = isBackward; } void Camera::SetIsRight(bool isRight) { m_isRight = isRight; } void Camera::SetIsLeft(bool isLeft) { m_isLeft = isLeft; } float Camera::GetX() { return m_x; } float Camera::GetY() { return m_y; } float Camera::GetZ() { return m_z; } float Camera::GetDirectionX() { return m_dx; } float Camera::GetDirectionY() { return m_dy; } float Camera::GetDirectionZ() { return m_dz; } // makes the camera follow the position of an object with a slight offset void Camera::CameraFollow(float targetX, float targetY, float targetZ) { if (m_isForward) //if isForward is true the camera faces down the z axis positively { m_x = targetX; m_y = targetY + 3; m_z = targetZ - 15; m_dx = sinf(XMConvertToRadians(0.0f)); m_dz = cosf(XMConvertToRadians(0.0f)); } else if(m_isBackward) //if isBackward is true the camera faces down the z axis negatively { m_x = targetX; m_y = targetY + 3; m_z = targetZ + 15; m_dx = sinf(XMConvertToRadians(180.0f)); m_dz = cosf(XMConvertToRadians(180.0f)); } else if (m_isRight) //if isRight is true the camera faces down the x axis negatively { m_x = targetX + 15; m_y = targetY + 3; m_z = targetZ; m_dx = sinf(XMConvertToRadians(270.0f)); m_dz = cosf(XMConvertToRadians(270.0f)); } else if (m_isLeft) //if isLeft is true the camera faces down the y axy positively { m_x = targetX - 15; m_y = targetY + 3; m_z = targetZ; m_dx = sinf(XMConvertToRadians(90.0f)); m_dz = cosf(XMConvertToRadians(90.0f)); } } void Camera::LookAt(float targetX, float targetZ) { m_camera_rotation = atan2f((targetX - m_x), (targetZ - m_z)) * (180 / XM_PI); m_dx = sinf(XMConvertToRadians(m_camera_rotation)); m_dz = cosf(XMConvertToRadians(m_camera_rotation)); } XMMATRIX Camera::GetViewMatrix() { /*m_camRotationMatrix = XMMatrixRotationRollPitchYaw(m_camPitch, m_camYaw, 0); m_lookat = XMVector3TransformCoord(m_defaultForward, m_camRotationMatrix); m_lookat = XMVector3Normalize(m_lookat);*/ //XMMATRIX rotateYTempMatrix; //rotateYTempMatrix = XMMatrixRotationY(m_camYaw); //m_right = XMVector3TransformCoord(m_defaultRight, rotateYTempMatrix); //m_up = XMVector3TransformCoord(m_up, rotateYTempMatrix); //m_forward = XMVector3TransformCoord(m_defaultForward, rotateYTempMatrix); /*m_position += m_moveLeftRight * m_right; m_position += m_moveBackForward * m_forward; m_moveLeftRight = 0.0f; m_moveBackForward = 0.0f; m_lookat = m_position + m_lookat;*/ m_position = XMVectorSet(m_x, m_y, m_z, 0.0f); m_lookat = XMVectorSet(m_x + m_dx, m_y + m_dy, m_z + m_dz, 0.0f); m_up = XMVectorSet(0.0f, 1.0f, 0.0f, 0.0f); //Get the forward and right vector positions m_forward = XMVector3Normalize(m_lookat - m_position); m_right = XMVector3Cross(m_forward, m_up); return XMMatrixLookAtLH(m_position, m_lookat, m_up); }
93b557b671f5767ae754f744f88a684301aab6ad
6c489d291b99860097eb1316be00ce1d23d41507
/Lecture28/firstUniqueCharacter.cpp
38db9e582b21d7b1687c54fa5a5dc7bcdd99ddfe
[]
no_license
sanjeetboora/CppLiveAugust2020
15bd83fd188a8965a38ff223fda73350fab6c0d8
3cb7375549222e5374bbd0afacde59108a10618f
refs/heads/master
2023-01-23T22:42:44.471791
2020-12-05T21:43:16
2020-12-05T21:43:16
290,770,574
2
2
null
null
null
null
UTF-8
C++
false
false
599
cpp
firstUniqueCharacter.cpp
/* Problem - */ /* By Sanjeet Boora */ #include<bits/stdc++.h> using namespace std; void firstUniqueChar(string str) { int freq[26] = {0}; queue<char> q; for (int i = 0; i < str.length(); ++i) { char ch = str[i]; freq[ch - 'a']++; //update freq of curr char if (freq[ch - 'a'] > 1) { //repeated char while (!q.empty() and freq[q.front() - 'a'] > 1) {//queue's front isn't unique q.pop(); } } else { //unique char q.push(ch); } } cout << q.front() << endl; } int main(int argc, char const *argv[]) { string str = "aabbcdafgdc"; firstUniqueChar(str); return 0; }
99c4948504acd62a8d91a79f1871c4bc7a37b033
ab64c72b421125590a9eb9449d678d7db4f7610a
/Hieroglyph3/Source/Application/RenderApplication.h
91afce6bca3786519de7a6a7c53dfaefeb4bc019
[ "MIT" ]
permissive
xzwang2005/DX11_tutorials_with_hieroglyph3
03220106c9d762bfccdbf098c42821bf25bb2b46
611e273dafe099875e86222e75420920ca2c49bf
refs/heads/master
2020-05-17T13:44:24.834766
2018-03-22T11:03:50
2018-03-22T11:03:50
28,190,906
5
3
null
null
null
null
UTF-8
C++
false
false
2,259
h
RenderApplication.h
//-------------------------------------------------------------------------------- // This file is a portion of the Hieroglyph 3 Rendering Engine. It is distributed // under the MIT License, available in the root of this distribution and // at the following URL: // // http://www.opensource.org/licenses/mit-license.php // // Copyright (c) Jason Zink //-------------------------------------------------------------------------------- #include "PCH.h" #include "Application.h" #include "Win32RenderWindow.h" #include "RendererDX11.h" #include "SceneRenderTask.h" #include "ViewTextOverlay.h" #include "Camera.h" #include "Scene.h" #include "ConsoleActor.h" namespace Glyph3 { class RenderApplication : public Application { public: RenderApplication(); virtual ~RenderApplication(); public: virtual bool ConfigureRenderingEngineComponents( UINT width, UINT height, D3D_FEATURE_LEVEL desiredLevel, D3D_DRIVER_TYPE driverType = D3D_DRIVER_TYPE_HARDWARE ); virtual bool ConfigureRenderingSetup(); virtual void ShutdownRenderingEngineComponents(); virtual void ShutdownRenderingSetup(); virtual void HandleWindowResize( HWND handle, UINT width, UINT height ); virtual bool HandleEvent( EventPtr pEvent ); virtual Win32RenderWindow* CreateRenderWindow(); void ToggleMultiThreadedMode(); void SetMultiThreadedMode( bool mode ); bool GetMultiThreadedMode(); virtual void TakeScreenShot(); virtual void SetScreenShotName( const std::wstring name ); protected: RendererDX11* m_pRenderer11; Win32RenderWindow* m_pWindow; UINT m_iWidth; UINT m_iHeight; ResourcePtr m_BackBuffer; SceneRenderTask* m_pRenderView; ViewTextOverlay* m_pTextOverlayView; bool m_bMultithreadedMode; std::wstring m_ScreenShotName; public: enum class InputMode { Console, Camera }; // For the camera, we have a reference to the object itself, and // also provide another event manager for it to use. This allows // us to control when the camera receives events and when they // should be passed to a different object. EventManager CameraEventHub; Camera* m_pCamera; EventManager ConsoleEventHub; ConsoleActor* m_pConsole; InputMode m_InputMode; }; };
5ff004bf58c3eb776535858aaf2d56c5c2c72f69
657074186b970c9af8a59a7b8d8ab4eb3ed993a6
/dcs/uiDCS/ui/transmit.h
9b8e6bcc18ea91df9ce2418eb816a4f32d1761bb
[]
no_license
FedorGurin/UiGenDCS
f2650e2cb87cb887efeb3985ef524388750da284
4d43258600a43b01e1d0f53b6f460bc023d7e57a
refs/heads/master
2021-06-27T12:30:49.902370
2020-11-22T13:09:07
2020-11-22T13:09:07
34,628,665
0
0
null
null
null
null
UTF-8
C++
false
false
1,853
h
transmit.h
//! Класс для приема/отправки данных //! #ifndef CL_TRANSMIT_H #define CL_TRANSMIT_H #include <QUdpSocket> #include <QDataStream> #include "../NetworkCommunication/cl_NetworkCommunication.h" #include "SettingUI.h" class Transmit:public QObject { Q_OBJECT public: Transmit(NetworkCommunication *networkCommunication=0); //! задать размер принимаемых данных void setSizeBytes(long size); //! сокет QUdpSocket udpSocket; //! разрешение приема пакетов от УЦВС void enableRecive(bool); //! буфер для приема данных char* dataToSend; //! структура с настройками модуля SettingUI *setting; //! размерность массива для передачи данных long sizeDataToSend; //! смена портов void changePort(); //!порт отправки int portSend; //!порт приема int portRecive; //! объект для соединения NetworkCommunication *glNetworkCommunication; //! отправить пакет void sendDatagram(char*); //! признак 1ого приема данных bool firstRecive(){return firstRecive_;} protected: //! таймер для обновления данных void timerEvent(QTimerEvent *event); public slots: //! обработка полученных пакетов void processPendingDatagrams(); //! слот на готовность соединения void slotReadyNetworkCommunication(); signals: //! сигнал с полученными данными void ReciveData(char*); private: //! признак первого приема данных bool firstRecive_; }; #endif
5399995b736bc365a09d5817e46edab5114d683a
1f54d4dee97fb7257af3f42fe341f87dc29e9cd4
/reactor/src/reactor/network/resolve.hh
b9f590cb2209c7c90a7b207c8253832283ac6d54
[ "Apache-2.0" ]
permissive
LongJohnCoder/elle
b7e677e4808d924193f8ae6f1c9a68b602250f06
e0a30ea44d42fa35ffe42dc4581a7437919e21e9
refs/heads/master
2021-06-13T20:36:20.894438
2017-02-21T11:33:56
2017-02-21T11:34:54
null
0
0
null
null
null
null
UTF-8
C++
false
false
502
hh
resolve.hh
#ifndef INFINIT_REACTOR_NETWORK_RESOLVE_HH # define INFINIT_REACTOR_NETWORK_RESOLVE_HH # include <boost/asio.hpp> namespace reactor { namespace network { boost::asio::ip::tcp::endpoint resolve_tcp(const std::string& hostname, const std::string& service, bool ipv4_only = true); boost::asio::ip::udp::endpoint resolve_udp(const std::string& hostname, const std::string& service, bool ipv4_only = true); } } #endif
6807c04dceb382e077a09424bef43d14cd9ba376
480f4ae475655631dac33a2d48e24e9fbc960d63
/src/GLMesh.h
49d4cbf350b37c15e1b11c8c481f851fc58fa43f
[]
no_license
sunverwerth/chunky
c4778f79ddf5f4d538b2d7d693c4d7363a2cb1fb
8fec542260eafcb6a5adffd9c18cd6686be551e8
refs/heads/master
2020-04-21T09:46:21.027792
2019-02-07T16:56:01
2019-02-07T16:56:01
169,462,281
2
0
null
null
null
null
UTF-8
C++
false
false
1,833
h
GLMesh.h
#ifndef GLMesh_H #define GLMesh_H #include "GLVertexArray.h" #include "GLElementBuffer.h" #include <vector> class GLMesh { public: struct Element { unsigned int count; unsigned int type; size_t size; }; bool useIndices = true; enum class PrimitiveType { TRIANGLES, LINES } primitiveType = PrimitiveType::TRIANGLES; GLMesh(const std::vector<Element>& elements) { glGenVertexArrays(1, &vao); glGenBuffers(1, &vbo); glGenBuffers(1, &ebo); glBindVertexArray(vao); glBindBuffer(GL_ARRAY_BUFFER, vbo); size_t stride = 0; for (auto& el : elements) { stride += el.count * el.size; } size_t offset = 0; for (int i = 0; i < elements.size(); ++i) { glVertexAttribPointer(i, elements[i].count, elements[i].type, GL_FALSE, stride, (void*)offset); glEnableVertexAttribArray(i); offset += elements[i].size * elements[i].count; } } ~GLMesh(); void setIndices(const void* data, size_t size, size_t count, unsigned int usage) { glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ebo); glBufferData(GL_ELEMENT_ARRAY_BUFFER, size*count, data, usage); numIndices = count; } void setVertices(const void* data, size_t size, size_t count, unsigned int usage) { glBindBuffer(GL_ARRAY_BUFFER, vbo); glBufferData(GL_ARRAY_BUFFER, size*count, data, usage); numVertices = count; } void draw() { glBindVertexArray(vao); if (useIndices) { glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ebo); if (primitiveType == PrimitiveType::TRIANGLES) { glDrawElements(GL_TRIANGLES, numIndices, GL_UNSIGNED_INT, 0); } } else { if (primitiveType == PrimitiveType::LINES) { glDrawArrays(GL_LINES, 0, numVertices); } } } int numVertices; int numIndices; GLuint vbo; GLuint vao; GLuint ebo; }; #endif
0535589800787964fbb4fea1313346229cf24f0a
5f5e6147b8067220c9476c7d93cd91c2f88ab3f7
/improve/4_templateClass_seg.h
b33404213abcf0a27b5a8067765a09f2bdab2141
[]
no_license
fengxuewei-dev/C-plus-plus-Learning
df3939b89a53f527f02db2f10dd667ab73cab5b9
fc643720bed42d966618bf395a6989c558866929
refs/heads/main
2023-05-06T01:10:36.842523
2021-05-04T15:56:09
2021-05-04T15:56:09
355,407,410
0
0
null
null
null
null
UTF-8
C++
false
false
242
h
4_templateClass_seg.h
#pragma once #include <iostream> using namespace std; template<class T> class Person{ public: Person(T age); void show(); static int a; private: T mAge; }; template<class T> int Person<T>::a = 0;
2fe7b6f7449888ebb39f0d4646708c6739fdaf1f
577585cca6375b96d031f92732b186ae8779f0f4
/EndmillRender/millerrender~.cpp
dff00fb93a20d07602410d35f47ad4477b73fb9a
[]
no_license
kvzhao/skyLovesCAM_OpenGL33
3c5862818f8f5d2711f9ee406f1ddf652283864f
8b8097ad3b290ade6215a2a8621c3ae055a0ecd3
refs/heads/master
2020-05-30T02:52:01.565780
2014-06-16T06:46:39
2014-06-16T06:46:39
null
0
0
null
null
null
null
UTF-8
C++
false
false
31,298
cpp
millerrender~.cpp
#include "millerrender.hpp" MillerRender::MillerRender() { gLookAtOther = true; gPosition1 = vec3(-1.5f, 0.0f, 0.0f); // gOrientation1; // Initialise GLFW if( !glfwInit() ) { fprintf( stderr, "Failed to initialize GLFW\n" ); //return -1;exit } glfwWindowHint(GLFW_SAMPLES, 4); glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); // Open a window and create its OpenGL context window = glfwCreateWindow( 1024, 768, "Tutorial 17 - Rotations", NULL, NULL); if( window == NULL ){ fprintf( stderr, "Failed to open GLFW window. If you have an Intel GPU, they are not 3.3 compatible. Try the 2.1 version of the tutorials.\n" ); glfwTerminate(); // return -1;exit } glfwMakeContextCurrent(window); // Initialize GLEW glewExperimental = true; // Needed for core profile if (glewInit() != GLEW_OK) { fprintf(stderr, "Failed to initialize GLEW\n"); // return -1; exit } //initGL(window); // Initialize the GUI TwInit(TW_OPENGL_CORE, NULL); TwWindowSize(1024, 768); TwBar * EulerGUI = TwNewBar("Euler settings"); // TwBar * QuaternionGUI = TwNewBar("Quaternion settings"); TwSetParam(EulerGUI, NULL, "refresh", TW_PARAM_CSTRING, 1, "0.1"); // TwSetParam(QuaternionGUI, NULL, "position", TW_PARAM_CSTRING, 1, "808 16"); TwAddVarRW(EulerGUI, "Euler X", TW_TYPE_FLOAT, &gOrientation1.x, "step=0.01"); TwAddVarRW(EulerGUI, "Euler Y", TW_TYPE_FLOAT, &gOrientation1.y, "step=0.01"); TwAddVarRW(EulerGUI, "Euler Z", TW_TYPE_FLOAT, &gOrientation1.z, "step=0.01"); TwAddVarRW(EulerGUI, "Pos X" , TW_TYPE_FLOAT, &gPosition1.x, "step=0.1"); TwAddVarRW(EulerGUI, "Pos Y" , TW_TYPE_FLOAT, &gPosition1.y, "step=0.1"); TwAddVarRW(EulerGUI, "Pos Z" , TW_TYPE_FLOAT, &gPosition1.z, "step=0.1"); //TwAddVarRW(QuaternionGUI, "Quaternion", TW_TYPE_QUAT4F, &gOrientation2, "showval=true open=true "); //TwAddVarRW(QuaternionGUI, "Use LookAt", TW_TYPE_BOOL8 , &gLookAtOther, "help='Look at the other monkey ?'"); // Set GLFW event callbacks. I removed glfwSetWindowSizeCallback for conciseness glfwSetMouseButtonCallback(window, (GLFWmousebuttonfun)TwEventMouseButtonGLFW); // - Directly redirect GLFW mouse button events to AntTweakBar glfwSetCursorPosCallback(window, (GLFWcursorposfun)TwEventMousePosGLFW); // - Directly redirect GLFW mouse position events to AntTweakBar glfwSetScrollCallback(window, (GLFWscrollfun)TwEventMouseWheelGLFW); // - Directly redirect GLFW mouse wheel events to AntTweakBar glfwSetKeyCallback(window, (GLFWkeyfun)TwEventKeyGLFW); // - Directly redirect GLFW key events to AntTweakBar glfwSetCharCallback(window, (GLFWcharfun)TwEventCharGLFW); // - Directly redirect GLFW char events to AntTweakBar // Ensure we can capture the escape key being pressed below glfwSetInputMode(window, GLFW_STICKY_KEYS, GL_TRUE); glfwSetCursorPos(window, 1024/2, 768/2); // Dark blue background glClearColor(0.0f, 0.0f, 0.4f, 0.0f); // Enable depth test glEnable(GL_DEPTH_TEST); // Accept fragment if it closer to the camera than the former one glDepthFunc(GL_LESS); // Cull triangles which normal is not towards the camera glEnable(GL_CULL_FACE); // Read our .obj file std::vector<unsigned short> indices; std::vector<glm::vec3> indexed_vertices; std::vector<glm::vec2> indexed_uvs; std::vector<glm::vec3> indexed_normals; // load model //char* file = "/home/kaeon/MyProgram/src/rim.stl"; //char* file = "/home/kaeon/MyProgram/src/box.stl"; char* file = "/home/kaeon/MyProgram/OpenGL-33-myproject/src/cube.obj"; //char* file = "/home/kaeon/MyProgram/OpenGL-33-myproject/src/ES4.STL"; //char* file = "/home/kaeon/MyProgram/src/suzanne.obj"; //char* file = "/home/kaeon/MyProgram/src/monkey.obj"; //loadOBJ(file,outIndices,vertexArray,uvArray,normalArray); //bool res = loadAssImp(file, indices, indexed_vertices, indexed_uvs, indexed_normals); loadOBJ(file, indices,indexed_vertices,indexed_uvs,indexed_normals); ChangeVerticesCoord(indexed_vertices); GLuint VertexArrayID; glGenVertexArrays(1, &VertexArrayID); glBindVertexArray(VertexArrayID); GLuint WP_VertexArrayID; glGenVertexArrays(1, &WP_VertexArrayID); glBindVertexArray(WP_VertexArrayID); // Create and compile our GLSL program from the shaders //GLuint programID = LoadShaders( "/home/kaeon/MyProgram/opengl_test_success/SimpleTransform.vertexshader", "/home/kaeon/MyProgram/opengl_test_success/SingleColor.fragmentshader" ); programID = LoadShaders( "/home/kaeon/MyProgram/OpenGL-33-myproject/src/StandardShading.vertexshader", "/home/kaeon/MyProgram/OpenGL-33-myproject/src/StandardShading.fragmentshader" ); // Get a handle for our "MVP" uniform MatrixID = glGetUniformLocation(programID, "MVP"); ViewMatrixID = glGetUniformLocation(programID, "V"); ModelMatrixID = glGetUniformLocation(programID, "M"); // Load the texture Texture = loadDDS("/home/kaeon/MyProgram/OpenGL-33-myproject/src/uvmap.DDS"); // Get a handle for our "myTextureSampler" uniform TextureID = glGetUniformLocation(programID, "myTextureSampler"); /***==================== My triangle=============================e **/ std::vector<unsigned short> indices2;//(101*101); std::vector<glm::vec3> indexed_vertices2;//(101*101); std::vector<glm::vec2> indexed_uvs2; std::vector<glm::vec3> indexed_normals2; // /* for (int i = 0; i < 101; i++) { for (int j = 0; j < 101; j++) { double z = sin(float(i)/10.0)*sin(float(i)/10.0); indexed_vertices2[i] = glm::vec3( i-50, j-50, z-20.0); } }*/ // CalculateIndices(indices2); // calculate indices //loadOBJ("/home/kaeon/MyProgram/OpenGL-33-myproject/src/ES4.STL", indices2,indexed_vertices2,indexed_uvs2,indexed_normals2); loadOBJ("/home/kaeon/MyProgram/OpenGL-33-myproject/src/cube.obj", indices2,indexed_vertices2,indexed_uvs2,indexed_normals2); ChangeVerticesCoord(indexed_vertices2); /***==================================================================**/ // Load it into a VBO GLuint vertexbuffer; glGenBuffers(1, &vertexbuffer); glBindBuffer(GL_ARRAY_BUFFER, vertexbuffer); // glBufferData(GL_ARRAY_BUFFER, indexed_vertices.size() * sizeof(glm::vec3), &indexed_vertices[0], GL_STATIC_DRAW); glBufferData(GL_ARRAY_BUFFER, (indexed_vertices.size() + indexed_vertices2.size()) * sizeof(glm::vec3), 0, GL_STATIC_DRAW); glBufferSubData(GL_ARRAY_BUFFER, 0 ,indexed_vertices.size()*sizeof(glm::vec3), &indexed_vertices[0] ); glBufferSubData(GL_ARRAY_BUFFER, indexed_vertices.size()*sizeof(glm::vec3), indexed_vertices2.size()*sizeof(glm::vec3), &indexed_vertices2[0]); GLuint uvbuffer; glGenBuffers(1, &uvbuffer); glBindBuffer(GL_ARRAY_BUFFER, uvbuffer); //glBufferData(GL_ARRAY_BUFFER, indexed_uvs.size() * sizeof(glm::vec2), &indexed_uvs[0], GL_STATIC_DRAW); glBufferData(GL_ARRAY_BUFFER, (indexed_uvs.size()+indexed_uvs2.size() )* sizeof(glm::vec2), 0, GL_STATIC_DRAW); glBufferSubData(GL_ARRAY_BUFFER, 0 ,indexed_uvs.size()*sizeof(glm::vec2), &indexed_uvs[0] ); glBufferSubData(GL_ARRAY_BUFFER, indexed_uvs.size()*sizeof(glm::vec2), indexed_uvs2.size()*sizeof(glm::vec2), &indexed_uvs2[0]); GLuint normalbuffer; glGenBuffers(1, &normalbuffer); glBindBuffer(GL_ARRAY_BUFFER, normalbuffer); //glBufferData(GL_ARRAY_BUFFER, indexed_normals.size() * sizeof(glm::vec3), &indexed_normals[0], GL_STATIC_DRAW); glBufferData(GL_ARRAY_BUFFER, (indexed_normals.size()+indexed_normals2.size() )* sizeof(glm::vec3), 0, GL_STATIC_DRAW); glBufferSubData(GL_ARRAY_BUFFER, 0 ,indexed_normals.size()*sizeof(glm::vec3), &indexed_normals[0] ); glBufferSubData(GL_ARRAY_BUFFER, indexed_normals.size()*sizeof(glm::vec3), indexed_normals2.size()*sizeof(glm::vec3), &indexed_normals2[0]); // Generate a buffer for the indices as well GLuint elementbuffer; glGenBuffers(1, &elementbuffer); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, elementbuffer); //glBufferData(GL_ELEMENT_ARRAY_BUFFER, indices.size() * sizeof(unsigned short), &indices[0] , GL_STATIC_DRAW); glBufferData(GL_ELEMENT_ARRAY_BUFFER, (indices.size()+indices2.size() )* sizeof(unsigned short), 0, GL_STATIC_DRAW); glBufferSubData(GL_ELEMENT_ARRAY_BUFFER, 0 ,indices.size()*sizeof(unsigned short), &indices[0] ); glBufferSubData(GL_ELEMENT_ARRAY_BUFFER, indices.size()*sizeof(unsigned short), indices2.size()*sizeof(unsigned short), &indices2[0]); // Get a handle for our "LightPosition" uniform glUseProgram(programID); GLuint LightID = glGetUniformLocation(programID, "LightPosition_worldspace"); // For speed computation double lastTime = glfwGetTime(); double lastFrameTime = lastTime; int nbFrames = 0; std::cout<<"test0"<<std::endl; float tt = 0.0; do{ // Measure speed double currentTime = glfwGetTime(); float deltaTime = (float)(currentTime - lastFrameTime); lastFrameTime = currentTime; nbFrames++; if ( currentTime - lastTime >= 1.0 ){ // If last prinf() was more than 1sec ago // printf and reset printf("%f ms/frame\n", 1000.0/double(nbFrames)); nbFrames = 0; lastTime += 1.0; } // Clear the screen glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Use our shader glUseProgram(programID); /* // Compute the MVP matrix from keyboard and mouse input // computeMatricesFromInputs(); glm::mat4 ProjectionMatrix = getProjectionMatrix(); glm::mat4 ViewMatrix = getViewMatrix(); glm::mat4 ModelMatrix = glm::mat4(1.0); glm::mat4 MVP = ProjectionMatrix * ViewMatrix * ModelMatrix; // Send our transformation to the currently bound shader, // in the "MVP" uniform glUniformMatrix4fv(MatrixID, 1, GL_FALSE, &MVP[0][0]); glUniformMatrix4fv(ModelMatrixID, 1, GL_FALSE, &ModelMatrix[0][0]); glUniformMatrix4fv(ViewMatrixID, 1, GL_FALSE, &ViewMatrix[0][0]); */ glm::mat4 ProjectionMatrix = glm::perspective(45.0f, 4.0f / 3.0f, 0.1f, 110.0f);// display range glm::mat4 ViewMatrix = glm::lookAt( //glm::vec3( 0, 0, 70 ), // Camera is here glm::vec3( 20,30, 70 ), // Camera is here //glm::vec3(gOrientation1.x,0,0),// and looks here glm::vec3( 0, 0, 0 ), // and looks here //glm::vec3( 0, 1, 0 ) // Head is up (set to 0,-1,0 to look upside-down) glm::vec3( 3, 10, 5 ) // Head is up (set to 0,-1,0 to look upside-down) ); glm::vec3 lightPos = glm::vec3(gPosition1.x,2,10); //glm::vec3 lightPos = glm::vec3(0,2,10); glUniform3f(LightID, lightPos.x, lightPos.y, lightPos.z); // Bind our texture in Texture Unit 0 glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, Texture); // Set our "myTextureSampler" sampler to user Texture Unit 0 glUniform1i(TextureID, 0); // 1rst attribute buffer : vertices glEnableVertexAttribArray(0); glBindBuffer(GL_ARRAY_BUFFER, vertexbuffer); glVertexAttribPointer( 0, // attribute 3, // size GL_FLOAT, // type GL_FALSE, // normalized? 0, // stride (void*)0 // array buffer offset ); // 2nd attribute buffer : UVs glEnableVertexAttribArray(1); glBindBuffer(GL_ARRAY_BUFFER, uvbuffer); glVertexAttribPointer( 1, // attribute 2, // size GL_FLOAT, // type GL_FALSE, // normalized? 0, // stride (void*)0 // array buffer offset ); // 3rd attribute buffer : normals glEnableVertexAttribArray(2); glBindBuffer(GL_ARRAY_BUFFER, normalbuffer); glVertexAttribPointer( 2, // attribute 3, // size GL_FLOAT, // type GL_FALSE, // normalized? 0, // stride (void*)0 // array buffer offset ); // Index buffer glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, elementbuffer); glUniform3f(LightID, lightPos.x, lightPos.y, lightPos.z); { // Euler // As an example, rotate arount the vertical axis at 180\B0/sec /* gOrientation1.z += 3.14159f/2.0f * deltaTime * 5; gOrientation1.x = 3.14159f/2; gPosition1.y = 40; // Build the model matrix glm::mat4 RotationMatrix = eulerAngleYXZ(gOrientation1.y, gOrientation1.x, gOrientation1.z); glm::mat4 TranslationMatrix = translate(mat4(), gPosition1); // A bit to the left glm::mat4 ScalingMatrix = scale(mat4(), vec3(1.0f, 1.0f, 1.0f)); glm::mat4 ModelMatrix = TranslationMatrix * RotationMatrix * ScalingMatrix;*/ gOrientation1.z += 3.14159f/2.0f * deltaTime; gOrientation1.x = 20;3.14159f/2; gPosition1.y = 10; tt = tt + 0.01f; gPosition1.x = 20.0*sin(tt); //gPosition1.z = tt;//20.0*sin(tt); // Build the model matrix glm::mat4 RotationMatrix = eulerAngleYXZ(gOrientation1.y, gOrientation1.x, gOrientation1.z); glm::mat4 TranslationMatrix = translate(mat4(), gPosition1); // A bit to the left glm::mat4 ScalingMatrix = scale(mat4(), vec3(1.0f, 1.0f, 1.0f)); glm::mat4 ModelMatrix = TranslationMatrix * RotationMatrix * ScalingMatrix; // glm::mat4 ModelMatrix = eulerAngleYXZ((float)3,(float)0,(float)0)*translate(mat4(), glm::vec3(5,0,0)) *TranslationMatrix* RotationMatrix * ScalingMatrix; glm::mat4 MVP = ProjectionMatrix * ViewMatrix * ModelMatrix; // Send our transformation to the currently bound shader, // in the "MVP" uniform glUniformMatrix4fv(MatrixID, 1, GL_FALSE, &MVP[0][0]); glUniformMatrix4fv(ModelMatrixID, 1, GL_FALSE, &ModelMatrix[0][0]); glUniformMatrix4fv(ViewMatrixID, 1, GL_FALSE, &ViewMatrix[0][0]); // Draw the triangles ! glDrawElements( GL_TRIANGLES, // mode indices.size(), // count GL_UNSIGNED_SHORT, // type (void*)0 // element array buffer offset ); } //=============================================================================// glEnableVertexAttribArray(0); glBindBuffer(GL_ARRAY_BUFFER, vertexbuffer); glVertexAttribPointer( 0, // attribute 3, // size GL_FLOAT, // type GL_FALSE, // normalized? 0, // stride (void*)(0+indexed_vertices.size()*sizeof(glm::vec3)) // array buffer offset ); // 2nd attribute buffer : UVs glEnableVertexAttribArray(1); glBindBuffer(GL_ARRAY_BUFFER, uvbuffer); glVertexAttribPointer( 1, // attribute 2, // size GL_FLOAT, // type GL_FALSE, // normalized? 0, // stride (void*)(0+indexed_uvs.size()*sizeof(glm::vec2)) // array buffer offset ); // 3rd attribute buffer : normals glEnableVertexAttribArray(2); glBindBuffer(GL_ARRAY_BUFFER, normalbuffer); glVertexAttribPointer( 2, // attribute 3, // size GL_FLOAT, // type GL_FALSE, // normalized? 0, // stride (void*)(0+indexed_normals.size()*sizeof(glm::vec3)) // array buffer offset ); // Index buffer glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, elementbuffer); glUniform3f(LightID, lightPos.x, lightPos.y, lightPos.z); { // Euler // As an example, rotate arount the vertical axis at 180\B0/sec /* gOrientation1.z += 3.14159f/2.0f * deltaTime * 5; gOrientation1.x = 3.14159f/2; gPosition1.y = 40; // Build the model matrix glm::mat4 RotationMatrix = eulerAngleYXZ(gOrientation1.y, gOrientation1.x, gOrientation1.z); glm::mat4 TranslationMatrix = translate(mat4(), gPosition1); // A bit to the left glm::mat4 ScalingMatrix = scale(mat4(), vec3(1.0f, 1.0f, 1.0f)); glm::mat4 ModelMatrix = TranslationMatrix * RotationMatrix * ScalingMatrix;*/ gOrientation1.z += 3.14159f/2.0f * deltaTime/1000.0; gOrientation1.x = 3.14159f/2; gPosition1.y = 10;40; tt = tt + 0.01f; gPosition1.x = 20.0*sin(tt/100.0); //gPosition1.z = tt;//20.0*sin(tt); // Build the model matrix glm::mat4 RotationMatrix = eulerAngleYXZ(gOrientation1.y, gOrientation1.x, gOrientation1.z); glm::mat4 TranslationMatrix = translate(mat4(), gPosition1); // A bit to the left glm::mat4 ScalingMatrix = scale(mat4(), vec3(1.0f, 1.0f, 1.0f)); glm::mat4 ModelMatrix = TranslationMatrix * RotationMatrix * ScalingMatrix; // glm::mat4 ModelMatrix = eulerAngleYXZ((float)3,(float)0,(float)0)*translate(mat4(), glm::vec3(5,0,0)) *TranslationMatrix* RotationMatrix * ScalingMatrix; glm::mat4 MVP = ProjectionMatrix * ViewMatrix * ModelMatrix; // Send our transformation to the currently bound shader, // in the "MVP" uniform glUniformMatrix4fv(MatrixID, 1, GL_FALSE, &MVP[0][0]); glUniformMatrix4fv(ModelMatrixID, 1, GL_FALSE, &ModelMatrix[0][0]); glUniformMatrix4fv(ViewMatrixID, 1, GL_FALSE, &ViewMatrix[0][0]); // Draw the triangles ! glDrawElements( GL_TRIANGLES, // mode indices2.size(), // count GL_UNSIGNED_SHORT, // type (void*)(0 + indices.size()) // element array buffer offset ); } //======================================================================================// glDisableVertexAttribArray(0); glDisableVertexAttribArray(1); glDisableVertexAttribArray(2); // Draw GUI TwDraw(); // Swap buffers glfwSwapBuffers(window); glfwPollEvents(); } // Check if the ESC key was pressed or the window was closed while( glfwGetKey(window, GLFW_KEY_ESCAPE ) != GLFW_PRESS && glfwWindowShouldClose(window) == 0 ); // Cleanup VBO and shader glDeleteBuffers(1, &vertexbuffer); glDeleteBuffers(1, &uvbuffer); glDeleteBuffers(1, &normalbuffer); glDeleteBuffers(1, &elementbuffer); glDeleteProgram(programID); glDeleteTextures(1, &Texture); glDeleteVertexArrays(1, &VertexArrayID); glDeleteVertexArrays(1, &WP_VertexArrayID); } MillerRender::~MillerRender(){ // Close OpenGL window and terminate GLFW glfwTerminate(); } bool MillerRender::initGL(GLFWwindow*& window){ // Initialise GLFW if( !glfwInit() ) { fprintf( stderr, "Failed to initialize GLFW\n" ); return false; } glfwWindowHint(GLFW_SAMPLES, 4); glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); // Open a window and create its OpenGL context window = glfwCreateWindow( 1024, 768, "Tutorial 03 - Matrices", NULL, NULL); if( window == NULL ){ fprintf( stderr, "Failed to open GLFW window. If you have an Intel GPU, they are not 3.3 compatible. Try the 2.1 version of the tutorials.\n" ); glfwTerminate(); return false; } glfwMakeContextCurrent(window); // Initialize GLEW glewExperimental = true; // Needed for core profile if (glewInit() != GLEW_OK) { fprintf(stderr, "Failed to initialize GLEW\n"); return false; } // Ensure we can capture the escape key being pressed below glfwSetInputMode(window, GLFW_STICKY_KEYS, GL_TRUE); glfwSetCursorPos(window, 1024/2, 768/2);// I don't what its function // Dark blue background glClearColor(0.0f, 0.0f, 0.4f, 0.0f); return true; } bool MillerRender::loadAssImp( const char * path, std::vector<unsigned short> & indices, std::vector<glm::vec3> & vertices, std::vector<glm::vec2> & uvs, std::vector<glm::vec3> & normals ){ Assimp::Importer importer; const aiScene* scene = importer.ReadFile( path, aiProcess_CalcTangentSpace| //后处理标志,自动计算切线和副法线 aiProcess_Triangulate| //后处理标志,自动将四边形面转换为三角面 aiProcess_JoinIdenticalVertices| //后处理标志,自动合并相同的顶点 aiProcess_SortByPType); //后处理标志,将不同图元放置到不同的模型中去,图片类型可能是点、直线、三角形等 /// const aiScene* scene = importer.ReadFile(path, 0/*aiProcess_JoinIdenticalVertices | aiProcess_SortByPType*/); if( !scene) { fprintf( stderr, importer.GetErrorString()); getchar(); return false; } const aiMesh* mesh = scene->mMeshes[0]; // In this simple example code we always use the 1rst mesh (in OBJ files there is often only one anyway) // Fill vertices positions vertices.reserve(mesh->mNumVertices); for(unsigned int i=0; i<mesh->mNumVertices; i++){ aiVector3D pos = mesh->mVertices[i]; vertices.push_back(glm::vec3(pos.x, pos.y, pos.z)); } // Fill vertices texture coordinates uvs.reserve(mesh->mNumVertices); for(unsigned int i=0; i<mesh->mNumVertices; i++){ // std::cout<<i<<std::endl; // aiVector3D UVW = mesh->mTextureCoords[0][i]; // Assume only 1 set of UV coords; AssImp supports 8 UV sets. // uvs.push_back(glm::vec2(UVW.x, UVW.y)); } for (unsigned int i = 0; i < mesh->mNumVertices; ++i) { if (mesh->HasTextureCoords(0)) { //uvArray[i * 2 + 0] = mesh->mTextureCoords[0][i].x; //uvArray[i * 2 + 1] = mesh->mTextureCoords[0][i].y; uvs.push_back(glm::vec2(mesh->mTextureCoords[0][i].x, mesh->mTextureCoords[0][i].y)); } } // Fill vertices normals normals.reserve(mesh->mNumVertices); for(unsigned int i=0; i<mesh->mNumVertices; i++){ aiVector3D n = mesh->mNormals[i]; normals.push_back(glm::vec3(n.x, n.y, n.z)); } // Fill face indices indices.reserve(3*mesh->mNumFaces); for (unsigned int i=0; i<mesh->mNumFaces; i++){ // Assume the model has only triangles. indices.push_back(mesh->mFaces[i].mIndices[0]); indices.push_back(mesh->mFaces[i].mIndices[1]); indices.push_back(mesh->mFaces[i].mIndices[2]); } // The "scene" pointer will be deleted automatically by "importer" return true; } bool MillerRender::loadOBJ( const char *path, std::vector<unsigned short> &outIndices, std::vector<glm::vec3> &outVertices, std::vector<glm::vec2> &uvArray, std::vector<glm::vec3> &normalArray ){ Assimp::Importer importer; // 使用导入器导入选定的模型文件 // sintel.obj const aiScene* scene = importer.ReadFile( path, aiProcess_CalcTangentSpace| //后处理标志,自动计算切线和副法线 aiProcess_Triangulate| //后处理标志,自动将四边形面转换为三角面 aiProcess_JoinIdenticalVertices| //后处理标志,自动合并相同的顶点 aiProcess_SortByPType); //后处理标志,将不同图元放置到不同的模型中去,图片类型可能是点、直线、三角形等 //const aiScene* scene = importer.ReadFile(path, aiProcessPreset_TargetRealtime_Fast); if( !scene) { //导入错误,获取错误信息并进行相应的处理 std::cout << importer.GetErrorString()<<std::endl; //DoTheErrorLogging( importer.GetErrorString()); return false; } aiMesh* mesh = scene->mMeshes[0]; int numOfFaces = mesh->mNumFaces; int numOfIndices = numOfFaces * 3; /*outIndices.resize(numOfIndices); for (unsigned int i = 0; i < mesh->mNumFaces; ++i) { //getchar(); //std::cout<<"he"<<std::endl; const aiFace &face = mesh->mFaces[i]; assert(face.mNumIndices == 3); outIndices[i * 3 + 0] = face.mIndices[0]; outIndices[i * 3 + 1] = face.mIndices[1]; outIndices[i * 3 + 2] = face.mIndices[2]; } */ // // Fill face indices outIndices.reserve(3*mesh->mNumFaces); for (unsigned int i=0; i<mesh->mNumFaces; i++){ // Assume the model has only triangles. outIndices.push_back(mesh->mFaces[i].mIndices[0]); outIndices.push_back(mesh->mFaces[i].mIndices[1]); outIndices.push_back(mesh->mFaces[i].mIndices[2]); } // int numOfVertices = mesh->mNumVertices; outVertices.resize(numOfVertices * 3); normalArray.resize(numOfVertices * 3); uvArray.resize(numOfVertices * 2); for (unsigned int i = 0; i < mesh->mNumVertices; ++i) { if (mesh->HasPositions()) { outVertices[i] = glm::vec3(mesh->mVertices[i].x,mesh->mVertices[i].y,mesh->mVertices[i].z); /// outVertices[i * 3 + 0] = mesh->mVertices[i].x; /// outVertices[i * 3 + 1] = mesh->mVertices[i].y; /// outVertices[i * 3 + 2] = mesh->mVertices[i].z; } if (mesh->HasNormals()) { normalArray[i] = glm::vec3(mesh->mNormals[i].x,mesh->mNormals[i].y,mesh->mNormals[i].z); /// normalArray[i * 3 + 0] = mesh->mNormals[i].x; /// normalArray[i * 3 + 1] = mesh->mNormals[i].x; // normalArray[i * 3 + 2] = mesh->mNormals[i].x; } if (mesh->HasTextureCoords(0)) { uvArray[i] = (glm::vec2(mesh->mTextureCoords[0][i].x, mesh->mTextureCoords[0][i].y)); // uvArray[i * 2 + 0] = mesh->mTextureCoords[0][i].x; // uvArray[i * 2 + 1] = mesh->mTextureCoords[0][i].y; } } return true; } void MillerRender::ChangeVerticesCoord(std::vector<glm::vec3>& indexed_vertices){ GLfloat Cx,Cy,Cz; Cx = 0; Cy = 0; Cz = 0; for(int i = 0; i < indexed_vertices.size();i++){ Cx += indexed_vertices[i].x; Cy += indexed_vertices[i].y; Cz += indexed_vertices[i].z; } Cx = Cx/indexed_vertices.size(); Cy = Cy/indexed_vertices.size(); Cz = Cz/indexed_vertices.size(); std::cout<< Cx<<std::endl; std::cout<< Cy<<std::endl; std::cout<< Cz<<std::endl; for(int i = 0; i < indexed_vertices.size();i++){ indexed_vertices[i] = indexed_vertices[i] - glm::vec3(2.1,2.1,Cz); // 2.3 close maybe 2.1 is very close }// 修正模型的位置, 讓旋轉中心看起來像再軸向 } void MillerRender::CalculateIndices( std::vector<unsigned short>& indices){ //int i = 0; indices.resize(101*100*6); for (int y = 0; y < 101; y++) { for (int x = 0; x < 100; x++) { /* indices.push_back(y * 101 + x); indices.push_back(y * 101 + x + 1); indices.push_back((y + 1) * 101 + x + 1); indices.push_back(y * 101 + x+1);// +1 or not ?? I think this indices was wrong, so I add it one indices.push_back((y + 1) * 101 + x + 1); indices.push_back((y + 1) * 101 + x);*/ indices[0 + 6*x + 6*100*y] = y * 101 + x; indices[1 + 6*x + 6*100*y] = y * 101 + x + 1; indices[2 + 6*x + 6*100*y] = (y + 1) * 101 + x + 1; indices[3 + 6*x + 6*100*y] = y * 101 + x+1;// +1 or not ?? I think this indices was wrong, so I add it one indices[4 + 6*x + 6*100*y] = (y + 1) * 101 + x + 1; indices[5 + 6*x + 6*100*y] = (y + 1) * 101 + x; } } }
008e3170a9149d4827cdc0495299caed768166f5
38896951aea62f5b87fcb236c149647513f1889c
/apps/cloud_composer/tools/organized_segmentation.cpp
47d7430fad0e429ecec598ecabb550a701e0cc45
[ "BSD-3-Clause" ]
permissive
PointCloudLibrary/pcl
243714ed366a277f60a8097e133e195f3b91321c
f2492bd65cb1e9c48a60f5e27296e25e1835169a
refs/heads/master
2023-09-04T17:55:05.319149
2023-09-04T07:40:09
2023-09-04T07:40:09
8,162,615
9,065
4,836
NOASSERTION
2023-09-14T19:47:04
2013-02-12T16:40:25
C++
UTF-8
C++
false
false
2,260
cpp
organized_segmentation.cpp
#include <pcl/apps/cloud_composer/tools/organized_segmentation.h> #include <pcl/apps/cloud_composer/items/cloud_item.h> #include <pcl/point_types.h> #include <pcl/filters/extract_indices.h> #include <pcl/kdtree/kdtree.h> #include <pcl/segmentation/extract_clusters.h> #include <pcl/apps/cloud_composer/tools/impl/organized_segmentation.hpp> Q_PLUGIN_METADATA(IID "cloud_composer.ToolFactory/1.0") pcl::cloud_composer::OrganizedSegmentationTool::OrganizedSegmentationTool (PropertiesModel* parameter_model, QObject* parent) : SplitItemTool (parameter_model, parent) { } QList <pcl::cloud_composer::CloudComposerItem*> pcl::cloud_composer::OrganizedSegmentationTool::performAction (ConstItemList input_data, PointTypeFlags::PointType type) { if (type != PointTypeFlags::NONE) { switch ((std::uint8_t) type) { case (PointTypeFlags::XYZ): return this->performTemplatedAction<pcl::PointXYZ> (input_data); case (PointTypeFlags::XYZ | PointTypeFlags::RGB): return this->performTemplatedAction<pcl::PointXYZRGB> (input_data); case (PointTypeFlags::XYZ | PointTypeFlags::RGBA): return this->performTemplatedAction<pcl::PointXYZRGBA> (input_data); } } QList <CloudComposerItem*> output; qCritical () << "organized_segmentation requires templated types!"; return output; } /////////////////// PARAMETER MODEL ///////////////////////////////// pcl::cloud_composer::PropertiesModel* pcl::cloud_composer::OrganizedSegmentationToolFactory::createToolParameterModel (QObject* parent) { PropertiesModel* parameter_model = new PropertiesModel(parent); parameter_model->addProperty ("Min Inliers", 1000, Qt::ItemIsEditable | Qt::ItemIsEnabled); parameter_model->addProperty ("Min Plane Size", 10000, Qt::ItemIsEditable | Qt::ItemIsEnabled); parameter_model->addProperty ("Angular Threshold", 2.0, Qt::ItemIsEditable | Qt::ItemIsEnabled); parameter_model->addProperty ("Distance Threshold", 0.02, Qt::ItemIsEditable | Qt::ItemIsEnabled); parameter_model->addProperty ("Cluster Dist. Thresh.", 0.01, Qt::ItemIsEditable | Qt::ItemIsEnabled); parameter_model->addProperty ("Min Cluster Size", 1000, Qt::ItemIsEditable | Qt::ItemIsEnabled); return parameter_model; }
8d9db92de59d81bb05ce98c2e71c5a35353aa69a
06cc6e99ee1d0a6ad120763ad004c38d757b77cd
/Uva/10539.cpp
04b105a3006edc5b24d0abc520515b16867d453c
[]
no_license
MaicolGomez/ACM
0eddec0ba8325c6bdc07721acc57a361c03c4588
ff23b2c24daa5df1cc864b134886ff81a6d488c7
refs/heads/master
2020-03-06T20:57:14.628666
2018-03-28T01:46:27
2018-03-28T01:51:08
127,066,787
0
0
null
null
null
null
UTF-8
C++
false
false
1,366
cpp
10539.cpp
#include<cstdio> #include<iostream> #include<cstring> #include<vector> #include<cmath> #include<algorithm> #include<climits> #include<set> #include<deque> #include<queue> #include<map> #include<climits> #include<string> #include<stack> #include<sstream> using namespace std; #define pi (2.0*acos(0.0)) #define eps 1e-6 #define ll long long #define inf (1<<30) #define vi vector<int> #define vll vector<ll> #define sc(x) scanf("%d",&x) #define scl(x) scanf("%lld",&x) #define all(v) v.begin() , v.end() #define me(a,val) memset( a , val ,sizeof(a) ) #define pb(x) push_back(x) #define pii pair<int,int> #define mp(a,b) make_pair(a,b) #define Q(x) (x) * (x) #define fi first #define se second #define MOD 10009 #define N 1000000LL bool prime[N+5]; ll L = N*N*1LL; vll v; void sieve(){ for(int i = 2 ; i * i <= N ; i++) if( !prime[i] ) for(int j = i*i ; j <= N ; j+=i) prime[j] = 1; for(ll i = 2 ; i <= N ; i++) if( !prime[i] ){ ll x = i*i; while( x <= L ){ v.pb( x ); x *= i; } } sort( all(v) ); } int main(){ sieve(); int tc; sc(tc); while( tc-- ){ ll l , h; scl(l),scl(h); int r = upper_bound( all(v) , h ) - lower_bound( all(v) , l ); printf("%d\n",r); } return 0; }
2d65c4bbf84352e0469c25d8a00d0fce35c188ca
cb03501a58fdfd38bb32c3c6655f30294c026a0f
/Machines/JoystickMachine.hpp
4a4c754dcf6b7b3cff419fecb5b879b8e2b6f68c
[ "MIT" ]
permissive
TomHarte/CLK
6f19e56cccb05bf8680bb875d8df161e92bad6cb
3e666a08ae547fd9c8787af07b08b3afb53eff61
refs/heads/master
2023-09-01T04:26:12.421586
2023-08-30T01:24:04
2023-08-30T01:24:04
39,225,788
850
51
MIT
2023-09-10T22:08:12
2015-07-16T23:46:52
C++
UTF-8
C++
false
false
442
hpp
JoystickMachine.hpp
// // JoystickMachine.hpp // Clock Signal // // Created by Thomas Harte on 14/10/2017. // Copyright 2017 Thomas Harte. All rights reserved. // #ifndef JoystickMachine_hpp #define JoystickMachine_hpp #include "../Inputs/Joystick.hpp" #include <vector> namespace MachineTypes { class JoystickMachine { public: virtual const std::vector<std::unique_ptr<Inputs::Joystick>> &get_joysticks() = 0; }; } #endif /* JoystickMachine_hpp */
c433f090cadf020c1a5bf4078fd8744a34ae5c8d
e6dfab2339ae9ec35bac1a8029bde39c0cc80132
/cppServer/base/CountDownLatch.h
8251e1f474f66367631b122a51893f334dc755d2
[ "MIT" ]
permissive
dalenWW/cppServer
5945f038f69480f51da98c34f10feb62ff4caf7e
2e1f773e78fe4a146434a212dadb6f37c2c77a60
refs/heads/master
2020-07-08T21:48:33.234148
2019-08-22T12:19:19
2019-08-22T12:19:19
203,760,000
0
0
null
null
null
null
UTF-8
C++
false
false
277
h
CountDownLatch.h
#pragma once #include"Condition.h" #include"noncopyable.h" #include"MutexLock.h" class CountDownLatch:noncopyable { public: explicit CountDownLatch(int count); void wait(); void countDown(); private: MutexLock mutex_; Condition cond_; int count_; };
eedb44518b0d9fa31cef1ea289639307da70f231
dd755386d122ff291b3345b33374b2d4ed0c13d1
/source/examples/demo-stages-plugins/MultiFrameRenderingPipeline.h
e9b5240c489f20cbc2162a0347e7232d864c75be
[ "MIT" ]
permissive
cginternals/gloperate
2526b0ac354d114347f64d06646a64e149ebf1d5
376f5f37c81fabcb39b704bf3d7e42880ac19837
refs/heads/master
2022-06-06T05:44:12.532420
2022-06-03T11:36:36
2022-06-03T11:36:36
23,700,348
35
21
MIT
2022-06-03T11:32:39
2014-09-05T11:16:49
C++
UTF-8
C++
false
false
6,176
h
MultiFrameRenderingPipeline.h
#pragma once #include <cppexpose/plugin/plugin_api.h> #include <gloperate/gloperate-version.h> #include <gloperate/pipeline/Pipeline.h> #include <gloperate/stages/interfaces/CanvasInterface.h> namespace globjects { class NamedString; } namespace gloperate { class Quad; class Camera; class TextureRenderTargetStage; class TextureFromRenderTargetExtractionStage; class TransformStage; class ProgramStage; class RenderPassStage; class RasterizationStage; class ClearStage; } namespace gloperate_glkernel { class DiscDistributionKernelStage; class HemisphereDistributionKernelStage; class NoiseKernelStage; class TransparencyKernelStage; } class GeometryImporterStage; /** * @brief * Demo pipeline that renders a static triangle onto the screen */ class MultiFrameRenderingPipeline : public gloperate::Pipeline { public: CPPEXPOSE_DECLARE_COMPONENT( MultiFrameRenderingPipeline, gloperate::Stage , "" // Tags , "" // Icon , "" // Annotations , "Demo pipeline that renders a static triangle onto the screen" , GLOPERATE_AUTHOR_ORGANIZATION , "v1.0.0" ) public: // Interfaces gloperate::CanvasInterface canvasInterface; ///< Interface for rendering into a viewer // Inputs Input<int> multiFrameCount; ///< Total number of frames to aggregate Input<gloperate::Camera *> camera; ///< Camera provided by navigation Input<bool> useAntialiasing; ///< Flag enabling antialiasing effect Input<bool> useDOF; ///< Flag enabling depth of field effect Input<bool> useSSAO; ///< Flag enabling ssao effect Input<bool> useTransparency; ///< Flag enabling transparency effect Input<float> dofIntensity; ///< Intensity value for DOF Input<float> dofZFocus; ///< Focus distance for DOF Input<float> ssaoRadius; ///< Effect radius for SSAO Input<float> ssaoIntensity; ///< Effect intensity for SSAO Input<float> transparencyAlpha; ///< Alpha value for transparency public: /** * @brief * Constructor * * @param[in] environment * Environment to which the pipeline belongs (must NOT be null!) * @param[in] name * Pipeline name */ MultiFrameRenderingPipeline(gloperate::Environment * environment, const std::string & name = "MultiFrameRenderingPipeline"); /** * @brief * Destructor */ virtual ~MultiFrameRenderingPipeline(); protected: // Virtual Stage interface virtual void onContextInit(gloperate::AbstractGLContext * context); virtual void onContextDeinit(gloperate::AbstractGLContext * context); protected: // Stages // Custom FBO std::unique_ptr<gloperate::TextureRenderTargetStage> m_colorTextureStage; ///< Stage creating color texture for main rendering std::unique_ptr<gloperate::TextureRenderTargetStage> m_depthTextureStage; ///< Stage creating depth texture for main rendering std::unique_ptr<gloperate::TextureRenderTargetStage> m_normalTextureStage; ///< Stage creating normal texture for main rendering // Kernels std::unique_ptr<gloperate_glkernel::DiscDistributionKernelStage> m_subpixelStage; ///< subpixel offsets for antialiasing std::unique_ptr<gloperate_glkernel::DiscDistributionKernelStage> m_dofShiftStage; ///< offsets for depth of field std::unique_ptr<gloperate_glkernel::HemisphereDistributionKernelStage> m_ssaoKernelStage; ///< kernel for SSAO std::unique_ptr<gloperate_glkernel::NoiseKernelStage> m_noiseStage; ///< noise for SSAO & Transparency std::unique_ptr<gloperate_glkernel::TransparencyKernelStage> m_transparencyKernelStage; ///< kernel for transparency // Rendering std::unique_ptr<GeometryImporterStage> m_renderGeometryStage; ///< geometry for rendering step std::unique_ptr<gloperate::TransformStage> m_transformStage; ///< model matrix for rendering std::unique_ptr<gloperate::ProgramStage> m_renderProgramStage; ///< shader program for rendering step std::unique_ptr<gloperate::RenderPassStage> m_renderPassStage; ///< render pass for rendering step std::unique_ptr<gloperate::ClearStage> m_renderClearStage; ///< FBO clear for rendering step std::unique_ptr<gloperate::RasterizationStage> m_renderRasterizationStage; ///< rasterization for rendering step std::unique_ptr<gloperate::ProgramStage> m_postprocessingProgramStage; ///< shader program for postprocessing step std::unique_ptr<gloperate::RenderPassStage> m_postprocessingPassStage; ///< render pass for postprocessing step std::unique_ptr<gloperate::ClearStage> m_postprocessingClearStage; ///< FBO clear for postprocessing step std::unique_ptr<gloperate::RasterizationStage> m_postprocessingRasterizationStage; ///< rasterization for postprocessing step // Rendering ressources std::unique_ptr<globjects::NamedString> m_randomNamedString; ///< named string for shader include std::unique_ptr<globjects::NamedString> m_ssaoNamedString; ///< named string for shader include std::unique_ptr<gloperate::Camera> m_camera; ///< camera for rendering step std::unique_ptr<gloperate::Quad> m_quad; ///< geometry for postprocessing step };
d40dae1d9bed34b45790950d73e210922b257966
45e0fbd9a9dbcdd4fbe6aaa2fdb2aed296f81e33
/FindSecret/Classes/Native/mscorlib_System_IO_BinaryReader2428077293.h
21f22129ed07567972cf13ef62c1b51050e2ca6d
[ "MIT" ]
permissive
GodIsWord/NewFindSecret
d4a5d2d810ee1f9d6b3bc91168895cc808bac817
4f98f316d29936380f9665d6a6d89962d9ee5478
refs/heads/master
2020-03-24T09:54:50.239014
2018-10-27T05:22:11
2018-10-27T05:22:11
142,641,511
0
0
null
null
null
null
UTF-8
C++
false
false
3,922
h
mscorlib_System_IO_BinaryReader2428077293.h
#pragma once #include "il2cpp-config.h" #ifndef _MSC_VER # include <alloca.h> #else # include <malloc.h> #endif #include <stdint.h> #include "mscorlib_System_Object3080106164.h" // System.IO.Stream struct Stream_t1273022909; // System.Text.Encoding struct Encoding_t1523322056; // System.Byte[] struct ByteU5BU5D_t4116647657; // System.Text.Decoder struct Decoder_t2204182725; // System.Char[] struct CharU5BU5D_t3528271667; #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.IO.BinaryReader struct BinaryReader_t2428077293 : public Il2CppObject { public: // System.IO.Stream System.IO.BinaryReader::m_stream Stream_t1273022909 * ___m_stream_0; // System.Text.Encoding System.IO.BinaryReader::m_encoding Encoding_t1523322056 * ___m_encoding_1; // System.Byte[] System.IO.BinaryReader::m_buffer ByteU5BU5D_t4116647657* ___m_buffer_2; // System.Text.Decoder System.IO.BinaryReader::decoder Decoder_t2204182725 * ___decoder_3; // System.Char[] System.IO.BinaryReader::charBuffer CharU5BU5D_t3528271667* ___charBuffer_4; // System.Boolean System.IO.BinaryReader::m_disposed bool ___m_disposed_5; public: inline static int32_t get_offset_of_m_stream_0() { return static_cast<int32_t>(offsetof(BinaryReader_t2428077293, ___m_stream_0)); } inline Stream_t1273022909 * get_m_stream_0() const { return ___m_stream_0; } inline Stream_t1273022909 ** get_address_of_m_stream_0() { return &___m_stream_0; } inline void set_m_stream_0(Stream_t1273022909 * value) { ___m_stream_0 = value; Il2CppCodeGenWriteBarrier(&___m_stream_0, value); } inline static int32_t get_offset_of_m_encoding_1() { return static_cast<int32_t>(offsetof(BinaryReader_t2428077293, ___m_encoding_1)); } inline Encoding_t1523322056 * get_m_encoding_1() const { return ___m_encoding_1; } inline Encoding_t1523322056 ** get_address_of_m_encoding_1() { return &___m_encoding_1; } inline void set_m_encoding_1(Encoding_t1523322056 * value) { ___m_encoding_1 = value; Il2CppCodeGenWriteBarrier(&___m_encoding_1, value); } inline static int32_t get_offset_of_m_buffer_2() { return static_cast<int32_t>(offsetof(BinaryReader_t2428077293, ___m_buffer_2)); } inline ByteU5BU5D_t4116647657* get_m_buffer_2() const { return ___m_buffer_2; } inline ByteU5BU5D_t4116647657** get_address_of_m_buffer_2() { return &___m_buffer_2; } inline void set_m_buffer_2(ByteU5BU5D_t4116647657* value) { ___m_buffer_2 = value; Il2CppCodeGenWriteBarrier(&___m_buffer_2, value); } inline static int32_t get_offset_of_decoder_3() { return static_cast<int32_t>(offsetof(BinaryReader_t2428077293, ___decoder_3)); } inline Decoder_t2204182725 * get_decoder_3() const { return ___decoder_3; } inline Decoder_t2204182725 ** get_address_of_decoder_3() { return &___decoder_3; } inline void set_decoder_3(Decoder_t2204182725 * value) { ___decoder_3 = value; Il2CppCodeGenWriteBarrier(&___decoder_3, value); } inline static int32_t get_offset_of_charBuffer_4() { return static_cast<int32_t>(offsetof(BinaryReader_t2428077293, ___charBuffer_4)); } inline CharU5BU5D_t3528271667* get_charBuffer_4() const { return ___charBuffer_4; } inline CharU5BU5D_t3528271667** get_address_of_charBuffer_4() { return &___charBuffer_4; } inline void set_charBuffer_4(CharU5BU5D_t3528271667* value) { ___charBuffer_4 = value; Il2CppCodeGenWriteBarrier(&___charBuffer_4, value); } inline static int32_t get_offset_of_m_disposed_5() { return static_cast<int32_t>(offsetof(BinaryReader_t2428077293, ___m_disposed_5)); } inline bool get_m_disposed_5() const { return ___m_disposed_5; } inline bool* get_address_of_m_disposed_5() { return &___m_disposed_5; } inline void set_m_disposed_5(bool value) { ___m_disposed_5 = value; } }; #ifdef __clang__ #pragma clang diagnostic pop #endif
38a121275450a04d53b2b456e4d8152d7c57e477
6b2a8dd202fdce77c971c412717e305e1caaac51
/solutions_5658571765186560_1/C++/pranavPrakash/main.cpp
c5aa9da98d2b63998ad15aea6d95543d808c4c1b
[]
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
1,515
cpp
main.cpp
// // main.cpp // Codejam D // // Created by Pranav Prakash on 4/11/15. // Copyright (gridC) 2015 Pranav Prakash. All rights reserved. // #include <iostream> #include <fstream> #include <vector> using namespace std; int main(int argc, const char *argv[]) { ifstream fin("input.txt"); ofstream fout("output.txt"); int numTestCases; fin >> numTestCases; for (int testCase = 1; testCase <= numTestCases; testCase++) { int xOminoe, gridR, gridC; fin >> xOminoe >> gridR >> gridC; bool possible = true; if (xOminoe >= 7) { possible = false; } else if (xOminoe > gridR and xOminoe > gridC) { possible = false; } else if (gridR * gridC % xOminoe != 0) { possible = false; } else if ((xOminoe + 1) / 2 > min(gridR, gridC)) { possible = false; } else if (xOminoe == 1 or xOminoe == 2 or xOminoe == 3) { possible = true; } else if (xOminoe == 4) { possible = min(gridR, gridC) > 2; } else if (xOminoe == 5) { possible = !(min(gridR, gridC) == 3 and max(gridR, gridC) == 5); } else if (xOminoe == 6) { possible = min(gridR, gridC) > 3; } fout << "Case #" << testCase << ": " << (possible ? "GABRIEL" : "RICHARD") << '\n'; } return 0; }
4a30c3e47e123f23d855c017e493f2603133f871
0eff74b05b60098333ad66cf801bdd93becc9ea4
/second/download/CMake/CMake-gumtree/Kitware_CMake_repos_basic_block_block_17661.cpp
9a402eaf01eb823630385d2243868bdde122f24c
[]
no_license
niuxu18/logTracker-old
97543445ea7e414ed40bdc681239365d33418975
f2b060f13a0295387fe02187543db124916eb446
refs/heads/master
2021-09-13T21:39:37.686481
2017-12-11T03:36:34
2017-12-11T03:36:34
null
0
0
null
null
null
null
UTF-8
C++
false
false
425
cpp
Kitware_CMake_repos_basic_block_block_17661.cpp
{ case ENCRYPTION_TRADITIONAL: additional_size = TRAD_HEADER_SIZE; version_needed = 20; break; case ENCRYPTION_WINZIP_AES128: additional_size = WINZIP_AES128_HEADER_SIZE + AUTH_CODE_SIZE; version_needed = 20; break; case ENCRYPTION_WINZIP_AES256: additional_size = WINZIP_AES256_HEADER_SIZE + AUTH_CODE_SIZE; version_needed = 20; break; default: break; }
50599112362b2d7aca43e6da3e7e55a451cbeec6
dfb55f89c667b28b65f05394ba5a93a3ce55915a
/P3/number_prod.cc
7f9fa2106e72db441ed5a092efb82fcdaef7f925
[]
no_license
davidas1798/CyA
edde41c3cca22bac2bd758133c78576eb903d7c4
a87d233ccbe8b23447be11ed4ca28f99f60a4709
refs/heads/main
2023-01-22T09:08:56.290479
2020-12-02T15:05:58
2020-12-02T15:05:58
303,405,134
0
0
null
null
null
null
UTF-8
C++
false
false
634
cc
number_prod.cc
#include "number_prod.h" NumberProd::NumberProd(int a, int b): operand_a(a), operand_b(b), number_(a * b) {} int NumberProd::GetNumber() { return number_; } bool NumberProd::operator<(const NumberProd& other) const { if(number_ == other.number_) { if((operand_a + operand_b) < (other.operand_a + other.operand_b)) return true; else return false; } else { if(number_ < other.number_) return true; else return false; } } ostream& operator<<(ostream& os, NumberProd& input) { os << input.number_ << " <- " << input.operand_a << " * " << input.operand_b; return os; }
0bcceb82dee335f330ab93c477755653918d3c67
fec89b0bcce87216ef9fe55d8b6f1799a6ef9be8
/NavMesh.cpp
81dfbd6eac717f1b4eb399da4cee62d9b2e4ce23
[]
no_license
samengEljest/AI-pathfinding
b76191d8868587ae3e41aaf594ffa997f0f085ff
b5c3a96d2c7f05a1a4ec522947086f0d30206b06
refs/heads/master
2021-01-22T02:52:48.371491
2017-09-07T16:18:47
2017-09-07T16:18:47
102,255,039
1
0
null
null
null
null
UTF-8
C++
false
false
9,897
cpp
NavMesh.cpp
//! NavMesh.cpp #include "NavMesh.h" #include "Tile.h" #include <fstream> #include <iostream> using namespace std; NavMesh::NavMesh() { } NavMesh::~NavMesh() {} bool NavMesh::ReadMap(std::string s) { int y = 0; int x = 0; std::vector<char> list; fstream loadFile; loadFile.open (s, ifstream::in); while (loadFile.good()) { list.push_back(loadFile.get()); } for(int j = 0; j < list.size(); j++) { const char noWak = char(88); const char wak = char(48); const char start = char(83); const char goal = char(71); if(list[j] == noWak) { Tile* t = new Tile(x, y, false); tileList.push_back(t); } else if(list[j] == wak) { Tile* t = new Tile(x, y, true); tileList.push_back(t); } else if(list[j] == start) { Tile* t = new Tile(x, y, true); t->start = true; tileList.push_back(t); } else if(list[j] == goal) { Tile* t = new Tile(x, y, true); t->goal = true; tileList.push_back(t); } else { y++; x = -1; } x++; } findNeighbors(); return true; } void NavMesh::findNeighbors() { for(int i = 0; i < tileList.size(); i++) { if(tileList[i]->walkable) //only walkables have neighbors { for(int j = 0; j < tileList.size(); j++) //find other tiles next to this tile { if(tileList[j]->x == tileList[i]->x+1 && tileList[j]->y == tileList[i]->y && tileList[j]->walkable) { tileList[i]->neighbors.push_back(tileList[j]); } else if(tileList[j]->x == tileList[i]->x-1 && tileList[j]->y == tileList[i]->y+1 && tileList[j]->walkable) { tileList[i]->neighbors.push_back(tileList[j]); } else if(tileList[j]->x == tileList[i]->x && tileList[j]->y == tileList[i]->y+1 && tileList[j]->walkable) { tileList[i]->neighbors.push_back(tileList[j]); } else if(tileList[j]->x == tileList[i]->x+1 && tileList[j]->y == tileList[i]->y+1 && tileList[j]->walkable) { tileList[i]->neighbors.push_back(tileList[j]); } else if(tileList[j]->x == tileList[i]->x-1 && tileList[j]->y == tileList[i]->y-1 && tileList[j]->walkable) { tileList[i]->neighbors.push_back(tileList[j]); } else if(tileList[j]->x == tileList[i]->x && tileList[j]->y == tileList[i]->y-1 && tileList[j]->walkable) { tileList[i]->neighbors.push_back(tileList[j]); } else if(tileList[j]->x == tileList[i]->x+1 && tileList[j]->y == tileList[i]->y-1 && tileList[j]->walkable) { tileList[i]->neighbors.push_back(tileList[j]); } else if(tileList[j]->x == tileList[i]->x-1 && tileList[j]->y == tileList[i]->y && tileList[j]->walkable) { tileList[i]->neighbors.push_back(tileList[j]); } } } } } void NavMesh::UpdateList() { for(int i = 0; i < tileList.size(); i++) { tileList[i]->searched = false; tileList[i]->flaggdOpen = false; tileList[i]->flaggedClosed = false; tileList[i]->parent = NULL; } } std::vector<Tile*> NavMesh::getList() { return tileList; } bool NavMesh::Expand(int x) { Tile* t = tileList[x]; //the tile we are looking at //dont expand on this if it ia non walkable, flaggd(removed from list), is a goal or is start if(t->walkable && !t->flagged && !t->goal && !t->start) { int i = rand() % t->neighbors.size(); //takes an random neighbor to start expanding with for(i; i < t->neighbors.size(); i++) { Tile* t2 = t->neighbors[i%t->neighbors.size()]; //neghboring tile to t if(!t2->flagged && !t2->goal && !t2->start) //if the neighbor in not flagged, goal or start { int intersect = Intersect(t, t2); //check what way to expand //if expanding if(intersect == 1 || intersect == 2) { //if expanding on x if(intersect == 1) { //if negbor is on left side if(t->x > t2->x) { for(int j = 0; j < t->neighbors.size(); j++) //relink steal negbor { if(!neighborCheck(t->neighbors[j], t2)) { t2->neighbors.push_back(t->neighbors[j]); for(int k = 0; k < t->neighbors[j]->neighbors.size(); k++) { if(t->neighbors[j]->neighbors[k] == t) { t->neighbors[j]->neighbors[k] = t2; } } } } t2->width += t->width; //make width bigger tileList[x]->flagged = true; //flagg for removed from main list return true; } //if negbor is on right side else { for(int j = 0; j < t2->neighbors.size(); j++) //relink steal negbor { if(!neighborCheck(t2->neighbors[j], t)) { t->neighbors.push_back(t2->neighbors[j]); for(int k = 0; k < t2->neighbors[j]->neighbors.size(); k++) { if(t2->neighbors[j]->neighbors[k] == t2) { t2->neighbors[j]->neighbors[k] = t; } } } } t->width += t2->width; //make width bigger for(int k = 0; k < tileList.size(); k++) { if(t2 == tileList[k]) { tileList[k]->flagged = true; //flagged to true for removal from main list return true; } } } } //if expanding on y else { //if negbor is above if(t->y > t2->y) { for(int j = 0; j < t->neighbors.size(); j++) //relink steal negbor { if(!neighborCheck(t->neighbors[j], t2)) { t2->neighbors.push_back(t->neighbors[j]); for(int k = 0; k < t->neighbors[j]->neighbors.size(); k++) { if(t->neighbors[j]->neighbors[k] == t) { t->neighbors[j]->neighbors[k] = t2; } } } } t2->height += t->height; //make height bigger tileList[x]->flagged = true; //flagg for removal from main list return true; } //if neghbor is below else { for(int j = 0; j < t2->neighbors.size(); j++) //relink steal negbor { if(!neighborCheck(t2->neighbors[j], t)) { t->neighbors.push_back(t2->neighbors[j]); for(int k = 0; k < t2->neighbors[j]->neighbors.size(); k++) { if(t2->neighbors[j]->neighbors[k] == t2) { t2->neighbors[j]->neighbors[k] = t; } } } } t->height += t2->height; //make height bigger for(int k = 0; k < tileList.size(); k++) { if(t2 == tileList[k]) { tileList[k]->flagged = true; //flagg this tile for removal from main list return true; } } } } } } } } return false; } bool NavMesh::neighborCheck(Tile* neighbor, Tile* t) { for(int j = 0; j < t->neighbors.size(); j++) { //see if the naighbor list contains this naighbor if(t->neighbors[j] == neighbor) { return true; } //make shureeee if the neighbor isent me if(neighbor == t) { return true; } } //return false puts this naighbor in naighber list return false; } int NavMesh::Intersect(Tile* t, Tile* t2) { vector<float> test; vector<float> test2; //calculates the corners of t float vertexULX = t->x * 16; float vertexULY = t->y * 16 * -1; float vertexURX = vertexULX + (t->width * 16); float vertexURY = vertexULY; float vertexLLX = vertexULX; float vertexLLY = vertexULY - (t->height * 16); float vertexLRX = vertexURX; float vertexLRY = vertexLLY; test.push_back(vertexULX); test.push_back(vertexULY); test.push_back(vertexURX); test.push_back(vertexURY); test.push_back(vertexLLX); test.push_back(vertexLLY); test.push_back(vertexLRX); test.push_back(vertexLRY); //calculates the corners of t2 float vertexULX2 = t2->x * 16; float vertexULY2 = t2->y * 16 * -1; float vertexURX2 = vertexULX2 + (t2->width * 16); float vertexURY2 = vertexULY2; float vertexLLX2 = vertexULX2; float vertexLLY2 = vertexULY2 - (t2->height * 16); float vertexLRX2 = vertexURX2; float vertexLRY2 = vertexLLY2; test2.push_back(vertexULX2); test2.push_back(vertexULY2); test2.push_back(vertexURX2); test2.push_back(vertexURY2); test2.push_back(vertexLLX2); test2.push_back(vertexLLY2); test2.push_back(vertexLRX2); test2.push_back(vertexLRY2); int same = 0; vector<float> vectorsaveX; vector<float> vectorsaveY; //finds corners that are the same between t and t2 for(int i = 0; i < test.size(); i+=2) { for(int j = 0; j < test2.size(); j+=2) { if(test[i] == test2[j] && test[i+1] == test2[j+1]) { same++; //saves the two corners in an vector for later use vectorsaveX.push_back(test[i]); vectorsaveY.push_back(test[i+1]); } } } if(same > 1) //if there is more then one corner that is the same(will always be two) { //cout<<"Not intersecting: "<<t2->x<<", "<<t2->y<<endl; if(vectorsaveX[0] == vectorsaveX[1]) //see if the tilees shares x values, to be able to know if it takes ower a tile on x or y side { return 1; } else { return 2; } } else { //cout<<"Intersecting: "<<t2->x<<", "<<t2->y<<endl; return 0; } } void NavMesh::calcNodes() { //sets the node in the middle of the tile for(int i = 0; i < tileList.size(); i++) { float vertexULX = tileList[i]->x * 16; float vertexULY = tileList[i]->y * 16 * -1; float vertexURX = vertexULX + (tileList[i]->width * 16); float vertexURY = vertexULY; float vertexLLX = vertexULX; float vertexLLY = vertexULY - (tileList[i]->height * 16); float vertexLRX = vertexURX; float vertexLRY = vertexLLY; tileList[i]->nodeX = (vertexULX+vertexLRX)/2; tileList[i]->nodeY = (vertexULY+vertexLRY)/2; } }
071dea0e401dc78bd16de5e7ee0d4a113f906127
12b0490737789f12296177bb8642c32f1158ebcb
/DirectX/cpptest.cpp/cpptest.cpp
6158ce3ab688d5fd510ce4d2066ddbef3c820da8
[]
no_license
dinodragon/mygooglecode
ef2775f09bed4fd583eec4524e3675bca150e5e3
1a5525ec6ef1b88f94af55a101d520e1aab83100
refs/heads/master
2021-01-10T12:05:09.301836
2013-03-25T04:02:32
2013-03-25T04:02:32
36,418,668
2
1
null
null
null
null
GB18030
C++
false
false
770
cpp
cpptest.cpp
#include <iostream> #include <math.h> using namespace std; typedef struct { int x; int y; } POINT; #define mid(a,b) ((a)+(b))/(2.0f) void main() { POINT b = {100,0}, c = {100,100}; //右下角 POINT p = {80,100}; //控制点 POINT x1,x2,x3; float k = (c.y-p.y)/float(c.x - p.x); //对称轴的斜率 //对称轴方程 y = -kx+z float z = k * (mid(p.x,c.x)) + mid(p.y,c.y); x1.y = c.y; x1.x = (mid(p.y,c.y) - x1.y)*k + mid(p.x,c.x); x2.y = b.y; x2.x = (mid(p.y,c.y) - x2.y)*k + mid(p.x,c.x); x3.x = 2*(k*z-b.x-k*b.y)/(k*k -1) - b.x; x3.y = 2*((k*z-b.x-k*b.y)/(1-k) + z) - b.y; cout<<"x1("<<x1.x<<","<<x1.y<<")"<<endl; cout<<"x2("<<x2.x<<","<<x2.y<<")"<<endl; cout<<"x3("<<x3.x<<","<<x3.y<<")"<<endl; }
207dff563865dc69b197b623566ca460008f9d01
204cd8e362c7c355eb2b89cb43cdea9038fafcc0
/CH04/Ex01/Ex01/Ex01.cpp
10ca6bf01f24fd9c3de5f9f0c12ee738aa35da4d
[]
no_license
zajac-mc/Stroustrup
934f7c739d5d9031c217daade1ca6c4e451ba8cb
e0f182058735cd43199bf0c5ead2b29d6230b165
refs/heads/master
2021-04-26T23:11:50.876057
2019-04-10T16:25:33
2019-04-10T16:25:33
123,944,914
0
0
null
null
null
null
UTF-8
C++
false
false
874
cpp
Ex01.cpp
// Marcin Zajac 02 03 2018 // Stroustrup Rozdzial 04 Ex 01-05 #include "../../../std_lib_facilities.h" int main() { double a = 0; double b = 0; char znak_konca = '|'; char ch = ' '; while (ch != znak_konca) { cout << "Podaj dwie liczby: "; cin >> a >> b; cout << "Podales " << a << " i " << b << endl; if (a < b) { cout << "Mniejsza z liczb to: " << a << endl; if (b - a < 1.0 / 100) cout << "Liczby sa prawie rowne\n"; } else if (b < a) { cout << "Mniejsza z liczb to: " << b << endl; if (a - b < 1.0 / 100) cout << "Liczby sa prawie rowne.\n"; } else if (a == b) cout << "Liczby sa rowne\n"; else cout << "Cos poszlo nie tak:("; cout << "Jesli chcesz zakonczyc dzialanie programu wpisz znak '|'," << endl << "Jesli chcesz kontynuowac wprowadz dowolny inny znak: "; cin >> ch; } keep_window_open(); return 0; }
059f9c5fe9fd3b5e5359191aaa50b5a1b6f8fee6
5e8d200078e64b97e3bbd1e61f83cb5bae99ab6e
/main/source/src/apps/benchmark/performance/DatabaseIO.bench.hh
f023b2224962ced11d0079af9b6d3e99ac23baa6
[]
no_license
MedicaicloudLink/Rosetta
3ee2d79d48b31bd8ca898036ad32fe910c9a7a28
01affdf77abb773ed375b83cdbbf58439edd8719
refs/heads/master
2020-12-07T17:52:01.350906
2020-01-10T08:24:09
2020-01-10T08:24:09
232,757,729
2
6
null
null
null
null
UTF-8
C++
false
false
1,780
hh
DatabaseIO.bench.hh
// -*- mode:c++;tab-width:2;indent-tabs-mode:t;show-trailing-whitespace:t;rm-trailing-spaces:t -*- // vi: set ts=2 noet: // // (c) Copyright Rosetta Commons Member Institutions. // (c) This file is part of the Rosetta software suite and is made available under license. // (c) The Rosetta software is developed by the contributing members of the Rosetta Commons. // (c) For more information, see http://www.rosettacommons.org. Questions about this can be // (c) addressed to University of Washington CoMotion, email: license@uw.edu. /// @file rosetta/benchmark/pdb_io.bench.cc /// /// @brief Performance benchmark for database input output /// @author Tim Jacobs #include <apps/benchmark/performance/performance_benchmark.hh> #include <core/pose/Pose.hh> #include <fstream> #include <numeric/random/random.hh> #include <utility/vector1.hh> #include <utility/sql_database/DatabaseSessionManager.hh> #include <utility/sql_database/types.hh> #include <protocols/features/helixAssembly/ConcurrencyTest.hh> class DatabaseIOBenchmark : public PerformanceBenchmark { public: utility::sql_database::sessionOP db_session_; protocols::features::StructureFeatures structure_feature_; protocols::features::helixAssembly::ConcurrencyTest test_feature_; DatabaseIOBenchmark(std::string name) : PerformanceBenchmark(name) {}; virtual void setUp() { db_session_ = get_db_session( utility::sql_database::DatabaseMode::sqlite3, "db_io_benchmark.db3"); test_feature_.write_schema_to_db(db_session); } virtual void run(core::Real /*scaleFactor*/) { core::pose::Pose pose; StructureID struct_id = numeric::random::random_range(0, INT_MAX); test_feature_.report_features(pose, struct_id, db_session_); }; virtual void tearDown() { db_session_ = 0; } };
5e46b3fb6110b6c041c58846b4ee870da0c65d16
e0a15d6a8c6c16b3732063dedc7b38b82ec3074d
/C++/taktak.cpp
554b72077bc102e0092751cd8af5a37222b71f89
[]
no_license
Dharana23/Competitive-Coding
3ccce7071015d4bd20965668fe024dbcc2818343
3760ffc95547d2331ffab5f4c8eae9985029067a
refs/heads/master
2022-10-11T16:40:44.033279
2020-06-12T09:55:15
2020-06-12T09:55:15
255,526,714
1
0
null
null
null
null
UTF-8
C++
false
false
443
cpp
taktak.cpp
#include<bits/stdc++.h> using namespace std; bool canDistributeEqually(int fruits) { if((fruits % 11) == 1) { return true; } else { return false; } } int main() { freopen("taktakin.txt", "r", stdin); freopen("taktakout.txt", "w", stdout); int fruits; cin >> fruits; int fullMoons = 0; while(!canDistributeEqually(fruits)) { fullMoons += 1; fruits = 2 * fruits; } cout << fullMoons <<" " << fruits << endl; return 0; }
4592ae184327244060ac15b7a42cc1816280c775
80a6dcd8e0e55b1ec225e4e82d8b1bed100fdcd5
/Demux/20.03.22/34.cpp
0a0e38fae6f0c9c72478052d3857630874be88cd
[]
no_license
arnabs542/competitive-programming-1
58b54f54cb0b009f1dac600ca1bac5a4c1d7a523
3fa3a62277e5cd8a94d1baebb9ac26fe89211da3
refs/heads/master
2023-08-14T23:53:22.941834
2021-10-14T11:26:21
2021-10-14T11:26:21
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,215
cpp
34.cpp
// https://leetcode.com/problems/find-first-and-last-position-of-element-in-sorted-array/ class Solution { public: vector<int> searchRange(vector<int>& nums, int target) { vector<int> v; int lb, ub; if(!nums.size()){ v.push_back(-1); v.push_back(-1); return v; } int lo, hi, mid; lo = 0, hi = nums.size()-1; while(lo<hi){ mid = lo+(hi-lo)/2; if(nums[mid] >= target) hi = mid; else lo = mid+1; } if(nums[lo] >= target) lb = lo; else lb = INT_MAX; lo = 0, hi = nums.size()-1; while(lo<hi){ mid = lo+(hi-lo+1)/2; if(nums[mid] > target) hi = mid-1; else lo = mid; } if(!(nums[lo] > target)) ub = lo; else ub = -1; if(lb<=ub){ v.push_back(lb); v.push_back(ub); return v; } else{ v.push_back(-1); v.push_back(-1); return v; } } };
f5854c35c449b3422f3718ce706ca79513508bbd
36bb83633ee4deed991eadd975c36a1ba9605096
/generichid/testinputvalue.cpp
869e061fc1c8eca612c1f346c1afea14d03c547c
[]
no_license
ftkalcevic/GenericHID
1b07a26ecfb47f761164f124626baa80bc6f7d1b
07c192710263871a3416d2e3e8bf7443d1b0e22f
refs/heads/master
2021-01-10T20:54:01.824366
2019-10-23T10:01:04
2019-10-23T10:01:04
34,788,505
7
4
null
2015-08-05T20:14:35
2015-04-29T10:50:06
C++
UTF-8
C++
false
false
2,366
cpp
testinputvalue.cpp
// generichid, DIY HID device // Copyright (C) 2009, Frank Tkalcevic, www.franksworkshop.com // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // any later version. // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. #include "stdafx.h" #include "testinputvalue.h" #include "hidparser.h" TestInputValue::TestInputValue(const QString &sName, struct HID_ReportItem_t *pHIDItem, QWidget *parent) : TestInput("TestInputValue",pHIDItem->ReportID,parent) , m_nValue( pHIDItem->Value ) { QGridLayout *layout = new QGridLayout(); m_pbValue = new QProgressBar(); m_pbValue->setRange( pHIDItem->Attributes.LogicalMinimum, pHIDItem->Attributes.LogicalMaximum ); m_pbValue->setTextVisible( false ); m_pbValue->setMinimumWidth( 60 ); QLabel *lblName = new QLabel(); lblName->setText( sName ); layout->addWidget( lblName, 0, 0 ); layout->addWidget( m_pbValue, 1, 0 ); layout->addWidget( new QLabel("Logical"), 0, 1 ); layout->addWidget( new QLabel("Physical"), 1, 1 ); m_lblLogical = new QLabel(); m_lblPhysical = new QLabel(); layout->addWidget( m_lblLogical, 0, 2 ); layout->addWidget( m_lblPhysical, 1, 2 ); setLayout( layout ); m_nLogicalMin = pHIDItem->Attributes.LogicalMinimum; m_nLogicalMax = pHIDItem->Attributes.LogicalMaximum; m_nPhysicalMin = pHIDItem->Attributes.PhysicalMinimum; m_nPhysicalMax = pHIDItem->Attributes.PhysicalMaximum; } TestInputValue::~TestInputValue() { } void TestInputValue::Update() { m_pbValue->setValue( m_nValue ); m_lblLogical->setText( QString("%1").arg(m_nValue) ); int nPhysical = m_nValue; if ( m_nPhysicalMin != m_nPhysicalMax) nPhysical = (m_nPhysicalMax - m_nPhysicalMin) * (m_nValue - m_nLogicalMin) / (m_nLogicalMax - m_nLogicalMin) + m_nPhysicalMin; m_lblPhysical->setText(QString("%1").arg(nPhysical) ); }
7a36db649651e9a9b169244008a447dd6fd7fbb8
654e42a8405d0ee09910cf64dca8427d5ce7c680
/modules/JRPowObj.h
45ed269ce2d223da28722a04619f189a081aba41
[]
no_license
neattools/neattools
bbd94d46c4e5aeb1ab524bf63a9b1ac623e7fd58
ac63c05ba1d575797303e48558fa2383a5e8ccf7
refs/heads/master
2020-05-29T17:34:04.002088
2018-03-01T15:59:04
2018-03-01T15:59:04
17,801,058
0
0
null
2018-03-01T15:59:05
2014-03-16T14:29:07
C++
UTF-8
C++
false
false
325
h
JRPowObj.h
#if !defined( _JRPowObj_h ) #define _JRPowObj_h #include "JRDivideObj.h" class JRPowObj : public JRDivideObj { public: virtual const char* className() const; virtual JObject* clone() const; virtual void draw(JGraphics g, int x, int y, int w, int h); virtual void engine(int n, JLinkObj& link); }; #endif