Dxf庫中的DL_Codes類

在 DXF 文件格式中,DL_Codes?通常是一個用于表示不同類型數據的枚舉類或常量集合。這些代碼用于標識 DXF 文件中各種數據元素的類型,例如實體類型、屬性類型、顏色值等。通過使用?DL_Codes,您可以更輕松地解析和處理 DXF 文件中的數據。

以下是一個簡單的示例,展示了如何在 DXF 文件解析中使用?DL_Codes

enum DL_Codes {// 實體類型代碼ENTITY_TYPE_LINE = 0,ENTITY_TYPE_CIRCLE = 1,ENTITY_TYPE_ARC = 2,// 顏色代碼COLOR_RED = 1,COLOR_GREEN = 2,COLOR_BLUE = 3,// 線型代碼LINE_TYPE_CONTINUOUS = 0,LINE_TYPE_DASHED = 1,LINE_TYPE_DOTTED = 2
};// 解析 DXF 文件中的實體
void parseEntity(int type, int color, int lineType) {if (type == ENTITY_TYPE_LINE) {// 處理線段實體} else if (type == ENTITY_TYPE_CIRCLE) {// 處理圓實體} else if (type == ENTITY_TYPE_ARC) {// 處理圓弧實體}// 根據顏色和線型處理其他屬性
}// 在解析過程中使用 DL_Codes
parseEntity(ENTITY_TYPE_LINE, COLOR_RED, LINE_TYPE_DASHED);

在上面的示例中,我們定義了一個簡單的?DL_Codes?枚舉類,其中包含了實體類型、顏色、線型等代碼的常量定義。然后,在解析 DXF 文件時,我們可以使用這些常量來識別并處理不同類型的數據元素。

請注意,上面的示例是一個簡化的示例,實際的 DXF 文件解析過程可能會更復雜,具體取決于您的需求和處理邏輯。您可以根據您所使用的 DXF 文件解析庫的 API 設計和文檔,了解如何正確使用?DL_Codes?或類似的枚舉類型。

源碼:

/****************************************************************************
** Copyright (C) 2001-2013 RibbonSoft, GmbH. All rights reserved.
** Copyright (C) 2001 Robert J. Campbell Jr.
**
** This file is part of the dxflib project.
**
** This file is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** Licensees holding valid dxflib Professional Edition licenses may use
** this file in accordance with the dxflib Commercial License
** Agreement provided with the Software.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.ribbonsoft.com for further details.
**
** Contact info@ribbonsoft.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************//*** Defines common DXF codes and constants.*/#ifndef DXF_CODES_H
#define DXF_CODES_H#include "dl_global.h"#if defined(__OS2__)||defined(__EMX__)
#define strcasecmp( s, t ) stricmp( s, t )
#endif#if defined(_WIN32)
#ifndef strcasecmp  // on mingw, strcasecmp is defined
#define strcasecmp( s, t ) stricmp( s, t )
#endif
#endif#ifdef _WIN32
#undef M_PI
#define M_PI 3.14159265358979323846
#endif#ifndef M_PI
#define M_PI 3.1415926535897932384626433832795
#endif#define DL_DXF_MAXLINE      1024
#define DL_DXF_MAXGROUPCODE 1100// used to mark invalid vectors:
// #define DL_DXF_MAXDOUBLE 1.0E+10/*** Codes for colors and DXF versions.*/
class DXFLIB_EXPORT DL_Codes
{
public:/*** Standard DXF colors.*/enum color{black   = 250,green   = 3,red = 1,brown   = 15,yellow  = 2,cyan = 4,magenta = 6,gray    = 8,blue    = 5,l_blue  = 163,l_green = 121,l_cyan  = 131,l_red = 23,l_magenta = 221,l_gray  = 252,white   = 7,bylayer = 256,byblock = 0};/*** Version numbers for the DXF Format.*/enum version{AC1009_MIN,     // R12, minimalisticAC1009,         // R12AC1012,AC1014,AC1015          // R2000};
};// Extended color palette:
// The first entry is only for direct indexing starting with [1]
// Color 1 is red (1,0,0)
const double dxfColors[][3] =
{{      0,      0,      0 },                             // unused{      1,      0,      0 },                             // 1{      1,      1,      0 },{      0,      1,      0 },{      0,      1,      1 },{      0,      0,      1 },{      1,      0,      1 },{      1,      1,      1 },                           // black or white{    0.5,    0.5,    0.5 },{   0.75,   0.75,   0.75 },{      1,      0,      0 },                           // 10{      1,    0.5,    0.5 },{   0.65,      0,      0 },{   0.65,  0.325,  0.325 },{    0.5,      0,      0 },{    0.5,   0.25,   0.25 },{    0.3,      0,      0 },{    0.3,   0.15,   0.15 },{   0.15,      0,      0 },{   0.15,  0.075,  0.075 },{      1,   0.25,      0 },                           // 20{      1,  0.625,    0.5 },{   0.65, 0.1625,      0 },{   0.65, 0.4063,  0.325 },{    0.5,  0.125,      0 },{    0.5, 0.3125,   0.25 },{    0.3,  0.075,      0 },{    0.3, 0.1875,   0.15 },{   0.15, 0.0375,      0 },{   0.15, 0.0938,  0.075 },{      1,    0.5,      0 },                           // 30{      1,   0.75,    0.5 },{   0.65,  0.325,      0 },{   0.65, 0.4875,  0.325 },{    0.5,   0.25,      0 },{    0.5,  0.375,   0.25 },{    0.3,   0.15,      0 },{    0.3,  0.225,   0.15 },{   0.15,  0.075,      0 },{   0.15, 0.1125,  0.075 },{      1,   0.75,      0 },                           // 40{      1,  0.875,    0.5 },{   0.65, 0.4875,      0 },{   0.65, 0.5688,  0.325 },{    0.5,  0.375,      0 },{    0.5, 0.4375,   0.25 },{    0.3,  0.225,      0 },{    0.3, 0.2625,   0.15 },{   0.15, 0.1125,      0 },{   0.15, 0.1313,  0.075 },{      1,      1,      0 },                           // 50{      1,      1,    0.5 },{   0.65,   0.65,      0 },{   0.65,   0.65,  0.325 },{    0.5,    0.5,      0 },{    0.5,    0.5,   0.25 },{    0.3,    0.3,      0 },{    0.3,    0.3,   0.15 },{   0.15,   0.15,      0 },{   0.15,   0.15,  0.075 },{   0.75,      1,      0 },                           // 60{  0.875,      1,    0.5 },{ 0.4875,   0.65,      0 },{ 0.5688,   0.65,  0.325 },{  0.375,    0.5,      0 },{ 0.4375,    0.5,   0.25 },{  0.225,    0.3,      0 },{ 0.2625,    0.3,   0.15 },{ 0.1125,   0.15,      0 },{ 0.1313,   0.15,  0.075 },{    0.5,      1,      0 },                           // 70{   0.75,      1,    0.5 },{  0.325,   0.65,      0 },{ 0.4875,   0.65,  0.325 },{   0.25,    0.5,      0 },{  0.375,    0.5,   0.25 },{   0.15,    0.3,      0 },{  0.225,    0.3,   0.15 },{  0.075,   0.15,      0 },{ 0.1125,   0.15,  0.075 },{   0.25,      1,      0 },                           // 80{  0.625,      1,    0.5 },{ 0.1625,   0.65,      0 },{ 0.4063,   0.65,  0.325 },{  0.125,    0.5,      0 },{ 0.3125,    0.5,   0.25 },{  0.075,    0.3,      0 },{ 0.1875,    0.3,   0.15 },{ 0.0375,   0.15,      0 },{ 0.0938,   0.15,  0.075 },{      0,      1,      0 },                           // 90{    0.5,      1,    0.5 },{      0,   0.65,      0 },{  0.325,   0.65,  0.325 },{      0,    0.5,      0 },{   0.25,    0.5,   0.25 },{      0,    0.3,      0 },{   0.15,    0.3,   0.15 },{      0,   0.15,      0 },{  0.075,   0.15,  0.075 },{      0,      1,   0.25 },                           // 100{    0.5,      1,  0.625 },{      0,   0.65, 0.1625 },{  0.325,   0.65, 0.4063 },{      0,    0.5,  0.125 },{   0.25,    0.5, 0.3125 },{      0,    0.3,  0.075 },{   0.15,    0.3, 0.1875 },{      0,   0.15, 0.0375 },{  0.075,   0.15, 0.0938 },{      0,      1,    0.5 },                           // 110{    0.5,      1,   0.75 },{      0,   0.65,  0.325 },{  0.325,   0.65, 0.4875 },{      0,    0.5,   0.25 },{   0.25,    0.5,  0.375 },{      0,    0.3,   0.15 },{   0.15,    0.3,  0.225 },{      0,   0.15,  0.075 },{  0.075,   0.15, 0.1125 },{      0,      1,   0.75 },                           // 120{    0.5,      1,  0.875 },{      0,   0.65, 0.4875 },{  0.325,   0.65, 0.5688 },{      0,    0.5,  0.375 },{   0.25,    0.5, 0.4375 },{      0,    0.3,  0.225 },{   0.15,    0.3, 0.2625 },{      0,   0.15, 0.1125 },{  0.075,   0.15, 0.1313 },{      0,      1,      1 },                           // 130{    0.5,      1,      1 },{      0,   0.65,   0.65 },{  0.325,   0.65,   0.65 },{      0,    0.5,    0.5 },{   0.25,    0.5,    0.5 },{      0,    0.3,    0.3 },{   0.15,    0.3,    0.3 },{      0,   0.15,   0.15 },{  0.075,   0.15,   0.15 },{      0,   0.75,      1 },                           // 140{    0.5,  0.875,      1 },{      0, 0.4875,   0.65 },{  0.325, 0.5688,   0.65 },{      0,  0.375,    0.5 },{   0.25, 0.4375,    0.5 },{      0,  0.225,    0.3 },{   0.15, 0.2625,    0.3 },{      0, 0.1125,   0.15 },{  0.075, 0.1313,   0.15 },{      0,    0.5,      1 },                           // 150{    0.5,   0.75,      1 },{      0,  0.325,   0.65 },{  0.325, 0.4875,   0.65 },{      0,   0.25,    0.5 },{   0.25,  0.375,    0.5 },{      0,   0.15,    0.3 },{   0.15,  0.225,    0.3 },{      0,  0.075,   0.15 },{  0.075, 0.1125,   0.15 },{      0,   0.25,      1 },                           // 160{    0.5,  0.625,      1 },{      0, 0.1625,   0.65 },{  0.325, 0.4063,   0.65 },{      0,  0.125,    0.5 },{   0.25, 0.3125,    0.5 },{      0,  0.075,    0.3 },{   0.15, 0.1875,    0.3 },{      0, 0.0375,   0.15 },{  0.075, 0.0938,   0.15 },{      0,      0,      1 },                           // 170{    0.5,    0.5,      1 },{      0,      0,   0.65 },{  0.325,  0.325,   0.65 },{      0,      0,    0.5 },{   0.25,   0.25,    0.5 },{      0,      0,    0.3 },{   0.15,   0.15,    0.3 },{      0,      0,   0.15 },{  0.075,  0.075,   0.15 },{   0.25,      0,      1 },                           // 180{  0.625,    0.5,      1 },{ 0.1625,      0,   0.65 },{ 0.4063,  0.325,   0.65 },{  0.125,      0,    0.5 },{ 0.3125,   0.25,    0.5 },{  0.075,      0,    0.3 },{ 0.1875,   0.15,    0.3 },{ 0.0375,      0,   0.15 },{ 0.0938,  0.075,   0.15 },{    0.5,      0,      1 },                           // 190{   0.75,    0.5,      1 },{  0.325,      0,   0.65 },{ 0.4875,  0.325,   0.65 },{   0.25,      0,    0.5 },{  0.375,   0.25,    0.5 },{   0.15,      0,    0.3 },{  0.225,   0.15,    0.3 },{  0.075,      0,   0.15 },{ 0.1125,  0.075,   0.15 },{   0.75,      0,      1 },                           // 200{  0.875,    0.5,      1 },{ 0.4875,      0,   0.65 },{ 0.5688,  0.325,   0.65 },{  0.375,      0,    0.5 },{ 0.4375,   0.25,    0.5 },{  0.225,      0,    0.3 },{ 0.2625,   0.15,    0.3 },{ 0.1125,      0,   0.15 },{ 0.1313,  0.075,   0.15 },{      1,      0,      1 },                           // 210{      1,    0.5,      1 },{   0.65,      0,   0.65 },{   0.65,  0.325,   0.65 },{    0.5,      0,    0.5 },{    0.5,   0.25,    0.5 },{    0.3,      0,    0.3 },{    0.3,   0.15,    0.3 },{   0.15,      0,   0.15 },{   0.15,  0.075,   0.15 },{      1,      0,   0.75 },                           // 220{      1,    0.5,  0.875 },{   0.65,      0, 0.4875 },{   0.65,  0.325, 0.5688 },{    0.5,      0,  0.375 },{    0.5,   0.25, 0.4375 },{    0.3,      0,  0.225 },{    0.3,   0.15, 0.2625 },{   0.15,      0, 0.1125 },{   0.15,  0.075, 0.1313 },{      1,      0,    0.5 },                           // 230{      1,    0.5,   0.75 },{   0.65,      0,  0.325 },{   0.65,  0.325, 0.4875 },{    0.5,      0,   0.25 },{    0.5,   0.25,  0.375 },{    0.3,      0,   0.15 },{    0.3,   0.15,  0.225 },{   0.15,      0,  0.075 },{   0.15,  0.075, 0.1125 },{      1,      0,   0.25 },                           // 240{      1,    0.5,  0.625 },{   0.65,      0, 0.1625 },{   0.65,  0.325, 0.4063 },{    0.5,      0,  0.125 },{    0.5,   0.25, 0.3125 },{    0.3,      0,  0.075 },{    0.3,   0.15, 0.1875 },{   0.15,      0, 0.0375 },{   0.15,  0.075, 0.0938 },{   0.33,   0.33,   0.33 },                           // 250{  0.464,  0.464,  0.464 },{  0.598,  0.598,  0.598 },{  0.732,  0.732,  0.732 },{  0.866,  0.866,  0.866 },{      1,      1,      1 }                            // 255
};// AutoCAD VERSION aliases
#define DL_VERSION_R12  DL_Codes::AC1009
#define DL_VERSION_LT2  DL_Codes::AC1009
#define DL_VERSION_R13  DL_Codes::AC1012        // not supported yet
#define DL_VERSION_LT95 DL_Codes::AC1012        // not supported yet
#define DL_VERSION_R14  DL_Codes::AC1014        // not supported yet
#define DL_VERSION_LT97 DL_Codes::AC1014        // not supported yet
#define DL_VERSION_LT98 DL_Codes::AC1014        // not supported yet
#define DL_VERSION_2000 DL_Codes::AC1015
#define DL_VERSION_2002 DL_Codes::AC1015// DXF Group Codes:// Strings
#define DL_STRGRP_START 0
#define DL_STRGRP_END   9// Coordinates
#define DL_CRDGRP_START 10
#define DL_CRDGRP_END   19// Real values
#define DL_RLGRP_START  38
#define DL_RLGRP_END    59// Short integer values
#define DL_SHOGRP_START 60
#define DL_SHOGRP_END   79// New in Release 13,
#define DL_SUBCLASS 100// More coordinates
#define DL_CRD2GRP_START    210
#define DL_CRD2GRP_END      239// Extended data strings
#define DL_ESTRGRP_START    1000
#define DL_ESTRGRP_END      1009// Extended data reals
#define DL_ERLGRP_START 1010
#define DL_ERLGRP_END   1059#define DL_Y8_COORD_CODE        28
#define DL_Z0_COORD_CODE        30
#define DL_Z8_COORD_CODE        38#define DL_POINT_COORD_CODE     10
#define DL_INSERT_COORD_CODE    10#define DL_CRD2GRP_START        210
#define DL_CRD2GRP_END          239#define DL_THICKNESS            39
#define DL_FIRST_REAL_CODE      THICKNESS
#define DL_LAST_REAL_CODE       59
#define DL_FIRST_INT_CODE       60
#define DL_ATTFLAGS_CODE        70
#define DL_PLINE_FLAGS_CODE     70
#define DL_LAYER_FLAGS_CODE     70
#define DL_FLD_LEN_CODE         73 // Inside ATTRIB resbuf
#define DL_LAST_INT_CODE        79
#define DL_X_EXTRU_CODE         210
#define DL_Y_EXTRU_CODE         220
#define DL_Z_EXTRU_CODE         230
#define DL_COMMENT_CODE         999// Start and endpoints of a line
#define DL_LINE_START_CODE  10      // Followed by x coord
#define DL_LINE_END_CODE    11      // Followed by x coord// Some codes used by blocks
#define DL_BLOCK_FLAGS_CODE 70      // An int containing flags
#define DL_BLOCK_BASE_CODE  10      // Origin of block definition
#define DL_XREF_DEPENDENT   16      // If a block contains an XREF
#define DL_XREF_RESOLVED    32      // If a XREF resolved ok
#define DL_REFERENCED       64      // If a block is ref'd in DWG#define DL_XSCALE_CODE      41
#define DL_YSCALE_CODE      42
#define DL_ANGLE_CODE       50
#define DL_INS_POINT_CODE   10      // Followed by x of ins pnt
#define DL_NAME2_CODE       3       // Second appearance of name// Some codes used by circle entities
#define DL_CENTER_CODE  10          // Followed by x of center
#define DL_RADIUS_CODE  40          // Followd by radius of circle#define DL_COND_OP_CODE -4          // Conditional op,ads_ssget// When using ads_buildlist you MUST use RTDXF0 instead of these
#define DL_ENTITY_TYPE_CODE     0   // Then there is LINE, 3DFACE..
#define DL_SES_CODE             0   // Start End String Code
#define DL_FILE_SEP_CODE        0   // File separator
#define DL_SOT_CODE             0   // Start Of Table
#define DL_TEXTVAL_CODE         1
#define DL_NAME_CODE            2
#define DL_BLOCK_NAME_CODE      2
#define DL_SECTION_NAME_CODE    2
#define DL_ENT_HAND_CODE        5   // What follows is hexa string
#define DL_TXT_STYLE_CODE       7   // Inside attributes
#define DL_LAYER_NAME_CODE      8   // What follows is layer name
#define DL_FIRST_XCOORD_CODE    10  // Group code x of 1st coord
#define DL_FIRST_YCOORD_CODE    20  // Group code y of 1st coord
#define DL_FIRST_ZCOORD_CODE    30  // Group code z of 1st coord
#define DL_L_START_CODE         10
#define DL_L_END_CODE           11
#define DL_TXTHI_CODE           40
#define DL_SCALE_X_CODE         41
#define DL_SCALE_Y_CODE         42
#define DL_SCALE_Z_CODE         43
#define DL_BULGE_CODE           42  // Used in PLINE verts for arcs
#define DL_ROTATION_CODE        50
#define DL_COLOUR_CODE          62  // What follows is a color int
#define DL_LTYPE_CODE           6   // What follows is a linetype// Attribute flags
#define DL_ATTS_FOLLOW_CODE 66
#define DL_ATT_TAG_CODE     2
#define DL_ATT_VAL_CODE     1
#define DL_ATT_FLAGS_CODE   70      // 4 1 bit flags as follows...
#define DL_ATT_INVIS_FLAG   1
#define DL_ATT_CONST_FLAG   2
#define DL_ATT_VERIFY_FLAG  4       // Prompt and verify
#define DL_ATT_PRESET_FLAG  8       // No prompt and no verify// PLINE defines
// Flags
#define DL_OPEN_PLINE           0x00
#define DL_CLOSED_PLINE         0x01
#define DL_POLYLINE3D           0x08
#define DL_PFACE_MESH           0x40
#define DL_PGON_MESH            0x10
// Vertices follow entity, required in POLYLINES
#define DL_VERTS_FOLLOW_CODE    66 // Value should always be 1
#define DL_VERTEX_COORD_CODE    10// LAYER flags
#define DL_FROZEN           1
#define DL_FROZEN_BY_DEF    2
#define DL_LOCKED           4
#define DL_OBJECT_USED      64  // Object is ref'd in the dwg#define DL_BLOCK_EN_CODE    -2  // Block entity definition
#define DL_E_NAME           -1  // Entity name// Extended data codes
#define DL_EXTD_SENTINEL    (-3)
#define DL_EXTD_STR         1000
#define DL_EXTD_APP_NAME    1001
#define DL_EXTD_CTL_STR     1002
#define DL_EXTD_LYR_STR     1003
#define DL_EXTD_CHUNK       1004
#define DL_EXTD_HANDLE      1005
#define DL_EXTD_POINT       1010
#define DL_EXTD_POS         1011
#define DL_EXTD_DISP        1012
#define DL_EXTD_DIR         1013
#define DL_EXTD_FLOAT       1040
#define DL_EXTD_DIST        1041
#define DL_EXTD_SCALE       1042
#define DL_EXTD_INT16       1070
#define DL_EXTD_INT32       1071// UCS codes for use in ads_trans
#define DL_WCS_TRANS_CODE   0
#define DL_UCS_TRANS_CODE   1
#define DL_DCS_TRANS_CODE   2
#define DL_PCS_TRANS_CODE   3#endif

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/diannao/35681.shtml
繁體地址,請注明出處:http://hk.pswp.cn/diannao/35681.shtml
英文地址,請注明出處:http://en.pswp.cn/diannao/35681.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

leetcode119 楊輝三角②

給定一個非負索引 rowIndex,返回「楊輝三角」的第 rowIndex 行。 在「楊輝三角」中,每個數是它左上方和右上方的數的和。 示例 1: 輸入: rowIndex 3 輸出: [1,3,3,1]示例 2: 輸入: rowIndex 0 輸出: [1]示例 3: 輸入: rowIndex 1 輸出: [1,1] pub…

寵物空氣凈化器熱賣爆款,希喂、小米、352貓用空氣凈化器真實PK

相信大漫天多數養貓家庭都會有一個煩惱:貓咪們的貓實在是太多了,無法忍受家里面漫天飛舞的浮毛和難聞的貓貓便臭。作為養貓多年的過來人我嘗試過很多種方法清理這些貓浮毛和異味,但都以失敗告終。 直到后面看到一個寵物博主推薦的寵物空氣凈…

ffmpeg截取視頻

用格式工廠截取視頻不知道為啥還是原長度,不過只能播放截取的部分,其他部分不能播放,但是總時長不對就不想用了。 參考 https://blog.csdn.net/m0_60259116/article/details/127017324https://cloud.tencent.com/developer/article/2410818ht…

tensorrt動態batch推理注意事項

一、背景:使用pytorch進行訓練得到pt模型, 然后使用torch.onnx把pt模型轉化為onnx模型。然后再使用tensorrt自帶的trtexec.exe文件把onnx模型轉化為engine文件。 (1)在使用C進行推理的時候發現一個batch的數據,值推理…

篩斗數據:數據提取技術,讓數據說話的力量

在當今這個信息爆炸的時代,數據已經滲透到我們生活的方方面面。從商業決策到科學研究,從社會治理到個人生活,數據都扮演著至關重要的角色。而要讓這些數據真正發揮其價值,就需要依賴數據提取技術,讓數據“開口說話”&a…

環路濾波器

塊效應產生的原因 塊效應指視頻邊界不連續的變化,我們在觀看視頻的時候,在運動劇烈的場景常能觀察到圖像出現小方塊,小方塊在邊界處呈現不連續的效果(如下圖),這種現象被稱為塊效應(blocking artifact)。 造成這種現象的主要原因有兩點: DCT量化誤差導致運動補償導致…

深入理解Java多線程中的 wait() 和 notify():為何要與 synchronized 手牽手

在Java中,wait、notify方法通常與synchronized關鍵字一起使用,這樣做有幾個重要的原因,主要涉及線程的協調和正確的并發控制。以下是一些關鍵點: 監視器鎖(Monitor Lock): 每個對象在Java中都可…

二叉樹 遍歷迭代法

二叉樹 遍歷迭代法 Leetcode 94 /*** Definition for a binary tree node.* struct TreeNode {* int val;* TreeNode *left;* TreeNode *right;* TreeNode() : val(0), left(nullptr), right(nullptr) {}* TreeNode(int x) : val(x), left(nullptr), rig…

一個產品需求工程師繁忙的一天

早晨:開啟新的一天 7:00 AM - 起床 早晨七點準時起床。洗漱、早餐后,查看手機上的郵件和消息,提前了解今天的工作安排和優先事項。 8:00 AM - 前往公司 坐地鐵前往公司。在地鐵上,習慣性地閱讀一些行業資訊和市場報告&#xff0…

使用SpringBoot整合Servlet

一、SpringBoot和Servlet的整合 1、用注解WebServlet配置Servlet映射 創建一個SpringBoot的web工程,在工程用創建一個Servlet 2、在SpringBoot的啟動類上加注解ServletComponentScan 二、額外的方式 1、不使用WebServlet配置Servlet映射 創建一個SpringBoot工…

RabbitMQ延時隊列(實現定時任務)

消息的TTL(Time To Live)就是消息的存活時間。 RabbitMQ可以對隊列和消息分別設置TTL。 對隊列設置存活時間,就是隊列沒有消費者連著的保留時間。 對每一個單獨的消息單獨的設置存活時間。超過了這個時間,我們認為這個消息就死了,稱之為死…

代碼隨想錄算法訓練營:19/60

非科班學習算法day19 | LeetCode530:二叉搜索樹的最小絕對差 ,Leetcode501:二叉搜索樹的眾數 ,Leetcode236:二叉樹的最近公共祖先 目錄 介紹 一、LeetCode題目 1.LeetCode530:二叉搜索樹的最小絕對差 題目解析 2.Leetcode501: 二叉搜索樹的眾數 …

軟設之加工邏輯之結構化語言

結構化語言是一種介于自然語言和形式化語言之間的半形式語言,是自然語言的一個受限子集 外層:用來描述控制結構,采用順序,選擇和重復3種基本結構 1.順序結構:一組祈使語句,選擇語句,重復語句的…

個人對JVM的一點理解

JVM(Java 虛擬機)是 Java 程序能夠跨平臺運行的關鍵。它負責將 Java 字節碼轉換為機器碼并執行。 JVM 主要由類加載器、運行時數據區、執行引擎和本地方法接口等部分組成。運行時數據區包括方法區、堆、虛擬機棧、本地方法棧和程序計數器等。 GC&#xf…

遠期利率(Forward Rate)是什么?以及遠期利率在期貨合約中的應用

遠期利率是什么? 中文版 遠期利率(Forward Rate)是指從未來某一時間段開始適用的利率。它是金融市場上的一種合約利率,表示在某個特定日期開始的一段時間內的預期利率。這種利率可以通過現有的即期利率(Spot Rate&am…

6.26考試前總結

一、選擇 1、運算符重載:(1)不可重載:. .* :: ?: sizeof (2)只成員函數:、[]、()、-> ps:和[]需要加&,返回類,[]返回中括號內…

SpringBoot根據不同IP限制接口的QPS

根據對方IP地址來限制接口的QPS(每秒查詢率),你可以結合Spring Boot應用、Guava的RateLimiter或者自定義的并發控制邏輯來實現。以下是一個基于Guava RateLimiter和Spring Boot的示例,展示如何根據IP地址來限制接口的QPS&#xff…

鏡頭下的光學

說實話,當我看到幾何光學的內容全是初中的解析幾何的時候,我就覺得講的方式太原始了,而且太過復雜也看不懂。所以我嘗試做了數學建模,發現建模之后模型可以解釋一些物理現象,也不會有矛盾的地方,那就算過得…

【Python系列】探索 Python 環境管理工具:conda 與 pip 的比較

💝💝💝歡迎來到我的博客,很高興能夠在這里和您見面!希望您在這里可以感受到一份輕松愉快的氛圍,不僅可以獲得有趣的內容和知識,也可以暢所欲言、分享您的想法和見解。 推薦:kwan 的首頁,持續學…

簡過網:專科生可以考的編制崗位有哪些?這5個鐵飯碗要抓住了!

專科生可以考的編制崗位有哪些?以下這幾種可以考的,尤其是應屆畢業生,一定要抓住機會哦! ? 一、三支一扶:專科生可報考,期滿可轉編。 三支一扶:支農、支醫生、支教、扶貧 工作時間一般為2年&…