blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 3
264
| content_id
stringlengths 40
40
| detected_licenses
listlengths 0
85
| license_type
stringclasses 2
values | repo_name
stringlengths 5
140
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringclasses 905
values | visit_date
timestamp[us]date 2015-08-09 11:21:18
2023-09-06 10:45:07
| revision_date
timestamp[us]date 1997-09-14 05:04:47
2023-09-17 19:19:19
| committer_date
timestamp[us]date 1997-09-14 05:04:47
2023-09-06 06:22:19
| github_id
int64 3.89k
681M
⌀ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 22
values | gha_event_created_at
timestamp[us]date 2012-06-07 00:51:45
2023-09-14 21:58:39
⌀ | gha_created_at
timestamp[us]date 2008-03-27 23:40:48
2023-08-21 23:17:38
⌀ | gha_language
stringclasses 141
values | src_encoding
stringclasses 34
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 3
10.4M
| extension
stringclasses 115
values | content
stringlengths 3
10.4M
| authors
listlengths 1
1
| author_id
stringlengths 0
158
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
d6c6b4638206384ff47b3b212bb1bd568808df55
|
2dbbcbdceb9c3e1647a401103bf55afabe156eac
|
/sca/tools/scagen/junit/testinput/modules/MyValueServiceModule/StockQuoteService.h
|
d96115fb3fe75eec029f88459ae0ff13a986e84a
|
[
"Apache-2.0"
] |
permissive
|
lelou13/tuscany-sca-cpp
|
bd30f5967f0c3a95382d80f38ee41a16ec7420ca
|
b06cb5b2608c0802c15c75c708589e82a9c60e2d
|
refs/heads/cpp-M1
| 2021-01-15T08:04:32.276885
| 2009-11-16T06:23:13
| 2009-11-16T06:23:13
| 49,079,719
| 0
| 0
| null | 2016-01-05T16:58:49
| 2016-01-05T16:58:49
| null |
UTF-8
|
C++
| false
| false
| 1,022
|
h
|
/*
*
* Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
//
//////////////////////////////////////////////////////////////////////
#ifndef StockQuoteService_h
#define StockQuoteService_h
#include <string>
#include "commonj/sdo/sdo.h"
using std::string;
class StockQuoteService
{
public:
virtual commonj::sdo::DataObjectPtr GetStockQuotes(commonj::sdo::DataObjectPtr request) = 0;
};
#endif // StockQuoteService_h
|
[
"robbinspg@apache.org"
] |
robbinspg@apache.org
|
e99ea7eb247dd12df06b7334fd2cd2f7d9a73cf5
|
5776c02b86d6b1ddf086d7918942ef25e66e153b
|
/Practice/Concepts/Bitmasks/2_mul_and_div_by2.cpp
|
db8d8af594388144bf4f05f39e9f89a8a53bad36
|
[] |
no_license
|
DaKidReturns/CP
|
11282b018060b06e82a6114d0c3e13feae61d801
|
4786a08a4a20b2c7c6f762abfd01a3b53adb6ff2
|
refs/heads/master
| 2023-07-10T18:18:20.002544
| 2021-08-21T14:24:10
| 2021-08-21T14:24:10
| 317,222,217
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 237
|
cpp
|
#include<iostream>
int main(){
int n;
std::cout<<"Enter an intege: ";
std::cin>>n;
int p = n<<1;
int q = n>>1;
std::cout<<n<<" * 2 = "<< p<<std::endl;
std::cout<<n<<" / 2 = "<< q<<std::endl;
return 0;
}
|
[
"rohitkarun@gmail.com"
] |
rohitkarun@gmail.com
|
565a90c1328ab3aa59df950c8de74769b211d6b1
|
536656cd89e4fa3a92b5dcab28657d60d1d244bd
|
/third_party/skia/modules/skottie/src/layers/shapelayer/ShapeLayer.h
|
6a89efa4e523ce9e3a913197af7e1a40db947489
|
[
"LGPL-2.0-or-later",
"GPL-1.0-or-later",
"MIT",
"Apache-2.0",
"BSD-3-Clause"
] |
permissive
|
ECS-251-W2020/chromium
|
79caebf50443f297557d9510620bf8d44a68399a
|
ac814e85cb870a6b569e184c7a60a70ff3cb19f9
|
refs/heads/master
| 2022-08-19T17:42:46.887573
| 2020-03-18T06:08:44
| 2020-03-18T06:08:44
| 248,141,336
| 7
| 8
|
BSD-3-Clause
| 2022-07-06T20:32:48
| 2020-03-18T04:52:18
| null |
UTF-8
|
C++
| false
| false
| 3,727
|
h
|
/*
* Copyright 2020 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef SkottieShapeLayer_DEFINED
#define SkottieShapeLayer_DEFINED
#include "include/private/SkNoncopyable.h"
#include "modules/skottie/src/Animator.h"
#include "modules/sksg/include/SkSGMerge.h"
#include <vector>
namespace skjson {
class ObjectValue;
} // namespace skjson
namespace sksg {
class GeometryNode;
class PaintNode;
class RenderNode;
} // namespace sksg
namespace skottie {
namespace internal {
class AnimationBuilder;
// TODO/TRANSITIONAL: not much state here yet, but will eventually hold ShapeLayer-related stuff.
class ShapeBuilder final : SkNoncopyable {
public:
static sk_sp<sksg::Merge> MergeGeometry(std::vector<sk_sp<sksg::GeometryNode>>&&,
sksg::Merge::Mode);
static sk_sp<sksg::GeometryNode> AttachPathGeometry(const skjson::ObjectValue&,
const AnimationBuilder*);
static sk_sp<sksg::GeometryNode> AttachRRectGeometry(const skjson::ObjectValue&,
const AnimationBuilder*);
static sk_sp<sksg::GeometryNode> AttachEllipseGeometry(const skjson::ObjectValue&,
const AnimationBuilder*);
static sk_sp<sksg::GeometryNode> AttachPolystarGeometry(const skjson::ObjectValue&,
const AnimationBuilder*);
static sk_sp<sksg::PaintNode> AttachColorFill(const skjson::ObjectValue&,
const AnimationBuilder*);
static sk_sp<sksg::PaintNode> AttachColorStroke(const skjson::ObjectValue&,
const AnimationBuilder*);
static sk_sp<sksg::PaintNode> AttachGradientFill(const skjson::ObjectValue&,
const AnimationBuilder*);
static sk_sp<sksg::PaintNode> AttachGradientStroke(const skjson::ObjectValue&,
const AnimationBuilder*);
static std::vector<sk_sp<sksg::GeometryNode>> AttachMergeGeometryEffect(
const skjson::ObjectValue&, const AnimationBuilder*,
std::vector<sk_sp<sksg::GeometryNode>>&&);
static std::vector<sk_sp<sksg::GeometryNode>> AttachTrimGeometryEffect(
const skjson::ObjectValue&,
const AnimationBuilder*,
std::vector<sk_sp<sksg::GeometryNode>>&&);
static std::vector<sk_sp<sksg::GeometryNode>> AttachRoundGeometryEffect(
const skjson::ObjectValue&, const AnimationBuilder*,
std::vector<sk_sp<sksg::GeometryNode>>&&);
static std::vector<sk_sp<sksg::RenderNode>> AttachRepeaterDrawEffect(
const skjson::ObjectValue&,
const AnimationBuilder*,
std::vector<sk_sp<sksg::RenderNode>>&&);
private:
static sk_sp<sksg::PaintNode> AttachFill(const skjson::ObjectValue&,
const AnimationBuilder*,
sk_sp<sksg::PaintNode>,
sk_sp<AnimatablePropertyContainer> = nullptr);
static sk_sp<sksg::PaintNode> AttachStroke(const skjson::ObjectValue&,
const AnimationBuilder*,
sk_sp<sksg::PaintNode>,
sk_sp<AnimatablePropertyContainer> = nullptr);
};
} // namespace internal
} // namespace skottie
#endif // SkottieShapeLayer_DEFINED
|
[
"pcding@ucdavis.edu"
] |
pcding@ucdavis.edu
|
03f351872454aeab4fc2e1d090cae7afc9302ef8
|
795ed2f56f2b8b0e3b32b4ef796526233a8ce060
|
/funcPointer/Source.cpp
|
46af94c63dc68296a9cf7feb0f3034ffc5e23c2b
|
[] |
no_license
|
windo-developer/CPP_Study
|
d436883b499d2ab8f7d530c3cea461da98d99643
|
369211ff67bd78a35fec8b246001d2e40723d65e
|
refs/heads/master
| 2023-04-24T00:11:05.598137
| 2021-05-10T08:09:02
| 2021-05-10T08:09:02
| 346,973,279
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 778
|
cpp
|
#include <iostream>
using namespace std;
template<typename T, int SIZE = 10>
class RandomBox
{
public:
T GetRnadomData()
{
int index = rand() % SIZE;
return _data[index];
}
public:
T _data[SIZE];
private:
};
template<int SIZE>
class RandomBox<double, SIZE>
{
public:
double GetRnadomData()
{
int index = rand() % SIZE;
return _data[index];
}
public:
double _data[SIZE];
private:
};
int main()
{
srand(static_cast<unsigned int>(time(nullptr)));
RandomBox<int, 10> rb1;
for (int i = 0; i < 10; i++)
{
rb1._data[i] = i;
}
int value1 = rb1.GetRnadomData();
RandomBox<double, 20> rb2;
for (int i = 0; i < 20; i++)
{
rb2._data[i] = i + 0.5f;
}
float value2 = rb2.GetRnadomData();
cout << value1 << endl;
cout << value2 << endl;
return 0;
}
|
[
"yui050505@gmail.com"
] |
yui050505@gmail.com
|
1b3ab716f7fc4ff5028fb5955f9d37a8fbcbfd8d
|
cb80a8562d90eb969272a7ff2cf52c1fa7aeb084
|
/inletTest3/0.132/Ma
|
c92fcdd9a7f8295391f1703d7b35b67d7438baf4
|
[] |
no_license
|
mahoep/inletCFD
|
eb516145fad17408f018f51e32aa0604871eaa95
|
0df91e3fbfa60d5db9d52739e212ca6d3f0a28b2
|
refs/heads/main
| 2023-08-30T22:07:41.314690
| 2021-10-14T19:23:51
| 2021-10-14T19:23:51
| 314,657,843
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 150,361
|
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2006 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0.132";
object Ma;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 0 0 0 0 0 0];
internalField nonuniform List<scalar>
16277
(
0.139392
0.139393
0.139392
0.13939
0.13939
0.139385
0.13937
0.139325
0.139223
0.139061
0.138856
0.138629
0.138396
0.138162
0.137926
0.137685
0.137437
0.13718
0.136911
0.136632
0.13634
0.136038
0.135725
0.135401
0.135066
0.13472
0.134365
0.133998
0.133622
0.133236
0.13284
0.132435
0.132021
0.131598
0.131167
0.130728
0.130281
0.129828
0.129367
0.1289
0.128427
0.127949
0.127466
0.126978
0.126487
0.125992
0.125494
0.124994
0.124492
0.123989
0.123485
0.122981
0.122477
0.121975
0.121474
0.120976
0.12048
0.119988
0.1195
0.119016
0.118538
0.118066
0.1176
0.117142
0.116691
0.116249
0.115815
0.115391
0.114977
0.114573
0.114181
0.1138
0.113431
0.113075
0.112732
0.112403
0.112087
0.111782
0.111487
0.111196
0.110909
0.110633
0.11039
0.110219
0.110144
0.110142
0.110172
0.110207
0.110235
0.110232
0.110211
0.110141
0.109962
0.109665
0.10918
0.108622
0.106572
0.105257
0.108647
0.109316
0.109386
0.108499
0.103772
0.102304
0.108323
0.10945
0.109443
0.108053
0.100955
0.0997108
0.107767
0.109402
0.109289
0.107397
0.0985496
0.0975002
0.107061
0.10917
0.108998
0.106678
0.0965075
0.0956376
0.106347
0.108846
0.108639
0.105946
0.094795
0.0940428
0.105608
0.108453
0.108216
0.105199
0.0933007
0.0926301
0.104858
0.108009
0.107754
0.104448
0.0919647
0.0913631
0.104117
0.107539
0.107264
0.103704
0.0907494
0.0901906
0.103372
0.107034
0.106742
0.102953
0.0896135
0.0890909
0.102624
0.106503
0.106204
0.10221
0.0885513
0.0880588
0.101886
0.10596
0.105652
0.101472
0.0875445
0.0870736
0.10115
0.105401
0.105085
0.100735
0.0865788
0.0861248
0.100414
0.104828
0.104503
0.0999981
0.0856451
0.0852042
0.0996771
0.104239
0.103906
0.0992582
0.084736
0.0843048
0.0989356
0.103636
0.103294
0.0985132
0.0838451
0.0834208
0.0981878
0.103016
0.102664
0.0977609
0.082967
0.0825475
0.0974316
0.102379
0.102018
0.0969995
0.0820977
0.0816811
0.0966655
0.101724
0.101353
0.0962276
0.0812337
0.0808185
0.0958878
0.101051
0.100669
0.0954433
0.0803721
0.0799568
0.0950968
0.100357
0.0999649
0.0946449
0.07951
0.0790936
0.0942909
0.0996428
0.099239
0.0938311
0.0786454
0.0782264
0.0934689
0.0989061
0.0984902
0.0930002
0.0777754
0.0773529
0.0926292
0.098146
0.0977174
0.0921508
0.076898
0.0764709
0.09177
0.0973612
0.0969193
0.0912811
0.0760111
0.0755782
0.0908896
0.0965504
0.0960944
0.0903894
0.0751124
0.0746728
0.0899864
0.0957121
0.0952415
0.0894741
0.0742
0.0737526
0.0890587
0.094845
0.0943591
0.0885336
0.0732718
0.0728158
0.088105
0.0939477
0.093446
0.0875664
0.0723261
0.0718607
0.0871239
0.0930191
0.0925009
0.0865711
0.0713613
0.0708857
0.086114
0.0920579
0.0915229
0.0855466
0.070376
0.0698897
0.0850745
0.0910634
0.0905111
0.084492
0.0693693
0.0688719
0.0840046
0.0900349
0.0894653
0.083407
0.0683406
0.0678323
0.0829042
0.0889722
0.0883855
0.0822918
0.0672904
0.0667717
0.081774
0.087876
0.0872728
0.0811475
0.0662198
0.0656918
0.0806157
0.0867476
0.086129
0.0799763
0.0651311
0.064595
0.0794317
0.0855894
0.0849569
0.0787812
0.0640273
0.0634854
0.0782261
0.0844048
0.0837608
0.0775668
0.062913
0.0623683
0.077004
0.0831987
0.0825463
0.0763394
0.0617947
0.061251
0.0757727
0.0819779
0.0813211
0.0751073
0.0606807
0.0601433
0.074542
0.080751
0.0800954
0.0738817
0.0595821
0.0590576
0.0733243
0.0795298
0.0788821
0.0726764
0.058513
0.0580097
0.0721352
0.0783288
0.0776977
0.0715089
0.0574906
0.0570187
0.0709941
0.0771661
0.0765622
0.0704006
0.0565363
0.0561078
0.0699246
0.076064
0.0755
0.0693773
0.0556752
0.0553043
0.0689545
0.0750488
0.0745389
0.0684684
0.054936
0.0546416
0.0681128
0.0741499
0.0737104
0.0677057
0.0543528
0.0541648
0.0674346
0.0733978
0.0730466
0.0671244
0.053967
0.0538988
0.0669587
0.072834
0.0725834
0.0667597
0.0538019
0.0538648
0.0667134
0.0724851
0.0723465
0.0666363
0.0538768
0.0540746
0.0667166
0.0723707
0.0723518
0.0667673
0.0541982
0.054517
0.066966
0.0724917
0.072585
0.0671326
0.0547484
0.055201
0.0674659
0.0728579
0.0730784
0.0677648
0.0555622
0.0561427
0.0682363
0.0734899
0.0738315
0.0686549
0.0566069
0.0572519
0.0692138
0.0743336
0.0747587
0.0697101
0.05777
0.0584527
0.0703321
0.0753303
0.0758153
0.0708801
0.0589971
0.059693
0.0715393
0.0764333
0.0769582
0.0721171
0.0602424
0.0609336
0.0727939
0.0776041
0.0781504
0.0733821
0.0614706
0.0621403
0.0740575
0.0788055
0.0793553
0.074638
0.0626479
0.0632818
0.0752953
0.0800028
0.08054
0.0758523
0.0637465
0.0643332
0.0764777
0.0811654
0.0816764
0.076998
0.0647452
0.0652763
0.0775806
0.0822675
0.0827413
0.078054
0.0656284
0.0660988
0.0785851
0.0832888
0.0837166
0.0790022
0.0663896
0.0667965
0.0794765
0.0842136
0.0845878
0.0798313
0.06703
0.0673702
0.080247
0.0850304
0.0853506
0.0805414
0.067547
0.0678229
0.0808983
0.0857375
0.0860039
0.0811337
0.0679461
0.0681625
0.0814342
0.0863358
0.0865502
0.0816138
0.0682373
0.0684009
0.0818619
0.08683
0.0869961
0.0819908
0.0684339
0.0685533
0.0821927
0.0872294
0.0873528
0.0822777
0.0685523
0.0686363
0.0824401
0.0875457
0.0876323
0.0824882
0.0686085
0.0686652
0.0826178
0.0877912
0.087847
0.0826356
0.0686172
0.0686536
0.0827388
0.0879779
0.0880086
0.0827323
0.0685908
0.0686124
0.0828145
0.0881168
0.0881269
0.0827889
0.0685392
0.0685498
0.0828543
0.0882164
0.0882099
0.0828137
0.0684692
0.068473
0.0828667
0.0882853
0.0882663
0.0828153
0.0683879
0.0683868
0.0828586
0.0883302
0.0883007
0.0827987
0.0682986
0.068295
0.0828347
0.0883558
0.0883183
0.0827684
0.0682052
0.0682003
0.0827991
0.0883666
0.0883227
0.082728
0.0681097
0.068105
0.0827555
0.0883664
0.0883179
0.0826814
0.0680147
0.0680099
0.082706
0.0883577
0.0883055
0.0826292
0.0679197
0.0679161
0.0826529
0.0883433
0.0882881
0.0825744
0.0678264
0.0678231
0.0825964
0.0883233
0.0882663
0.0825171
0.0677341
0.0677325
0.0825394
0.0883011
0.0882442
0.0824614
0.0676458
0.0676453
0.0824833
0.0882778
0.0882199
0.0824051
0.06756
0.0675684
0.0824342
0.0882595
0.0882023
0.0823578
0.0674863
0.0674944
0.0823882
0.0882551
0.0882169
0.0823291
0.0674156
0.0675144
0.0824019
0.0883004
0.0882853
0.0824083
0.0674923
0.0677138
0.0826172
0.088476
0.0886376
0.0828534
0.0681349
0.0689741
0.0834254
0.0891694
0.0907145
0.0857251
0.072287
0.0715778
0.0829924
0.0881999
0.0916132
0.0941264
0.0955829
0.0960835
0.0963894
0.0969934
0.0972358
0.0975018
0.0976213
0.0977234
0.0977458
0.0977139
0.09764
0.0974453
0.0972435
0.0967372
0.0964488
0.0961266
0.0957311
0.0950541
0.0933224
0.089584
0.0817501
0.0717717
0.0512105
0.0496149
0.0707502
0.0809487
0.0800908
0.0697903
0.0483573
0.0475436
0.0691494
0.0795538
0.0792935
0.0688843
0.0469408
0.0468563
0.068764
0.0791853
0.0790779
0.0686546
0.0465282
0.0465197
0.0685866
0.0790858
0.0790982
0.0685983
0.0465348
0.0465631
0.0686226
0.0791203
0.0791484
0.0686582
0.0466039
0.0466493
0.0687013
0.0791841
0.079217
0.0687445
0.0466973
0.0467481
0.0687926
0.079257
0.0792953
0.0688411
0.0468018
0.0468567
0.0688935
0.079339
0.0793783
0.0689443
0.0469119
0.0469702
0.0689985
0.0794237
0.0794673
0.0690539
0.0470308
0.0470925
0.0691112
0.079515
0.079558
0.0691652
0.0471516
0.0472133
0.0692225
0.0796048
0.0796509
0.0692802
0.047277
0.0473412
0.0693398
0.0797001
0.0797462
0.0693976
0.0474045
0.0474688
0.0694573
0.0797957
0.0798425
0.0695169
0.0475353
0.0476009
0.0695786
0.0798941
0.0799412
0.0696382
0.0476672
0.0477356
0.069701
0.0799931
0.0800431
0.0697635
0.0478056
0.0478745
0.0698277
0.0800965
0.0801453
0.0698883
0.0479415
0.0480112
0.0699522
0.0801975
0.0802493
0.0700162
0.0480823
0.0481535
0.0700819
0.0803039
0.0803561
0.0701462
0.0482248
0.0482977
0.070213
0.080412
0.0804653
0.0702791
0.0483703
0.048443
0.0703465
0.0805225
0.080576
0.0704124
0.0485155
0.0485891
0.0704808
0.0806341
0.0806906
0.0705497
0.0486645
0.0487399
0.0706198
0.0807505
0.0808063
0.0706868
0.0488118
0.0488855
0.0707571
0.0808674
0.0809263
0.0708281
0.0489607
0.0490359
0.0709005
0.0809902
0.0810508
0.0709715
0.0491099
0.0491847
0.0710453
0.0811161
0.08118
0.0711183
0.0492578
0.0493324
0.071194
0.0812478
0.0813143
0.0712682
0.0494039
0.0494775
0.0713457
0.0813852
0.0814566
0.0714244
0.0495504
0.0496235
0.071505
0.0815322
0.0816064
0.0715851
0.0496936
0.0497648
0.0716689
0.0816868
0.0817674
0.0717544
0.0498351
0.0499044
0.0718422
0.0818538
0.0819398
0.0719306
0.0499706
0.0500379
0.0720236
0.0820328
0.0821271
0.0721189
0.0501029
0.0501665
0.0722172
0.0822275
0.0823291
0.0723174
0.0502264
0.0502876
0.0724234
0.0824392
0.0825515
0.0725334
0.0503486
0.0504059
0.0726476
0.0826724
0.0827945
0.072765
0.0504614
0.0505174
0.0728903
0.0829274
0.0830646
0.0730217
0.0505747
0.0506305
0.07316
0.0832113
0.083363
0.073305
0.0506871
0.0507481
0.0734618
0.0835281
0.0836994
0.0736284
0.0508147
0.0508845
0.0738057
0.0838832
0.0840755
0.0739936
0.0509593
0.0510456
0.0741989
0.0842837
0.0845009
0.0744198
0.0511481
0.0512658
0.0746572
0.0847333
0.0849776
0.0749116
0.0514012
0.0515659
0.0751914
0.0852409
0.0855161
0.0754921
0.0517615
0.0519947
0.0758221
0.0858116
0.086127
0.0761794
0.0522689
0.0525943
0.0765709
0.0864613
0.0868132
0.0769962
0.0529782
0.0534331
0.0774625
0.087191
0.0875939
0.0779735
0.053961
0.05458
0.0785347
0.0880263
0.088488
0.0791532
0.0553007
0.0561524
0.0798545
0.0890078
0.0896017
0.0806778
0.0572113
0.0585421
0.0816288
0.0902702
0.0909396
0.0826119
0.0598755
0.0611399
0.0835566
0.0915438
0.0920284
0.0843377
0.062363
0.0634314
0.0847804
0.0923506
0.0926089
0.0854219
0.0644801
0.0654485
0.0857943
0.092818
0.092966
0.0862072
0.0665297
0.0676793
0.0866186
0.0931258
0.0931516
0.086905
0.0687162
0.0696106
0.0871623
0.093137
0.0931281
0.0874458
0.0705878
0.0716411
0.0877156
0.0931224
0.0930608
0.0879254
0.0727047
0.073313
0.0881243
0.0928812
0.0922857
0.0877597
0.0733143
0.0583799
0.0808858
0.0891841
0.0916353
0.0839816
0.0620562
0.0621012
0.0843419
0.0917692
0.0916415
0.0845178
0.063039
0.064283
0.0845963
0.0914576
0.0915262
0.0850719
0.0658005
0.067464
0.08542
0.0914927
0.0915646
0.0859336
0.0690333
0.070529
0.0861919
0.0914507
0.0914434
0.0866336
0.0720338
0.0734348
0.086964
0.0913811
0.091265
0.0872579
0.0746852
0.0751327
0.0871
0.0907103
0.0882971
0.0819049
0.0646127
0.0686391
0.0847583
0.09031
0.0904079
0.0851523
0.0695764
0.0711676
0.0857499
0.0904103
0.0904057
0.0860897
0.0724136
0.0735575
0.0862957
0.0902947
0.0901774
0.0865762
0.0747327
0.0753598
0.086604
0.0898782
0.0892561
0.0862232
0.0755902
0.0666425
0.081711
0.087184
0.0886153
0.0841886
0.0700885
0.0709565
0.0843974
0.0884418
0.0881064
0.0844559
0.0721208
0.0732621
0.0843877
0.0877209
0.0873594
0.0844829
0.0744739
0.0748427
0.0840794
0.0865147
0.0845853
0.0802557
0.067116
0.0710499
0.0822594
0.0858407
0.0855848
0.0824744
0.0721242
0.0731124
0.0823722
0.0851239
0.0845662
0.0822906
0.0737965
0.073774
0.081522
0.0835204
0.0818527
0.0783833
0.0672059
0.0702818
0.079734
0.0824933
0.0816408
0.0792868
0.0707476
0.0715941
0.0788429
0.0806967
0.0793285
0.0778718
0.0714454
0.0660991
0.07512
0.0776843
0.077757
0.0757289
0.0687744
0.0688973
0.0747982
0.0764055
0.0747658
0.0736538
0.0688246
0.0677185
0.0717601
0.0724587
0.0701353
0.0686854
0.0630941
0.0635402
0.0675695
0.068436
0.0650165
0.0647204
0.0615761
0.056833
0.0607818
0.0618596
0.0586798
0.0581589
0.0559287
0.0517664
0.0526367
0.0525437
0.0452062
0.0449194
0.0437164
0.0348566
0.0347526
0.0351812
0.0239795
0.0220371
0.020615
0.00593327
0.00913311
0.0150049
0.0295593
0.0279373
0.0283298
0.0536066
0.0519378
0.0512216
0.0693128
0.0707704
0.0721998
0.0833237
0.0831549
0.0822571
0.0866971
0.0866284
0.0854392
0.089033
0.0917222
0.0917619
0.0932245
0.0924454
0.0889933
0.0908973
0.095238
0.0959019
0.0968469
0.0953746
0.09039
0.087362
0.0944695
0.0965346
0.0984302
0.0968313
0.0896479
0.0867847
0.0949361
0.0974777
0.0994142
0.0976558
0.0904469
0.0893953
0.0969945
0.0994403
0.0981604
0.0950479
0.0864611
0.0896809
0.0977183
0.0998865
0.0995499
0.0966875
0.0881387
0.0851825
0.0945488
0.0980184
0.0998252
0.0975359
0.088879
0.08726
0.0964509
0.0995287
0.0977494
0.0938772
0.0837764
0.0877438
0.0969076
0.0994955
0.099281
0.0961599
0.086708
0.0832453
0.0934678
0.0973556
0.0991356
0.0965229
0.0875372
0.0866635
0.0959513
0.0991625
0.0972521
0.0932458
0.0830361
0.0868011
0.096192
0.0989497
0.0988688
0.0955701
0.0859391
0.0827668
0.0930326
0.0970049
0.0988399
0.096067
0.0867058
0.0856235
0.0953392
0.0987083
0.0968207
0.0927741
0.0823082
0.0865289
0.0958427
0.0986476
0.0986466
0.0953292
0.0854617
0.0837169
0.0940475
0.0979831
0.0955525
0.0910932
0.0792094
0.0839804
0.094663
0.0976765
0.0977516
0.0940006
0.0828921
0.0790131
0.0909062
0.0956814
0.0978041
0.0945708
0.0836719
0.0822856
0.0935949
0.0976089
0.0953608
0.0908081
0.0783929
0.083571
0.0945577
0.097637
0.0977119
0.093905
0.082634
0.078878
0.0908129
0.0955592
0.0977293
0.0944282
0.0833157
0.082197
0.0936671
0.0976112
0.0955618
0.0907277
0.0787835
0.0836752
0.0946408
0.0979318
0.0978467
0.0939366
0.0825944
0.0788987
0.0909152
0.0955572
0.0978719
0.0945973
0.0836811
0.0825179
0.093789
0.097925
0.0958421
0.0911048
0.0789616
0.0840827
0.0950787
0.0983333
0.0983207
0.0942521
0.0829476
0.0788013
0.0911969
0.0958173
0.098304
0.0950122
0.0835181
0.0811345
0.0929538
0.0971113
0.099613
0.0966885
0.0863599
0.0857744
0.0961003
0.0997169
0.0976864
0.0933909
0.0826325
0.0867207
0.0968053
0.0998922
0.0997675
0.096012
0.0854849
0.0824141
0.0934909
0.0979126
0.10039
0.0974435
0.0873664
0.0866193
0.0970166
0.100634
0.0987087
0.0943485
0.0834604
0.0876602
0.0978986
0.100901
0.100747
0.0969634
0.0862214
0.082634
0.0939952
0.0987269
0.101186
0.0980124
0.0876249
0.0870827
0.0976872
0.101432
0.0992686
0.0951047
0.0835965
0.0877521
0.0987454
0.101733
0.100338
0.0964514
0.0851667
0.0889123
0.0995274
0.102498
0.102443
0.0987375
0.087887
0.0851994
0.0963058
0.100645
0.103075
0.100241
0.0899669
0.0889813
0.099661
0.103335
0.101282
0.0969136
0.0854006
0.0896815
0.100691
0.103649
0.102196
0.0982501
0.0869818
0.0911026
0.101371
0.10435
0.10461
0.101059
0.0907834
0.0881085
0.0987323
0.102936
0.105245
0.102327
0.0923251
0.0914529
0.101738
0.105297
0.103237
0.0991524
0.0879765
0.0918448
0.102749
0.105633
0.104121
0.100176
0.0889179
0.0930191
0.10328
0.106189
0.106584
0.10306
0.0927616
0.0900222
0.100825
0.104955
0.10725
0.104414
0.0942084
0.0932992
0.103809
0.107377
0.105344
0.100824
0.0898517
0.0934848
0.104648
0.107631
0.106184
0.102224
0.0906682
0.0950109
0.105486
0.108411
0.108635
0.10499
0.0945429
0.0914334
0.102575
0.106793
0.109324
0.106464
0.0955916
0.0934643
0.104522
0.108313
0.110636
0.107929
0.0978064
0.0966481
0.107017
0.110483
0.1083
0.103903
0.0932229
0.0965083
0.107397
0.11047
0.109393
0.105395
0.0942647
0.0992502
0.1092
0.111966
0.112104
0.108621
0.0985078
0.0953954
0.105823
0.110211
0.112597
0.109735
0.0991988
0.0968556
0.107728
0.11148
0.113665
0.110967
0.100919
0.0997619
0.109926
0.113452
0.111205
0.106977
0.0959069
0.0998246
0.110641
0.113443
0.112721
0.109052
0.0981284
0.102494
0.112626
0.115236
0.115381
0.112054
0.101789
0.0984516
0.109081
0.113428
0.115676
0.112893
0.10183
0.0994519
0.110626
0.11448
0.116793
0.114034
0.103297
0.100665
0.111523
0.115308
0.117166
0.11442
0.104327
0.103964
0.114019
0.117459
0.115831
0.111684
0.101198
0.104965
0.115505
0.118289
0.117296
0.113583
0.102788
0.106809
0.116962
0.119572
0.119506
0.116063
0.105752
0.102361
0.113079
0.117505
0.119702
0.116858
0.105526
0.102643
0.114263
0.118207
0.120421
0.117605
0.106385
0.104705
0.115841
0.119553
0.121986
0.119416
0.109345
0.108556
0.118741
0.122149
0.120346
0.116264
0.105471
0.109008
0.119959
0.122702
0.121423
0.117648
0.106461
0.110364
0.121144
0.123756
0.122586
0.119024
0.108308
0.111712
0.121873
0.124528
0.124288
0.120763
0.110416
0.107254
0.117995
0.122411
0.124913
0.122153
0.111246
0.109166
0.120263
0.124
0.126424
0.123881
0.113176
0.111218
0.1219
0.12543
0.127573
0.125067
0.115178
0.114348
0.124284
0.127614
0.12578
0.121725
0.111139
0.114363
0.125198
0.127955
0.126547
0.122729
0.111688
0.115036
0.125983
0.128732
0.127749
0.12403
0.113184
0.117399
0.127415
0.129979
0.130167
0.126728
0.116672
0.113306
0.124363
0.128375
0.13071
0.128062
0.116794
0.114389
0.125925
0.129593
0.131844
0.129389
0.118241
0.116096
0.127185
0.130718
0.132783
0.130246
0.120039
0.118978
0.129225
0.132666
0.130546
0.126365
0.115145
0.118565
0.12989
0.132772
0.13183
0.12789
0.116538
0.120924
0.13186
0.13449
0.133469
0.129803
0.118995
0.122688
0.133285
0.135794
0.134741
0.131277
0.120712
0.124457
0.134348
0.136811
0.136795
0.133497
0.123577
0.120473
0.130673
0.134948
0.137158
0.134404
0.123314
0.120665
0.132084
0.135891
0.138123
0.135369
0.123942
0.121635
0.132996
0.136881
0.139218
0.136598
0.125846
0.124077
0.1347
0.138304
0.140558
0.138106
0.128206
0.127424
0.137401
0.140717
0.138967
0.134927
0.124116
0.127497
0.138624
0.141292
0.140165
0.136379
0.125066
0.12877
0.139905
0.142516
0.14128
0.137599
0.126559
0.130194
0.14091
0.14344
0.142228
0.138632
0.128038
0.131524
0.141594
0.144204
0.144296
0.14088
0.130777
0.127636
0.138477
0.142594
0.145029
0.142303
0.131102
0.128722
0.14015
0.143992
0.146433
0.143881
0.132658
0.130544
0.141647
0.14531
0.14746
0.144927
0.134101
0.131989
0.142779
0.146375
0.148468
0.145946
0.13593
0.135071
0.145115
0.148486
0.146588
0.142265
0.131753
0.13455
0.146002
0.148788
0.147594
0.143694
0.131909
0.136117
0.147566
0.15021
0.149171
0.14537
0.13421
0.137977
0.149008
0.151606
0.150484
0.14683
0.135908
0.139422
0.150156
0.152718
0.151682
0.148119
0.137514
0.141269
0.151342
0.15382
0.153889
0.150478
0.140351
0.136816
0.147964
0.152104
0.154455
0.15165
0.14024
0.137576
0.149255
0.153184
0.155455
0.152756
0.141159
0.138801
0.150277
0.154194
0.156607
0.153923
0.142774
0.140923
0.151854
0.155592
0.157944
0.155364
0.144582
0.14278
0.15346
0.157045
0.159336
0.156855
0.146913
0.146038
0.156091
0.15945
0.157674
0.153539
0.142664
0.146157
0.157323
0.160055
0.158935
0.155027
0.143812
0.147734
0.158878
0.161497
0.16033
0.156582
0.145521
0.148978
0.159988
0.162609
0.161352
0.157608
0.146757
0.150344
0.161
0.163606
0.162686
0.15914
0.148576
0.152368
0.162425
0.1649
0.165058
0.161676
0.151582
0.148174
0.159236
0.163358
0.165697
0.162949
0.151365
0.148974
0.160671
0.164628
0.167133
0.16452
0.152858
0.150535
0.162182
0.165967
0.168321
0.165742
0.154349
0.152317
0.163519
0.167193
0.169418
0.166834
0.155833
0.15395
0.16478
0.168412
0.170703
0.168206
0.158065
0.1572
0.16743
0.170871
0.169148
0.164933
0.153874
0.157315
0.168826
0.171598
0.170602
0.166666
0.155074
0.159102
0.170642
0.173251
0.172098
0.168292
0.156781
0.160632
0.171911
0.174515
0.17344
0.169765
0.158698
0.162228
0.17319
0.17578
0.174806
0.171169
0.160345
0.164334
0.174557
0.177061
0.177198
0.173721
0.163389
0.159775
0.171262
0.175494
0.177983
0.175188
0.16337
0.160919
0.172813
0.176877
0.179424
0.176704
0.164894
0.162575
0.174345
0.178272
0.180815
0.178157
0.166448
0.164399
0.1759
0.179715
0.182136
0.179489
0.168079
0.166075
0.177264
0.181056
0.183552
0.180963
0.17003
0.168225
0.17904
0.182669
0.184997
0.182477
0.172404
0.171562
0.181824
0.185291
0.183626
0.179348
0.16859
0.172064
0.18335
0.186153
0.18515
0.18125
0.169756
0.173909
0.185297
0.187896
0.186838
0.183069
0.171821
0.175574
0.186701
0.189313
0.188254
0.184506
0.173633
0.177322
0.188077
0.190669
0.18973
0.186137
0.175445
0.179412
0.18956
0.192057
0.19226
0.188788
0.178422
0.175324
0.186399
0.190645
0.193158
0.190422
0.178846
0.176312
0.188005
0.19203
0.194647
0.191989
0.180309
0.178269
0.189822
0.193639
0.196132
0.193522
0.182043
0.180185
0.191426
0.195198
0.197823
0.1953
0.184249
0.182537
0.19349
0.197064
0.199447
0.197025
0.186777
0.185527
0.196131
0.199637
0.197938
0.193542
0.182561
0.186234
0.197697
0.2006
0.199484
0.195441
0.183697
0.187882
0.199549
0.202282
0.201207
0.197264
0.185745
0.189839
0.201186
0.203865
0.202922
0.199143
0.188011
0.191873
0.202878
0.205492
0.204702
0.201013
0.190051
0.194434
0.204733
0.207255
0.207737
0.204198
0.193647
0.190714
0.201916
0.206278
0.209005
0.206263
0.19465
0.192399
0.204071
0.208044
0.210713
0.20802
0.19628
0.193904
0.205561
0.209537
0.212011
0.209281
0.197726
0.195635
0.207061
0.210962
0.213659
0.211028
0.199838
0.197895
0.209113
0.212836
0.215337
0.21278
0.202205
0.201457
0.212289
0.21588
0.214353
0.209956
0.1986
0.202382
0.214178
0.217055
0.216162
0.212091
0.200224
0.204774
0.216485
0.219193
0.218459
0.21455
0.20292
0.207884
0.218994
0.221466
0.220723
0.217166
0.206101
0.209648
0.220465
0.223009
0.223061
0.219404
0.208183
0.204819
0.216793
0.221347
0.224066
0.221195
0.208673
0.206218
0.218796
0.223042
0.225926
0.223145
0.210785
0.208508
0.220823
0.224914
0.227774
0.225005
0.213153
0.211033
0.22294
0.226926
0.229691
0.227007
0.215886
0.215119
0.226609
0.230403
0.228893
0.224202
0.212449
0.216781
0.228969
0.232027
0.231332
0.227176
0.214637
0.220184
0.232246
0.234814
0.233829
0.229911
0.217831
0.221554
0.233573
0.236354
0.235214
0.231198
0.219104
0.223627
0.235065
0.237871
0.238105
0.234133
0.222234
0.218979
0.231579
0.236498
0.239595
0.236621
0.223649
0.22105
0.234151
0.238612
0.241689
0.238785
0.226067
0.224005
0.236632
0.240871
0.244197
0.241351
0.229054
0.226982
0.23943
0.243565
0.246637
0.243927
0.232268
0.231792
0.243851
0.247741
0.246651
0.241985
0.229528
0.234218
0.247122
0.249949
0.248527
0.244145
0.230887
0.235317
0.248282
0.251273
0.250069
0.245782
0.232831
0.237496
0.250155
0.253102
0.252144
0.247887
0.235178
0.240132
0.25214
0.255041
0.255628
0.251499
0.239089
0.236056
0.249002
0.254051
0.257266
0.25412
0.240978
0.238582
0.251952
0.256492
0.260101
0.25722
0.244335
0.242265
0.255409
0.259666
0.263154
0.260458
0.248305
0.248495
0.260888
0.26469
0.263262
0.258463
0.24571
0.24955
0.26298
0.2661
0.264548
0.259893
0.246119
0.251034
0.264512
0.267696
0.266592
0.262039
0.248555
0.253793
0.266885
0.269934
0.269188
0.264787
0.251656
0.257088
0.269449
0.272453
0.273337
0.269061
0.256217
0.253491
0.266594
0.271822
0.275303
0.271957
0.258821
0.256482
0.270042
0.274658
0.278719
0.275829
0.262696
0.261034
0.274431
0.278728
0.282603
0.280281
0.26885
0.268615
0.280403
0.28385
0.281762
0.276988
0.26417
0.267586
0.281119
0.284468
0.283171
0.278421
0.264423
0.269922
0.283573
0.286755
0.286
0.281419
0.267496
0.273361
0.286385
0.289453
0.290456
0.28601
0.272418
0.269534
0.283437
0.288933
0.292516
0.28905
0.275339
0.272828
0.287071
0.291948
0.296168
0.293084
0.279752
0.279654
0.293754
0.298305
0.297629
0.292243
0.277911
0.28528
0.299055
0.301994
0.300743
0.296177
0.281964
0.285966
0.30039
0.303803
0.302268
0.297278
0.282428
0.288125
0.302128
0.305545
0.306235
0.301343
0.286804
0.283535
0.298655
0.304587
0.308593
0.304898
0.289829
0.28717
0.302768
0.307962
0.312315
0.30903
0.294549
0.294056
0.309288
0.314172
0.312897
0.306934
0.291204
0.298466
0.313787
0.317407
0.317747
0.312683
0.297146
0.306645
0.320379
0.323022
0.323937
0.319657
0.305093
0.299523
0.315355
0.321192
0.324457
0.320429
0.304513
0.300806
0.31741
0.32304
0.327225
0.323522
0.308178
0.307103
0.323251
0.328604
0.327101
0.320566
0.303838
0.31113
0.327743
0.331795
0.331249
0.325456
0.308364
0.31718
0.3329
0.336402
0.339051
0.333731
0.317116
0.314968
0.332116
0.338475
0.344244
0.341252
0.326196
0.324033
0.339216
0.343983
0.34775
0.344292
0.328894
0.325639
0.342323
0.347554
0.344946
0.338352
0.320877
0.327976
0.345022
0.349517
0.348405
0.342418
0.324595
0.333029
0.349432
0.353316
0.355308
0.349618
0.332325
0.32938
0.347106
0.354117
0.359513
0.355521
0.338341
0.336664
0.354351
0.360205
0.36668
0.363858
0.349021
0.352156
0.367261
0.371074
0.369754
0.364514
0.348802
0.352365
0.368829
0.372961
0.372461
0.366676
0.348615
0.343785
0.362734
0.369927
0.375246
0.370604
0.352362
0.349161
0.368299
0.374553
0.380262
0.376277
0.358953
0.359069
0.377405
0.383212
0.382683
0.375614
0.356739
0.367385
0.384604
0.388588
0.393189
0.387845
0.36938
0.369153
0.387611
0.393759
0.399754
0.395906
0.37798
0.372945
0.393145
0.399334
0.395808
0.38784
0.366544
0.375251
0.395578
0.400867
0.399597
0.392471
0.371501
0.382484
0.401278
0.405809
0.409085
0.40268
0.382924
0.381063
0.401259
0.408911
0.415669
0.41152
0.393706
0.397268
0.416209
0.421455
0.422747
0.416816
0.398141
0.407067
0.425262
0.428969
0.42823
0.422104
0.401368
0.394533
0.416553
0.424862
0.429936
0.424564
0.404288
0.402672
0.424528
0.431608
0.430755
0.422151
0.399621
0.413674
0.43373
0.438646
0.444291
0.437647
0.415851
0.418279
0.439747
0.446989
0.456319
0.4536
0.436067
0.432625
0.453023
0.457997
0.456786
0.449009
0.425333
0.41624
0.442697
0.452805
0.45873
0.45265
0.428603
0.427169
0.453331
0.461439
0.461632
0.452029
0.425138
0.446143
0.467664
0.472263
0.482289
0.477917
0.455317
0.458997
0.481811
0.487742
0.483712
0.474419
0.447681
0.45554
0.48096
0.487744
0.486899
0.478662
0.449641
0.446751
0.477663
0.48801
0.488038
0.475484
0.443587
0.471228
0.495261
0.499769
0.511104
0.506313
0.481699
0.481564
0.508266
0.51526
0.509375
0.49811
0.465851
0.476664
0.50568
0.513288
0.513733
0.505261
0.47256
0.472284
0.508098
0.518077
0.528603
0.518614
0.483042
0.48158
0.517486
0.528238
0.536104
0.527084
0.493633
0.481943
0.521265
0.532622
0.532205
0.519357
0.47588
0.478702
0.52497
0.536944
0.542049
0.528503
0.480098
0.468971
0.523176
0.540604
0.529022
0.508546
0.450989
0.483307
0.523682
0.53623
0.533466
0.521908
0.480633
0.46998
0.516582
0.530755
0.524418
0.507849
0.451952
0.434173
0.495752
0.514329
0.502225
0.48131
0.41408
0.391067
0.465942
0.490052
0.478883
0.451874
0.371162
0.355192
0.440145
0.469604
0.461814
0.430027
0.341547
0.329417
0.420846
0.454875
0.448495
0.412313
0.31848
0.308623
0.40432
0.442549
0.436952
0.396803
0.299637
0.291456
0.389718
0.431637
0.426573
0.383037
0.284013
0.277204
0.376713
0.421732
0.4171
0.370736
0.27099
0.265343
0.365101
0.412662
0.408399
0.359789
0.260212
0.255556
0.354788
0.404291
0.40033
0.350076
0.251322
0.247491
0.345648
0.396508
0.392821
0.341487
0.244037
0.240936
0.337588
0.389263
0.385826
0.333924
0.23815
0.235656
0.330487
0.382499
0.379279
0.327258
0.233425
0.231441
0.324238
0.376165
0.373158
0.32141
0.229681
0.228124
0.318768
0.370254
0.36745
0.316294
0.226747
0.225538
0.313982
0.364742
0.362129
0.311818
0.224477
0.223552
0.309795
0.359609
0.357182
0.307895
0.222747
0.222053
0.306117
0.35485
0.352609
0.304447
0.221457
0.220949
0.302882
0.350459
0.348392
0.301412
0.220518
0.220158
0.300034
0.346413
0.344514
0.298738
0.219857
0.219609
0.297525
0.342704
0.340971
0.296384
0.219408
0.219248
0.295312
0.339323
0.33775
0.294305
0.219122
0.219028
0.29336
0.336257
0.334833
0.292465
0.218968
0.218929
0.291625
0.333483
0.332198
0.29083
0.218917
0.218917
0.290085
0.330982
0.329826
0.28938
0.218935
0.218956
0.288721
0.328733
0.327696
0.288095
0.218987
0.219018
0.287514
0.326717
0.325787
0.286961
0.219055
0.219086
0.286446
0.324909
0.324074
0.285956
0.219122
0.219153
0.285501
0.323291
0.322545
0.285069
0.219187
0.219211
0.284666
0.321842
0.321174
0.284283
0.21924
0.219265
0.28393
0.320549
0.319953
0.283597
0.219293
0.219311
0.283287
0.319393
0.318858
0.282991
0.21933
0.219343
0.282718
0.318357
0.317879
0.282459
0.219359
0.219365
0.282218
0.317429
0.316998
0.281989
0.219373
0.219376
0.281777
0.316596
0.316211
0.281576
0.219382
0.21938
0.281385
0.315846
0.315496
0.281202
0.219381
0.219378
0.281031
0.315168
0.314852
0.280868
0.219378
0.21937
0.280713
0.314553
0.314264
0.280563
0.219365
0.219356
0.280424
0.313994
0.313733
0.280292
0.219351
0.219339
0.280166
0.313485
0.313246
0.280044
0.219328
0.219316
0.279932
0.313023
0.312806
0.279825
0.219307
0.219292
0.279722
0.312601
0.312402
0.279623
0.219278
0.219264
0.279532
0.312216
0.312037
0.279446
0.219251
0.219236
0.279363
0.311866
0.311704
0.279283
0.21922
0.219204
0.279209
0.311549
0.311407
0.279141
0.219192
0.219179
0.279077
0.311266
0.311138
0.279017
0.219168
0.219154
0.278959
0.311007
0.310894
0.278906
0.219145
0.219135
0.278858
0.310776
0.310675
0.278814
0.219128
0.21912
0.278772
0.310567
0.310479
0.278735
0.219117
0.219113
0.278702
0.310382
0.310304
0.278672
0.219113
0.219112
0.278644
0.310215
0.310148
0.278621
0.219116
0.219119
0.278599
0.310068
0.31001
0.278583
0.219128
0.219136
0.278566
0.309938
0.309889
0.278557
0.21915
0.219163
0.278547
0.309825
0.309785
0.278544
0.219182
0.2192
0.27854
0.309727
0.309697
0.278543
0.219224
0.219247
0.278545
0.309647
0.309624
0.278554
0.219276
0.219304
0.278561
0.30958
0.309565
0.278576
0.219337
0.219371
0.278589
0.309528
0.309521
0.278609
0.219408
0.219446
0.278627
0.309489
0.30949
0.278651
0.219488
0.21953
0.278675
0.309464
0.309472
0.278704
0.219575
0.219621
0.278731
0.309451
0.309466
0.278765
0.219671
0.219721
0.278797
0.30945
0.309471
0.278834
0.219773
0.219826
0.27887
0.309459
0.309486
0.278912
0.219882
0.219938
0.278952
0.30948
0.309512
0.278997
0.219997
0.220056
0.27904
0.30951
0.309547
0.279088
0.220117
0.220179
0.279135
0.30955
0.309591
0.279187
0.220242
0.220306
0.279237
0.309598
0.309643
0.279291
0.220372
0.220438
0.279344
0.309655
0.309704
0.279402
0.220505
0.220574
0.279457
0.309719
0.309773
0.279518
0.220644
0.220714
0.279577
0.309792
0.30985
0.27964
0.220786
0.220858
0.279701
0.309871
0.309934
0.279767
0.220932
0.221006
0.279832
0.309959
0.310025
0.2799
0.221081
0.221157
0.279967
0.310053
0.310123
0.280037
0.221233
0.221311
0.280106
0.310154
0.310227
0.280179
0.221388
0.221466
0.28025
0.31026
0.310336
0.280324
0.221545
0.221624
0.280397
0.310372
0.31045
0.280473
0.221703
0.221783
0.280547
0.310488
0.310569
0.280625
0.221862
0.221942
0.2807
0.310609
0.310692
0.280779
0.222022
0.222103
0.280856
0.310734
0.310819
0.280936
0.222183
0.222263
0.281013
0.310863
0.310949
0.281094
0.222343
0.222424
0.281172
0.310994
0.311082
0.281254
0.222504
0.222584
0.281333
0.311129
0.311218
0.281416
0.222664
0.222745
0.281496
0.311266
0.311357
0.281579
0.222825
0.222906
0.28166
0.311406
0.311498
0.281744
0.222987
0.223068
0.281826
0.311549
0.311644
0.281911
0.223149
0.223231
0.281995
0.311696
0.311792
0.282081
0.223313
0.223395
0.282166
0.311846
0.311945
0.282254
0.223478
0.223561
0.28234
0.312001
0.312101
0.282429
0.223645
0.223729
0.282517
0.312159
0.312262
0.282608
0.223814
0.223899
0.282697
0.312322
0.312426
0.28279
0.223985
0.224071
0.282881
0.312489
0.312596
0.282976
0.224158
0.224245
0.283068
0.312661
0.312769
0.283164
0.224332
0.224418
0.283258
0.312835
0.312944
0.283354
0.224505
0.22459
0.283447
0.313011
0.313119
0.283542
0.224675
0.224758
0.283635
0.313186
0.313294
0.283729
0.224842
0.224923
0.28382
0.313359
0.313466
0.283912
0.225003
0.225082
0.284001
0.313532
0.31364
0.284095
0.225159
0.225239
0.284185
0.313706
0.313814
0.284278
0.225322
0.225397
0.284365
0.313877
0.314
0.284454
0.225471
0.225539
0.284534
0.314055
0.314169
0.284637
0.225667
0.225749
0.284729
0.314247
0.314324
0.284841
0.225865
0.225988
0.284887
0.314344
0.314242
0.284793
0.22607
0.225973
0.284561
0.314035
0.314613
0.284757
0.226105
0.227129
0.285913
0.316503
0.31761
0.286857
0.227992
0.357557
0.393104
0.414594
0.419388
0.421567
0.428658
0.432127
0.434362
0.43635
0.440736
0.443426
0.446723
0.449286
0.451108
0.452446
0.453381
0.454039
0.454504
0.454839
0.455086
0.455272
0.455417
0.455531
0.455623
0.455698
0.45576
0.455811
0.455853
0.455885
0.455911
0.455927
0.455938
0.455942
0.455931
0.455927
0.455922
0.455914
0.455904
0.45589
0.455872
0.455849
0.455821
0.455789
0.455755
0.455723
0.455688
0.455639
0.455568
0.455478
0.455373
0.455257
0.45513
0.45499
0.454837
0.454667
0.45448
0.454273
0.454043
0.453787
0.453501
0.453181
0.452821
0.452417
0.451962
0.45145
0.450874
0.450226
0.4495
0.448684
0.44777
0.446747
0.445605
0.444329
0.442909
0.441332
0.439584
0.437654
0.435528
0.433197
0.43065
0.42788
0.424882
0.421653
0.418192
0.414504
0.410593
0.406471
0.402147
0.397637
0.392954
0.388121
0.38315
0.378066
0.372885
0.367629
0.362314
0.356963
0.351588
0.346208
0.34084
0.335493
0.330183
0.324921
0.319714
0.314575
0.309508
0.30452
0.299619
0.294807
0.290087
0.285466
0.280941
0.276517
0.272193
0.267972
0.263852
0.259834
0.255916
0.252099
0.24838
0.244759
0.241236
0.237806
0.234471
0.231225
0.228071
0.225004
0.222023
0.219126
0.216311
0.213577
0.21092
0.20834
0.205835
0.203402
0.20104
0.198747
0.19652
0.19436
0.192264
0.190229
0.188255
0.18634
0.184482
0.18268
0.180932
0.179238
0.177595
0.176001
0.174457
0.172961
0.171511
0.170106
0.168745
0.167427
0.166151
0.164915
0.163719
0.162562
0.161442
0.16036
0.159313
0.1583
0.157322
0.156378
0.155466
0.154585
0.153735
0.152916
0.152126
0.151365
0.150632
0.149927
0.149249
0.148597
0.14797
0.147369
0.146793
0.146241
0.145713
0.145208
0.144727
0.144267
0.14383
0.143415
0.143021
0.142648
0.142296
0.141964
0.141653
0.141362
0.141092
0.140841
0.14061
0.140398
0.140207
0.140035
0.139884
0.139753
0.139644
0.139557
0.139491
0.139446
0.139417
0.139403
0.139398
0.139396
0.139395
0.139393
0.139391
0.139388
0.139377
0.139342
0.139257
0.139112
0.138916
0.138691
0.138456
0.138218
0.137979
0.137736
0.137487
0.137228
0.136958
0.136677
0.136384
0.13608
0.135766
0.13544
0.135104
0.134758
0.134401
0.134034
0.133657
0.13327
0.132873
0.132467
0.132052
0.131628
0.131196
0.130756
0.130308
0.129853
0.129392
0.128923
0.128449
0.12797
0.127485
0.126996
0.126503
0.126007
0.125508
0.125006
0.124502
0.123997
0.123492
0.122986
0.12248
0.121976
0.121473
0.120973
0.120475
0.119981
0.119491
0.119006
0.118525
0.118051
0.117583
0.117122
0.116669
0.116225
0.115789
0.115362
0.114946
0.11454
0.114144
0.11376
0.113388
0.113029
0.112683
0.11235
0.11203
0.11172
0.111417
0.111117
0.110818
0.110535
0.110298
0.110151
0.110106
0.110129
0.110176
0.11022
0.110248
0.11024
0.110216
0.110096
0.11012
0.110122
0.110092
0.110054
0.109983
0.109914
0.109813
0.109721
0.109596
0.109489
0.109337
0.109209
0.109035
0.108893
0.108704
0.108553
0.108347
0.108185
0.107964
0.107791
0.107555
0.107372
0.107123
0.10693
0.106666
0.106463
0.106185
0.105972
0.10568
0.105457
0.105151
0.104917
0.104597
0.104352
0.104016
0.10376
0.10341
0.103141
0.102776
0.102494
0.102113
0.101819
0.101421
0.101113
0.100699
0.100376
0.0999457
0.0996075
0.0991595
0.0988056
0.0983396
0.0979694
0.0974851
0.097098
0.096595
0.0961906
0.0956687
0.0952466
0.0947057
0.094266
0.0937062
0.093249
0.092671
0.0921971
0.0916017
0.0911122
0.0905007
0.0899974
0.0893718
0.0888569
0.0882199
0.0876966
0.0870517
0.0865244
0.0858763
0.0853505
0.0847049
0.0841879
0.0835524
0.0830528
0.0824365
0.0819653
0.0813793
0.0809494
0.0804062
0.0800321
0.0795458
0.0792419
0.0788277
0.0786069
0.0782816
0.0781583
0.0779344
0.0779184
0.0778066
0.0778932
0.0778848
0.0780955
0.0782074
0.0785579
0.0787858
0.0792305
0.0795434
0.080066
0.0804433
0.0810226
0.0814481
0.0820662
0.0825233
0.0831616
0.0836331
0.0842739
0.0847444
0.085372
0.085828
0.086429
0.0868588
0.087422
0.0878164
0.0883335
0.0886858
0.0891517
0.0894566
0.089869
0.090125
0.0904847
0.0906934
0.091003
0.0911676
0.0914325
0.091558
0.0917841
0.0918761
0.0920694
0.0921331
0.0922994
0.0923399
0.0924839
0.0925055
0.0926308
0.0926367
0.0927482
0.0927416
0.0928414
0.0928246
0.0929153
0.0928903
0.0929739
0.0929424
0.0930208
0.0929843
0.0930584
0.0930178
0.0930891
0.093045
0.0931133
0.093067
0.0931347
0.0930871
0.0931527
0.0931045
0.0931733
0.093124
0.0931959
0.0931509
0.0932344
0.0932001
0.0932991
0.0932446
0.0934149
0.0936574
0.0942381
0.0954919
0.0953813
0.0953268
0.0960219
0.0952103
0.0953045
0.0959786
0.0951595
0.0952655
0.0959454
0.0951144
0.0952247
0.0959146
0.0950775
0.0951905
0.0958867
0.0950459
0.0951586
0.095859
0.0950155
0.0951275
0.0958296
0.0949823
0.0950922
0.0957977
0.094947
0.0950552
0.0957623
0.094907
0.0950121
0.0957219
0.0948612
0.094963
0.0956756
0.0948082
0.0949057
0.0956217
0.0947461
0.0948383
0.0955579
0.0946719
0.0947575
0.0954815
0.0945826
0.09466
0.0953893
0.094474
0.0945411
0.0952772
0.0943417
0.0943963
0.09514
0.0941793
0.0942184
0.0949715
0.09398
0.0940001
0.0947641
0.0937352
0.0937322
0.0945086
0.0934347
0.0934037
0.094194
0.0930673
0.0930033
0.0938086
0.0926212
0.0925195
0.0933403
0.0920845
0.0919421
0.0927792
0.0914519
0.0912669
0.0921191
0.0907203
0.0904934
0.091359
0.0898925
0.0896271
0.0905036
0.0889774
0.0886794
0.0895638
0.0879896
0.0876676
0.0885572
0.0869497
0.0866148
0.0875079
0.0858832
0.0855484
0.086445
0.0848189
0.0844996
0.0854016
0.0837904
0.0835033
0.0844144
0.0828332
0.0825944
0.0835187
0.0819791
0.081801
0.0827291
0.0812557
0.0811601
0.0820911
0.080712
0.0807356
0.0817119
0.0804382
0.0805883
0.0816185
0.0804194
0.080662
0.0817363
0.0805897
0.0809381
0.0820549
0.0809698
0.0814138
0.0825782
0.0815406
0.0820662
0.0832738
0.082273
0.0828659
0.0841076
0.0831378
0.0837815
0.0850476
0.0841036
0.0847837
0.0860652
0.0851423
0.085847
0.0871351
0.0862308
0.086949
0.0882356
0.0873484
0.0880715
0.0893496
0.0884787
0.0891998
0.0904641
0.0896088
0.0903223
0.0915685
0.0907281
0.0914299
0.0926547
0.0918288
0.0925156
0.0937165
0.0929048
0.0935741
0.0947493
0.0939515
0.0946017
0.0957498
0.0949659
0.0955957
0.0967159
0.0959456
0.0965542
0.0976459
0.0968891
0.0974761
0.0985388
0.0977957
0.0983608
0.0993943
0.0986651
0.0992085
0.100213
0.0994978
0.10002
0.100994
0.100294
0.100795
0.10174
0.101056
0.101535
0.102451
0.101783
0.102242
0.103127
0.102476
0.102916
0.103771
0.103138
0.103557
0.104382
0.103767
0.104168
0.104961
0.104367
0.104748
0.10551
0.104937
0.105299
0.106028
0.105478
0.105822
0.106517
0.105991
0.106317
0.106978
0.106477
0.106784
0.10741
0.106935
0.107224
0.107813
0.107367
0.107638
0.108188
0.107772
0.108024
0.108535
0.108151
0.108385
0.108853
0.108504
0.108718
0.109144
0.108829
0.109024
0.109405
0.109128
0.109302
0.109636
0.109397
0.10955
0.109835
0.109638
0.109772
0.110006
0.109851
0.10996
0.110141
0.110022
0.110102
0.110234
0.110151
0.110208
0.110291
0.110242
0.110271
0.110311
0.110282
0.110279
0.110291
0.110258
0.110259
0.110259
0.11024
0.110194
0.11012
0.110015
0.109881
0.109719
0.109527
0.109308
0.109061
0.108787
0.108486
0.108157
0.107801
0.107416
0.107003
0.106562
0.106091
0.10559
0.105059
0.104495
0.1039
0.10327
0.102607
0.101908
0.101173
0.100401
0.0995916
0.0987437
0.0978574
0.0969335
0.0959731
0.0949773
0.0939485
0.09289
0.0918067
0.0907054
0.0895948
0.0884863
0.0873958
0.0863456
0.0853628
0.0844803
0.083737
0.0831775
0.0828464
0.0827475
0.0829102
0.0834169
0.0842016
0.0851353
0.0861781
0.0872965
0.0884483
0.0895931
0.0906924
0.0917155
0.0926398
0.0934533
0.0941508
0.0947326
0.0952052
0.0955805
0.0958739
0.0961017
0.0962786
0.0964168
0.0965257
0.0966124
0.0966824
0.0967401
0.0967885
0.0968301
0.0968664
0.0968989
0.0969288
0.0969566
0.0969828
0.0970076
0.0970305
0.0970503
0.0970653
0.0970759
0.097095
0.0969893
0.0962385
0.0959861
0.0960273
0.0963251
0.0969867
0.0972279
0.0972015
0.0975088
0.0975049
0.0976181
0.0976084
0.0975613
0.0975468
0.0975391
0.0975273
0.0975119
0.0974937
0.0974735
0.0974521
0.09743
0.0974072
0.0973837
0.0973587
0.0973316
0.0973018
0.097268
0.0975257
0.0975414
0.0975575
0.0975743
0.0975915
0.0976089
0.0976266
0.0976447
0.0976627
0.0976801
0.0976962
0.09771
0.0977203
0.0977266
0.0977384
0.0977236
0.0977239
0.0977453
0.0977432
0.0977085
0.0977126
0.0976432
0.0976476
0.0976865
0.097678
0.0976751
0.0973401
0.0973377
0.0973408
0.0974178
0.0974368
0.0972332
0.0972404
0.0965794
0.0966618
0.0963372
0.096335
0.096386
0.09636
0.0963581
0.0963649
0.0973384
0.0976682
0.0976576
0.0976449
0.0976311
0.0973229
0.0973284
0.0973338
0.0963766
0.096391
0.0964078
0.0956123
0.0954961
0.0955901
0.0954742
0.0955711
0.0954557
0.0955556
0.0954411
0.0955457
0.0954325
0.0955453
0.0954288
0.0955673
0.0955705
0.0956831
0.095926
0.0955847
0.0955145
0.0947926
0.0948917
0.093039
0.092848
0.0926856
0.0947278
0.0945569
0.0925274
0.0925727
0.0946764
0.0945008
0.0924972
0.0925497
0.09463
0.0945199
0.0925041
0.0882113
0.0882114
0.088195
0.0882333
0.0882674
0.0883911
0.0886298
0.0889992
0.0882315
0.0925516
0.0946637
0.0944936
0.0924899
0.0925526
0.0946245
0.09452
0.0925155
0.0925758
0.094664
0.0945006
0.0925242
0.0925842
0.0946317
0.0945327
0.0925522
0.0883529
0.0883346
0.0883004
0.0882952
0.0882645
0.0882623
0.0882323
0.0883869
0.0926142
0.094677
0.0945175
0.0925659
0.0926277
0.0946488
0.0945527
0.0925982
0.0926612
0.0946966
0.0945398
0.0926148
0.0926773
0.0946705
0.0945769
0.0926499
0.0885645
0.0885412
0.0885027
0.0884909
0.0884551
0.0884341
0.0883971
0.0886018
0.0927136
0.0947203
0.0945664
0.0926691
0.0927322
0.0946964
0.0946052
0.0927066
0.0927709
0.0947479
0.0945972
0.0927287
0.0927926
0.0947265
0.0955213
0.0946376
0.0927686
0.0888024
0.0887765
0.0887351
0.088719
0.08868
0.0886552
0.0886155
0.0888428
0.0928334
0.0947794
0.0956375
0.0964268
0.097318
0.0976173
0.097604
0.0975915
0.0975801
0.0973114
0.0973118
0.0973141
0.0964486
0.0964736
0.096502
0.0965325
0.0973135
0.0975703
0.097563
0.0975592
0.0975597
0.097352
0.0973317
0.0973196
0.096569
0.0966193
0.0966851
0.0959704
0.0958405
0.0958913
0.0957668
0.0958288
0.0957084
0.0957791
0.0956609
0.0957367
0.0956192
0.0956994
0.0955823
0.0956665
0.0955498
0.0947604
0.0946319
0.0927933
0.0928579
0.0928366
0.0946745
0.0948156
0.0946717
0.0928648
0.0929025
0.0889751
0.0889325
0.0889034
0.0888602
0.0889951
0.0890402
0.0929304
0.0947994
0.0947163
0.0929112
0.0890712
0.0891157
0.092978
0.0948566
0.0947168
0.0929435
0.0930103
0.0948439
0.0947639
0.0929937
0.0930618
0.0949033
0.0947679
0.0930304
0.0930988
0.0948942
0.0948181
0.093086
0.0893839
0.0893455
0.0892946
0.0892678
0.0892204
0.0891869
0.0891392
0.0894354
0.0931561
0.0949569
0.0948266
0.0931287
0.0931994
0.0949525
0.0948812
0.093191
0.0932641
0.0950201
0.0948968
0.0932427
0.0933171
0.0950234
0.0949582
0.0933146
0.0897736
0.0897226
0.0896606
0.0896224
0.0895654
0.0895221
0.0894665
0.089838
0.0933919
0.0950979
0.0949832
0.0933776
0.0934568
0.095111
0.0950535
0.0934619
0.0935445
0.0951943
0.0950891
0.0935385
0.0936231
0.0952184
0.0959314
0.0951691
0.0936365
0.0903006
0.0902281
0.090148
0.0900902
0.0900161
0.0899551
0.089885
0.0903863
0.0937253
0.0953112
0.096067
0.0967653
0.0973848
0.0975656
0.0975099
0.0972283
0.0971797
0.0971182
0.0970382
0.0969315
0.0967859
0.0965846
0.0963073
0.0959326
0.0954434
0.0948292
0.0940853
0.0932107
0.0922095
0.0910924
0.0898798
0.0911397
0.0923782
0.0934605
0.0944003
0.095199
0.0958596
0.0963843
0.0967775
0.0970512
0.0972278
0.097336
0.0974017
0.0974431
0.0974714
0.0974925
0.0975772
0.0975942
0.0976163
0.0975753
0.0974939
0.097432
0.0968659
0.0969962
0.0971652
0.0973889
0.0976857
0.0976421
0.0976626
0.0976573
0.0975921
0.0980223
0.0979445
0.0978167
0.0976893
0.0980463
0.0983592
0.0982255
0.0978869
0.0976104
0.0973031
0.097134
0.0968823
0.0967845
0.0965776
0.0965288
0.0963511
0.0963351
0.0961783
0.0961852
0.0960417
0.0953484
0.0952167
0.0937293
0.093821
0.0938448
0.0953095
0.0954539
0.0953721
0.0939574
0.0939413
0.0907377
0.090638
0.090551
0.0904579
0.0908259
0.090935
0.0940579
0.095508
0.0954826
0.0940951
0.0910406
0.0911589
0.0942019
0.0956314
0.0955661
0.094234
0.0943469
0.0957087
0.0957009
0.0944022
0.0945242
0.0958573
0.0958155
0.0945777
0.094707
0.0959679
0.0959823
0.0947861
0.0921261
0.0919673
0.0918098
0.0916712
0.0915288
0.0913995
0.091269
0.0922988
0.094929
0.0961519
0.0961409
0.0950112
0.0951653
0.0963105
0.0963564
0.0952789
0.0954536
0.0965485
0.0965819
0.0955785
0.0957704
0.0967797
0.09687
0.0959355
0.0938036
0.0935476
0.0933039
0.0930808
0.092866
0.092667
0.0924733
0.0940836
0.0961618
0.0970969
0.0971979
0.0963599
0.0966276
0.097447
0.0976174
0.096894
0.0972094
0.0978875
0.0980408
0.0974804
0.0977492
0.0982683
0.0984465
0.0983724
0.0979334
0.0965843
0.0963087
0.0959448
0.0955385
0.095113
0.0947254
0.0943846
0.0967833
0.0980843
0.0985259
0.0986359
0.0984855
0.0979756
0.0974244
0.097123
0.0966777
0.0960916
0.0968114
0.097363
0.097757
0.0983555
0.0979819
0.0974181
0.0966939
0.0961181
0.0953687
0.0945093
0.0935081
0.0923344
0.0932107
0.0943267
0.0952926
0.095825
0.0948055
0.0936126
0.09391
0.0945201
0.0951752
0.0956685
0.0961929
0.0966099
0.0970746
0.0974168
0.0977998
0.0980399
0.0983084
0.0984647
0.0986448
0.0986563
0.0986208
0.0985484
0.0981551
0.0982077
0.0982064
0.0985778
0.0986017
0.098494
0.0981113
0.0981919
0.0970176
0.0970149
0.0969769
0.0969033
0.0969633
0.0968721
0.0980279
0.0984486
0.0983039
0.097916
0.0967804
0.0966907
0.0978141
0.0982442
0.0980757
0.0976618
0.0975711
0.0979987
0.0978929
0.0975914
0.097709
0.0978458
0.0976198
0.097426
0.0975899
0.0972628
0.0972662
0.0965173
0.0964158
0.0965373
0.0944465
0.09588
0.0960001
0.0957757
0.0970959
0.0967731
0.09547
0.0953326
0.096676
0.0969715
0.0965148
0.0960718
0.0956034
0.095236
0.095371
0.0957289
0.095859
0.0962163
0.0963228
0.0951085
0.0949569
0.0947191
0.0945516
0.0943058
0.0941381
0.0940817
0.0950553
0.0950501
0.0951348
0.0944916
0.0938337
0.0931052
0.0931578
0.0924809
0.0922538
0.0918798
0.0909264
0.0897601
0.0886145
0.087348
0.086132
0.0850086
0.0840201
0.0833221
0.0830356
0.0830827
0.0834167
0.0840238
0.084837
0.0857939
0.0868447
0.0879518
0.0890867
0.0902285
0.0905822
0.0893945
0.0882036
0.0870229
0.0858835
0.0848317
0.0839327
0.0832719
0.0829441
0.0829743
0.0834141
0.084328
0.0855573
0.086905
0.0883187
0.0893194
0.0876323
0.0859485
0.0861161
0.0882715
0.0902251
0.0906184
0.0885016
0.0857718
0.0828286
0.0840129
0.0843852
0.0832382
0.0826641
0.0825738
0.0816289
0.0817138
0.0824761
0.0806206
0.0796182
0.0796954
0.0766084
0.0760617
0.0773101
0.0807943
0.0849154
0.0880741
0.0904768
0.0915486
0.0914809
0.092381
0.0925081
0.0928101
0.0931572
0.0934669
0.0938562
0.0941441
0.0944995
0.0947452
0.0943572
0.0945404
0.0934229
0.0923816
0.0934091
0.0932426
0.0941238
0.0938343
0.0930264
0.0927735
0.0935417
0.0931942
0.0928784
0.0926013
0.0919346
0.0921735
0.0924862
0.0905115
0.0911329
0.09208
0.0923909
0.0919821
0.0920461
0.0915156
0.0912799
0.0917463
0.0908798
0.0903596
0.0898007
0.0906285
0.0901678
0.0904553
0.0892249
0.089164
0.0895886
0.0888228
0.089328
0.088697
0.0881136
0.088495
0.087851
0.0880223
0.0864909
0.0863676
0.0870556
0.0867109
0.0874455
0.086851
0.0874711
0.0878691
0.0874608
0.0861894
0.0854755
0.0860438
0.0852532
0.0854937
0.0843282
0.0850321
0.0830085
0.0821353
0.0817154
0.0827575
0.08395
0.0849066
0.0840673
0.0841863
0.0831377
0.0820276
0.0809308
0.079864
0.0805027
0.0792556
0.0798273
0.0807657
0.0775916
0.0769529
0.0736424
0.0748503
0.0721124
0.0697837
0.0702736
0.066186
0.0712731
0.0743289
0.076425
0.0778046
0.0770513
0.0785383
0.0776612
0.0790302
0.0796161
0.0759894
0.074097
0.0755718
0.0735761
0.0719134
0.0698056
0.0719434
0.0670298
0.0693237
0.0663186
0.0638945
0.0605515
0.0634202
0.0606547
0.0575991
0.0526125
0.0564688
0.0606816
0.0639661
0.0505118
0.0453028
0.0336119
0.0329811
0.0443711
0.0510568
0.0561581
0.0591774
0.0638267
0.0649937
0.05889
0.0589481
0.0562879
0.0516165
0.0469987
0.0508911
0.0533315
0.0566482
0.0596323
0.0550088
0.053676
0.0480658
0.0412396
0.0372527
0.023453
0.0343789
0.0433026
0.054257
0.0514146
0.0674001
0.0660579
0.0756921
0.0799987
0.0866316
0.0902097
0.0937249
0.0953966
0.0973434
0.0984745
0.0987404
0.100084
0.100065
0.101413
0.101503
0.100851
0.102045
0.101848
0.100997
0.102288
0.101935
0.100809
0.102281
0.101826
0.100608
0.102241
0.10178
0.100481
0.102146
0.101637
0.100381
0.102105
0.101567
0.100269
0.102106
0.101688
0.101008
0.0994686
0.101529
0.101012
0.0995649
0.101597
0.100939
0.0994091
0.101652
0.101108
0.0995643
0.101762
0.101163
0.0997226
0.102017
0.10141
0.0998353
0.102126
0.101538
0.100087
0.102478
0.101879
0.100166
0.102488
0.101259
0.103698
0.103169
0.101745
0.103967
0.103392
0.102092
0.104407
0.104007
0.102656
0.104794
0.104221
0.102817
0.105221
0.104821
0.103415
0.105532
0.104251
0.10636
0.10589
0.104698
0.106947
0.106596
0.1052
0.107426
0.106139
0.108322
0.10794
0.106789
0.108973
0.108597
0.107209
0.109211
0.10791
0.110111
0.109832
0.108757
0.110902
0.11059
0.10922
0.111415
0.110168
0.112349
0.111989
0.110759
0.112992
0.112072
0.114022
0.113571
0.112128
0.114358
0.113406
0.115546
0.115232
0.114015
0.116076
0.115115
0.116973
0.116493
0.115033
0.117399
0.116573
0.118666
0.118398
0.117144
0.119191
0.118131
0.119904
0.118751
0.12092
0.120708
0.119649
0.121723
0.120909
0.122799
0.122488
0.1212
0.123074
0.121868
0.124019
0.123253
0.125308
0.125132
0.124032
0.126086
0.12509
0.126934
0.125963
0.127761
0.127397
0.126258
0.128368
0.127573
0.12962
0.128861
0.130727
0.130501
0.129326
0.13126
0.130163
0.13204
0.131233
0.133157
0.133027
0.13197
0.133892
0.133023
0.134953
0.134105
0.135902
0.135568
0.134233
0.136479
0.135663
0.137716
0.136957
0.138826
0.138089
0.139876
0.139648
0.138528
0.14042
0.139442
0.141233
0.14037
0.142393
0.141755
0.143667
0.143573
0.14255
0.144582
0.143721
0.145535
0.14466
0.14644
0.145578
0.147419
0.147254
0.146235
0.148287
0.147528
0.149381
0.148579
0.150428
0.149697
0.151524
0.151364
0.150236
0.152311
0.151424
0.153471
0.15273
0.154674
0.153906
0.1557
0.154998
0.156825
0.156728
0.155673
0.157589
0.156682
0.158714
0.157845
0.159824
0.15909
0.161102
0.160498
0.162404
0.162346
0.161338
0.163435
0.16267
0.164591
0.163806
0.165677
0.164853
0.166714
0.166068
0.167936
0.167906
0.166916
0.168899
0.168182
0.170266
0.169496
0.171375
0.170591
0.172525
0.171911
0.173836
0.173837
0.172846
0.175082
0.17438
0.176413
0.175679
0.177678
0.176963
0.178844
0.178225
0.180159
0.180161
0.179179
0.181271
0.180548
0.182737
0.182
0.184015
0.183297
0.185373
0.184715
0.186689
0.186159
0.188258
0.188383
0.187483
0.189608
0.188989
0.191119
0.190466
0.192424
0.1918
0.193761
0.193235
0.195171
0.19525
0.194366
0.196451
0.195764
0.197826
0.197226
0.199394
0.198878
0.20091
0.200514
0.202653
0.202794
0.201915
0.204092
0.203432
0.205642
0.20502
0.207144
0.206612
0.208778
0.208393
0.210554
0.210849
0.210125
0.212333
0.211776
0.213794
0.213155
0.215367
0.214802
0.21694
0.216519
0.218819
0.21916
0.218369
0.220712
0.220269
0.222728
0.222393
0.224584
0.224149
0.226106
0.226258
0.225366
0.227611
0.227014
0.229491
0.22896
0.231264
0.230883
0.233435
0.233955
0.233317
0.235892
0.235669
0.238165
0.237605
0.23969
0.239132
0.241416
0.24166
0.240861
0.243394
0.242851
0.245682
0.24533
0.247958
0.247766
0.250552
0.251385
0.251009
0.253326
0.252624
0.255005
0.25439
0.256809
0.256346
0.258836
0.2593
0.258596
0.261315
0.261098
0.264151
0.264189
0.266986
0.268021
0.267437
0.269855
0.269107
0.271641
0.271182
0.274014
0.273768
0.276562
0.277266
0.276691
0.279667
0.279691
0.282815
0.283244
0.286294
0.287097
0.286097
0.288619
0.28808
0.290984
0.290778
0.293618
0.294456
0.293923
0.297017
0.297235
0.300754
0.302457
0.302689
0.305673
0.305306
0.307678
0.307107
0.310012
0.310749
0.310135
0.313518
0.313592
0.317523
0.319001
0.318809
0.322514
0.323447
0.326654
0.327616
0.326339
0.329284
0.328818
0.332639
0.333897
0.333438
0.337312
0.337598
0.34193
0.344172
0.344787
0.34868
0.349096
0.352075
0.3526
0.351448
0.355021
0.354832
0.358866
0.360724
0.360873
0.365482
0.367023
0.371854
0.37479
0.374746
0.377419
0.378086
0.377105
0.381348
0.381673
0.386458
0.389019
0.389748
0.39461
0.398404
0.400247
0.403362
0.404745
0.403244
0.407435
0.407507
0.412436
0.415378
0.416596
0.421858
0.426633
0.429155
0.432142
0.433677
0.432403
0.436677
0.439067
0.440019
0.446366
0.451328
0.4552
0.459077
0.462552
0.462983
0.461477
0.466994
0.470283
0.472559
0.479312
0.486643
0.491405
0.490814
0.493619
0.495304
0.497705
0.499891
0.507198
0.515284
0.519191
0.51713
0.520382
0.522667
0.527226
0.535327
0.538458
0.538535
0.540536
0.540976
0.544447
0.548667
0.548749
0.542358
0.542945
0.540611
0.537518
0.532265
0.524368
0.514979
0.50557
0.496816
0.489294
0.482942
0.477399
0.472436
0.467881
0.463691
0.459771
0.456124
0.452688
0.449492
0.446466
0.443646
0.440947
0.438421
0.435983
0.433696
0.431476
0.42939
0.427349
0.425427
0.423535
0.421749
0.419977
0.418301
0.416628
0.415041
0.413447
0.411935
0.410412
0.408969
0.407511
0.406127
0.404722
0.403389
0.402034
0.400748
0.399439
0.398198
0.396937
0.395739
0.394517
0.393358
0.392177
0.391056
0.389913
0.38883
0.387729
0.386684
0.385619
0.384608
0.383585
0.382609
0.38162
0.380677
0.379729
0.378824
0.377909
0.377039
0.376161
0.375332
0.374485
0.373692
0.372882
0.372131
0.371353
0.370641
0.369901
0.369232
0.368523
0.36789
0.367217
0.366626
0.365983
0.365426
0.364818
0.364301
0.36372
0.363235
0.362687
0.36224
0.361719
0.3613
0.360807
0.36042
0.359958
0.3596
0.359158
0.358828
0.358414
0.358111
0.357718
0.357441
0.357071
0.356819
0.356467
0.356238
0.355908
0.3557
0.355388
0.355201
0.354908
0.354741
0.354463
0.354315
0.354054
0.353923
0.353676
0.353561
0.35333
0.35323
0.353011
0.352926
0.352721
0.35265
0.352456
0.352397
0.352216
0.352169
0.351998
0.351962
0.351801
0.351775
0.351623
0.351606
0.351464
0.351456
0.351321
0.351322
0.351194
0.351202
0.351082
0.351098
0.350985
0.351007
0.3509
0.35093
0.35083
0.350865
0.350771
0.350812
0.350724
0.35077
0.350687
0.350738
0.35066
0.350716
0.350642
0.350703
0.350634
0.350698
0.350633
0.350701
0.35064
0.35071
0.350653
0.350727
0.350673
0.35075
0.350699
0.350779
0.350732
0.350814
0.35077
0.350856
0.350815
0.350903
0.350866
0.350958
0.350924
0.351018
0.350988
0.351086
0.351059
0.35116
0.351136
0.35124
0.351219
0.351325
0.351307
0.351416
0.3514
0.351509
0.351494
0.351605
0.351591
0.351709
0.351696
0.351806
0.351795
0.351906
0.351895
0.352013
0.351998
0.352136
0.352124
0.352244
0.352196
0.352059
0.351872
0.352762
0.354583
0.392307
0.41407
0.413814
0.391505
0.390381
0.412107
0.419325
0.419222
0.41945
0.431082
0.434139
0.434309
0.434637
0.430879
0.417632
0.412652
0.390884
0.390587
0.411233
0.412111
0.391113
0.390686
0.411017
0.41594
0.429402
0.429673
0.415453
0.411821
0.391068
0.390664
0.410818
0.411641
0.39106
0.390703
0.410865
0.414763
0.428821
0.4324
0.431458
0.429111
0.415033
0.411723
0.39111
0.390767
0.410887
0.411748
0.391181
0.390847
0.411012
0.414803
0.428497
0.428951
0.41509
0.411883
0.391276
0.390944
0.411091
0.411959
0.391372
0.391049
0.411237
0.41498
0.428437
0.431098
0.44063
0.440858
0.441276
0.441928
0.446041
0.445786
0.445626
0.445531
0.445492
0.440545
0.43096
0.428924
0.415264
0.412103
0.391477
0.391155
0.411324
0.412189
0.391589
0.391271
0.411471
0.415184
0.428448
0.428936
0.415466
0.412335
0.391707
0.391386
0.411563
0.412431
0.391828
0.391515
0.411719
0.415397
0.428476
0.43092
0.430915
0.428969
0.415681
0.412584
0.391959
0.391646
0.411821
0.41269
0.392097
0.391793
0.411989
0.415624
0.428529
0.429025
0.415915
0.412853
0.392247
0.391944
0.412099
0.412967
0.392404
0.39211
0.412274
0.415869
0.4286
0.430952
0.440461
0.440482
0.440507
0.44548
0.445473
0.445464
0.448641
0.448644
0.448644
0.448644
0.448656
0.448689
0.44875
0.448876
0.450874
0.450806
0.450775
0.45076
0.452187
0.452203
0.452232
0.452287
0.453264
0.453215
0.453184
0.45316
0.453139
0.452177
0.450755
0.450754
0.450751
0.450744
0.45214
0.452154
0.452167
0.453119
0.453097
0.453075
0.453717
0.453747
0.453776
0.453804
0.453833
0.453864
0.453899
0.453943
0.454422
0.454382
0.454347
0.454312
0.454662
0.454698
0.454732
0.454768
0.455025
0.454992
0.454961
0.454926
0.45489
0.454626
0.454278
0.454245
0.454211
0.454176
0.454516
0.454554
0.45459
0.454854
0.454816
0.454777
0.454735
0.454476
0.454139
0.453686
0.453051
0.452126
0.450737
0.448636
0.445454
0.440448
0.431003
0.429096
0.416163
0.413136
0.392573
0.392278
0.412393
0.413259
0.392747
0.392461
0.412575
0.416125
0.428683
0.429177
0.416422
0.413434
0.392932
0.392645
0.4127
0.413562
0.393122
0.392845
0.412887
0.41639
0.428773
0.431065
0.43113
0.429263
0.416686
0.413741
0.393323
0.393045
0.413016
0.413872
0.39353
0.39326
0.413205
0.416659
0.428865
0.42935
0.416954
0.414053
0.393747
0.393476
0.413337
0.414187
0.393971
0.393707
0.41353
0.416931
0.428957
0.431197
0.440466
0.440453
0.440445
0.445448
0.445451
0.445462
0.445478
0.440481
0.431264
0.429437
0.417225
0.41437
0.394204
0.393938
0.413665
0.414507
0.394442
0.394183
0.41386
0.417205
0.42905
0.429525
0.417497
0.414692
0.394691
0.39443
0.413998
0.414831
0.394947
0.394695
0.414195
0.417481
0.429145
0.431331
0.431403
0.429617
0.417771
0.415018
0.395213
0.394961
0.414335
0.415159
0.395485
0.395243
0.414535
0.417759
0.429245
0.429715
0.418048
0.415348
0.395767
0.395526
0.414678
0.415493
0.396056
0.395825
0.414881
0.41804
0.429351
0.431481
0.440552
0.440522
0.440499
0.445497
0.445522
0.445554
0.445596
0.44059
0.431566
0.429818
0.418327
0.415684
0.396355
0.396126
0.415027
0.415831
0.396661
0.396443
0.415233
0.418323
0.429463
0.429928
0.41861
0.416023
0.396979
0.396763
0.41538
0.416173
0.397303
0.397097
0.415589
0.418609
0.429582
0.431659
0.43176
0.430046
0.418895
0.416367
0.397637
0.397432
0.415739
0.416519
0.397976
0.397782
0.41595
0.418898
0.429709
0.430172
0.419182
0.416715
0.398325
0.398133
0.416102
0.416869
0.398682
0.3985
0.416315
0.419188
0.429844
0.43187
0.44076
0.440693
0.440636
0.445646
0.445707
0.44578
0.445864
0.440838
0.43199
0.430307
0.419471
0.417065
0.399048
0.398869
0.416469
0.417222
0.39942
0.399252
0.416685
0.419481
0.429987
0.43045
0.419763
0.417421
0.399802
0.399636
0.416842
0.417581
0.40019
0.400035
0.417061
0.419777
0.43014
0.432122
0.432268
0.430606
0.42006
0.417783
0.400588
0.400435
0.417222
0.417948
0.400992
0.40085
0.417447
0.42008
0.430308
0.430779
0.420364
0.418153
0.401406
0.401266
0.417612
0.418323
0.401828
0.401699
0.417841
0.420389
0.430493
0.432431
0.441162
0.441037
0.44093
0.445962
0.446076
0.446208
0.44938
0.449252
0.44914
0.449044
0.44896
0.448888
0.448827
0.448777
0.448735
0.448703
0.448677
0.448657
0.448641
0.448631
0.448631
0.450731
0.450726
0.450727
0.45209
0.4521
0.452112
0.453028
0.453006
0.452987
0.45297
0.452085
0.450735
0.450751
0.450771
0.450797
0.452108
0.452094
0.452086
0.452956
0.452947
0.452944
0.453504
0.453522
0.453543
0.453568
0.453595
0.453625
0.453655
0.454103
0.454066
0.454029
0.454354
0.454395
0.454436
0.454693
0.454649
0.454605
0.454561
0.454313
0.453994
0.453961
0.45393
0.453901
0.454199
0.454235
0.454274
0.454518
0.454475
0.454434
0.454395
0.454165
0.453875
0.45349
0.452947
0.452127
0.450831
0.450874
0.450926
0.450989
0.452234
0.452189
0.452154
0.452956
0.45297
0.452993
0.453024
0.452289
0.451063
0.45115
0.45125
0.451366
0.452526
0.452434
0.452355
0.453064
0.453114
0.453176
0.453557
0.453525
0.453502
0.453487
0.45348
0.453478
0.453481
0.453853
0.453834
0.45382
0.454078
0.454104
0.454133
0.454357
0.45432
0.454285
0.454252
0.454054
0.453809
0.453804
0.453804
0.45381
0.454003
0.454016
0.454033
0.45422
0.45419
0.454162
0.4543
0.454339
0.454379
0.454419
0.454459
0.454499
0.454541
0.454583
0.454626
0.454671
0.454716
0.454762
0.454807
0.454853
0.454898
0.454941
0.454983
0.455022
0.45506
0.455095
0.455129
0.455162
0.45519
0.45522
0.455372
0.455346
0.455321
0.45529
0.45542
0.455447
0.45547
0.455492
0.45559
0.45557
0.455551
0.455527
0.4555
0.455391
0.455258
0.455224
0.455188
0.455149
0.455287
0.455324
0.455359
0.45547
0.455438
0.455402
0.4555
0.455534
0.455564
0.455591
0.455615
0.455636
0.455653
0.455669
0.455735
0.455722
0.455707
0.455689
0.455751
0.455767
0.455779
0.45579
0.455835
0.455826
0.455816
0.455802
0.455786
0.455732
0.455667
0.455643
0.455615
0.455583
0.455655
0.455684
0.45571
0.455766
0.455742
0.455715
0.455764
0.45579
0.455812
0.455829
0.455844
0.455856
0.455864
0.455871
0.455898
0.455892
0.455886
0.455875
0.455896
0.455906
0.455911
0.455916
0.455926
0.455922
0.455917
0.455909
0.455898
0.455885
0.455863
0.455846
0.455826
0.455802
0.455827
0.455851
0.45587
0.455884
0.455865
0.455842
0.455814
0.455799
0.455772
0.455734
0.455683
0.455621
0.455548
0.455463
0.455364
0.455247
0.455108
0.455065
0.45502
0.454974
0.455114
0.45516
0.455204
0.455322
0.455279
0.455233
0.455186
0.455067
0.454927
0.45488
0.454833
0.454787
0.454925
0.454972
0.455019
0.455139
0.455092
0.455045
0.455149
0.455196
0.455243
0.45529
0.455336
0.45538
0.455423
0.45551
0.455468
0.455425
0.455501
0.455544
0.455584
0.455647
0.455608
0.455567
0.455525
0.455458
0.45538
0.455334
0.455288
0.455242
0.455325
0.455369
0.455413
0.455483
0.455441
0.455397
0.455342
0.455278
0.455195
0.455102
0.454997
0.454878
0.454742
0.454697
0.454652
0.454607
0.454736
0.454784
0.454831
0.454949
0.4549
0.45485
0.454799
0.454687
0.454562
0.454516
0.45447
0.454423
0.454533
0.454587
0.454637
0.454746
0.454684
0.454602
0.454596
0.454724
0.454822
0.454895
0.454953
0.455004
0.455053
0.455147
0.455095
0.455032
0.455065
0.455157
0.455225
0.455271
0.455176
0.455057
0.454917
0.454948
0.454949
0.454838
0.454699
0.454538
0.45447
0.454645
0.454806
0.454762
0.454594
0.454412
0.454364
0.454553
0.454725
0.454885
0.455032
0.455166
0.455282
0.455376
0.455448
0.455501
0.455543
0.455583
0.455622
0.455662
0.455699
0.455739
0.455703
0.455665
0.455696
0.455731
0.455766
0.455782
0.455748
0.455714
0.45568
0.455661
0.455629
0.45559
0.45554
0.455473
0.45548
0.45556
0.455619
0.455633
0.455567
0.455479
0.455376
0.45538
0.455384
0.455275
0.45515
0.455012
0.454999
0.455138
0.455265
0.455259
0.455132
0.454993
0.45484
0.454848
0.454862
0.4547
0.454522
0.454325
0.454298
0.4545
0.454682
0.454672
0.454486
0.454281
0.454053
0.454073
0.454108
0.454155
0.454213
0.45428
0.454359
0.45444
0.454491
0.454469
0.454378
0.454261
0.454136
0.453994
0.453824
0.453599
0.453251
0.452633
0.451498
0.449526
0.446359
0.441308
0.432616
0.43097
0.420676
0.418533
0.402259
0.402133
0.418012
0.418709
0.402698
0.402582
0.418249
0.420709
0.430698
0.431183
0.421
0.418925
0.403146
0.403034
0.418426
0.419109
0.403602
0.403502
0.418669
0.421042
0.430926
0.432825
0.433063
0.431422
0.421338
0.41933
0.404067
0.403969
0.418852
0.419521
0.404539
0.404453
0.419105
0.42139
0.431181
0.431691
0.421694
0.419752
0.405019
0.404937
0.419297
0.419954
0.405508
0.405437
0.419562
0.421759
0.431469
0.433335
0.441904
0.441674
0.441477
0.446534
0.446734
0.446966
0.447232
0.442171
0.433646
0.431996
0.422073
0.420194
0.406005
0.405938
0.419767
0.420415
0.406511
0.406454
0.420047
0.422155
0.431797
0.432344
0.422485
0.420663
0.407021
0.406973
0.420265
0.420911
0.407552
0.407511
0.420572
0.422589
0.432171
0.434003
0.434416
0.432743
0.422937
0.421172
0.408077
0.408046
0.420803
0.421445
0.408625
0.408603
0.421136
0.423067
0.432598
0.4332
0.423439
0.421731
0.40917
0.409156
0.421394
0.422032
0.409738
0.409734
0.421757
0.4236
0.433091
0.434894
0.44327
0.442846
0.442482
0.447539
0.447894
0.448304
0.448779
0.443765
0.43545
0.433732
0.424008
0.422351
0.410305
0.410312
0.422049
0.422687
0.410898
0.410916
0.422449
0.424208
0.433662
0.434348
0.424656
0.423047
0.411493
0.411523
0.422784
0.423426
0.412117
0.41216
0.423228
0.424903
0.434323
0.436098
0.436853
0.435062
0.4254
0.423834
0.412747
0.412804
0.423614
0.424266
0.41341
0.413482
0.424112
0.425705
0.435092
0.435894
0.426262
0.424732
0.414085
0.414175
0.42456
0.425229
0.414799
0.414907
0.425126
0.426637
0.435985
0.437733
0.445809
0.445019
0.444343
0.449328
0.449963
0.450698
0.451548
0.446733
0.438762
0.436863
0.427268
0.425767
0.415528
0.415661
0.42565
0.426343
0.416307
0.416468
0.426301
0.427729
0.437027
0.437994
0.428452
0.426981
0.417115
0.417303
0.426921
0.427645
0.417975
0.418196
0.427673
0.429019
0.438241
0.439966
0.44138
0.439313
0.429851
0.428399
0.418879
0.41913
0.428411
0.429182
0.419841
0.420133
0.429287
0.430546
0.439656
0.440852
0.43151
0.430071
0.420863
0.421192
0.430167
0.431
0.421957
0.422334
0.431196
0.432362
0.441306
0.443042
0.45056
0.449078
0.447813
0.45253
0.453665
0.454978
0.45725
0.456113
0.45512
0.454254
0.453499
0.452842
0.45227
0.451773
0.451341
0.450965
0.450637
0.450352
0.450102
0.449884
0.449693
0.451648
0.45182
0.452015
0.453059
0.452897
0.452756
0.45334
0.453444
0.453566
0.453709
0.453245
0.452238
0.452492
0.452782
0.453113
0.453981
0.453702
0.453458
0.453876
0.454069
0.454291
0.454325
0.454156
0.454014
0.453895
0.453798
0.453718
0.453652
0.453846
0.453877
0.453916
0.453998
0.453991
0.45399
0.454112
0.454092
0.454079
0.454068
0.454019
0.453969
0.454044
0.454142
0.454251
0.454136
0.454095
0.454052
0.454053
0.454025
0.45398
0.453915
0.454167
0.454376
0.454522
0.454546
0.4543
0.453493
0.453927
0.454424
0.454992
0.455546
0.455077
0.454664
0.454837
0.455173
0.455551
0.455964
0.456077
0.455638
0.45637
0.4572
0.458139
0.458092
0.457352
0.456679
0.45642
0.45692
0.457448
0.456385
0.456114
0.45583
0.455541
0.455254
0.454984
0.45474
0.454513
0.454646
0.454772
0.454186
0.454195
0.454189
0.453829
0.453723
0.453595
0.453442
0.454159
0.454891
0.454999
0.455088
0.455158
0.453935
0.454038
0.454111
0.45326
0.453041
0.452778
0.452463
0.453804
0.455221
0.456644
0.457974
0.458898
0.459199
0.45855
0.456498
0.452302
0.445001
0.442656
0.433489
0.432056
0.423129
0.423555
0.432255
0.433167
0.424395
0.424881
0.433474
0.434535
0.443243
0.444778
0.435864
0.434431
0.425765
0.426313
0.434754
0.435769
0.427251
0.427872
0.436211
0.437152
0.445526
0.447318
0.450064
0.447282
0.438732
0.43729
0.42887
0.429572
0.437766
0.438913
0.430641
0.431438
0.439524
0.440324
0.448229
0.45026
0.442222
0.440757
0.432589
0.433488
0.441424
0.442739
0.434728
0.435747
0.44356
0.444202
0.451462
0.453309
0.459541
0.456766
0.454356
0.458258
0.460263
0.462471
0.464887
0.462649
0.457126
0.453846
0.446513
0.444992
0.4371
0.438256
0.445906
0.447443
0.439734
0.441057
0.448545
0.449014
0.455425
0.458313
0.451902
0.450251
0.442701
0.444217
0.451499
0.453351
0.446046
0.447793
0.45482
0.455121
0.46048
0.461661
0.467341
0.46399
0.45879
0.456892
0.449852
0.451873
0.458573
0.460887
0.454213
0.456571
0.462865
0.462962
0.466947
0.471206
0.467739
0.465475
0.459258
0.462044
0.467808
0.470815
0.465184
0.468483
0.47359
0.47335
0.475513
0.475125
0.478746
0.471136
0.466235
0.4679
0.472471
0.478293
0.482989
0.486887
0.485902
0.481518
0.479727
0.476984
0.472116
0.475994
0.480187
0.484054
0.480293
0.484986
0.487894
0.487054
0.487539
0.494609
0.495598
0.49249
0.490339
0.496379
0.49756
0.503501
0.503229
0.510814
0.509975
0.506127
0.502856
0.496648
0.503154
0.508842
0.516027
0.516385
0.518545
0.525838
0.52304
0.527459
0.531542
0.535416
0.531096
0.52231
0.512657
0.515874
0.524847
0.533855
0.538115
0.539837
0.53568
0.536964
0.541312
0.547026
0.546644
0.540909
0.538298
0.537256
0.524499
0.516314
0.505497
0.495662
0.494916
0.492227
0.485451
0.486593
0.486262
0.483525
0.493467
0.503367
0.515819
0.522792
0.519506
0.533201
0.540478
0.540982
0.543895
0.537093
0.53367
0.53479
0.528008
0.526872
0.526964
0.511607
0.517116
0.523282
0.523676
0.520418
0.518738
0.515698
0.517308
0.519993
0.515632
0.510022
0.505465
0.503189
0.501795
0.498087
0.495184
0.494897
0.495546
0.499343
0.487074
0.491616
0.492265
0.492449
0.487683
0.486994
0.481297
0.485587
0.482004
0.476229
0.474629
0.47077
0.467419
0.466153
0.463932
0.463542
0.460125
0.456247
0.454656
0.450022
0.451376
0.454454
0.453936
0.459349
0.463347
0.471069
0.472269
0.467171
0.469093
0.479018
0.476824
0.470331
0.466295
0.483881
0.493952
0.501052
0.497188
0.510991
0.509174
0.511804
0.488537
0.497683
0.487792
0.478169
0.4708
0.479724
0.469897
0.477598
0.46553
0.452759
0.457166
0.443098
0.443645
0.447079
0.447118
0.447618
0.446519
0.443572
0.440268
0.437605
0.436025
0.433845
0.434429
0.438761
0.442478
0.44279
0.430639
0.431331
0.43093
0.429295
0.425006
0.421377
0.419046
0.416039
0.418024
0.423331
0.426812
0.426888
0.423814
0.431098
0.439196
0.43794
0.431475
0.418307
0.416795
0.417431
0.416342
0.415232
0.413804
0.410936
0.409106
0.407369
0.405558
0.402834
0.400969
0.397446
0.399917
0.394682
0.392613
0.390151
0.388112
0.385067
0.383413
0.381121
0.380051
0.38175
0.386369
0.389168
0.393785
0.391996
0.395349
0.402971
0.401562
0.4082
0.406449
0.403049
0.411058
0.411644
0.409731
0.409479
0.390572
0.390095
0.388844
0.383127
0.380699
0.379776
0.378674
0.376654
0.374119
0.37152
0.369652
0.367463
0.364055
0.361771
0.365802
0.360607
0.358325
0.357518
0.355075
0.354122
0.352828
0.351514
0.349825
0.347163
0.344807
0.348301
0.350703
0.355136
0.356187
0.35714
0.360735
0.359076
0.364362
0.368776
0.374157
0.368625
0.376228
0.376915
0.375577
0.378117
0.369615
0.383535
0.38086
0.382596
0.393428
0.405477
0.406382
0.394554
0.383462
0.383335
0.394176
0.405481
0.417275
0.430068
0.427346
0.439893
0.435473
0.447244
0.458887
0.451911
0.46188
0.454069
0.462196
0.469035
0.474248
0.477539
0.478851
0.478767
0.477846
0.475784
0.472061
0.468109
0.465385
0.46341
0.461653
0.460024
0.460365
0.461598
0.462944
0.461676
0.460638
0.459751
0.458496
0.459089
0.459924
0.460823
0.463177
0.464652
0.467132
0.469718
0.471321
0.466301
0.465853
0.464798
0.461403
0.461638
0.461575
0.457211
0.457771
0.457949
0.457895
0.457701
0.457329
0.456935
0.455281
0.455324
0.45531
0.453078
0.453406
0.453636
0.452083
0.451611
0.45101
0.450235
0.452595
0.455156
0.454803
0.454185
0.453208
0.449599
0.450918
0.451895
0.449238
0.447965
0.446363
0.444375
0.447868
0.451792
0.456189
0.461064
0.466348
0.47201
0.472139
0.471413
0.46933
0.461803
0.464364
0.465814
0.459915
0.457972
0.455111
0.451275
0.458041
0.465719
0.460631
0.454243
0.446805
0.440256
0.447117
0.453105
0.446486
0.440828
0.434431
0.429275
0.4353
0.440694
0.44536
0.449236
0.4523
0.45459
0.449851
0.447303
0.444093
0.439593
0.442914
0.445659
0.441951
0.439049
0.435642
0.431723
0.435683
0.440196
0.435632
0.430449
0.424721
0.420693
0.426185
0.431201
0.427307
0.422425
0.417124
0.411459
0.414795
0.418536
0.422732
0.427446
0.432723
0.438594
0.445042
0.435464
0.441352
0.430581
0.41984
0.423827
0.412489
0.415224
0.403702
0.392763
0.382303
0.380985
0.391056
0.401533
0.399014
0.409288
0.405937
0.415735
0.425625
0.420863
0.429873
0.424716
0.420023
0.412304
0.416409
0.407946
0.411738
0.402627
0.393623
0.396326
0.386968
0.389093
0.37951
0.370332
0.371426
0.372397
0.372976
0.372776
0.371892
0.37034
0.367774
0.358174
0.354507
0.352549
0.350969
0.346612
0.343803
0.341773
0.339886
0.336846
0.33553
0.338505
0.337848
0.339901
0.334399
0.332453
0.331883
0.329571
0.328457
0.331124
0.327251
0.325494
0.324265
0.32173
0.320195
0.318949
0.316979
0.316315
0.313337
0.31237
0.316006
0.317697
0.322097
0.322774
0.323915
0.32718
0.325698
0.330932
0.324174
0.320636
0.31882
0.315613
0.31293
0.31119
0.30979
0.307674
0.306678
0.304993
0.303585
0.302523
0.299839
0.298764
0.296834
0.296084
0.297925
0.301916
0.303702
0.308005
0.305116
0.308755
0.309789
0.304886
0.302535
0.306232
0.312984
0.309699
0.316772
0.323072
0.316547
0.309541
0.306208
0.299771
0.296075
0.293699
0.292099
0.289694
0.29013
0.28819
0.288917
0.290887
0.291144
0.292992
0.293404
0.295622
0.294971
0.294663
0.292159
0.291137
0.296028
0.298789
0.297048
0.296558
0.287274
0.285668
0.284935
0.282265
0.281451
0.279593
0.278995
0.280822
0.284749
0.286231
0.286924
0.289395
0.287247
0.290528
0.284053
0.282301
0.280026
0.278647
0.276475
0.276185
0.274195
0.274038
0.271884
0.271557
0.270037
0.269295
0.268772
0.266533
0.265809
0.264076
0.263876
0.261365
0.260767
0.264096
0.265169
0.268562
0.269844
0.273389
0.270648
0.273577
0.274689
0.277729
0.27548
0.278079
0.279103
0.275059
0.278338
0.272595
0.271198
0.269612
0.266161
0.2644
0.262543
0.260388
0.259089
0.257122
0.257034
0.255396
0.255186
0.253303
0.252593
0.252027
0.250457
0.250314
0.248027
0.247729
0.245986
0.246101
0.243634
0.243246
0.246574
0.243413
0.24179
0.241836
0.240064
0.239915
0.238204
0.238017
0.235946
0.235448
0.235103
0.23357
0.233649
0.231543
0.231405
0.229874
0.230093
0.227993
0.227739
0.230593
0.227912
0.22645
0.226465
0.224705
0.2246
0.222915
0.222895
0.220981
0.220689
0.220528
0.219073
0.219281
0.217308
0.217342
0.215861
0.216124
0.214112
0.214004
0.212609
0.212441
0.213891
0.2167
0.217357
0.219814
0.220466
0.223087
0.222716
0.223862
0.226368
0.226288
0.22726
0.229582
0.227629
0.231212
0.235573
0.232399
0.23403
0.231287
0.234851
0.237958
0.237668
0.238873
0.241486
0.239381
0.241571
0.242504
0.245158
0.243036
0.243702
0.242569
0.244919
0.249715
0.246712
0.248673
0.250548
0.251549
0.25468
0.254665
0.255762
0.258644
0.258791
0.259794
0.256424
0.256545
0.258763
0.260811
0.262264
0.264603
0.259886
0.257213
0.254325
0.252832
0.251008
0.252219
0.25283
0.248542
0.245614
0.241571
0.238659
0.23482
0.231808
0.229606
0.228302
0.226809
0.22482
0.223168
0.221814
0.220517
0.218497
0.216973
0.215598
0.213628
0.212481
0.210734
0.210806
0.209153
0.209323
0.207514
0.207633
0.206078
0.206257
0.204538
0.204457
0.204424
0.202969
0.20324
0.201226
0.201264
0.199853
0.200183
0.19824
0.198291
0.196911
0.196946
0.198355
0.200849
0.20136
0.203916
0.204454
0.206626
0.206245
0.207257
0.209733
0.207427
0.209373
0.210417
0.212545
0.21058
0.2124
0.213334
0.211075
0.213769
0.209909
0.208695
0.208127
0.205363
0.204353
0.203053
0.202658
0.199871
0.198283
0.197153
0.195515
0.19572
0.194255
0.19453
0.192892
0.193084
0.191564
0.191783
0.190061
0.189988
0.190027
0.188664
0.189027
0.187189
0.187396
0.185996
0.186467
0.184568
0.184757
0.18335
0.183807
0.18181
0.181759
0.184539
0.184965
0.187225
0.187642
0.189702
0.190156
0.192359
0.191829
0.192897
0.19497
0.194636
0.195575
0.197679
0.19564
0.197258
0.198206
0.199071
0.197866
0.196707
0.195654
0.193889
0.192683
0.191497
0.190596
0.188797
0.187707
0.186477
0.185719
0.183907
0.182229
0.18106
0.179403
0.179708
0.178257
0.178591
0.176928
0.177203
0.175668
0.175783
0.176187
0.174288
0.174527
0.173215
0.173729
0.171989
0.172218
0.170875
0.171359
0.169466
0.16947
0.172143
0.169918
0.168511
0.168964
0.167384
0.167795
0.166367
0.166783
0.16517
0.165486
0.164072
0.16423
0.164634
0.162884
0.163153
0.16178
0.162363
0.16052
0.160882
0.159532
0.160145
0.158278
0.158367
0.160998
0.161257
0.163232
0.163506
0.165335
0.16567
0.16757
0.165472
0.167051
0.167985
0.169735
0.169246
0.170172
0.171869
0.170059
0.173134
0.176225
0.173695
0.174467
0.172461
0.174805
0.176946
0.177313
0.179184
0.177133
0.178783
0.179692
0.181767
0.179686
0.18128
0.182261
0.181034
0.180719
0.182137
0.185278
0.182967
0.186792
0.190042
0.191649
0.194973
0.196677
0.199836
0.197384
0.194733
0.192425
0.189902
0.187626
0.18523
0.183005
0.180698
0.178512
0.176266
0.17403
0.172276
0.17128
0.170506
0.168945
0.168035
0.166962
0.166318
0.164703
0.16391
0.162769
0.162275
0.160664
0.15905
0.157943
0.156359
0.156761
0.155324
0.155784
0.154153
0.154597
0.153107
0.153402
0.153927
0.152117
0.152443
0.151168
0.151734
0.149982
0.150241
0.1489
0.149177
0.150536
0.152606
0.152804
0.154747
0.154998
0.156663
0.154697
0.156124
0.157021
0.158843
0.156869
0.158264
0.159204
0.158357
0.158243
0.159391
0.162047
0.159979
0.163272
0.165987
0.167289
0.170052
0.171434
0.168062
0.166085
0.1641
0.16221
0.160265
0.15844
0.156519
0.154519
0.152237
0.150728
0.149658
0.148121
0.148627
0.147253
0.147784
0.146263
0.14668
0.145283
0.145515
0.145998
0.144205
0.144551
0.143167
0.143872
0.142082
0.142509
0.141214
0.141572
0.142898
0.144854
0.14501
0.146816
0.147051
0.148717
0.148146
0.149028
0.150668
0.148823
0.150029
0.150919
0.151865
0.151186
0.150196
0.149674
0.148213
0.147569
0.14649
0.146132
0.14465
0.143111
0.142062
0.140516
0.140956
0.139538
0.140037
0.138404
0.138923
0.137391
0.137805
0.138437
0.136649
0.137054
0.135782
0.136426
0.134605
0.134744
0.137329
0.13533
0.133908
0.134536
0.132963
0.133551
0.132173
0.13255
0.133145
0.131421
0.131816
0.130433
0.131145
0.129133
0.129404
0.132187
0.130139
0.128727
0.129405
0.127841
0.128414
0.12694
0.127303
0.127944
0.126013
0.126517
0.125102
0.125973
0.124085
0.124406
0.127046
0.125074
0.123635
0.124226
0.122516
0.122895
0.123414
0.121947
0.122851
0.120974
0.121552
0.120142
0.120621
0.122083
0.124029
0.124019
0.125723
0.124739
0.125779
0.127088
0.125415
0.129437
0.127084
0.126794
0.125691
0.125655
0.124173
0.122432
0.121248
0.119451
0.12008
0.118443
0.118998
0.119803
0.117917
0.118433
0.117008
0.117511
0.118966
0.120884
0.120896
0.122659
0.120381
0.121803
0.122786
0.122754
0.123252
0.120987
0.119359
0.11819
0.116431
0.117141
0.115508
0.116098
0.11693
0.114962
0.115487
0.113949
0.114517
0.116083
0.118066
0.118047
0.119708
0.117495
0.118806
0.119756
0.121063
0.12087
0.119766
0.119834
0.118327
0.116518
0.115296
0.113441
0.11417
0.112572
0.113119
0.113907
0.111761
0.11207
0.115022
0.112953
0.111322
0.112178
0.110359
0.110909
0.111441
0.109899
0.110478
0.112024
0.114056
0.112905
0.113982
0.115337
0.113467
0.117803
0.11709
0.11685
0.114499
0.115002
0.115937
0.116929
0.118211
0.120202
0.118261
0.120782
0.122491
0.121743
0.123132
0.124015
0.124938
0.125893
0.126598
0.128445
0.130074
0.131207
0.132337
0.130242
0.128927
0.12708
0.129036
0.130581
0.128622
0.129899
0.130783
0.132275
0.130483
0.13217
0.133129
0.135276
0.133382
0.133759
0.133988
0.134148
0.135777
0.133766
0.135031
0.135938
0.137212
0.135641
0.139487
0.139194
0.139314
0.137464
0.139492
0.141073
0.139108
0.140447
0.14134
0.143009
0.142409
0.1433
0.141116
0.142697
0.142731
0.140589
0.140336
0.143685
0.146042
0.147076
0.149454
0.150569
0.152815
0.151307
0.153094
0.154757
0.156613
0.154863
0.153139
0.151416
0.149681
0.147899
0.146341
0.14458
0.143093
0.141343
0.139937
0.138179
0.136559
0.135518
0.135238
0.136165
0.13703
0.136986
0.135679
0.134057
0.132834
0.131624
0.133176
0.134404
0.135972
0.137266
0.138598
0.140218
0.14162
0.143287
0.144794
0.146475
0.14806
0.149759
0.151454
0.149827
0.14815
0.146604
0.144946
0.143484
0.141849
0.140465
0.138859
0.137549
0.136301
0.134733
0.133564
0.132022
0.130494
0.128988
0.1275
0.126464
0.127931
0.126923
0.125464
0.124545
0.125987
0.12511
0.123686
0.122291
0.120928
0.119485
0.118805
0.117363
0.115633
0.114443
0.11248
0.111289
0.109486
0.110283
0.108644
0.109252
0.110113
0.107908
0.108332
0.111319
0.109294
0.107668
0.108574
0.106721
0.107307
0.109322
0.110462
0.110389
0.111959
0.109854
0.113301
0.115289
0.114683
0.112879
0.110668
0.111228
0.111967
0.112913
0.112987
0.115711
0.114936
0.113342
0.112238
0.112476
0.110901
0.109003
0.107776
0.105896
0.106463
0.10845
0.109544
0.109469
0.107061
0.105477
0.106169
0.107717
0.108219
0.107011
0.105168
0.105845
0.10773
0.108809
0.108721
0.110097
0.11132
0.113092
0.111045
0.113443
0.112854
0.111387
0.110387
0.11064
0.109193
0.10744
0.104442
0.10387
0.106098
0.104979
0.106521
0.107243
0.105358
0.103765
0.104496
0.105487
0.103411
0.10395
0.106704
0.104853
0.10331
0.104047
0.105026
0.103017
0.103522
0.106225
0.104396
0.102938
0.103677
0.104587
0.102769
0.103236
0.105669
0.10402
0.10271
0.103275
0.103821
0.104953
0.106139
0.104471
0.108191
0.10666
0.105378
0.104502
0.10312
0.103684
0.10421
0.103104
0.103681
0.104714
0.105853
0.105055
0.105766
0.106196
0.105093
0.104324
0.103139
0.103633
0.104782
0.105429
0.105395
0.104045
0.103106
0.103541
0.104393
0.104603
0.103996
0.103075
0.103377
0.10422
0.104554
0.1047
0.105471
0.105203
0.106024
0.104808
0.104267
0.103558
0.103085
0.102356
0.102194
0.102878
0.102768
0.103347
0.101844
0.101268
0.100661
0.0996388
0.0985756
0.0998445
0.0971308
0.0958399
0.093337
0.0905303
0.0866751
0.0825199
0.0790779
0.0731424
0.065843
0.0575604
0.0504369
0.0467562
0.0535839
0.0587152
0.057991
0.0625812
0.0666468
0.0630583
0.06478
0.060765
0.0561902
0.0610514
0.0668555
0.0722868
0.0718636
0.0682795
0.0641797
0.0671924
0.0695669
0.076176
0.0738772
0.0703108
0.0732525
0.078945
0.0777057
0.0809092
0.0873014
0.0827716
0.0898082
0.0909791
0.0956192
0.0946627
0.0917355
0.0906144
0.0837409
0.0837427
0.0798421
0.0832632
0.0857848
0.0815364
0.0790709
0.0786679
0.0795677
0.0808814
0.0821526
0.0831078
0.0836422
0.0829189
0.0821498
0.0806823
0.0785738
0.0760336
0.0718298
0.0669779
0.0702884
0.0732181
0.0683897
0.0636943
0.0666432
0.0722217
0.0846349
0.0857997
0.0856701
0.084321
0.0837952
0.0854615
0.0870839
0.0870741
0.0870543
0.0883391
0.089617
0.0908668
0.0911501
0.0898421
0.088477
0.0886308
0.09009
0.0914575
0.0918209
0.0903977
0.0888403
0.0871247
0.0852281
0.0831385
0.0825626
0.0851223
0.0853612
0.0824184
0.0831203
0.0861562
0.0885505
0.0877302
0.0872971
0.0891692
0.090812
0.092275
0.0928511
0.0913826
0.0896996
0.0905049
0.0921497
0.0935718
0.0948283
0.0941564
0.0935942
0.0931278
0.0927365
0.0923942
0.0920748
0.0917533
0.0913623
0.0924763
0.0935629
0.0946168
0.0956344
0.0966136
0.0975532
0.0984529
0.0993127
0.100133
0.100915
0.10166
0.102367
0.103038
0.103674
0.104276
0.104506
0.103923
0.103306
0.102654
0.101966
0.101241
0.100478
0.0996782
0.0988394
0.0979577
0.0970325
0.096063
0.0950493
0.0939917
0.0928919
0.0932344
0.0943436
0.095402
0.0957495
0.0946916
0.0935741
0.0939334
0.0950552
0.0961088
0.0971001
0.0967512
0.0964103
0.09737
0.0982828
0.0991508
0.0994515
0.0985991
0.0976999
0.0980345
0.0989163
0.0997492
0.100055
0.0992451
0.0983852
0.0974706
0.0964956
0.095453
0.0943341
0.0947961
0.0959006
0.0969226
0.0973991
0.096409
0.095334
0.0959575
0.0969857
0.0979315
0.0988082
0.0983174
0.0978736
0.0987623
0.0995955
0.100379
0.100728
0.0999752
0.0991736
0.0996254
0.100391
0.10111
0.101786
0.101436
0.101116
0.100818
0.100536
0.10026
0.0999759
0.10076
0.101505
0.102212
0.102435
0.101749
0.101025
0.10128
0.101983
0.102647
0.103274
0.103083
0.102881
0.103514
0.104112
0.104677
0.104818
0.104273
0.103695
0.103866
0.104424
0.10495
0.105083
0.104576
0.104037
0.103466
0.10286
0.102218
0.101538
0.10181
0.102466
0.103084
0.103327
0.102733
0.102103
0.102424
0.103027
0.103596
0.104133
0.103887
0.103667
0.104218
0.104736
0.105224
0.105383
0.104914
0.104415
0.10464
0.105119
0.10557
0.105806
0.105369
0.104907
0.104418
0.103903
0.103358
0.102783
0.102175
0.101531
0.100849
0.100124
0.0993511
0.0985243
0.0976345
0.0966699
0.0956139
0.0944436
0.093126
0.0916133
0.0898333
0.0876753
0.0849821
0.0879046
0.0898224
0.0922072
0.09105
0.0901139
0.08957
0.0940307
0.0952966
0.0987023
0.101535
0.100751
0.0971244
0.0935179
0.103537
0.103848
0.104015
0.101601
0.105205
0.106941
0.107781
0.10687
0.106301
0.106173
0.10669
0.106944
0.108123
0.106829
0.109234
0.109521
0.109648
0.10801
0.106887
0.104922
0.105485
0.107401
0.108311
0.107739
0.109573
0.107234
0.105392
0.106005
0.10867
0.108114
0.105893
0.106516
0.109385
0.111245
0.111519
0.109707
0.111074
0.112229
0.112559
0.113669
0.114092
0.114519
0.115729
0.116272
0.116826
0.118137
0.117511
0.116942
0.11642
0.115235
0.114778
0.114338
0.113271
0.112866
0.111875
0.110848
0.110555
0.11014
0.109495
0.108712
0.10773
0.106182
0.107119
0.10847
0.10925
0.110253
0.110979
0.111482
0.112408
0.111827
0.111059
0.111945
0.112721
0.113356
0.113879
0.114923
0.115438
0.115926
0.117106
0.117641
0.118196
0.118791
0.119438
0.120144
0.121499
0.120774
0.120105
0.121445
0.122139
0.122882
0.124291
0.123525
0.122806
0.122121
0.120791
0.119482
0.11889
0.118314
0.117735
0.11657
0.116006
0.115391
0.114347
0.113679
0.112921
0.112117
0.11107
0.110113
0.109101
0.108082
0.106944
0.105731
0.104451
0.102992
0.101162
0.0985642
0.100982
0.10289
0.104502
0.103529
0.101743
0.0996821
0.0972022
0.0966438
0.0937485
0.0939711
0.0945605
0.0953162
0.0933883
0.0915079
0.0929838
0.0942879
0.095453
0.0965722
0.0955841
0.0945216
0.0961349
0.0969628
0.097773
0.099034
0.0983856
0.0977616
0.0971986
0.0967571
0.0965335
0.0987666
0.0990288
0.101068
0.102878
0.102524
0.100738
0.100635
0.0987734
0.0990006
0.0993709
0.0998299
0.10034
0.101681
0.101283
0.100952
0.10072
0.102367
0.102369
0.104002
0.104182
0.104541
0.105137
0.10595
0.107322
0.108149
0.109373
0.110187
0.111337
0.110626
0.110008
0.108667
0.108082
0.10664
0.106108
0.105753
0.105561
0.107063
0.107268
0.107611
0.109069
0.10949
0.110878
0.111351
0.111907
0.112542
0.113243
0.113982
0.114712
0.115815
0.116494
0.117133
0.118305
0.118935
0.119551
0.120164
0.121462
0.120815
0.120171
0.121441
0.122108
0.122783
0.123472
0.124185
0.124931
0.125719
0.126557
0.12745
0.128401
0.129419
0.13093
0.129899
0.128932
0.13043
0.131414
0.132458
0.134
0.135119
0.136685
0.13788
0.13914
0.140744
0.142083
0.143708
0.145124
0.146769
0.148264
0.149929
0.151506
0.153151
0.15486
0.156622
0.158429
0.160302
0.16213
0.164096
0.165946
0.168
0.170076
0.172137
0.174159
0.172011
0.169872
0.17172
0.173911
0.176135
0.17837
0.180401
0.182799
0.18484
0.187361
0.189424
0.192066
0.194149
0.196913
0.199688
0.202407
0.205267
0.207796
0.210784
0.213347
0.216473
0.219627
0.21567
0.214541
0.221651
0.225766
0.227898
0.222398
0.21909
0.215763
0.212473
0.210188
0.207079
0.2048
0.201907
0.204055
0.20614
0.209263
0.211373
0.214672
0.218067
0.221538
0.225054
0.228565
0.231201
0.227507
0.223852
0.226066
0.229832
0.233678
0.237547
0.240077
0.244258
0.246768
0.251228
0.255786
0.260365
0.263272
0.268025
0.27309
0.276299
0.281692
0.28486
0.290669
0.293713
0.287616
0.290056
0.296347
0.302784
0.305324
0.312302
0.319599
0.326911
0.334699
0.343044
0.339697
0.335263
0.334023
0.347549
0.346519
0.337972
0.329812
0.322097
0.314617
0.307495
0.300693
0.298663
0.292235
0.29416
0.28792
0.286076
0.284009
0.281707
0.279151
0.273641
0.27099
0.265912
0.260898
0.258445
0.253712
0.249121
0.251334
0.256033
0.258209
0.263185
0.268341
0.270582
0.276039
0.278214
0.280176
0.281953
0.276249
0.274518
0.272636
0.267277
0.265313
0.260237
0.255361
0.25341
0.248786
0.246794
0.244682
0.242446
0.238263
0.236027
0.232058
0.228199
0.224457
0.222403
0.220275
0.216794
0.213421
0.210149
0.208171
0.205056
0.203089
0.201077
0.199021
0.196179
0.193404
0.191434
0.188786
0.186832
0.184311
0.182376
0.179982
0.178075
0.175787
0.173553
0.175375
0.177646
0.179487
0.181864
0.183725
0.186216
0.188094
0.190707
0.192598
0.195341
0.198168
0.200121
0.197244
0.194459
0.191769
0.189944
0.187379
0.185563
0.183117
0.181311
0.178978
0.177184
0.174959
0.173178
0.171386
0.169584
0.167773
0.165731
0.163938
0.161993
0.160218
0.158372
0.160115
0.161855
0.163758
0.165517
0.167515
0.16929
0.167269
0.165323
0.163591
0.161737
0.160021
0.158301
0.156581
0.154851
0.153191
0.151599
0.15327
0.154877
0.156554
0.158256
0.156563
0.15494
0.156605
0.158246
0.159956
0.16165
0.16345
0.165155
0.167047
0.169014
0.171057
0.172814
0.170749
0.168761
0.166848
0.165008
0.163336
0.161586
0.159922
0.158261
0.159904
0.161532
0.163236
0.164869
0.166664
0.168527
0.170463
0.172472
0.174559
0.176727
0.178481
0.180756
0.182517
0.184904
0.18667
0.189173
0.190944
0.193569
0.196291
0.199113
0.202035
0.20391
0.206977
0.208855
0.212075
0.215406
0.218849
0.220834
0.217333
0.213952
0.215784
0.219205
0.222755
0.226437
0.23025
0.234194
0.236235
0.240392
0.242413
0.244336
0.240054
0.238185
0.234113
0.232219
0.228348
0.224619
0.221028
0.217572
0.219315
0.222802
0.226427
0.230195
0.231984
0.235939
0.2377
0.24185
0.246173
0.250673
0.252467
0.257199
0.262132
0.263907
0.269098
0.270794
0.265576
0.260583
0.258937
0.254175
0.249611
0.24793
0.243576
0.239397
0.241026
0.24523
0.246812
0.251214
0.255798
0.257337
0.262137
0.267145
0.272376
0.277848
0.283573
0.289571
0.295852
0.30244
0.309338
0.316559
0.324152
0.332073
0.340432
0.34927
0.351215
0.360499
0.361945
0.362772
0.353372
0.352554
0.343601
0.342271
0.333829
0.325805
0.31815
0.310878
0.312166
0.319433
0.327082
0.335132
0.336054
0.344475
0.34498
0.353773
0.363101
0.362932
0.353859
0.345222
0.345253
0.35362
0.362312
0.361524
0.35313
0.345068
0.337312
0.337263
0.337065
0.336679
0.328786
0.328055
0.320466
0.313248
0.314152
0.321292
0.321938
0.329315
0.329669
0.329871
0.322781
0.322428
0.315504
0.314898
0.308185
0.307355
0.306381
0.305249
0.303945
0.297346
0.291054
0.285055
0.286408
0.292393
0.298669
0.299839
0.293597
0.287638
0.281941
0.28069
0.279328
0.273852
0.268614
0.2636
0.264973
0.269987
0.275221
0.276488
0.271265
0.266257
0.267453
0.272449
0.277655
0.283086
0.288753
0.294673
0.300867
0.301765
0.295631
0.289756
0.290653
0.296475
0.302545
0.308883
0.309464
0.315982
0.316346
0.323019
0.329967
0.337218
0.344716
0.352524
0.360648
0.369114
0.377883
0.376174
0.384792
0.38264
0.390985
0.399443
0.396433
0.404407
0.40114
0.408558
0.415789
0.411984
0.405157
0.398141
0.395398
0.402075
0.408563
0.405492
0.399286
0.392897
0.386386
0.388601
0.39101
0.393621
0.386071
0.38846
0.380552
0.372753
0.374451
0.366455
0.367802
0.359685
0.351845
0.344274
0.34377
0.351104
0.358666
0.357614
0.365102
0.363762
0.3711
0.37855
0.376647
0.383828
0.381736
0.379796
0.373177
0.374855
0.367995
0.36951
0.362455
0.3555
0.356553
0.349504
0.350319
0.343214
0.336322
0.336683
0.336994
0.329949
0.323153
0.316606
0.316774
0.323198
0.329831
0.329634
0.323157
0.316869
0.316896
0.323054
0.329385
0.335911
0.342616
0.341992
0.348677
0.347854
0.354471
0.361194
0.359989
0.366563
0.36522
0.371617
0.378007
0.38436
0.390626
0.396771
0.402742
0.40849
0.413962
0.419106
0.423878
0.428239
0.432164
0.435637
0.438662
0.441259
0.443458
0.445295
0.446818
0.448069
0.449093
0.449931
0.450622
0.451199
0.451686
0.452101
0.452456
0.452761
0.453025
0.453255
0.453457
0.453633
0.453785
0.453913
0.454016
0.454094
0.454152
0.454191
0.454226
0.454328
0.454263
0.454174
0.454115
0.454262
0.45438
0.45435
0.454183
0.453994
0.453783
0.453943
0.454057
0.453912
0.453742
0.453545
0.453273
0.453522
0.453745
0.453548
0.453286
0.452993
0.452719
0.453054
0.453351
0.453616
0.453853
0.454067
0.454263
0.454164
0.453952
0.453717
0.453592
0.453846
0.454074
0.453994
0.45375
0.453476
0.453168
0.453307
0.453456
0.453163
0.452832
0.452458
0.452213
0.452622
0.452985
0.452822
0.452431
0.45199
0.451494
0.451751
0.452036
0.452341
0.452662
0.452993
0.453322
0.453071
0.452789
0.452468
0.451921
0.452323
0.452679
0.45229
0.451868
0.45139
0.450847
0.451463
0.452103
0.451684
0.451202
0.450645
0.449655
0.450342
0.45094
0.450229
0.449526
0.448725
0.447862
0.448766
0.449562
0.450264
0.450884
0.451431
0.451914
0.451559
0.45102
0.450411
0.449978
0.450642
0.451229
0.450934
0.450304
0.449593
0.448795
0.449231
0.449723
0.448946
0.448067
0.447075
0.446369
0.447438
0.448388
0.447896
0.446886
0.445753
0.445237
0.446423
0.447481
0.448426
0.449267
0.450015
0.450681
0.451273
0.451798
0.452265
0.452679
0.453046
0.453373
0.453664
0.453923
0.453865
0.453594
0.45329
0.453231
0.453544
0.453823
0.453799
0.453515
0.453197
0.45284
0.45288
0.452949
0.452565
0.452132
0.451646
0.45154
0.45204
0.452485
0.452438
0.451986
0.451478
0.450906
0.450977
0.451098
0.450482
0.449789
0.449011
0.448834
0.449633
0.450344
0.450263
0.449541
0.44873
0.447822
0.447939
0.448138
0.447158
0.446062
0.444837
0.444562
0.445814
0.446936
0.446805
0.445669
0.444401
0.442988
0.443165
0.443468
0.44391
0.444482
0.445167
0.445954
0.446837
0.447811
0.448867
0.449999
0.449246
0.448362
0.447318
0.445686
0.446906
0.447958
0.446765
0.445568
0.444197
0.442625
0.444267
0.446081
0.444616
0.442884
0.440853
0.438525
0.440717
0.442622
0.440828
0.43878
0.436455
0.434628
0.437061
0.439228
0.441152
0.442852
0.444352
0.445673
0.444689
0.443261
0.441653
0.4406
0.442298
0.443815
0.443058
0.441468
0.439695
0.437723
0.438702
0.439845
0.437816
0.43555
0.433029
0.431646
0.43424
0.436587
0.435538
0.433125
0.430474
0.427574
0.428795
0.430238
0.431913
0.433833
0.436016
0.438483
0.435748
0.432625
0.4291
0.426403
0.429968
0.433169
0.430896
0.427633
0.424037
0.42011
0.422476
0.425173
0.420858
0.416177
0.411161
0.408685
0.413594
0.418201
0.415869
0.411323
0.406504
0.404594
0.409339
0.413832
0.418045
0.42197
0.42559
0.428903
0.427169
0.423817
0.420177
0.41864
0.422294
0.425679
0.424421
0.421011
0.417345
0.413428
0.414721
0.416255
0.412065
0.407616
0.402933
0.401503
0.406136
0.41055
0.409274
0.404889
0.400297
0.399315
0.403875
0.408237
0.412379
0.416294
0.419967
0.423396
0.426579
0.429516
0.432214
0.434677
0.436918
0.438947
0.44078
0.442429
0.441944
0.440251
0.438375
0.437984
0.43989
0.441613
0.441419
0.439678
0.437755
0.435636
0.435882
0.436301
0.434021
0.431519
0.428789
0.428295
0.431048
0.433573
0.433312
0.430772
0.428007
0.425014
0.425313
0.425824
0.422621
0.419177
0.415497
0.414958
0.418641
0.422096
0.421789
0.418329
0.414643
0.410732
0.411046
0.411584
0.407452
0.403106
0.39857
0.398064
0.402585
0.40692
0.406609
0.402281
0.397769
0.39308
0.393364
0.393851
0.394566
0.395509
0.396664
0.398031
0.399617
0.401436
0.403507
0.405849
0.400285
0.394512
0.388573
0.386725
0.392489
0.398095
0.396153
0.390687
0.385071
0.379338
0.380843
0.382515
0.376368
0.370176
0.36397
0.362813
0.368853
0.374873
0.373521
0.367648
0.361751
0.360786
0.36656
0.372307
0.377993
0.383599
0.389089
0.394441
0.392944
0.387689
0.382304
0.381177
0.386477
0.39165
0.390554
0.385446
0.380217
0.374881
0.375768
0.376805
0.371228
0.365588
0.359919
0.359153
0.364734
0.370281
0.369468
0.363998
0.358489
0.35296
0.353552
0.354233
0.354998
0.355844
0.35677
0.357771
0.358846
0.35252
0.353476
0.347047
0.340722
0.341357
0.334995
0.335466
0.329095
0.322897
0.316862
0.31678
0.322698
0.328771
0.328423
0.33451
0.334018
0.340091
0.34626
0.345505
0.351613
0.350758
0.349962
0.34411
0.344787
0.338883
0.339476
0.333529
0.327685
0.328059
0.322218
0.322471
0.316657
0.310983
0.311013
0.310995
0.310922
0.31079
0.310589
0.310307
0.309935
0.303771
0.303211
0.29721
0.291446
0.285905
0.285065
0.284126
0.278723
0.27354
0.268558
0.269577
0.274538
0.279696
0.280576
0.275447
0.270511
0.265753
0.2648
0.263767
0.26265
0.26145
0.260164
0.258792
0.254182
0.252737
0.24832
0.24408
0.242587
0.238529
0.236987
0.235382
0.233714
0.229882
0.228182
0.224526
0.22101
0.222653
0.226197
0.227814
0.231524
0.233106
0.234626
0.230872
0.229373
0.225779
0.224244
0.220804
0.219239
0.217623
0.215957
0.214245
0.212489
0.210692
0.207551
0.205748
0.202753
0.200949
0.198094
0.199867
0.201609
0.204524
0.20626
0.209316
0.211042
0.207956
0.204982
0.203314
0.200477
0.198799
0.197086
0.195341
0.192688
0.190131
0.188413
0.185975
0.184257
0.181932
0.180217
0.178001
0.176289
0.174179
0.172146
0.173809
0.175866
0.177532
0.179692
0.181358
0.183625
0.18529
0.187666
0.189328
0.19182
0.194405
0.19609
0.193477
0.190958
0.188527
0.186924
0.184605
0.182996
0.180784
0.179172
0.177064
0.17545
0.17344
0.171825
0.170187
0.1683
0.16648
0.164727
0.16314
0.161473
0.159889
0.158286
0.156665
0.15503
0.153384
0.151731
0.150075
0.14842
0.146978
0.14534
0.143976
0.142357
0.141071
0.139471
0.138263
0.137116
0.135553
0.134479
0.132941
0.131941
0.133462
0.134991
0.136026
0.137579
0.138686
0.139848
0.141439
0.142677
0.144286
0.1456
0.147225
0.148618
0.150258
0.151893
0.150462
0.148847
0.147496
0.145893
0.144619
0.143031
0.141831
0.140259
0.139133
0.138056
0.136524
0.135515
0.134004
0.132496
0.130994
0.129502
0.128022
0.127164
0.126353
0.125581
0.126993
0.127789
0.128623
0.130095
0.129238
0.128418
0.127629
0.126228
0.124842
0.124126
0.123427
0.12274
0.124064
0.124768
0.125488
0.126866
0.126126
0.125406
0.12676
0.127495
0.128255
0.12904
0.129852
0.130696
0.131575
0.133062
0.132159
0.131291
0.132733
0.133624
0.13455
0.136036
0.137025
0.13853
0.139584
0.140684
0.142228
0.143398
0.144957
0.1462
0.147771
0.149089
0.150671
0.152066
0.153519
0.155132
0.153656
0.152237
0.153787
0.15523
0.156729
0.158309
0.156784
0.155317
0.153902
0.152396
0.150871
0.149329
0.148039
0.146505
0.145287
0.143764
0.142617
0.141106
0.140027
0.138991
0.137517
0.136543
0.135086
0.134172
0.133293
0.131875
0.130456
0.12965
0.128872
0.128121
0.129484
0.130252
0.131048
0.132445
0.13163
0.130845
0.132201
0.133003
0.133838
0.134706
0.135607
0.137035
0.137994
0.139434
0.140455
0.141515
0.14299
0.144116
0.145602
0.146797
0.148291
0.149557
0.151058
0.15254
0.151226
0.149767
0.148525
0.147072
0.145898
0.144452
0.143345
0.141907
0.140863
0.13986
0.138453
0.137509
0.136112
0.135224
0.13437
0.13355
0.134888
0.135727
0.1366
0.137965
0.138894
0.140267
0.141254
0.142279
0.143681
0.144768
0.146175
0.147328
0.14874
0.14996
0.151375
0.152664
0.154001
0.155388
0.156827
0.158319
0.159868
0.161405
0.163035
0.164574
0.16629
0.168069
0.169913
0.171502
0.169633
0.167829
0.169341
0.17117
0.173065
0.175028
0.176589
0.17865
0.180206
0.182366
0.183916
0.186182
0.187724
0.190096
0.192554
0.195099
0.19774
0.199352
0.202116
0.203716
0.206608
0.20961
0.212725
0.214363
0.211221
0.208192
0.205273
0.202455
0.200925
0.198232
0.196685
0.194112
0.195632
0.197112
0.199737
0.201199
0.203943
0.206786
0.209731
0.212786
0.215953
0.217494
0.214301
0.211221
0.212662
0.215765
0.218982
0.222316
0.223772
0.227257
0.228674
0.232309
0.236083
0.240004
0.24141
0.245501
0.249755
0.251113
0.255548
0.256832
0.252393
0.248123
0.246849
0.242747
0.238797
0.237473
0.233682
0.230031
0.231327
0.234993
0.236239
0.240053
0.244013
0.245208
0.249323
0.253597
0.258036
0.259159
0.254723
0.25045
0.251505
0.255774
0.260203
0.26117
0.25675
0.252487
0.248374
0.247388
0.246333
0.242363
0.241242
0.237419
0.23373
0.23256
0.22901
0.227789
0.226509
0.22517
0.221794
0.220415
0.217177
0.214053
0.211039
0.20967
0.208251
0.205385
0.202618
0.199946
0.198551
0.195993
0.194579
0.193123
0.191629
0.189231
0.186915
0.185433
0.183222
0.181731
0.179619
0.178119
0.176106
0.1746
0.17268
0.170826
0.172282
0.17416
0.175611
0.17758
0.179023
0.181085
0.182518
0.184679
0.1861
0.18836
0.1907
0.192131
0.189768
0.187484
0.185278
0.183916
0.181806
0.180432
0.178415
0.177029
0.175104
0.173709
0.171871
0.170468
0.169036
0.167576
0.166088
0.164408
0.162919
0.161321
0.159832
0.158316
0.159781
0.161222
0.162786
0.164226
0.165872
0.167309
0.16564
0.164029
0.162639
0.161106
0.159712
0.158294
0.156852
0.155442
0.154081
0.15277
0.154143
0.155477
0.156861
0.158256
0.15685
0.155494
0.156822
0.158199
0.159627
0.160973
0.162474
0.163815
0.165393
0.167026
0.168718
0.170098
0.168383
0.166729
0.16513
0.163586
0.162293
0.160823
0.159523
0.158125
0.159404
0.160656
0.162095
0.163341
0.164852
0.166416
0.168036
0.169712
0.171448
0.173244
0.174586
0.176467
0.177798
0.179768
0.181085
0.183146
0.184449
0.186603
0.188831
0.191137
0.193523
0.194874
0.197366
0.198696
0.201298
0.203991
0.20678
0.208128
0.205318
0.202604
0.199982
0.197449
0.196183
0.193754
0.192466
0.190139
0.191407
0.192634
0.195
0.196204
0.198671
0.201223
0.203864
0.206598
0.209428
0.212358
0.215391
0.218536
0.219839
0.223116
0.22438
0.225586
0.222279
0.221088
0.21791
0.216677
0.213625
0.210678
0.20783
0.205078
0.206244
0.209012
0.211876
0.21484
0.216004
0.219087
0.22021
0.223415
0.226735
0.23017
0.231269
0.234838
0.238534
0.239584
0.243416
0.244403
0.24057
0.236865
0.235883
0.232307
0.228855
0.227824
0.224495
0.221278
0.222291
0.225517
0.226481
0.229827
0.233285
0.234201
0.237785
0.241491
0.245323
0.249291
0.253399
0.257653
0.26206
0.266627
0.271363
0.276272
0.281367
0.286653
0.292142
0.297846
0.298387
0.304234
0.30461
0.304906
0.299218
0.298842
0.293271
0.292748
0.287315
0.282073
0.277015
0.272136
0.272834
0.27768
0.282699
0.287893
0.288394
0.293715
0.294087
0.299522
0.305131
0.305294
0.299761
0.294394
0.294639
0.299942
0.305399
0.305453
0.300069
0.294828
0.289732
0.289489
0.289188
0.288824
0.283727
0.283249
0.278271
0.273458
0.274012
0.278791
0.279244
0.284139
0.284489
0.284779
0.279965
0.279635
0.274925
0.2745
0.269901
0.269385
0.268802
0.268149
0.267424
0.262877
0.258484
0.254241
0.255015
0.259246
0.263621
0.264296
0.259938
0.255721
0.251641
0.250924
0.250141
0.246178
0.242347
0.238642
0.239437
0.243141
0.246967
0.247692
0.24387
0.240169
0.240839
0.244537
0.248352
0.252293
0.256362
0.260564
0.264903
0.265444
0.261125
0.256938
0.25745
0.261622
0.265921
0.270354
0.270745
0.275289
0.275595
0.280239
0.285013
0.289923
0.294968
0.300149
0.305468
0.310918
0.316504
0.316324
0.321946
0.321665
0.327311
0.333051
0.332587
0.338317
0.337785
0.343481
0.349227
0.348558
0.342903
0.337293
0.336844
0.342383
0.347959
0.347434
0.341925
0.336446
0.331009
0.33135
0.331731
0.332145
0.326581
0.32694
0.321377
0.315916
0.316127
0.310697
0.31082
0.305442
0.300187
0.295062
0.295116
0.300188
0.305385
0.305304
0.310553
0.310398
0.315699
0.321093
0.320817
0.326239
0.32592
0.325631
0.32032
0.320557
0.315275
0.315484
0.310236
0.30509
0.305203
0.30011
0.300161
0.295136
0.290227
0.290166
0.290067
0.285198
0.280459
0.275847
0.27605
0.280631
0.285338
0.285437
0.280761
0.276208
0.276327
0.280855
0.2855
0.290258
0.295127
0.295097
0.300041
0.299963
0.304972
0.310077
0.309925
0.315079
0.314907
0.32011
0.325383
0.330719
0.336108
0.341537
0.346994
0.352465
0.357935
0.363386
0.368797
0.374151
0.379429
0.384602
0.389658
0.388977
0.383959
0.378827
0.378416
0.383521
0.388513
0.388242
0.383264
0.378175
0.372985
0.37321
0.373592
0.368283
0.362913
0.357508
0.357216
0.36259
0.367931
0.367724
0.3624
0.357042
0.351659
0.351815
0.352081
0.346651
0.341235
0.335841
0.335654
0.341023
0.346413
0.346272
0.340898
0.335543
0.330227
0.330325
0.330489
0.325186
0.31994
0.314765
0.314665
0.31982
0.325045
0.324961
0.319748
0.314605
0.309534
0.309585
0.309668
0.309784
0.304745
0.304855
0.299879
0.294998
0.295053
0.290247
0.290263
0.285535
0.280916
0.276411
0.276467
0.280952
0.285547
0.285541
0.290218
0.290182
0.29494
0.299796
0.299724
0.304651
0.304583
0.304541
0.299637
0.299671
0.294847
0.294887
0.290147
0.285506
0.285525
0.28097
0.280969
0.276502
0.272141
0.27209
0.272015
0.271909
0.271769
0.271587
0.271358
0.271079
0.266695
0.266337
0.262057
0.257902
0.25387
0.253406
0.252881
0.24895
0.24514
0.241447
0.241994
0.245682
0.249484
0.249959
0.246164
0.242481
0.24291
0.246587
0.250374
0.254275
0.258294
0.262432
0.262753
0.266996
0.267246
0.267449
0.263242
0.263022
0.258913
0.25863
0.254624
0.250733
0.246954
0.243283
0.243604
0.247268
0.251039
0.25492
0.255167
0.259148
0.259339
0.263418
0.267608
0.267731
0.263555
0.25949
0.259606
0.26366
0.267822
0.267886
0.263737
0.259693
0.255754
0.255657
0.25553
0.255368
0.251507
0.251296
0.247533
0.243875
0.244101
0.247753
0.247931
0.251678
0.251813
0.251917
0.248183
0.248073
0.244433
0.244286
0.24074
0.240549
0.240319
0.240043
0.239718
0.23934
0.238907
0.238417
0.237866
0.237256
0.236584
0.235851
0.235057
0.231591
0.230739
0.227388
0.224147
0.223247
0.22012
0.219172
0.21817
0.217114
0.214121
0.213024
0.210145
0.207362
0.20843
0.211228
0.21226
0.215165
0.216157
0.217095
0.214168
0.21324
0.210419
0.20945
0.206732
0.205726
0.204671
0.203569
0.202419
0.19985
0.197365
0.194963
0.193819
0.191513
0.190345
0.189137
0.187889
0.185715
0.183614
0.182368
0.180356
0.179094
0.17717
0.175895
0.174056
0.172767
0.17101
0.169313
0.17056
0.172278
0.173513
0.175311
0.176533
0.178412
0.179619
0.181583
0.182773
0.184823
0.186944
0.188132
0.185993
0.183925
0.181925
0.18079
0.178874
0.177721
0.175885
0.174716
0.172959
0.171776
0.170097
0.1689
0.167673
0.166089
0.164559
0.163081
0.161882
0.160473
0.159267
0.158034
0.156776
0.155493
0.154187
0.152857
0.151506
0.150133
0.148935
0.147565
0.146433
0.145065
0.143996
0.142633
0.141625
0.140655
0.139318
0.138405
0.137073
0.136215
0.137529
0.138828
0.139723
0.141026
0.141978
0.142968
0.144293
0.145343
0.146671
0.147782
0.149112
0.150286
0.151616
0.152925
0.151709
0.150421
0.149269
0.14798
0.14689
0.145601
0.144571
0.143283
0.142312
0.141378
0.140111
0.139233
0.137968
0.136687
0.135392
0.134084
0.132763
0.131432
0.130092
0.128746
0.127398
0.126049
0.124707
0.123376
0.122063
0.120775
0.11952
0.118862
0.117652
0.116983
0.116314
0.115117
0.114432
0.113791
0.11321
0.112697
0.114041
0.114527
0.115071
0.11567
0.116943
0.117557
0.118202
0.119463
0.120114
0.121399
0.120753
0.120134
0.118834
0.118239
0.117685
0.116372
0.115851
0.115381
0.114965
0.113616
0.112253
0.111881
0.110489
0.110178
0.108742
0.10852
0.1084
0.106964
0.105483
0.103952
0.104018
0.102501
0.102736
0.103042
0.104409
0.104178
0.105601
0.105499
0.106944
0.108353
0.108365
0.106997
0.107113
0.10577
0.105991
0.104694
0.103398
0.102121
0.100878
0.0996862
0.0985542
0.0974908
0.0965062
0.0974685
0.0983559
0.0991805
0.0999037
0.0991495
0.0983474
0.0993023
0.100017
0.1007
0.101352
0.100615
0.0999513
0.100675
0.101358
0.102003
0.102537
0.101929
0.101289
0.101977
0.102574
0.103147
0.103842
0.103303
0.102746
0.10217
0.101575
0.100961
0.100331
0.101428
0.10198
0.102528
0.10355
0.103065
0.102586
0.103788
0.1042
0.104625
0.105056
0.104036
0.103068
0.103597
0.104114
0.104618
0.105458
0.104992
0.104517
0.105488
0.105918
0.106343
0.106761
0.105914
0.105108
0.104363
0.103697
0.103116
0.102613
0.103192
0.103742
0.104265
0.104699
0.104195
0.103668
0.104225
0.104732
0.105219
0.105688
0.105181
0.104762
0.105234
0.105685
0.106114
0.106508
0.106085
0.105642
0.106139
0.106573
0.106991
0.107543
0.107136
0.106714
0.106276
0.105823
0.105353
0.104867
0.105585
0.106047
0.106495
0.107213
0.106792
0.106359
0.10717
0.10757
0.107959
0.108336
0.10762
0.106928
0.107346
0.10775
0.108139
0.108759
0.108393
0.108014
0.108702
0.109055
0.109395
0.110044
0.10973
0.109404
0.109068
0.108722
0.108367
0.108003
0.107632
0.107254
0.106873
0.106489
0.106107
0.105731
0.105365
0.105016
0.106252
0.106541
0.106851
0.107973
0.107717
0.107483
0.107279
0.108549
0.108434
0.109729
0.109702
0.109723
0.109798
0.109946
0.111341
0.111579
0.112948
0.113251
0.114602
0.114292
0.114035
0.112703
0.112512
0.111167
0.111061
0.111009
0.111
0.112247
0.112288
0.112373
0.113665
0.113828
0.115116
0.115342
0.115614
0.115933
0.1163
0.116714
0.117176
0.1185
0.119004
0.119549
0.120866
0.121447
0.122062
0.122708
0.124032
0.123384
0.122767
0.122184
0.121637
0.120322
0.119817
0.119352
0.118038
0.117621
0.117246
0.116916
0.116628
0.117893
0.118198
0.118542
0.118927
0.120218
0.120653
0.121126
0.122426
0.122945
0.123499
0.124088
0.124711
0.125366
0.126703
0.126039
0.125407
0.12672
0.127363
0.128039
0.129371
0.128681
0.128025
0.127401
0.12611
0.124808
0.124244
0.123713
0.123218
0.121942
0.121495
0.121084
0.119821
0.119462
0.11914
0.118854
0.117627
0.116381
0.116175
0.114932
0.114787
0.113546
0.113471
0.113433
0.112242
0.11103
0.1098
0.109906
0.108702
0.108885
0.109091
0.109316
0.108245
0.107174
0.107506
0.107842
0.10818
0.109114
0.108819
0.108529
0.109553
0.1098
0.110053
0.110997
0.110783
0.110577
0.110382
0.110203
0.110043
0.111188
0.111094
0.112268
0.113426
0.113445
0.112322
0.112401
0.111306
0.111445
0.111599
0.111766
0.111944
0.112891
0.112749
0.112618
0.112501
0.113551
0.113488
0.114564
0.114555
0.114568
0.114607
0.114679
0.115872
0.116006
0.117205
0.117398
0.118603
0.118386
0.118201
0.117045
0.116915
0.115768
0.115695
0.115651
0.11563
0.116685
0.116737
0.116813
0.117917
0.118045
0.11916
0.119341
0.119551
0.119791
0.120063
0.120368
0.120708
0.121938
0.12233
0.122757
0.124003
0.124479
0.124989
0.125532
0.12681
0.126252
0.125727
0.125236
0.124777
0.123561
0.123152
0.122775
0.12158
0.121255
0.120962
0.1207
0.120467
0.121577
0.121833
0.122117
0.122431
0.123591
0.123955
0.12435
0.125532
0.125977
0.126453
0.126961
0.127501
0.128074
0.12868
0.129319
0.129991
0.130695
0.13201
0.131289
0.130602
0.131872
0.132576
0.133313
0.134604
0.13385
0.133129
0.132441
0.131201
0.129947
0.129326
0.128737
0.12818
0.129384
0.129958
0.130563
0.131786
0.131163
0.130572
0.131745
0.132354
0.132994
0.133666
0.134371
0.135109
0.135881
0.137144
0.136354
0.135598
0.136809
0.137582
0.13839
0.13962
0.140481
0.141712
0.142627
0.14358
0.14483
0.14584
0.14709
0.148159
0.149407
0.150537
0.151783
0.152975
0.154211
0.155474
0.154218
0.153006
0.154206
0.155437
0.156712
0.157926
0.156631
0.155382
0.154177
0.153019
0.151838
0.150634
0.149527
0.148319
0.147271
0.146061
0.14507
0.143858
0.142924
0.142027
0.140832
0.139989
0.138794
0.138003
0.137245
0.136068
0.134875
0.134186
0.133528
0.132902
0.134043
0.134686
0.135361
0.13652
0.135828
0.135167
0.134537
0.133431
0.132308
0.131168
0.130013
0.128842
0.127655
0.127161
0.126699
0.126266
0.125118
0.124735
0.124381
0.123257
0.122951
0.122673
0.123755
0.124054
0.125143
0.125489
0.125864
0.126977
0.127399
0.12785
0.12833
0.129484
0.128985
0.128516
0.128075
0.127662
0.126583
0.126217
0.125876
0.124823
0.124528
0.123482
0.122422
0.121349
0.120261
0.120082
0.119006
0.118876
0.117813
0.117732
0.117672
0.116655
0.115629
0.114594
0.114643
0.113633
0.11373
0.113839
0.113958
0.113043
0.112128
0.111217
0.11031
0.109409
0.108516
0.108849
0.109176
0.109498
0.110286
0.109997
0.109704
0.110569
0.110827
0.111084
0.111338
0.110569
0.109813
0.110119
0.110418
0.110707
0.111384
0.11112
0.110848
0.111588
0.111834
0.112075
0.112776
0.11256
0.11234
0.112117
0.111892
0.111666
0.111441
0.112319
0.112512
0.112708
0.11353
0.113364
0.113201
0.114085
0.114218
0.114356
0.114498
0.113699
0.112905
0.113101
0.113295
0.113487
0.114206
0.114038
0.113869
0.114642
0.114787
0.114932
0.115662
0.11554
0.115419
0.115301
0.115185
0.115075
0.11497
0.114872
0.114784
0.114707
0.11568
0.115647
0.116643
0.117631
0.117608
0.116647
0.116665
0.115727
0.115785
0.115854
0.115932
0.116016
0.116847
0.116788
0.116737
0.116696
0.117603
0.117599
0.118526
0.118562
0.118613
0.118681
0.118768
0.119793
0.119926
0.120965
0.121145
0.122195
0.121992
0.12181
0.120807
0.12067
0.119681
0.119587
0.11951
0.119449
0.120365
0.12045
0.120551
0.121507
0.121649
0.122618
0.122802
0.123007
0.123233
0.124257
0.124009
0.123783
0.124751
0.124999
0.125268
0.12556
0.126579
0.126915
0.127275
0.12832
0.128725
0.129157
0.129617
0.130105
0.130622
0.131743
0.131208
0.130702
0.131771
0.132296
0.132848
0.133937
0.133366
0.132824
0.13231
0.131275
0.130224
0.129773
0.129349
0.128949
0.127939
0.127584
0.127251
0.126267
0.125977
0.125708
0.12546
0.124524
0.123576
0.123389
0.122453
0.122305
0.121382
0.121273
0.121179
0.120294
0.119402
0.118505
0.118495
0.117618
0.117643
0.117677
0.117718
0.116912
0.116106
0.1162
0.116297
0.116397
0.117135
0.117057
0.116982
0.117765
0.117817
0.117874
0.118615
0.118579
0.118548
0.118523
0.118505
0.118495
0.119344
0.119367
0.120236
0.121098
0.12103
0.120189
0.120153
0.119331
0.119326
0.11933
0.119339
0.119355
0.120095
0.120099
0.120109
0.120127
0.120925
0.120972
0.121787
0.121865
0.121955
0.122058
0.122174
0.123066
0.123219
0.124124
0.124315
0.125231
0.12502
0.124825
0.12395
0.123792
0.122929
0.122805
0.122694
0.122596
0.123399
0.123517
0.123648
0.124483
0.124646
0.125492
0.12569
0.125904
0.126136
0.126385
0.126653
0.126942
0.127894
0.128223
0.128574
0.129551
0.129945
0.130363
0.130806
0.131823
0.131361
0.130925
0.130513
0.130124
0.12918
0.128832
0.128505
0.127586
0.127298
0.127029
0.126779
0.126546
0.127391
0.127642
0.127911
0.128199
0.129087
0.129412
0.129757
0.130669
0.131053
0.13146
0.13189
0.132344
0.132824
0.133329
0.133861
0.13442
0.135008
0.135626
0.136273
0.136951
0.137662
0.138404
0.139179
0.140338
0.141165
0.142322
0.143202
0.144118
0.145291
0.146262
0.147433
0.14846
0.149628
0.150712
0.151875
0.153015
0.151895
0.150773
0.14971
0.148582
0.147576
0.146444
0.145493
0.144357
0.14346
0.142598
0.141478
0.140667
0.139545
0.138785
0.138058
0.137362
0.138433
0.139145
0.13989
0.140976
0.14177
0.142854
0.143699
0.144578
0.145675
0.146607
0.1477
0.148685
0.149773
0.150814
0.151895
0.152993
0.15413
0.15531
0.156533
0.1578
0.159113
0.160274
0.161653
0.162804
0.164251
0.165747
0.167296
0.168474
0.166906
0.165392
0.166503
0.168035
0.169621
0.171262
0.172395
0.174111
0.175228
0.17702
0.17812
0.179991
0.181072
0.183022
0.18504
0.187125
0.189282
0.190391
0.192639
0.193723
0.196063
0.198481
0.200983
0.20207
0.199553
0.197119
0.194764
0.192486
0.19146
0.189271
0.188218
0.186116
0.187153
0.188149
0.190282
0.191251
0.193469
0.195762
0.198131
0.200579
0.20311
0.204102
0.201558
0.199097
0.200017
0.202491
0.205047
0.207689
0.208596
0.211336
0.212201
0.215043
0.217979
0.221013
0.221849
0.22499
0.228235
0.229025
0.232384
0.233116
0.229754
0.226501
0.225775
0.222627
0.21958
0.218807
0.215864
0.213013
0.213771
0.216629
0.217338
0.220295
0.223348
0.224012
0.227169
0.230425
0.233788
0.234399
0.231035
0.227777
0.228327
0.231586
0.23495
0.235443
0.232079
0.228819
0.225654
0.225164
0.224617
0.221555
0.220954
0.217991
0.215119
0.214473
0.211697
0.211003
0.210254
0.209451
0.206787
0.205942
0.203375
0.20089
0.198483
0.197622
0.196715
0.194409
0.192177
0.190017
0.189104
0.187027
0.186085
0.185103
0.184082
0.182116
0.180212
0.179184
0.177359
0.176311
0.174561
0.173495
0.171819
0.170736
0.169133
0.167584
0.168634
0.170199
0.171233
0.172869
0.173886
0.175593
0.17659
0.178371
0.179347
0.181203
0.183121
0.184088
0.182156
0.180286
0.178476
0.177551
0.175814
0.174868
0.173201
0.172234
0.170637
0.169652
0.168122
0.167119
0.166086
0.165022
0.163928
0.162514
0.161408
0.160059
0.158943
0.157658
0.158757
0.159829
0.161148
0.162208
0.163591
0.164638
0.163239
0.161888
0.160873
0.159582
0.158555
0.1575
0.156418
0.155221
0.154066
0.152952
0.153984
0.155115
0.156286
0.157325
0.156137
0.154991
0.155972
0.157134
0.158336
0.159321
0.160582
0.161554
0.162875
0.164241
0.165656
0.166643
0.165213
0.163832
0.162496
0.161205
0.160277
0.159044
0.158103
0.156926
0.157854
0.158753
0.159958
0.160843
0.162104
0.163408
0.164758
0.166154
0.167598
0.169092
0.17003
0.171589
0.172507
0.174133
0.17503
0.176725
0.177599
0.179363
0.181186
0.18307
0.185016
0.185903
0.187927
0.188784
0.190887
0.19306
0.195304
0.196153
0.193897
0.191712
0.192491
0.194687
0.196954
0.199295
0.201713
0.204209
0.204992
0.20758
0.20832
0.209006
0.206401
0.205723
0.203208
0.202486
0.200058
0.197706
0.195428
0.193222
0.193903
0.19612
0.198408
0.20077
0.201429
0.203876
0.204491
0.207025
0.209638
0.212336
0.21292
0.215709
0.218587
0.219126
0.222098
0.222586
0.219609
0.216723
0.216243
0.213449
0.210738
0.210215
0.207595
0.205053
0.205563
0.20811
0.208574
0.211207
0.213923
0.214345
0.217149
0.220039
0.223019
0.226089
0.229254
0.232515
0.235878
0.236258
0.232897
0.229636
0.229967
0.233228
0.236587
0.236866
0.23351
0.230251
0.227086
0.226802
0.226471
0.223399
0.220417
0.217524
0.21785
0.220746
0.223729
0.224012
0.221028
0.218131
0.21837
0.221268
0.224252
0.227325
0.230491
0.233747
0.237101
0.237294
0.233943
0.230689
0.230851
0.234103
0.23745
0.240893
0.241013
0.244548
0.244635
0.248264
0.251993
0.255823
0.259755
0.26379
0.267928
0.272171
0.276519
0.276525
0.280963
0.280954
0.285488
0.290117
0.290098
0.294822
0.285475
0.280946
0.276521
0.276524
0.272193
0.272187
0.267954
0.263823
0.259796
0.25982
0.263841
0.267967
0.267972
0.272194
0.263849
0.259831
0.255911
0.255897
0.25587
0.252046
0.248321
0.244695
0.244732
0.248356
0.252078
0.252094
0.248374
0.244752
0.241228
0.241207
0.241167
0.241104
0.237668
0.237574
0.23423
0.23098
0.227819
0.227688
0.227525
0.224452
0.221468
0.218569
0.218734
0.221632
0.224617
0.224748
0.221765
0.218866
0.21605
0.215919
0.215755
0.215556
0.215319
0.21504
0.214716
0.211992
0.211624
0.208986
0.206427
0.20602
0.203543
0.203092
0.20259
0.202036
0.199656
0.199058
0.196761
0.194535
0.195115
0.197349
0.197887
0.200203
0.200697
0.201141
0.198811
0.198374
0.196122
0.195644
0.193468
0.192948
0.192377
0.191755
0.191084
0.190364
0.189597
0.187549
0.186748
0.184776
0.183944
0.182047
0.182867
0.183645
0.185566
0.186311
0.188305
0.189015
0.187009
0.185067
0.184379
0.182509
0.181786
0.181019
0.180211
0.178435
0.176715
0.175891
0.174239
0.173391
0.171804
0.170934
0.169413
0.168522
0.167064
0.165654
0.166518
0.167941
0.168786
0.17027
0.171093
0.17264
0.173439
0.175051
0.175824
0.177499
0.179231
0.179986
0.178243
0.176556
0.174923
0.174201
0.172631
0.171881
0.170373
0.169597
0.168149
0.16735
0.165961
0.165141
0.16429
0.162973
0.161698
0.160468
0.159625
0.158448
0.15759
0.156704
0.155791
0.154851
0.153885
0.152894
0.151878
0.150837
0.149818
0.14877
0.147805
0.146751
0.145838
0.144779
0.143917
0.143089
0.142043
0.141264
0.140214
0.139485
0.140518
0.141532
0.142294
0.143304
0.144115
0.144959
0.145981
0.146875
0.147891
0.148836
0.149845
0.150842
0.151843
0.152819
0.15179
0.150829
0.149853
0.148883
0.147957
0.14698
0.146104
0.14512
0.144294
0.143499
0.142525
0.141778
0.1408
0.139803
0.138786
0.137751
0.136697
0.136063
0.135457
0.13488
0.135883
0.136477
0.137099
0.138118
0.137478
0.136868
0.136284
0.135316
0.134331
0.133808
0.133312
0.13284
0.133774
0.134263
0.134777
0.135728
0.135198
0.134692
0.135594
0.136116
0.136662
0.137235
0.137835
0.138462
0.139118
0.140099
0.139427
0.138784
0.139714
0.140373
0.141061
0.142003
0.142736
0.143673
0.144452
0.145262
0.146208
0.147066
0.148005
0.148912
0.149843
0.150799
0.15172
0.152726
0.15377
0.154695
0.153637
0.152617
0.153489
0.154522
0.155594
0.156467
0.155382
0.154334
0.153323
0.152491
0.151633
0.15075
0.149815
0.148922
0.148035
0.147133
0.146293
0.145383
0.144589
0.143827
0.142925
0.142207
0.1413
0.140625
0.139979
0.139083
0.138168
0.137579
0.137017
0.136479
0.137347
0.1379
0.138478
0.139359
0.138766
0.138198
0.139031
0.139614
0.140222
0.140856
0.141517
0.14239
0.143094
0.14396
0.144707
0.145485
0.146358
0.14718
0.148045
0.148914
0.149769
0.150684
0.151529
0.152348
0.151408
0.1506
0.149706
0.148888
0.148038
0.147209
0.146405
0.145567
0.144806
0.144074
0.143242
0.142552
0.141714
0.141065
0.140443
0.139846
0.140643
0.141253
0.141889
0.142694
0.14337
0.144168
0.144885
0.14563
0.146432
0.14722
0.148013
0.148844
0.149626
0.150501
0.151271
0.15219
0.153142
0.15413
0.155154
0.156214
0.157312
0.158129
0.159278
0.160079
0.161281
0.162524
0.163811
0.164618
0.163319
0.162064
0.162816
0.164083
0.165393
0.166748
0.167501
0.168913
0.169641
0.171112
0.171812
0.173342
0.174012
0.175602
0.177247
0.178944
0.180698
0.181365
0.183186
0.183816
0.185708
0.18766
0.189676
0.190287
0.188262
0.1863
0.184399
0.182558
0.181985
0.180211
0.1796
0.177893
0.178493
0.179046
0.180774
0.181289
0.183083
0.184933
0.186843
0.188814
0.190849
0.191361
0.189317
0.187338
0.187784
0.189772
0.191824
0.193939
0.194362
0.196552
0.196934
0.1992
0.201535
0.203944
0.204298
0.206785
0.209349
0.209666
0.212312
0.212589
0.209939
0.207367
0.207098
0.204606
0.202187
0.201883
0.199543
0.197271
0.197565
0.199842
0.2001
0.202449
0.204872
0.2051
0.207597
0.210173
0.212824
0.213021
0.210368
0.207791
0.207952
0.21053
0.213184
0.213316
0.210661
0.208082
0.205578
0.205449
0.205291
0.202863
0.202674
0.200321
0.198037
0.19782
0.195608
0.195358
0.195069
0.194737
0.192608
0.192239
0.19018
0.188184
0.186249
0.185857
0.185419
0.183559
0.181757
0.180012
0.179553
0.17787
0.177373
0.176829
0.176238
0.174638
0.173087
0.172471
0.17098
0.170331
0.168898
0.168219
0.166842
0.166135
0.164814
0.163536
0.164223
0.165511
0.166171
0.167511
0.168141
0.169538
0.170134
0.171586
0.172148
0.173658
0.175218
0.175752
0.174183
0.172664
0.171194
0.170687
0.169272
0.168729
0.167369
0.166791
0.165484
0.164873
0.163618
0.162977
0.162301
0.161591
0.16085
0.159677
0.158917
0.157795
0.157018
0.155946
0.156711
0.157448
0.158543
0.159263
0.160407
0.161107
0.159952
0.158836
0.158157
0.157088
0.15639
0.155664
0.154911
0.153911
0.152946
0.152015
0.152735
0.153677
0.154653
0.155368
0.154381
0.153429
0.154096
0.155059
0.156056
0.156715
0.157757
0.158395
0.159483
0.160609
0.161773
0.162404
0.161231
0.160097
0.159
0.157941
0.157344
0.156329
0.155708
0.154736
0.155347
0.155928
0.156917
0.15747
0.158501
0.159568
0.160673
0.161816
0.162997
0.16422
0.164781
0.166053
0.166579
0.167903
0.168392
0.16977
0.170223
0.171655
0.173135
0.174663
0.176241
0.176683
0.178321
0.178726
0.180426
0.182179
0.18399
0.184374
0.182556
0.180796
0.179088
0.177435
0.17708
0.175486
0.175096
0.17356
0.173942
0.174282
0.175834
0.176141
0.17775
0.17941
0.181124
0.182891
0.184716
0.186598
0.188539
0.190542
0.190861
0.192933
0.193217
0.193463
0.191382
0.19114
0.189126
0.188853
0.186905
0.185017
0.183186
0.181412
0.181664
0.183443
0.18528
0.187173
0.187405
0.189362
0.189565
0.191588
0.193673
0.195822
0.196002
0.198221
0.200507
0.200662
0.20302
0.203148
0.200788
0.198498
0.198374
0.196153
0.193998
0.193851
0.191762
0.189736
0.189878
0.191907
0.192025
0.194118
0.196275
0.196371
0.198595
0.200886
0.203247
0.205678
0.208183
0.210762
0.213419
0.216153
0.218969
0.221868
0.22485
0.22792
0.231078
0.234327
0.234396
0.237733
0.237775
0.237797
0.234462
0.234438
0.231191
0.231147
0.227992
0.224922
0.22194
0.219043
0.21909
0.221986
0.224968
0.228037
0.228061
0.231216
0.224993
0.222012
0.219116
0.2163
0.216274
0.216227
0.213493
0.210835
0.208256
0.208303
0.210883
0.21354
0.213566
0.210909
0.20833
0.205824
0.205798
0.20575
0.203318
0.200958
0.198665
0.198711
0.201004
0.203365
0.203391
0.20103
0.198736
0.19651
0.196484
0.19644
0.194281
0.194213
0.192118
0.190085
0.189994
0.188024
0.18791
0.187771
0.187603
0.185701
0.185507
0.183666
0.181882
0.182068
0.183856
0.184017
0.185866
0.186002
0.186113
0.18426
0.184151
0.182356
0.182225
0.180487
0.180333
0.180151
0.179938
0.179692
0.178026
0.176411
0.174847
0.174583
0.173073
0.172779
0.172446
0.172072
0.170632
0.169238
0.168837
0.167496
0.16706
0.16577
0.165297
0.164059
0.16355
0.16236
0.161209
0.161702
0.16286
0.163317
0.164523
0.164944
0.166199
0.166584
0.167889
0.16824
0.169597
0.170998
0.171324
0.169915
0.168551
0.167231
0.166927
0.165657
0.165321
0.164099
0.16373
0.162556
0.162151
0.161024
0.160582
0.160097
0.159022
0.157983
0.15698
0.156473
0.155511
0.154972
0.1544
0.153797
0.153166
0.152509
0.151826
0.151117
0.150384
0.149529
0.148783
0.147971
0.147213
0.146442
0.145674
0.144945
0.144243
0.143479
0.142817
0.142045
0.141421
0.14218
0.14292
0.143568
0.1443
0.144987
0.1457
0.146434
0.147188
0.147911
0.148705
0.149416
0.150251
0.150949
0.151622
0.150765
0.150103
0.149287
0.148611
0.147835
0.147146
0.146409
0.145709
0.14501
0.144338
0.143639
0.143004
0.142296
0.141569
0.140823
0.140058
0.139275
0.138473
0.137655
0.136819
0.135966
0.135097
0.134211
0.13331
0.132393
0.131968
0.131566
0.131186
0.130306
0.129963
0.12964
0.128782
0.128495
0.128225
0.127973
0.127156
0.126329
0.126127
0.125309
0.12514
0.124332
0.124195
0.12407
0.123292
0.122508
0.121719
0.12166
0.120887
0.120856
0.120833
0.121569
0.121611
0.122362
0.12243
0.123195
0.123955
0.123851
0.123109
0.123031
0.122302
0.122249
0.121534
0.120816
0.120096
0.119376
0.118655
0.117934
0.117215
0.116498
0.115785
0.115076
0.114373
0.113676
0.112988
0.112309
0.111642
0.110988
0.110348
0.109723
0.109111
0.108513
0.107934
0.107394
0.106916
0.106523
0.106221
0.105996
0.105824
0.105683
0.10556
0.105445
0.10533
0.105208
0.105055
0.104844
0.10538
0.105884
0.106357
0.1068
0.107214
0.1076
0.107958
0.108288
0.10859
0.108866
0.109116
0.10934
0.109538
0.10971
0.109855
0.109807
0.109673
0.109514
0.109331
0.109123
0.10889
0.108631
0.108346
0.108034
0.107696
0.10733
0.106935
0.106511
0.106057
0.105572
0.105707
0.106175
0.106613
0.106684
0.106263
0.105812
0.105909
0.106344
0.10675
0.107129
0.107077
0.10702
0.107399
0.107748
0.10807
0.108091
0.10778
0.107442
0.107481
0.107806
0.108105
0.108116
0.10783
0.107519
0.107181
0.106817
0.106426
0.106007
0.106113
0.106516
0.106892
0.106988
0.106625
0.106238
0.106396
0.106773
0.107127
0.107461
0.107326
0.107242
0.107566
0.107865
0.10814
0.108206
0.107934
0.107641
0.107774
0.10807
0.10835
0.108615
0.10846
0.108393
0.108376
0.108377
0.108377
0.108367
0.108639
0.108885
0.109106
0.10908
0.108871
0.108637
0.108624
0.108846
0.109043
0.109217
0.109264
0.109302
0.109474
0.109621
0.109747
0.109678
0.10956
0.109423
0.109369
0.109501
0.109617
0.109602
0.109477
0.109339
0.109186
0.109015
0.108824
0.108612
0.108623
0.108835
0.10903
0.10913
0.108919
0.108697
0.108868
0.10911
0.109343
0.109566
0.10933
0.109209
0.109377
0.109534
0.109683
0.109882
0.109705
0.109522
0.10978
0.109984
0.110176
0.110356
0.11005
0.109825
0.109718
0.109718
0.109778
0.109851
0.109917
0.109974
0.110067
0.110135
0.11018
0.110206
0.110219
0.110169
0.110149
0.110117
0.110071
0.110004
0.109935
0.11
0.11005
0.109983
0.109927
0.109861
0.109806
0.109885
0.109959
0.110031
0.110033
0.110087
0.110114
0.110073
0.110096
0.110223
0.110133
0.110033
0.109931
0.109826
0.109963
0.110095
0.110224
0.1105
0.110359
0.110209
0.110522
0.110674
0.110814
0.110939
0.110628
0.110345
0.11045
0.110735
0.11104
0.111347
0.111254
0.111137
0.111004
0.110858
0.110696
0.110518
0.110324
0.110114
0.109891
0.109655
0.109407
0.109148
0.108877
0.108596
0.108302
0.107996
0.107676
0.10734
0.106986
0.106614
0.106914
0.107287
0.107645
0.108044
0.107682
0.107307
0.107781
0.108153
0.108511
0.108854
0.108391
0.107989
0.108319
0.108635
0.10894
0.109349
0.109044
0.108725
0.109181
0.109493
0.10979
0.110243
0.10996
0.109662
0.109347
0.109017
0.108672
0.108311
0.108871
0.109215
0.109543
0.11008
0.109772
0.109448
0.110038
0.11034
0.11063
0.110907
0.110375
0.109856
0.110154
0.110437
0.110705
0.111177
0.110923
0.110656
0.111171
0.111423
0.111663
0.11189
0.111417
0.110958
0.11051
0.110071
0.109639
0.109231
0.10951
0.109775
0.110026
0.110418
0.110174
0.109915
0.110335
0.110583
0.110816
0.111032
0.110645
0.110261
0.110481
0.110685
0.110872
0.111228
0.11105
0.110855
0.111232
0.111417
0.111587
0.111955
0.111793
0.111616
0.111425
0.111219
0.110998
0.110762
0.111197
0.111421
0.111632
0.112058
0.111857
0.111644
0.112106
0.112308
0.112499
0.112678
0.112246
0.111828
0.112011
0.11218
0.112336
0.11273
0.112582
0.11242
0.112844
0.112998
0.113139
0.113561
0.113427
0.113282
0.113124
0.112955
0.112775
0.112583
0.112379
0.112165
0.111939
0.111702
0.111453
0.111194
0.110923
0.110641
0.111259
0.111521
0.111773
0.112366
0.112133
0.111892
0.112537
0.112759
0.112973
0.11318
0.112591
0.112015
0.112247
0.112469
0.112681
0.113211
0.113013
0.112807
0.113379
0.11357
0.113753
0.114305
0.114137
0.113962
0.11378
0.113591
0.113396
0.113195
0.113862
0.114043
0.114219
0.114855
0.114698
0.114537
0.115219
0.11536
0.115499
0.115634
0.115008
0.11439
0.114555
0.114714
0.114867
0.115438
0.1153
0.115156
0.115766
0.115893
0.116016
0.116135
0.11557
0.115014
0.114466
0.113927
0.113399
0.112883
0.113074
0.113254
0.113424
0.113905
0.113746
0.113578
0.114093
0.11425
0.114397
0.114536
0.114054
0.113583
0.113732
0.113869
0.113994
0.114439
0.114321
0.114193
0.114665
0.114784
0.114894
0.115358
0.115257
0.115147
0.115027
0.114899
0.114763
0.114618
0.115153
0.115286
0.115411
0.11593
0.115817
0.115697
0.116248
0.116356
0.116458
0.116554
0.116037
0.115528
0.115637
0.115738
0.115831
0.116313
0.116228
0.116136
0.116643
0.116726
0.116802
0.116871
0.116389
0.115915
0.115449
0.114993
0.114546
0.114109
0.113682
0.113268
0.112866
0.112477
0.112103
0.111741
0.111389
0.111042
0.111196
0.111335
0.111461
0.111787
0.111667
0.111536
0.111881
0.112007
0.112121
0.112218
0.111889
0.11157
0.111656
0.11197
0.112294
0.11263
0.112558
0.112466
0.112357
0.112236
0.112605
0.112721
0.112825
0.113197
0.113098
0.112988
0.113384
0.113488
0.113581
0.113658
0.113279
0.112912
0.11298
0.113343
0.113718
0.114105
0.11405
0.113977
0.11389
0.113792
0.114211
0.114304
0.114385
0.114803
0.114727
0.114641
0.115082
0.115161
0.115231
0.115288
0.114865
0.114452
0.114503
0.114912
0.115332
0.115761
0.115721
0.115669
0.115605
0.115531
0.11599
0.116057
0.116115
0.116571
0.116518
0.116457
0.116932
0.116986
0.117034
0.117073
0.116614
0.116163
0.116199
0.116647
0.117102
0.117565
0.117539
0.117504
0.117462
0.117414
0.11736
0.117298
0.117231
0.117157
0.117077
0.116992
0.116902
0.116806
0.116706
0.116601
0.116493
0.116381
0.116266
0.116149
0.116029
0.115907
0.1166
0.116702
0.116804
0.117464
0.11738
0.117297
0.117997
0.118061
0.118127
0.118193
0.117547
0.116904
0.117003
0.117099
0.117193
0.117789
0.11771
0.117629
0.118259
0.118325
0.118389
0.118993
0.118943
0.118892
0.118842
0.118792
0.118744
0.118698
0.1194
0.119429
0.11946
0.120128
0.120114
0.120103
0.120805
0.120799
0.120797
0.120798
0.120145
0.119493
0.119528
0.119564
0.1196
0.120209
0.120186
0.120165
0.120803
0.12081
0.120819
0.12083
0.120233
0.119637
0.119043
0.118453
0.117866
0.117283
0.11737
0.117454
0.117533
0.118079
0.118011
0.11794
0.118514
0.118573
0.11863
0.118684
0.118143
0.117607
0.117677
0.117742
0.117801
0.11831
0.118259
0.118203
0.118734
0.118781
0.118824
0.119343
0.119308
0.11927
0.119229
0.119185
0.11914
0.119092
0.119673
0.119709
0.119744
0.120305
0.120281
0.120257
0.120843
0.120856
0.120869
0.120883
0.120329
0.119777
0.119809
0.119839
0.119866
0.120392
0.120373
0.120351
0.120896
0.120909
0.120921
0.121452
0.121448
0.121443
0.121438
0.121434
0.121431
0.121429
0.121429
0.12143
0.121434
0.121441
0.12145
0.121464
0.121483
0.121506
0.122204
0.122165
0.122131
0.122796
0.122845
0.1229
0.122962
0.12367
0.123756
0.124476
0.124588
0.124709
0.124841
0.124985
0.125767
0.12594
0.126732
0.126936
0.127736
0.127514
0.127306
0.126541
0.126363
0.125606
0.125457
0.125319
0.125191
0.1259
0.126043
0.126197
0.12693
0.127112
0.127853
0.128063
0.128287
0.128525
0.128779
0.129049
0.129335
0.130164
0.130486
0.130826
0.131675
0.132052
0.132449
0.132868
0.133753
0.133318
0.132904
0.132511
0.132138
0.131318
0.130981
0.130661
0.129861
0.129574
0.129304
0.12905
0.12881
0.129548
0.129803
0.130073
0.130358
0.131131
0.131449
0.131784
0.132575
0.132944
0.133333
0.133742
0.134171
0.134623
0.135476
0.135009
0.134564
0.135372
0.135832
0.136314
0.137135
0.136638
0.136164
0.135711
0.134933
0.13414
0.133736
0.133352
0.132987
0.132224
0.131891
0.131575
0.13083
0.130545
0.130275
0.13002
0.129307
0.128585
0.128372
0.127656
0.127471
0.126761
0.126602
0.126455
0.125767
0.125073
0.124374
0.124281
0.123592
0.123522
0.123458
0.1234
0.122752
0.122102
0.122078
0.122058
0.122041
0.122651
0.122681
0.122714
0.123349
0.123302
0.12326
0.123867
0.123921
0.12398
0.124045
0.124117
0.124195
0.124865
0.124965
0.125644
0.126317
0.126189
0.125529
0.125423
0.124772
0.124687
0.124609
0.124537
0.124472
0.125073
0.12515
0.125234
0.125325
0.125958
0.126069
0.12671
0.126842
0.126984
0.127136
0.127298
0.127986
0.128173
0.128867
0.129081
0.129779
0.129552
0.129337
0.128665
0.128476
0.12781
0.127644
0.12749
0.127345
0.127973
0.12813
0.128298
0.128944
0.129134
0.129784
0.13
0.130227
0.130468
0.130723
0.130992
0.131276
0.131995
0.132309
0.132639
0.133374
0.133736
0.134116
0.134515
0.135278
0.134865
0.134472
0.134096
0.133739
0.13303
0.132703
0.132392
0.131698
0.131415
0.131147
0.130894
0.130653
0.131297
0.131549
0.131816
0.132096
0.132766
0.133075
0.133399
0.134081
0.134435
0.134805
0.135193
0.1356
0.136027
0.136473
0.13694
0.137429
0.137939
0.138727
0.138202
0.1377
0.138443
0.138959
0.139497
0.140249
0.139698
0.13917
0.138664
0.13795
0.137219
0.13676
0.13632
0.135901
0.136593
0.137026
0.137478
0.138179
0.137715
0.137271
0.137933
0.138389
0.138864
0.139361
0.139879
0.140419
0.140982
0.141698
0.141123
0.140571
0.141244
0.141807
0.142394
0.143071
0.143692
0.14436
0.145017
0.1457
0.146368
0.147088
0.147743
0.148501
0.149143
0.14994
0.150568
0.151403
0.152269
0.15289
0.152015
0.151171
0.151749
0.152601
0.153485
0.15405
0.153159
0.152299
0.151468
0.150926
0.150356
0.149762
0.148985
0.148376
0.147636
0.147013
0.14631
0.145674
0.145007
0.144364
0.143728
0.14312
0.142473
0.141899
0.141348
0.140703
0.140041
0.139533
0.139046
0.138579
0.139209
0.139686
0.140184
0.140818
0.14031
0.139822
0.139354
0.138751
0.138132
0.137496
0.136846
0.13618
0.1355
0.135117
0.134751
0.134403
0.133745
0.133425
0.13312
0.132473
0.132195
0.131931
0.132554
0.13283
0.133453
0.133754
0.134071
0.134704
0.135048
0.135408
0.135785
0.136439
0.136051
0.135679
0.135325
0.134987
0.134377
0.134064
0.133767
0.133166
0.132894
0.132292
0.13168
0.131058
0.130426
0.130211
0.129581
0.12939
0.128764
0.128595
0.128436
0.127826
0.127209
0.126586
0.126471
0.125855
0.12576
0.125671
0.125589
0.125002
0.124411
0.123818
0.123223
0.122625
0.122027
0.122016
0.122007
0.122
0.122566
0.122583
0.122603
0.123189
0.123159
0.123132
0.123109
0.122552
0.121995
0.121991
0.121987
0.121985
0.122519
0.122528
0.122539
0.123088
0.123069
0.123053
0.123586
0.12361
0.123636
0.123665
0.123697
0.123734
0.123774
0.124356
0.124306
0.124261
0.124822
0.124877
0.124937
0.125514
0.125445
0.125381
0.125323
0.124773
0.12422
0.124183
0.124149
0.124119
0.124651
0.124687
0.124728
0.125271
0.125223
0.125181
0.125143
0.124619
0.124093
0.123566
0.123038
0.12251
0.121983
0.121457
0.120932
0.12041
0.119891
0.119375
0.118863
0.118357
0.117855
0.117903
0.117945
0.117982
0.118466
0.118434
0.118398
0.118898
0.118929
0.118956
0.118978
0.118492
0.118013
0.118035
0.118512
0.118994
0.119482
0.119468
0.11945
0.119429
0.119404
0.119913
0.119933
0.11995
0.120453
0.120441
0.120426
0.120943
0.120951
0.120959
0.120965
0.120463
0.119964
0.119974
0.12047
0.12097
0.121473
0.121471
0.121468
0.121465
0.121461
0.121982
0.12198
0.121979
0.122492
0.122497
0.122503
0.123025
0.123014
0.123005
0.122997
0.122487
0.121978
0.121977
0.122484
0.122991
0.123498
0.123508
0.123519
0.123532
0.123548
0.12407
0.124049
0.124032
0.124544
0.124565
0.12459
0.125109
0.12508
0.125055
0.125034
0.124527
0.124018
0.124006
0.124513
0.125018
0.125521
0.12554
0.125564
0.125593
0.125626
0.125665
0.125708
0.125757
0.125811
0.125871
0.125937
0.126009
0.126088
0.126173
0.126265
0.126364
0.126964
0.127082
0.127688
0.128287
0.128147
0.127559
0.127438
0.126854
0.126752
0.126657
0.12657
0.126489
0.127037
0.127126
0.127222
0.127326
0.127895
0.128017
0.12859
0.12873
0.12888
0.129039
0.129209
0.129816
0.130007
0.130617
0.130831
0.131442
0.131217
0.131004
0.130414
0.130223
0.129635
0.129465
0.129306
0.129156
0.129715
0.129874
0.130043
0.130613
0.130803
0.131374
0.131585
0.131808
0.132044
0.132635
0.132389
0.132157
0.132718
0.13296
0.133216
0.133484
0.134064
0.134357
0.134664
0.135251
0.135584
0.135932
0.136297
0.136679
0.137079
0.137703
0.137293
0.136901
0.13749
0.137892
0.138312
0.138906
0.138476
0.138065
0.137671
0.137106
0.136526
0.136168
0.135826
0.135499
0.134934
0.134632
0.134344
0.133786
0.133521
0.13327
0.133032
0.132489
0.131936
0.131728
0.131175
0.130988
0.130435
0.130267
0.13011
0.129566
0.129016
0.128459
0.128337
0.127782
0.127677
0.127581
0.127492
0.126956
0.126415
0.126348
0.126287
0.126232
0.126753
0.126814
0.126881
0.12741
0.127336
0.12727
0.127782
0.127854
0.127934
0.128023
0.128119
0.128224
0.128764
0.128885
0.129427
0.129963
0.129826
0.129298
0.129178
0.128652
0.128548
0.128453
0.128367
0.12829
0.128792
0.128875
0.128967
0.129068
0.129582
0.129699
0.130212
0.130346
0.130491
0.130646
0.130811
0.131347
0.131532
0.132067
0.132272
0.132807
0.132594
0.132393
0.131875
0.131693
0.131174
0.131011
0.13086
0.130719
0.131217
0.131365
0.131523
0.132027
0.132204
0.132706
0.132902
0.13311
0.133331
0.133565
0.133811
0.134071
0.134609
0.134891
0.135188
0.135731
0.136051
0.136387
0.136738
0.137294
0.136934
0.13659
0.137116
0.137468
0.137837
0.138222
0.138624
0.139045
0.139484
0.139941
0.140419
0.140916
0.141434
0.141974
0.142535
0.143152
0.143747
0.144353
0.14498
0.145632
0.146236
0.146923
0.147514
0.148236
0.148813
0.14957
0.150132
0.150667
0.149894
0.149366
0.148628
0.148082
0.147378
0.146818
0.146148
0.145575
0.144939
0.144326
0.143749
0.143169
0.142581
0.142032
0.141504
0.140998
0.141559
0.142074
0.142611
0.14317
0.143737
0.144285
0.144882
0.145503
0.146046
0.1467
0.147229
0.147916
0.14843
0.149149
0.149643
0.150394
0.151173
0.15198
0.152817
0.153683
0.154581
0.155075
0.156011
0.156469
0.157444
0.158454
0.1595
0.159934
0.158882
0.157865
0.158242
0.159265
0.160325
0.161421
0.161777
0.162918
0.16324
0.164428
0.164719
0.165954
0.166215
0.167499
0.168825
0.170196
0.171611
0.171863
0.173331
0.173556
0.175077
0.176646
0.178267
0.178475
0.176849
0.175275
0.173749
0.17227
0.172082
0.170655
0.170442
0.169065
0.169273
0.169452
0.170839
0.170996
0.172431
0.173914
0.175444
0.177023
0.178653
0.178803
0.17717
0.175587
0.175707
0.177292
0.178928
0.180615
0.180719
0.182463
0.182546
0.184345
0.186201
0.188114
0.188179
0.190151
0.192185
0.192229
0.194325
0.19435
0.192254
0.190219
0.190194
0.188222
0.186307
0.186265
0.184408
0.182608
0.182648
0.184449
0.184472
0.18633
0.188245
0.182671
0.180923
0.180901
0.180862
0.180801
0.17911
0.17903
0.177391
0.175804
0.174265
0.17417
0.174054
0.172567
0.171128
0.169733
0.169605
0.168258
0.16811
0.167935
0.167733
0.166443
0.165196
0.164974
0.163772
0.163524
0.162368
0.162091
0.160981
0.160673
0.159607
0.158576
0.158871
0.159908
0.160172
0.161251
0.161487
0.16261
0.162821
0.163989
0.164176
0.165388
0.166641
0.166811
0.165553
0.164336
0.163158
0.163002
0.161868
0.161692
0.160601
0.160402
0.159353
0.159129
0.158121
0.15787
0.157582
0.157254
0.156883
0.155935
0.155527
0.154618
0.154171
0.153299
0.15374
0.154138
0.155021
0.155379
0.1563
0.156621
0.155695
0.154801
0.154491
0.153634
0.153286
0.152894
0.152457
0.151645
0.150861
0.150105
0.150529
0.151289
0.152077
0.152465
0.151673
0.15091
0.151245
0.152012
0.152808
0.153107
0.153939
0.154203
0.15507
0.15597
0.156903
0.157148
0.15621
0.155304
0.15443
0.153588
0.153366
0.15256
0.152307
0.151535
0.151784
0.151995
0.152777
0.152961
0.153778
0.154626
0.155505
0.156416
0.157361
0.158339
0.158527
0.159546
0.159712
0.160772
0.160918
0.162019
0.162147
0.16329
0.164472
0.165693
0.166955
0.167077
0.168384
0.168487
0.169841
0.171238
0.17268
0.172773
0.171328
0.169928
0.169997
0.171399
0.172846
0.174339
0.17588
0.17747
0.177527
0.179169
0.179207
0.179229
0.177586
0.177565
0.175972
0.175936
0.174394
0.172899
0.17145
0.170047
0.17008
0.171484
0.172933
0.174429
0.174449
0.175993
0.172953
0.171503
0.170098
0.168737
0.168719
0.168687
0.168639
0.168572
0.167259
0.167177
0.165909
0.165811
0.164586
0.164681
0.164758
0.165988
0.166051
0.167324
0.167371
0.166097
0.164863
0.164818
0.163626
0.163567
0.163493
0.163401
0.162255
0.161146
0.161042
0.159974
0.159854
0.158826
0.158689
0.1577
0.157543
0.156593
0.155677
0.155823
0.156745
0.156873
0.157832
0.157944
0.158941
0.159038
0.160074
0.160157
0.161232
0.162343
0.162415
0.161301
0.160224
0.159182
0.159118
0.158113
0.158037
0.15707
0.15698
0.15605
0.155946
0.155053
0.154934
0.154792
0.153939
0.153118
0.152326
0.152175
0.151417
0.151243
0.151037
0.150793
0.150506
0.150175
0.149797
0.149376
0.148918
0.14822
0.147737
0.147069
0.146568
0.145932
0.145417
0.144812
0.144229
0.14371
0.143157
0.142625
0.142102
0.142626
0.14313
0.143669
0.144161
0.144729
0.145319
0.145805
0.146425
0.146897
0.147546
0.147995
0.148673
0.149091
0.149466
0.148783
0.14841
0.147754
0.147342
0.146712
0.146271
0.145668
0.145208
0.144634
0.144082
0.143615
0.143091
0.142612
0.142115
0.141599
0.141064
0.140511
0.140045
0.139597
0.139168
0.139696
0.140133
0.140589
0.141116
0.140653
0.140208
0.139782
0.139278
0.138757
0.138364
0.137988
0.137628
0.138125
0.138492
0.138876
0.139373
0.138982
0.138608
0.139076
0.139457
0.139854
0.140269
0.140702
0.141154
0.141625
0.142115
0.141638
0.141179
0.141638
0.142103
0.142587
0.14304
0.14355
0.143992
0.144529
0.145088
0.14552
0.146105
0.146512
0.147122
0.147492
0.148126
0.148451
0.14911
0.149795
0.150078
0.14939
0.148729
0.148962
0.149626
0.150318
0.15052
0.149824
0.149155
0.148513
0.148324
0.148094
0.147817
0.147207
0.146882
0.146295
0.145925
0.14536
0.144957
0.144415
0.143894
0.143476
0.142979
0.142549
0.142079
0.141627
0.141192
0.14074
0.140318
0.139915
0.139528
0.139964
0.140356
0.140765
0.141194
0.140779
0.140382
0.140784
0.141186
0.141607
0.142045
0.142503
0.14291
0.143392
0.143786
0.144291
0.144815
0.145185
0.145729
0.146056
0.146621
0.146897
0.147483
0.147711
0.147898
0.147307
0.147124
0.14656
0.146333
0.145792
0.145513
0.14499
0.14466
0.144155
0.143668
0.143301
0.142834
0.142448
0.142004
0.141578
0.141171
0.141543
0.141956
0.142386
0.14275
0.1432
0.143537
0.144003
0.144487
0.144773
0.145272
0.145501
0.146019
0.146199
0.146741
0.146885
0.147454
0.148049
0.148669
0.149315
0.149988
0.150689
0.15083
0.151563
0.151686
0.152453
0.153249
0.154076
0.154191
0.153359
0.152559
0.152646
0.153451
0.154286
0.155152
0.155235
0.156136
0.156207
0.157143
0.157203
0.158175
0.158224
0.159233
0.160276
0.161356
0.162472
0.162513
0.163669
0.163697
0.164892
0.166127
0.167402
0.16742
0.166143
0.164908
0.163713
0.162555
0.16254
0.161421
0.161396
0.160315
0.160339
0.160353
0.161436
0.159307
0.159293
0.159269
0.158259
0.157283
0.157249
0.156308
0.156264
0.155357
0.155302
0.15443
0.154365
0.153527
0.152718
0.152777
0.153588
0.153638
0.154482
0.154522
0.155399
0.15543
0.15634
0.156361
0.157305
0.158282
0.158295
0.157317
0.156373
0.155461
0.15545
0.15457
0.154551
0.153703
0.153676
0.15286
0.152824
0.152039
0.151995
0.151939
0.151871
0.151787
0.151045
0.150947
0.150237
0.150125
0.149447
0.149555
0.149643
0.15033
0.150406
0.151124
0.15119
0.150468
0.149774
0.149715
0.149052
0.148984
0.148899
0.148796
0.148171
0.147572
0.146999
0.147089
0.147667
0.14827
0.14835
0.147743
0.147161
0.147217
0.147803
0.148414
0.148466
0.149106
0.14915
0.14982
0.150517
0.151242
0.151284
0.150556
0.149856
0.149184
0.148537
0.148506
0.147888
0.147851
0.147261
0.147295
0.147321
0.147917
0.147938
0.148561
0.149209
0.149884
0.150586
0.151316
0.152073
0.152098
0.152886
0.152903
0.153721
0.153731
0.15458
0.152912
0.152122
0.152113
0.151353
0.151338
0.150608
0.149904
0.149917
0.150621
0.150629
0.151362
0.149924
0.149246
0.149239
0.149228
0.148578
0.147953
0.147354
0.147341
0.146768
0.146751
0.146728
0.146696
0.146656
0.146603
0.146536
0.14645
0.14634
0.145819
0.145681
0.145185
0.145005
0.144529
0.144293
0.143832
0.143388
0.143089
0.142657
0.142318
0.141902
0.142242
0.14255
0.142961
0.143216
0.143636
0.144073
0.144259
0.144712
0.144848
0.145322
0.145425
0.145926
0.146008
0.146071
0.145562
0.145503
0.145022
0.144948
0.144494
0.144396
0.143965
0.143827
0.143413
0.143018
0.142813
0.142425
0.142155
0.141842
0.141504
0.141149
0.140781
0.140399
0.140002
0.139589
0.139158
0.138712
0.13825
0.137774
0.137284
0.13678
0.136262
0.135949
0.135426
0.135136
0.13486
0.134341
0.134087
0.133845
0.133617
0.133402
0.133891
0.134114
0.134349
0.134598
0.135097
0.135367
0.135651
0.136153
0.136459
0.136956
0.136643
0.136345
0.135862
0.135586
0.135323
0.134842
0.134599
0.13437
0.134154
0.133682
0.133199
0.133008
0.132522
0.13235
0.131862
0.131708
0.131565
0.131081
0.130588
0.130089
0.129975
0.129474
0.129376
0.129288
0.129777
0.129871
0.130359
0.130469
0.130955
0.131434
0.131314
0.13084
0.130737
0.130261
0.130172
0.129694
0.129209
0.128717
0.12822
0.127718
0.127211
0.126699
0.126184
0.12614
0.126102
0.12607
0.126573
0.126609
0.126651
0.127158
0.127112
0.127072
0.12704
0.126544
0.126043
0.126022
0.12652
0.127015
0.127505
0.127533
0.127568
0.127611
0.127661
0.128159
0.128105
0.128058
0.128544
0.128594
0.128652
0.129139
0.129077
0.129024
0.128981
0.128504
0.128021
0.127991
0.128472
0.128948
0.129417
0.129453
0.129498
0.129554
0.129619
0.130094
0.130024
0.129965
0.130426
0.130488
0.130561
0.130644
0.131108
0.131205
0.131666
0.13178
0.131905
0.132042
0.13219
0.132664
0.13283
0.1333
0.133485
0.133951
0.133761
0.133583
0.133128
0.132968
0.13251
0.132367
0.132237
0.132119
0.132563
0.132686
0.132821
0.133265
0.133418
0.133858
0.134029
0.134212
0.134408
0.134617
0.134839
0.135074
0.135537
0.135792
0.136062
0.136525
0.136815
0.13712
0.137439
0.137909
0.137583
0.137272
0.136976
0.136695
0.13625
0.135989
0.135742
0.135296
0.135068
0.134853
0.134652
0.134464
0.134888
0.135082
0.135288
0.135508
0.135937
0.136176
0.136428
0.136856
0.137128
0.137414
0.137716
0.138032
0.138364
0.138805
0.138467
0.138146
0.138561
0.138887
0.13923
0.139639
0.139292
0.13896
0.138645
0.138249
0.137839
0.137547
0.13727
0.137008
0.136598
0.136354
0.136124
0.135712
0.135501
0.135303
0.135118
0.134708
0.134288
0.134126
0.133701
0.133556
0.133125
0.132998
0.132883
0.132452
0.132012
0.131564
0.131473
0.131021
0.130944
0.130879
0.130827
0.130376
0.129918
0.129881
0.130337
0.130786
0.131227
0.13127
0.131325
0.131393
0.131833
0.131917
0.132353
0.13278
0.132689
0.132266
0.132192
0.131763
0.131706
0.131661
0.132086
0.132132
0.132551
0.132613
0.133025
0.133104
0.133198
0.133305
0.133424
0.133841
0.133977
0.134388
0.134542
0.134947
0.134789
0.134645
0.134248
0.134121
0.133718
0.133607
0.133509
0.133427
0.13382
0.133905
0.134007
0.134397
0.134515
0.134898
0.135032
0.13518
0.135342
0.135517
0.135706
0.135908
0.136304
0.136525
0.136759
0.137152
0.137404
0.137671
0.137953
0.138344
0.138059
0.137788
0.137531
0.137289
0.136913
0.136689
0.136478
0.136098
0.135905
0.135726
0.13556
0.135409
0.135775
0.13593
0.136099
0.136281
0.136647
0.136847
0.137061
0.13742
0.137651
0.137897
0.138157
0.138431
0.13872
0.139025
0.139344
0.13968
0.140031
0.140408
0.140052
0.139712
0.140067
0.14041
0.140771
0.141122
0.140757
0.140409
0.140077
0.139739
0.139389
0.139081
0.138788
0.138511
0.13885
0.139131
0.139427
0.139761
0.139461
0.139176
0.139492
0.13978
0.140085
0.140405
0.14074
0.141092
0.141459
0.141774
0.141408
0.141057
0.141348
0.141693
0.142052
0.142277
0.14264
0.142794
0.143165
0.143555
0.143652
0.144062
0.144129
0.144564
0.144615
0.145077
0.145117
0.145606
0.146119
0.146156
0.14564
0.145147
0.145169
0.145665
0.146184
0.146205
0.145683
0.145184
0.144708
0.144696
0.144677
0.144651
0.144208
0.144175
0.143759
0.143716
0.143325
0.143263
0.142894
0.142546
0.14244
0.142103
0.141929
0.141594
0.141272
0.141015
0.140721
0.140399
0.140091
0.139799
0.140097
0.14039
0.140696
0.140962
0.140663
0.140376
0.1401
0.139819
0.139523
0.139219
0.138907
0.138584
0.138248
0.137999
0.137765
0.137545
0.137203
0.136999
0.13681
0.13646
0.136288
0.13613
0.136474
0.136635
0.136969
0.137147
0.137339
0.137666
0.137874
0.138096
0.138333
0.138653
0.138414
0.138189
0.137978
0.137782
0.137471
0.137291
0.137125
0.136806
0.136656
0.136327
0.135986
0.135634
0.135271
0.135146
0.134776
0.134668
0.134292
0.134203
0.134131
0.13375
0.13336
0.13296
0.132909
0.132502
0.133307
0.133695
0.134074
0.134442
0.134502
0.134577
0.13494
0.135035
0.135391
0.135505
0.135854
0.135737
0.135636
0.135293
0.135213
0.134862
0.134801
0.135149
0.135487
0.135553
0.135882
0.135968
0.136072
0.136192
0.136519
0.136396
0.13629
0.1366
0.136709
0.136835
0.136973
0.137278
0.137432
0.1376
0.137895
0.138079
0.138278
0.138491
0.138719
0.138961
0.139261
0.139015
0.138783
0.13907
0.139304
0.139554
0.139837
0.139587
0.13935
0.139127
0.13885
0.138567
0.138366
0.138179
0.138007
0.137726
0.13757
0.137428
0.137138
0.13701
0.136898
0.136805
0.136509
0.136201
0.13613
0.135814
0.136436
0.13673
0.137013
0.13709
0.137185
0.137298
0.137575
0.137706
0.13785
0.13812
0.13828
0.138455
0.138645
0.138919
0.138725
0.138547
0.138384
0.138235
0.137974
0.137841
0.137723
0.13746
0.137363
0.137284
0.137545
0.137625
0.137878
0.137979
0.138099
0.138352
0.138492
0.138644
0.13881
0.138992
0.139188
0.139397
0.139618
0.139852
0.140096
0.140351
0.140616
0.14089
0.141176
0.141472
0.141781
0.141903
0.142215
0.142279
0.142608
0.142956
0.142992
0.143364
0.143389
0.143787
0.143806
0.14423
0.144245
0.144255
0.143824
0.143817
0.143411
0.143403
0.143023
0.143012
0.142657
0.142641
0.142311
0.142002
0.141971
0.141681
0.141606
0.141324
0.141054
0.140796
0.140908
0.141151
0.141408
0.141444
0.141713
0.141721
0.142012
0.142324
0.142326
0.142664
0.142665
0.143027
0.143028
0.143415
0.143417
0.143828
0.144261
0.144717
0.145195
0.145696
0.14622
0.14623
0.14678
0.146787
0.147363
0.147963
0.148588
0.148594
0.147968
0.147367
0.146792
0.14624
0.146236
0.145709
0.145704
0.145201
0.145205
0.145208
0.145712
0.144726
0.144725
0.144722
0.144264
0.143829
0.143416
0.143416
0.14383
0.144266
0.144267
0.14383
0.143415
0.143021
0.143023
0.143025
0.143027
0.142658
0.142662
0.142317
0.142323
0.142003
0.14201
0.141715
0.141441
0.14145
0.141199
0.141193
0.140959
0.140968
0.140954
0.141187
0.141168
0.141426
0.141704
0.141691
0.141994
0.141984
0.142311
0.142305
0.142654
0.142651
0.142649
0.142297
0.1423
0.14197
0.141976
0.141668
0.141678
0.141393
0.141409
0.141147
0.140906
0.140931
0.140715
0.140741
0.140754
0.14074
0.140677
0.140548
0.140309
0.140079
0.139857
0.140043
0.140246
0.140457
0.140535
0.140342
0.140159
0.139984
0.139847
0.139644
0.139441
0.139249
0.139068
0.139306
0.139478
0.139659
0.139817
0.139656
0.139501
0.139632
0.139764
0.139904
0.140051
0.140208
0.140376
0.140558
0.140546
0.140369
0.140209
0.140183
0.140342
0.140519
0.140486
0.140686
0.140659
0.140883
0.141128
0.141112
0.14138
0.14137
0.14166
0.141655
0.141966
0.141365
0.141094
0.141101
0.140852
0.140864
0.140637
0.14043
0.140455
0.140272
0.140306
0.140147
0.140006
0.140042
0.140063
0.139929
0.139807
0.139694
0.139703
0.139803
0.139916
0.139882
0.139775
0.139682
0.139648
0.139737
0.139843
0.139966
0.140109
0.140077
0.140243
0.140223
0.140413
0.140622
0.140613
0.140844
0.140403
0.140212
0.140041
0.140054
0.139906
0.139932
0.139806
0.139701
0.139614
0.139585
0.139672
0.139779
0.139761
0.139891
0.139653
0.139566
0.1395
0.139517
0.139543
0.139574
0.139602
0.139613
0.139589
0.139506
0.139353
0.139143
0.1389
0.138746
0.138603
0.138476
0.138228
0.138125
0.138041
0.137796
0.138282
0.138369
0.138612
0.138721
0.13885
0.138992
0.139213
0.139079
0.138955
0.138848
0.138759
0.138522
0.13898
0.139062
0.139158
0.139268
0.139385
0.139491
0.139396
0.139308
0.139393
0.139459
0.139533
0.139533
0.139473
0.139424
0.139387
0.139338
0.139231
0.139165
0.139293
0.13936
0.139386
0.1394
0.139425
0.139463
0.139512
0.139487
0.139445
0.139416
0.139409
0.13943
0.139466
0.139452
0.139421
0.139405
0.139398
0.139399
0.1394
0.139392
0.139394
0.139395
0.101248
0.10299
0.102852
0.103552
0.103615
0.106977
0.1063
0.1079
0.108537
0.115617
0.144108
0.132288
0.128976
0.130129
0.123937
0.123858
0.146761
0.154444
0.155587
0.156014
0.157461
0.15888
0.178272
0.177598
0.1764
0.167876
0.180688
0.182179
0.192964
0.247478
0.239525
0.23787
0.236486
0.224189
0.259099
0.26083
0.280149
0.281371
0.310202
0.312149
0.333034
0.340973
0.343434
0.356879
0.483959
0.512583
0.110025
0.11015
0.110086
0.109929
0.109803
0.110004
0.110216
0.110241
0.110214
0.110175
0.110138
0.110129
0.110192
0.110354
0.110596
0.110876
0.111168
0.111463
0.111761
0.112067
0.112385
0.112715
0.113059
0.113416
0.113786
0.114168
0.114562
0.114966
0.115381
0.115806
0.11624
0.116683
0.117135
0.117594
0.118061
0.118533
0.119012
0.119496
0.119985
0.120478
0.120975
0.121474
0.121975
0.122478
0.122983
0.123487
0.123992
0.124496
0.124998
0.125499
0.125997
0.126493
0.126985
0.127473
0.127956
0.128435
0.128908
0.129376
0.129837
0.130291
0.130738
0.131177
0.131609
0.132032
0.132446
0.132851
0.133247
0.133634
0.13401
0.134376
0.134732
0.135078
0.135413
0.135738
0.136052
0.136354
0.136646
0.136926
0.137195
0.137453
0.137701
0.137942
0.13818
0.138416
0.13865
0.138876
0.139078
0.139234
0.13933
0.139373
0.139385
0.13939
0.110149
0.109986
0.109728
0.11022
)
;
boundaryField
{
bottomEmptyFaces
{
type empty;
}
topEmptyFaces
{
type empty;
}
inlet
{
type calculated;
value nonuniform List<scalar>
95
(
0.13939
0.13939
0.139385
0.13937
0.139325
0.139223
0.139061
0.138856
0.138629
0.138396
0.138162
0.137925
0.137685
0.137437
0.137179
0.136911
0.136631
0.13634
0.136038
0.135725
0.1354
0.135066
0.13472
0.134364
0.133998
0.133622
0.133236
0.13284
0.132435
0.132021
0.131598
0.131167
0.130728
0.130281
0.129827
0.129366
0.1289
0.128427
0.127948
0.127465
0.126978
0.126486
0.125991
0.125494
0.124993
0.124491
0.123988
0.123484
0.12298
0.122477
0.121974
0.121474
0.120975
0.120479
0.119987
0.119499
0.119016
0.118538
0.118065
0.1176
0.117141
0.116691
0.116248
0.115815
0.115391
0.114977
0.114573
0.11418
0.113799
0.113431
0.113074
0.112732
0.112403
0.112087
0.111782
0.111486
0.111196
0.110909
0.110633
0.11039
0.110219
0.110144
0.110142
0.110172
0.110211
0.110232
0.110141
0.109962
0.109664
0.110207
0.110235
0.139392
0.10657
0.108622
0.109179
)
;
}
outlet
{
type calculated;
value nonuniform List<scalar>
36
(
0.455938
0.455927
0.455911
0.455885
0.455853
0.455811
0.45576
0.455698
0.455623
0.455531
0.455417
0.455272
0.455086
0.454839
0.454504
0.454039
0.453381
0.452446
0.451108
0.449286
0.446723
0.443426
0.43635
0.440736
0.434362
0.432127
0.421567
0.428658
0.419388
0.414594
0.393104
0.357557
0.227992
0.286857
0.31761
0.455942
)
;
}
walls
{
type calculated;
value uniform 0;
}
rightWall
{
type calculated;
value nonuniform List<scalar>
28
(
0.089584
0.0933224
0.0950541
0.0957311
0.0961266
0.0964488
0.0967372
0.0972435
0.0974453
0.09764
0.0977139
0.0977458
0.0977234
0.0976213
0.0975018
0.0972358
0.0969934
0.0963894
0.0960835
0.0955829
0.0941264
0.0916132
0.0715778
0.0829924
0.0881999
0.0512105
0.0717717
0.0817501
)
;
}
symmetryLine
{
type symmetryPlane;
}
}
// ************************************************************************* //
|
[
"mhoeper3234@gmail.com"
] |
mhoeper3234@gmail.com
|
|
951776af12a4e063cdb38c65765be816289e521f
|
8c9575a3582289157af75f08b08f3d17237879c8
|
/src/hash/system-test/system_test.cpp
|
992a69443044d1c3f7dbaa46c10629d3483735d8
|
[] |
no_license
|
babky/hashing
|
a7c4a2ef1a9fb1bc33e3ea82ac7c140bde6cc42a
|
e520bd28901473fb812b7ffa888560974405c54b
|
refs/heads/master
| 2020-12-30T13:22:02.271181
| 2020-04-08T19:51:09
| 2020-04-08T19:51:09
| 91,207,567
| 0
| 0
| null | 2020-10-13T04:38:32
| 2017-05-13T23:02:42
|
TeX
|
UTF-8
|
C++
| false
| false
| 6,719
|
cpp
|
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include "utils/boost_include.h"
#include <boost/program_options.hpp>
#include "systems/uniform/dietzfelbinger_woelfel.h"
#include "systems/bit_string_system.h"
#include "systems/polynomial_system.h"
#include "systems/linear_map_system.h"
#include "systems/cwlf_system.h"
#include "systems/multiply_shift_system.h"
#include "systems/cwlf_exponential_system.h"
#include "systems/tabulation_system.h"
#include "systems/polynomial_system.h"
#include "systems/tr1_function.h"
#include "systems/identity_function.h"
#include "utils/time_vector.h"
using namespace std;
using namespace boost::posix_time;
using namespace Hash::Utils;
/**
* Testing of the (time) peformance of various hash systems.
*/
struct Test {
Test(string aName, size_t aLength, size_t aRepeats):
name(aName),
length(aLength),
repeats(aRepeats)
{
}
virtual ~Test(void) {
}
const string & getName(void) const {
return name;
}
virtual void run(void) = 0;
TimeVector & getTimes(void) {
return times;
}
protected:
string name;
size_t length;
size_t repeats;
TimeVector times;
};
template<class F, typename T>
struct FunctionTest : public Test {
FunctionTest(string aName, size_t aLength, size_t aRepeats):
Test(aName, aLength, aRepeats)
{
}
virtual void run() {
cout << "Running " << name << " of length " << length << ".\n";
function.setTableSize(length);
ptime start, finish;
size_t hash = 0xdead;
for (size_t j = 0; j < repeats; ++j) {
start = microsec_clock::local_time();
function.reset();
hash = 0xdead;
for (size_t i = 0; i < length; ++i) {
hash ^= function.hash(i);
}
if (hash == 0) {
cout << "Almost impossible :)!\n";
}
finish = microsec_clock::local_time();
times.add(finish - start);
}
}
private:
F function;
};
class CompleteTest {
public:
typedef vector<Test *> FunctionTestVector;
CompleteTest(size_t aLength, size_t aRepeats):
length(aLength),
repeats(aRepeats) {
}
template<typename T>
void runTest(void) {
typedef size_t TestStorage;
using namespace Hash::Systems;
functions.push_back(new FunctionTest<IdentityFunction<T, TestStorage>, T>("ID", length, repeats));
functions.push_back(new FunctionTest<Tr1Function<T, TestStorage>, T>("TR1", length, repeats));
functions.push_back(new FunctionTest<UniversalFunctionCWLF<T, TestStorage>, T>("CWLF", length, repeats));
functions.push_back(new FunctionTest<CWLFExponentialSystem<T, TestStorage>, T>("CWLFExp", length, repeats));
functions.push_back(new FunctionTest<BitStringFunction<T, TestStorage>, T>("BitString", length, repeats));
functions.push_back(new FunctionTest<TabulationFunction<T, TestStorage>, T>("Tabulation", length, repeats));
functions.push_back(new FunctionTest<UniversalFunctionLinearMap<T, TestStorage>, T>("LinearMap", length, repeats));
functions.push_back(new FunctionTest<PolynomialSystem<T, TestStorage>, T>("Polynomial - deg 2", length, repeats));
functions.push_back(new FunctionTest<PolynomialSystem4<T, TestStorage>, T>("Polynomial - deg 4", length, repeats));
functions.push_back(new FunctionTest<Uniform::DietzfelbingerWoelfel<T, TestStorage, Hash::Systems::PolynomialSystem4>, T>("DW - deg 4", length, repeats));
functions.push_back(new FunctionTest<MultiplyShiftSystem<T, TestStorage>, T>("MultiplyShift", length, repeats));
for (FunctionTestVector::iterator b = functions.begin(), e = functions.end(); b != e; ++b) {
(*b)->run();
}
}
size_t getLength(void) const {
return length;
}
size_t getRepeats(void) const {
return repeats;
}
FunctionTestVector & getFunctions(void) {
return functions;
}
protected:
FunctionTestVector functions;
size_t length;
size_t repeats;
};
int main(int argc, char ** argv) {
using namespace boost::program_options;
size_t bits;
const size_t DEFAULT_BITS = 32;
size_t length;
#ifdef HASH_DEBUG
const size_t DEFAULT_LENGTH = 10;
#else
const size_t DEFAULT_LENGTH = 24;
#endif
size_t repeats;
const size_t DEFAULT_REPEATS = 32;
size_t step;
const size_t DEFAULT_STEP = 1;
size_t steps;
const size_t DEFAULT_STEPS = 0;
string output;
string DEFAULT_OUTPUT = "";
bool help;
options_description opts("Universal systems test options.");
opts.add_options()
("bits", value<size_t>(&bits)->default_value(DEFAULT_BITS), "the number of bits used 32 or 64")
("length", value<size_t>(&length)->default_value(DEFAULT_LENGTH), "the logarithm of number of times the function is called and the size of the table")
("repeats", value<size_t>(&repeats)->default_value(DEFAULT_REPEATS), "the number of repetitions")
("step", value<size_t>(&step)->default_value(DEFAULT_STEP), "the iteration step")
("steps", value<size_t>(&steps)->default_value(DEFAULT_STEPS), "the number of steps")
("output", value<string>(&output)->default_value(DEFAULT_OUTPUT), "output file")
("help", "prints this help.");
variables_map vm;
store(parse_command_line(argc, argv, opts), vm);
notify(vm);
if (vm.count("help")) {
cout << opts;
return 0;
}
typedef vector<CompleteTest> TestVector;
TestVector v;
for (size_t s = 0; s < steps; ++s) {
CompleteTest t(1 << (length + s * step), repeats);
if (bits == 32) {
t.runTest<boost::uint32_t>();
} else if (bits == 64) {
t.runTest<boost::uint64_t>();
/*#ifdef __GNUC__ TODO: Not working in gcc 4.7.
} else if (bits == 128) {
t.runTest<__uint128_t>();
#endif*/
} else {
std::cerr << opts;
return 1;
}
v.push_back(t);
}
ofstream fout;
if (output != "") {
fout.open(output.c_str());
}
ostream & out = output != "" ? fout : cout;
for (TestVector::iterator b = v.begin(), e = v.end(); b != e; ++b) {
out << "TEST: length = " << setw(10) << b->getLength() << ", repeats = " << setw(2) << b->getRepeats() << "\n";
for (CompleteTest::FunctionTestVector::iterator fb = b->getFunctions().begin(), fe = b->getFunctions().end(); fe != fb; ++fb) {
out << setw(20) << (*fb)->getName() << " " << setw(6) << right << (*fb)->getTimes().getAverageTime().total_milliseconds() << " [(+/-) " << setw(12) << fixed << setprecision(3) << (*fb)->getTimes().getMillisVariance() << "] ms\n";
}
out << "\n";
}
if (output != "") {
out << "\n\n---PRINTING WHOLE DATA SET---\n";
for (TestVector::iterator b = v.begin(), e = v.end(); b != e; ++b) {
for (CompleteTest::FunctionTestVector::iterator fb = b->getFunctions().begin(), fe = b->getFunctions().end(); fe != fb; ++fb) {
out << setw(20) << (*fb)->getName() << ", length = " << setw(10) << b->getLength() << ", repeats = " << setw(2) << b->getRepeats() << ": ";
out << (*fb)->getTimes() << "\n";
}
}
fout.close();
}
return 0;
}
|
[
"babky@users.noreply.github.com"
] |
babky@users.noreply.github.com
|
c5fab90689a4f8592a11737d201e0400eaeeaa42
|
5aa0551354d442ef3c531802775ac4eab96c3b01
|
/Source/ui/longitudinalwidget.h
|
05a2735983e54d1f27701c65ab50561f42feee96
|
[] |
no_license
|
rafaelppires/weldway
|
404e26d0676720b2e6c7a168c925654dc7f96f14
|
ea421cb4879420ca691265aa0dde979b5ce6bbd8
|
refs/heads/master
| 2016-08-03T08:42:48.467688
| 2015-09-21T13:14:29
| 2015-09-21T13:14:29
| 31,918,598
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 882
|
h
|
#ifndef LONGITUDINALWIDGET_H
#define LONGITUDINALWIDGET_H
#include <oscillation_widget.h>
#include <slider_spin.h>
#include <trajectory.h>
namespace Ui {
class LongitudinalWidget;
}
//-----------------------------------------------------------------------------
class LongitudinalWidget : public OscillationWidget {
Q_OBJECT
public:
explicit LongitudinalWidget(QWidget *parent = 0);
~LongitudinalWidget();
virtual AbsTrajectoryPtr trajectory(TrajectoryTransformPtr tt);
virtual void draft(PositionVector&) {}
private slots:
void on_longTrajectoryComboBox_currentTextChanged(const QString &arg1);
void changeRatios();
private:
Ui::LongitudinalWidget *ui;
SliderSpin *sbWeldSpeedSliderSpin, *fwSpeedSliderSpin, *fwLengthSliderSpin, *bwSpeedSliderSpin, *bwLengthSliderSpin, *spdratioSliderSpin;
};
#endif // LONGITUDINALWIDGET_H
|
[
"Rafael@5480589f-094f-1b4a-8096-6e62e98e9fcd"
] |
Rafael@5480589f-094f-1b4a-8096-6e62e98e9fcd
|
476b427a7993fa35effae3c37e1216dabf090c8a
|
1a1155a3e9535206d692fe2c7ddff27ca7e712c5
|
/8_Program.cpp
|
14bf01370004208a5656105c46d38a8ac0fc64f1
|
[] |
no_license
|
anuragbisht12/CPP-Revisited
|
e080c9073514500a56db2f7de1b8608f0062d3ea
|
f35c015b8e34b13395c885e6d3ac83f5fad7a604
|
refs/heads/master
| 2023-02-10T04:24:26.378913
| 2020-12-28T14:16:52
| 2020-12-28T14:16:52
| 278,111,349
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 2,908
|
cpp
|
/*
C++ Strings
C++ provides following two types of string representations −
The C-style character string.
The string class type introduced with Standard C++.
The C-Style Character String
The C-style character string originated within the C language and continues to be supported within C++.
This string is actually a one-dimensional array of characters which is terminated by a null character '\0'.
Thus a null-terminated string contains the characters that comprise the string followed by a null.
The following declaration and initialization create a string consisting of the word "Hello".
To hold the null character at the end of the array, the size of the character array containing the
string is one more than the number of characters in the word "Hello."
*/
#include <iostream>
using namespace std;
int main()
{
char greeting[6] = {'H', 'e', 'l', 'l', 'o', '\0'};
char greeting2[] = "Hello";
cout << "Greeting message: ";
cout << greeting << endl;
cout << greeting2 << endl;
return 0;
}
/*
Function & Purpose
1
strcpy(s1, s2);
Copies string s2 into string s1.
2
strcat(s1, s2);
Concatenates string s2 onto the end of string s1.
3
strlen(s1);
Returns the length of string s1.
4
strcmp(s1, s2);
Returns 0 if s1 and s2 are the same; less than 0 if s1<s2; greater than 0 if s1>s2.
5
strchr(s1, ch);
Returns a pointer to the first occurrence of character ch in string s1.
6
strstr(s1, s2);
Returns a pointer to the first occurrence of string s2 in string s1.
*/
Live Demo
#include <iostream>
#include <cstring>
using namespace std;
int main()
{
char str1[10] = "Hello";
char str2[10] = "World";
char str3[10];
int len;
// copy str1 into str3
strcpy(str3, str1);
cout << "strcpy( str3, str1) : " << str3 << endl;
// concatenates str1 and str2
strcat(str1, str2);
cout << "strcat( str1, str2): " << str1 << endl;
// total lenghth of str1 after concatenation
len = strlen(str1);
cout << "strlen(str1) : " << len << endl;
return 0;
}
// strcpy( str3, str1) : Hello
// strcat( str1, str2): HelloWorld
// strlen(str1) : 10
/*
The String Class in C++
The standard C++ library provides a string class type that supports all the operations mentioned above,
additionally much more functionality. Let us check the following example −
*/
#include <iostream>
#include <string>
using namespace std;
int main()
{
string str1 = "Hello";
string str2 = "World";
string str3;
int len;
// copy str1 into str3
str3 = str1;
cout << "str3 : " << str3 << endl;
// concatenates str1 and str2
str3 = str1 + str2;
cout << "str1 + str2 : " << str3 << endl;
// total length of str3 after concatenation
len = str3.size();
cout << "str3.size() : " << len << endl;
return 0;
}
// str3 : Hello
// str1 + str2 : HelloWorld
// str3.size() : 10
|
[
"anuragbisht12@gmail.com"
] |
anuragbisht12@gmail.com
|
3003b7a455fd464e95600da552baebd45192331b
|
fe18014a36e9044e6b35dd277a079d23fec38ef1
|
/Utils/Histogram.cc
|
500badb5936a09f71b4e8f2f0f2ff6a67035e864
|
[] |
no_license
|
mlamarre/ACG
|
b8127d91155fd00bddd0f7e7c3d56b603b4125dc
|
80f116e53a5af15993dddec919d70a0f995ef8ea
|
refs/heads/master
| 2021-05-16T15:56:36.625825
| 2018-01-31T02:55:14
| 2018-01-31T02:55:14
| 119,601,050
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 3,413
|
cc
|
/*===========================================================================*\
* *
* OpenFlipper *
* Copyright (c) 2001-2015, RWTH-Aachen University *
* Department of Computer Graphics and Multimedia *
* All rights reserved. *
* www.openflipper.org *
* *
*---------------------------------------------------------------------------*
* This file is part of OpenFlipper. *
*---------------------------------------------------------------------------*
* *
* Redistribution and use in source and binary forms, with or without *
* modification, are permitted provided that the following conditions *
* are met: *
* *
* 1. Redistributions of source code must retain the above copyright notice, *
* this list of conditions and the following disclaimer. *
* *
* 2. Redistributions in binary form must reproduce the above copyright *
* notice, this list of conditions and the following disclaimer in the *
* documentation and/or other materials provided with the distribution. *
* *
* 3. Neither the name of the copyright holder nor the names of its *
* contributors may be used to endorse or promote products derived from *
* this software without specific prior written permission. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
* *
\*===========================================================================*/
#include "Histogram.hh"
namespace ACG {
template<>
QString HistogramT<double>::getBoundaryLabel(size_t idx) const {
// TODO: choose accuracy based on avg_bin_size_
return QString::number(bin_boundaries_[idx], 'g', 2);
}
} // namespace ACG
|
[
"mlamarre@ea.com"
] |
mlamarre@ea.com
|
75070004695fc0ac4af69bbbb61287ef36128b64
|
91ba0c0c42b3fcdbc2a7778e4a4684ab1942714b
|
/Cpp/SDK/BP_RB_Rank03_RankDesc_classes.h
|
49505848bd3a10a357f090e5ac2e8bfdc31583bb
|
[] |
no_license
|
zH4x/SoT-SDK-2.1.1
|
0f8c1ec3ad8821de82df3f75a0356642b581b8c6
|
35144dfc629aeddf96c1741e9e27e5113a2b1bb3
|
refs/heads/main
| 2023-05-12T09:03:32.050860
| 2021-06-05T01:54:15
| 2021-06-05T01:54:15
| 373,997,263
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 740
|
h
|
#pragma once
// Name: SoT, Version: 2.1.1
/*!!DEFINE!!*/
/*!!HELPER_DEF!!*/
/*!!HELPER_INC!!*/
#ifdef _MSC_VER
#pragma pack(push, 0x01)
#endif
namespace CG
{
//---------------------------------------------------------------------------
// Classes
//---------------------------------------------------------------------------
// BlueprintGeneratedClass BP_RB_Rank03_RankDesc.BP_RB_Rank03_RankDesc_C
// 0x0000 (FullSize[0x00E0] - InheritedSize[0x00E0])
class UBP_RB_Rank03_RankDesc_C : public URankDesc
{
public:
static UClass* StaticClass()
{
static auto ptr = UObject::FindClass("BlueprintGeneratedClass BP_RB_Rank03_RankDesc.BP_RB_Rank03_RankDesc_C");
return ptr;
}
};
}
#ifdef _MSC_VER
#pragma pack(pop)
#endif
|
[
"Massimo.linker@gmail.com"
] |
Massimo.linker@gmail.com
|
86240172fc5b889d6d1c179f8fec33e8e54abd1d
|
a2111a80faf35749d74a533e123d9da9da108214
|
/raw/workshop11/workshop2011-data-20110925/sources/u35c5glxw45elmls/81/sandbox/my_sandbox/apps/ministellar/ministellar.cpp
|
51a0c8bf286ecbcbd9ac005ebd965f94b7bae669
|
[
"MIT"
] |
permissive
|
bkahlert/seqan-research
|
f2c550d539f511825842a60f6b994c1f0a3934c2
|
21945be863855077eec7cbdb51c3450afcf560a3
|
refs/heads/master
| 2022-12-24T13:05:48.828734
| 2015-07-01T01:56:22
| 2015-07-01T01:56:22
| 21,610,669
| 1
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 5,845
|
cpp
|
#include <seqan/stream.h>
#include <seqan/index.h>
#include <seqan/align.h>
#include <seqan/seeds2.h>
using namespace seqan;
// set parameters
unsigned const minimalLength = 12;
float const errorRate = 0.05;
//unsigned const qGramLength = 8;
CharString const filename = "ministellar.out";
typedef int TScoreValue;
TScoreValue const matchScore = 1;
TScoreValue const mismatchScore = -2;
TScoreValue const gapScore = -2;
TScoreValue const minScore = 9;
TScoreValue const xDrop = 3;
int main(int argc, char const ** argv)
{
if (argc != 3)
{
std::cerr << "ERROR: Invalid argument count!" << std::endl;
std::cerr << "USAGE: ministallar IN1.fa IN2.fa" << std::endl;
return 1;
}
typedef Score<TScoreValue, Simple> TScoreScheme;
TScoreScheme scoring = TScoreScheme(matchScore, mismatchScore, gapScore);
// DONE: Define a scoring scheme 'score' with linear gap costs using the above defined
// score values for scoring matches, mismatches, and gaps.
// HINT: You can find a section on Schoring Schemes in the Alignments tutorial.
// read sequences from fasta files
typedef Dna5String TSequence;
StringSet<CharString> ids1, ids2;
StringSet<TSequence> seqs1, seqs2;
std::ifstream streamIn1(argv[1], std::ios::in | std::ios::binary);
RecordReader<std::ifstream, SinglePass<> > reader1(streamIn1);
if (read2(ids1, seqs1, reader1, Fasta()) != 0)
{
std::cerr << "Could not read file " << argv[1] << std::endl;
return 1;
}
// DONE: Do the same for the second file.
std::ifstream streamIn2(argv[2], std::ios::in | std::ios::binary);
RecordReader<std::ifstream, SinglePass<> > reader2(streamIn2);
if (read2(ids2, seqs2, reader2, Fasta()) != 0)
{
std::cerr << "Could not read file " << argv[2] << std::endl;
return 1;
}
// prepare output file
std::ofstream outFile;
outFile.open(toCString(filename));
// define finder and pattern
// TODO: Define types for finder and pattern using SeqAn's find interface from the index
// module. Both should be specialized for the approproiate swift filter algorithm.
// The pattern will need the definition of a q-gram-index. Use q-grams of length 8
// for now, and open addressing.
// HINT: The tutorial on Pattern Matching describes the find interface. At the end of that
// tutorial page, you will find a link to a Swift HowTo page.
typedef Index<TSequence, IndexQGram<UngappedShape<8> > > TQIndex;
typedef Finder<TSequence, Swift<SwiftLocal> > TFinder;
typedef Pattern<TQIndex, Swift<SwiftLocal> > TPattern;
// TODO: Define variables of your pattern and finder types, and initialize them with the
// first sequences in the sequence sets seqs1 and seqs2.
TQIndex index1 = TQIndex(seqs2[0]);
TPattern pattern = TPattern(index1);
TFinder finder = TFinder(seqs1[0]);
// TODO: Repeat the following steps for all hits of the finder.
//typedef Iterator<TFinder> TFinderIt;
//TFinderIt it = TFinderIt(finder);
// call the function find to obtain a swift hit
// TODO: uncomment the following line
while (find(finder, pattern, errorRate, int(minimalLength))) {
// extract infixes from hit
// TODO: uncomment the following three lines
typedef Infix<TSequence>::Type TInfix;
TInfix fInfix = infix(finder, seqs1[0]);
TInfix pInfix = infix(pattern, seqs2[0]);
// find best local alignment of infixes, and check for minimal score
// TODO: Define an align object and initialize it with the infixes. Find the best local
// alignment of the infixes. Use the above defined scoring scheme. Make sure that
// it reaches the minimal score minScore.
std::cout << fInfix << std::endl;
std::cout << pInfix << std::endl;
typedef Align<TSequence> TAlign;
typedef Row<TAlign> TRow;
TAlign aln = TAlign();
resize(rows(aln), 2);
assignSource(row(aln, 0), fInfix);
assignSource(row(aln, 1), pInfix);
int scr = localAlignment(aln, scoring);
std::cout << aln <<std::endl;
// std::cout << "Score:" << scr <<std::endl;
if (scr < minScore) {
continue;
}
// create a seed for the local alignment, and conduct gapped X-drop extension
// TODO: Define a seed on the original sequences but for the subsequences of the local
// alignment. Extend this seed in both directions using gapped X-drop extension.
// Check that the extended seed has a length of at least minimalLength.
// HINT: Have a look at the Seed-and-Extend tutorial.
typedef Seed<Simple> TSeed;
TSeed seed = TSeed(beginPosition(fInfix) + clippedBeginPosition(row(aln, 0)),
beginPosition(pInfix) + clippedBeginPosition(row(aln, 1)),
beginPosition(fInfix) + clippedEndPosition(row(aln, 0)),
beginPosition(pInfix) + clippedEndPosition(row(aln, 1)));
std::cout << "Seed: " << seed << std::endl;
extendSeed(seed, seqs2[0], seqs1[0], EXTEND_BOTH, scoring, xDrop, GappedXDrop());
std::cout << "Extendeed Seed: " <<seed << std::endl;
// find best global alignment of extended seed
// TODO: Compute the best global alignment of extended seed and its score.
// HINT: Create an align object on infixes of the sequences.
TInfix subseq1 = TInfix(seqs1[0], getBeginDim0(seed), getEndDim0(seed));
TInfix subseq2 = TInfix(seqs2[0], getBeginDim1(seed), getEndDim1(seed));
TAlign gAln;
resize(rows(gAln), 2);
assignSource(row(gAln, 0), subseq1);
assignSource(row(gAln, 1), subseq2);
globalAlignment(gAln, scoring);
outFile << gAln << std::endl;
// TODO: Output the alignment as a match to the output file.
}
outFile.close();
return 0;
}
|
[
"mail@bkahlert.com"
] |
mail@bkahlert.com
|
1b7460b87d8f1a9e4300650b2f0264a8b56ea67b
|
d747c7cedffa13171b2793aa3b3ad2c35f111032
|
/typeconversion.cpp
|
0c41e7c10b5523f65e8ed465e7f1e5bc379b08e2
|
[] |
no_license
|
shubhamguptaji/CPP
|
213556c39f6f2e9d17714cc0768cec293bfa317f
|
2320c4d1e52e1022b678ebe9218babc744a67119
|
refs/heads/master
| 2020-03-08T02:29:13.111784
| 2018-04-03T14:20:05
| 2018-04-03T14:20:05
| 127,861,013
| 3
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 680
|
cpp
|
#include<iostream>
using namespace std;
class Time
{
int hours,mins;
public:
Time()
{hours=0;mins=0;}
Time(int d)
{
hours = d/60;
mins = d%60;
}
Time(int h, int m)
{
hours = h;
mins = m;
}
operator int()
{
return (hours*60 + mins);
}
void show()
{
cout << hours << ":" << mins << endl;
}
};
int main()
{
Time T1;
int duration,h,m;
cout << "Enter Duration: ";
cin >> duration;
cout << "Enter hours and minutes: ";
cin >> h >> m;
Time T2(h,m);
T1 = duration;
T1.show();
duration = T2;
cout << duration << endl;
return 0;
}
|
[
"shubham2604gupta@gmail.com"
] |
shubham2604gupta@gmail.com
|
903303ed04c4ab0ef3a5237627e98086534ee01e
|
ec494526ff8a0105a4ab2738f2cfe9668977680d
|
/BalloonMan/BackGround.cpp
|
19d81b2657c4084aacf17b8c1b8d2848d77e06e5
|
[] |
no_license
|
aoyamashunta/BalloonMan
|
e952cec5f15d31870d4b473805915316592a7d9c
|
46d85f3eee9c396ff866a001a2aa2eb959472070
|
refs/heads/master
| 2023-02-26T15:50:27.387870
| 2021-02-01T01:43:23
| 2021-02-01T01:43:23
| 319,378,049
| 0
| 0
| null | null | null | null |
SHIFT_JIS
|
C++
| false
| false
| 5,504
|
cpp
|
#include "BackGround.h"
#include "stdio.h"
#include <stdlib.h>
#include "DxLib.h"
extern enum blocknum{
NONE,
BLOCK,
PLAYER,
GOAL,
SPINE
};
//extern int WIN_WIDTH; //ウィンドウ横幅
//extern int WIN_HEIGHT; //ウィンドウ縦幅
BackGround::BackGround(const char *mapName) :
mapXSize(32),
mapYSize(32),
mapChipMax(4),
map() {
whiteColor = GetColor(108,103,110);
fname = mapName;
error = false;
if(!MapLoad()) {
//実行しない
error = true;
}
}
bool BackGround::MapLoad() {
char buf[1000], *p, *end;
FILE *fp;
errno_t error;
error = fopen_s(&fp, fname, "r");
if(error != 0) {
return false;
}
else {
for(int i = 0; i < 200; i++) {
if(fgets(buf, sizeof(buf), fp) == NULL) {
break;
}
p = buf;
for(int j = 0; j < 30; j++) {
long num = strtol(p, &end, 10); // 10進数を読み取る
if(p == end) break; // 読み取り終了
if(num < 0 || num > mapChipMax) {
fclose(fp);
return false; // 異常終了
}
map[i][j] = num;
p = end + 1; // ',' をスキップする
}
}
fclose(fp);
}
return true;
}
void BackGround::MapChip() {
//背景
for(int i = 0; i < 480; i++) {
DrawBox(0, i, 960, i + 1,
GetColor(105 + 114 * i / 480, 179 + 57 * i / 480, 255), 1);
}
//map chip
for(int i = 0; i < 30; i++) {
for(int j = 0; j < 200; j++) {
if(map[j][i] == BLOCK) {
DrawBlock(i,j);
}
else if(map[j][i] == GOAL) {
DrawGoal(i,j);
}
else if(map[j][i] == SPINE) {
DrawSpine(i,j);
}
}
}
}
void BackGround::LoadPlayerIni() {
for(int i = 0; i < 30; i++) {
for(int j = 0; j < 200; j++) {
if(map[j][i] == PLAYER) {
playerXIni = i * mapXSize;
playerYIni = j * mapYSize;
}
}
}
}
void BackGround::DrawBlock(int i,int j) {
//内側の塗りつぶし
DrawBox((int)((i + 0.125) * mapXSize),
(int)((j + 0.25) * mapYSize),
(int)((i + 0.875) * mapXSize),
(int)((j + 0.75) * mapYSize),
GetColor(255,255,255),
1);
//下段の雲
DrawOval((int)((i + 0.25) * mapXSize),
(int)((j + 0.8125) * mapYSize),
10,5,
GetColor(255,255,255),1);
DrawOval((int)((i + 0.5) * mapXSize),
(int)((j + 0.8125) * mapYSize),
10,4,
GetColor(255,255,255),1);
DrawOval((int)((i + 0.75) * mapXSize),
(int)((j + 0.8125) * mapYSize),
10,5,
GetColor(255,255,255),1);
//中段の雲
DrawOval((int)((i + 0.25) * mapXSize),
(int)((j + 0.5) * mapYSize),
8,5,
GetColor(255,255,255),1);
DrawOval((int)((i + 0.375) * mapXSize),
(int)((j + 0.5) * mapYSize),
10,4,
GetColor(255,255,255),1);
DrawOval((int)((i + 0.625) * mapXSize),
(int)((j + 0.5) * mapYSize),
10,4,
GetColor(255,255,255),1);
DrawOval((int)((i + 0.75) * mapXSize),
(int)((j + 0.5) * mapYSize),
8,5,
GetColor(255,255,255),1);
//上段の雲
DrawOval((int)((i + 0.75) * mapXSize),
(int)((j + 0.25) * mapYSize),
10,8,
GetColor(255,255,255),1);
DrawCircle((int)((i + 0.375) * mapXSize),
(int)((j + 0.1875) * mapYSize),
6,
GetColor(255,255,255));
}
void BackGround::DrawGoal(int i, int j) {
//goal flagの棒の部分
DrawLine((int)((i + 0.25) * mapXSize),
j * mapYSize,
(int)((i + 0.25) * mapXSize),
(j + 1) * mapYSize,
whiteColor);
//goal flagの旗の部分
DrawTriangle((int)((i + 0.25) * mapXSize),
j * mapYSize,
(int)((i + 0.25) * mapXSize),
(int)((j + 0.5) * mapYSize),
(i + 1) * mapXSize,
(int)((j + 0.25) * mapYSize),
GetColor(255, 0, 0),
1);
}
void BackGround::DrawSpine(int i, int j) {
//中心円
DrawCircle((int)((i + 0.5) * mapXSize),
(int)((j + 0.5) * mapYSize),
mapXSize / 2 - 5,
GetColor(0, 0, 0));
//上三角
DrawTriangle((int)((i + 0.5) * mapXSize),
j * mapYSize,
(int)((i + 0.5) * mapXSize - 2),
j * mapYSize + 4,
(int)((i + 0.5) * mapXSize + 2),
j * mapYSize + 4,
whiteColor, 1);
//右上三角
DrawTriangle((i + 1) * mapXSize,
j * mapYSize,
(int)((i + 0.5) * mapXSize + 2),
j * mapYSize + 4,
(i + 1) * mapXSize - 4,
(int)((j + 0.5) * mapYSize - 2),
whiteColor, 1);
//右三角
DrawTriangle((i + 1) * mapXSize,
(int)((j + 0.5) * mapYSize),
(i + 1) * mapXSize - 4,
(int)((j + 0.5) * mapYSize - 2),
(i + 1) * mapXSize - 4,
(int)((j + 0.5) * mapYSize + 2),
whiteColor, 1);
//右下三角
DrawTriangle((i + 1) * mapXSize,
(j + 1) * mapYSize,
(i + 1) * mapXSize - 4,
(int)((j + 0.5) * mapYSize + 2),
(int)((i + 0.5) * mapXSize + 2),
(j + 1) * mapYSize - 4,
whiteColor, 1);
//下三角
DrawTriangle((int)((i + 0.5) * mapXSize),
(j + 1) * mapYSize,
(int)((i + 0.5) * mapXSize + 2),
(j + 1) * mapYSize - 4,
(int)((i + 0.5) * mapXSize - 2),
(j + 1) * mapYSize - 4,
whiteColor, 1);
//左下三角
DrawTriangle(i * mapXSize,
(j + 1) * mapYSize,
(int)((i + 0.5) * mapXSize - 2),
(j + 1) * mapYSize - 4,
i * mapXSize + 4,
(int)((j + 0.5) * mapYSize + 2),
whiteColor, 1);
//左三角
DrawTriangle(i * mapXSize,
(int)((j + 0.5) * mapYSize),
i * mapXSize + 4,
(int)((j + 0.5) * mapYSize + 2),
i * mapXSize + 4,
(int)((j + 0.5) * mapYSize - 2),
whiteColor, 1);
//左上三角
DrawTriangle(i * mapXSize,
j * mapYSize,
(int)((i + 0.5) * mapXSize - 2),
j * mapYSize + 4,
i * mapXSize + 4,
(int)((j + 0.5) * mapYSize - 2),
whiteColor, 1);
}
|
[
"k020g1114@g.neec.ac.jp"
] |
k020g1114@g.neec.ac.jp
|
606357bca476d618cff122bf9f46a34655c863ee
|
5f2e1907411cf1f417bb7325395dcfdee199d1d9
|
/src/Pos.h
|
382bc01aa3e523e7a3eed4e26e282f10982ddb30
|
[
"Zlib",
"LicenseRef-scancode-warranty-disclaimer"
] |
permissive
|
anthemEdge/Sudoku-Solver
|
33c2884515f3212aed64c3269557be1d37c98838
|
800796247175d0463ebffef40f8a2271722ac03c
|
refs/heads/master
| 2020-05-17T14:48:25.935610
| 2015-07-18T22:09:59
| 2015-07-18T22:09:59
| 39,303,112
| 2
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 241
|
h
|
/*
* Pos.h
*
* Created on: 14 Jul 2015
* Author: eva
*/
#ifndef POS_H_
#define POS_H_
#include <sstream>
using namespace std;
struct Pos {
int row;
int col;
Pos(int row, int col);
string toString();
};
#endif /* POS_H_ */
|
[
"d.mx.gibbs@gmail.com"
] |
d.mx.gibbs@gmail.com
|
a3def3f90d29cbfb67ff728a88872e123b1ed3bd
|
50402cc4388dfee3a9dbe9e121ef217759ebdba8
|
/CSProj/cs236/proj4/src/Fact.h
|
dc744a7e917d386cc2c0563656c9b734a6c35fb8
|
[] |
no_license
|
dqyi11/SVNBackup
|
bd46a69ec55e3a4f981a9bca4c8340944d8d5886
|
9ad38e38453ef8539011cf4d9a9c0a363e668759
|
refs/heads/master
| 2020-03-26T12:15:01.155873
| 2015-12-10T01:11:36
| 2015-12-10T01:11:36
| 144,883,382
| 2
| 1
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 416
|
h
|
/*
* Fact.h
*
* Created on: Feb 5, 2013
* Author: kyle
*/
#ifndef FACT_H_
#define FACT_H_
#include <vector>
#include <string>
#include <sstream>
#include "Lex.h"
#include "Domain.h"
class Fact {
friend class Relation;
friend class Database;
public:
Fact(Lex* lex, Domain* domain);
~Fact();
string toString();
protected:
string identifier;
vector<string> identifierList;
};
#endif /* FACT_H_ */
|
[
"walter@e224401c-0ce2-47f2-81f6-2da1fe30fd39"
] |
walter@e224401c-0ce2-47f2-81f6-2da1fe30fd39
|
58943f73cdd239a2fd7ae754c21c2a678c425c9a
|
ee6d19e7976f4c07b17004d326a4e1be4306990c
|
/codechef/contests/2021/august/algomaniac/old_saint.cpp
|
027ce0f9cc8c88d9dd2b5dcc4d0d0c3ce07fd1f1
|
[] |
no_license
|
samahuja642/competitive-programming
|
b37eab547ac59ba6f4cdd9f4173fbfac9b46e292
|
031a7d38db557b4b6058af5d5e246543821011b5
|
refs/heads/main
| 2023-09-03T08:14:09.558871
| 2021-10-20T17:55:29
| 2021-10-20T17:55:29
| 350,995,005
| 0
| 1
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 451
|
cpp
|
#include<iostream>
using namespace std;
int main(){
ios_base::sync_with_stdio(false);
cin.tie();
cout.tie();
int t;
cin>>t;
while(t--){
int a[3],b[3];
int ans1=0,hero1=0;
for(int i=0;i<3;i++){cin>>a[i];if(a[i]==1)ans1++;}
for(int i=0;i<3;i++){cin>>b[i];if(b[i]==1)hero1++;}
if(hero1==ans1){
cout<<"Pass"<<endl;
}
else cout<<"Fail"<<endl;
}
return 0;
}
|
[
"samahuja642@gmail.com"
] |
samahuja642@gmail.com
|
5901a93f85f931f9cbd60cc14ec66d9494477f3f
|
646748c063c3b4e8538db6e89d9e13461ce4396b
|
/CCPanel.cpp
|
dee87b5d6674b9244048d8797d0eba006142b33c
|
[] |
no_license
|
kdar/ccrack
|
8c57c38a6729be43ddea2f8a450ada581fb3a7ad
|
bbd237922eccde8d298860e1ce6c0ff6df52ef39
|
refs/heads/master
| 2016-09-01T17:38:42.371987
| 2009-12-19T08:59:31
| 2009-12-19T08:59:31
| 442,634
| 1
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 5,075
|
cpp
|
/////////////////////////////////////////////////////////////////////////////
// Name: CCPanel.cpp
// Purpose:
// Author: crenix
// Modified by:
// Created: 12/30/03 15:40:49
// RCS-ID:
// Copyright:
// Licence:
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "CCPanel.cpp"
#endif
// For compilers that support precompilation, includes "wx/wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
////@begin includes
#include "wx/wx.h"
#include "wx/listctrl.h"
#include "wx/statline.h"
////@end includes
#include "CCPanel.h"
////@begin XPM images
////@end XPM images
/*!
* CCPanel type definition
*/
IMPLEMENT_CLASS( CCPanel, wxPanel )
/*!
* CCPanel event table definition
*/
BEGIN_EVENT_TABLE( CCPanel, wxPanel )
////@begin CCPanel event table entries
////@end CCPanel event table entries
END_EVENT_TABLE()
/*!
* CCPanel constructors
*/
CCPanel::CCPanel( )
{
}
CCPanel::CCPanel( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style )
{
Create(parent, id, pos, size, style);
}
/*!
* CCPanel creator
*/
bool CCPanel::Create( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style )
{
////@begin CCPanel member initialisation
////@end CCPanel member initialisation
////@begin CCPanel creation
wxPanel::Create( parent, id, pos, size, style );
CreateControls();
GetSizer()->Fit(this);
GetSizer()->SetSizeHints(this);
Centre();
////@end CCPanel creation
return TRUE;
}
/*!
* Control creation for CCPanel
*/
void CCPanel::CreateControls()
{
////@begin CCPanel content construction
CCPanel* item1 = this;
wxBoxSizer* item2 = new wxBoxSizer(wxVERTICAL);
item1->SetSizer(item2);
item1->SetAutoLayout(TRUE);
wxBoxSizer* item3 = new wxBoxSizer(wxHORIZONTAL);
item2->Add(item3, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 3);
wxListCtrl* item4 = new wxListCtrl( item1, ID_ListCracks, wxDefaultPosition, wxSize(150, 100), wxLC_REPORT|wxLC_SINGLE_SEL|wxLC_HRULES|wxSIMPLE_BORDER );
item3->Add(item4, 0, wxALIGN_CENTER_VERTICAL|wxALL, 0);
item3->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 1);
wxBoxSizer* item6 = new wxBoxSizer(wxVERTICAL);
item3->Add(item6, 0, wxALIGN_TOP|wxALL, 0);
wxBoxSizer* item7 = new wxBoxSizer(wxHORIZONTAL);
item6->Add(item7, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 0);
wxTextCtrl* item8 = new wxTextCtrl( item1, ID_TextPath, _T(""), wxDefaultPosition, wxSize(200, 20), wxTE_READONLY|wxSIMPLE_BORDER );
item8->SetHelpText(_("Path to the software executable."));
if (ShowToolTips())
item8->SetToolTip(_("Path to the software executable."));
item7->Add(item8, 0, wxALIGN_CENTER_VERTICAL|wxALL, 0);
item7->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 1);
wxButton* item10 = new wxButton( item1, ID_ButtonBrowse, _("Browse..."), wxDefaultPosition, wxSize(-1, 20), 0 );
item10->SetHelpText(_("Find the program to crack..."));
if (ShowToolTips())
item10->SetToolTip(_("Find the program to crack..."));
item7->Add(item10, 0, wxALIGN_CENTER_VERTICAL|wxALL, 0);
wxStaticLine* item11 = new wxStaticLine( item1, wxID_STATIC, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
item6->Add(item11, 0, wxGROW|wxALL, 5);
wxBoxSizer* item12 = new wxBoxSizer(wxHORIZONTAL);
item6->Add(item12, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 0);
wxButton* item13 = new wxButton( item1, ID_ButtonCrack, _("Crack"), wxDefaultPosition, wxSize(-1, 20), 0 );
item13->SetHelpText(_("Crack the above program."));
if (ShowToolTips())
item13->SetToolTip(_("Crack the above program."));
item12->Add(item13, 0, wxALIGN_CENTER_VERTICAL|wxALL, 0);
item12->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 1);
wxButton* item15 = new wxButton( item1, ID_ButtonHelp, _("?"), wxDefaultPosition, wxSize(15, 20), 0 );
item15->SetHelpText(_("View the about."));
if (ShowToolTips())
item15->SetToolTip(_("View the about."));
item12->Add(item15, 0, wxALIGN_CENTER_VERTICAL|wxALL, 0);
item12->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 1);
wxButton* item17 = new wxButton( item1, ID_ButtonExit, _("Exit"), wxDefaultPosition, wxSize(-1, 20), 0 );
item17->SetHelpText(_("Exit the program."));
if (ShowToolTips())
item17->SetToolTip(_("Exit the program."));
item12->Add(item17, 0, wxALIGN_CENTER_VERTICAL|wxALL, 0);
item6->Add(0, 27, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 0);
wxBoxSizer* item19 = new wxBoxSizer(wxHORIZONTAL);
item6->Add(item19, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 0);
wxGauge* item20 = new wxGauge( item1, ID_Gauge, 100, wxDefaultPosition, wxSize(250, 20), wxGA_HORIZONTAL|wxGA_PROGRESSBAR|wxGA_SMOOTH|wxSIMPLE_BORDER );
item20->SetValue(0);
item19->Add(item20, 0, wxALIGN_CENTER_VERTICAL|wxALL, 0);
////@end CCPanel content construction
}
/*!
* Should we show tooltips?
*/
bool CCPanel::ShowToolTips()
{
return TRUE;
}
|
[
"kdarlington@rxmanagement.net"
] |
kdarlington@rxmanagement.net
|
57eb5a76eae0f7ea9db352f097046b6eeb6a62a1
|
83b0434238f6aac2a37cd7ae10df270636f63618
|
/lab6/lab6v13.cpp
|
0d74af09f6133dd1adc67d598b609047611a521c
|
[] |
no_license
|
hickeym2/object-oriented-programming
|
0a0a5ef13f3653e94e7a152b00ab2783e97a8c15
|
085367b4dd550c41e0375dda5740936e61d2a610
|
refs/heads/master
| 2020-03-25T09:14:07.574806
| 2018-08-05T23:36:43
| 2018-08-05T23:36:43
| 143,655,309
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 16,432
|
cpp
|
/*
* Mike Hickey
* Professor Carpenter
* Lab 6 Linked List
* Due Date 10/21/16
*/
#include <iostream>
#include <cstdlib>
#include <string>
#include <fstream>
#include <sstream>
using namespace std;
//=== Struct ===
struct entry_qb{
string firstName;
string lastName;
string entryName;
int arrayYear[4];
int yearWon;
int numWins;
int wins;// not used
int yesHead;//not used
entry_qb *next; //points to the next struct in the list
entry_qb *prev; //points to the previous struct in the list
};
entry_qb *list = NULL;
//=== Function Prototype ===
void menu(int &menuSel);
void clearScreen();
void exitProgram();
void testPrint(int menuSel);
void makeEntry(entry_qb *list);//case 1
int readList(entry_qb *list, entry_qb *head);//case 2
void searchNameYearNum(entry_qb *list, entry_qb *head);//case 3
void deleteEntry(entry_qb *list, entry_qb *head);//case 5
void deleteList(entry_qb *&list, entry_qb *head);//case 6
void populateList(entry_qb *&list, entry_qb *&head);//case 7
entry_qb *search(entry_qb *list, entry_qb *head, string fName, string lName, int yrWon);
int main(){
int menuSel = 0;
clearScreen();
entry_qb *head = NULL;
//initially the first time you run the program, you want a list to be there.
populateList(list, head);
menu(menuSel);
do{ /* Just because you don't like do-while. */
switch (menuSel){
case 1: makeEntry(list);
cout << endl;
menu(menuSel);
break;
//case 1 add an entry.
case 2: readList(list, head);
cout << endl;
menu(menuSel);
break;
//case 2 read full list to screen
case 3: searchNameYearNum(list, head);
cout << endl << endl;
menu(menuSel);
break;
//case 3 search for year, name, or number
case 4:
cout << endl << endl;
menu(menuSel);
break;
//case 4 sort alphabetically
case 5: deleteEntry(list, head);
cout << endl << endl;
menu(menuSel);
break;
//case 5 delete an entry
case 6: deleteList(list, head);
cout << endl;
menu(menuSel);
break;
//case 6 remove all entries
case 7: populateList(list, head);
cout << "The list has been reset." << endl << endl;
menu(menuSel);
break;
//case 7 reset list to original
default:cout << "Exiting Program. . . " << endl;
return 0;
break;
//default will exit the program.
}//end of switch(menuSel)
}while(menuSel != 0);//end of do-while loop
}//End of main
void menu(int &menuSel){
cout << "Select 1 to add an entry to the list.\nSelect 2 to read the list.\nSelect 3 to search for a year, name, or number.\nSelect 4 to sort the list in alphabetical order.\nSelect 5 to delete an entry.\nSelect 6 to remove all entries.\nSelect 7 to reset the list.\nSelect 8 to exit the program.\nSelecting: ";
cin >> menuSel;
}//end of menu()
void clearScreen(){
for (int i = 0; i < 50; i++){
cout << endl;
}
}//end of clearScreen()
void exitProgram(){
cout << "Exiting Program. . ." << endl;
exit(0);
}//end of exitProgram()
void testPrint(int menuSel){
cout << "Testing. . . " << endl << "menuSel = " << menuSel << endl;
}//end of testPrint()
void populateList(entry_qb *&list, entry_qb *&head){
string line, fName, lName;
int yrWon = 0;
static int checkRan = 0;
//entry_qb head;//maybe make head a pointer
list = NULL;
//You will be inside the file qbList.txt referened to as infile.
ifstream infile;
infile.open("qbListv2.txt");
//Can you open the file? This will check if it's there or corrupted.
if (infile.fail()){
cerr << "Error Opening File." << endl << "File not found, HTTP 404." << endl;
exit(1);
}
entry_qb *temp;
//Nothing is wrong with qbListv2.txt
while(infile >> fName >> lName >> yrWon){
//While there is a line get it.
if(list == NULL){
//This is making the head struct as the first entry from reading the qbListv2.txt
head = new entry_qb;
head -> firstName = fName;
head -> lastName = lName;
//iniializing the arrayYear to 0 and what the file said.
head -> arrayYear[0] = yrWon;
head -> arrayYear[1] = 0;
head -> arrayYear[2] = 0;
head -> arrayYear[3] = 0;
head -> next = head;
head -> prev = head;
head -> numWins = 1;
list = head;
//list is a pointer, and its now storing the address of head in it. so its pointing to head.
//Seriously list and head are the same thing so its redundant.
//already making a temp pointer to set up the rest of the list.
temp = head;
}else{
//Now dynamically create entry_qb and store the lines in it. Only if the person was not created before.
entry_qb *return_qb;//this equals NULL at the start of search() funciton.
return_qb = search(list, head, fName, lName, yrWon);
if(return_qb){
return_qb -> numWins = (return_qb -> numWins) + 1;
return_qb -> arrayYear[return_qb -> numWins -1] = yrWon;
//because array starts at 0, and everyone initially has a numWin value of 1.
temp = head -> prev;// so you can start at the end of the "tail"
}else{
temp -> next = new entry_qb;
temp -> next -> firstName = fName;
temp -> next -> lastName = lName;
temp -> next -> yearWon = yrWon;
//initializing my arrayYear to store yrWon
temp -> next -> arrayYear[0] = yrWon;
temp -> next -> arrayYear[1] = 0;
temp -> next -> arrayYear[2] = 0;
temp -> next -> arrayYear[3] = 0;
temp -> next -> next = head;
temp -> next -> prev = temp;
temp -> next -> numWins = 1;
temp = temp -> next;
head -> prev = temp;
}//end of else where if asks if a qb was found
}//end of else statement
}//end of while loop
cout << endl;
}//end of populateList()
void deleteList(entry_qb *&list, entry_qb *head){
//not really deleting the list, its just orphaning the list.
//so loop backwards and do a delete entry function from if head and while temp != head
int ran = 0;
for(entry_qb *temp = head; temp != head -> prev; temp = temp -> next){
if(ran == 0){
entry_qb *holder1 = head -> prev;
entry_qb *holder2 = head -> next;
head -> prev -> next = holder2;
head -> next -> prev = holder1;
ran = 1;
temp = temp -> prev;//this is so it prints out trentDilfer2001
delete head;
}else{
entry_qb *holder1 = temp -> prev;
entry_qb *holder2 = temp -> next;
temp -> prev -> next = holder2;
temp -> next -> prev = holder1;
delete temp;
}
list = NULL;
}//end of for loop
cout << endl << "The list has been deleted." << endl;
}//end of deleteList()
void deleteEntry(entry_qb *list, entry_qb *head){
string delFirstName;
string delLastName;
entry_qb *temp;
int check = 0;
cout << endl;
if(list == NULL){
cout << "There is no list, so you can not delete an entry." << endl;
}else{
cout << "Enter the first name of the QB that you want to delete." << endl;
cout << "First Name: ";
cin >> delFirstName;
cout << "Enter the last name of the QB that you want to delete." << endl;
cout << "Last Name: ";
cin >> delLastName;
if(!(head -> firstName.compare(delFirstName)) && !(head -> lastName.compare(delLastName))){
entry_qb *holder1 = head -> prev;
entry_qb *holder2 = head -> next;
head -> prev -> next = holder2;
head -> next -> prev = holder1;
delete head;
check = 1;
cout << endl << delFirstName << " " << delLastName << " was deleted.";
}//end of if statement
temp = head -> next;
while(temp != head){
if(!(temp -> firstName.compare(delFirstName)) && !(temp -> lastName.compare(delLastName))){
entry_qb *holder1 = temp -> prev;
entry_qb *holder2 = temp -> next;
temp -> prev -> next = holder2;
temp -> next -> prev = holder1;
delete temp;
check = 1;
cout << endl << delFirstName << " " << delLastName << " was deleted.";
}
temp = temp -> next;
}//end of while
}//end of if else list = null
if(check == 0){
cout << "No QB of " << delFirstName << " " << delLastName << " was found in the list.";
}
}//end of deleteEntry()
int readList(entry_qb *list, entry_qb *head){
if(list == NULL){
cout << endl << "No available list." << endl;
}else{
int ran = 0;
for(entry_qb *temp = head; temp != head -> prev; temp = temp -> next){
if(ran == 0){
cout << endl;
cout << head -> firstName << " ";
cout << head -> lastName << " ";
for(int i = 0; i != head -> numWins; i++){
cout << (head -> arrayYear[i]);
cout << " ";
}
cout << endl;
ran = 1;
temp = temp -> prev;//this is so it prints out trentDilfer2001
}else{
cout << temp -> next -> firstName << " ";
cout << temp -> next -> lastName << " ";
for(int i = 0; i != temp -> next -> numWins; i++){
cout << (temp -> next -> arrayYear[i]);
cout << " ";
}//end of for loop
cout << endl;
}//end of if else
}//end of for loop
}//end of if else
}//end of readList()
//How do i ask if a previous entry of the same name was made?
entry_qb *search(entry_qb *list, entry_qb *head, string fName, string lName, int yrWon){
entry_qb *return_qb;
return_qb = NULL;
entry_qb *temp;
//hey this is a specific check just for head since you cant really
//start a loop at head and end at head since it a circle.
if(!(head -> firstName.compare(fName)) && !(head -> lastName.compare(lName))){
//bryon helped me with the .compare because you can not do == for string.
//he showed my why you use this to compare strings and need the !
//This is why i am in comp sci 1
return_qb = temp;
return return_qb;//returns head if it was found.
}//end of if statement to check for head.
temp = head -> next;
//This temp = head -> next is here so the while loop will start checking
//at the second position of the list.
while (temp != head){
//Heyyy this entry you just made, does it match a name of a previous entry?
//if it does match an entry, return that qb inside return_qb
//hey does temp -> lastName have any differences from lName? if yes, return 1.
//in our situation, there are no differences in the strings so the compare results in a 0
//then we do the NOT of 0 and get a 1.
if(!(temp -> firstName.compare(fName)) && !(temp -> lastName.compare(lName))){
return_qb = temp;
return return_qb;//returns the entry that matched to populate list.
}
temp = temp -> next;
}//end of while loop
return return_qb;//returns NULL
}//end of checkDuplicate()
void makeEntry(entry_qb *list){
string entFirstName;
string entLastName;
int entYearWon;
entry_qb *temp;
entry_qb *head = list;
//First gather the info to input.
cout << "Enter the first name of the QB you would like to enter to the list." << endl;
cout << "First Name: ";
cin >> entFirstName;
cout << "Enter the last name of thr QB you would like to enter to the list." << endl;
cout << "Last Name: ";
cin >> entLastName;
cout << "Enter the year the QB won the super bowl." << endl;
cout << "Year Won: ";
cin >> entYearWon;
if(list == NULL){
//this will make the head if there is no head.
//Now fill the struct with your input.
head = new entry_qb;
head -> firstName = entFirstName;
head -> lastName = entLastName;
head -> arrayYear[0] = entYearWon;
head -> next = head;
head -> prev = head;
head -> numWins = 1;
list = head;
temp = head;//starting the list at the head.
}else{
//Now dynamically create entry_qb and store the lines in it. Only if the person was not created before.
entry_qb *return_qb = NULL;//this equals NULL at the start of search() funciton.
return_qb = search(list, head, entFirstName, entLastName, entYearWon);
//we are changing the arguments in this function to be different from the prototype.
//if(return_qb) == NULL skip the if statement code block
if(return_qb){
return_qb -> numWins = (return_qb -> numWins) + 1;
return_qb -> arrayYear[return_qb -> numWins -1] = entYearWon;
//because array starts at 0, and everyone initially has a numWin value of 1.
temp = head -> prev;// so you can start at the end of the "tail"
}else{
//if the list is not null lets add on an entry.
temp = head -> prev;
temp -> next = new entry_qb;
temp -> firstName = entFirstName;
temp -> lastName = entLastName;
temp -> yearWon = entYearWon;
temp -> arrayYear[0] = entYearWon;
temp -> next -> next = head;
temp -> next -> prev = temp;
temp -> numWins = 1;
//this says
//temp = head
//head ->prev = head;
//temp = temp -> next;//pushes temp to the next entry_qb, which is head
head -> prev = temp -> next;//links head to the tail
}//end of if else
}//end of if else to make new entries
cout << endl;
cout << entFirstName << " " << entLastName << " " << entYearWon << " has been added to the list." << endl;
cout << endl;
}//end of makeEntry()
void searchNameYearNum(entry_qb *list, entry_qb *head){
int menuSel = 0;
string fName, lName;
int yrWon;
bool menuLoop = 1;
if(list == NULL){
cout << endl << "No available list, you should reset the list or add an entry.";
}else{
cout << endl;
cout << "Select 1 to search for a QB's name." << endl;
cout << "Select 2 to seach for a QB by year." << endl;
cout << "Select 3 to search for a QB by number of wins." << endl;
cout << "Selecting: ";
cin >> menuSel;
cout << endl;
while(menuLoop){
if(menuSel == 1){
//Search for a name.
cout << "Enter the QB's first name." << endl << "First Name: ";
cin >> fName;
cout << "Enter the QB's last name." << endl << "Last Name: ";
cin >> lName;
cout << endl;
//making return_qb so I can store the output of the function.
entry_qb *return_qb;
//the 1 in the function search is here so i can just pass 1, its not used, but the parameters are there so i can search by year won later.
return_qb = search(list, head, fName, lName, 1);
if(return_qb){
cout << fName << " " << lName << " " << "was found in the list.";
}else{
cout << "No QB of name " << fName << " " << lName << " exists in the list.";
}
menuLoop = 0;
}else if(menuSel == 2){
//search for a year
cout << "Enter the year you would like to search for." << endl << "Year: ";
cin >> yrWon;
entry_qb *return_qb;
return_qb = NULL;
entry_qb *temp;
if(head -> arrayYear[0] == yrWon || head -> arrayYear[1] == yrWon || head -> arrayYear[2] == yrWon || head -> arrayYear[3] == yrWon){
return_qb = temp;
}//end of if statement to check for head.
temp = head -> next;
while (temp != head){
if(temp -> arrayYear[0] == yrWon || temp -> arrayYear[1] == yrWon || temp -> arrayYear[2] == yrWon || temp -> arrayYear[3] == yrWon){
return_qb = temp;
}
temp = temp -> next;
}//end of while loop
//return_qb will be NULL here if nothing is found
if(return_qb){
cout << endl << return_qb -> firstName << " " << return_qb -> lastName << " won the super bowl in " << yrWon << ".";
}else{
cout << endl << "No QB in the list has won in the year " << yrWon << ".";
}
menuLoop = 0;
}else if(menuSel == 3){
//search by number of wins.
int wins = 0;
entry_qb *return_qb = NULL;
entry_qb *temp;
cout << "Enter the number of times that a QB might have won the super bowl." << endl << "Number of Wins: ";
cin >> wins;
cout << endl;
if(head -> numWins >= wins){
return_qb = temp;
cout << head -> firstName << " " << head -> lastName << endl;
}
temp = head -> next;
while (temp != head){
if(temp -> numWins >= wins){
return_qb = temp;
cout << temp -> firstName << " " << temp -> lastName << endl;
}
temp = temp -> next;
}//end of while loop
if(return_qb){
if(wins == 1){
cout << endl << "These QBs were found in the list with at least " << wins << " win.";
}else{
cout << endl << "These QBs were found in the list with at least " << wins << " wins.";
}
}else{
if(wins == 1){
cout << "No QBs were found in the list with at least " << wins << " win." << endl;
cout << "Because the list is empty";
}else{
cout << "No QBs were found in the list with at least " << wins << " wins.";
}
}
menuLoop = 0;
}else{
cout << endl << "You did not select an option." << endl << "Selecting: ";
cin >> menuSel;
menuLoop = 1;
}
}//end of while loop
}//end of big if else where if(list == NULL)
}//end of searchNameYearNum()
|
[
"mikehickey95@gmail.com"
] |
mikehickey95@gmail.com
|
3acb5a1c581effcf1184f5ece261eeb8adf3d360
|
91e885f46cb5d8add4c3ea101747311e4afafc0a
|
/practice/revesre.cpp
|
ef816dbe177822ddeba95044b381a9809ac5b54b
|
[] |
no_license
|
CoderMayhem/namanDoesCP
|
25d4cef7b39d26483ec70dd5c8bb0c97325ba652
|
88c904091a5b72ec0339f1708ac2f920d18b6fbc
|
refs/heads/master
| 2023-05-10T12:49:53.911330
| 2021-06-03T20:48:19
| 2021-06-03T20:48:19
| 363,678,652
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 226
|
cpp
|
#include<iostream>
using namespace std;
int main(){
int n;
cin>>n;
int reverse = 0;
while(n>0){
int last = n%10;
reverse = reverse*10 + last;
n=n/10;
}
cout<<reverse<<endl;
}
|
[
"namanmishra1900@gmail.com"
] |
namanmishra1900@gmail.com
|
7d15297eb55b0dbcacf1287f5c01c813b087731d
|
950161afb4cbe035579af74aa69a206e543697da
|
/parser/pglang_parser__token.hpp
|
cecd6402f8d6d5ecdf36744e0112abbe9dd78cd9
|
[] |
no_license
|
mugisaku/pglang
|
31120a683cce8c9bca2c9271aa659a1a96269c1a
|
afdbd2c6e7f10bc2e16302d04fe9a26d33496b8e
|
refs/heads/master
| 2021-01-12T07:49:04.379042
| 2017-02-01T03:49:08
| 2017-02-01T03:49:08
| 77,029,725
| 1
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,578
|
hpp
|
#ifndef PGLANG_PARSER__TOKEN_HPP_INCLUDED
#define PGLANG_PARSER__TOKEN_HPP_INCLUDED
#include<cstddef>
#include<string>
#include"pglang_expr__operator.hpp"
#include"pglang_parser__block.hpp"
#include"pglang_parser__cursor.hpp"
#ifndef report
#define report printf("[report in %s] %d %s\n",__FILE__,__LINE__,__func__);
#endif
namespace pglang{
namespace parser{
enum class
TokenKind
{
null,
tab,
newline,
space,
semicolon,
character,
u8character,
u16character,
u32character,
string,
u8string,
u16string,
u32string,
identifier,
operator_,
integer,
floating_point_number,
block,
unknown,
};
union
TokenData
{
uint64_t i;
double f;
Block block;
std::string string;
Operator operator_;
TokenData(){}
~TokenData(){}
};
class
Token
{
TokenKind kind;
TokenData data;
Cursor cursor;
public:
Token(TokenKind k=TokenKind::null);
Token(uint64_t i, TokenKind k);
Token(std::string&& s, TokenKind k);
Token(double f);
Token(Block&& blk);
Token(Operator&& op);
Token( Token&& rhs) noexcept;
Token(const Token& rhs) noexcept;
~Token( );
Token& operator=( Token&& rhs) noexcept;
Token& operator=(const Token& rhs) noexcept;
const TokenData& operator*() const;
const TokenData* operator->() const;
bool operator==(TokenKind k) const;
operator bool() const;
void clear();
void set_cursor(const Cursor& cur);
const Cursor& get_cursor() const;
void print(int indent) const;
};
}}
#endif
|
[
"lentilspring@gmail.com"
] |
lentilspring@gmail.com
|
3b70f835c6f211fa298b823a533e3f3c9c6e3651
|
9c7584da436d9f44c966abe28105644aece6931c
|
/p3865.cpp
|
2bb5074f9c766a7cb7cde86f3d29fe598efe3792
|
[] |
no_license
|
Leo-Ngok/UVa_solutions
|
c6b703c910fcc5e534b576394b8522a89701f642
|
c890ef4f33b66cff348c29eb2ca130edbc7417a8
|
refs/heads/master
| 2022-01-19T22:27:18.048148
| 2022-01-04T15:54:12
| 2022-01-04T15:54:12
| 202,375,424
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 562
|
cpp
|
//p3865
#include <cstdio>
#include <algorithm>
#include <math.h>
using namespace std;
int st[20][100010],n,m,l,r;
int main(){
scanf("%d%d",&n,&m);
for(int i=1;i<=n;i++)
scanf("%d",&st[0][i]);
int h=log(n)/log(2);
for(int i=1;i<=h;i++)
for(int j=1;j<=n-(1<<i)+1;j++)
st[i][j]=max(st[i-1][j],st[i-1][j+(1<<(i-1))]);
#ifdef DEBUG
for(int i=1;i<=h;i++){
for(int j=1;j<=n;j++)printf("%d ",st[i][j]);
printf("\n");
}
#endif
while(m--){
scanf("%d%d",&l,&r);
int p=log(r-l+1)/log(2);
printf("%d\n",max(st[p][l],st[p][r-(1<<p)+1]));
}
return 0;
}
|
[
"z1023825@outlook.com"
] |
z1023825@outlook.com
|
aee2739037e9ac4aada0defb65a7c70777c096bf
|
c43b0d1e041d004d1fa8e1469f57b62d4d4bea88
|
/zircon/system/ulib/blobfs/write-txn.cc
|
c6270845915c4f0dfae52b9fe23b4f859f342e9a
|
[
"BSD-3-Clause",
"MIT"
] |
permissive
|
ZVNexus/fuchsia
|
75122894e09c79f26af828d6132202796febf3f3
|
c5610ad15208208c98693618a79c705af935270c
|
refs/heads/master
| 2023-01-12T10:48:06.597690
| 2019-07-04T05:09:11
| 2019-07-04T05:09:11
| 195,169,207
| 0
| 0
|
BSD-3-Clause
| 2023-01-05T20:35:36
| 2019-07-04T04:34:33
|
C++
|
UTF-8
|
C++
| false
| false
| 3,782
|
cc
|
// Copyright 2017 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <blobfs/metrics.h>
#include <blobfs/write-txn.h>
namespace blobfs {
WriteTxn::~WriteTxn() {
ZX_DEBUG_ASSERT_MSG(operations_.is_empty(), "WriteTxn still has pending operations");
}
void WriteTxn::Enqueue(const zx::vmo& vmo, uint64_t relative_block, uint64_t absolute_block,
uint64_t nblocks) {
ZX_DEBUG_ASSERT(vmo.is_valid());
ZX_DEBUG_ASSERT(!IsBuffered());
for (auto& operation : operations_) {
if (operation.vmo->get() != vmo.get()) {
continue;
}
if (operation.op.vmo_offset == relative_block) {
// Take the longer of the operations (if operating on the same blocks).
if (nblocks > operation.op.length) {
block_count_ += (nblocks - operation.op.length);
operation.op.length = nblocks;
}
return;
} else if ((operation.op.vmo_offset + operation.op.length == relative_block) &&
(operation.op.dev_offset + operation.op.length == absolute_block)) {
// Combine with the previous operation, if immediately following.
operation.op.length += nblocks;
block_count_ += nblocks;
return;
}
}
UnbufferedOperation operation;
operation.vmo = zx::unowned_vmo(vmo.get());
operation.op.type = OperationType::kWrite;
operation.op.vmo_offset = relative_block;
operation.op.dev_offset = absolute_block;
operation.op.length = nblocks;
operations_.push_back(std::move(operation));
block_count_ += operation.op.length;
}
size_t WriteTxn::BlkStart() const {
ZX_DEBUG_ASSERT(IsBuffered());
ZX_DEBUG_ASSERT(operations_.size() > 0);
return operations_[0].op.vmo_offset;
}
size_t WriteTxn::BlkCount() const {
return block_count_;
}
void WriteTxn::SetBuffer(vmoid_t vmoid) {
ZX_DEBUG_ASSERT(vmoid_ == VMOID_INVALID || vmoid_ == vmoid);
ZX_DEBUG_ASSERT(vmoid != VMOID_INVALID);
vmoid_ = vmoid;
}
zx_status_t WriteTxn::Flush() {
ZX_ASSERT(IsBuffered());
fs::Ticker ticker(transaction_manager_->Metrics().Collecting());
// Update all the outgoing transactions to be in disk blocks
block_fifo_request_t blk_reqs[operations_.size()];
const uint32_t kDiskBlocksPerBlobfsBlock =
kBlobfsBlockSize / transaction_manager_->DeviceBlockSize();
for (size_t i = 0; i < operations_.size(); i++) {
blk_reqs[i].group = transaction_manager_->BlockGroupID();
blk_reqs[i].vmoid = vmoid_;
blk_reqs[i].opcode = BLOCKIO_WRITE;
blk_reqs[i].vmo_offset = operations_[i].op.vmo_offset * kDiskBlocksPerBlobfsBlock;
blk_reqs[i].dev_offset = operations_[i].op.dev_offset * kDiskBlocksPerBlobfsBlock;
uint64_t length = operations_[i].op.length * kDiskBlocksPerBlobfsBlock;
// TODO(ZX-2253): Requests this long, although unlikely, should be
// handled more gracefully.
ZX_ASSERT_MSG(length < UINT32_MAX, "Request size too large");
blk_reqs[i].length = static_cast<uint32_t>(length);
}
// Actually send the operations to the underlying block device.
zx_status_t status = transaction_manager_->Transaction(blk_reqs, operations_.size());
if (transaction_manager_->Metrics().Collecting()) {
uint64_t sum = 0;
for (const auto& blk_req : blk_reqs) {
sum += blk_req.length * kBlobfsBlockSize;
}
transaction_manager_->Metrics().UpdateWriteback(sum, ticker.End());
}
operations_.reset();
vmoid_ = VMOID_INVALID;
block_count_ = 0;
return status;
}
} // namespace blobfs
|
[
"commit-bot@chromium.org"
] |
commit-bot@chromium.org
|
72d452631b02bf13b01ec166d9d04f24f9d62b13
|
65b074479e44c95ad179b09ebb4383e62f19c259
|
/Implementation/Core.Android/GLContext.h
|
29858ea2b71a57e78b6055756a7faa5a8105bede
|
[] |
no_license
|
YevhenRezohlazov/Mogren
|
fcd622a0df39fd47074696462be69a14c3998d05
|
198805a60bef287ab43030f93be2d8c42951eae9
|
refs/heads/master
| 2020-06-03T00:40:00.246128
| 2019-01-03T10:43:13
| 2019-01-03T10:43:13
| 191,363,888
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 3,293
|
h
|
/*
* Copyright 2013 The Android Open Source Project
*
* 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.
*/
//--------------------------------------------------------------------------------
// GLContext.h
//--------------------------------------------------------------------------------
#ifndef GLCONTEXT_H_
#define GLCONTEXT_H_
#include <EGL/egl.h>
#include <GLES2/gl2.h>
#include <android/log.h>
#include <android/native_window.h>
namespace ndk_helper {
//--------------------------------------------------------------------------------
// Constants
//--------------------------------------------------------------------------------
//--------------------------------------------------------------------------------
// Class
//--------------------------------------------------------------------------------
/******************************************************************
* OpenGL context handler
* The class handles OpenGL and EGL context based on Android activity life cycle
* The caller needs to call corresponding methods for each activity life cycle
*events as it's done in sample codes.
*
* Also the class initializes OpenGL ES3 when the compatible driver is installed
*in the device.
* getGLVersion() returns 3.0~ when the device supports OpenGLES3.0
*
* Thread safety: OpenGL context is expecting used within dedicated single
*thread,
* thus GLContext class is not designed as a thread-safe
*/
class GLContext {
private:
// EGL configurations
ANativeWindow* window_;
EGLDisplay display_;
EGLSurface surface_;
EGLContext context_;
EGLConfig config_;
// Screen parameters
int32_t screen_width_;
int32_t screen_height_;
int32_t color_size_;
int32_t depth_size_;
// Flags
bool gles_initialized_;
bool egl_context_initialized_;
bool context_valid_;
void InitGLES();
void Terminate();
bool InitEGLSurface();
bool InitEGLContext();
GLContext(GLContext const&);
void operator=(GLContext const&);
GLContext();
virtual ~GLContext();
public:
static GLContext* GetInstance() {
// Singleton
static GLContext instance;
return &instance;
}
bool Init(ANativeWindow* window);
EGLint Swap();
bool Invalidate();
void Suspend();
EGLint Resume(ANativeWindow* window);
ANativeWindow* GetANativeWindow(void) const { return window_; };
int32_t GetScreenWidth() const { return screen_width_; }
int32_t GetScreenHeight() const { return screen_height_; }
int32_t GetBufferColorSize() const { return color_size_; }
int32_t GetBufferDepthSize() const { return depth_size_; }
bool CheckExtension(const char* extension);
EGLDisplay GetDisplay() const { return display_; }
EGLSurface GetSurface() const { return surface_; }
};
} // namespace ndkHelper
#endif /* GLCONTEXT_H_ */
|
[
"yevhen.rezohlazov@gmail.com"
] |
yevhen.rezohlazov@gmail.com
|
b74f5e4934e6311c0a0afff9f68dd0888f8c3f03
|
64589428b06258be0b9b82a7e7c92c0b3f0778f1
|
/Codeforces/Gym/101670 2017-2018 CTU Open Contest/H.cpp
|
2246efef20ebb062154e0269937b97ac11bfe45b
|
[] |
no_license
|
splucs/Competitive-Programming
|
b6def1ec6be720c6fbf93f2618e926e1062fdc48
|
4f41a7fbc71aa6ab8cb943d80e82d9149de7c7d6
|
refs/heads/master
| 2023-08-31T05:10:09.573198
| 2023-08-31T00:40:32
| 2023-08-31T00:40:32
| 85,239,827
| 141
| 27
| null | 2023-01-08T20:31:49
| 2017-03-16T20:42:37
|
C++
|
UTF-8
|
C++
| false
| false
| 601
|
cpp
|
#include <bits/stdc++.h>
using namespace std;
#define MAXN 200009
#define FOR(i, n) for(int i = 0; i < n; i++)
#define REP(i, n) for(int i = n-1; i >= 0; i--)
#define FOR1(i, n) for(int i = 1; i <= n; i++)
#define REP1(i, n) for(int i = n; i > 0; i--)
typedef long long ll;
int a[MAXN], inv[MAXN];
int main() {
int n;
while(scanf("%d", &n) != EOF) {
FOR1(i, n) {
scanf("%d", &a[i]);
inv[a[i]] = i;
}
int ans = 0;
FOR1(i, n) {
if(a[i] != i) {
int j = inv[i];
swap(a[i], a[j]);
inv[a[i]] = i;
inv[a[j]] = j;
ans++;
}
}
printf("%d\n", ans);
}
return 0;
}
|
[
"lucas.fra.oli18@gmail.com"
] |
lucas.fra.oli18@gmail.com
|
b6340e47473287d348eccc8dc1a5261ec7ed9639
|
44748073e5254d85d0c6859a272bb1812f9da125
|
/practice/treap/givr awaay.cpp
|
e2309b3d0b94ce2b4007a3f0c409afa962a27b31
|
[] |
no_license
|
shikharsrivastava/Competitive-Programming-code
|
b33c7132fac82b01a6dbb799ddf379b56a3e2559
|
73402bac6333f9b29a0d6c7ce1be09fb5dbc2f93
|
refs/heads/master
| 2021-04-29T05:27:46.734598
| 2017-01-04T05:04:56
| 2017-01-04T05:04:56
| 77,982,204
| 2
| 2
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 3,196
|
cpp
|
//22:17
#include<bits/stdc++.h>
#define cnt(t) (t ? t->count : 0)
#define updatecnt(t) (t ? (t->count = cnt(t->l) + cnt(t->r) + 1) : 0)
using namespace std;
typedef struct node * pnode;
int *arr;
pnode nodes;
int next;
struct node
{
int p;
int v;
int count;
pnode l,r;
};
int scanint()
{
int num = 0;
char c = getchar_unlocked();
while(c >= '0' && c<= '9')
{
num = num *10 + c - '0';
c = getchar_unlocked();
}
return num;
}
struct Treap
{
pnode tp;
void init(int n)
{
tp = NULL;
}
void split(pnode t,pnode &l,pnode &r,int key)
{
if(!t)
return void(l=r=0);
else if(key > t->v)
split(t->r,t->r,r,key) , l = t;
else
split(t->l,l,t->l,key) , r =t;
updatecnt(t);
}
void merge(pnode &t,pnode l,pnode r)
{
if(!l || !r)
t = l ? l : r;
else if(l->p > r->p)
merge(l->r,l->r,r) , t = l;
else
merge(r->l,l,r->l) , t = r;
updatecnt(t);
}
void insert(pnode &t,pnode it)
{
if(!t)
t = it;
else if(it->p > t->p)
split(t,it->l,it->r,it->v) , t = it;
else if(it->v >= t->v)
insert(t->r,it);
else
insert(t->l,it);
updatecnt(t);
}
int get(pnode &t,int key)
{
if(!t)
return 0;
else if(key > t->v)
return get(t->r,key);
else
return get(t->l,key) + cnt(t->r) + 1;
}
void erase(pnode &t,int key)
{
int ic = cnt(t);
if(!t)
return;
else if(t->v == key)
merge(t,t->l,t->r);
else if(key > t->v)
erase(t->r,key);
else
erase(t->l,key);
updatecnt(t);
}
void replace(pnode &t,int k1,int k2)
{
erase(t,k1);
ins(t,k2);
}
void inss(pnode &t,int k1)
{
nodes[next].v = k1;
nodes[next].p = rand();
nodes[next].count = 1;
nodes[next].l = nodes[next].r = NULL;
insert(t,&nodes[next]);
next++;
}
};
struct snode
{
Treap treap;
};
struct SegmentTree
{
snode * t;
int n;
SegmentTree(int s)
{
n = s;
t = new snode[4*n];
}
void build(int l,int r,int id = 1)
{
t[id].treap.init(r-l+1);
for(int i=l;i<=r;i++)
t[id].treap.ins(t[id].treap.tp,arr[i]);
if(l == r)
return;
int m = (l+r)/2;
build(l,m,id*2);
build(m+1,r,id*2+1);
}
int get(int L,int R,int key,int l,int r,int id = 1)
{
int ans;
if(r<L || l>R)
return 0;
else if(l>=L && r<=R)
return t[id].treap.get(t[id].treap.tp,key);
else
{
int m = (l+r)/2;
return get(L,R,key,l,m,id*2) + get(L,R,key,m+1,r,id*2+1);
}
}
void update(int p,int k1,int k2,int l,int r,int id=1)
{
t[id].treap.replace(t[id].treap.tp,k1,k2);
if(l == r)
return;
int m = (l+r)/2;
if(p>m)
update(p,k1,k2,m+1,r,id*2+1);
else
update(p,k1,k2,l,m,id*2);
}
};
int main()
{
int n,q,t,a,b,c;
//scanf("%d",&n);
n = scanint();
arr = (int*)calloc(n+1,sizeof(int));
for(int i=1;i<=n;i++)
arr[i] = scanint(); //scanf("%d",&arr[i]);
q = scanint();
nodes = new node[21000000];
next = 0;
SegmentTree st(n);
st.build(1,st.n);
//scanf("%d",&q);
while(q--)
{
//scanf("%d",&t);
t = scanint();
if(t == 0)
{
//scanf("%d %d %d",&a,&b,&c);
a = scanint();
b = scanint();
c = scanint();
printf("%d\n",st.get(a,b,c,1,st.n));
}
else if(t == 1)
{
//scanf("%d %d",&a,&b);
a = scanint();
b = scanint();
st.update(a,arr[a],b,1,st.n);
arr[a] = b;
}
}
return 0;
}
|
[
"shikharsri1996@gmail.com"
] |
shikharsri1996@gmail.com
|
5ed70975e4dfeaf0f98ef610311f6e1981707ebc
|
90047daeb462598a924d76ddf4288e832e86417c
|
/net/quic/core/quic_header_list.h
|
b460d41fb97372baa0ba867d062891b82117bc00
|
[
"BSD-3-Clause"
] |
permissive
|
massbrowser/android
|
99b8c21fa4552a13c06bbedd0f9c88dd4a4ad080
|
a9c4371682c9443d6e1d66005d4db61a24a9617c
|
refs/heads/master
| 2022-11-04T21:15:50.656802
| 2017-06-08T12:31:39
| 2017-06-08T12:31:39
| 93,747,579
| 2
| 2
|
BSD-3-Clause
| 2022-10-31T10:34:25
| 2017-06-08T12:36:07
| null |
UTF-8
|
C++
| false
| false
| 2,582
|
h
|
// Copyright (c) 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef NET_QUIC_CORE_QUIC_HEADER_LIST_H_
#define NET_QUIC_CORE_QUIC_HEADER_LIST_H_
#include <algorithm>
#include <deque>
#include <functional>
#include "net/quic/platform/api/quic_bug_tracker.h"
#include "net/quic/platform/api/quic_export.h"
#include "net/quic/platform/api/quic_string_piece.h"
#include "net/spdy/core/spdy_header_block.h"
#include "net/spdy/core/spdy_headers_handler_interface.h"
namespace net {
// A simple class that accumulates header pairs
class QUIC_EXPORT_PRIVATE QuicHeaderList : public SpdyHeadersHandlerInterface {
public:
typedef std::deque<std::pair<std::string, std::string>> ListType;
typedef ListType::const_iterator const_iterator;
QuicHeaderList();
QuicHeaderList(QuicHeaderList&& other);
QuicHeaderList(const QuicHeaderList& other);
QuicHeaderList& operator=(QuicHeaderList&& other);
QuicHeaderList& operator=(const QuicHeaderList& other);
~QuicHeaderList() override;
// From SpdyHeadersHandlerInteface.
void OnHeaderBlockStart() override;
void OnHeader(QuicStringPiece name, QuicStringPiece value) override;
void OnHeaderBlockEnd(size_t uncompressed_header_bytes) override;
void OnHeaderBlockEnd(size_t uncompressed_header_bytes,
size_t compressed_header_bytes) override;
void Clear();
const_iterator begin() const { return header_list_.begin(); }
const_iterator end() const { return header_list_.end(); }
bool empty() const { return header_list_.empty(); }
size_t uncompressed_header_bytes() const {
return uncompressed_header_bytes_;
}
size_t compressed_header_bytes() const { return compressed_header_bytes_; }
void set_max_uncompressed_header_bytes(size_t max_uncompressed_header_bytes) {
max_uncompressed_header_bytes_ = max_uncompressed_header_bytes;
}
std::string DebugString() const;
private:
std::deque<std::pair<std::string, std::string>> header_list_;
size_t max_uncompressed_header_bytes_;
size_t uncompressed_header_bytes_;
size_t compressed_header_bytes_;
};
inline bool operator==(const QuicHeaderList& l1, const QuicHeaderList& l2) {
auto pred = [](const std::pair<std::string, std::string>& p1,
const std::pair<std::string, std::string>& p2) {
return p1.first == p2.first && p1.second == p2.second;
};
return std::equal(l1.begin(), l1.end(), l2.begin(), pred);
}
} // namespace net
#endif // NET_QUIC_CORE_QUIC_HEADER_LIST_H_
|
[
"xElvis89x@gmail.com"
] |
xElvis89x@gmail.com
|
dda9add4e528c93abe269db7ad4d5c2e600f2027
|
7a11814cb2d966035582e0334f184d4786a4f79d
|
/rocksdb-cloud/db/version_set.cc
|
36e9c527d4dfd6135de7b57f942bc4d076e9919a
|
[
"Apache-2.0",
"GPL-2.0-only",
"BSD-3-Clause"
] |
permissive
|
naivewong/YCSB-C
|
f6e1efadfa69688b1a7311b5ce18fe6b4ca4e9a8
|
9a603e95083950278ed0972e2ee889edf77e4148
|
refs/heads/master
| 2022-12-16T16:16:00.106547
| 2020-09-13T12:52:50
| 2020-09-13T12:52:50
| 257,572,961
| 0
| 0
|
Apache-2.0
| 2020-04-21T11:26:35
| 2020-04-21T11:26:34
| null |
UTF-8
|
C++
| false
| false
| 218,927
|
cc
|
// Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
// This source code is licensed under both the GPLv2 (found in the
// COPYING file in the root directory) and Apache 2.0 License
// (found in the LICENSE.Apache file in the root directory).
//
// Copyright (c) 2011 The LevelDB Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. See the AUTHORS file for names of contributors.
#include "db/version_set.h"
#include <stdio.h>
#include <algorithm>
#include <array>
#include <cinttypes>
#include <list>
#include <map>
#include <set>
#include <string>
#include <unordered_map>
#include <vector>
#include "compaction/compaction.h"
#include "db/internal_stats.h"
#include "db/log_reader.h"
#include "db/log_writer.h"
#include "db/memtable.h"
#include "db/merge_context.h"
#include "db/merge_helper.h"
#include "db/pinned_iterators_manager.h"
#include "db/table_cache.h"
#include "db/version_builder.h"
#include "file/filename.h"
#include "monitoring/file_read_sample.h"
#include "monitoring/perf_context_imp.h"
#include "monitoring/persistent_stats_history.h"
#include "rocksdb/env.h"
#include "rocksdb/merge_operator.h"
#include "rocksdb/write_buffer_manager.h"
#include "table/format.h"
#include "table/get_context.h"
#include "table/internal_iterator.h"
#include "table/merging_iterator.h"
#include "table/meta_blocks.h"
#include "table/multiget_context.h"
#include "table/plain/plain_table_factory.h"
#include "table/table_reader.h"
#include "table/two_level_iterator.h"
#include "test_util/sync_point.h"
#include "util/coding.h"
#include "util/file_reader_writer.h"
#include "util/stop_watch.h"
#include "util/string_util.h"
#include "util/user_comparator_wrapper.h"
namespace rocksdb {
namespace {
// Find File in LevelFilesBrief data structure
// Within an index range defined by left and right
int FindFileInRange(const InternalKeyComparator& icmp,
const LevelFilesBrief& file_level,
const Slice& key,
uint32_t left,
uint32_t right) {
auto cmp = [&](const FdWithKeyRange& f, const Slice& k) -> bool {
return icmp.InternalKeyComparator::Compare(f.largest_key, k) < 0;
};
const auto &b = file_level.files;
return static_cast<int>(std::lower_bound(b + left,
b + right, key, cmp) - b);
}
Status OverlapWithIterator(const Comparator* ucmp,
const Slice& smallest_user_key,
const Slice& largest_user_key,
InternalIterator* iter,
bool* overlap) {
InternalKey range_start(smallest_user_key, kMaxSequenceNumber,
kValueTypeForSeek);
iter->Seek(range_start.Encode());
if (!iter->status().ok()) {
return iter->status();
}
*overlap = false;
if (iter->Valid()) {
ParsedInternalKey seek_result;
if (!ParseInternalKey(iter->key(), &seek_result)) {
return Status::Corruption("DB have corrupted keys");
}
if (ucmp->CompareWithoutTimestamp(seek_result.user_key, largest_user_key) <=
0) {
*overlap = true;
}
}
return iter->status();
}
// Class to help choose the next file to search for the particular key.
// Searches and returns files level by level.
// We can search level-by-level since entries never hop across
// levels. Therefore we are guaranteed that if we find data
// in a smaller level, later levels are irrelevant (unless we
// are MergeInProgress).
class FilePicker {
public:
FilePicker(std::vector<FileMetaData*>* files, const Slice& user_key,
const Slice& ikey, autovector<LevelFilesBrief>* file_levels,
unsigned int num_levels, FileIndexer* file_indexer,
const Comparator* user_comparator,
const InternalKeyComparator* internal_comparator)
: num_levels_(num_levels),
curr_level_(static_cast<unsigned int>(-1)),
returned_file_level_(static_cast<unsigned int>(-1)),
hit_file_level_(static_cast<unsigned int>(-1)),
search_left_bound_(0),
search_right_bound_(FileIndexer::kLevelMaxIndex),
#ifndef NDEBUG
files_(files),
#endif
level_files_brief_(file_levels),
is_hit_file_last_in_level_(false),
curr_file_level_(nullptr),
user_key_(user_key),
ikey_(ikey),
file_indexer_(file_indexer),
user_comparator_(user_comparator),
internal_comparator_(internal_comparator) {
#ifdef NDEBUG
(void)files;
#endif
// Setup member variables to search first level.
search_ended_ = !PrepareNextLevel();
if (!search_ended_) {
// Prefetch Level 0 table data to avoid cache miss if possible.
for (unsigned int i = 0; i < (*level_files_brief_)[0].num_files; ++i) {
auto* r = (*level_files_brief_)[0].files[i].fd.table_reader;
if (r) {
r->Prepare(ikey);
}
}
}
}
int GetCurrentLevel() const { return curr_level_; }
FdWithKeyRange* GetNextFile() {
while (!search_ended_) { // Loops over different levels.
while (curr_index_in_curr_level_ < curr_file_level_->num_files) {
// Loops over all files in current level.
FdWithKeyRange* f = &curr_file_level_->files[curr_index_in_curr_level_];
hit_file_level_ = curr_level_;
is_hit_file_last_in_level_ =
curr_index_in_curr_level_ == curr_file_level_->num_files - 1;
int cmp_largest = -1;
// Do key range filtering of files or/and fractional cascading if:
// (1) not all the files are in level 0, or
// (2) there are more than 3 current level files
// If there are only 3 or less current level files in the system, we skip
// the key range filtering. In this case, more likely, the system is
// highly tuned to minimize number of tables queried by each query,
// so it is unlikely that key range filtering is more efficient than
// querying the files.
if (num_levels_ > 1 || curr_file_level_->num_files > 3) {
// Check if key is within a file's range. If search left bound and
// right bound point to the same find, we are sure key falls in
// range.
assert(curr_level_ == 0 ||
curr_index_in_curr_level_ == start_index_in_curr_level_ ||
user_comparator_->CompareWithoutTimestamp(
user_key_, ExtractUserKey(f->smallest_key)) <= 0);
int cmp_smallest = user_comparator_->CompareWithoutTimestamp(
user_key_, ExtractUserKey(f->smallest_key));
if (cmp_smallest >= 0) {
cmp_largest = user_comparator_->CompareWithoutTimestamp(
user_key_, ExtractUserKey(f->largest_key));
}
// Setup file search bound for the next level based on the
// comparison results
if (curr_level_ > 0) {
file_indexer_->GetNextLevelIndex(curr_level_,
curr_index_in_curr_level_,
cmp_smallest, cmp_largest,
&search_left_bound_,
&search_right_bound_);
}
// Key falls out of current file's range
if (cmp_smallest < 0 || cmp_largest > 0) {
if (curr_level_ == 0) {
++curr_index_in_curr_level_;
continue;
} else {
// Search next level.
break;
}
}
}
#ifndef NDEBUG
// Sanity check to make sure that the files are correctly sorted
if (prev_file_) {
if (curr_level_ != 0) {
int comp_sign = internal_comparator_->Compare(
prev_file_->largest_key, f->smallest_key);
assert(comp_sign < 0);
} else {
// level == 0, the current file cannot be newer than the previous
// one. Use compressed data structure, has no attribute seqNo
assert(curr_index_in_curr_level_ > 0);
assert(!NewestFirstBySeqNo(files_[0][curr_index_in_curr_level_],
files_[0][curr_index_in_curr_level_-1]));
}
}
prev_file_ = f;
#endif
returned_file_level_ = curr_level_;
if (curr_level_ > 0 && cmp_largest < 0) {
// No more files to search in this level.
search_ended_ = !PrepareNextLevel();
} else {
++curr_index_in_curr_level_;
}
return f;
}
// Start searching next level.
search_ended_ = !PrepareNextLevel();
}
// Search ended.
return nullptr;
}
// getter for current file level
// for GET_HIT_L0, GET_HIT_L1 & GET_HIT_L2_AND_UP counts
unsigned int GetHitFileLevel() { return hit_file_level_; }
// Returns true if the most recent "hit file" (i.e., one returned by
// GetNextFile()) is at the last index in its level.
bool IsHitFileLastInLevel() { return is_hit_file_last_in_level_; }
private:
unsigned int num_levels_;
unsigned int curr_level_;
unsigned int returned_file_level_;
unsigned int hit_file_level_;
int32_t search_left_bound_;
int32_t search_right_bound_;
#ifndef NDEBUG
std::vector<FileMetaData*>* files_;
#endif
autovector<LevelFilesBrief>* level_files_brief_;
bool search_ended_;
bool is_hit_file_last_in_level_;
LevelFilesBrief* curr_file_level_;
unsigned int curr_index_in_curr_level_;
unsigned int start_index_in_curr_level_;
Slice user_key_;
Slice ikey_;
FileIndexer* file_indexer_;
const Comparator* user_comparator_;
const InternalKeyComparator* internal_comparator_;
#ifndef NDEBUG
FdWithKeyRange* prev_file_;
#endif
// Setup local variables to search next level.
// Returns false if there are no more levels to search.
bool PrepareNextLevel() {
curr_level_++;
while (curr_level_ < num_levels_) {
curr_file_level_ = &(*level_files_brief_)[curr_level_];
if (curr_file_level_->num_files == 0) {
// When current level is empty, the search bound generated from upper
// level must be [0, -1] or [0, FileIndexer::kLevelMaxIndex] if it is
// also empty.
assert(search_left_bound_ == 0);
assert(search_right_bound_ == -1 ||
search_right_bound_ == FileIndexer::kLevelMaxIndex);
// Since current level is empty, it will need to search all files in
// the next level
search_left_bound_ = 0;
search_right_bound_ = FileIndexer::kLevelMaxIndex;
curr_level_++;
continue;
}
// Some files may overlap each other. We find
// all files that overlap user_key and process them in order from
// newest to oldest. In the context of merge-operator, this can occur at
// any level. Otherwise, it only occurs at Level-0 (since Put/Deletes
// are always compacted into a single entry).
int32_t start_index;
if (curr_level_ == 0) {
// On Level-0, we read through all files to check for overlap.
start_index = 0;
} else {
// On Level-n (n>=1), files are sorted. Binary search to find the
// earliest file whose largest key >= ikey. Search left bound and
// right bound are used to narrow the range.
if (search_left_bound_ <= search_right_bound_) {
if (search_right_bound_ == FileIndexer::kLevelMaxIndex) {
search_right_bound_ =
static_cast<int32_t>(curr_file_level_->num_files) - 1;
}
// `search_right_bound_` is an inclusive upper-bound, but since it was
// determined based on user key, it is still possible the lookup key
// falls to the right of `search_right_bound_`'s corresponding file.
// So, pass a limit one higher, which allows us to detect this case.
start_index =
FindFileInRange(*internal_comparator_, *curr_file_level_, ikey_,
static_cast<uint32_t>(search_left_bound_),
static_cast<uint32_t>(search_right_bound_) + 1);
if (start_index == search_right_bound_ + 1) {
// `ikey_` comes after `search_right_bound_`. The lookup key does
// not exist on this level, so let's skip this level and do a full
// binary search on the next level.
search_left_bound_ = 0;
search_right_bound_ = FileIndexer::kLevelMaxIndex;
curr_level_++;
continue;
}
} else {
// search_left_bound > search_right_bound, key does not exist in
// this level. Since no comparison is done in this level, it will
// need to search all files in the next level.
search_left_bound_ = 0;
search_right_bound_ = FileIndexer::kLevelMaxIndex;
curr_level_++;
continue;
}
}
start_index_in_curr_level_ = start_index;
curr_index_in_curr_level_ = start_index;
#ifndef NDEBUG
prev_file_ = nullptr;
#endif
return true;
}
// curr_level_ = num_levels_. So, no more levels to search.
return false;
}
};
class FilePickerMultiGet {
private:
struct FilePickerContext;
public:
FilePickerMultiGet(MultiGetRange* range,
autovector<LevelFilesBrief>* file_levels,
unsigned int num_levels, FileIndexer* file_indexer,
const Comparator* user_comparator,
const InternalKeyComparator* internal_comparator)
: num_levels_(num_levels),
curr_level_(static_cast<unsigned int>(-1)),
returned_file_level_(static_cast<unsigned int>(-1)),
hit_file_level_(static_cast<unsigned int>(-1)),
range_(range),
batch_iter_(range->begin()),
batch_iter_prev_(range->begin()),
maybe_repeat_key_(false),
current_level_range_(*range, range->begin(), range->end()),
current_file_range_(*range, range->begin(), range->end()),
level_files_brief_(file_levels),
is_hit_file_last_in_level_(false),
curr_file_level_(nullptr),
file_indexer_(file_indexer),
user_comparator_(user_comparator),
internal_comparator_(internal_comparator) {
for (auto iter = range_->begin(); iter != range_->end(); ++iter) {
fp_ctx_array_[iter.index()] =
FilePickerContext(0, FileIndexer::kLevelMaxIndex);
}
// Setup member variables to search first level.
search_ended_ = !PrepareNextLevel();
if (!search_ended_) {
// REVISIT
// Prefetch Level 0 table data to avoid cache miss if possible.
// As of now, only PlainTableReader and CuckooTableReader do any
// prefetching. This may not be necessary anymore once we implement
// batching in those table readers
for (unsigned int i = 0; i < (*level_files_brief_)[0].num_files; ++i) {
auto* r = (*level_files_brief_)[0].files[i].fd.table_reader;
if (r) {
for (auto iter = range_->begin(); iter != range_->end(); ++iter) {
r->Prepare(iter->ikey);
}
}
}
}
}
int GetCurrentLevel() const { return curr_level_; }
// Iterates through files in the current level until it finds a file that
// contains atleast one key from the MultiGet batch
bool GetNextFileInLevelWithKeys(MultiGetRange* next_file_range,
size_t* file_index, FdWithKeyRange** fd,
bool* is_last_key_in_file) {
size_t curr_file_index = *file_index;
FdWithKeyRange* f = nullptr;
bool file_hit = false;
int cmp_largest = -1;
if (curr_file_index >= curr_file_level_->num_files) {
// In the unlikely case the next key is a duplicate of the current key,
// and the current key is the last in the level and the internal key
// was not found, we need to skip lookup for the remaining keys and
// reset the search bounds
if (batch_iter_ != current_level_range_.end()) {
++batch_iter_;
for (; batch_iter_ != current_level_range_.end(); ++batch_iter_) {
struct FilePickerContext& fp_ctx = fp_ctx_array_[batch_iter_.index()];
fp_ctx.search_left_bound = 0;
fp_ctx.search_right_bound = FileIndexer::kLevelMaxIndex;
}
}
return false;
}
// Loops over keys in the MultiGet batch until it finds a file with
// atleast one of the keys. Then it keeps moving forward until the
// last key in the batch that falls in that file
while (batch_iter_ != current_level_range_.end() &&
(fp_ctx_array_[batch_iter_.index()].curr_index_in_curr_level ==
curr_file_index ||
!file_hit)) {
struct FilePickerContext& fp_ctx = fp_ctx_array_[batch_iter_.index()];
f = &curr_file_level_->files[fp_ctx.curr_index_in_curr_level];
Slice& user_key = batch_iter_->ukey;
// Do key range filtering of files or/and fractional cascading if:
// (1) not all the files are in level 0, or
// (2) there are more than 3 current level files
// If there are only 3 or less current level files in the system, we
// skip the key range filtering. In this case, more likely, the system
// is highly tuned to minimize number of tables queried by each query,
// so it is unlikely that key range filtering is more efficient than
// querying the files.
if (num_levels_ > 1 || curr_file_level_->num_files > 3) {
// Check if key is within a file's range. If search left bound and
// right bound point to the same find, we are sure key falls in
// range.
assert(curr_level_ == 0 ||
fp_ctx.curr_index_in_curr_level ==
fp_ctx.start_index_in_curr_level ||
user_comparator_->Compare(user_key,
ExtractUserKey(f->smallest_key)) <= 0);
int cmp_smallest = user_comparator_->Compare(
user_key, ExtractUserKey(f->smallest_key));
if (cmp_smallest >= 0) {
cmp_largest = user_comparator_->Compare(
user_key, ExtractUserKey(f->largest_key));
} else {
cmp_largest = -1;
}
// Setup file search bound for the next level based on the
// comparison results
if (curr_level_ > 0) {
file_indexer_->GetNextLevelIndex(
curr_level_, fp_ctx.curr_index_in_curr_level, cmp_smallest,
cmp_largest, &fp_ctx.search_left_bound,
&fp_ctx.search_right_bound);
}
// Key falls out of current file's range
if (cmp_smallest < 0 || cmp_largest > 0) {
next_file_range->SkipKey(batch_iter_);
} else {
file_hit = true;
}
} else {
file_hit = true;
}
if (cmp_largest == 0) {
// cmp_largest is 0, which means the next key will not be in this
// file, so stop looking further. Also don't increment megt_iter_
// as we may have to look for this key in the next file if we don't
// find it in this one
break;
} else {
if (curr_level_ == 0) {
// We need to look through all files in level 0
++fp_ctx.curr_index_in_curr_level;
}
++batch_iter_;
}
if (!file_hit) {
curr_file_index =
(batch_iter_ != current_level_range_.end())
? fp_ctx_array_[batch_iter_.index()].curr_index_in_curr_level
: curr_file_level_->num_files;
}
}
*fd = f;
*file_index = curr_file_index;
*is_last_key_in_file = cmp_largest == 0;
return file_hit;
}
FdWithKeyRange* GetNextFile() {
while (!search_ended_) {
// Start searching next level.
if (batch_iter_ == current_level_range_.end()) {
search_ended_ = !PrepareNextLevel();
continue;
} else {
if (maybe_repeat_key_) {
maybe_repeat_key_ = false;
// Check if we found the final value for the last key in the
// previous lookup range. If we did, then there's no need to look
// any further for that key, so advance batch_iter_. Else, keep
// batch_iter_ positioned on that key so we look it up again in
// the next file
// For L0, always advance the key because we will look in the next
// file regardless for all keys not found yet
if (current_level_range_.CheckKeyDone(batch_iter_) ||
curr_level_ == 0) {
++batch_iter_;
}
}
// batch_iter_prev_ will become the start key for the next file
// lookup
batch_iter_prev_ = batch_iter_;
}
MultiGetRange next_file_range(current_level_range_, batch_iter_prev_,
current_level_range_.end());
size_t curr_file_index =
(batch_iter_ != current_level_range_.end())
? fp_ctx_array_[batch_iter_.index()].curr_index_in_curr_level
: curr_file_level_->num_files;
FdWithKeyRange* f;
bool is_last_key_in_file;
if (!GetNextFileInLevelWithKeys(&next_file_range, &curr_file_index, &f,
&is_last_key_in_file)) {
search_ended_ = !PrepareNextLevel();
} else {
MultiGetRange::Iterator upper_key = batch_iter_;
if (is_last_key_in_file) {
// Since cmp_largest is 0, batch_iter_ still points to the last key
// that falls in this file, instead of the next one. Increment
// upper_key so we can set the range properly for SST MultiGet
++upper_key;
++(fp_ctx_array_[batch_iter_.index()].curr_index_in_curr_level);
maybe_repeat_key_ = true;
}
// Set the range for this file
current_file_range_ =
MultiGetRange(next_file_range, batch_iter_prev_, upper_key);
returned_file_level_ = curr_level_;
hit_file_level_ = curr_level_;
is_hit_file_last_in_level_ =
curr_file_index == curr_file_level_->num_files - 1;
return f;
}
}
// Search ended
return nullptr;
}
// getter for current file level
// for GET_HIT_L0, GET_HIT_L1 & GET_HIT_L2_AND_UP counts
unsigned int GetHitFileLevel() { return hit_file_level_; }
// Returns true if the most recent "hit file" (i.e., one returned by
// GetNextFile()) is at the last index in its level.
bool IsHitFileLastInLevel() { return is_hit_file_last_in_level_; }
const MultiGetRange& CurrentFileRange() { return current_file_range_; }
private:
unsigned int num_levels_;
unsigned int curr_level_;
unsigned int returned_file_level_;
unsigned int hit_file_level_;
struct FilePickerContext {
int32_t search_left_bound;
int32_t search_right_bound;
unsigned int curr_index_in_curr_level;
unsigned int start_index_in_curr_level;
FilePickerContext(int32_t left, int32_t right)
: search_left_bound(left), search_right_bound(right),
curr_index_in_curr_level(0), start_index_in_curr_level(0) {}
FilePickerContext() = default;
};
std::array<FilePickerContext, MultiGetContext::MAX_BATCH_SIZE> fp_ctx_array_;
MultiGetRange* range_;
// Iterator to iterate through the keys in a MultiGet batch, that gets reset
// at the beginning of each level. Each call to GetNextFile() will position
// batch_iter_ at or right after the last key that was found in the returned
// SST file
MultiGetRange::Iterator batch_iter_;
// An iterator that records the previous position of batch_iter_, i.e last
// key found in the previous SST file, in order to serve as the start of
// the batch key range for the next SST file
MultiGetRange::Iterator batch_iter_prev_;
bool maybe_repeat_key_;
MultiGetRange current_level_range_;
MultiGetRange current_file_range_;
autovector<LevelFilesBrief>* level_files_brief_;
bool search_ended_;
bool is_hit_file_last_in_level_;
LevelFilesBrief* curr_file_level_;
FileIndexer* file_indexer_;
const Comparator* user_comparator_;
const InternalKeyComparator* internal_comparator_;
// Setup local variables to search next level.
// Returns false if there are no more levels to search.
bool PrepareNextLevel() {
if (curr_level_ == 0) {
MultiGetRange::Iterator mget_iter = current_level_range_.begin();
if (fp_ctx_array_[mget_iter.index()].curr_index_in_curr_level <
curr_file_level_->num_files) {
batch_iter_prev_ = current_level_range_.begin();
batch_iter_ = current_level_range_.begin();
return true;
}
}
curr_level_++;
// Reset key range to saved value
while (curr_level_ < num_levels_) {
bool level_contains_keys = false;
curr_file_level_ = &(*level_files_brief_)[curr_level_];
if (curr_file_level_->num_files == 0) {
// When current level is empty, the search bound generated from upper
// level must be [0, -1] or [0, FileIndexer::kLevelMaxIndex] if it is
// also empty.
for (auto mget_iter = current_level_range_.begin();
mget_iter != current_level_range_.end(); ++mget_iter) {
struct FilePickerContext& fp_ctx = fp_ctx_array_[mget_iter.index()];
assert(fp_ctx.search_left_bound == 0);
assert(fp_ctx.search_right_bound == -1 ||
fp_ctx.search_right_bound == FileIndexer::kLevelMaxIndex);
// Since current level is empty, it will need to search all files in
// the next level
fp_ctx.search_left_bound = 0;
fp_ctx.search_right_bound = FileIndexer::kLevelMaxIndex;
}
// Skip all subsequent empty levels
do {
++curr_level_;
} while ((curr_level_ < num_levels_) &&
(*level_files_brief_)[curr_level_].num_files == 0);
continue;
}
// Some files may overlap each other. We find
// all files that overlap user_key and process them in order from
// newest to oldest. In the context of merge-operator, this can occur at
// any level. Otherwise, it only occurs at Level-0 (since Put/Deletes
// are always compacted into a single entry).
int32_t start_index = -1;
current_level_range_ =
MultiGetRange(*range_, range_->begin(), range_->end());
for (auto mget_iter = current_level_range_.begin();
mget_iter != current_level_range_.end(); ++mget_iter) {
struct FilePickerContext& fp_ctx = fp_ctx_array_[mget_iter.index()];
if (curr_level_ == 0) {
// On Level-0, we read through all files to check for overlap.
start_index = 0;
level_contains_keys = true;
} else {
// On Level-n (n>=1), files are sorted. Binary search to find the
// earliest file whose largest key >= ikey. Search left bound and
// right bound are used to narrow the range.
if (fp_ctx.search_left_bound <= fp_ctx.search_right_bound) {
if (fp_ctx.search_right_bound == FileIndexer::kLevelMaxIndex) {
fp_ctx.search_right_bound =
static_cast<int32_t>(curr_file_level_->num_files) - 1;
}
// `search_right_bound_` is an inclusive upper-bound, but since it
// was determined based on user key, it is still possible the lookup
// key falls to the right of `search_right_bound_`'s corresponding
// file. So, pass a limit one higher, which allows us to detect this
// case.
Slice& ikey = mget_iter->ikey;
start_index = FindFileInRange(
*internal_comparator_, *curr_file_level_, ikey,
static_cast<uint32_t>(fp_ctx.search_left_bound),
static_cast<uint32_t>(fp_ctx.search_right_bound) + 1);
if (start_index == fp_ctx.search_right_bound + 1) {
// `ikey_` comes after `search_right_bound_`. The lookup key does
// not exist on this level, so let's skip this level and do a full
// binary search on the next level.
fp_ctx.search_left_bound = 0;
fp_ctx.search_right_bound = FileIndexer::kLevelMaxIndex;
current_level_range_.SkipKey(mget_iter);
continue;
} else {
level_contains_keys = true;
}
} else {
// search_left_bound > search_right_bound, key does not exist in
// this level. Since no comparison is done in this level, it will
// need to search all files in the next level.
fp_ctx.search_left_bound = 0;
fp_ctx.search_right_bound = FileIndexer::kLevelMaxIndex;
current_level_range_.SkipKey(mget_iter);
continue;
}
}
fp_ctx.start_index_in_curr_level = start_index;
fp_ctx.curr_index_in_curr_level = start_index;
}
if (level_contains_keys) {
batch_iter_prev_ = current_level_range_.begin();
batch_iter_ = current_level_range_.begin();
return true;
}
curr_level_++;
}
// curr_level_ = num_levels_. So, no more levels to search.
return false;
}
};
} // anonymous namespace
VersionStorageInfo::~VersionStorageInfo() { delete[] files_; }
Version::~Version() {
assert(refs_ == 0);
// Remove from linked list
prev_->next_ = next_;
next_->prev_ = prev_;
// Drop references to files
for (int level = 0; level < storage_info_.num_levels_; level++) {
for (size_t i = 0; i < storage_info_.files_[level].size(); i++) {
FileMetaData* f = storage_info_.files_[level][i];
assert(f->refs > 0);
f->refs--;
if (f->refs <= 0) {
assert(cfd_ != nullptr);
uint32_t path_id = f->fd.GetPathId();
assert(path_id < cfd_->ioptions()->cf_paths.size());
vset_->obsolete_files_.push_back(
ObsoleteFileInfo(f, cfd_->ioptions()->cf_paths[path_id].path));
}
}
}
}
int FindFile(const InternalKeyComparator& icmp,
const LevelFilesBrief& file_level,
const Slice& key) {
return FindFileInRange(icmp, file_level, key, 0,
static_cast<uint32_t>(file_level.num_files));
}
void DoGenerateLevelFilesBrief(LevelFilesBrief* file_level,
const std::vector<FileMetaData*>& files,
Arena* arena) {
assert(file_level);
assert(arena);
size_t num = files.size();
file_level->num_files = num;
char* mem = arena->AllocateAligned(num * sizeof(FdWithKeyRange));
file_level->files = new (mem)FdWithKeyRange[num];
for (size_t i = 0; i < num; i++) {
Slice smallest_key = files[i]->smallest.Encode();
Slice largest_key = files[i]->largest.Encode();
// Copy key slice to sequential memory
size_t smallest_size = smallest_key.size();
size_t largest_size = largest_key.size();
mem = arena->AllocateAligned(smallest_size + largest_size);
memcpy(mem, smallest_key.data(), smallest_size);
memcpy(mem + smallest_size, largest_key.data(), largest_size);
FdWithKeyRange& f = file_level->files[i];
f.fd = files[i]->fd;
f.file_metadata = files[i];
f.smallest_key = Slice(mem, smallest_size);
f.largest_key = Slice(mem + smallest_size, largest_size);
}
}
static bool AfterFile(const Comparator* ucmp,
const Slice* user_key, const FdWithKeyRange* f) {
// nullptr user_key occurs before all keys and is therefore never after *f
return (user_key != nullptr &&
ucmp->CompareWithoutTimestamp(*user_key,
ExtractUserKey(f->largest_key)) > 0);
}
static bool BeforeFile(const Comparator* ucmp,
const Slice* user_key, const FdWithKeyRange* f) {
// nullptr user_key occurs after all keys and is therefore never before *f
return (user_key != nullptr &&
ucmp->CompareWithoutTimestamp(*user_key,
ExtractUserKey(f->smallest_key)) < 0);
}
bool SomeFileOverlapsRange(
const InternalKeyComparator& icmp,
bool disjoint_sorted_files,
const LevelFilesBrief& file_level,
const Slice* smallest_user_key,
const Slice* largest_user_key) {
const Comparator* ucmp = icmp.user_comparator();
if (!disjoint_sorted_files) {
// Need to check against all files
for (size_t i = 0; i < file_level.num_files; i++) {
const FdWithKeyRange* f = &(file_level.files[i]);
if (AfterFile(ucmp, smallest_user_key, f) ||
BeforeFile(ucmp, largest_user_key, f)) {
// No overlap
} else {
return true; // Overlap
}
}
return false;
}
// Binary search over file list
uint32_t index = 0;
if (smallest_user_key != nullptr) {
// Find the leftmost possible internal key for smallest_user_key
InternalKey small;
small.SetMinPossibleForUserKey(*smallest_user_key);
index = FindFile(icmp, file_level, small.Encode());
}
if (index >= file_level.num_files) {
// beginning of range is after all files, so no overlap.
return false;
}
return !BeforeFile(ucmp, largest_user_key, &file_level.files[index]);
}
namespace {
class LevelIterator final : public InternalIterator {
public:
LevelIterator(TableCache* table_cache, const ReadOptions& read_options,
const EnvOptions& env_options,
const InternalKeyComparator& icomparator,
const LevelFilesBrief* flevel,
const SliceTransform* prefix_extractor, bool should_sample,
HistogramImpl* file_read_hist, TableReaderCaller caller,
bool skip_filters, int level, RangeDelAggregator* range_del_agg,
const std::vector<AtomicCompactionUnitBoundary>*
compaction_boundaries = nullptr)
: table_cache_(table_cache),
read_options_(read_options),
env_options_(env_options),
icomparator_(icomparator),
user_comparator_(icomparator.user_comparator()),
flevel_(flevel),
prefix_extractor_(prefix_extractor),
file_read_hist_(file_read_hist),
should_sample_(should_sample),
caller_(caller),
skip_filters_(skip_filters),
file_index_(flevel_->num_files),
level_(level),
range_del_agg_(range_del_agg),
pinned_iters_mgr_(nullptr),
compaction_boundaries_(compaction_boundaries) {
// Empty level is not supported.
assert(flevel_ != nullptr && flevel_->num_files > 0);
}
~LevelIterator() override { delete file_iter_.Set(nullptr); }
void Seek(const Slice& target) override;
void SeekForPrev(const Slice& target) override;
void SeekToFirst() override;
void SeekToLast() override;
void Next() final override;
bool NextAndGetResult(IterateResult* result) override;
void Prev() override;
bool Valid() const override { return file_iter_.Valid(); }
Slice key() const override {
assert(Valid());
return file_iter_.key();
}
Slice value() const override {
assert(Valid());
return file_iter_.value();
}
Status status() const override {
return file_iter_.iter() ? file_iter_.status() : Status::OK();
}
inline bool MayBeOutOfLowerBound() override {
assert(Valid());
return may_be_out_of_lower_bound_ && file_iter_.MayBeOutOfLowerBound();
}
inline bool MayBeOutOfUpperBound() override {
assert(Valid());
return file_iter_.MayBeOutOfUpperBound();
}
void SetPinnedItersMgr(PinnedIteratorsManager* pinned_iters_mgr) override {
pinned_iters_mgr_ = pinned_iters_mgr;
if (file_iter_.iter()) {
file_iter_.SetPinnedItersMgr(pinned_iters_mgr);
}
}
bool IsKeyPinned() const override {
return pinned_iters_mgr_ && pinned_iters_mgr_->PinningEnabled() &&
file_iter_.iter() && file_iter_.IsKeyPinned();
}
bool IsValuePinned() const override {
return pinned_iters_mgr_ && pinned_iters_mgr_->PinningEnabled() &&
file_iter_.iter() && file_iter_.IsValuePinned();
}
private:
void SkipEmptyFileForward();
void SkipEmptyFileBackward();
void SetFileIterator(InternalIterator* iter);
void InitFileIterator(size_t new_file_index);
// Called by both of Next() and NextAndGetResult(). Force inline.
void NextImpl() {
assert(Valid());
file_iter_.Next();
SkipEmptyFileForward();
}
const Slice& file_smallest_key(size_t file_index) {
assert(file_index < flevel_->num_files);
return flevel_->files[file_index].smallest_key;
}
bool KeyReachedUpperBound(const Slice& internal_key) {
return read_options_.iterate_upper_bound != nullptr &&
user_comparator_.CompareWithoutTimestamp(
ExtractUserKey(internal_key),
*read_options_.iterate_upper_bound) >= 0;
}
InternalIterator* NewFileIterator() {
assert(file_index_ < flevel_->num_files);
auto file_meta = flevel_->files[file_index_];
if (should_sample_) {
sample_file_read_inc(file_meta.file_metadata);
}
const InternalKey* smallest_compaction_key = nullptr;
const InternalKey* largest_compaction_key = nullptr;
if (compaction_boundaries_ != nullptr) {
smallest_compaction_key = (*compaction_boundaries_)[file_index_].smallest;
largest_compaction_key = (*compaction_boundaries_)[file_index_].largest;
}
CheckMayBeOutOfLowerBound();
return table_cache_->NewIterator(
read_options_, env_options_, icomparator_, *file_meta.file_metadata,
range_del_agg_, prefix_extractor_,
nullptr /* don't need reference to table */, file_read_hist_, caller_,
/*arena=*/nullptr, skip_filters_, level_, smallest_compaction_key,
largest_compaction_key);
}
// Check if current file being fully within iterate_lower_bound.
//
// Note MyRocks may update iterate bounds between seek. To workaround it,
// we need to check and update may_be_out_of_lower_bound_ accordingly.
void CheckMayBeOutOfLowerBound() {
if (read_options_.iterate_lower_bound != nullptr &&
file_index_ < flevel_->num_files) {
may_be_out_of_lower_bound_ =
user_comparator_.Compare(
ExtractUserKey(file_smallest_key(file_index_)),
*read_options_.iterate_lower_bound) < 0;
}
}
TableCache* table_cache_;
const ReadOptions read_options_;
const EnvOptions& env_options_;
const InternalKeyComparator& icomparator_;
const UserComparatorWrapper user_comparator_;
const LevelFilesBrief* flevel_;
mutable FileDescriptor current_value_;
const SliceTransform* prefix_extractor_;
HistogramImpl* file_read_hist_;
bool should_sample_;
TableReaderCaller caller_;
bool skip_filters_;
bool may_be_out_of_lower_bound_ = true;
size_t file_index_;
int level_;
RangeDelAggregator* range_del_agg_;
IteratorWrapper file_iter_; // May be nullptr
PinnedIteratorsManager* pinned_iters_mgr_;
// To be propagated to RangeDelAggregator in order to safely truncate range
// tombstones.
const std::vector<AtomicCompactionUnitBoundary>* compaction_boundaries_;
};
void LevelIterator::Seek(const Slice& target) {
// Check whether the seek key fall under the same file
bool need_to_reseek = true;
if (file_iter_.iter() != nullptr && file_index_ < flevel_->num_files) {
const FdWithKeyRange& cur_file = flevel_->files[file_index_];
if (icomparator_.InternalKeyComparator::Compare(
target, cur_file.largest_key) <= 0 &&
icomparator_.InternalKeyComparator::Compare(
target, cur_file.smallest_key) >= 0) {
need_to_reseek = false;
assert(static_cast<size_t>(FindFile(icomparator_, *flevel_, target)) ==
file_index_);
}
}
if (need_to_reseek) {
TEST_SYNC_POINT("LevelIterator::Seek:BeforeFindFile");
size_t new_file_index = FindFile(icomparator_, *flevel_, target);
InitFileIterator(new_file_index);
}
if (file_iter_.iter() != nullptr) {
file_iter_.Seek(target);
}
SkipEmptyFileForward();
CheckMayBeOutOfLowerBound();
}
void LevelIterator::SeekForPrev(const Slice& target) {
size_t new_file_index = FindFile(icomparator_, *flevel_, target);
if (new_file_index >= flevel_->num_files) {
new_file_index = flevel_->num_files - 1;
}
InitFileIterator(new_file_index);
if (file_iter_.iter() != nullptr) {
file_iter_.SeekForPrev(target);
SkipEmptyFileBackward();
}
CheckMayBeOutOfLowerBound();
}
void LevelIterator::SeekToFirst() {
InitFileIterator(0);
if (file_iter_.iter() != nullptr) {
file_iter_.SeekToFirst();
}
SkipEmptyFileForward();
CheckMayBeOutOfLowerBound();
}
void LevelIterator::SeekToLast() {
InitFileIterator(flevel_->num_files - 1);
if (file_iter_.iter() != nullptr) {
file_iter_.SeekToLast();
}
SkipEmptyFileBackward();
CheckMayBeOutOfLowerBound();
}
void LevelIterator::Next() { NextImpl(); }
bool LevelIterator::NextAndGetResult(IterateResult* result) {
NextImpl();
bool is_valid = Valid();
if (is_valid) {
result->key = key();
result->may_be_out_of_upper_bound = MayBeOutOfUpperBound();
}
return is_valid;
}
void LevelIterator::Prev() {
assert(Valid());
file_iter_.Prev();
SkipEmptyFileBackward();
}
void LevelIterator::SkipEmptyFileForward() {
while (file_iter_.iter() == nullptr ||
(!file_iter_.Valid() && file_iter_.status().ok() &&
!file_iter_.iter()->IsOutOfBound())) {
// Move to next file
if (file_index_ >= flevel_->num_files - 1) {
// Already at the last file
SetFileIterator(nullptr);
return;
}
if (KeyReachedUpperBound(file_smallest_key(file_index_ + 1))) {
SetFileIterator(nullptr);
return;
}
InitFileIterator(file_index_ + 1);
if (file_iter_.iter() != nullptr) {
file_iter_.SeekToFirst();
}
}
}
void LevelIterator::SkipEmptyFileBackward() {
while (file_iter_.iter() == nullptr ||
(!file_iter_.Valid() && file_iter_.status().ok())) {
// Move to previous file
if (file_index_ == 0) {
// Already the first file
SetFileIterator(nullptr);
return;
}
InitFileIterator(file_index_ - 1);
if (file_iter_.iter() != nullptr) {
file_iter_.SeekToLast();
}
}
}
void LevelIterator::SetFileIterator(InternalIterator* iter) {
if (pinned_iters_mgr_ && iter) {
iter->SetPinnedItersMgr(pinned_iters_mgr_);
}
InternalIterator* old_iter = file_iter_.Set(iter);
if (pinned_iters_mgr_ && pinned_iters_mgr_->PinningEnabled()) {
pinned_iters_mgr_->PinIterator(old_iter);
} else {
delete old_iter;
}
}
void LevelIterator::InitFileIterator(size_t new_file_index) {
if (new_file_index >= flevel_->num_files) {
file_index_ = new_file_index;
SetFileIterator(nullptr);
return;
} else {
// If the file iterator shows incomplete, we try it again if users seek
// to the same file, as this time we may go to a different data block
// which is cached in block cache.
//
if (file_iter_.iter() != nullptr && !file_iter_.status().IsIncomplete() &&
new_file_index == file_index_) {
// file_iter_ is already constructed with this iterator, so
// no need to change anything
} else {
file_index_ = new_file_index;
InternalIterator* iter = NewFileIterator();
SetFileIterator(iter);
}
}
}
} // anonymous namespace
// A wrapper of version builder which references the current version in
// constructor and unref it in the destructor.
// Both of the constructor and destructor need to be called inside DB Mutex.
class BaseReferencedVersionBuilder {
public:
explicit BaseReferencedVersionBuilder(ColumnFamilyData* cfd)
: version_builder_(new VersionBuilder(
cfd->current()->version_set()->env_options(), cfd->table_cache(),
cfd->current()->storage_info(), cfd->ioptions()->info_log)),
version_(cfd->current()) {
version_->Ref();
}
~BaseReferencedVersionBuilder() {
version_->Unref();
}
VersionBuilder* version_builder() { return version_builder_.get(); }
private:
std::unique_ptr<VersionBuilder> version_builder_;
Version* version_;
};
Status Version::GetTableProperties(std::shared_ptr<const TableProperties>* tp,
const FileMetaData* file_meta,
const std::string* fname) const {
auto table_cache = cfd_->table_cache();
auto ioptions = cfd_->ioptions();
Status s = table_cache->GetTableProperties(
env_options_, cfd_->internal_comparator(), file_meta->fd, tp,
mutable_cf_options_.prefix_extractor.get(), true /* no io */);
if (s.ok()) {
return s;
}
// We only ignore error type `Incomplete` since it's by design that we
// disallow table when it's not in table cache.
if (!s.IsIncomplete()) {
return s;
}
// 2. Table is not present in table cache, we'll read the table properties
// directly from the properties block in the file.
std::unique_ptr<RandomAccessFile> file;
std::string file_name;
if (fname != nullptr) {
file_name = *fname;
} else {
file_name =
TableFileName(ioptions->cf_paths, file_meta->fd.GetNumber(),
file_meta->fd.GetPathId());
}
s = ioptions->env->NewRandomAccessFile(file_name, &file, env_options_);
if (!s.ok()) {
return s;
}
TableProperties* raw_table_properties;
// By setting the magic number to kInvalidTableMagicNumber, we can by
// pass the magic number check in the footer.
std::unique_ptr<RandomAccessFileReader> file_reader(
new RandomAccessFileReader(
std::move(file), file_name, nullptr /* env */, nullptr /* stats */,
0 /* hist_type */, nullptr /* file_read_hist */,
nullptr /* rate_limiter */, ioptions->listeners));
s = ReadTableProperties(
file_reader.get(), file_meta->fd.GetFileSize(),
Footer::kInvalidTableMagicNumber /* table's magic number */, *ioptions,
&raw_table_properties, false /* compression_type_missing */);
if (!s.ok()) {
return s;
}
RecordTick(ioptions->statistics, NUMBER_DIRECT_LOAD_TABLE_PROPERTIES);
*tp = std::shared_ptr<const TableProperties>(raw_table_properties);
return s;
}
Status Version::GetPropertiesOfAllTables(TablePropertiesCollection* props) {
Status s;
for (int level = 0; level < storage_info_.num_levels_; level++) {
s = GetPropertiesOfAllTables(props, level);
if (!s.ok()) {
return s;
}
}
return Status::OK();
}
Status Version::TablesRangeTombstoneSummary(int max_entries_to_print,
std::string* out_str) {
if (max_entries_to_print <= 0) {
return Status::OK();
}
int num_entries_left = max_entries_to_print;
std::stringstream ss;
for (int level = 0; level < storage_info_.num_levels_; level++) {
for (const auto& file_meta : storage_info_.files_[level]) {
auto fname =
TableFileName(cfd_->ioptions()->cf_paths, file_meta->fd.GetNumber(),
file_meta->fd.GetPathId());
ss << "=== file : " << fname << " ===\n";
TableCache* table_cache = cfd_->table_cache();
std::unique_ptr<FragmentedRangeTombstoneIterator> tombstone_iter;
Status s = table_cache->GetRangeTombstoneIterator(
ReadOptions(), cfd_->internal_comparator(), *file_meta,
&tombstone_iter);
if (!s.ok()) {
return s;
}
if (tombstone_iter) {
tombstone_iter->SeekToFirst();
while (tombstone_iter->Valid() && num_entries_left > 0) {
ss << "start: " << tombstone_iter->start_key().ToString(true)
<< " end: " << tombstone_iter->end_key().ToString(true)
<< " seq: " << tombstone_iter->seq() << '\n';
tombstone_iter->Next();
num_entries_left--;
}
if (num_entries_left <= 0) {
break;
}
}
}
if (num_entries_left <= 0) {
break;
}
}
assert(num_entries_left >= 0);
if (num_entries_left <= 0) {
ss << "(results may not be complete)\n";
}
*out_str = ss.str();
return Status::OK();
}
Status Version::GetPropertiesOfAllTables(TablePropertiesCollection* props,
int level) {
for (const auto& file_meta : storage_info_.files_[level]) {
auto fname =
TableFileName(cfd_->ioptions()->cf_paths, file_meta->fd.GetNumber(),
file_meta->fd.GetPathId());
// 1. If the table is already present in table cache, load table
// properties from there.
std::shared_ptr<const TableProperties> table_properties;
Status s = GetTableProperties(&table_properties, file_meta, &fname);
if (s.ok()) {
props->insert({fname, table_properties});
} else {
return s;
}
}
return Status::OK();
}
Status Version::GetPropertiesOfTablesInRange(
const Range* range, std::size_t n, TablePropertiesCollection* props) const {
for (int level = 0; level < storage_info_.num_non_empty_levels(); level++) {
for (decltype(n) i = 0; i < n; i++) {
// Convert user_key into a corresponding internal key.
InternalKey k1(range[i].start, kMaxSequenceNumber, kValueTypeForSeek);
InternalKey k2(range[i].limit, kMaxSequenceNumber, kValueTypeForSeek);
std::vector<FileMetaData*> files;
storage_info_.GetOverlappingInputs(level, &k1, &k2, &files, -1, nullptr,
false);
for (const auto& file_meta : files) {
auto fname =
TableFileName(cfd_->ioptions()->cf_paths,
file_meta->fd.GetNumber(), file_meta->fd.GetPathId());
if (props->count(fname) == 0) {
// 1. If the table is already present in table cache, load table
// properties from there.
std::shared_ptr<const TableProperties> table_properties;
Status s = GetTableProperties(&table_properties, file_meta, &fname);
if (s.ok()) {
props->insert({fname, table_properties});
} else {
return s;
}
}
}
}
}
return Status::OK();
}
Status Version::GetAggregatedTableProperties(
std::shared_ptr<const TableProperties>* tp, int level) {
TablePropertiesCollection props;
Status s;
if (level < 0) {
s = GetPropertiesOfAllTables(&props);
} else {
s = GetPropertiesOfAllTables(&props, level);
}
if (!s.ok()) {
return s;
}
auto* new_tp = new TableProperties();
for (const auto& item : props) {
new_tp->Add(*item.second);
}
tp->reset(new_tp);
return Status::OK();
}
size_t Version::GetMemoryUsageByTableReaders() {
size_t total_usage = 0;
for (auto& file_level : storage_info_.level_files_brief_) {
for (size_t i = 0; i < file_level.num_files; i++) {
total_usage += cfd_->table_cache()->GetMemoryUsageByTableReader(
env_options_, cfd_->internal_comparator(), file_level.files[i].fd,
mutable_cf_options_.prefix_extractor.get());
}
}
return total_usage;
}
void Version::GetColumnFamilyMetaData(ColumnFamilyMetaData* cf_meta) {
assert(cf_meta);
assert(cfd_);
cf_meta->name = cfd_->GetName();
cf_meta->size = 0;
cf_meta->file_count = 0;
cf_meta->levels.clear();
auto* ioptions = cfd_->ioptions();
auto* vstorage = storage_info();
for (int level = 0; level < cfd_->NumberLevels(); level++) {
uint64_t level_size = 0;
cf_meta->file_count += vstorage->LevelFiles(level).size();
std::vector<SstFileMetaData> files;
for (const auto& file : vstorage->LevelFiles(level)) {
uint32_t path_id = file->fd.GetPathId();
std::string file_path;
if (path_id < ioptions->cf_paths.size()) {
file_path = ioptions->cf_paths[path_id].path;
} else {
assert(!ioptions->cf_paths.empty());
file_path = ioptions->cf_paths.back().path;
}
files.emplace_back(SstFileMetaData{
MakeTableFileName("", file->fd.GetNumber()),
file_path,
static_cast<size_t>(file->fd.GetFileSize()),
file->fd.smallest_seqno,
file->fd.largest_seqno,
file->smallest.user_key().ToString(),
file->largest.user_key().ToString(),
file->stats.num_reads_sampled.load(std::memory_order_relaxed),
file->being_compacted});
files.back().num_entries = file->num_entries;
files.back().num_deletions = file->num_deletions;
level_size += file->fd.GetFileSize();
}
cf_meta->levels.emplace_back(
level, level_size, std::move(files));
cf_meta->size += level_size;
}
}
uint64_t Version::GetSstFilesSize() {
uint64_t sst_files_size = 0;
for (int level = 0; level < storage_info_.num_levels_; level++) {
for (const auto& file_meta : storage_info_.LevelFiles(level)) {
sst_files_size += file_meta->fd.GetFileSize();
}
}
return sst_files_size;
}
uint64_t VersionStorageInfo::GetEstimatedActiveKeys() const {
// Estimation will be inaccurate when:
// (1) there exist merge keys
// (2) keys are directly overwritten
// (3) deletion on non-existing keys
// (4) low number of samples
if (current_num_samples_ == 0) {
return 0;
}
if (current_num_non_deletions_ <= current_num_deletions_) {
return 0;
}
uint64_t est = current_num_non_deletions_ - current_num_deletions_;
uint64_t file_count = 0;
for (int level = 0; level < num_levels_; ++level) {
file_count += files_[level].size();
}
if (current_num_samples_ < file_count) {
// casting to avoid overflowing
return
static_cast<uint64_t>(
(est * static_cast<double>(file_count) / current_num_samples_)
);
} else {
return est;
}
}
double VersionStorageInfo::GetEstimatedCompressionRatioAtLevel(
int level) const {
assert(level < num_levels_);
uint64_t sum_file_size_bytes = 0;
uint64_t sum_data_size_bytes = 0;
for (auto* file_meta : files_[level]) {
sum_file_size_bytes += file_meta->fd.GetFileSize();
sum_data_size_bytes += file_meta->raw_key_size + file_meta->raw_value_size;
}
if (sum_file_size_bytes == 0) {
return -1.0;
}
return static_cast<double>(sum_data_size_bytes) / sum_file_size_bytes;
}
void Version::AddIterators(const ReadOptions& read_options,
const EnvOptions& soptions,
MergeIteratorBuilder* merge_iter_builder,
RangeDelAggregator* range_del_agg) {
assert(storage_info_.finalized_);
for (int level = 0; level < storage_info_.num_non_empty_levels(); level++) {
AddIteratorsForLevel(read_options, soptions, merge_iter_builder, level,
range_del_agg);
}
}
void Version::AddIteratorsForLevel(const ReadOptions& read_options,
const EnvOptions& soptions,
MergeIteratorBuilder* merge_iter_builder,
int level,
RangeDelAggregator* range_del_agg) {
assert(storage_info_.finalized_);
if (level >= storage_info_.num_non_empty_levels()) {
// This is an empty level
return;
} else if (storage_info_.LevelFilesBrief(level).num_files == 0) {
// No files in this level
return;
}
bool should_sample = should_sample_file_read();
auto* arena = merge_iter_builder->GetArena();
if (level == 0) {
// Merge all level zero files together since they may overlap
for (size_t i = 0; i < storage_info_.LevelFilesBrief(0).num_files; i++) {
const auto& file = storage_info_.LevelFilesBrief(0).files[i];
merge_iter_builder->AddIterator(cfd_->table_cache()->NewIterator(
read_options, soptions, cfd_->internal_comparator(),
*file.file_metadata, range_del_agg,
mutable_cf_options_.prefix_extractor.get(), nullptr,
cfd_->internal_stats()->GetFileReadHist(0),
TableReaderCaller::kUserIterator, arena,
/*skip_filters=*/false, /*level=*/0,
/*smallest_compaction_key=*/nullptr,
/*largest_compaction_key=*/nullptr));
}
if (should_sample) {
// Count ones for every L0 files. This is done per iterator creation
// rather than Seek(), while files in other levels are recored per seek.
// If users execute one range query per iterator, there may be some
// discrepancy here.
for (FileMetaData* meta : storage_info_.LevelFiles(0)) {
sample_file_read_inc(meta);
}
}
} else if (storage_info_.LevelFilesBrief(level).num_files > 0) {
// For levels > 0, we can use a concatenating iterator that sequentially
// walks through the non-overlapping files in the level, opening them
// lazily.
auto* mem = arena->AllocateAligned(sizeof(LevelIterator));
merge_iter_builder->AddIterator(new (mem) LevelIterator(
cfd_->table_cache(), read_options, soptions,
cfd_->internal_comparator(), &storage_info_.LevelFilesBrief(level),
mutable_cf_options_.prefix_extractor.get(), should_sample_file_read(),
cfd_->internal_stats()->GetFileReadHist(level),
TableReaderCaller::kUserIterator, IsFilterSkipped(level), level,
range_del_agg, /*largest_compaction_key=*/nullptr));
}
}
Status Version::OverlapWithLevelIterator(const ReadOptions& read_options,
const EnvOptions& env_options,
const Slice& smallest_user_key,
const Slice& largest_user_key,
int level, bool* overlap) {
assert(storage_info_.finalized_);
auto icmp = cfd_->internal_comparator();
auto ucmp = icmp.user_comparator();
Arena arena;
Status status;
ReadRangeDelAggregator range_del_agg(&icmp,
kMaxSequenceNumber /* upper_bound */);
*overlap = false;
if (level == 0) {
for (size_t i = 0; i < storage_info_.LevelFilesBrief(0).num_files; i++) {
const auto file = &storage_info_.LevelFilesBrief(0).files[i];
if (AfterFile(ucmp, &smallest_user_key, file) ||
BeforeFile(ucmp, &largest_user_key, file)) {
continue;
}
ScopedArenaIterator iter(cfd_->table_cache()->NewIterator(
read_options, env_options, cfd_->internal_comparator(),
*file->file_metadata, &range_del_agg,
mutable_cf_options_.prefix_extractor.get(), nullptr,
cfd_->internal_stats()->GetFileReadHist(0),
TableReaderCaller::kUserIterator, &arena,
/*skip_filters=*/false, /*level=*/0,
/*smallest_compaction_key=*/nullptr,
/*largest_compaction_key=*/nullptr));
status = OverlapWithIterator(
ucmp, smallest_user_key, largest_user_key, iter.get(), overlap);
if (!status.ok() || *overlap) {
break;
}
}
} else if (storage_info_.LevelFilesBrief(level).num_files > 0) {
auto mem = arena.AllocateAligned(sizeof(LevelIterator));
ScopedArenaIterator iter(new (mem) LevelIterator(
cfd_->table_cache(), read_options, env_options,
cfd_->internal_comparator(), &storage_info_.LevelFilesBrief(level),
mutable_cf_options_.prefix_extractor.get(), should_sample_file_read(),
cfd_->internal_stats()->GetFileReadHist(level),
TableReaderCaller::kUserIterator, IsFilterSkipped(level), level,
&range_del_agg));
status = OverlapWithIterator(
ucmp, smallest_user_key, largest_user_key, iter.get(), overlap);
}
if (status.ok() && *overlap == false &&
range_del_agg.IsRangeOverlapped(smallest_user_key, largest_user_key)) {
*overlap = true;
}
return status;
}
VersionStorageInfo::VersionStorageInfo(
const InternalKeyComparator* internal_comparator,
const Comparator* user_comparator, int levels,
CompactionStyle compaction_style, VersionStorageInfo* ref_vstorage,
bool _force_consistency_checks)
: internal_comparator_(internal_comparator),
user_comparator_(user_comparator),
// cfd is nullptr if Version is dummy
num_levels_(levels),
num_non_empty_levels_(0),
file_indexer_(user_comparator),
compaction_style_(compaction_style),
files_(new std::vector<FileMetaData*>[num_levels_]),
base_level_(num_levels_ == 1 ? -1 : 1),
level_multiplier_(0.0),
files_by_compaction_pri_(num_levels_),
level0_non_overlapping_(false),
next_file_to_compact_by_size_(num_levels_),
compaction_score_(num_levels_),
compaction_level_(num_levels_),
l0_delay_trigger_count_(0),
accumulated_file_size_(0),
accumulated_raw_key_size_(0),
accumulated_raw_value_size_(0),
accumulated_num_non_deletions_(0),
accumulated_num_deletions_(0),
current_num_non_deletions_(0),
current_num_deletions_(0),
current_num_samples_(0),
estimated_compaction_needed_bytes_(0),
finalized_(false),
force_consistency_checks_(_force_consistency_checks) {
if (ref_vstorage != nullptr) {
accumulated_file_size_ = ref_vstorage->accumulated_file_size_;
accumulated_raw_key_size_ = ref_vstorage->accumulated_raw_key_size_;
accumulated_raw_value_size_ = ref_vstorage->accumulated_raw_value_size_;
accumulated_num_non_deletions_ =
ref_vstorage->accumulated_num_non_deletions_;
accumulated_num_deletions_ = ref_vstorage->accumulated_num_deletions_;
current_num_non_deletions_ = ref_vstorage->current_num_non_deletions_;
current_num_deletions_ = ref_vstorage->current_num_deletions_;
current_num_samples_ = ref_vstorage->current_num_samples_;
oldest_snapshot_seqnum_ = ref_vstorage->oldest_snapshot_seqnum_;
}
}
Version::Version(ColumnFamilyData* column_family_data, VersionSet* vset,
const EnvOptions& env_opt,
const MutableCFOptions mutable_cf_options,
uint64_t version_number)
: env_(vset->env_),
cfd_(column_family_data),
info_log_((cfd_ == nullptr) ? nullptr : cfd_->ioptions()->info_log),
db_statistics_((cfd_ == nullptr) ? nullptr
: cfd_->ioptions()->statistics),
table_cache_((cfd_ == nullptr) ? nullptr : cfd_->table_cache()),
merge_operator_((cfd_ == nullptr) ? nullptr
: cfd_->ioptions()->merge_operator),
storage_info_(
(cfd_ == nullptr) ? nullptr : &cfd_->internal_comparator(),
(cfd_ == nullptr) ? nullptr : cfd_->user_comparator(),
cfd_ == nullptr ? 0 : cfd_->NumberLevels(),
cfd_ == nullptr ? kCompactionStyleLevel
: cfd_->ioptions()->compaction_style,
(cfd_ == nullptr || cfd_->current() == nullptr)
? nullptr
: cfd_->current()->storage_info(),
cfd_ == nullptr ? false : cfd_->ioptions()->force_consistency_checks),
vset_(vset),
next_(this),
prev_(this),
refs_(0),
env_options_(env_opt),
mutable_cf_options_(mutable_cf_options),
version_number_(version_number) {}
void Version::Get(const ReadOptions& read_options, const LookupKey& k,
PinnableSlice* value, Status* status,
MergeContext* merge_context,
SequenceNumber* max_covering_tombstone_seq, bool* value_found,
bool* key_exists, SequenceNumber* seq, ReadCallback* callback,
bool* is_blob, bool do_merge) {
Slice ikey = k.internal_key();
Slice user_key = k.user_key();
assert(status->ok() || status->IsMergeInProgress());
if (key_exists != nullptr) {
// will falsify below if not found
*key_exists = true;
}
PinnedIteratorsManager pinned_iters_mgr;
uint64_t tracing_get_id = BlockCacheTraceHelper::kReservedGetId;
if (vset_ && vset_->block_cache_tracer_ &&
vset_->block_cache_tracer_->is_tracing_enabled()) {
tracing_get_id = vset_->block_cache_tracer_->NextGetId();
}
GetContext get_context(
user_comparator(), merge_operator_, info_log_, db_statistics_,
status->ok() ? GetContext::kNotFound : GetContext::kMerge, user_key,
do_merge ? value : nullptr, value_found, merge_context, do_merge,
max_covering_tombstone_seq, this->env_, seq,
merge_operator_ ? &pinned_iters_mgr : nullptr, callback, is_blob,
tracing_get_id);
// Pin blocks that we read to hold merge operands
if (merge_operator_) {
pinned_iters_mgr.StartPinning();
}
FilePicker fp(
storage_info_.files_, user_key, ikey, &storage_info_.level_files_brief_,
storage_info_.num_non_empty_levels_, &storage_info_.file_indexer_,
user_comparator(), internal_comparator());
FdWithKeyRange* f = fp.GetNextFile();
while (f != nullptr) {
if (*max_covering_tombstone_seq > 0) {
// The remaining files we look at will only contain covered keys, so we
// stop here.
break;
}
if (get_context.sample()) {
sample_file_read_inc(f->file_metadata);
}
bool timer_enabled =
GetPerfLevel() >= PerfLevel::kEnableTimeExceptForMutex &&
get_perf_context()->per_level_perf_context_enabled;
StopWatchNano timer(env_, timer_enabled /* auto_start */);
*status = table_cache_->Get(
read_options, *internal_comparator(), *f->file_metadata, ikey,
&get_context, mutable_cf_options_.prefix_extractor.get(),
cfd_->internal_stats()->GetFileReadHist(fp.GetHitFileLevel()),
IsFilterSkipped(static_cast<int>(fp.GetHitFileLevel()),
fp.IsHitFileLastInLevel()),
fp.GetCurrentLevel());
// TODO: examine the behavior for corrupted key
if (timer_enabled) {
PERF_COUNTER_BY_LEVEL_ADD(get_from_table_nanos, timer.ElapsedNanos(),
fp.GetCurrentLevel());
}
if (!status->ok()) {
return;
}
// report the counters before returning
if (get_context.State() != GetContext::kNotFound &&
get_context.State() != GetContext::kMerge &&
db_statistics_ != nullptr) {
get_context.ReportCounters();
}
switch (get_context.State()) {
case GetContext::kNotFound:
// Keep searching in other files
break;
case GetContext::kMerge:
// TODO: update per-level perfcontext user_key_return_count for kMerge
break;
case GetContext::kFound:
if (fp.GetHitFileLevel() == 0) {
RecordTick(db_statistics_, GET_HIT_L0);
} else if (fp.GetHitFileLevel() == 1) {
RecordTick(db_statistics_, GET_HIT_L1);
} else if (fp.GetHitFileLevel() >= 2) {
RecordTick(db_statistics_, GET_HIT_L2_AND_UP);
}
PERF_COUNTER_BY_LEVEL_ADD(user_key_return_count, 1,
fp.GetHitFileLevel());
return;
case GetContext::kDeleted:
// Use empty error message for speed
*status = Status::NotFound();
return;
case GetContext::kCorrupt:
*status = Status::Corruption("corrupted key for ", user_key);
return;
case GetContext::kBlobIndex:
ROCKS_LOG_ERROR(info_log_, "Encounter unexpected blob index.");
*status = Status::NotSupported(
"Encounter unexpected blob index. Please open DB with "
"rocksdb::blob_db::BlobDB instead.");
return;
}
f = fp.GetNextFile();
}
if (db_statistics_ != nullptr) {
get_context.ReportCounters();
}
if (GetContext::kMerge == get_context.State()) {
if (!do_merge) {
*status = Status::OK();
return;
}
if (!merge_operator_) {
*status = Status::InvalidArgument(
"merge_operator is not properly initialized.");
return;
}
// merge_operands are in saver and we hit the beginning of the key history
// do a final merge of nullptr and operands;
std::string* str_value = value != nullptr ? value->GetSelf() : nullptr;
*status = MergeHelper::TimedFullMerge(
merge_operator_, user_key, nullptr, merge_context->GetOperands(),
str_value, info_log_, db_statistics_, env_,
nullptr /* result_operand */, true);
if (LIKELY(value != nullptr)) {
value->PinSelf();
}
} else {
if (key_exists != nullptr) {
*key_exists = false;
}
*status = Status::NotFound(); // Use an empty error message for speed
}
}
void Version::MultiGet(const ReadOptions& read_options, MultiGetRange* range,
ReadCallback* callback, bool* is_blob) {
PinnedIteratorsManager pinned_iters_mgr;
// Pin blocks that we read to hold merge operands
if (merge_operator_) {
pinned_iters_mgr.StartPinning();
}
uint64_t tracing_mget_id = BlockCacheTraceHelper::kReservedGetId;
if (vset_ && vset_->block_cache_tracer_ &&
vset_->block_cache_tracer_->is_tracing_enabled()) {
tracing_mget_id = vset_->block_cache_tracer_->NextGetId();
}
// Even though we know the batch size won't be > MAX_BATCH_SIZE,
// use autovector in order to avoid unnecessary construction of GetContext
// objects, which is expensive
autovector<GetContext, 16> get_ctx;
for (auto iter = range->begin(); iter != range->end(); ++iter) {
assert(iter->s->ok() || iter->s->IsMergeInProgress());
get_ctx.emplace_back(
user_comparator(), merge_operator_, info_log_, db_statistics_,
iter->s->ok() ? GetContext::kNotFound : GetContext::kMerge, iter->ukey,
iter->value, nullptr, &(iter->merge_context), true,
&iter->max_covering_tombstone_seq, this->env_, nullptr,
merge_operator_ ? &pinned_iters_mgr : nullptr, callback, is_blob,
tracing_mget_id);
}
int get_ctx_index = 0;
for (auto iter = range->begin(); iter != range->end();
++iter, get_ctx_index++) {
iter->get_context = &(get_ctx[get_ctx_index]);
}
MultiGetRange file_picker_range(*range, range->begin(), range->end());
FilePickerMultiGet fp(
&file_picker_range,
&storage_info_.level_files_brief_, storage_info_.num_non_empty_levels_,
&storage_info_.file_indexer_, user_comparator(), internal_comparator());
FdWithKeyRange* f = fp.GetNextFile();
while (f != nullptr) {
MultiGetRange file_range = fp.CurrentFileRange();
bool timer_enabled =
GetPerfLevel() >= PerfLevel::kEnableTimeExceptForMutex &&
get_perf_context()->per_level_perf_context_enabled;
StopWatchNano timer(env_, timer_enabled /* auto_start */);
Status s = table_cache_->MultiGet(
read_options, *internal_comparator(), *f->file_metadata, &file_range,
mutable_cf_options_.prefix_extractor.get(),
cfd_->internal_stats()->GetFileReadHist(fp.GetHitFileLevel()),
IsFilterSkipped(static_cast<int>(fp.GetHitFileLevel()),
fp.IsHitFileLastInLevel()),
fp.GetCurrentLevel());
// TODO: examine the behavior for corrupted key
if (timer_enabled) {
PERF_COUNTER_BY_LEVEL_ADD(get_from_table_nanos, timer.ElapsedNanos(),
fp.GetCurrentLevel());
}
if (!s.ok()) {
// TODO: Set status for individual keys appropriately
for (auto iter = file_range.begin(); iter != file_range.end(); ++iter) {
*iter->s = s;
file_range.MarkKeyDone(iter);
}
return;
}
uint64_t batch_size = 0;
for (auto iter = file_range.begin(); iter != file_range.end(); ++iter) {
GetContext& get_context = *iter->get_context;
Status* status = iter->s;
if (get_context.sample()) {
sample_file_read_inc(f->file_metadata);
}
batch_size++;
// report the counters before returning
if (get_context.State() != GetContext::kNotFound &&
get_context.State() != GetContext::kMerge &&
db_statistics_ != nullptr) {
get_context.ReportCounters();
} else {
if (iter->max_covering_tombstone_seq > 0) {
// The remaining files we look at will only contain covered keys, so
// we stop here for this key
file_picker_range.SkipKey(iter);
}
}
switch (get_context.State()) {
case GetContext::kNotFound:
// Keep searching in other files
break;
case GetContext::kMerge:
// TODO: update per-level perfcontext user_key_return_count for kMerge
break;
case GetContext::kFound:
if (fp.GetHitFileLevel() == 0) {
RecordTick(db_statistics_, GET_HIT_L0);
} else if (fp.GetHitFileLevel() == 1) {
RecordTick(db_statistics_, GET_HIT_L1);
} else if (fp.GetHitFileLevel() >= 2) {
RecordTick(db_statistics_, GET_HIT_L2_AND_UP);
}
PERF_COUNTER_BY_LEVEL_ADD(user_key_return_count, 1,
fp.GetHitFileLevel());
file_range.MarkKeyDone(iter);
continue;
case GetContext::kDeleted:
// Use empty error message for speed
*status = Status::NotFound();
file_range.MarkKeyDone(iter);
continue;
case GetContext::kCorrupt:
*status =
Status::Corruption("corrupted key for ", iter->lkey->user_key());
file_range.MarkKeyDone(iter);
continue;
case GetContext::kBlobIndex:
ROCKS_LOG_ERROR(info_log_, "Encounter unexpected blob index.");
*status = Status::NotSupported(
"Encounter unexpected blob index. Please open DB with "
"rocksdb::blob_db::BlobDB instead.");
file_range.MarkKeyDone(iter);
continue;
}
}
RecordInHistogram(db_statistics_, SST_BATCH_SIZE, batch_size);
if (file_picker_range.empty()) {
break;
}
f = fp.GetNextFile();
}
// Process any left over keys
for (auto iter = range->begin(); iter != range->end(); ++iter) {
GetContext& get_context = *iter->get_context;
Status* status = iter->s;
Slice user_key = iter->lkey->user_key();
if (db_statistics_ != nullptr) {
get_context.ReportCounters();
}
if (GetContext::kMerge == get_context.State()) {
if (!merge_operator_) {
*status = Status::InvalidArgument(
"merge_operator is not properly initialized.");
range->MarkKeyDone(iter);
continue;
}
// merge_operands are in saver and we hit the beginning of the key history
// do a final merge of nullptr and operands;
std::string* str_value =
iter->value != nullptr ? iter->value->GetSelf() : nullptr;
*status = MergeHelper::TimedFullMerge(
merge_operator_, user_key, nullptr, iter->merge_context.GetOperands(),
str_value, info_log_, db_statistics_, env_,
nullptr /* result_operand */, true);
if (LIKELY(iter->value != nullptr)) {
iter->value->PinSelf();
}
} else {
range->MarkKeyDone(iter);
*status = Status::NotFound(); // Use an empty error message for speed
}
}
}
bool Version::IsFilterSkipped(int level, bool is_file_last_in_level) {
// Reaching the bottom level implies misses at all upper levels, so we'll
// skip checking the filters when we predict a hit.
return cfd_->ioptions()->optimize_filters_for_hits &&
(level > 0 || is_file_last_in_level) &&
level == storage_info_.num_non_empty_levels() - 1;
}
void VersionStorageInfo::GenerateLevelFilesBrief() {
level_files_brief_.resize(num_non_empty_levels_);
for (int level = 0; level < num_non_empty_levels_; level++) {
DoGenerateLevelFilesBrief(
&level_files_brief_[level], files_[level], &arena_);
}
}
void Version::PrepareApply(
const MutableCFOptions& mutable_cf_options,
bool update_stats) {
UpdateAccumulatedStats(update_stats);
storage_info_.UpdateNumNonEmptyLevels();
storage_info_.CalculateBaseBytes(*cfd_->ioptions(), mutable_cf_options);
storage_info_.UpdateFilesByCompactionPri(cfd_->ioptions()->compaction_pri);
storage_info_.GenerateFileIndexer();
storage_info_.GenerateLevelFilesBrief();
storage_info_.GenerateLevel0NonOverlapping();
storage_info_.GenerateBottommostFiles();
}
bool Version::MaybeInitializeFileMetaData(FileMetaData* file_meta) {
if (file_meta->init_stats_from_file ||
file_meta->compensated_file_size > 0) {
return false;
}
std::shared_ptr<const TableProperties> tp;
Status s = GetTableProperties(&tp, file_meta);
file_meta->init_stats_from_file = true;
if (!s.ok()) {
ROCKS_LOG_ERROR(vset_->db_options_->info_log,
"Unable to load table properties for file %" PRIu64
" --- %s\n",
file_meta->fd.GetNumber(), s.ToString().c_str());
return false;
}
if (tp.get() == nullptr) return false;
file_meta->num_entries = tp->num_entries;
file_meta->num_deletions = tp->num_deletions;
file_meta->raw_value_size = tp->raw_value_size;
file_meta->raw_key_size = tp->raw_key_size;
return true;
}
void VersionStorageInfo::UpdateAccumulatedStats(FileMetaData* file_meta) {
assert(file_meta->init_stats_from_file);
accumulated_file_size_ += file_meta->fd.GetFileSize();
accumulated_raw_key_size_ += file_meta->raw_key_size;
accumulated_raw_value_size_ += file_meta->raw_value_size;
accumulated_num_non_deletions_ +=
file_meta->num_entries - file_meta->num_deletions;
accumulated_num_deletions_ += file_meta->num_deletions;
current_num_non_deletions_ +=
file_meta->num_entries - file_meta->num_deletions;
current_num_deletions_ += file_meta->num_deletions;
current_num_samples_++;
}
void VersionStorageInfo::RemoveCurrentStats(FileMetaData* file_meta) {
if (file_meta->init_stats_from_file) {
current_num_non_deletions_ -=
file_meta->num_entries - file_meta->num_deletions;
current_num_deletions_ -= file_meta->num_deletions;
current_num_samples_--;
}
}
void Version::UpdateAccumulatedStats(bool update_stats) {
if (update_stats) {
// maximum number of table properties loaded from files.
const int kMaxInitCount = 20;
int init_count = 0;
// here only the first kMaxInitCount files which haven't been
// initialized from file will be updated with num_deletions.
// The motivation here is to cap the maximum I/O per Version creation.
// The reason for choosing files from lower-level instead of higher-level
// is that such design is able to propagate the initialization from
// lower-level to higher-level: When the num_deletions of lower-level
// files are updated, it will make the lower-level files have accurate
// compensated_file_size, making lower-level to higher-level compaction
// will be triggered, which creates higher-level files whose num_deletions
// will be updated here.
for (int level = 0;
level < storage_info_.num_levels_ && init_count < kMaxInitCount;
++level) {
for (auto* file_meta : storage_info_.files_[level]) {
if (MaybeInitializeFileMetaData(file_meta)) {
// each FileMeta will be initialized only once.
storage_info_.UpdateAccumulatedStats(file_meta);
// when option "max_open_files" is -1, all the file metadata has
// already been read, so MaybeInitializeFileMetaData() won't incur
// any I/O cost. "max_open_files=-1" means that the table cache passed
// to the VersionSet and then to the ColumnFamilySet has a size of
// TableCache::kInfiniteCapacity
if (vset_->GetColumnFamilySet()->get_table_cache()->GetCapacity() ==
TableCache::kInfiniteCapacity) {
continue;
}
if (++init_count >= kMaxInitCount) {
break;
}
}
}
}
// In case all sampled-files contain only deletion entries, then we
// load the table-property of a file in higher-level to initialize
// that value.
for (int level = storage_info_.num_levels_ - 1;
storage_info_.accumulated_raw_value_size_ == 0 && level >= 0;
--level) {
for (int i = static_cast<int>(storage_info_.files_[level].size()) - 1;
storage_info_.accumulated_raw_value_size_ == 0 && i >= 0; --i) {
if (MaybeInitializeFileMetaData(storage_info_.files_[level][i])) {
storage_info_.UpdateAccumulatedStats(storage_info_.files_[level][i]);
}
}
}
}
storage_info_.ComputeCompensatedSizes();
}
void VersionStorageInfo::ComputeCompensatedSizes() {
static const int kDeletionWeightOnCompaction = 2;
uint64_t average_value_size = GetAverageValueSize();
// compute the compensated size
for (int level = 0; level < num_levels_; level++) {
for (auto* file_meta : files_[level]) {
// Here we only compute compensated_file_size for those file_meta
// which compensated_file_size is uninitialized (== 0). This is true only
// for files that have been created right now and no other thread has
// access to them. That's why we can safely mutate compensated_file_size.
if (file_meta->compensated_file_size == 0) {
file_meta->compensated_file_size = file_meta->fd.GetFileSize();
// Here we only boost the size of deletion entries of a file only
// when the number of deletion entries is greater than the number of
// non-deletion entries in the file. The motivation here is that in
// a stable workload, the number of deletion entries should be roughly
// equal to the number of non-deletion entries. If we compensate the
// size of deletion entries in a stable workload, the deletion
// compensation logic might introduce unwanted effet which changes the
// shape of LSM tree.
if (file_meta->num_deletions * 2 >= file_meta->num_entries) {
file_meta->compensated_file_size +=
(file_meta->num_deletions * 2 - file_meta->num_entries) *
average_value_size * kDeletionWeightOnCompaction;
}
}
}
}
}
int VersionStorageInfo::MaxInputLevel() const {
if (compaction_style_ == kCompactionStyleLevel) {
return num_levels() - 2;
}
return 0;
}
int VersionStorageInfo::MaxOutputLevel(bool allow_ingest_behind) const {
if (allow_ingest_behind) {
assert(num_levels() > 1);
return num_levels() - 2;
}
return num_levels() - 1;
}
void VersionStorageInfo::EstimateCompactionBytesNeeded(
const MutableCFOptions& mutable_cf_options) {
// Only implemented for level-based compaction
if (compaction_style_ != kCompactionStyleLevel) {
estimated_compaction_needed_bytes_ = 0;
return;
}
// Start from Level 0, if level 0 qualifies compaction to level 1,
// we estimate the size of compaction.
// Then we move on to the next level and see whether it qualifies compaction
// to the next level. The size of the level is estimated as the actual size
// on the level plus the input bytes from the previous level if there is any.
// If it exceeds, take the exceeded bytes as compaction input and add the size
// of the compaction size to tatal size.
// We keep doing it to Level 2, 3, etc, until the last level and return the
// accumulated bytes.
uint64_t bytes_compact_to_next_level = 0;
uint64_t level_size = 0;
for (auto* f : files_[0]) {
level_size += f->fd.GetFileSize();
}
// Level 0
bool level0_compact_triggered = false;
if (static_cast<int>(files_[0].size()) >=
mutable_cf_options.level0_file_num_compaction_trigger ||
level_size >= mutable_cf_options.max_bytes_for_level_base) {
level0_compact_triggered = true;
estimated_compaction_needed_bytes_ = level_size;
bytes_compact_to_next_level = level_size;
} else {
estimated_compaction_needed_bytes_ = 0;
}
// Level 1 and up.
uint64_t bytes_next_level = 0;
for (int level = base_level(); level <= MaxInputLevel(); level++) {
level_size = 0;
if (bytes_next_level > 0) {
#ifndef NDEBUG
uint64_t level_size2 = 0;
for (auto* f : files_[level]) {
level_size2 += f->fd.GetFileSize();
}
assert(level_size2 == bytes_next_level);
#endif
level_size = bytes_next_level;
bytes_next_level = 0;
} else {
for (auto* f : files_[level]) {
level_size += f->fd.GetFileSize();
}
}
if (level == base_level() && level0_compact_triggered) {
// Add base level size to compaction if level0 compaction triggered.
estimated_compaction_needed_bytes_ += level_size;
}
// Add size added by previous compaction
level_size += bytes_compact_to_next_level;
bytes_compact_to_next_level = 0;
uint64_t level_target = MaxBytesForLevel(level);
if (level_size > level_target) {
bytes_compact_to_next_level = level_size - level_target;
// Estimate the actual compaction fan-out ratio as size ratio between
// the two levels.
assert(bytes_next_level == 0);
if (level + 1 < num_levels_) {
for (auto* f : files_[level + 1]) {
bytes_next_level += f->fd.GetFileSize();
}
}
if (bytes_next_level > 0) {
assert(level_size > 0);
estimated_compaction_needed_bytes_ += static_cast<uint64_t>(
static_cast<double>(bytes_compact_to_next_level) *
(static_cast<double>(bytes_next_level) /
static_cast<double>(level_size) +
1));
}
}
}
}
namespace {
uint32_t GetExpiredTtlFilesCount(const ImmutableCFOptions& ioptions,
const MutableCFOptions& mutable_cf_options,
const std::vector<FileMetaData*>& files) {
uint32_t ttl_expired_files_count = 0;
int64_t _current_time;
auto status = ioptions.env->GetCurrentTime(&_current_time);
if (status.ok()) {
const uint64_t current_time = static_cast<uint64_t>(_current_time);
for (auto f : files) {
if (!f->being_compacted && f->fd.table_reader != nullptr &&
f->fd.table_reader->GetTableProperties() != nullptr) {
auto creation_time =
f->fd.table_reader->GetTableProperties()->creation_time;
if (creation_time > 0 &&
creation_time < (current_time - mutable_cf_options.ttl)) {
ttl_expired_files_count++;
}
}
}
}
return ttl_expired_files_count;
}
} // anonymous namespace
void VersionStorageInfo::ComputeCompactionScore(
const ImmutableCFOptions& immutable_cf_options,
const MutableCFOptions& mutable_cf_options) {
for (int level = 0; level <= MaxInputLevel(); level++) {
double score;
if (level == 0) {
// We treat level-0 specially by bounding the number of files
// instead of number of bytes for two reasons:
//
// (1) With larger write-buffer sizes, it is nice not to do too
// many level-0 compactions.
//
// (2) The files in level-0 are merged on every read and
// therefore we wish to avoid too many files when the individual
// file size is small (perhaps because of a small write-buffer
// setting, or very high compression ratios, or lots of
// overwrites/deletions).
int num_sorted_runs = 0;
uint64_t total_size = 0;
for (auto* f : files_[level]) {
if (!f->being_compacted) {
total_size += f->compensated_file_size;
num_sorted_runs++;
}
}
if (compaction_style_ == kCompactionStyleUniversal) {
// For universal compaction, we use level0 score to indicate
// compaction score for the whole DB. Adding other levels as if
// they are L0 files.
for (int i = 1; i < num_levels(); i++) {
if (!files_[i].empty() && !files_[i][0]->being_compacted) {
num_sorted_runs++;
}
}
}
if (compaction_style_ == kCompactionStyleFIFO) {
score = static_cast<double>(total_size) /
mutable_cf_options.compaction_options_fifo.max_table_files_size;
if (mutable_cf_options.compaction_options_fifo.allow_compaction) {
score = std::max(
static_cast<double>(num_sorted_runs) /
mutable_cf_options.level0_file_num_compaction_trigger,
score);
}
if (mutable_cf_options.ttl > 0) {
score = std::max(
static_cast<double>(GetExpiredTtlFilesCount(
immutable_cf_options, mutable_cf_options, files_[level])),
score);
}
} else {
score = static_cast<double>(num_sorted_runs) /
mutable_cf_options.level0_file_num_compaction_trigger;
if (compaction_style_ == kCompactionStyleLevel && num_levels() > 1) {
// Level-based involves L0->L0 compactions that can lead to oversized
// L0 files. Take into account size as well to avoid later giant
// compactions to the base level.
score = std::max(
score, static_cast<double>(total_size) /
mutable_cf_options.max_bytes_for_level_base);
}
}
} else {
// Compute the ratio of current size to size limit.
uint64_t level_bytes_no_compacting = 0;
for (auto f : files_[level]) {
if (!f->being_compacted) {
level_bytes_no_compacting += f->compensated_file_size;
}
}
score = static_cast<double>(level_bytes_no_compacting) /
MaxBytesForLevel(level);
}
compaction_level_[level] = level;
compaction_score_[level] = score;
}
// sort all the levels based on their score. Higher scores get listed
// first. Use bubble sort because the number of entries are small.
for (int i = 0; i < num_levels() - 2; i++) {
for (int j = i + 1; j < num_levels() - 1; j++) {
if (compaction_score_[i] < compaction_score_[j]) {
double score = compaction_score_[i];
int level = compaction_level_[i];
compaction_score_[i] = compaction_score_[j];
compaction_level_[i] = compaction_level_[j];
compaction_score_[j] = score;
compaction_level_[j] = level;
}
}
}
ComputeFilesMarkedForCompaction();
ComputeBottommostFilesMarkedForCompaction();
if (mutable_cf_options.ttl > 0) {
ComputeExpiredTtlFiles(immutable_cf_options, mutable_cf_options.ttl);
}
if (mutable_cf_options.periodic_compaction_seconds > 0) {
ComputeFilesMarkedForPeriodicCompaction(
immutable_cf_options, mutable_cf_options.periodic_compaction_seconds);
}
EstimateCompactionBytesNeeded(mutable_cf_options);
}
void VersionStorageInfo::ComputeFilesMarkedForCompaction() {
files_marked_for_compaction_.clear();
int last_qualify_level = 0;
// Do not include files from the last level with data
// If table properties collector suggests a file on the last level,
// we should not move it to a new level.
for (int level = num_levels() - 1; level >= 1; level--) {
if (!files_[level].empty()) {
last_qualify_level = level - 1;
break;
}
}
for (int level = 0; level <= last_qualify_level; level++) {
for (auto* f : files_[level]) {
if (!f->being_compacted && f->marked_for_compaction) {
files_marked_for_compaction_.emplace_back(level, f);
}
}
}
}
void VersionStorageInfo::ComputeExpiredTtlFiles(
const ImmutableCFOptions& ioptions, const uint64_t ttl) {
assert(ttl > 0);
expired_ttl_files_.clear();
int64_t _current_time;
auto status = ioptions.env->GetCurrentTime(&_current_time);
if (!status.ok()) {
return;
}
const uint64_t current_time = static_cast<uint64_t>(_current_time);
for (int level = 0; level < num_levels() - 1; level++) {
for (auto f : files_[level]) {
if (!f->being_compacted && f->fd.table_reader != nullptr &&
f->fd.table_reader->GetTableProperties() != nullptr) {
auto creation_time =
f->fd.table_reader->GetTableProperties()->creation_time;
if (creation_time > 0 && creation_time < (current_time - ttl)) {
expired_ttl_files_.emplace_back(level, f);
}
}
}
}
}
void VersionStorageInfo::ComputeFilesMarkedForPeriodicCompaction(
const ImmutableCFOptions& ioptions,
const uint64_t periodic_compaction_seconds) {
assert(periodic_compaction_seconds > 0);
files_marked_for_periodic_compaction_.clear();
int64_t temp_current_time;
auto status = ioptions.env->GetCurrentTime(&temp_current_time);
if (!status.ok()) {
return;
}
const uint64_t current_time = static_cast<uint64_t>(temp_current_time);
const uint64_t allowed_time_limit =
current_time - periodic_compaction_seconds;
for (int level = 0; level < num_levels(); level++) {
for (auto f : files_[level]) {
if (!f->being_compacted && f->fd.table_reader != nullptr &&
f->fd.table_reader->GetTableProperties() != nullptr) {
// Compute a file's modification time in the following order:
// 1. Use file_creation_time table property if it is > 0.
// 2. Use creation_time table property if it is > 0.
// 3. Use file's mtime metadata if the above two table properties are 0.
// Don't consider the file at all if the modification time cannot be
// correctly determined based on the above conditions.
uint64_t file_modification_time =
f->fd.table_reader->GetTableProperties()->file_creation_time;
if (file_modification_time == 0) {
file_modification_time =
f->fd.table_reader->GetTableProperties()->creation_time;
}
if (file_modification_time == 0) {
auto file_path = TableFileName(ioptions.cf_paths, f->fd.GetNumber(),
f->fd.GetPathId());
status = ioptions.env->GetFileModificationTime(
file_path, &file_modification_time);
if (!status.ok()) {
ROCKS_LOG_WARN(ioptions.info_log,
"Can't get file modification time: %s: %s",
file_path.c_str(), status.ToString().c_str());
continue;
}
}
if (file_modification_time > 0 &&
file_modification_time < allowed_time_limit) {
files_marked_for_periodic_compaction_.emplace_back(level, f);
}
}
}
}
}
namespace {
// used to sort files by size
struct Fsize {
size_t index;
FileMetaData* file;
};
// Compator that is used to sort files based on their size
// In normal mode: descending size
bool CompareCompensatedSizeDescending(const Fsize& first, const Fsize& second) {
return (first.file->compensated_file_size >
second.file->compensated_file_size);
}
} // anonymous namespace
void VersionStorageInfo::AddFile(int level, FileMetaData* f, Logger* info_log) {
auto* level_files = &files_[level];
// Must not overlap
#ifndef NDEBUG
if (level > 0 && !level_files->empty() &&
internal_comparator_->Compare(
(*level_files)[level_files->size() - 1]->largest, f->smallest) >= 0) {
auto* f2 = (*level_files)[level_files->size() - 1];
if (info_log != nullptr) {
Error(info_log, "Adding new file %" PRIu64
" range (%s, %s) to level %d but overlapping "
"with existing file %" PRIu64 " %s %s",
f->fd.GetNumber(), f->smallest.DebugString(true).c_str(),
f->largest.DebugString(true).c_str(), level, f2->fd.GetNumber(),
f2->smallest.DebugString(true).c_str(),
f2->largest.DebugString(true).c_str());
LogFlush(info_log);
}
assert(false);
}
#else
(void)info_log;
#endif
f->refs++;
level_files->push_back(f);
}
// Version::PrepareApply() need to be called before calling the function, or
// following functions called:
// 1. UpdateNumNonEmptyLevels();
// 2. CalculateBaseBytes();
// 3. UpdateFilesByCompactionPri();
// 4. GenerateFileIndexer();
// 5. GenerateLevelFilesBrief();
// 6. GenerateLevel0NonOverlapping();
// 7. GenerateBottommostFiles();
void VersionStorageInfo::SetFinalized() {
finalized_ = true;
#ifndef NDEBUG
if (compaction_style_ != kCompactionStyleLevel) {
// Not level based compaction.
return;
}
assert(base_level_ < 0 || num_levels() == 1 ||
(base_level_ >= 1 && base_level_ < num_levels()));
// Verify all levels newer than base_level are empty except L0
for (int level = 1; level < base_level(); level++) {
assert(NumLevelBytes(level) == 0);
}
uint64_t max_bytes_prev_level = 0;
for (int level = base_level(); level < num_levels() - 1; level++) {
if (LevelFiles(level).size() == 0) {
continue;
}
assert(MaxBytesForLevel(level) >= max_bytes_prev_level);
max_bytes_prev_level = MaxBytesForLevel(level);
}
int num_empty_non_l0_level = 0;
for (int level = 0; level < num_levels(); level++) {
assert(LevelFiles(level).size() == 0 ||
LevelFiles(level).size() == LevelFilesBrief(level).num_files);
if (level > 0 && NumLevelBytes(level) > 0) {
num_empty_non_l0_level++;
}
if (LevelFiles(level).size() > 0) {
assert(level < num_non_empty_levels());
}
}
assert(compaction_level_.size() > 0);
assert(compaction_level_.size() == compaction_score_.size());
#endif
}
void VersionStorageInfo::UpdateNumNonEmptyLevels() {
num_non_empty_levels_ = num_levels_;
for (int i = num_levels_ - 1; i >= 0; i--) {
if (files_[i].size() != 0) {
return;
} else {
num_non_empty_levels_ = i;
}
}
}
namespace {
// Sort `temp` based on ratio of overlapping size over file size
void SortFileByOverlappingRatio(
const InternalKeyComparator& icmp, const std::vector<FileMetaData*>& files,
const std::vector<FileMetaData*>& next_level_files,
std::vector<Fsize>* temp) {
std::unordered_map<uint64_t, uint64_t> file_to_order;
auto next_level_it = next_level_files.begin();
for (auto& file : files) {
uint64_t overlapping_bytes = 0;
// Skip files in next level that is smaller than current file
while (next_level_it != next_level_files.end() &&
icmp.Compare((*next_level_it)->largest, file->smallest) < 0) {
next_level_it++;
}
while (next_level_it != next_level_files.end() &&
icmp.Compare((*next_level_it)->smallest, file->largest) < 0) {
overlapping_bytes += (*next_level_it)->fd.file_size;
if (icmp.Compare((*next_level_it)->largest, file->largest) > 0) {
// next level file cross large boundary of current file.
break;
}
next_level_it++;
}
assert(file->compensated_file_size != 0);
file_to_order[file->fd.GetNumber()] =
overlapping_bytes * 1024u / file->compensated_file_size;
}
std::sort(temp->begin(), temp->end(),
[&](const Fsize& f1, const Fsize& f2) -> bool {
return file_to_order[f1.file->fd.GetNumber()] <
file_to_order[f2.file->fd.GetNumber()];
});
}
} // namespace
void VersionStorageInfo::UpdateFilesByCompactionPri(
CompactionPri compaction_pri) {
if (compaction_style_ == kCompactionStyleNone ||
compaction_style_ == kCompactionStyleFIFO ||
compaction_style_ == kCompactionStyleUniversal) {
// don't need this
return;
}
// No need to sort the highest level because it is never compacted.
for (int level = 0; level < num_levels() - 1; level++) {
const std::vector<FileMetaData*>& files = files_[level];
auto& files_by_compaction_pri = files_by_compaction_pri_[level];
assert(files_by_compaction_pri.size() == 0);
// populate a temp vector for sorting based on size
std::vector<Fsize> temp(files.size());
for (size_t i = 0; i < files.size(); i++) {
temp[i].index = i;
temp[i].file = files[i];
}
// sort the top number_of_files_to_sort_ based on file size
size_t num = VersionStorageInfo::kNumberFilesToSort;
if (num > temp.size()) {
num = temp.size();
}
switch (compaction_pri) {
case kByCompensatedSize:
std::partial_sort(temp.begin(), temp.begin() + num, temp.end(),
CompareCompensatedSizeDescending);
break;
case kOldestLargestSeqFirst:
std::sort(temp.begin(), temp.end(),
[](const Fsize& f1, const Fsize& f2) -> bool {
return f1.file->fd.largest_seqno <
f2.file->fd.largest_seqno;
});
break;
case kOldestSmallestSeqFirst:
std::sort(temp.begin(), temp.end(),
[](const Fsize& f1, const Fsize& f2) -> bool {
return f1.file->fd.smallest_seqno <
f2.file->fd.smallest_seqno;
});
break;
case kMinOverlappingRatio:
SortFileByOverlappingRatio(*internal_comparator_, files_[level],
files_[level + 1], &temp);
break;
default:
assert(false);
}
assert(temp.size() == files.size());
// initialize files_by_compaction_pri_
for (size_t i = 0; i < temp.size(); i++) {
files_by_compaction_pri.push_back(static_cast<int>(temp[i].index));
}
next_file_to_compact_by_size_[level] = 0;
assert(files_[level].size() == files_by_compaction_pri_[level].size());
}
}
void VersionStorageInfo::GenerateLevel0NonOverlapping() {
assert(!finalized_);
level0_non_overlapping_ = true;
if (level_files_brief_.size() == 0) {
return;
}
// A copy of L0 files sorted by smallest key
std::vector<FdWithKeyRange> level0_sorted_file(
level_files_brief_[0].files,
level_files_brief_[0].files + level_files_brief_[0].num_files);
std::sort(level0_sorted_file.begin(), level0_sorted_file.end(),
[this](const FdWithKeyRange& f1, const FdWithKeyRange& f2) -> bool {
return (internal_comparator_->Compare(f1.smallest_key,
f2.smallest_key) < 0);
});
for (size_t i = 1; i < level0_sorted_file.size(); ++i) {
FdWithKeyRange& f = level0_sorted_file[i];
FdWithKeyRange& prev = level0_sorted_file[i - 1];
if (internal_comparator_->Compare(prev.largest_key, f.smallest_key) >= 0) {
level0_non_overlapping_ = false;
break;
}
}
}
void VersionStorageInfo::GenerateBottommostFiles() {
assert(!finalized_);
assert(bottommost_files_.empty());
for (size_t level = 0; level < level_files_brief_.size(); ++level) {
for (size_t file_idx = 0; file_idx < level_files_brief_[level].num_files;
++file_idx) {
const FdWithKeyRange& f = level_files_brief_[level].files[file_idx];
int l0_file_idx;
if (level == 0) {
l0_file_idx = static_cast<int>(file_idx);
} else {
l0_file_idx = -1;
}
Slice smallest_user_key = ExtractUserKey(f.smallest_key);
Slice largest_user_key = ExtractUserKey(f.largest_key);
if (!RangeMightExistAfterSortedRun(smallest_user_key, largest_user_key,
static_cast<int>(level),
l0_file_idx)) {
bottommost_files_.emplace_back(static_cast<int>(level),
f.file_metadata);
}
}
}
}
void VersionStorageInfo::UpdateOldestSnapshot(SequenceNumber seqnum) {
assert(seqnum >= oldest_snapshot_seqnum_);
oldest_snapshot_seqnum_ = seqnum;
if (oldest_snapshot_seqnum_ > bottommost_files_mark_threshold_) {
ComputeBottommostFilesMarkedForCompaction();
}
}
void VersionStorageInfo::ComputeBottommostFilesMarkedForCompaction() {
bottommost_files_marked_for_compaction_.clear();
bottommost_files_mark_threshold_ = kMaxSequenceNumber;
for (auto& level_and_file : bottommost_files_) {
if (!level_and_file.second->being_compacted &&
level_and_file.second->fd.largest_seqno != 0 &&
level_and_file.second->num_deletions > 1) {
// largest_seqno might be nonzero due to containing the final key in an
// earlier compaction, whose seqnum we didn't zero out. Multiple deletions
// ensures the file really contains deleted or overwritten keys.
if (level_and_file.second->fd.largest_seqno < oldest_snapshot_seqnum_) {
bottommost_files_marked_for_compaction_.push_back(level_and_file);
} else {
bottommost_files_mark_threshold_ =
std::min(bottommost_files_mark_threshold_,
level_and_file.second->fd.largest_seqno);
}
}
}
}
void Version::Ref() {
++refs_;
}
bool Version::Unref() {
assert(refs_ >= 1);
--refs_;
if (refs_ == 0) {
delete this;
return true;
}
return false;
}
bool VersionStorageInfo::OverlapInLevel(int level,
const Slice* smallest_user_key,
const Slice* largest_user_key) {
if (level >= num_non_empty_levels_) {
// empty level, no overlap
return false;
}
return SomeFileOverlapsRange(*internal_comparator_, (level > 0),
level_files_brief_[level], smallest_user_key,
largest_user_key);
}
// Store in "*inputs" all files in "level" that overlap [begin,end]
// If hint_index is specified, then it points to a file in the
// overlapping range.
// The file_index returns a pointer to any file in an overlapping range.
void VersionStorageInfo::GetOverlappingInputs(
int level, const InternalKey* begin, const InternalKey* end,
std::vector<FileMetaData*>* inputs, int hint_index, int* file_index,
bool expand_range, InternalKey** next_smallest) const {
if (level >= num_non_empty_levels_) {
// this level is empty, no overlapping inputs
return;
}
inputs->clear();
if (file_index) {
*file_index = -1;
}
const Comparator* user_cmp = user_comparator_;
if (level > 0) {
GetOverlappingInputsRangeBinarySearch(level, begin, end, inputs, hint_index,
file_index, false, next_smallest);
return;
}
if (next_smallest) {
// next_smallest key only makes sense for non-level 0, where files are
// non-overlapping
*next_smallest = nullptr;
}
Slice user_begin, user_end;
if (begin != nullptr) {
user_begin = begin->user_key();
}
if (end != nullptr) {
user_end = end->user_key();
}
// index stores the file index need to check.
std::list<size_t> index;
for (size_t i = 0; i < level_files_brief_[level].num_files; i++) {
index.emplace_back(i);
}
while (!index.empty()) {
bool found_overlapping_file = false;
auto iter = index.begin();
while (iter != index.end()) {
FdWithKeyRange* f = &(level_files_brief_[level].files[*iter]);
const Slice file_start = ExtractUserKey(f->smallest_key);
const Slice file_limit = ExtractUserKey(f->largest_key);
if (begin != nullptr &&
user_cmp->CompareWithoutTimestamp(file_limit, user_begin) < 0) {
// "f" is completely before specified range; skip it
iter++;
} else if (end != nullptr &&
user_cmp->CompareWithoutTimestamp(file_start, user_end) > 0) {
// "f" is completely after specified range; skip it
iter++;
} else {
// if overlap
inputs->emplace_back(files_[level][*iter]);
found_overlapping_file = true;
// record the first file index.
if (file_index && *file_index == -1) {
*file_index = static_cast<int>(*iter);
}
// the related file is overlap, erase to avoid checking again.
iter = index.erase(iter);
if (expand_range) {
if (begin != nullptr &&
user_cmp->CompareWithoutTimestamp(file_start, user_begin) < 0) {
user_begin = file_start;
}
if (end != nullptr &&
user_cmp->CompareWithoutTimestamp(file_limit, user_end) > 0) {
user_end = file_limit;
}
}
}
}
// if all the files left are not overlap, break
if (!found_overlapping_file) {
break;
}
}
}
// Store in "*inputs" files in "level" that within range [begin,end]
// Guarantee a "clean cut" boundary between the files in inputs
// and the surrounding files and the maxinum number of files.
// This will ensure that no parts of a key are lost during compaction.
// If hint_index is specified, then it points to a file in the range.
// The file_index returns a pointer to any file in an overlapping range.
void VersionStorageInfo::GetCleanInputsWithinInterval(
int level, const InternalKey* begin, const InternalKey* end,
std::vector<FileMetaData*>* inputs, int hint_index, int* file_index) const {
inputs->clear();
if (file_index) {
*file_index = -1;
}
if (level >= num_non_empty_levels_ || level == 0 ||
level_files_brief_[level].num_files == 0) {
// this level is empty, no inputs within range
// also don't support clean input interval within L0
return;
}
GetOverlappingInputsRangeBinarySearch(level, begin, end, inputs,
hint_index, file_index,
true /* within_interval */);
}
// Store in "*inputs" all files in "level" that overlap [begin,end]
// Employ binary search to find at least one file that overlaps the
// specified range. From that file, iterate backwards and
// forwards to find all overlapping files.
// if within_range is set, then only store the maximum clean inputs
// within range [begin, end]. "clean" means there is a boudnary
// between the files in "*inputs" and the surrounding files
void VersionStorageInfo::GetOverlappingInputsRangeBinarySearch(
int level, const InternalKey* begin, const InternalKey* end,
std::vector<FileMetaData*>* inputs, int hint_index, int* file_index,
bool within_interval, InternalKey** next_smallest) const {
assert(level > 0);
auto user_cmp = user_comparator_;
const FdWithKeyRange* files = level_files_brief_[level].files;
const int num_files = static_cast<int>(level_files_brief_[level].num_files);
// begin to use binary search to find lower bound
// and upper bound.
int start_index = 0;
int end_index = num_files;
if (begin != nullptr) {
// if within_interval is true, with file_key would find
// not overlapping ranges in std::lower_bound.
auto cmp = [&user_cmp, &within_interval](const FdWithKeyRange& f,
const InternalKey* k) {
auto& file_key = within_interval ? f.file_metadata->smallest
: f.file_metadata->largest;
return sstableKeyCompare(user_cmp, file_key, *k) < 0;
};
start_index = static_cast<int>(
std::lower_bound(files,
files + (hint_index == -1 ? num_files : hint_index),
begin, cmp) -
files);
if (start_index > 0 && within_interval) {
bool is_overlapping = true;
while (is_overlapping && start_index < num_files) {
auto& pre_limit = files[start_index - 1].file_metadata->largest;
auto& cur_start = files[start_index].file_metadata->smallest;
is_overlapping = sstableKeyCompare(user_cmp, pre_limit, cur_start) == 0;
start_index += is_overlapping;
}
}
}
if (end != nullptr) {
// if within_interval is true, with file_key would find
// not overlapping ranges in std::upper_bound.
auto cmp = [&user_cmp, &within_interval](const InternalKey* k,
const FdWithKeyRange& f) {
auto& file_key = within_interval ? f.file_metadata->largest
: f.file_metadata->smallest;
return sstableKeyCompare(user_cmp, *k, file_key) < 0;
};
end_index = static_cast<int>(
std::upper_bound(files + start_index, files + num_files, end, cmp) -
files);
if (end_index < num_files && within_interval) {
bool is_overlapping = true;
while (is_overlapping && end_index > start_index) {
auto& next_start = files[end_index].file_metadata->smallest;
auto& cur_limit = files[end_index - 1].file_metadata->largest;
is_overlapping =
sstableKeyCompare(user_cmp, cur_limit, next_start) == 0;
end_index -= is_overlapping;
}
}
}
assert(start_index <= end_index);
// If there were no overlapping files, return immediately.
if (start_index == end_index) {
if (next_smallest) {
*next_smallest = nullptr;
}
return;
}
assert(start_index < end_index);
// returns the index where an overlap is found
if (file_index) {
*file_index = start_index;
}
// insert overlapping files into vector
for (int i = start_index; i < end_index; i++) {
inputs->push_back(files_[level][i]);
}
if (next_smallest != nullptr) {
// Provide the next key outside the range covered by inputs
if (end_index < static_cast<int>(files_[level].size())) {
**next_smallest = files_[level][end_index]->smallest;
} else {
*next_smallest = nullptr;
}
}
}
uint64_t VersionStorageInfo::NumLevelBytes(int level) const {
assert(level >= 0);
assert(level < num_levels());
return TotalFileSize(files_[level]);
}
const char* VersionStorageInfo::LevelSummary(
LevelSummaryStorage* scratch) const {
int len = 0;
if (compaction_style_ == kCompactionStyleLevel && num_levels() > 1) {
assert(base_level_ < static_cast<int>(level_max_bytes_.size()));
if (level_multiplier_ != 0.0) {
len = snprintf(
scratch->buffer, sizeof(scratch->buffer),
"base level %d level multiplier %.2f max bytes base %" PRIu64 " ",
base_level_, level_multiplier_, level_max_bytes_[base_level_]);
}
}
len +=
snprintf(scratch->buffer + len, sizeof(scratch->buffer) - len, "files[");
for (int i = 0; i < num_levels(); i++) {
int sz = sizeof(scratch->buffer) - len;
int ret = snprintf(scratch->buffer + len, sz, "%d ", int(files_[i].size()));
if (ret < 0 || ret >= sz) break;
len += ret;
}
if (len > 0) {
// overwrite the last space
--len;
}
len += snprintf(scratch->buffer + len, sizeof(scratch->buffer) - len,
"] max score %.2f", compaction_score_[0]);
if (!files_marked_for_compaction_.empty()) {
snprintf(scratch->buffer + len, sizeof(scratch->buffer) - len,
" (%" ROCKSDB_PRIszt " files need compaction)",
files_marked_for_compaction_.size());
}
return scratch->buffer;
}
const char* VersionStorageInfo::LevelFileSummary(FileSummaryStorage* scratch,
int level) const {
int len = snprintf(scratch->buffer, sizeof(scratch->buffer), "files_size[");
for (const auto& f : files_[level]) {
int sz = sizeof(scratch->buffer) - len;
char sztxt[16];
AppendHumanBytes(f->fd.GetFileSize(), sztxt, sizeof(sztxt));
int ret = snprintf(scratch->buffer + len, sz,
"#%" PRIu64 "(seq=%" PRIu64 ",sz=%s,%d) ",
f->fd.GetNumber(), f->fd.smallest_seqno, sztxt,
static_cast<int>(f->being_compacted));
if (ret < 0 || ret >= sz)
break;
len += ret;
}
// overwrite the last space (only if files_[level].size() is non-zero)
if (files_[level].size() && len > 0) {
--len;
}
snprintf(scratch->buffer + len, sizeof(scratch->buffer) - len, "]");
return scratch->buffer;
}
int64_t VersionStorageInfo::MaxNextLevelOverlappingBytes() {
uint64_t result = 0;
std::vector<FileMetaData*> overlaps;
for (int level = 1; level < num_levels() - 1; level++) {
for (const auto& f : files_[level]) {
GetOverlappingInputs(level + 1, &f->smallest, &f->largest, &overlaps);
const uint64_t sum = TotalFileSize(overlaps);
if (sum > result) {
result = sum;
}
}
}
return result;
}
uint64_t VersionStorageInfo::MaxBytesForLevel(int level) const {
// Note: the result for level zero is not really used since we set
// the level-0 compaction threshold based on number of files.
assert(level >= 0);
assert(level < static_cast<int>(level_max_bytes_.size()));
return level_max_bytes_[level];
}
void VersionStorageInfo::CalculateBaseBytes(const ImmutableCFOptions& ioptions,
const MutableCFOptions& options) {
// Special logic to set number of sorted runs.
// It is to match the previous behavior when all files are in L0.
int num_l0_count = static_cast<int>(files_[0].size());
if (compaction_style_ == kCompactionStyleUniversal) {
// For universal compaction, we use level0 score to indicate
// compaction score for the whole DB. Adding other levels as if
// they are L0 files.
for (int i = 1; i < num_levels(); i++) {
if (!files_[i].empty()) {
num_l0_count++;
}
}
}
set_l0_delay_trigger_count(num_l0_count);
level_max_bytes_.resize(ioptions.num_levels);
if (!ioptions.level_compaction_dynamic_level_bytes) {
base_level_ = (ioptions.compaction_style == kCompactionStyleLevel) ? 1 : -1;
// Calculate for static bytes base case
for (int i = 0; i < ioptions.num_levels; ++i) {
if (i == 0 && ioptions.compaction_style == kCompactionStyleUniversal) {
level_max_bytes_[i] = options.max_bytes_for_level_base;
} else if (i > 1) {
level_max_bytes_[i] = MultiplyCheckOverflow(
MultiplyCheckOverflow(level_max_bytes_[i - 1],
options.max_bytes_for_level_multiplier),
options.MaxBytesMultiplerAdditional(i - 1));
} else {
level_max_bytes_[i] = options.max_bytes_for_level_base;
}
}
} else {
uint64_t max_level_size = 0;
int first_non_empty_level = -1;
// Find size of non-L0 level of most data.
// Cannot use the size of the last level because it can be empty or less
// than previous levels after compaction.
for (int i = 1; i < num_levels_; i++) {
uint64_t total_size = 0;
for (const auto& f : files_[i]) {
total_size += f->fd.GetFileSize();
}
if (total_size > 0 && first_non_empty_level == -1) {
first_non_empty_level = i;
}
if (total_size > max_level_size) {
max_level_size = total_size;
}
}
// Prefill every level's max bytes to disallow compaction from there.
for (int i = 0; i < num_levels_; i++) {
level_max_bytes_[i] = std::numeric_limits<uint64_t>::max();
}
if (max_level_size == 0) {
// No data for L1 and up. L0 compacts to last level directly.
// No compaction from L1+ needs to be scheduled.
base_level_ = num_levels_ - 1;
} else {
uint64_t l0_size = 0;
for (const auto& f : files_[0]) {
l0_size += f->fd.GetFileSize();
}
uint64_t base_bytes_max =
std::max(options.max_bytes_for_level_base, l0_size);
uint64_t base_bytes_min = static_cast<uint64_t>(
base_bytes_max / options.max_bytes_for_level_multiplier);
// Try whether we can make last level's target size to be max_level_size
uint64_t cur_level_size = max_level_size;
for (int i = num_levels_ - 2; i >= first_non_empty_level; i--) {
// Round up after dividing
cur_level_size = static_cast<uint64_t>(
cur_level_size / options.max_bytes_for_level_multiplier);
}
// Calculate base level and its size.
uint64_t base_level_size;
if (cur_level_size <= base_bytes_min) {
// Case 1. If we make target size of last level to be max_level_size,
// target size of the first non-empty level would be smaller than
// base_bytes_min. We set it be base_bytes_min.
base_level_size = base_bytes_min + 1U;
base_level_ = first_non_empty_level;
ROCKS_LOG_INFO(ioptions.info_log,
"More existing levels in DB than needed. "
"max_bytes_for_level_multiplier may not be guaranteed.");
} else {
// Find base level (where L0 data is compacted to).
base_level_ = first_non_empty_level;
while (base_level_ > 1 && cur_level_size > base_bytes_max) {
--base_level_;
cur_level_size = static_cast<uint64_t>(
cur_level_size / options.max_bytes_for_level_multiplier);
}
if (cur_level_size > base_bytes_max) {
// Even L1 will be too large
assert(base_level_ == 1);
base_level_size = base_bytes_max;
} else {
base_level_size = cur_level_size;
}
}
level_multiplier_ = options.max_bytes_for_level_multiplier;
assert(base_level_size > 0);
if (l0_size > base_level_size &&
(l0_size > options.max_bytes_for_level_base ||
static_cast<int>(files_[0].size() / 2) >=
options.level0_file_num_compaction_trigger)) {
// We adjust the base level according to actual L0 size, and adjust
// the level multiplier accordingly, when:
// 1. the L0 size is larger than level size base, or
// 2. number of L0 files reaches twice the L0->L1 compaction trigger
// We don't do this otherwise to keep the LSM-tree structure stable
// unless the L0 compation is backlogged.
base_level_size = l0_size;
if (base_level_ == num_levels_ - 1) {
level_multiplier_ = 1.0;
} else {
level_multiplier_ = std::pow(
static_cast<double>(max_level_size) /
static_cast<double>(base_level_size),
1.0 / static_cast<double>(num_levels_ - base_level_ - 1));
}
}
uint64_t level_size = base_level_size;
for (int i = base_level_; i < num_levels_; i++) {
if (i > base_level_) {
level_size = MultiplyCheckOverflow(level_size, level_multiplier_);
}
// Don't set any level below base_bytes_max. Otherwise, the LSM can
// assume an hourglass shape where L1+ sizes are smaller than L0. This
// causes compaction scoring, which depends on level sizes, to favor L1+
// at the expense of L0, which may fill up and stall.
level_max_bytes_[i] = std::max(level_size, base_bytes_max);
}
}
}
}
uint64_t VersionStorageInfo::EstimateLiveDataSize() const {
// Estimate the live data size by adding up the size of the last level for all
// key ranges. Note: Estimate depends on the ordering of files in level 0
// because files in level 0 can be overlapping.
uint64_t size = 0;
auto ikey_lt = [this](InternalKey* x, InternalKey* y) {
return internal_comparator_->Compare(*x, *y) < 0;
};
// (Ordered) map of largest keys in non-overlapping files
std::map<InternalKey*, FileMetaData*, decltype(ikey_lt)> ranges(ikey_lt);
for (int l = num_levels_ - 1; l >= 0; l--) {
bool found_end = false;
for (auto file : files_[l]) {
// Find the first file where the largest key is larger than the smallest
// key of the current file. If this file does not overlap with the
// current file, none of the files in the map does. If there is
// no potential overlap, we can safely insert the rest of this level
// (if the level is not 0) into the map without checking again because
// the elements in the level are sorted and non-overlapping.
auto lb = (found_end && l != 0) ?
ranges.end() : ranges.lower_bound(&file->smallest);
found_end = (lb == ranges.end());
if (found_end || internal_comparator_->Compare(
file->largest, (*lb).second->smallest) < 0) {
ranges.emplace_hint(lb, &file->largest, file);
size += file->fd.file_size;
}
}
}
return size;
}
bool VersionStorageInfo::RangeMightExistAfterSortedRun(
const Slice& smallest_user_key, const Slice& largest_user_key,
int last_level, int last_l0_idx) {
assert((last_l0_idx != -1) == (last_level == 0));
// TODO(ajkr): this preserves earlier behavior where we considered an L0 file
// bottommost only if it's the oldest L0 file and there are no files on older
// levels. It'd be better to consider it bottommost if there's no overlap in
// older levels/files.
if (last_level == 0 &&
last_l0_idx != static_cast<int>(LevelFiles(0).size() - 1)) {
return true;
}
// Checks whether there are files living beyond the `last_level`. If lower
// levels have files, it checks for overlap between [`smallest_key`,
// `largest_key`] and those files. Bottomlevel optimizations can be made if
// there are no files in lower levels or if there is no overlap with the files
// in the lower levels.
for (int level = last_level + 1; level < num_levels(); level++) {
// The range is not in the bottommost level if there are files in lower
// levels when the `last_level` is 0 or if there are files in lower levels
// which overlap with [`smallest_key`, `largest_key`].
if (files_[level].size() > 0 &&
(last_level == 0 ||
OverlapInLevel(level, &smallest_user_key, &largest_user_key))) {
return true;
}
}
return false;
}
void Version::AddLiveFiles(std::vector<FileDescriptor>* live) {
for (int level = 0; level < storage_info_.num_levels(); level++) {
const std::vector<FileMetaData*>& files = storage_info_.files_[level];
for (const auto& file : files) {
live->push_back(file->fd);
}
}
}
std::string Version::DebugString(bool hex, bool print_stats) const {
std::string r;
for (int level = 0; level < storage_info_.num_levels_; level++) {
// E.g.,
// --- level 1 ---
// 17:123[1 .. 124]['a' .. 'd']
// 20:43[124 .. 128]['e' .. 'g']
//
// if print_stats=true:
// 17:123[1 .. 124]['a' .. 'd'](4096)
r.append("--- level ");
AppendNumberTo(&r, level);
r.append(" --- version# ");
AppendNumberTo(&r, version_number_);
r.append(" ---\n");
const std::vector<FileMetaData*>& files = storage_info_.files_[level];
for (size_t i = 0; i < files.size(); i++) {
r.push_back(' ');
AppendNumberTo(&r, files[i]->fd.GetNumber());
r.push_back(':');
AppendNumberTo(&r, files[i]->fd.GetFileSize());
r.append("[");
AppendNumberTo(&r, files[i]->fd.smallest_seqno);
r.append(" .. ");
AppendNumberTo(&r, files[i]->fd.largest_seqno);
r.append("]");
r.append("[");
r.append(files[i]->smallest.DebugString(hex));
r.append(" .. ");
r.append(files[i]->largest.DebugString(hex));
r.append("]");
if (print_stats) {
r.append("(");
r.append(ToString(
files[i]->stats.num_reads_sampled.load(std::memory_order_relaxed)));
r.append(")");
}
r.append("\n");
}
}
return r;
}
// this is used to batch writes to the manifest file
struct VersionSet::ManifestWriter {
Status status;
bool done;
InstrumentedCondVar cv;
ColumnFamilyData* cfd;
const MutableCFOptions mutable_cf_options;
const autovector<VersionEdit*>& edit_list;
explicit ManifestWriter(InstrumentedMutex* mu, ColumnFamilyData* _cfd,
const MutableCFOptions& cf_options,
const autovector<VersionEdit*>& e)
: done(false),
cv(mu),
cfd(_cfd),
mutable_cf_options(cf_options),
edit_list(e) {}
};
Status AtomicGroupReadBuffer::AddEdit(VersionEdit* edit) {
assert(edit);
if (edit->is_in_atomic_group_) {
TEST_SYNC_POINT("AtomicGroupReadBuffer::AddEdit:AtomicGroup");
if (replay_buffer_.empty()) {
replay_buffer_.resize(edit->remaining_entries_ + 1);
TEST_SYNC_POINT_CALLBACK(
"AtomicGroupReadBuffer::AddEdit:FirstInAtomicGroup", edit);
}
read_edits_in_atomic_group_++;
if (read_edits_in_atomic_group_ + edit->remaining_entries_ !=
static_cast<uint32_t>(replay_buffer_.size())) {
TEST_SYNC_POINT_CALLBACK(
"AtomicGroupReadBuffer::AddEdit:IncorrectAtomicGroupSize", edit);
return Status::Corruption("corrupted atomic group");
}
replay_buffer_[read_edits_in_atomic_group_ - 1] = std::move(*edit);
if (read_edits_in_atomic_group_ == replay_buffer_.size()) {
TEST_SYNC_POINT_CALLBACK(
"AtomicGroupReadBuffer::AddEdit:LastInAtomicGroup", edit);
return Status::OK();
}
return Status::OK();
}
// A normal edit.
if (!replay_buffer().empty()) {
TEST_SYNC_POINT_CALLBACK(
"AtomicGroupReadBuffer::AddEdit:AtomicGroupMixedWithNormalEdits", edit);
return Status::Corruption("corrupted atomic group");
}
return Status::OK();
}
bool AtomicGroupReadBuffer::IsFull() const {
return read_edits_in_atomic_group_ == replay_buffer_.size();
}
bool AtomicGroupReadBuffer::IsEmpty() const { return replay_buffer_.empty(); }
void AtomicGroupReadBuffer::Clear() {
read_edits_in_atomic_group_ = 0;
replay_buffer_.clear();
}
VersionSet::VersionSet(const std::string& dbname,
const ImmutableDBOptions* _db_options,
const EnvOptions& storage_options, Cache* table_cache,
WriteBufferManager* write_buffer_manager,
WriteController* write_controller,
BlockCacheTracer* const block_cache_tracer)
: column_family_set_(new ColumnFamilySet(
dbname, _db_options, storage_options, table_cache,
write_buffer_manager, write_controller, block_cache_tracer)),
env_(_db_options->env),
dbname_(dbname),
db_options_(_db_options),
next_file_number_(2),
manifest_file_number_(0), // Filled by Recover()
options_file_number_(0),
pending_manifest_file_number_(0),
last_sequence_(0),
last_allocated_sequence_(0),
last_published_sequence_(0),
prev_log_number_(0),
current_version_number_(0),
manifest_file_size_(0),
env_options_(storage_options),
block_cache_tracer_(block_cache_tracer) {}
VersionSet::~VersionSet() {
// we need to delete column_family_set_ because its destructor depends on
// VersionSet
Cache* table_cache = column_family_set_->get_table_cache();
column_family_set_.reset();
for (auto& file : obsolete_files_) {
if (file.metadata->table_reader_handle) {
table_cache->Release(file.metadata->table_reader_handle);
TableCache::Evict(table_cache, file.metadata->fd.GetNumber());
}
file.DeleteMetadata();
}
obsolete_files_.clear();
}
void VersionSet::AppendVersion(ColumnFamilyData* column_family_data,
Version* v) {
// compute new compaction score
v->storage_info()->ComputeCompactionScore(
*column_family_data->ioptions(),
*column_family_data->GetLatestMutableCFOptions());
// Mark v finalized
v->storage_info_.SetFinalized();
// Make "v" current
assert(v->refs_ == 0);
Version* current = column_family_data->current();
assert(v != current);
if (current != nullptr) {
assert(current->refs_ > 0);
current->Unref();
}
column_family_data->SetCurrent(v);
v->Ref();
// Append to linked list
v->prev_ = column_family_data->dummy_versions()->prev_;
v->next_ = column_family_data->dummy_versions();
v->prev_->next_ = v;
v->next_->prev_ = v;
}
Status VersionSet::ProcessManifestWrites(
std::deque<ManifestWriter>& writers, InstrumentedMutex* mu,
Directory* db_directory, bool new_descriptor_log,
const ColumnFamilyOptions* new_cf_options) {
assert(!writers.empty());
ManifestWriter& first_writer = writers.front();
ManifestWriter* last_writer = &first_writer;
assert(!manifest_writers_.empty());
assert(manifest_writers_.front() == &first_writer);
autovector<VersionEdit*> batch_edits;
autovector<Version*> versions;
autovector<const MutableCFOptions*> mutable_cf_options_ptrs;
std::vector<std::unique_ptr<BaseReferencedVersionBuilder>> builder_guards;
if (first_writer.edit_list.front()->IsColumnFamilyManipulation()) {
// No group commits for column family add or drop
LogAndApplyCFHelper(first_writer.edit_list.front());
batch_edits.push_back(first_writer.edit_list.front());
} else {
auto it = manifest_writers_.cbegin();
size_t group_start = std::numeric_limits<size_t>::max();
while (it != manifest_writers_.cend()) {
if ((*it)->edit_list.front()->IsColumnFamilyManipulation()) {
// no group commits for column family add or drop
break;
}
last_writer = *(it++);
assert(last_writer != nullptr);
assert(last_writer->cfd != nullptr);
if (last_writer->cfd->IsDropped()) {
// If we detect a dropped CF at this point, and the corresponding
// version edits belong to an atomic group, then we need to find out
// the preceding version edits in the same atomic group, and update
// their `remaining_entries_` member variable because we are NOT going
// to write the version edits' of dropped CF to the MANIFEST. If we
// don't update, then Recover can report corrupted atomic group because
// the `remaining_entries_` do not match.
if (!batch_edits.empty()) {
if (batch_edits.back()->is_in_atomic_group_ &&
batch_edits.back()->remaining_entries_ > 0) {
assert(group_start < batch_edits.size());
const auto& edit_list = last_writer->edit_list;
size_t k = 0;
while (k < edit_list.size()) {
if (!edit_list[k]->is_in_atomic_group_) {
break;
} else if (edit_list[k]->remaining_entries_ == 0) {
++k;
break;
}
++k;
}
for (auto i = group_start; i < batch_edits.size(); ++i) {
assert(static_cast<uint32_t>(k) <=
batch_edits.back()->remaining_entries_);
batch_edits[i]->remaining_entries_ -= static_cast<uint32_t>(k);
}
}
}
continue;
}
// We do a linear search on versions because versions is small.
// TODO(yanqin) maybe consider unordered_map
Version* version = nullptr;
VersionBuilder* builder = nullptr;
for (int i = 0; i != static_cast<int>(versions.size()); ++i) {
uint32_t cf_id = last_writer->cfd->GetID();
if (versions[i]->cfd()->GetID() == cf_id) {
version = versions[i];
assert(!builder_guards.empty() &&
builder_guards.size() == versions.size());
builder = builder_guards[i]->version_builder();
TEST_SYNC_POINT_CALLBACK(
"VersionSet::ProcessManifestWrites:SameColumnFamily", &cf_id);
break;
}
}
if (version == nullptr) {
version = new Version(last_writer->cfd, this, env_options_,
last_writer->mutable_cf_options,
current_version_number_++);
versions.push_back(version);
mutable_cf_options_ptrs.push_back(&last_writer->mutable_cf_options);
builder_guards.emplace_back(
new BaseReferencedVersionBuilder(last_writer->cfd));
builder = builder_guards.back()->version_builder();
}
assert(builder != nullptr); // make checker happy
for (const auto& e : last_writer->edit_list) {
if (e->is_in_atomic_group_) {
if (batch_edits.empty() || !batch_edits.back()->is_in_atomic_group_ ||
(batch_edits.back()->is_in_atomic_group_ &&
batch_edits.back()->remaining_entries_ == 0)) {
group_start = batch_edits.size();
}
} else if (group_start != std::numeric_limits<size_t>::max()) {
group_start = std::numeric_limits<size_t>::max();
}
Status s = LogAndApplyHelper(last_writer->cfd, builder, e, mu);
if (!s.ok()) {
// free up the allocated memory
for (auto v : versions) {
delete v;
}
return s;
}
batch_edits.push_back(e);
}
}
for (int i = 0; i < static_cast<int>(versions.size()); ++i) {
assert(!builder_guards.empty() &&
builder_guards.size() == versions.size());
auto* builder = builder_guards[i]->version_builder();
Status s = builder->SaveTo(versions[i]->storage_info());
if (!s.ok()) {
// free up the allocated memory
for (auto v : versions) {
delete v;
}
return s;
}
}
}
#ifndef NDEBUG
// Verify that version edits of atomic groups have correct
// remaining_entries_.
size_t k = 0;
while (k < batch_edits.size()) {
while (k < batch_edits.size() && !batch_edits[k]->is_in_atomic_group_) {
++k;
}
if (k == batch_edits.size()) {
break;
}
size_t i = k;
while (i < batch_edits.size()) {
if (!batch_edits[i]->is_in_atomic_group_) {
break;
}
assert(i - k + batch_edits[i]->remaining_entries_ ==
batch_edits[k]->remaining_entries_);
if (batch_edits[i]->remaining_entries_ == 0) {
++i;
break;
}
++i;
}
assert(batch_edits[i - 1]->is_in_atomic_group_);
assert(0 == batch_edits[i - 1]->remaining_entries_);
std::vector<VersionEdit*> tmp;
for (size_t j = k; j != i; ++j) {
tmp.emplace_back(batch_edits[j]);
}
TEST_SYNC_POINT_CALLBACK(
"VersionSet::ProcessManifestWrites:CheckOneAtomicGroup", &tmp);
k = i;
}
#endif // NDEBUG
uint64_t new_manifest_file_size = 0;
Status s;
assert(pending_manifest_file_number_ == 0);
if (!descriptor_log_ ||
manifest_file_size_ > db_options_->max_manifest_file_size) {
TEST_SYNC_POINT("VersionSet::ProcessManifestWrites:BeforeNewManifest");
pending_manifest_file_number_ = NewFileNumber();
batch_edits.back()->SetNextFile(next_file_number_.load());
new_descriptor_log = true;
} else {
pending_manifest_file_number_ = manifest_file_number_;
}
if (new_descriptor_log) {
// if we are writing out new snapshot make sure to persist max column
// family.
if (column_family_set_->GetMaxColumnFamily() > 0) {
first_writer.edit_list.front()->SetMaxColumnFamily(
column_family_set_->GetMaxColumnFamily());
}
}
{
EnvOptions opt_env_opts = env_->OptimizeForManifestWrite(env_options_);
mu->Unlock();
TEST_SYNC_POINT("VersionSet::LogAndApply:WriteManifest");
if (!first_writer.edit_list.front()->IsColumnFamilyManipulation()) {
for (int i = 0; i < static_cast<int>(versions.size()); ++i) {
assert(!builder_guards.empty() &&
builder_guards.size() == versions.size());
assert(!mutable_cf_options_ptrs.empty() &&
builder_guards.size() == versions.size());
ColumnFamilyData* cfd = versions[i]->cfd_;
builder_guards[i]->version_builder()->LoadTableHandlers(
cfd->internal_stats(), cfd->ioptions()->optimize_filters_for_hits,
true /* prefetch_index_and_filter_in_cache */,
false /* is_initial_load */,
mutable_cf_options_ptrs[i]->prefix_extractor.get());
}
}
// This is fine because everything inside of this block is serialized --
// only one thread can be here at the same time
if (new_descriptor_log) {
// create new manifest file
ROCKS_LOG_INFO(db_options_->info_log, "Creating manifest %" PRIu64 "\n",
pending_manifest_file_number_);
std::string descriptor_fname =
DescriptorFileName(dbname_, pending_manifest_file_number_);
std::unique_ptr<WritableFile> descriptor_file;
s = NewWritableFile(env_, descriptor_fname, &descriptor_file,
opt_env_opts);
if (s.ok()) {
descriptor_file->SetPreallocationBlockSize(
db_options_->manifest_preallocation_size);
std::unique_ptr<WritableFileWriter> file_writer(new WritableFileWriter(
std::move(descriptor_file), descriptor_fname, opt_env_opts, env_,
nullptr, db_options_->listeners));
descriptor_log_.reset(
new log::Writer(std::move(file_writer), 0, false));
s = WriteCurrentStateToManifest(descriptor_log_.get());
}
}
if (!first_writer.edit_list.front()->IsColumnFamilyManipulation()) {
for (int i = 0; i < static_cast<int>(versions.size()); ++i) {
versions[i]->PrepareApply(*mutable_cf_options_ptrs[i], true);
}
}
// Write new records to MANIFEST log
if (s.ok()) {
#ifndef NDEBUG
size_t idx = 0;
#endif
for (auto& e : batch_edits) {
std::string record;
if (!e->EncodeTo(&record)) {
s = Status::Corruption("Unable to encode VersionEdit:" +
e->DebugString(true));
break;
}
TEST_KILL_RANDOM("VersionSet::LogAndApply:BeforeAddRecord",
rocksdb_kill_odds * REDUCE_ODDS2);
#ifndef NDEBUG
if (batch_edits.size() > 1 && batch_edits.size() - 1 == idx) {
TEST_SYNC_POINT(
"VersionSet::ProcessManifestWrites:BeforeWriteLastVersionEdit:0");
TEST_SYNC_POINT(
"VersionSet::ProcessManifestWrites:BeforeWriteLastVersionEdit:1");
}
++idx;
#endif /* !NDEBUG */
s = descriptor_log_->AddRecord(record);
if (!s.ok()) {
break;
}
}
if (s.ok()) {
s = SyncManifest(env_, db_options_, descriptor_log_->file());
}
if (!s.ok()) {
ROCKS_LOG_ERROR(db_options_->info_log, "MANIFEST write %s\n",
s.ToString().c_str());
}
}
// If we just created a new descriptor file, install it by writing a
// new CURRENT file that points to it.
if (s.ok() && new_descriptor_log) {
s = SetCurrentFile(env_, dbname_, pending_manifest_file_number_,
db_directory);
TEST_SYNC_POINT("VersionSet::ProcessManifestWrites:AfterNewManifest");
}
if (s.ok()) {
// find offset in manifest file where this version is stored.
new_manifest_file_size = descriptor_log_->file()->GetFileSize();
}
if (first_writer.edit_list.front()->is_column_family_drop_) {
TEST_SYNC_POINT("VersionSet::LogAndApply::ColumnFamilyDrop:0");
TEST_SYNC_POINT("VersionSet::LogAndApply::ColumnFamilyDrop:1");
TEST_SYNC_POINT("VersionSet::LogAndApply::ColumnFamilyDrop:2");
}
LogFlush(db_options_->info_log);
TEST_SYNC_POINT("VersionSet::LogAndApply:WriteManifestDone");
mu->Lock();
}
// Append the old manifest file to the obsolete_manifest_ list to be deleted
// by PurgeObsoleteFiles later.
if (s.ok() && new_descriptor_log) {
obsolete_manifests_.emplace_back(
DescriptorFileName("", manifest_file_number_));
}
// Install the new versions
if (s.ok()) {
if (first_writer.edit_list.front()->is_column_family_add_) {
assert(batch_edits.size() == 1);
assert(new_cf_options != nullptr);
CreateColumnFamily(*new_cf_options, first_writer.edit_list.front());
} else if (first_writer.edit_list.front()->is_column_family_drop_) {
assert(batch_edits.size() == 1);
first_writer.cfd->SetDropped();
if (first_writer.cfd->Unref()) {
delete first_writer.cfd;
}
} else {
// Each version in versions corresponds to a column family.
// For each column family, update its log number indicating that logs
// with number smaller than this should be ignored.
for (const auto version : versions) {
uint64_t max_log_number_in_batch = 0;
uint32_t cf_id = version->cfd_->GetID();
for (const auto& e : batch_edits) {
if (e->has_log_number_ && e->column_family_ == cf_id) {
max_log_number_in_batch =
std::max(max_log_number_in_batch, e->log_number_);
}
}
if (max_log_number_in_batch != 0) {
assert(version->cfd_->GetLogNumber() <= max_log_number_in_batch);
version->cfd_->SetLogNumber(max_log_number_in_batch);
}
}
uint64_t last_min_log_number_to_keep = 0;
for (auto& e : batch_edits) {
if (e->has_min_log_number_to_keep_) {
last_min_log_number_to_keep =
std::max(last_min_log_number_to_keep, e->min_log_number_to_keep_);
}
}
if (last_min_log_number_to_keep != 0) {
// Should only be set in 2PC mode.
MarkMinLogNumberToKeep2PC(last_min_log_number_to_keep);
}
for (int i = 0; i < static_cast<int>(versions.size()); ++i) {
ColumnFamilyData* cfd = versions[i]->cfd_;
AppendVersion(cfd, versions[i]);
}
}
manifest_file_number_ = pending_manifest_file_number_;
manifest_file_size_ = new_manifest_file_size;
prev_log_number_ = first_writer.edit_list.front()->prev_log_number_;
} else {
std::string version_edits;
for (auto& e : batch_edits) {
version_edits += ("\n" + e->DebugString(true));
}
ROCKS_LOG_ERROR(db_options_->info_log,
"Error in committing version edit to MANIFEST: %s",
version_edits.c_str());
for (auto v : versions) {
delete v;
}
if (new_descriptor_log) {
ROCKS_LOG_INFO(db_options_->info_log,
"Deleting manifest %" PRIu64 " current manifest %" PRIu64
"\n",
manifest_file_number_, pending_manifest_file_number_);
descriptor_log_.reset();
env_->DeleteFile(
DescriptorFileName(dbname_, pending_manifest_file_number_));
}
}
pending_manifest_file_number_ = 0;
// wake up all the waiting writers
while (true) {
ManifestWriter* ready = manifest_writers_.front();
manifest_writers_.pop_front();
bool need_signal = true;
for (const auto& w : writers) {
if (&w == ready) {
need_signal = false;
break;
}
}
ready->status = s;
ready->done = true;
if (need_signal) {
ready->cv.Signal();
}
if (ready == last_writer) {
break;
}
}
if (!manifest_writers_.empty()) {
manifest_writers_.front()->cv.Signal();
}
return s;
}
// 'datas' is gramatically incorrect. We still use this notation to indicate
// that this variable represents a collection of column_family_data.
Status VersionSet::LogAndApply(
const autovector<ColumnFamilyData*>& column_family_datas,
const autovector<const MutableCFOptions*>& mutable_cf_options_list,
const autovector<autovector<VersionEdit*>>& edit_lists,
InstrumentedMutex* mu, Directory* db_directory, bool new_descriptor_log,
const ColumnFamilyOptions* new_cf_options) {
mu->AssertHeld();
int num_edits = 0;
for (const auto& elist : edit_lists) {
num_edits += static_cast<int>(elist.size());
}
if (num_edits == 0) {
return Status::OK();
} else if (num_edits > 1) {
#ifndef NDEBUG
for (const auto& edit_list : edit_lists) {
for (const auto& edit : edit_list) {
assert(!edit->IsColumnFamilyManipulation());
}
}
#endif /* ! NDEBUG */
}
int num_cfds = static_cast<int>(column_family_datas.size());
if (num_cfds == 1 && column_family_datas[0] == nullptr) {
assert(edit_lists.size() == 1 && edit_lists[0].size() == 1);
assert(edit_lists[0][0]->is_column_family_add_);
assert(new_cf_options != nullptr);
}
std::deque<ManifestWriter> writers;
if (num_cfds > 0) {
assert(static_cast<size_t>(num_cfds) == mutable_cf_options_list.size());
assert(static_cast<size_t>(num_cfds) == edit_lists.size());
}
for (int i = 0; i < num_cfds; ++i) {
writers.emplace_back(mu, column_family_datas[i],
*mutable_cf_options_list[i], edit_lists[i]);
manifest_writers_.push_back(&writers[i]);
}
assert(!writers.empty());
ManifestWriter& first_writer = writers.front();
while (!first_writer.done && &first_writer != manifest_writers_.front()) {
first_writer.cv.Wait();
}
if (first_writer.done) {
// All non-CF-manipulation operations can be grouped together and committed
// to MANIFEST. They should all have finished. The status code is stored in
// the first manifest writer.
#ifndef NDEBUG
for (const auto& writer : writers) {
assert(writer.done);
}
#endif /* !NDEBUG */
return first_writer.status;
}
int num_undropped_cfds = 0;
for (auto cfd : column_family_datas) {
// if cfd == nullptr, it is a column family add.
if (cfd == nullptr || !cfd->IsDropped()) {
++num_undropped_cfds;
}
}
if (0 == num_undropped_cfds) {
for (int i = 0; i != num_cfds; ++i) {
manifest_writers_.pop_front();
}
// Notify new head of manifest write queue.
if (!manifest_writers_.empty()) {
manifest_writers_.front()->cv.Signal();
}
return Status::ColumnFamilyDropped();
}
return ProcessManifestWrites(writers, mu, db_directory, new_descriptor_log,
new_cf_options);
}
void VersionSet::LogAndApplyCFHelper(VersionEdit* edit) {
assert(edit->IsColumnFamilyManipulation());
edit->SetNextFile(next_file_number_.load());
// The log might have data that is not visible to memtbale and hence have not
// updated the last_sequence_ yet. It is also possible that the log has is
// expecting some new data that is not written yet. Since LastSequence is an
// upper bound on the sequence, it is ok to record
// last_allocated_sequence_ as the last sequence.
edit->SetLastSequence(db_options_->two_write_queues ? last_allocated_sequence_
: last_sequence_);
if (edit->is_column_family_drop_) {
// if we drop column family, we have to make sure to save max column family,
// so that we don't reuse existing ID
edit->SetMaxColumnFamily(column_family_set_->GetMaxColumnFamily());
}
}
Status VersionSet::LogAndApplyHelper(ColumnFamilyData* cfd,
VersionBuilder* builder, VersionEdit* edit,
InstrumentedMutex* mu) {
#ifdef NDEBUG
(void)cfd;
#endif
mu->AssertHeld();
assert(!edit->IsColumnFamilyManipulation());
if (edit->has_log_number_) {
assert(edit->log_number_ >= cfd->GetLogNumber());
assert(edit->log_number_ < next_file_number_.load());
}
if (!edit->has_prev_log_number_) {
edit->SetPrevLogNumber(prev_log_number_);
}
edit->SetNextFile(next_file_number_.load());
// The log might have data that is not visible to memtbale and hence have not
// updated the last_sequence_ yet. It is also possible that the log has is
// expecting some new data that is not written yet. Since LastSequence is an
// upper bound on the sequence, it is ok to record
// last_allocated_sequence_ as the last sequence.
edit->SetLastSequence(db_options_->two_write_queues ? last_allocated_sequence_
: last_sequence_);
Status s = builder->Apply(edit);
return s;
}
Status VersionSet::ApplyOneVersionEditToBuilder(
VersionEdit& edit,
const std::unordered_map<std::string, ColumnFamilyOptions>& name_to_options,
std::unordered_map<int, std::string>& column_families_not_found,
std::unordered_map<uint32_t, std::unique_ptr<BaseReferencedVersionBuilder>>&
builders,
VersionEditParams* version_edit_params) {
// Not found means that user didn't supply that column
// family option AND we encountered column family add
// record. Once we encounter column family drop record,
// we will delete the column family from
// column_families_not_found.
bool cf_in_not_found = (column_families_not_found.find(edit.column_family_) !=
column_families_not_found.end());
// in builders means that user supplied that column family
// option AND that we encountered column family add record
bool cf_in_builders = builders.find(edit.column_family_) != builders.end();
// they can't both be true
assert(!(cf_in_not_found && cf_in_builders));
ColumnFamilyData* cfd = nullptr;
if (edit.is_column_family_add_) {
if (cf_in_builders || cf_in_not_found) {
return Status::Corruption(
"Manifest adding the same column family twice: " +
edit.column_family_name_);
}
auto cf_options = name_to_options.find(edit.column_family_name_);
// implicitly add persistent_stats column family without requiring user
// to specify
bool is_persistent_stats_column_family =
edit.column_family_name_.compare(kPersistentStatsColumnFamilyName) == 0;
if (cf_options == name_to_options.end() &&
!is_persistent_stats_column_family) {
column_families_not_found.insert(
{edit.column_family_, edit.column_family_name_});
} else {
// recover persistent_stats CF from a DB that already contains it
if (is_persistent_stats_column_family) {
ColumnFamilyOptions cfo;
OptimizeForPersistentStats(&cfo);
cfd = CreateColumnFamily(cfo, &edit);
} else {
cfd = CreateColumnFamily(cf_options->second, &edit);
}
cfd->set_initialized();
builders.insert(std::make_pair(
edit.column_family_, std::unique_ptr<BaseReferencedVersionBuilder>(
new BaseReferencedVersionBuilder(cfd))));
}
} else if (edit.is_column_family_drop_) {
if (cf_in_builders) {
auto builder = builders.find(edit.column_family_);
assert(builder != builders.end());
builders.erase(builder);
cfd = column_family_set_->GetColumnFamily(edit.column_family_);
assert(cfd != nullptr);
if (cfd->Unref()) {
delete cfd;
cfd = nullptr;
} else {
// who else can have reference to cfd!?
assert(false);
}
} else if (cf_in_not_found) {
column_families_not_found.erase(edit.column_family_);
} else {
return Status::Corruption(
"Manifest - dropping non-existing column family");
}
} else if (!cf_in_not_found) {
if (!cf_in_builders) {
return Status::Corruption(
"Manifest record referencing unknown column family");
}
cfd = column_family_set_->GetColumnFamily(edit.column_family_);
// this should never happen since cf_in_builders is true
assert(cfd != nullptr);
// if it is not column family add or column family drop,
// then it's a file add/delete, which should be forwarded
// to builder
auto builder = builders.find(edit.column_family_);
assert(builder != builders.end());
Status s = builder->second->version_builder()->Apply(&edit);
if (!s.ok()) {
return s;
}
}
return ExtractInfoFromVersionEdit(cfd, edit, version_edit_params);
}
Status VersionSet::ExtractInfoFromVersionEdit(
ColumnFamilyData* cfd, const VersionEdit& from_edit,
VersionEditParams* version_edit_params) {
if (cfd != nullptr) {
if (from_edit.has_db_id_) {
version_edit_params->SetDBId(from_edit.db_id_);
}
if (from_edit.has_log_number_) {
if (cfd->GetLogNumber() > from_edit.log_number_) {
ROCKS_LOG_WARN(
db_options_->info_log,
"MANIFEST corruption detected, but ignored - Log numbers in "
"records NOT monotonically increasing");
} else {
cfd->SetLogNumber(from_edit.log_number_);
version_edit_params->SetLogNumber(from_edit.log_number_);
}
}
if (from_edit.has_comparator_ &&
from_edit.comparator_ != cfd->user_comparator()->Name()) {
return Status::InvalidArgument(
cfd->user_comparator()->Name(),
"does not match existing comparator " + from_edit.comparator_);
}
}
if (from_edit.has_prev_log_number_) {
version_edit_params->SetPrevLogNumber(from_edit.prev_log_number_);
}
if (from_edit.has_next_file_number_) {
version_edit_params->SetNextFile(from_edit.next_file_number_);
}
if (from_edit.has_max_column_family_) {
version_edit_params->SetMaxColumnFamily(from_edit.max_column_family_);
}
if (from_edit.has_min_log_number_to_keep_) {
version_edit_params->min_log_number_to_keep_ =
std::max(version_edit_params->min_log_number_to_keep_,
from_edit.min_log_number_to_keep_);
}
if (from_edit.has_last_sequence_) {
version_edit_params->SetLastSequence(from_edit.last_sequence_);
}
return Status::OK();
}
Status VersionSet::GetCurrentManifestPath(const std::string& dbname, Env* env,
std::string* manifest_path,
uint64_t* manifest_file_number) {
assert(env != nullptr);
assert(manifest_path != nullptr);
assert(manifest_file_number != nullptr);
std::string fname;
Status s = ReadFileToString(env, CurrentFileName(dbname), &fname);
if (!s.ok()) {
return s;
}
if (fname.empty() || fname.back() != '\n') {
return Status::Corruption("CURRENT file does not end with newline");
}
// remove the trailing '\n'
fname.resize(fname.size() - 1);
FileType type;
bool parse_ok = ParseFileName(fname, manifest_file_number, &type);
if (!parse_ok || type != kDescriptorFile) {
return Status::Corruption("CURRENT file corrupted");
}
*manifest_path = dbname;
if (dbname.back() != '/') {
manifest_path->push_back('/');
}
*manifest_path += fname;
return Status::OK();
}
Status VersionSet::ReadAndRecover(
log::Reader* reader, AtomicGroupReadBuffer* read_buffer,
const std::unordered_map<std::string, ColumnFamilyOptions>& name_to_options,
std::unordered_map<int, std::string>& column_families_not_found,
std::unordered_map<uint32_t, std::unique_ptr<BaseReferencedVersionBuilder>>&
builders,
VersionEditParams* version_edit_params, std::string* db_id) {
assert(reader != nullptr);
assert(read_buffer != nullptr);
Status s;
Slice record;
std::string scratch;
size_t recovered_edits = 0;
while (reader->ReadRecord(&record, &scratch) && s.ok()) {
VersionEdit edit;
s = edit.DecodeFrom(record);
if (!s.ok()) {
break;
}
if (edit.has_db_id_) {
db_id_ = edit.GetDbId();
if (db_id != nullptr) {
db_id->assign(edit.GetDbId());
}
}
s = read_buffer->AddEdit(&edit);
if (!s.ok()) {
break;
}
if (edit.is_in_atomic_group_) {
if (read_buffer->IsFull()) {
// Apply edits in an atomic group when we have read all edits in the
// group.
for (auto& e : read_buffer->replay_buffer()) {
s = ApplyOneVersionEditToBuilder(e, name_to_options,
column_families_not_found, builders,
version_edit_params);
if (!s.ok()) {
break;
}
recovered_edits++;
}
if (!s.ok()) {
break;
}
read_buffer->Clear();
}
} else {
// Apply a normal edit immediately.
s = ApplyOneVersionEditToBuilder(edit, name_to_options,
column_families_not_found, builders,
version_edit_params);
if (s.ok()) {
recovered_edits++;
}
}
}
if (!s.ok()) {
// Clear the buffer if we fail to decode/apply an edit.
read_buffer->Clear();
}
TEST_SYNC_POINT_CALLBACK("VersionSet::ReadAndRecover:RecoveredEdits",
&recovered_edits);
return s;
}
Status VersionSet::Recover(
const std::vector<ColumnFamilyDescriptor>& column_families, bool read_only,
std::string* db_id) {
std::unordered_map<std::string, ColumnFamilyOptions> cf_name_to_options;
for (auto cf : column_families) {
cf_name_to_options.insert({cf.name, cf.options});
}
// keeps track of column families in manifest that were not found in
// column families parameters. if those column families are not dropped
// by subsequent manifest records, Recover() will return failure status
std::unordered_map<int, std::string> column_families_not_found;
// Read "CURRENT" file, which contains a pointer to the current manifest file
std::string manifest_path;
Status s = GetCurrentManifestPath(dbname_, env_, &manifest_path,
&manifest_file_number_);
if (!s.ok()) {
return s;
}
ROCKS_LOG_INFO(db_options_->info_log, "Recovering from manifest file: %s\n",
manifest_path.c_str());
std::unique_ptr<SequentialFileReader> manifest_file_reader;
{
std::unique_ptr<SequentialFile> manifest_file;
s = env_->NewSequentialFile(manifest_path, &manifest_file,
env_->OptimizeForManifestRead(env_options_));
if (!s.ok()) {
return s;
}
manifest_file_reader.reset(
new SequentialFileReader(std::move(manifest_file), manifest_path,
db_options_->log_readahead_size));
}
uint64_t current_manifest_file_size;
s = env_->GetFileSize(manifest_path, ¤t_manifest_file_size);
if (!s.ok()) {
return s;
}
std::unordered_map<uint32_t, std::unique_ptr<BaseReferencedVersionBuilder>>
builders;
// add default column family
auto default_cf_iter = cf_name_to_options.find(kDefaultColumnFamilyName);
if (default_cf_iter == cf_name_to_options.end()) {
return Status::InvalidArgument("Default column family not specified");
}
VersionEdit default_cf_edit;
default_cf_edit.AddColumnFamily(kDefaultColumnFamilyName);
default_cf_edit.SetColumnFamily(0);
ColumnFamilyData* default_cfd =
CreateColumnFamily(default_cf_iter->second, &default_cf_edit);
// In recovery, nobody else can access it, so it's fine to set it to be
// initialized earlier.
default_cfd->set_initialized();
builders.insert(
std::make_pair(0, std::unique_ptr<BaseReferencedVersionBuilder>(
new BaseReferencedVersionBuilder(default_cfd))));
VersionEditParams version_edit_params;
{
VersionSet::LogReporter reporter;
reporter.status = &s;
log::Reader reader(nullptr, std::move(manifest_file_reader), &reporter,
true /* checksum */, 0 /* log_number */);
Slice record;
std::string scratch;
AtomicGroupReadBuffer read_buffer;
s = ReadAndRecover(&reader, &read_buffer, cf_name_to_options,
column_families_not_found, builders,
&version_edit_params, db_id);
}
if (s.ok()) {
if (!version_edit_params.has_next_file_number_) {
s = Status::Corruption("no meta-nextfile entry in descriptor");
} else if (!version_edit_params.has_log_number_) {
s = Status::Corruption("no meta-lognumber entry in descriptor");
} else if (!version_edit_params.has_last_sequence_) {
s = Status::Corruption("no last-sequence-number entry in descriptor");
}
if (!version_edit_params.has_prev_log_number_) {
version_edit_params.SetPrevLogNumber(0);
}
column_family_set_->UpdateMaxColumnFamily(
version_edit_params.max_column_family_);
// When reading DB generated using old release, min_log_number_to_keep=0.
// All log files will be scanned for potential prepare entries.
MarkMinLogNumberToKeep2PC(version_edit_params.min_log_number_to_keep_);
MarkFileNumberUsed(version_edit_params.prev_log_number_);
MarkFileNumberUsed(version_edit_params.log_number_);
}
// there were some column families in the MANIFEST that weren't specified
// in the argument. This is OK in read_only mode
if (read_only == false && !column_families_not_found.empty()) {
std::string list_of_not_found;
for (const auto& cf : column_families_not_found) {
list_of_not_found += ", " + cf.second;
}
list_of_not_found = list_of_not_found.substr(2);
s = Status::InvalidArgument(
"You have to open all column families. Column families not opened: " +
list_of_not_found);
}
if (s.ok()) {
for (auto cfd : *column_family_set_) {
assert(builders.count(cfd->GetID()) > 0);
auto* builder = builders[cfd->GetID()]->version_builder();
if (!builder->CheckConsistencyForNumLevels()) {
s = Status::InvalidArgument(
"db has more levels than options.num_levels");
break;
}
}
}
if (s.ok()) {
for (auto cfd : *column_family_set_) {
if (cfd->IsDropped()) {
continue;
}
if (read_only) {
cfd->table_cache()->SetTablesAreImmortal();
}
assert(cfd->initialized());
auto builders_iter = builders.find(cfd->GetID());
assert(builders_iter != builders.end());
auto builder = builders_iter->second->version_builder();
// unlimited table cache. Pre-load table handle now.
// Need to do it out of the mutex.
builder->LoadTableHandlers(
cfd->internal_stats(), db_options_->max_file_opening_threads,
false /* prefetch_index_and_filter_in_cache */,
true /* is_initial_load */,
cfd->GetLatestMutableCFOptions()->prefix_extractor.get());
Version* v = new Version(cfd, this, env_options_,
*cfd->GetLatestMutableCFOptions(),
current_version_number_++);
builder->SaveTo(v->storage_info());
// Install recovered version
v->PrepareApply(*cfd->GetLatestMutableCFOptions(),
!(db_options_->skip_stats_update_on_db_open));
AppendVersion(cfd, v);
}
manifest_file_size_ = current_manifest_file_size;
next_file_number_.store(version_edit_params.next_file_number_ + 1);
last_allocated_sequence_ = version_edit_params.last_sequence_;
last_published_sequence_ = version_edit_params.last_sequence_;
last_sequence_ = version_edit_params.last_sequence_;
prev_log_number_ = version_edit_params.prev_log_number_;
ROCKS_LOG_INFO(
db_options_->info_log,
"Recovered from manifest file:%s succeeded,"
"manifest_file_number is %" PRIu64 ", next_file_number is %" PRIu64
", last_sequence is %" PRIu64 ", log_number is %" PRIu64
",prev_log_number is %" PRIu64 ",max_column_family is %" PRIu32
",min_log_number_to_keep is %" PRIu64 "\n",
manifest_path.c_str(), manifest_file_number_, next_file_number_.load(),
last_sequence_.load(), version_edit_params.log_number_,
prev_log_number_, column_family_set_->GetMaxColumnFamily(),
min_log_number_to_keep_2pc());
for (auto cfd : *column_family_set_) {
if (cfd->IsDropped()) {
continue;
}
ROCKS_LOG_INFO(db_options_->info_log,
"Column family [%s] (ID %" PRIu32
"), log number is %" PRIu64 "\n",
cfd->GetName().c_str(), cfd->GetID(), cfd->GetLogNumber());
}
}
return s;
}
Status VersionSet::ListColumnFamilies(std::vector<std::string>* column_families,
const std::string& dbname, Env* env) {
// these are just for performance reasons, not correcntes,
// so we're fine using the defaults
EnvOptions soptions;
// Read "CURRENT" file, which contains a pointer to the current manifest file
std::string manifest_path;
uint64_t manifest_file_number;
Status s = GetCurrentManifestPath(dbname, env, &manifest_path,
&manifest_file_number);
if (!s.ok()) {
return s;
}
std::unique_ptr<SequentialFileReader> file_reader;
{
std::unique_ptr<SequentialFile> file;
s = env->NewSequentialFile(manifest_path, &file, soptions);
if (!s.ok()) {
return s;
}
file_reader.reset(new SequentialFileReader(std::move(file), manifest_path));
}
std::map<uint32_t, std::string> column_family_names;
// default column family is always implicitly there
column_family_names.insert({0, kDefaultColumnFamilyName});
VersionSet::LogReporter reporter;
reporter.status = &s;
log::Reader reader(nullptr, std::move(file_reader), &reporter,
true /* checksum */, 0 /* log_number */);
Slice record;
std::string scratch;
while (reader.ReadRecord(&record, &scratch) && s.ok()) {
VersionEdit edit;
s = edit.DecodeFrom(record);
if (!s.ok()) {
break;
}
if (edit.is_column_family_add_) {
if (column_family_names.find(edit.column_family_) !=
column_family_names.end()) {
s = Status::Corruption("Manifest adding the same column family twice");
break;
}
column_family_names.insert(
{edit.column_family_, edit.column_family_name_});
} else if (edit.is_column_family_drop_) {
if (column_family_names.find(edit.column_family_) ==
column_family_names.end()) {
s = Status::Corruption(
"Manifest - dropping non-existing column family");
break;
}
column_family_names.erase(edit.column_family_);
}
}
column_families->clear();
if (s.ok()) {
for (const auto& iter : column_family_names) {
column_families->push_back(iter.second);
}
}
return s;
}
#ifndef ROCKSDB_LITE
Status VersionSet::ReduceNumberOfLevels(const std::string& dbname,
const Options* options,
const EnvOptions& env_options,
int new_levels) {
if (new_levels <= 1) {
return Status::InvalidArgument(
"Number of levels needs to be bigger than 1");
}
ImmutableDBOptions db_options(*options);
ColumnFamilyOptions cf_options(*options);
std::shared_ptr<Cache> tc(NewLRUCache(options->max_open_files - 10,
options->table_cache_numshardbits));
WriteController wc(options->delayed_write_rate);
WriteBufferManager wb(options->db_write_buffer_size);
VersionSet versions(dbname, &db_options, env_options, tc.get(), &wb, &wc,
/*block_cache_tracer=*/nullptr);
Status status;
std::vector<ColumnFamilyDescriptor> dummy;
ColumnFamilyDescriptor dummy_descriptor(kDefaultColumnFamilyName,
ColumnFamilyOptions(*options));
dummy.push_back(dummy_descriptor);
status = versions.Recover(dummy);
if (!status.ok()) {
return status;
}
Version* current_version =
versions.GetColumnFamilySet()->GetDefault()->current();
auto* vstorage = current_version->storage_info();
int current_levels = vstorage->num_levels();
if (current_levels <= new_levels) {
return Status::OK();
}
// Make sure there are file only on one level from
// (new_levels-1) to (current_levels-1)
int first_nonempty_level = -1;
int first_nonempty_level_filenum = 0;
for (int i = new_levels - 1; i < current_levels; i++) {
int file_num = vstorage->NumLevelFiles(i);
if (file_num != 0) {
if (first_nonempty_level < 0) {
first_nonempty_level = i;
first_nonempty_level_filenum = file_num;
} else {
char msg[255];
snprintf(msg, sizeof(msg),
"Found at least two levels containing files: "
"[%d:%d],[%d:%d].\n",
first_nonempty_level, first_nonempty_level_filenum, i,
file_num);
return Status::InvalidArgument(msg);
}
}
}
// we need to allocate an array with the old number of levels size to
// avoid SIGSEGV in WriteCurrentStatetoManifest()
// however, all levels bigger or equal to new_levels will be empty
std::vector<FileMetaData*>* new_files_list =
new std::vector<FileMetaData*>[current_levels];
for (int i = 0; i < new_levels - 1; i++) {
new_files_list[i] = vstorage->LevelFiles(i);
}
if (first_nonempty_level > 0) {
new_files_list[new_levels - 1] = vstorage->LevelFiles(first_nonempty_level);
}
delete[] vstorage -> files_;
vstorage->files_ = new_files_list;
vstorage->num_levels_ = new_levels;
MutableCFOptions mutable_cf_options(*options);
VersionEdit ve;
InstrumentedMutex dummy_mutex;
InstrumentedMutexLock l(&dummy_mutex);
return versions.LogAndApply(
versions.GetColumnFamilySet()->GetDefault(),
mutable_cf_options, &ve, &dummy_mutex, nullptr, true);
}
Status VersionSet::DumpManifest(Options& options, std::string& dscname,
bool verbose, bool hex, bool json) {
// Open the specified manifest file.
std::unique_ptr<SequentialFileReader> file_reader;
Status s;
{
std::unique_ptr<SequentialFile> file;
s = options.env->NewSequentialFile(
dscname, &file, env_->OptimizeForManifestRead(env_options_));
if (!s.ok()) {
return s;
}
file_reader.reset(new SequentialFileReader(
std::move(file), dscname, db_options_->log_readahead_size));
}
bool have_prev_log_number = false;
bool have_next_file = false;
bool have_last_sequence = false;
uint64_t next_file = 0;
uint64_t last_sequence = 0;
uint64_t previous_log_number = 0;
int count = 0;
std::unordered_map<uint32_t, std::string> comparators;
std::unordered_map<uint32_t, std::unique_ptr<BaseReferencedVersionBuilder>>
builders;
// add default column family
VersionEdit default_cf_edit;
default_cf_edit.AddColumnFamily(kDefaultColumnFamilyName);
default_cf_edit.SetColumnFamily(0);
ColumnFamilyData* default_cfd =
CreateColumnFamily(ColumnFamilyOptions(options), &default_cf_edit);
builders.insert(
std::make_pair(0, std::unique_ptr<BaseReferencedVersionBuilder>(
new BaseReferencedVersionBuilder(default_cfd))));
{
VersionSet::LogReporter reporter;
reporter.status = &s;
log::Reader reader(nullptr, std::move(file_reader), &reporter,
true /* checksum */, 0 /* log_number */);
Slice record;
std::string scratch;
while (reader.ReadRecord(&record, &scratch) && s.ok()) {
VersionEdit edit;
s = edit.DecodeFrom(record);
if (!s.ok()) {
break;
}
// Write out each individual edit
if (verbose && !json) {
printf("%s\n", edit.DebugString(hex).c_str());
} else if (json) {
printf("%s\n", edit.DebugJSON(count, hex).c_str());
}
count++;
bool cf_in_builders =
builders.find(edit.column_family_) != builders.end();
if (edit.has_comparator_) {
comparators.insert({edit.column_family_, edit.comparator_});
}
ColumnFamilyData* cfd = nullptr;
if (edit.is_column_family_add_) {
if (cf_in_builders) {
s = Status::Corruption(
"Manifest adding the same column family twice");
break;
}
cfd = CreateColumnFamily(ColumnFamilyOptions(options), &edit);
cfd->set_initialized();
builders.insert(std::make_pair(
edit.column_family_, std::unique_ptr<BaseReferencedVersionBuilder>(
new BaseReferencedVersionBuilder(cfd))));
} else if (edit.is_column_family_drop_) {
if (!cf_in_builders) {
s = Status::Corruption(
"Manifest - dropping non-existing column family");
break;
}
auto builder_iter = builders.find(edit.column_family_);
builders.erase(builder_iter);
comparators.erase(edit.column_family_);
cfd = column_family_set_->GetColumnFamily(edit.column_family_);
assert(cfd != nullptr);
cfd->Unref();
delete cfd;
cfd = nullptr;
} else {
if (!cf_in_builders) {
s = Status::Corruption(
"Manifest record referencing unknown column family");
break;
}
cfd = column_family_set_->GetColumnFamily(edit.column_family_);
// this should never happen since cf_in_builders is true
assert(cfd != nullptr);
// if it is not column family add or column family drop,
// then it's a file add/delete, which should be forwarded
// to builder
auto builder = builders.find(edit.column_family_);
assert(builder != builders.end());
s = builder->second->version_builder()->Apply(&edit);
if (!s.ok()) {
break;
}
}
if (cfd != nullptr && edit.has_log_number_) {
cfd->SetLogNumber(edit.log_number_);
}
if (edit.has_prev_log_number_) {
previous_log_number = edit.prev_log_number_;
have_prev_log_number = true;
}
if (edit.has_next_file_number_) {
next_file = edit.next_file_number_;
have_next_file = true;
}
if (edit.has_last_sequence_) {
last_sequence = edit.last_sequence_;
have_last_sequence = true;
}
if (edit.has_max_column_family_) {
column_family_set_->UpdateMaxColumnFamily(edit.max_column_family_);
}
if (edit.has_min_log_number_to_keep_) {
MarkMinLogNumberToKeep2PC(edit.min_log_number_to_keep_);
}
}
}
file_reader.reset();
if (s.ok()) {
if (!have_next_file) {
s = Status::Corruption("no meta-nextfile entry in descriptor");
printf("no meta-nextfile entry in descriptor");
} else if (!have_last_sequence) {
printf("no last-sequence-number entry in descriptor");
s = Status::Corruption("no last-sequence-number entry in descriptor");
}
if (!have_prev_log_number) {
previous_log_number = 0;
}
}
if (s.ok()) {
for (auto cfd : *column_family_set_) {
if (cfd->IsDropped()) {
continue;
}
auto builders_iter = builders.find(cfd->GetID());
assert(builders_iter != builders.end());
auto builder = builders_iter->second->version_builder();
Version* v = new Version(cfd, this, env_options_,
*cfd->GetLatestMutableCFOptions(),
current_version_number_++);
builder->SaveTo(v->storage_info());
v->PrepareApply(*cfd->GetLatestMutableCFOptions(), false);
printf("--------------- Column family \"%s\" (ID %" PRIu32
") --------------\n",
cfd->GetName().c_str(), cfd->GetID());
printf("log number: %" PRIu64 "\n", cfd->GetLogNumber());
auto comparator = comparators.find(cfd->GetID());
if (comparator != comparators.end()) {
printf("comparator: %s\n", comparator->second.c_str());
} else {
printf("comparator: <NO COMPARATOR>\n");
}
printf("%s \n", v->DebugString(hex).c_str());
delete v;
}
next_file_number_.store(next_file + 1);
last_allocated_sequence_ = last_sequence;
last_published_sequence_ = last_sequence;
last_sequence_ = last_sequence;
prev_log_number_ = previous_log_number;
printf("next_file_number %" PRIu64 " last_sequence %" PRIu64
" prev_log_number %" PRIu64 " max_column_family %" PRIu32
" min_log_number_to_keep "
"%" PRIu64 "\n",
next_file_number_.load(), last_sequence, previous_log_number,
column_family_set_->GetMaxColumnFamily(),
min_log_number_to_keep_2pc());
}
return s;
}
#endif // ROCKSDB_LITE
void VersionSet::MarkFileNumberUsed(uint64_t number) {
// only called during recovery and repair which are single threaded, so this
// works because there can't be concurrent calls
if (next_file_number_.load(std::memory_order_relaxed) <= number) {
next_file_number_.store(number + 1, std::memory_order_relaxed);
}
}
// Called only either from ::LogAndApply which is protected by mutex or during
// recovery which is single-threaded.
void VersionSet::MarkMinLogNumberToKeep2PC(uint64_t number) {
if (min_log_number_to_keep_2pc_.load(std::memory_order_relaxed) < number) {
min_log_number_to_keep_2pc_.store(number, std::memory_order_relaxed);
}
}
Status VersionSet::WriteCurrentStateToManifest(log::Writer* log) {
// TODO: Break up into multiple records to reduce memory usage on recovery?
// WARNING: This method doesn't hold a mutex!!
// This is done without DB mutex lock held, but only within single-threaded
// LogAndApply. Column family manipulations can only happen within LogAndApply
// (the same single thread), so we're safe to iterate.
if (db_options_->write_dbid_to_manifest) {
VersionEdit edit_for_db_id;
assert(!db_id_.empty());
edit_for_db_id.SetDBId(db_id_);
std::string db_id_record;
if (!edit_for_db_id.EncodeTo(&db_id_record)) {
return Status::Corruption("Unable to Encode VersionEdit:" +
edit_for_db_id.DebugString(true));
}
Status add_record = log->AddRecord(db_id_record);
if (!add_record.ok()) {
return add_record;
}
}
for (auto cfd : *column_family_set_) {
if (cfd->IsDropped()) {
continue;
}
assert(cfd->initialized());
{
// Store column family info
VersionEdit edit;
if (cfd->GetID() != 0) {
// default column family is always there,
// no need to explicitly write it
edit.AddColumnFamily(cfd->GetName());
edit.SetColumnFamily(cfd->GetID());
}
edit.SetComparatorName(
cfd->internal_comparator().user_comparator()->Name());
std::string record;
if (!edit.EncodeTo(&record)) {
return Status::Corruption(
"Unable to Encode VersionEdit:" + edit.DebugString(true));
}
Status s = log->AddRecord(record);
if (!s.ok()) {
return s;
}
}
{
// Save files
VersionEdit edit;
edit.SetColumnFamily(cfd->GetID());
for (int level = 0; level < cfd->NumberLevels(); level++) {
for (const auto& f :
cfd->current()->storage_info()->LevelFiles(level)) {
edit.AddFile(level, f->fd.GetNumber(), f->fd.GetPathId(),
f->fd.GetFileSize(), f->smallest, f->largest,
f->fd.smallest_seqno, f->fd.largest_seqno,
f->marked_for_compaction);
}
}
edit.SetLogNumber(cfd->GetLogNumber());
std::string record;
if (!edit.EncodeTo(&record)) {
return Status::Corruption(
"Unable to Encode VersionEdit:" + edit.DebugString(true));
}
Status s = log->AddRecord(record);
if (!s.ok()) {
return s;
}
}
}
return Status::OK();
}
// TODO(aekmekji): in CompactionJob::GenSubcompactionBoundaries(), this
// function is called repeatedly with consecutive pairs of slices. For example
// if the slice list is [a, b, c, d] this function is called with arguments
// (a,b) then (b,c) then (c,d). Knowing this, an optimization is possible where
// we avoid doing binary search for the keys b and c twice and instead somehow
// maintain state of where they first appear in the files.
uint64_t VersionSet::ApproximateSize(const SizeApproximationOptions& options,
Version* v, const Slice& start,
const Slice& end, int start_level,
int end_level, TableReaderCaller caller) {
const auto& icmp = v->cfd_->internal_comparator();
// pre-condition
assert(icmp.Compare(start, end) <= 0);
uint64_t total_full_size = 0;
const auto* vstorage = v->storage_info();
const int num_non_empty_levels = vstorage->num_non_empty_levels();
end_level = (end_level == -1) ? num_non_empty_levels
: std::min(end_level, num_non_empty_levels);
assert(start_level <= end_level);
// Outline of the optimization that uses options.files_size_error_margin.
// When approximating the files total size that is used to store a keys range,
// we first sum up the sizes of the files that fully fall into the range.
// Then we sum up the sizes of all the files that may intersect with the range
// (this includes all files in L0 as well). Then, if total_intersecting_size
// is smaller than total_full_size * options.files_size_error_margin - we can
// infer that the intersecting files have a sufficiently negligible
// contribution to the total size, and we can approximate the storage required
// for the keys in range as just half of the intersecting_files_size.
// E.g., if the value of files_size_error_margin is 0.1, then the error of the
// approximation is limited to only ~10% of the total size of files that fully
// fall into the keys range. In such case, this helps to avoid a costly
// process of binary searching the intersecting files that is required only
// for a more precise calculation of the total size.
autovector<FdWithKeyRange*, 32> first_files;
autovector<FdWithKeyRange*, 16> last_files;
// scan all the levels
for (int level = start_level; level < end_level; ++level) {
const LevelFilesBrief& files_brief = vstorage->LevelFilesBrief(level);
if (files_brief.num_files == 0) {
// empty level, skip exploration
continue;
}
if (level == 0) {
// level 0 files are not in sorted order, we need to iterate through
// the list to compute the total bytes that require scanning,
// so handle the case explicitly (similarly to first_files case)
for (size_t i = 0; i < files_brief.num_files; i++) {
first_files.push_back(&files_brief.files[i]);
}
continue;
}
assert(level > 0);
assert(files_brief.num_files > 0);
// identify the file position for start key
const int idx_start =
FindFileInRange(icmp, files_brief, start, 0,
static_cast<uint32_t>(files_brief.num_files - 1));
assert(static_cast<size_t>(idx_start) < files_brief.num_files);
// identify the file position for end key
int idx_end = idx_start;
if (icmp.Compare(files_brief.files[idx_end].largest_key, end) < 0) {
idx_end =
FindFileInRange(icmp, files_brief, end, idx_start,
static_cast<uint32_t>(files_brief.num_files - 1));
}
assert(idx_end >= idx_start &&
static_cast<size_t>(idx_end) < files_brief.num_files);
// scan all files from the starting index to the ending index
// (inferred from the sorted order)
// first scan all the intermediate full files (excluding first and last)
for (int i = idx_start + 1; i < idx_end; ++i) {
uint64_t file_size = files_brief.files[i].fd.GetFileSize();
// The entire file falls into the range, so we can just take its size.
assert(file_size ==
ApproximateSize(v, files_brief.files[i], start, end, caller));
total_full_size += file_size;
}
// save the first and the last files (which may be the same file), so we
// can scan them later.
first_files.push_back(&files_brief.files[idx_start]);
if (idx_start != idx_end) {
// we need to estimate size for both files, only if they are different
last_files.push_back(&files_brief.files[idx_end]);
}
}
// The sum of all file sizes that intersect the [start, end] keys range.
uint64_t total_intersecting_size = 0;
for (const auto* file_ptr : first_files) {
total_intersecting_size += file_ptr->fd.GetFileSize();
}
for (const auto* file_ptr : last_files) {
total_intersecting_size += file_ptr->fd.GetFileSize();
}
// Now scan all the first & last files at each level, and estimate their size.
// If the total_intersecting_size is less than X% of the total_full_size - we
// want to approximate the result in order to avoid the costly binary search
// inside ApproximateSize. We use half of file size as an approximation below.
const double margin = options.files_size_error_margin;
if (margin > 0 && total_intersecting_size <
static_cast<uint64_t>(total_full_size * margin)) {
total_full_size += total_intersecting_size / 2;
} else {
// Estimate for all the first files, at each level
for (const auto file_ptr : first_files) {
total_full_size += ApproximateSize(v, *file_ptr, start, end, caller);
}
// Estimate for all the last files, at each level
for (const auto file_ptr : last_files) {
// We could use ApproximateSize here, but calling ApproximateOffsetOf
// directly is just more efficient.
total_full_size += ApproximateOffsetOf(v, *file_ptr, end, caller);
}
}
return total_full_size;
}
uint64_t VersionSet::ApproximateOffsetOf(Version* v, const FdWithKeyRange& f,
const Slice& key,
TableReaderCaller caller) {
// pre-condition
assert(v);
const auto& icmp = v->cfd_->internal_comparator();
uint64_t result = 0;
if (icmp.Compare(f.largest_key, key) <= 0) {
// Entire file is before "key", so just add the file size
result = f.fd.GetFileSize();
} else if (icmp.Compare(f.smallest_key, key) > 0) {
// Entire file is after "key", so ignore
result = 0;
} else {
// "key" falls in the range for this table. Add the
// approximate offset of "key" within the table.
TableCache* table_cache = v->cfd_->table_cache();
if (table_cache != nullptr) {
result = table_cache->ApproximateOffsetOf(
key, f.file_metadata->fd, caller, icmp,
v->GetMutableCFOptions().prefix_extractor.get());
}
}
return result;
}
uint64_t VersionSet::ApproximateSize(Version* v, const FdWithKeyRange& f,
const Slice& start, const Slice& end,
TableReaderCaller caller) {
// pre-condition
assert(v);
const auto& icmp = v->cfd_->internal_comparator();
assert(icmp.Compare(start, end) <= 0);
if (icmp.Compare(f.largest_key, start) <= 0 ||
icmp.Compare(f.smallest_key, end) > 0) {
// Entire file is before or after the start/end keys range
return 0;
}
if (icmp.Compare(f.smallest_key, start) >= 0) {
// Start of the range is before the file start - approximate by end offset
return ApproximateOffsetOf(v, f, end, caller);
}
if (icmp.Compare(f.largest_key, end) < 0) {
// End of the range is after the file end - approximate by subtracting
// start offset from the file size
uint64_t start_offset = ApproximateOffsetOf(v, f, start, caller);
assert(f.fd.GetFileSize() >= start_offset);
return f.fd.GetFileSize() - start_offset;
}
// The interval falls entirely in the range for this file.
TableCache* table_cache = v->cfd_->table_cache();
if (table_cache == nullptr) {
return 0;
}
return table_cache->ApproximateSize(
start, end, f.file_metadata->fd, caller, icmp,
v->GetMutableCFOptions().prefix_extractor.get());
}
void VersionSet::AddLiveFiles(std::vector<FileDescriptor>* live_list) {
// pre-calculate space requirement
int64_t total_files = 0;
for (auto cfd : *column_family_set_) {
if (!cfd->initialized()) {
continue;
}
Version* dummy_versions = cfd->dummy_versions();
for (Version* v = dummy_versions->next_; v != dummy_versions;
v = v->next_) {
const auto* vstorage = v->storage_info();
for (int level = 0; level < vstorage->num_levels(); level++) {
total_files += vstorage->LevelFiles(level).size();
}
}
}
// just one time extension to the right size
live_list->reserve(live_list->size() + static_cast<size_t>(total_files));
for (auto cfd : *column_family_set_) {
if (!cfd->initialized()) {
continue;
}
auto* current = cfd->current();
bool found_current = false;
Version* dummy_versions = cfd->dummy_versions();
for (Version* v = dummy_versions->next_; v != dummy_versions;
v = v->next_) {
v->AddLiveFiles(live_list);
if (v == current) {
found_current = true;
}
}
if (!found_current && current != nullptr) {
// Should never happen unless it is a bug.
assert(false);
current->AddLiveFiles(live_list);
}
}
}
InternalIterator* VersionSet::MakeInputIterator(
const Compaction* c, RangeDelAggregator* range_del_agg,
const EnvOptions& env_options_compactions) {
auto cfd = c->column_family_data();
ReadOptions read_options;
read_options.verify_checksums = true;
read_options.fill_cache = false;
// Compaction iterators shouldn't be confined to a single prefix.
// Compactions use Seek() for
// (a) concurrent compactions,
// (b) CompactionFilter::Decision::kRemoveAndSkipUntil.
read_options.total_order_seek = true;
// Level-0 files have to be merged together. For other levels,
// we will make a concatenating iterator per level.
// TODO(opt): use concatenating iterator for level-0 if there is no overlap
const size_t space = (c->level() == 0 ? c->input_levels(0)->num_files +
c->num_input_levels() - 1
: c->num_input_levels());
InternalIterator** list = new InternalIterator* [space];
size_t num = 0;
for (size_t which = 0; which < c->num_input_levels(); which++) {
if (c->input_levels(which)->num_files != 0) {
if (c->level(which) == 0) {
const LevelFilesBrief* flevel = c->input_levels(which);
for (size_t i = 0; i < flevel->num_files; i++) {
list[num++] = cfd->table_cache()->NewIterator(
read_options, env_options_compactions, cfd->internal_comparator(),
*flevel->files[i].file_metadata, range_del_agg,
c->mutable_cf_options()->prefix_extractor.get(),
/*table_reader_ptr=*/nullptr,
/*file_read_hist=*/nullptr, TableReaderCaller::kCompaction,
/*arena=*/nullptr,
/*skip_filters=*/false, /*level=*/static_cast<int>(which),
/*smallest_compaction_key=*/nullptr,
/*largest_compaction_key=*/nullptr);
}
} else {
// Create concatenating iterator for the files from this level
list[num++] = new LevelIterator(
cfd->table_cache(), read_options, env_options_compactions,
cfd->internal_comparator(), c->input_levels(which),
c->mutable_cf_options()->prefix_extractor.get(),
/*should_sample=*/false,
/*no per level latency histogram=*/nullptr,
TableReaderCaller::kCompaction, /*skip_filters=*/false,
/*level=*/static_cast<int>(which), range_del_agg,
c->boundaries(which));
}
}
}
assert(num <= space);
InternalIterator* result =
NewMergingIterator(&c->column_family_data()->internal_comparator(), list,
static_cast<int>(num));
delete[] list;
return result;
}
// verify that the files listed in this compaction are present
// in the current version
bool VersionSet::VerifyCompactionFileConsistency(Compaction* c) {
#ifndef NDEBUG
Version* version = c->column_family_data()->current();
const VersionStorageInfo* vstorage = version->storage_info();
if (c->input_version() != version) {
ROCKS_LOG_INFO(
db_options_->info_log,
"[%s] compaction output being applied to a different base version from"
" input version",
c->column_family_data()->GetName().c_str());
if (vstorage->compaction_style_ == kCompactionStyleLevel &&
c->start_level() == 0 && c->num_input_levels() > 2U) {
// We are doing a L0->base_level compaction. The assumption is if
// base level is not L1, levels from L1 to base_level - 1 is empty.
// This is ensured by having one compaction from L0 going on at the
// same time in level-based compaction. So that during the time, no
// compaction/flush can put files to those levels.
for (int l = c->start_level() + 1; l < c->output_level(); l++) {
if (vstorage->NumLevelFiles(l) != 0) {
return false;
}
}
}
}
for (size_t input = 0; input < c->num_input_levels(); ++input) {
int level = c->level(input);
for (size_t i = 0; i < c->num_input_files(input); ++i) {
uint64_t number = c->input(input, i)->fd.GetNumber();
bool found = false;
for (size_t j = 0; j < vstorage->files_[level].size(); j++) {
FileMetaData* f = vstorage->files_[level][j];
if (f->fd.GetNumber() == number) {
found = true;
break;
}
}
if (!found) {
return false; // input files non existent in current version
}
}
}
#else
(void)c;
#endif
return true; // everything good
}
Status VersionSet::GetMetadataForFile(uint64_t number, int* filelevel,
FileMetaData** meta,
ColumnFamilyData** cfd) {
for (auto cfd_iter : *column_family_set_) {
if (!cfd_iter->initialized()) {
continue;
}
Version* version = cfd_iter->current();
const auto* vstorage = version->storage_info();
for (int level = 0; level < vstorage->num_levels(); level++) {
for (const auto& file : vstorage->LevelFiles(level)) {
if (file->fd.GetNumber() == number) {
*meta = file;
*filelevel = level;
*cfd = cfd_iter;
return Status::OK();
}
}
}
}
return Status::NotFound("File not present in any level");
}
void VersionSet::GetLiveFilesMetaData(std::vector<LiveFileMetaData>* metadata) {
for (auto cfd : *column_family_set_) {
if (cfd->IsDropped() || !cfd->initialized()) {
continue;
}
for (int level = 0; level < cfd->NumberLevels(); level++) {
for (const auto& file :
cfd->current()->storage_info()->LevelFiles(level)) {
LiveFileMetaData filemetadata;
filemetadata.column_family_name = cfd->GetName();
uint32_t path_id = file->fd.GetPathId();
if (path_id < cfd->ioptions()->cf_paths.size()) {
filemetadata.db_path = cfd->ioptions()->cf_paths[path_id].path;
} else {
assert(!cfd->ioptions()->cf_paths.empty());
filemetadata.db_path = cfd->ioptions()->cf_paths.back().path;
}
filemetadata.name = MakeTableFileName("", file->fd.GetNumber());
filemetadata.level = level;
filemetadata.size = static_cast<size_t>(file->fd.GetFileSize());
filemetadata.smallestkey = file->smallest.user_key().ToString();
filemetadata.largestkey = file->largest.user_key().ToString();
filemetadata.smallest_seqno = file->fd.smallest_seqno;
filemetadata.largest_seqno = file->fd.largest_seqno;
filemetadata.num_reads_sampled = file->stats.num_reads_sampled.load(
std::memory_order_relaxed);
filemetadata.being_compacted = file->being_compacted;
filemetadata.num_entries = file->num_entries;
filemetadata.num_deletions = file->num_deletions;
metadata->push_back(filemetadata);
}
}
}
}
void VersionSet::GetObsoleteFiles(std::vector<ObsoleteFileInfo>* files,
std::vector<std::string>* manifest_filenames,
uint64_t min_pending_output) {
assert(manifest_filenames->empty());
obsolete_manifests_.swap(*manifest_filenames);
std::vector<ObsoleteFileInfo> pending_files;
for (auto& f : obsolete_files_) {
if (f.metadata->fd.GetNumber() < min_pending_output) {
files->push_back(std::move(f));
} else {
pending_files.push_back(std::move(f));
}
}
obsolete_files_.swap(pending_files);
}
ColumnFamilyData* VersionSet::CreateColumnFamily(
const ColumnFamilyOptions& cf_options, VersionEdit* edit) {
assert(edit->is_column_family_add_);
MutableCFOptions dummy_cf_options;
Version* dummy_versions =
new Version(nullptr, this, env_options_, dummy_cf_options);
// Ref() dummy version once so that later we can call Unref() to delete it
// by avoiding calling "delete" explicitly (~Version is private)
dummy_versions->Ref();
auto new_cfd = column_family_set_->CreateColumnFamily(
edit->column_family_name_, edit->column_family_, dummy_versions,
cf_options);
Version* v = new Version(new_cfd, this, env_options_,
*new_cfd->GetLatestMutableCFOptions(),
current_version_number_++);
// Fill level target base information.
v->storage_info()->CalculateBaseBytes(*new_cfd->ioptions(),
*new_cfd->GetLatestMutableCFOptions());
AppendVersion(new_cfd, v);
// GetLatestMutableCFOptions() is safe here without mutex since the
// cfd is not available to client
new_cfd->CreateNewMemtable(*new_cfd->GetLatestMutableCFOptions(),
LastSequence());
new_cfd->SetLogNumber(edit->log_number_);
return new_cfd;
}
uint64_t VersionSet::GetNumLiveVersions(Version* dummy_versions) {
uint64_t count = 0;
for (Version* v = dummy_versions->next_; v != dummy_versions; v = v->next_) {
count++;
}
return count;
}
uint64_t VersionSet::GetTotalSstFilesSize(Version* dummy_versions) {
std::unordered_set<uint64_t> unique_files;
uint64_t total_files_size = 0;
for (Version* v = dummy_versions->next_; v != dummy_versions; v = v->next_) {
VersionStorageInfo* storage_info = v->storage_info();
for (int level = 0; level < storage_info->num_levels_; level++) {
for (const auto& file_meta : storage_info->LevelFiles(level)) {
if (unique_files.find(file_meta->fd.packed_number_and_path_id) ==
unique_files.end()) {
unique_files.insert(file_meta->fd.packed_number_and_path_id);
total_files_size += file_meta->fd.GetFileSize();
}
}
}
}
return total_files_size;
}
ReactiveVersionSet::ReactiveVersionSet(const std::string& dbname,
const ImmutableDBOptions* _db_options,
const EnvOptions& _env_options,
Cache* table_cache,
WriteBufferManager* write_buffer_manager,
WriteController* write_controller)
: VersionSet(dbname, _db_options, _env_options, table_cache,
write_buffer_manager, write_controller,
/*block_cache_tracer=*/nullptr),
number_of_edits_to_skip_(0) {}
ReactiveVersionSet::~ReactiveVersionSet() {}
Status ReactiveVersionSet::Recover(
const std::vector<ColumnFamilyDescriptor>& column_families,
std::unique_ptr<log::FragmentBufferedReader>* manifest_reader,
std::unique_ptr<log::Reader::Reporter>* manifest_reporter,
std::unique_ptr<Status>* manifest_reader_status) {
assert(manifest_reader != nullptr);
assert(manifest_reporter != nullptr);
assert(manifest_reader_status != nullptr);
std::unordered_map<std::string, ColumnFamilyOptions> cf_name_to_options;
for (const auto& cf : column_families) {
cf_name_to_options.insert({cf.name, cf.options});
}
// add default column family
auto default_cf_iter = cf_name_to_options.find(kDefaultColumnFamilyName);
if (default_cf_iter == cf_name_to_options.end()) {
return Status::InvalidArgument("Default column family not specified");
}
VersionEdit default_cf_edit;
default_cf_edit.AddColumnFamily(kDefaultColumnFamilyName);
default_cf_edit.SetColumnFamily(0);
ColumnFamilyData* default_cfd =
CreateColumnFamily(default_cf_iter->second, &default_cf_edit);
// In recovery, nobody else can access it, so it's fine to set it to be
// initialized earlier.
default_cfd->set_initialized();
std::unordered_map<uint32_t, std::unique_ptr<BaseReferencedVersionBuilder>>
builders;
std::unordered_map<int, std::string> column_families_not_found;
builders.insert(
std::make_pair(0, std::unique_ptr<BaseReferencedVersionBuilder>(
new BaseReferencedVersionBuilder(default_cfd))));
manifest_reader_status->reset(new Status());
manifest_reporter->reset(new LogReporter());
static_cast<LogReporter*>(manifest_reporter->get())->status =
manifest_reader_status->get();
Status s = MaybeSwitchManifest(manifest_reporter->get(), manifest_reader);
log::Reader* reader = manifest_reader->get();
int retry = 0;
VersionEdit version_edit;
while (s.ok() && retry < 1) {
assert(reader != nullptr);
Slice record;
std::string scratch;
s = ReadAndRecover(reader, &read_buffer_, cf_name_to_options,
column_families_not_found, builders, &version_edit);
if (s.ok()) {
bool enough = version_edit.has_next_file_number_ &&
version_edit.has_log_number_ &&
version_edit.has_last_sequence_;
if (enough) {
for (const auto& cf : column_families) {
auto cfd = column_family_set_->GetColumnFamily(cf.name);
if (cfd == nullptr) {
enough = false;
break;
}
}
}
if (enough) {
for (const auto& cf : column_families) {
auto cfd = column_family_set_->GetColumnFamily(cf.name);
assert(cfd != nullptr);
if (!cfd->IsDropped()) {
auto builder_iter = builders.find(cfd->GetID());
assert(builder_iter != builders.end());
auto builder = builder_iter->second->version_builder();
assert(builder != nullptr);
s = builder->LoadTableHandlers(
cfd->internal_stats(), db_options_->max_file_opening_threads,
false /* prefetch_index_and_filter_in_cache */,
true /* is_initial_load */,
cfd->GetLatestMutableCFOptions()->prefix_extractor.get());
if (!s.ok()) {
enough = false;
if (s.IsPathNotFound()) {
s = Status::OK();
}
break;
}
}
}
}
if (enough) {
break;
}
}
++retry;
}
if (s.ok()) {
if (!version_edit.has_prev_log_number_) {
version_edit.prev_log_number_ = 0;
}
column_family_set_->UpdateMaxColumnFamily(version_edit.max_column_family_);
MarkMinLogNumberToKeep2PC(version_edit.min_log_number_to_keep_);
MarkFileNumberUsed(version_edit.prev_log_number_);
MarkFileNumberUsed(version_edit.log_number_);
for (auto cfd : *column_family_set_) {
assert(builders.count(cfd->GetID()) > 0);
auto builder = builders[cfd->GetID()]->version_builder();
if (!builder->CheckConsistencyForNumLevels()) {
s = Status::InvalidArgument(
"db has more levels than options.num_levels");
break;
}
}
}
if (s.ok()) {
for (auto cfd : *column_family_set_) {
if (cfd->IsDropped()) {
continue;
}
assert(cfd->initialized());
auto builders_iter = builders.find(cfd->GetID());
assert(builders_iter != builders.end());
auto* builder = builders_iter->second->version_builder();
Version* v = new Version(cfd, this, env_options_,
*cfd->GetLatestMutableCFOptions(),
current_version_number_++);
builder->SaveTo(v->storage_info());
// Install recovered version
v->PrepareApply(*cfd->GetLatestMutableCFOptions(),
!(db_options_->skip_stats_update_on_db_open));
AppendVersion(cfd, v);
}
next_file_number_.store(version_edit.next_file_number_ + 1);
last_allocated_sequence_ = version_edit.last_sequence_;
last_published_sequence_ = version_edit.last_sequence_;
last_sequence_ = version_edit.last_sequence_;
prev_log_number_ = version_edit.prev_log_number_;
for (auto cfd : *column_family_set_) {
if (cfd->IsDropped()) {
continue;
}
ROCKS_LOG_INFO(db_options_->info_log,
"Column family [%s] (ID %u), log number is %" PRIu64 "\n",
cfd->GetName().c_str(), cfd->GetID(), cfd->GetLogNumber());
}
}
return s;
}
Status ReactiveVersionSet::ReadAndApply(
InstrumentedMutex* mu,
std::unique_ptr<log::FragmentBufferedReader>* manifest_reader,
std::unordered_set<ColumnFamilyData*>* cfds_changed) {
assert(manifest_reader != nullptr);
assert(cfds_changed != nullptr);
mu->AssertHeld();
Status s;
uint64_t applied_edits = 0;
while (s.ok()) {
Slice record;
std::string scratch;
log::Reader* reader = manifest_reader->get();
std::string old_manifest_path = reader->file()->file_name();
while (reader->ReadRecord(&record, &scratch)) {
VersionEdit edit;
s = edit.DecodeFrom(record);
if (!s.ok()) {
break;
}
// Skip the first VersionEdits of each MANIFEST generated by
// VersionSet::WriteCurrentStatetoManifest.
if (number_of_edits_to_skip_ > 0) {
ColumnFamilyData* cfd =
column_family_set_->GetColumnFamily(edit.column_family_);
if (cfd != nullptr && !cfd->IsDropped()) {
--number_of_edits_to_skip_;
}
continue;
}
s = read_buffer_.AddEdit(&edit);
if (!s.ok()) {
break;
}
VersionEdit temp_edit;
if (edit.is_in_atomic_group_) {
if (read_buffer_.IsFull()) {
// Apply edits in an atomic group when we have read all edits in the
// group.
for (auto& e : read_buffer_.replay_buffer()) {
s = ApplyOneVersionEditToBuilder(e, cfds_changed, &temp_edit);
if (!s.ok()) {
break;
}
applied_edits++;
}
if (!s.ok()) {
break;
}
read_buffer_.Clear();
}
} else {
// Apply a normal edit immediately.
s = ApplyOneVersionEditToBuilder(edit, cfds_changed, &temp_edit);
if (s.ok()) {
applied_edits++;
}
}
}
if (!s.ok()) {
// Clear the buffer if we fail to decode/apply an edit.
read_buffer_.Clear();
}
// It's possible that:
// 1) s.IsCorruption(), indicating the current MANIFEST is corrupted.
// 2) we have finished reading the current MANIFEST.
// 3) we have encountered an IOError reading the current MANIFEST.
// We need to look for the next MANIFEST and start from there. If we cannot
// find the next MANIFEST, we should exit the loop.
s = MaybeSwitchManifest(reader->GetReporter(), manifest_reader);
reader = manifest_reader->get();
if (s.ok()) {
if (reader->file()->file_name() == old_manifest_path) {
// Still processing the same MANIFEST, thus no need to continue this
// loop since no record is available if we have reached here.
break;
} else {
// We have switched to a new MANIFEST whose first records have been
// generated by VersionSet::WriteCurrentStatetoManifest. Since the
// secondary instance has already finished recovering upon start, there
// is no need for the secondary to process these records. Actually, if
// the secondary were to replay these records, the secondary may end up
// adding the same SST files AGAIN to each column family, causing
// consistency checks done by VersionBuilder to fail. Therefore, we
// record the number of records to skip at the beginning of the new
// MANIFEST and ignore them.
number_of_edits_to_skip_ = 0;
for (auto* cfd : *column_family_set_) {
if (cfd->IsDropped()) {
continue;
}
// Increase number_of_edits_to_skip by 2 because
// WriteCurrentStatetoManifest() writes 2 version edits for each
// column family at the beginning of the newly-generated MANIFEST.
// TODO(yanqin) remove hard-coded value.
if (db_options_->write_dbid_to_manifest) {
number_of_edits_to_skip_ += 3;
} else {
number_of_edits_to_skip_ += 2;
}
}
}
}
}
if (s.ok()) {
for (auto cfd : *column_family_set_) {
auto builder_iter = active_version_builders_.find(cfd->GetID());
if (builder_iter == active_version_builders_.end()) {
continue;
}
auto builder = builder_iter->second->version_builder();
if (!builder->CheckConsistencyForNumLevels()) {
s = Status::InvalidArgument(
"db has more levels than options.num_levels");
break;
}
}
}
TEST_SYNC_POINT_CALLBACK("ReactiveVersionSet::ReadAndApply:AppliedEdits",
&applied_edits);
return s;
}
Status ReactiveVersionSet::ApplyOneVersionEditToBuilder(
VersionEdit& edit, std::unordered_set<ColumnFamilyData*>* cfds_changed,
VersionEdit* version_edit) {
ColumnFamilyData* cfd =
column_family_set_->GetColumnFamily(edit.column_family_);
// If we cannot find this column family in our column family set, then it
// may be a new column family created by the primary after the secondary
// starts. It is also possible that the secondary instance opens only a subset
// of column families. Ignore it for now.
if (nullptr == cfd) {
return Status::OK();
}
if (active_version_builders_.find(edit.column_family_) ==
active_version_builders_.end() && !cfd->IsDropped()) {
std::unique_ptr<BaseReferencedVersionBuilder> builder_guard(
new BaseReferencedVersionBuilder(cfd));
active_version_builders_.insert(
std::make_pair(edit.column_family_, std::move(builder_guard)));
}
auto builder_iter = active_version_builders_.find(edit.column_family_);
assert(builder_iter != active_version_builders_.end());
auto builder = builder_iter->second->version_builder();
assert(builder != nullptr);
if (edit.is_column_family_add_) {
// TODO (yanqin) for now the secondary ignores column families created
// after Open. This also simplifies handling of switching to a new MANIFEST
// and processing the snapshot of the system at the beginning of the
// MANIFEST.
} else if (edit.is_column_family_drop_) {
// Drop the column family by setting it to be 'dropped' without destroying
// the column family handle.
// TODO (haoyu) figure out how to handle column faimly drop for
// secondary instance. (Is it possible that the ref count for cfd is 0 but
// the ref count for its versions is higher than 0?)
cfd->SetDropped();
if (cfd->Unref()) {
delete cfd;
cfd = nullptr;
}
active_version_builders_.erase(builder_iter);
} else {
Status s = builder->Apply(&edit);
if (!s.ok()) {
return s;
}
}
Status s = ExtractInfoFromVersionEdit(cfd, edit, version_edit);
if (!s.ok()) {
return s;
}
if (cfd != nullptr && !cfd->IsDropped()) {
s = builder->LoadTableHandlers(
cfd->internal_stats(), db_options_->max_file_opening_threads,
false /* prefetch_index_and_filter_in_cache */,
false /* is_initial_load */,
cfd->GetLatestMutableCFOptions()->prefix_extractor.get());
TEST_SYNC_POINT_CALLBACK(
"ReactiveVersionSet::ApplyOneVersionEditToBuilder:"
"AfterLoadTableHandlers",
&s);
if (s.ok()) {
auto version = new Version(cfd, this, env_options_,
*cfd->GetLatestMutableCFOptions(),
current_version_number_++);
builder->SaveTo(version->storage_info());
version->PrepareApply(*cfd->GetLatestMutableCFOptions(), true);
AppendVersion(cfd, version);
active_version_builders_.erase(builder_iter);
if (cfds_changed->count(cfd) == 0) {
cfds_changed->insert(cfd);
}
} else if (s.IsPathNotFound()) {
s = Status::OK();
}
// Some other error has occurred during LoadTableHandlers.
}
if (version_edit->has_next_file_number()) {
next_file_number_.store(version_edit->next_file_number_ + 1);
}
if (version_edit->has_last_sequence_) {
last_allocated_sequence_ = version_edit->last_sequence_;
last_published_sequence_ = version_edit->last_sequence_;
last_sequence_ = version_edit->last_sequence_;
}
if (version_edit->has_prev_log_number_) {
prev_log_number_ = version_edit->prev_log_number_;
MarkFileNumberUsed(version_edit->prev_log_number_);
}
if (version_edit->has_log_number_) {
MarkFileNumberUsed(version_edit->log_number_);
}
column_family_set_->UpdateMaxColumnFamily(version_edit->max_column_family_);
MarkMinLogNumberToKeep2PC(version_edit->min_log_number_to_keep_);
return s;
}
Status ReactiveVersionSet::MaybeSwitchManifest(
log::Reader::Reporter* reporter,
std::unique_ptr<log::FragmentBufferedReader>* manifest_reader) {
assert(manifest_reader != nullptr);
Status s;
do {
std::string manifest_path;
s = GetCurrentManifestPath(dbname_, env_, &manifest_path,
&manifest_file_number_);
std::unique_ptr<SequentialFile> manifest_file;
if (s.ok()) {
if (nullptr == manifest_reader->get() ||
manifest_reader->get()->file()->file_name() != manifest_path) {
TEST_SYNC_POINT(
"ReactiveVersionSet::MaybeSwitchManifest:"
"AfterGetCurrentManifestPath:0");
TEST_SYNC_POINT(
"ReactiveVersionSet::MaybeSwitchManifest:"
"AfterGetCurrentManifestPath:1");
s = env_->NewSequentialFile(
manifest_path, &manifest_file,
env_->OptimizeForManifestRead(env_options_));
} else {
// No need to switch manifest.
break;
}
}
std::unique_ptr<SequentialFileReader> manifest_file_reader;
if (s.ok()) {
manifest_file_reader.reset(
new SequentialFileReader(std::move(manifest_file), manifest_path,
db_options_->log_readahead_size));
manifest_reader->reset(new log::FragmentBufferedReader(
nullptr, std::move(manifest_file_reader), reporter,
true /* checksum */, 0 /* log_number */));
ROCKS_LOG_INFO(db_options_->info_log, "Switched to new manifest: %s\n",
manifest_path.c_str());
// TODO (yanqin) every time we switch to a new MANIFEST, we clear the
// active_version_builders_ map because we choose to construct the
// versions from scratch, thanks to the first part of each MANIFEST
// written by VersionSet::WriteCurrentStatetoManifest. This is not
// necessary, but we choose this at present for the sake of simplicity.
active_version_builders_.clear();
}
} while (s.IsPathNotFound());
return s;
}
} // namespace rocksdb
|
[
"867245430@qq.com"
] |
867245430@qq.com
|
b4c0ea9dde3419daf0d187d89c2397b8e6b505d6
|
80d2631d40972c2c9581836d31aba485f6d76e66
|
/Engine/Renderer/Vulkan/src/Command/VKCommandEndRecord.h
|
fb684b85dbce6426f373cd1bc78365910f1bb667
|
[
"BSD-2-Clause"
] |
permissive
|
syejiang/AresEngine
|
a411426dcebee945cff6609c835dafd0ab6dd86c
|
16cd7746a5e2528b85685b45cf4e902e7d0f5f0e
|
refs/heads/master
| 2020-07-24T12:41:13.552474
| 2019-09-11T13:05:41
| 2019-09-11T13:05:41
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 535
|
h
|
#pragma once
#include "GfxCommandBuffer.h"
class CVKCommandEndRecord : public CGfxCommandBase
{
public:
CVKCommandEndRecord(VkCommandBuffer vkCommandBuffer)
: m_vkCommandBuffer(vkCommandBuffer)
{
Execute();
}
virtual ~CVKCommandEndRecord(void)
{
}
public:
virtual void Execute(void) const
{
ASSERT(m_vkCommandBuffer);
CGfxProfilerSample sample(CGfxProfiler::SAMPLE_TYPE_COMMAND_END_RECORD, "CommandEndRecord");
{
vkEndCommandBuffer(m_vkCommandBuffer);
}
}
private:
VkCommandBuffer m_vkCommandBuffer;
};
|
[
"LiangYue1981816@Hotmail.com"
] |
LiangYue1981816@Hotmail.com
|
46c1b4340ff046c08a85572c704c8874449434cc
|
6c3925c167d55577bff746bab9c0498b0f1a398d
|
/UDMF-Converter-EE/Lump.hpp
|
80d201437f962723db90324e8e1e5398b2337504
|
[] |
no_license
|
ioan-chera/UDMF-Converter-EE
|
82457e5b7ef5162f606f5ebb9d5523274bb7e85c
|
02f3db0ed4b1b400f52d379a2659c90042d27182
|
refs/heads/master
| 2021-01-11T22:27:19.390316
| 2019-10-03T07:44:32
| 2019-10-03T07:44:32
| 78,963,353
| 0
| 1
| null | 2017-09-02T12:57:13
| 2017-01-14T19:57:58
|
C++
|
UTF-8
|
C++
| false
| false
| 1,916
|
hpp
|
//
// UDMF Converter EE
// Copyright (C) 2017 Ioan Chera
//
// 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
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU 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/
//
// Additional terms and conditions compatible with the GPLv3 apply. See the
// file COPYING-EE for details.
//
// Purpose: Lump data class
// Authors: Ioan Chera
//
#ifndef Lump_hpp
#define Lump_hpp
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <istream>
#include <vector>
#include "Result.hpp"
enum
{
LumpNameLength = 8, // lump name size is limited
};
//
// Lump class
//
class Lump
{
public:
Lump()
{
memset(mName, 0, sizeof(mName));
}
explicit Lump(const char name[LumpNameLength + 1])
{
strcpy(mName, name);
}
Lump(const char name[LumpNameLength + 1], const std::string &text);
template<typename T>
Lump(const char name[LumpNameLength + 1], const std::vector<T> &data)
{
strcpy(mName, name);
mData.resize(data.size() * sizeof(T));
memcpy(mData.data(), data.data(), data.size() * sizeof(T));
}
Result Load(std::istream &is, size_t size);
const char *Name() const
{
return mName;
}
const std::vector<uint8_t> &Data() const
{
return mData;
}
private:
char mName[LumpNameLength + 1]; // lump name
std::vector<uint8_t> mData; // lump content
};
#endif /* Lump_hpp */
|
[
"ioan.chera@gmail.com"
] |
ioan.chera@gmail.com
|
4410f54cebe0cbe6e51eb78d5651e8515216e2a6
|
0f79a15057a46aa107aebfde8d8033341958c617
|
/src/stack.h
|
5b7cd30b22eef0cef57f129b94598d8e489dfde7
|
[] |
no_license
|
liuyuntian/AI-in-Maze
|
d9fd155ede0a73829b61f09169f741ee0d42b83c
|
f2c71619ca506d73151945ff0a41f40da5134242
|
refs/heads/master
| 2021-01-10T08:11:32.162562
| 2016-03-03T11:05:55
| 2016-03-03T11:05:55
| 53,043,763
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 655
|
h
|
//Yuntian Liu
//C00151315
#ifndef STACK_H
#define STACK_H
#include <iostream>
#include <list>
using namespace std;
class CStack
{
public:
void Push(void *pData)
{
m_dataList.push_back(pData);
}
void* Pop()
{
void *ptr = NULL;
list<void *>::iterator it = m_dataList.end();
it--;
ptr = *it;
m_dataList.pop_back();
return ptr;
}
void Clear()
{
m_dataList.clear();
}
bool IsEmpty()
{
return m_dataList.empty();
}
size_t GetSize()
{
return m_dataList.size();
}
protected:
list<void *> m_dataList;
};
#endif
|
[
"liuyuntian110@126.com"
] |
liuyuntian110@126.com
|
51317e10baae6275b4a688ae6dbf4d720c2288f3
|
9ac2a0e4770e20315fdd68b0944cfffe7d8dc997
|
/Assignment-6/taylor.cpp
|
41e5963702390a305915e75c8b24ed248d70f04f
|
[] |
no_license
|
reidmcy/PHYS-239
|
cb0662ea37a0770cbf40b4b3d0c181bdf4c4b6c7
|
36c9c8e37d462482d83827027b34821fec086fd0
|
refs/heads/master
| 2020-04-06T06:52:41.176596
| 2014-04-28T01:12:49
| 2014-04-28T01:12:49
| 16,176,956
| 0
| 1
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 928
|
cpp
|
//Question 4
//Reid McIlroy-Young
//20416412
//March 11,2014
#include <iostream>
#include <math.h>
#include "discpp.h"
using namespace std;
Dislin G;
const int points = 10;
double fun(double x) {
return x*x*x*x*x*x;
}
double deriv(double f(double), double aX, double aDel) {
return (f(aX + aDel) - f(aX)) / aDel;
}
int main() {
double del = 0.1;
double xV = 1;
float x[points] , y[points];
for (int l =0; l < points; l++) {
y[l] = log(deriv( fun, xV, del) - 5);
x[l] = del;
del /=1.3;
}
G.metafl("PDF");
G.disini();
G.name("Step Length", "x");
G.name("Error", "y");
G.labels("EXP", "xy");
G.incmrk(1);
G.setscl(x, points, "X");
G.setscl(y, points, "Y");
//G.scale("LOG", "xy");
float minX, maxX, minY, maxY, stepX, stepY;
G.graf(minX, maxX, minX, stepX, minY, maxY, minY, stepY);
G.curve(x, y, points);
G.disfin();
}
|
[
"Reid@v1020-wn-16-100.campus-dynamic.uwaterloo.ca"
] |
Reid@v1020-wn-16-100.campus-dynamic.uwaterloo.ca
|
3a87ecab8ab8356ab7c167b4f1ed01a3491cc943
|
fa7f77f470995a4bba077d0ce837e61ba545015c
|
/src/objects/audio_analysis/PitchExtractor.h
|
42472b69ba64582acafcb809711aacb2c3b71e6f
|
[
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] |
permissive
|
d3cod3/ofxVisualProgramming
|
b0d73c7e334c78a90d3dd7e73a8d9e03da38e05a
|
f152893238cffa070da69c54324b770f07ddeddb
|
refs/heads/master
| 2023-04-06T10:20:29.050546
| 2023-01-24T16:51:11
| 2023-01-24T16:51:11
| 137,724,379
| 154
| 19
|
MIT
| 2023-09-11T18:56:05
| 2018-06-18T07:56:31
|
C++
|
UTF-8
|
C++
| false
| false
| 2,645
|
h
|
/*==============================================================================
ofxVisualProgramming: A visual programming patching environment for OF
Copyright (c) 2018 Emanuele Mazza aka n3m3da <emanuelemazza@d3cod3.org>
ofxVisualProgramming is distributed under the MIT License.
This gives everyone the freedoms to use ofxVisualProgramming in any context:
commercial or non-commercial, public or private, open or closed source.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
See https://github.com/d3cod3/ofxVisualProgramming for documentation
==============================================================================*/
#ifndef OFXVP_BUILD_WITH_MINIMAL_OBJECTS
#pragma once
#include "PatchObject.h"
class PitchExtractor : public PatchObject {
public:
PitchExtractor();
void newObject() override;
void setupObjectContent(shared_ptr<ofAppGLFWWindow> &mainWindow) override;
void updateObjectContent(map<int,shared_ptr<PatchObject>> &patchObjects) override;
void drawObjectContent(ofTrueTypeFont *font, shared_ptr<ofBaseGLRenderer>& glRenderer) override;
void drawObjectNodeGui( ImGuiEx::NodeCanvas& _nodeCanvas ) override;
void drawObjectNodeConfig() override;
void removeObjectContent(bool removeFileFromData=false) override;
int bufferSize;
int spectrumSize;
int arrayPosition;
bool isNewConnection;
bool isConnectionRight;
private:
OBJECT_FACTORY_PROPS
};
#endif
|
[
"n3m3da@d3cod3.org"
] |
n3m3da@d3cod3.org
|
a953ebc9bc3aed880515105951817d40df8dc7e5
|
f0738d67dfb6cde9ca853e562e5fe35e3cc80b8d
|
/Source/Engine/Systems/Render/RenderDebugSystem.cpp
|
26f604a9cf28bedf5ccaa5f136cef1c109bbf0e5
|
[] |
no_license
|
TLeonardUK/VulkanEngine
|
fcb1ac6e205eb7377e77e9c64b4dde661f8a16ea
|
af25c592769efb9df9e1ade867c2eccc28f0935e
|
refs/heads/master
| 2020-03-19T10:18:04.204706
| 2018-09-09T21:29:27
| 2018-09-09T21:29:27
| 136,359,347
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 12,220
|
cpp
|
#include "Pch.h"
#include "Engine/Components/Mesh/MeshComponent.h"
#include "Engine/Systems/Render/RenderDebugSystem.h"
#include "Engine/Systems/Render/RenderCameraViewSystem.h"
#include "Engine/Systems/Mesh/MeshBoundsUpdateSystem.h"
#include "Engine/Systems/Transform/TransformSystem.h"
#include "Engine/Systems/Transform/TransformUtils.h"
#include "Engine/Systems/Transform/SpatialIndexSystem.h"
#include "Engine/Rendering/Renderer.h"
#include "Engine/Rendering/RenderView.h"
#include "Engine/Rendering/RenderPropertyHeirarchy.h"
#include "Engine/Graphics/Graphics.h"
#include "Engine/Graphics/GraphicsCommandBuffer.h"
#include "Engine/Profiling/Profiling.h"
#include "Engine/Threading/ParallelFor.h"
#include "Engine/Types/OctTree.h"
RenderDebugSystem::RenderDebugSystem(
std::shared_ptr<World> world,
std::shared_ptr<Renderer> renderer,
std::shared_ptr<ResourceManager> resourceManager,
std::shared_ptr<IGraphics> graphics
)
: m_renderer(renderer)
, m_graphics(graphics)
{
AddPredecessor<MeshBoundsUpdateSystem>();
AddPredecessor<TransformSystem>();
AddPredecessor<RenderCameraViewSystem>();
m_debugLineMaterial = resourceManager->Load<Material>("Engine/Materials/debug_line.json");
m_debugLineMaterial.WaitUntilLoaded();
renderer->CreateMeshRenderState(&m_debugLineMeshRenderState);
}
void RenderDebugSystem::Tick(
World& world,
const FrameTime& frameTime,
const Array<Entity>& entities,
const Array<CameraViewComponent*>& views,
const Array<const TransformComponent*>& transforms)
{
Array<DrawDebugLineMessage> debugLineMessages = world.ConsumeMessages<DrawDebugLineMessage>();
Array<DrawDebugFrustumMessage> debugFrustumMessages = world.ConsumeMessages<DrawDebugFrustumMessage>();
Array<DrawDebugSphereMessage> debugSphereMessages = world.ConsumeMessages<DrawDebugSphereMessage>();
Array<DrawDebugBoundsMessage> debugBoundsMessages = world.ConsumeMessages<DrawDebugBoundsMessage>();
Array<DrawDebugOrientedBoundsMessage> debugOrientedBoundsMessages = world.ConsumeMessages<DrawDebugOrientedBoundsMessage>();
m_lines.clear();
m_lines.reserve(
(debugLineMessages.size() * 2) +
(debugFrustumMessages.size() * 12) +
(debugBoundsMessages.size() * 12) +
(debugOrientedBoundsMessages.size() * 12)
);
// Draw debug lines.
for (auto& message : debugLineMessages)
{
RenderLine line(message.start, message.end, message.color);
m_lines.push_back(line);
}
// Draw frustum.
for (auto& message : debugFrustumMessages)
{
Vector3 corners[(int)FrustumCorners::Count];
message.frustum.GetCorners(corners);
RenderLine lines[12] = {
RenderLine(corners[(int)FrustumCorners::FarTopLeft], corners[(int)FrustumCorners::FarTopRight], message.color),
RenderLine(corners[(int)FrustumCorners::FarBottomLeft], corners[(int)FrustumCorners::FarBottomRight], message.color),
RenderLine(corners[(int)FrustumCorners::FarTopLeft], corners[(int)FrustumCorners::FarBottomLeft], message.color),
RenderLine(corners[(int)FrustumCorners::FarTopRight], corners[(int)FrustumCorners::FarBottomRight], message.color),
RenderLine(corners[(int)FrustumCorners::NearTopLeft], corners[(int)FrustumCorners::NearTopRight], message.color),
RenderLine(corners[(int)FrustumCorners::NearBottomLeft], corners[(int)FrustumCorners::NearBottomRight], message.color),
RenderLine(corners[(int)FrustumCorners::NearTopLeft], corners[(int)FrustumCorners::NearBottomLeft], message.color),
RenderLine(corners[(int)FrustumCorners::NearTopRight], corners[(int)FrustumCorners::NearBottomRight], message.color),
RenderLine(corners[(int)FrustumCorners::NearTopLeft], corners[(int)FrustumCorners::FarTopLeft], message.color),
RenderLine(corners[(int)FrustumCorners::NearTopRight], corners[(int)FrustumCorners::FarTopRight], message.color),
RenderLine(corners[(int)FrustumCorners::NearBottomLeft], corners[(int)FrustumCorners::FarBottomLeft], message.color),
RenderLine(corners[(int)FrustumCorners::NearBottomRight], corners[(int)FrustumCorners::FarBottomRight], message.color),
};
for (int j = 0; j < 12; j++)
{
m_lines.push_back(lines[j]);
}
}
// Draw debug bounds.
for (auto& message : debugBoundsMessages)
{
Vector3 corners[(int)BoundsCorners::Count];
message.bounds.GetCorners(corners);
RenderLine lines[12] = {
RenderLine(corners[(int)BoundsCorners::BackTopLeft], corners[(int)BoundsCorners::BackTopRight], message.color),
RenderLine(corners[(int)BoundsCorners::FrontTopLeft], corners[(int)BoundsCorners::FrontTopRight], message.color),
RenderLine(corners[(int)BoundsCorners::BackTopLeft], corners[(int)BoundsCorners::FrontTopLeft], message.color),
RenderLine(corners[(int)BoundsCorners::BackTopRight], corners[(int)BoundsCorners::FrontTopRight], message.color),
RenderLine(corners[(int)BoundsCorners::BackBottomLeft], corners[(int)BoundsCorners::BackBottomRight], message.color),
RenderLine(corners[(int)BoundsCorners::FrontBottomLeft], corners[(int)BoundsCorners::FrontBottomRight], message.color),
RenderLine(corners[(int)BoundsCorners::BackBottomLeft], corners[(int)BoundsCorners::FrontBottomLeft], message.color),
RenderLine(corners[(int)BoundsCorners::BackBottomRight], corners[(int)BoundsCorners::FrontBottomRight], message.color),
RenderLine(corners[(int)BoundsCorners::BackTopLeft], corners[(int)BoundsCorners::BackBottomLeft], message.color),
RenderLine(corners[(int)BoundsCorners::BackTopRight], corners[(int)BoundsCorners::BackBottomRight], message.color),
RenderLine(corners[(int)BoundsCorners::FrontTopLeft], corners[(int)BoundsCorners::FrontBottomLeft], message.color),
RenderLine(corners[(int)BoundsCorners::FrontTopRight], corners[(int)BoundsCorners::FrontBottomRight], message.color)
};
for (int j = 0; j < 12; j++)
{
m_lines.push_back(lines[j]);
}
}
// Draw debug orinted bounds.
for (auto& message : debugOrientedBoundsMessages)
{
Vector3 corners[(int)BoundsCorners::Count];
message.bounds.GetCorners(corners);
RenderLine lines[12] = {
RenderLine(corners[(int)BoundsCorners::BackTopLeft], corners[(int)BoundsCorners::BackTopRight], message.color),
RenderLine(corners[(int)BoundsCorners::FrontTopLeft], corners[(int)BoundsCorners::FrontTopRight], message.color),
RenderLine(corners[(int)BoundsCorners::BackTopLeft], corners[(int)BoundsCorners::FrontTopLeft], message.color),
RenderLine(corners[(int)BoundsCorners::BackTopRight], corners[(int)BoundsCorners::FrontTopRight], message.color),
RenderLine(corners[(int)BoundsCorners::BackBottomLeft], corners[(int)BoundsCorners::BackBottomRight], message.color),
RenderLine(corners[(int)BoundsCorners::FrontBottomLeft], corners[(int)BoundsCorners::FrontBottomRight], message.color),
RenderLine(corners[(int)BoundsCorners::BackBottomLeft], corners[(int)BoundsCorners::FrontBottomLeft], message.color),
RenderLine(corners[(int)BoundsCorners::BackBottomRight], corners[(int)BoundsCorners::FrontBottomRight], message.color),
RenderLine(corners[(int)BoundsCorners::BackTopLeft], corners[(int)BoundsCorners::BackBottomLeft], message.color),
RenderLine(corners[(int)BoundsCorners::BackTopRight], corners[(int)BoundsCorners::BackBottomRight], message.color),
RenderLine(corners[(int)BoundsCorners::FrontTopLeft], corners[(int)BoundsCorners::FrontBottomLeft], message.color),
RenderLine(corners[(int)BoundsCorners::FrontTopRight], corners[(int)BoundsCorners::FrontBottomRight], message.color)
};
for (int j = 0; j < 12; j++)
{
m_lines.push_back(lines[j]);
}
}
// Draw debug sphere.
for (auto& message : debugSphereMessages)
{
const float PI = 3.141592f;
const int gradation = 20;
float radius = message.sphere.radius;
Vector3 origin = message.sphere.origin;
for (float alpha = 0.0; alpha < Math::Pi; alpha += PI / gradation)
{
for (float beta = 0.0; beta < 2.01 * Math::Pi; beta += PI / gradation)
{
Vector3 start(
radius * cos(beta) * sin(alpha),
radius * sin(beta) * sin(alpha),
radius * cos(alpha)
);
Vector3 end(
radius * cos(beta) * sin(alpha + PI / gradation),
radius * sin(beta) * sin(alpha + PI / gradation),
radius * cos(alpha + PI / gradation)
);
m_lines.push_back(RenderLine(origin + start, origin + end, message.color));
}
}
}
// Generate indices.
Array<uint32_t> lineIndices;
Array<DebugLineVertex> lineVerts;
lineVerts.resize(m_lines.size() * 2);
lineIndices.resize(m_lines.size() * 2);
for (size_t i = 0; i < m_lines.size(); i++)
{
RenderLine& line = m_lines[i];
lineVerts[(i * 2) + 0].position = line.Start;
lineVerts[(i * 2) + 0].color = line.LineColor.ToVector();
lineVerts[(i * 2) + 1].position = line.End;
lineVerts[(i * 2) + 1].color = line.LineColor.ToVector();
lineIndices[(i * 2) + 0] = static_cast<uint32_t>((i * 2) + 0);
lineIndices[(i * 2) + 1] = static_cast<uint32_t>((i * 2) + 1);
}
if (lineVerts.size() == 0)
{
return;
}
if (m_lineVertexBuffer == nullptr || lineVerts.size() > m_lineVertexBuffer->GetCapacity())
{
VertexBufferBindingDescription description;
m_debugLineMaterial.Get()->GetVertexBufferFormat(description);
m_lineVertexBuffer = m_graphics->CreateVertexBuffer("Debug Line Vertex Buffer", description, static_cast<int>(lineVerts.size()));
}
if (m_lineIndexBuffer == nullptr || lineIndices.size() > m_lineIndexBuffer->GetCapacity())
{
m_lineIndexBuffer = m_graphics->CreateIndexBuffer("Debug Line Index Buffer", sizeof(uint32_t), static_cast<int>(lineIndices.size()));
}
m_lineVertexBuffer->Stage(lineVerts.data(), 0, static_cast<int>(lineVerts.size()) * sizeof(DebugLineVertex));
m_lineIndexBuffer->Stage(lineIndices.data(), 0, static_cast<int>(lineIndices.size()) * sizeof(uint32_t));
// Draw lines on each view.
for (int i = 0; i < views.size(); i++)
{
CameraViewComponent* view = views[i];
RenderView(view, lineVerts, lineIndices);
}
}
void RenderDebugSystem::RenderView(
CameraViewComponent* view,
const Array<DebugLineVertex>& lineVerts,
const Array<uint32_t>& lineIndices)
{
ProfileScope scope(ProfileColors::Draw, "RenderDebugSystem::RenderView");
int swapWidth = m_renderer->GetSwapChainWidth();
int swapHeight = m_renderer->GetSwapChainHeight();
Rect viewport(
0.0f,
0.0f,
swapWidth,
swapHeight
);
// Update global properties.
view->viewProperties.Set(ViewMatrixHash, view->viewMatrix);
view->viewProperties.Set(ProjectionMatrixHash, view->projectionMatrix);
std::shared_ptr<IGraphicsCommandBuffer> buffer = m_renderer->RequestPrimaryBuffer();
buffer->Reset();
buffer->Begin();
buffer->Upload(m_lineVertexBuffer);
buffer->Upload(m_lineIndexBuffer);
// todo: set projection/view matrices.
// Get material.
std::shared_ptr<Material> material = m_debugLineMaterial.Get();
material->UpdateResources();
// Create render property heirarchy.
RenderPropertyHeirarchy renderHeirarchy;
renderHeirarchy.Set(GraphicsBindingFrequency::Global, &m_renderer->GetGlobalRenderProperties());
renderHeirarchy.Set(GraphicsBindingFrequency::View, &view->viewProperties);
renderHeirarchy.Set(GraphicsBindingFrequency::Material, &material->GetProperties());
renderHeirarchy.Set(GraphicsBindingFrequency::Mesh, nullptr);
const Array<std::shared_ptr<IGraphicsResourceSet>>& resourceSets = m_debugLineMeshRenderState->UpdateAndGetResourceSets(material, &renderHeirarchy);
buffer->BeginPass(material->GetRenderPass(), material->GetFrameBuffer());
buffer->BeginSubPass();
buffer->SetPipeline(material->GetPipeline());
buffer->SetScissor(
static_cast<int>(viewport.x),
static_cast<int>(viewport.y),
static_cast<int>(viewport.width),
static_cast<int>(viewport.height)
);
buffer->SetViewport(
static_cast<int>(viewport.x),
static_cast<int>(viewport.y),
static_cast<int>(viewport.width),
static_cast<int>(viewport.height)
);
buffer->SetIndexBuffer(m_lineIndexBuffer);
buffer->SetVertexBuffer(m_lineVertexBuffer);
buffer->SetResourceSets(resourceSets.data(), (int)resourceSets.size());
buffer->DrawIndexedElements(static_cast<int>(lineVerts.size()), 1, 0, 0, 0);
buffer->EndSubPass();
buffer->EndPass();
buffer->End();
m_renderer->QueuePrimaryBuffer("Debug Primitives", RenderCommandStage::View_Debug, buffer, reinterpret_cast<uint64_t>(view));
}
|
[
"infinitus@zombiegrinder.com"
] |
infinitus@zombiegrinder.com
|
73fe2c055b8eeba39a953ab763d7717d76206cce
|
e6da6eb616e72fa0ec97fb38e473f359dc9d1415
|
/test/TestMain.cpp
|
8bf2256705fe2415a7f00784d46e2d6339b55c99
|
[
"MIT"
] |
permissive
|
enlyze/scope-guard
|
71c1ceccf6b296284d347ac1ac40c29ed2777841
|
d5a555a7e24c742a281693f9f6e72a58df6e15ac
|
refs/heads/master
| 2020-08-30T07:30:29.839294
| 2019-10-27T13:04:41
| 2019-10-27T13:04:41
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,732
|
cpp
|
// MIT License
//
// Copyright (c) 2017-2019 offa
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#define CATCH_CONFIG_MAIN
#include <catch2/catch.hpp>
#include <trompeloeil.hpp>
namespace trompeloeil
{
template <>
void reporter<specialized>::send(severity s, const char* file, unsigned long line, const char* msg)
{
std::ostringstream os;
if( line != 0 )
{
os << file << ':' << line << '\n';
}
os << msg;
const auto failure = os.str();
if( s == severity::fatal )
{
FAIL(failure);
}
else
{
CAPTURE(failure);
CHECK(failure.empty());
}
}
}
|
[
"bm-dev@yandex.com"
] |
bm-dev@yandex.com
|
3b976e2b7e974c4b30401c54b9207bfe89c7aec7
|
fbe77e9e2a53a4600a1d9b00b5f2c29ee3e8c59a
|
/externals/binaryen/test/emscripten/tests/poppler/qt4/src/poppler-link-extractor.cc
|
e9806b5948888a4f76bd3f1c6cde76d7e95da26d
|
[
"MIT",
"NCSA",
"GPL-1.0-or-later",
"GPL-2.0-or-later",
"LGPL-2.0-or-later",
"GPL-2.0-only",
"Apache-2.0",
"BSD-3-Clause"
] |
permissive
|
AcuteAngleCloud/Acute-Angle-Chain
|
8d4a1ad714f6de1493954326e109b6af112561b9
|
5ea50bee042212ccff797ece5018c64f3f50ceff
|
refs/heads/master
| 2021-04-26T21:52:25.560457
| 2020-03-21T07:29:06
| 2020-03-21T07:29:06
| 124,164,376
| 10
| 5
|
MIT
| 2020-07-16T07:14:45
| 2018-03-07T02:03:53
|
C++
|
UTF-8
|
C++
| false
| false
| 2,543
|
cc
|
/* poppler-link-extractor_p.h: qt interface to poppler
* Copyright (C) 2007-2008, Pino Toscano <pino@kde.org>
* Copyright (C) 2008, Albert Astals Cid <aacid@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "poppler-link-extractor-private.h"
#include <GfxState.h>
#include <Link.h>
#include <Object.h>
#include <Page.h>
#include "poppler-qt4.h"
#include "poppler-page-private.h"
namespace Poppler
{
LinkExtractorOutputDev::LinkExtractorOutputDev(PageData *data)
: m_data(data)
{
Q_ASSERT(m_data);
::Page *popplerPage = m_data->page;
m_pageCropWidth = popplerPage->getCropWidth();
m_pageCropHeight = popplerPage->getCropHeight();
if (popplerPage->getRotate() == 90 || popplerPage->getRotate() == 270)
qSwap(m_pageCropWidth, m_pageCropHeight);
GfxState gfxState(72.0, 72.0, popplerPage->getCropBox(), popplerPage->getRotate(), gTrue);
setDefaultCTM(gfxState.getCTM());
}
LinkExtractorOutputDev::~LinkExtractorOutputDev()
{
qDeleteAll(m_links);
}
void LinkExtractorOutputDev::processLink(::Link *link, Catalog *catalog)
{
if (!link->isOk())
return;
double left, top, right, bottom;
int leftAux, topAux, rightAux, bottomAux;
link->getRect(&left, &top, &right, &bottom);
QRectF linkArea;
cvtUserToDev(left, top, &leftAux, &topAux);
cvtUserToDev(right, bottom, &rightAux, &bottomAux);
linkArea.setLeft((double)leftAux / m_pageCropWidth);
linkArea.setTop((double)topAux / m_pageCropHeight);
linkArea.setRight((double)rightAux / m_pageCropWidth);
linkArea.setBottom((double)bottomAux / m_pageCropHeight);
Link *popplerLink = m_data->convertLinkActionToLink(link->getAction(), linkArea);
if (popplerLink)
{
m_links.append(popplerLink);
}
OutputDev::processLink(link, catalog);
}
QList< Link* > LinkExtractorOutputDev::links()
{
QList< Link* > ret = m_links;
m_links.clear();
return ret;
}
}
|
[
"caokun@acuteangle.cn"
] |
caokun@acuteangle.cn
|
934825275b0c35c3cd7d4d4b5032c76bafd66c1f
|
b551859fdf0041911c6d1d9184786213e341319d
|
/leetcode_188. Best Time to Buy and Sell Stock IV_O(kn) space + O(n) time.cpp
|
ea989d0531d6ca45c73f871291f47eb6085281e1
|
[] |
no_license
|
huangmxsysu/leetcode
|
4b4dcedf105183a67cc540b78420d81cd6df2932
|
67ad6367d21f7437acb39f213344ea9924f76496
|
refs/heads/master
| 2021-01-22T20:18:34.036796
| 2017-03-17T12:29:55
| 2017-03-17T12:29:55
| 85,309,744
| 2
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,455
|
cpp
|
class Solution {
public:
int maxProfit(int k, vector<int>& prices) {
// f[k, ii] represents the max profit up until prices[ii] (Note: NOT ending with prices[ii]) using at most k transactions.
// f[k, ii] = max(f[k, ii-1], prices[ii] - prices[jj] + f[k-1, jj]) { jj in range of [0, ii-1] }
// = max(f[k, ii-1], prices[ii] + max(f[k-1, jj] - prices[jj]))
// f[0, ii] = 0; 0 times transation makes 0 profit
// f[k, 0] = 0; if there is only one price data point you can't make any money no matter how many times you can trade
if (prices.size() <= 1) return 0;
if ( k > prices.size()/2 ){
int max_profit = 0;
for( int i = 1 ; i < prices.size() ; i ++ ){
max_profit += max( prices[i] - prices[i-1] , 0 );
}
return max_profit;
}
else {
int maxProf = 0;
vector<vector<int>> f(k+1, vector<int>(prices.size(), 0));
for (int kk = 1; kk <= k; kk++) {
int tmpMax = f[kk-1][0] - prices[0];
for (int ii = 1; ii < prices.size(); ii++) {
f[kk][ii] = max(f[kk][ii-1], prices[ii] + tmpMax);
tmpMax = max(tmpMax, f[kk-1][ii] - prices[ii]);
maxProf = max(f[kk][ii], maxProf);
}
}
return maxProf;
}
}
};
|
[
"995304572@qq.com"
] |
995304572@qq.com
|
645c78e16978d09b1c486cf7f45b457ec195b37b
|
925f6c59c6cd28b28817054ea2868f3138b35ce0
|
/Define.h
|
8bcc7b3701c163ece587020e3c2ee21e9f243f08
|
[] |
no_license
|
TomomiBahun/Arcade-Shooter-Game-Project-1
|
d2ca8f2aecbff364d7b3d847ef3799175507b2c6
|
f6e2f70c6a1d5e2a3254ca452cfc9d85454bb765
|
refs/heads/master
| 2023-05-27T22:17:16.328597
| 2021-03-23T23:00:41
| 2021-03-23T23:00:41
| 290,541,330
| 0
| 0
| null | 2021-01-10T05:28:47
| 2020-08-26T15:57:47
|
C++
|
UTF-8
|
C++
| false
| false
| 538
|
h
|
#pragma once
class Define final {
public:
const static int WIN_W;
const static int WIN_H;
const static int OUTER_W;
const static int OUTER_H;
const static int INNER_W;
const static int INNER_H;
const static int CENTER_X;
const static int CENTER_Y;
const static int IN_X;
const static int IN_Y;
const static int BOSSBASE_X;
const static int BOSSBASE_Y;
const static float PI;
enum eStage {
stage1 = 1,
stage2,
stage3,
stage4,
stage5,
stageEX,
stageNum,
};
enum eCharacter {
reimu = 1,
marisa,
};
};
|
[
"tomomibahun@icloud.com"
] |
tomomibahun@icloud.com
|
74e87335a7fa81fa7345be840f54ce18450e03b5
|
25f1e07d79c2bea95ad39c0b89b2841e5bcd2179
|
/src/000-lambda-expression.cpp
|
87ee35a70a0e8d93e1582a5d654e62c6ac58afe2
|
[] |
no_license
|
Gelio/what-the-javascript
|
57376298aba111746b668df8df1cf1df36abe42d
|
d6aaca144eda72f14c916c8bc8684b1d57a43905
|
refs/heads/master
| 2020-08-06T03:47:44.004789
| 2019-10-09T21:44:59
| 2019-10-09T21:44:59
| 212,821,975
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 172
|
cpp
|
#include <iostream>
using namespace std;
auto sum(int x) {
return [x](int y) {
return x + y;
};
}
int main()
{
cout<< sum(1)(2); // 3
return 0;
}
|
[
"grzegorz.rozdzialik@codilime.com"
] |
grzegorz.rozdzialik@codilime.com
|
b9498b4a650b0186ec68fb4eb12ee94b6718d377
|
778d12777577b279ca29581442b27ef3c49e4801
|
/src/shader.cpp
|
d1b694b0cd26fb97720b356ad5c143b5f6756f72
|
[] |
no_license
|
gui2one/angine
|
9ba8fe4321fd2ac6fe138d553877923cf989b94b
|
66cdb7f455d12c1acfbffffddc5340acee955aa1
|
refs/heads/master
| 2020-04-11T03:12:45.385692
| 2019-04-01T21:14:12
| 2019-04-01T21:14:12
| 161,471,023
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 2,676
|
cpp
|
#include "shader.h"
Shader::Shader(){
}
Shader::~Shader(){
std::cout << "deleting shader \n\n";
}
std::string loadShaderFile(std::string path){
std::ifstream input(path);
std::string output = "";
for( std::string line; std::getline(input, line);){
output += line;
output += "\n";
}
return output;
}
void Shader::loadVertexShaderSource(std::string filePath){
vertexShaderSource = loadShaderFile(filePath);
}
void Shader::loadFragmentShaderSource(std::string filePath){
fragmentShaderSource = loadShaderFile(filePath);
}
std::string Shader::getVertexShaderSource(){
return vertexShaderSource;
}
std::string Shader::getFragmentShaderSource(){
return fragmentShaderSource;
}
unsigned int Shader::compileShader(unsigned int type, const std::string& source){
unsigned int id = glCreateShader(type);
const char* src = source.c_str();
glShaderSource(id, 1, &src, nullptr);
glCompileShader(id);
int result;
glGetShaderiv(id, GL_COMPILE_STATUS, &result);
if( result == GL_FALSE ){
int length;
glGetShaderiv(id, GL_INFO_LOG_LENGTH, &length);
char* message = (char*)alloca(length * sizeof(char));
glGetShaderInfoLog(id, length, &length, message);
std::cout << "Shader compile failure !!!!!\n";
std::cout << "in " << (type == GL_VERTEX_SHADER ? "vertex shader\n" : "fragment shader\n");
std::cout << message << "\n";
}
return id;
}
unsigned int Shader::createShader( const std::string& vertexShader, const std::string& fragmentShader){
unsigned int program = glCreateProgram();
unsigned int vs = compileShader(GL_VERTEX_SHADER, vertexShader);
unsigned int fs = compileShader(GL_FRAGMENT_SHADER, fragmentShader);
glAttachShader(program, vs);
glAttachShader(program, fs);
glLinkProgram(program);
glValidateProgram(program);
glDeleteShader(vs);
glDeleteShader(fs);
return program;
}
unsigned int Shader::createShader(){
m_id = glCreateProgram();
unsigned int vs = compileShader(GL_VERTEX_SHADER, vertexShaderSource);
unsigned int fs = compileShader(GL_FRAGMENT_SHADER, fragmentShaderSource);
glAttachShader(m_id, vs);
glAttachShader(m_id, fs);
glLinkProgram(m_id);
glValidateProgram(m_id);
glDeleteShader(vs);
glDeleteShader(fs);
return m_id;
}
void Shader::useProgram(){
glUseProgram(m_id);
}
|
[
"guillaume.rouault.fx@gmail.com.com"
] |
guillaume.rouault.fx@gmail.com.com
|
fdcb9a0a2aeea390b915657579e387a3f46172ac
|
048c3458ae317f62f07ee29ad3a6cff63f68af53
|
/DesktopLiveStreaming/DesktopLiveStreaming.cpp
|
2cef57b6cf01aea4ebbc61ba2d598e40e4a09beb
|
[] |
no_license
|
AnthonyZheng/DesktopLiveStreaming
|
a6d74ceb79323129bf63a733040913dcb757b67b
|
ac586ab0415a4ddbf5f71c3bed9cafd28b613ffb
|
refs/heads/master
| 2020-06-18T03:41:41.895053
| 2016-11-28T08:08:36
| 2016-11-28T08:08:36
| null | 0
| 0
| null | null | null | null |
GB18030
|
C++
| false
| false
| 7,182
|
cpp
|
// DesktopLiveStreaming.cpp : 定义应用程序的入口点。
//
#include "stdafx.h"
#include "DesktopLiveStreaming.h"
#include "AppContext.h"
#include "DesktopImageSource.h"
#include "RingCacheBuffer.h"
#include "DXGIDesktopOutputSystem.h"
#include "AudioSoureAACStream.h"
#include "HLS_Server.h"
#include "Connection.h"
#include "FlvLiveStream.h"
#include "resource.h"
#include <shellapi.h>
#define MAX_LOADSTRING 100
// 全局变量:
HINSTANCE hInst; // 当前实例
WCHAR szTitle[MAX_LOADSTRING]; // 标题栏文本
WCHAR szWindowClass[MAX_LOADSTRING]; // 主窗口类名
HWND hdlg;
// 此代码模块中包含的函数的前向声明:
ATOM MyRegisterClass(HINSTANCE hInstance);
BOOL InitInstance(HINSTANCE, int);
INT_PTR CALLBACK PanelProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
INT_PTR CALLBACK About(HWND, UINT, WPARAM, LPARAM);
class DXGIDesktopOutputSystem* d3dsys = nullptr;
int port = 80;
int bitrate = 4000;
bool usr_BitBlt = false;
static char portstr[8];
static char bitratestr[8];
static char myurl[80];
HWND EDIT_PORT;
HWND EDIT_BITRATE;
HWND BTN_START;
HWND CHECK_BitBlt;
HWND hWnd;
void Start()
{
MyContext->desktopSource = new DesktopImageSource(d3dsys, bitrate);
bool init_ok = AppContext::context->desktopSource->Init();
MyContext->accSource = new AudioSoureAACStream(AACbitRate);
if(usr_BitBlt)
d3dsys->DXG1NextFramecanWork = false;
MyContext->desktopSource->Start();//后启动
//MyContext->accSource->mcrophoneInput = false;
MyContext->accSource->Strat();
if (MyContext->live_model == LiveModel::http_flv)
{
MyContext->flvServer = new FlvLiveStream();//
MyContext->flvServer->start();
}
else
{
MyContext->hlsServer = new HLS_Server();
MyContext->hlsServer->start();
}
init_res_table();//web静态资源
IOCPServer *server = new IOCPServer(port, event_hander);
switch (server->bind_listen())
{
case port_occupation:
MessageBox(hdlg,L"该端口被占用",L"错误", MB_OKCANCEL);
exit(0);
break;
case fatal_error:
exit(0);
break;
case success:
server->start();
EnableWindow(EDIT_PORT, false);
EnableWindow(EDIT_BITRATE, false);
EnableWindow(BTN_START, false);
EnableWindow(CHECK_BitBlt,false);
sprintf(myurl,"http://127.0.0.1:%d",port);
ShellExecuteA(NULL, "open", myurl, NULL, NULL, SW_SHOWNORMAL);
break;
default:
break;
}
}
HINSTANCE ApphInstance;
int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
_In_opt_ HINSTANCE hPrevInstance,
_In_ LPWSTR lpCmdLine,
_In_ int nCmdShow)
{
CoInitialize(NULL);
ApphInstance = hInstance;
BOOL init_ok = false;
MyContext = new AppContext();
MyContext->rCache = new RingCacheBuffer(500);
d3dsys = new DXGIDesktopOutputSystem();
init_ok = d3dsys->Init();
strcpy(portstr, "80");
strcpy(bitratestr, "2000");
// 初始化全局字符串
LoadStringW(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
LoadStringW(hInstance, IDC_DESKTOPLIVESTREAMING, szWindowClass, MAX_LOADSTRING);
MyRegisterClass(hInstance);
// 执行应用程序初始化:
if (!InitInstance(hInstance, nCmdShow))
{
return FALSE;
}
//HACCEL hAccelTable = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_DESKTOPLIVESTREAMING));
MSG msg;
EDIT_PORT = GetDlgItem(hdlg, IDC_EDIT_PORT);
EDIT_BITRATE = GetDlgItem(hdlg, IDC_EDIT_BITRATE);
BTN_START = GetDlgItem(hdlg, IDC_BUTTON_START);
CHECK_BitBlt = GetDlgItem(hdlg, IDC_CHECK_BitBlt);
SetWindowTextA(EDIT_PORT, portstr);
SetWindowTextA(EDIT_BITRATE, bitratestr);
CheckRadioButton(hdlg, IDC_RADIO_HTTPFLV, IDC_RADIO_HLS, IDC_RADIO_HTTPFLV);
MyContext->live_model = LiveModel::http_flv;
//MSG msg;
// 主消息循环:
while (GetMessage(&msg, nullptr, 0, 0))
{
/*if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))
{*/
TranslateMessage(&msg);
DispatchMessage(&msg);
//}
}
CoUninitialize();
return (int)msg.wParam;
}
//
// 函数: MyRegisterClass()
//
// 目的: 注册窗口类。
//
ATOM MyRegisterClass(HINSTANCE hInstance)
{
WNDCLASSEXW wcex;
wcex.cbSize = sizeof(WNDCLASSEX);
wcex.style = CS_HREDRAW | CS_VREDRAW;
wcex.lpfnWndProc = WndProc;
wcex.cbClsExtra = 0;
wcex.cbWndExtra = 0;
wcex.hInstance = hInstance;
wcex.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_DESKTOPLIVESTREAMING));
wcex.hCursor = LoadCursor(nullptr, IDC_ARROW);
wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
//wcex.lpszMenuName = MAKEINTRESOURCEW(IDC_DESKTOPLIVESTREAMING);
wcex.lpszMenuName = 0;
wcex.lpszClassName = szWindowClass;
wcex.hIconSm = LoadIcon(wcex.hInstance, MAKEINTRESOURCE(IDI_SMALL));
return RegisterClassExW(&wcex);
}
//
// 函数: InitInstance(HINSTANCE, int)
//
// 目的: 保存实例句柄并创建主窗口
//
// 注释:
//
// 在此函数中,我们在全局变量中保存实例句柄并
// 创建和显示主程序窗口。
//
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
{
hInst = hInstance; // 将实例句柄存储在全局变量中
hWnd = CreateWindowW(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, 0, 380, 220, nullptr, nullptr, hInstance, nullptr);
if (!hWnd)
{
return FALSE;
}
ShowWindow(hWnd, nCmdShow);
UpdateWindow(hWnd);
return TRUE;
}
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_CREATE:
{
hdlg = CreateDialog(ApphInstance, MAKEINTRESOURCE(IDD_DIALOGMainGG), hWnd, (DLGPROC)PanelProc);
//SetParent(hdlg, hWnd);
ShowWindow(hdlg, SW_SHOWNA);
}
break;
case WM_COMMAND:
{
}
break;
case WM_PAINT:
{
PAINTSTRUCT ps;
HDC hdc = BeginPaint(hWnd, &ps);
// TODO: 在此处添加使用 hdc 的任何绘图代码...
EndPaint(hWnd, &ps);
}
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
return 0;
}
// “关于”框的消息处理程序。
INT_PTR CALLBACK PanelProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
UNREFERENCED_PARAMETER(lParam);
switch (message)
{
case WM_CTLCOLORDLG:
return (INT_PTR)GetStockObject(WHITE_BRUSH);
case WM_INITDIALOG:
return (INT_PTR)TRUE;
case WM_COMMAND:
{
int wmId = LOWORD(wParam);
// 分析菜单选择:
switch (wmId)
{
case IDC_RADIO_HTTPFLV:
MyContext->live_model = LiveModel::http_flv;
break;
case IDC_RADIO_HLS:
MyContext->live_model = LiveModel::hls;
break;
case IDC_BUTTON_START:
GetWindowTextA(EDIT_PORT, portstr, 7);
GetWindowTextA(EDIT_BITRATE, bitratestr, 7);
usr_BitBlt=IsDlgButtonChecked(hdlg, IDC_CHECK_BitBlt);
port = atoi(portstr);
bitrate = atoi(bitratestr);
if (bitrate < 1000)
bitrate = 1000;
if (bitrate > 4500)
bitrate = 4500;
if (port > 90000)
port = 8099;
Start();
break;
/*case IDM_ABOUT:
DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About);*/
break;
case IDM_EXIT:
DestroyWindow(hWnd);
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
}
break;
}
return (INT_PTR)FALSE;
}
|
[
"main dark"
] |
main dark
|
ca1f4348e3b151ebadd6808af717f618ec45f1a5
|
0cccf562a78598c5de2adeb431610ccb93ed9853
|
/code/src/stl_errors/Edge.cpp
|
8f606c0f8b051577f0f465a48901fc81b4c0c785
|
[
"MIT"
] |
permissive
|
sergeykhrykov/rk9students
|
1e110ac140eb3ea56fde429d94103ca422e58e06
|
648ce7ef6d390f2d5d7f2711fe728ca34db6b1a4
|
refs/heads/master
| 2020-04-11T02:05:16.624572
| 2018-07-30T10:42:46
| 2018-07-30T10:42:46
| 68,141,035
| 1
| 11
| null | 2017-01-23T06:42:28
| 2016-09-13T19:38:00
|
C++
|
UTF-8
|
C++
| false
| false
| 665
|
cpp
|
#include "Edge.h"
using namespace std;
namespace rk9
{
bool EdgesVertice(const Edge& a, const Edge& b, Point& p) {
if (a.A == b.A || a.A == b.B) {
p = a.A;
return true;
}
else if (a.B == b.A || a.B == b.B) {
p = a.B;
return true;
}
return false;
}
bool operator<(const Point& a, const Point& b) {
if (a.X != b.X) {
return a.X < b.X;
}
if (a.Y != b.Y) {
return a.Y < b.Y;
}
return a.Z < b.Z;
}
bool Edge::operator<(const Edge& other) const{
return centre() < other.centre();
}
unsigned GetEdgesCount(PolyModel model) {
unsigned triangles_count = model.GetTrianglesCount();
return triangles_count * 3;
}
};
|
[
"s.khrykov@gmail.com"
] |
s.khrykov@gmail.com
|
2d943f5f89edf9dd01063985065b6f80a7c5ff60
|
8809ff5cae9d5e6747a499ce363e55d2209d3b51
|
/arduino/test_comm_JSON.ino
|
aebd488a9403047993e8a0d7acb55c7fc7e3c066
|
[] |
no_license
|
dimaystinov/smena_robofrankenshtain
|
6088282c1a4f8e59caa9b8c0dbde4a56aec94b43
|
1bc493b252ae554a20ab1dfab5e994916d8042b1
|
refs/heads/main
| 2023-08-07T20:24:26.106517
| 2021-09-17T14:47:48
| 2021-09-17T14:47:48
| 396,429,645
| 1
| 1
| null | 2021-08-23T10:37:46
| 2021-08-15T17:16:34
|
C++
|
UTF-8
|
C++
| false
| false
| 4,502
|
ino
|
/********************************************
* Eduard Petrenko
* 2021-08
* робототехническая смена в Физтех-Лицее
* тест класса для JSON коммуникаций от "головы" до Arduino
от openmv
коэффициенты в ардуино
{
type:"move, rotate";
value: "mm, degrees";
}
от ардуинки
{
status:"0 : ok, -1 : error (пришла комана, а предыдущая ещё не выполнена) ";
}
defined error codes
-1 пришла следующая команда, выполнение предыдущей не завершено
-2 ошибка парсинга команды
-3 недопустимый тип команды
*/
#include <stdlib.h>
#include <string.h>
#include <Arduino_JSON.h>
#define BUFF_LEN 50
class Command{
protected:
char outBuff[BUFF_LEN];
char cType; //'m'|'r'|'s'|'u' for move (straight) | rotate | status | undefined (if parse error)
int value; // millimeters | degrees | status/error code
public:
Command();
char getType();
int getValue();
void setType(char _type);
void setValue(int _value);
int parseSimple(char *data); //returns '0' if successfull, '-2' or '-3' if parse error
char *serializeSimple();
};
Command::Command(){
cType = 'u';
value = 0;
}
char Command::getType() {return cType;}
int Command::getValue() {return value;}
void Command::setType(char _type) {cType = _type;}
void Command::setValue(int _value) {value = _value;}
int Command::parseSimple(char *data){
if((data[0]=='m')||(data[0]=='r')||(data[0]=='s')){
cType = data[0];
}
else {
cType = 'u';
value = 0;
return -3;
}
for(int i=1; data[i]!='\0';i++){
if(!((data[i]>='0') && (data[i]<='9')) && (data[i]!='-')){
cType = 'u';
value = 0;
return(-2);
}
}
value = atoi(data+1);
return 0;
}
char *Command::serializeSimple(){
outBuff[0] = cType;
itoa(value,outBuff+1,10);
return outBuff;
}
class CommandJSON: public Command {
public:
int parseJSON(char *data);
char *serializeJSON();
};
int CommandJSON::parseJSON(char *data){
cType = 'u';
value = 0;
JSONVar obj = JSON.parse(data);
if(JSON.typeof(obj) == "undefined") {
cType = 'u';
value = 0;
return -2;
}
if(obj.hasOwnProperty("type")) {
JSONVar _type = obj["type"];
if(_type==JSONVar("move")) cType='m';
if(_type==JSONVar("rotate")) cType='r';
if(_type==JSONVar("status")) cType='s';
//if still undefined then type was incorrect
if(cType=='u'){
value = 0;
return -3;
}
}
else{
cType = 'u';
value = 0;
return -2;
}
if(obj.hasOwnProperty("value")) {
value = (int)obj["value"];
}
else{
cType = 'u';
value = 0;
return -2;
}
return 0;
}
char *CommandJSON::serializeJSON(){
JSONVar obj;
if(cType=='m') obj["type"] = "move";
if(cType=='r') obj["type"] = "rotate";
if(cType=='s') obj["type"] = "status";
if(cType=='u') obj["type"] = "undefined";
obj["value"] = value;
String str = JSONVar::stringify(obj);
strlcpy(outBuff,str.c_str(),BUFF_LEN-1);
return outBuff;
}
CommandJSON cmd;
void setup() {
// инциируем коммуникацию
Serial.begin(9600);
// test cmd parse
Serial.println("parse {\"type\":\"move\",\"value\":-300}");
Serial.println(cmd.parseJSON("{\"type\":\"move\",\"value\":-300}"));
Serial.println(cmd.getType());
Serial.println(cmd.getValue());
Serial.println("parse {\"type\":\"hello\",\"value\":-300}");
Serial.println(cmd.parseJSON("{\"type\":\"hello\",\"value\":-300}"));
Serial.println(cmd.getType());
Serial.println(cmd.getValue());
Serial.println("parse m-50hello");
Serial.println(cmd.parseSimple("m-50hello"));
Serial.println(cmd.getType());
Serial.println(cmd.getValue());
}
void loop() {
// читаем из Serial и парсим команды. В ответ отправляем статус
char inBuff[BUFF_LEN];
for(int i=0; i<BUFF_LEN; i++) inBuff[i]='\0';
Serial.println("=========================");
if(Serial.readBytesUntil('\n',inBuff,BUFF_LEN-1)>0){
CommandJSON inCmd;
Serial.print("parse ");
Serial.println(inBuff);
int retCode = cmd.parseJSON(inBuff);
CommandJSON outCmd;
Serial.println(retCode);
Serial.println(cmd.getType());
Serial.println(cmd.getValue());
outCmd.setType('s');
outCmd.setValue(retCode);
Serial.println(outCmd.serializeJSON());
}
delay(5000);
}
|
[
"50107426+dimaystinov@users.noreply.github.com"
] |
50107426+dimaystinov@users.noreply.github.com
|
2e95eabbe139fc05d53dc7b0eb140a90f4a496e6
|
bd1318a3846ef5f460f59dd61a96a55209c675af
|
/src/lib/StdMeshLoaderXml.cpp
|
a45834facbeaf02632288c622a662d6aa84a8be6
|
[
"LicenseRef-scancode-unknown-license-reference",
"ISC"
] |
permissive
|
pkern/openclonk-debian
|
710642424f9063b989db847349055c14bde78769
|
f9e8e340369c51210b1135e119027cee583a8ab8
|
refs/heads/master
| 2021-05-07T01:36:09.261379
| 2017-06-29T20:31:05
| 2017-06-29T20:31:05
| 110,364,764
| 0
| 1
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 23,276
|
cpp
|
/*
* OpenClonk, http://www.openclonk.org
*
* Copyright (c) 2001-2009, RedWolf Design GmbH, http://www.clonk.de/
* Copyright (c) 2009-2015, The OpenClonk Team and contributors
*
* Distributed under the terms of the ISC license; see accompanying file
* "COPYING" for details.
*
* "Clonk" is a registered trademark of Matthes Bender, used with permission.
* See accompanying file "TRADEMARK" for details.
*
* To redistribute this file separately, substitute the full license texts
* for the above references.
*/
// A loader for the OGRE .mesh XML file format
#include "C4Include.h"
#include "StdMesh.h"
#include "StdMeshLoader.h"
#include <tinyxml.h>
// Helper class to load things from an XML file with error checking
class StdMeshLoader::StdMeshXML
{
public:
StdMeshXML(const char* filename, const char* xml_data);
const char* RequireStrAttribute(TiXmlElement* element, const char* attribute) const;
int RequireIntAttribute(TiXmlElement* element, const char* attribute) const;
float RequireFloatAttribute(TiXmlElement* element, const char* attribute) const;
TiXmlElement* RequireFirstChild(TiXmlElement* element, const char* child);
void LoadGeometry(StdMesh& mesh, std::vector<StdSubMesh::Vertex>& vertices, TiXmlElement* boneassignments_elem);
void LoadBoneAssignments(StdMesh& mesh, std::vector<StdSubMesh::Vertex>& vertices, TiXmlElement* boneassignments_elem);
void Error(const StdStrBuf& message, TiXmlElement* element) const;
void Error(const StdStrBuf& message, int row) const;
private:
TiXmlDocument Document;
StdStrBuf FileName;
};
StdMeshLoader::StdMeshXML::StdMeshXML(const char* filename, const char* xml_data):
FileName(filename)
{
Document.Parse(xml_data);
if (Document.Error())
Error(StdStrBuf(Document.ErrorDesc()), Document.ErrorRow());
}
const char* StdMeshLoader::StdMeshXML::RequireStrAttribute(TiXmlElement* element, const char* attribute) const
{
const char* value = element->Attribute(attribute);
if (!value) Error(FormatString("Element '%s' does not have attribute '%s'", element->Value(), attribute), element);
return value;
}
int StdMeshLoader::StdMeshXML::RequireIntAttribute(TiXmlElement* element, const char* attribute) const
{
int retval;
if (element->QueryIntAttribute(attribute, &retval) != TIXML_SUCCESS)
Error(FormatString("Element '%s' does not have integer attribute '%s'", element->Value(), attribute), element);
return retval;
}
float StdMeshLoader::StdMeshXML::RequireFloatAttribute(TiXmlElement* element, const char* attribute) const
{
float retval = 0;
if (element->QueryFloatAttribute(attribute, &retval) != TIXML_SUCCESS)
Error(FormatString("Element '%s' does not have floating point attribute '%s'", element->Value(), attribute), element);
return retval;
}
TiXmlElement* StdMeshLoader::StdMeshXML::RequireFirstChild(TiXmlElement* element, const char* child)
{
TiXmlElement* retval;
if (element)
{
retval = element->FirstChildElement(child);
if (!retval)
Error(FormatString("Element '%s' does not contain '%s' child", element->Value(), child), element);
}
else
{
retval = Document.RootElement();
if (strcmp(retval->Value(), child) != 0)
Error(FormatString("Root element is not '%s'", child), retval);
}
return retval;
}
void StdMeshLoader::StdMeshXML::Error(const StdStrBuf& message, TiXmlElement* element) const
{
Error(message, element->Row());
}
void StdMeshLoader::StdMeshXML::Error(const StdStrBuf& message, int row) const
{
throw StdMeshLoader::LoaderException(FormatString("%s:%u: %s", FileName.getData(), row, message.getData()).getData());
}
void StdMeshLoader::StdMeshXML::LoadGeometry(StdMesh& mesh, std::vector<StdSubMesh::Vertex>& vertices, TiXmlElement* geometry_elem)
{
// Check whether mesh has any vertices so far -- we need this later for
// initialization of bounding box and bounding sphere.
bool hasVertices = false;
if(!mesh.SharedVertices.empty()) hasVertices = true;
for(unsigned int i = 0; i < mesh.SubMeshes.size(); ++i)
if(!mesh.SubMeshes[i].Vertices.empty())
hasVertices = true;
int VertexCount = RequireIntAttribute(geometry_elem, "vertexcount");
vertices.resize(VertexCount);
static const unsigned int POSITIONS = 1;
static const unsigned int NORMALS = 2;
static const unsigned int TEXCOORDS = 4;
// Individual vertex attributes can be split up in multiple vertex buffers
unsigned int loaded_attributes = 0;
for(TiXmlElement* buffer_elem = geometry_elem->FirstChildElement("vertexbuffer"); buffer_elem != NULL; buffer_elem = buffer_elem->NextSiblingElement("vertexbuffer"))
{
unsigned int attributes = 0;
if(buffer_elem->Attribute("positions")) attributes |= POSITIONS;
if(buffer_elem->Attribute("normals")) attributes |= NORMALS;
if(buffer_elem->Attribute("texture_coords")) attributes |= TEXCOORDS;
unsigned int i;
TiXmlElement* vertex_elem;
for (vertex_elem = buffer_elem->FirstChildElement("vertex"), i = 0; vertex_elem != NULL && i < vertices.size(); vertex_elem = vertex_elem->NextSiblingElement("vertex"), ++i)
{
if(attributes & POSITIONS)
{
TiXmlElement* position_elem = RequireFirstChild(vertex_elem, "position");
vertices[i].x = RequireFloatAttribute(position_elem, "x");
vertices[i].y = RequireFloatAttribute(position_elem, "y");
vertices[i].z = RequireFloatAttribute(position_elem, "z");
}
if(attributes & NORMALS)
{
TiXmlElement* normal_elem = RequireFirstChild(vertex_elem, "normal");
vertices[i].nx = RequireFloatAttribute(normal_elem, "x");
vertices[i].ny = RequireFloatAttribute(normal_elem, "y");
vertices[i].nz = RequireFloatAttribute(normal_elem, "z");
}
if(attributes & TEXCOORDS)
{
// FIXME: The Ogre format supports denoting multiple texture coordinates, but the rendering code only supports one
// currently only the first set is read, any additional ones are ignored
TiXmlElement* texcoord_elem = RequireFirstChild(vertex_elem, "texcoord");
vertices[i].u = RequireFloatAttribute(texcoord_elem, "u");
vertices[i].v = RequireFloatAttribute(texcoord_elem, "v");
}
vertices[i] = OgreToClonk::TransformVertex(vertices[i]);
if (attributes & POSITIONS)
{
const float d = std::sqrt(vertices[i].x*vertices[i].x
+ vertices[i].y*vertices[i].y
+ vertices[i].z*vertices[i].z);
// Construct BoundingBox
StdMeshBox& BoundingBox = mesh.BoundingBox;
if (i == 0 && !hasVertices)
{
// First vertex
BoundingBox.x1 = BoundingBox.x2 = vertices[i].x;
BoundingBox.y1 = BoundingBox.y2 = vertices[i].y;
BoundingBox.z1 = BoundingBox.z2 = vertices[i].z;
mesh.BoundingRadius = d;
}
else
{
BoundingBox.x1 = std::min(vertices[i].x, BoundingBox.x1);
BoundingBox.x2 = std::max(vertices[i].x, BoundingBox.x2);
BoundingBox.y1 = std::min(vertices[i].y, BoundingBox.y1);
BoundingBox.y2 = std::max(vertices[i].y, BoundingBox.y2);
BoundingBox.z1 = std::min(vertices[i].z, BoundingBox.z1);
BoundingBox.z2 = std::max(vertices[i].z, BoundingBox.z2);
mesh.BoundingRadius = std::max(mesh.BoundingRadius, d);
}
}
}
if(vertex_elem != NULL)
Error(FormatString("Too many vertices in vertexbuffer"), buffer_elem);
if(i < vertices.size())
Error(FormatString("Not enough vertices in vertexbuffer"), buffer_elem);
loaded_attributes |= attributes;
}
static const unsigned int REQUIRED_ATTRIBUTES = POSITIONS | NORMALS | TEXCOORDS;
if((loaded_attributes & REQUIRED_ATTRIBUTES) != REQUIRED_ATTRIBUTES)
Error(FormatString("Not all required vertex attributes (positions, normals, texcoords) present in mesh geometry"), geometry_elem);
}
void StdMeshLoader::StdMeshXML::LoadBoneAssignments(StdMesh& mesh, std::vector<StdSubMesh::Vertex>& vertices, TiXmlElement* boneassignments_elem)
{
for (TiXmlElement* vertexboneassignment_elem = boneassignments_elem->FirstChildElement("vertexboneassignment"); vertexboneassignment_elem != NULL; vertexboneassignment_elem = vertexboneassignment_elem->NextSiblingElement("vertexboneassignment"))
{
int BoneID = RequireIntAttribute(vertexboneassignment_elem, "boneindex");
int VertexIndex = RequireIntAttribute(vertexboneassignment_elem, "vertexindex");
float weight = RequireFloatAttribute(vertexboneassignment_elem, "weight");
if (VertexIndex < 0 || static_cast<unsigned int>(VertexIndex) >= vertices.size())
Error(FormatString("Vertex index in bone assignment (%d) is out of range", VertexIndex), vertexboneassignment_elem);
// maybe not needed, see comment below
const StdMeshBone* bone = NULL;
for (unsigned int i = 0; !bone && i < mesh.GetSkeleton().GetNumBones(); ++i)
if (mesh.GetSkeleton().GetBone(i).ID == BoneID)
bone = &mesh.GetSkeleton().GetBone(i);
if (!bone) Error(FormatString("There is no such bone with ID %d", BoneID), vertexboneassignment_elem);
// Find first bone assignment with a zero weight (i.e. is unused)
StdSubMesh::Vertex& vertex = vertices[VertexIndex];
// Check quickly if all weight slots are used
if (vertex.bone_weight[StdMeshVertex::MaxBoneWeightCount - 1] != 0)
{
Error(FormatString("Vertex %d is influenced by more than %d bones", VertexIndex, static_cast<int>(StdMeshVertex::MaxBoneWeightCount)), vertexboneassignment_elem);
}
for (size_t weight_index = 0; weight_index < StdMeshVertex::MaxBoneWeightCount; ++weight_index)
{
if (vertex.bone_weight[weight_index] == 0)
{
vertex.bone_weight[weight_index] = weight;
vertex.bone_index[weight_index] = bone->Index;
break;
}
}
}
// Normalize vertex bone assignment weights (this is not guaranteed in the
// Ogre file format).
for (unsigned int i = 0; i < vertices.size(); ++i)
{
StdSubMesh::Vertex& vertex = vertices[i];
float sum = 0.0;
for (float weight : vertex.bone_weight)
sum += weight;
if (sum != 0)
for (float &weight : vertex.bone_weight)
weight /= sum;
else
vertex.bone_weight[0] = 1.0f;
}
}
StdMesh *StdMeshLoader::LoadMeshXml(const char* xml_data, size_t size, const StdMeshMatManager& manager, StdMeshSkeletonLoader& skel_loader, const char* filename)
{
StdMeshXML xml(filename ? filename : "<unknown>", xml_data);
std::unique_ptr<StdMesh> mesh(new StdMesh);
TiXmlElement* mesh_elem = xml.RequireFirstChild(NULL, "mesh");
// Load shared geometry, if any
TiXmlElement* sharedgeometry_elem = mesh_elem->FirstChildElement("sharedgeometry");
if(sharedgeometry_elem != NULL)
xml.LoadGeometry(*mesh, mesh->SharedVertices, sharedgeometry_elem);
TiXmlElement* submeshes_elem = xml.RequireFirstChild(mesh_elem, "submeshes");
TiXmlElement* submesh_elem_base = xml.RequireFirstChild(submeshes_elem, "submesh");
for (TiXmlElement* submesh_elem = submesh_elem_base; submesh_elem != NULL; submesh_elem = submesh_elem->NextSiblingElement("submesh"))
{
mesh->SubMeshes.push_back(StdSubMesh());
StdSubMesh& submesh = mesh->SubMeshes.back();
const char* material = xml.RequireStrAttribute(submesh_elem, "material");
submesh.Material = manager.GetMaterial(material);
if (!submesh.Material)
xml.Error(FormatString("There is no such material named '%s'", material), submesh_elem);
const char* usesharedvertices = submesh_elem->Attribute("usesharedvertices");
const std::vector<StdMesh::Vertex>* vertices;
if(!usesharedvertices || strcmp(usesharedvertices, "true") != 0)
{
TiXmlElement* geometry_elem = xml.RequireFirstChild(submesh_elem, "geometry");
xml.LoadGeometry(*mesh, submesh.Vertices, geometry_elem);
vertices = &submesh.Vertices;
}
else
{
if(mesh->SharedVertices.empty())
xml.Error(StdCopyStrBuf("Submesh specifies to use shared vertices but there is no shared geometry"), submesh_elem);
vertices = &mesh->SharedVertices;
}
TiXmlElement* faces_elem = xml.RequireFirstChild(submesh_elem, "faces");
int FaceCount = xml.RequireIntAttribute(faces_elem, "count");
submesh.Faces.resize(FaceCount);
unsigned int i = 0;
for (TiXmlElement* face_elem = faces_elem->FirstChildElement("face"); face_elem != NULL && i < submesh.Faces.size(); face_elem = face_elem->NextSiblingElement("face"), ++i)
{
int v[3];
v[0] = xml.RequireIntAttribute(face_elem, "v1");
v[1] = xml.RequireIntAttribute(face_elem, "v2");
v[2] = xml.RequireIntAttribute(face_elem, "v3");
for (unsigned int j = 0; j < 3; ++j)
{
if (v[j] < 0 || static_cast<unsigned int>(v[j]) >= vertices->size())
xml.Error(FormatString("Vertex index v%u (%d) is out of range", j+1, v[j]), face_elem);
submesh.Faces[i].Vertices[j] = v[j];
}
}
}
// We allow bounding box to be empty if it's only due to Z direction since
// this is what goes inside the screen in Clonk.
if(mesh->BoundingBox.x1 == mesh->BoundingBox.x2 || mesh->BoundingBox.y1 == mesh->BoundingBox.y2)
xml.Error(StdCopyStrBuf("Bounding box is empty"), mesh_elem);
// Read skeleton, if any
TiXmlElement* skeletonlink_elem = mesh_elem->FirstChildElement("skeletonlink");
if (skeletonlink_elem)
{
const char* name = xml.RequireStrAttribute(skeletonlink_elem, "name");
StdCopyStrBuf xml_filename(name); xml_filename.Append(".xml");
StdCopyStrBuf skeleton_filename;
StdMeshSkeletonLoader::MakeFullSkeletonPath(skeleton_filename, filename, xml_filename.getData());
mesh->Skeleton = skel_loader.GetSkeletonByName(skeleton_filename);
if (!mesh->Skeleton) xml.Error(FormatString("Failed to load '%s'", skeleton_filename.getData()), skeletonlink_elem);
// Vertex<->Bone assignments for shared geometry
if (sharedgeometry_elem)
{
TiXmlElement* boneassignments_elem = xml.RequireFirstChild(mesh_elem, "boneassignments");
xml.LoadBoneAssignments(*mesh, mesh->SharedVertices, boneassignments_elem);
}
// Vertex<->Bone assignments for all vertices (need to go through SubMeshes again...)
unsigned int submesh_index = 0;
for (TiXmlElement* submesh_elem = submesh_elem_base; submesh_elem != NULL; submesh_elem = submesh_elem->NextSiblingElement("submesh"), ++submesh_index)
{
StdSubMesh& submesh = mesh->SubMeshes[submesh_index];
if (!submesh.Vertices.empty())
{
TiXmlElement* boneassignments_elem = xml.RequireFirstChild(submesh_elem, "boneassignments");
xml.LoadBoneAssignments(*mesh, submesh.Vertices, boneassignments_elem);
}
}
}
else
{
// Mesh has no skeleton
// Bone assignements do not make sense then, as the
// actual bones are defined in the skeleton file.
for (TiXmlElement* submesh_elem = submesh_elem_base; submesh_elem != NULL; submesh_elem = submesh_elem->NextSiblingElement("submesh"))
{
TiXmlElement* boneassignments_elem = submesh_elem->FirstChildElement("boneassignments");
if (boneassignments_elem)
xml.Error(StdStrBuf("Mesh has bone assignments, but no skeleton"), boneassignments_elem);
}
TiXmlElement* boneassignments_elem = mesh_elem->FirstChildElement("boneassignments");
if (boneassignments_elem)
xml.Error(StdStrBuf("Mesh has bone assignments, but no skeleton"), boneassignments_elem);
}
return mesh.release();
}
void StdMeshSkeletonLoader::LoadSkeletonXml(const char* groupname, const char* filename, const char *sourcefile, size_t size)
{
if (sourcefile == NULL)
{
throw Ogre::InsufficientData(FormatString("Failed to load '%s/%s'", groupname, filename).getData());
}
std::shared_ptr<StdMeshLoader::StdMeshXML> skeleton(new StdMeshLoader::StdMeshXML(filename, sourcefile));
TiXmlElement* skeleton_elem = skeleton->RequireFirstChild(NULL, "skeleton");
TiXmlElement* bones_elem = skeleton->RequireFirstChild(skeleton_elem, "bones");
// Read bones. Don't insert into Master bone table yet, as the master bone
// table is sorted hierarchically, and we will read the hierarchy only
// afterwards.
std::vector<StdMeshBone*> bones;
for (TiXmlElement* bone_elem = bones_elem->FirstChildElement("bone"); bone_elem != NULL; bone_elem = bone_elem->NextSiblingElement("bone"))
{
StdMeshBone* bone = new StdMeshBone;
bones.push_back(bone);
bone->ID = skeleton->RequireIntAttribute(bone_elem, "id");
bone->Name = skeleton->RequireStrAttribute(bone_elem, "name");
// TODO: Make sure ID and name are unique
bone->Parent = NULL;
// Index of bone will be set when building Master Bone Table later
TiXmlElement* position_elem = skeleton->RequireFirstChild(bone_elem, "position");
TiXmlElement* rotation_elem = skeleton->RequireFirstChild(bone_elem, "rotation");
TiXmlElement* axis_elem = skeleton->RequireFirstChild(rotation_elem, "axis");
StdMeshVector d, r;
d.x = skeleton->RequireFloatAttribute(position_elem, "x");
d.y = skeleton->RequireFloatAttribute(position_elem, "y");
d.z = skeleton->RequireFloatAttribute(position_elem, "z");
float angle = skeleton->RequireFloatAttribute(rotation_elem, "angle");
r.x = skeleton->RequireFloatAttribute(axis_elem, "x");
r.y = skeleton->RequireFloatAttribute(axis_elem, "y");
r.z = skeleton->RequireFloatAttribute(axis_elem, "z");
bone->Transformation.scale = StdMeshVector::UnitScale();
bone->Transformation.rotate = StdMeshQuaternion::AngleAxis(angle, r);
bone->Transformation.translate = d;
// We need this later for applying animations, and attaching meshes, therefore cache it here
bone->InverseTransformation = StdMeshTransformation::Inverse(bone->Transformation);
}
// Bone hierarchy
TiXmlElement* bonehierarchy_elem = skeleton->RequireFirstChild(skeleton_elem, "bonehierarchy");
for (TiXmlElement* boneparent_elem = bonehierarchy_elem->FirstChildElement("boneparent"); boneparent_elem != NULL; boneparent_elem = boneparent_elem->NextSiblingElement("boneparent"))
{
const char* child_name = skeleton->RequireStrAttribute(boneparent_elem, "bone");
const char* parent_name = skeleton->RequireStrAttribute(boneparent_elem, "parent");
// Lookup the two bones
StdMeshBone* child = NULL;
StdMeshBone* parent = NULL;
for (unsigned int i = 0; i < bones.size() && (!child || !parent); ++i)
{
if (!child && bones[i]->Name == child_name)
child = bones[i];
if (!parent && bones[i]->Name == parent_name)
parent = bones[i];
}
if (!child) skeleton->Error(FormatString("There is no such bone with name '%s'", child_name), boneparent_elem);
if (!parent) skeleton->Error(FormatString("There is no such bone with name '%s'", parent_name), boneparent_elem);
child->Parent = parent;
parent->Children.push_back(child);
}
std::shared_ptr<StdMeshSkeleton> Skeleton(new StdMeshSkeleton);
// Fill master bone table in hierarchical order:
for (unsigned int i = 0; i < bones.size(); ++i)
if (bones[i]->Parent == NULL)
Skeleton->AddMasterBone(bones[i]);
// Load Animations
TiXmlElement* animations_elem = skeleton_elem->FirstChildElement("animations");
if (animations_elem)
{
for (TiXmlElement* animation_elem = animations_elem->FirstChildElement("animation"); animation_elem != NULL; animation_elem = animation_elem->NextSiblingElement("animation"))
{
StdCopyStrBuf name(skeleton->RequireStrAttribute(animation_elem, "name"));
if (Skeleton->Animations.find(name) != Skeleton->Animations.end())
skeleton->Error(FormatString("There is already an animation with name '%s'", name.getData()), animation_elem);
StdMeshAnimation& animation = Skeleton->Animations.insert(std::make_pair(name, StdMeshAnimation())).first->second;
animation.Name = name;
animation.Length = skeleton->RequireFloatAttribute(animation_elem, "length");
animation.Tracks.resize(Skeleton->GetNumBones());
animation.OriginSkeleton = &(*Skeleton);
TiXmlElement* tracks_elem = skeleton->RequireFirstChild(animation_elem, "tracks");
for (TiXmlElement* track_elem = tracks_elem->FirstChildElement("track"); track_elem != NULL; track_elem = track_elem->NextSiblingElement("track"))
{
const char* bone_name = skeleton->RequireStrAttribute(track_elem, "bone");
StdMeshBone* bone = NULL;
for (unsigned int i = 0; !bone && i < Skeleton->GetNumBones(); ++i)
if (Skeleton->Bones[i]->Name == bone_name)
bone = Skeleton->Bones[i];
if (!bone) skeleton->Error(FormatString("There is no such bone with name '%s'", bone_name), track_elem);
if (animation.Tracks[bone->Index] != NULL) skeleton->Error(FormatString("There is already a track for bone '%s' in animation '%s'", bone_name, animation.Name.getData()), track_elem);
StdMeshTrack* track = new StdMeshTrack;
animation.Tracks[bone->Index] = track;
TiXmlElement* keyframes_elem = skeleton->RequireFirstChild(track_elem, "keyframes");
for (TiXmlElement* keyframe_elem = keyframes_elem->FirstChildElement("keyframe"); keyframe_elem != NULL; keyframe_elem = keyframe_elem->NextSiblingElement("keyframe"))
{
float time = skeleton->RequireFloatAttribute(keyframe_elem, "time");
StdMeshKeyFrame& frame = track->Frames[time];
TiXmlElement* translate_elem = keyframe_elem->FirstChildElement("translate");
TiXmlElement* rotate_elem = keyframe_elem->FirstChildElement("rotate");
TiXmlElement* scale_elem = keyframe_elem->FirstChildElement("scale");
StdMeshVector d, s, r;
d.x = d.y = d.z = 0.0f;
s = StdMeshVector::UnitScale();
r.x = r.y = 0.0f; r.z = 1.0f;
float angle = 0.0f;
if (translate_elem)
{
d.x = skeleton->RequireFloatAttribute(translate_elem, "x");
d.y = skeleton->RequireFloatAttribute(translate_elem, "y");
d.z = skeleton->RequireFloatAttribute(translate_elem, "z");
}
if (rotate_elem)
{
TiXmlElement* axis_elem = skeleton->RequireFirstChild(rotate_elem, "axis");
angle = skeleton->RequireFloatAttribute(rotate_elem, "angle");
r.x = skeleton->RequireFloatAttribute(axis_elem, "x");
r.y = skeleton->RequireFloatAttribute(axis_elem, "y");
r.z = skeleton->RequireFloatAttribute(axis_elem, "z");
}
if (scale_elem)
{
s.x = skeleton->RequireFloatAttribute(scale_elem, "x");
s.y = skeleton->RequireFloatAttribute(scale_elem, "y");
s.z = skeleton->RequireFloatAttribute(scale_elem, "z");
}
frame.Transformation.scale = s;
frame.Transformation.rotate = StdMeshQuaternion::AngleAxis(angle, r);
frame.Transformation.translate = bone->InverseTransformation.rotate * (bone->InverseTransformation.scale * d);
frame.Transformation = OgreToClonk::TransformTransformation(frame.Transformation);
}
}
}
}
// is there even any xml file that we load from?
// it looks like this could never work: if the mesh has no skeleton, then the code below will fail because of a null pointer...
// Apply parent transformation to each bone transformation. We need to
// do this late since animation keyframe computation needs the bone
// transformations, not bone+parent.
for (unsigned int i = 0; i < Skeleton->GetNumBones(); ++i)
{
// Apply parent transformation
if (Skeleton->Bones[i]->Parent)
Skeleton->Bones[i]->Transformation = Skeleton->Bones[i]->Parent->Transformation * OgreToClonk::TransformTransformation(Skeleton->Bones[i]->Transformation);
else
Skeleton->Bones[i]->Transformation = OgreToClonk::TransformTransformation(Skeleton->Bones[i]->Transformation);
// Update inverse
Skeleton->Bones[i]->InverseTransformation = StdMeshTransformation::Inverse(Skeleton->Bones[i]->Transformation);
}
StoreSkeleton(groupname, filename, Skeleton);
}
|
[
"pkern@debian.org"
] |
pkern@debian.org
|
36f42b8358852b85ad5c0bd15aedb78da8c141da
|
33defc4281fe59837acc7d4428e4e38b18494216
|
/captal/src/captal/color.hpp
|
c700ac76702f956c5a8a30222523133e9382ba28
|
[
"MIT"
] |
permissive
|
msiva21/captal-engine
|
5ccdaff1d357f053cd761ed9dae0e2ccc095cb07
|
93a5f428b4cee810b529b7c9a9b3bf6504c8f32f
|
refs/heads/master
| 2023-08-27T12:27:29.694403
| 2021-10-28T16:51:57
| 2021-10-28T16:51:57
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 15,324
|
hpp
|
//MIT License
//
//Copyright (c) 2021 Alexy Pellegrini
//
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions:
//
//The above copyright notice and this permission notice shall be included in all
//copies or substantial portions of the Software.
//
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//SOFTWARE.
#ifndef CAPTAL_COLOR_HPP_INCLUDED
#define CAPTAL_COLOR_HPP_INCLUDED
#include "config.hpp"
#include <cassert>
#include <cmath>
#include <concepts>
#include <captal_foundation/math.hpp>
#include <tephra/image.hpp>
namespace cpt
{
struct CAPTAL_API color
{
constexpr color() noexcept = default;
template<std::floating_point T>
constexpr explicit color(T r, T g, T b, T a = static_cast<T>(1)) noexcept
:red{static_cast<float>(r)}
,green{static_cast<float>(g)}
,blue{static_cast<float>(b)}
,alpha{static_cast<float>(a)}
{
}
template<std::unsigned_integral T>
constexpr explicit color(T r, T g, T b, T a = std::numeric_limits<T>::max()) noexcept
:red{static_cast<float>(r) / std::numeric_limits<T>::max()}
,green{static_cast<float>(g) / std::numeric_limits<T>::max()}
,blue{static_cast<float>(b) / std::numeric_limits<T>::max()}
,alpha{static_cast<float>(a) / std::numeric_limits<T>::max()}
{
}
template<arithmetic T>
constexpr explicit color(const vec4<T>& value) noexcept
:color{value.x(), value.y(), value.z(), value.w()}
{
}
constexpr explicit color(const tph::pixel& pixel) noexcept
:color{pixel.red, pixel.blue, pixel.green, pixel.alpha}
{
}
constexpr explicit color(std::uint32_t rgba_value) noexcept
:color{static_cast<std::uint8_t>(rgba_value >> 16), static_cast<std::uint8_t>(rgba_value >> 8), static_cast<std::uint8_t>(rgba_value), static_cast<std::uint8_t>(rgba_value >> 24)}
{
}
constexpr explicit operator vec4f() const noexcept
{
return vec4f{red, green, blue, alpha};
}
constexpr explicit operator tph::pixel() const noexcept
{
return tph::pixel{static_cast<std::uint8_t>(red * 255.0f), static_cast<std::uint8_t>(green * 255.0f), static_cast<std::uint8_t>(blue * 255.0f), static_cast<std::uint8_t>(alpha * 255.0f)};
}
float red{};
float green{};
float blue{};
float alpha{};
};
inline color hsv_to_rgb(float hue, float saturation, float value, float alpha = 1.0f) noexcept
{
assert((0.0f <= hue && hue <= 360.0f) && "HSV value out of range.");
assert((0.0f <= saturation && saturation <= 1.0f) && "HSV value out of range.");
assert((0.0f <= value && value <= 1.0f) && "HSV value out of range.");
const float chroma{value * saturation};
const float prime{hue / 60.0f};
const float discriminant{chroma * (1.0f - std::fabs(std::fmod(prime, 2.0f) - 1.0f))};
const float remainder{value - chroma};
switch(static_cast<std::int32_t>(prime))
{
case 0: return color{chroma + remainder, discriminant + remainder, remainder, alpha};
case 1: return color{discriminant + remainder, chroma + remainder, remainder, alpha};
case 2: return color{remainder, chroma + remainder, discriminant + remainder, alpha};
case 3: return color{remainder, discriminant + remainder, chroma + remainder, alpha};
case 4: return color{discriminant + remainder, remainder, chroma + remainder, alpha};
case 5: return color{chroma + remainder, remainder, discriminant + remainder, alpha};
default: return color{0.0f, 0.0f, 0.0f, alpha};
}
}
constexpr color gradient(const color& first, const color& second, float advance) noexcept
{
assert((0.0f <= advance && advance <= 1.0f) && "advance must be in the range [0; 1].");
const auto compute = [advance](float first, float second) -> float
{
if(first < second)
{
return first + (second - first) * advance;
}
return first - (first - second) * advance;
};
color output{};
output.red = compute(first.red, second.red);
output.green = compute(first.green, second.green);
output.blue = compute(first.blue, second.blue);
output.alpha = compute(first.alpha, second.alpha);
return output;
}
namespace colors
{
inline constexpr color aliceblue {0.941f, 0.973f, 1.000f};
inline constexpr color antiquewhite {0.980f, 0.922f, 0.843f};
inline constexpr color aqua {0.000f, 1.000f, 1.000f};
inline constexpr color aquamarine {0.498f, 1.000f, 0.831f};
inline constexpr color azure {0.941f, 1.000f, 1.000f};
inline constexpr color beige {0.961f, 0.961f, 0.863f};
inline constexpr color bisque {1.000f, 0.894f, 0.769f};
inline constexpr color black {0.000f, 0.000f, 0.000f};
inline constexpr color blanchedalmond {1.000f, 0.922f, 0.804f};
inline constexpr color blue {0.000f, 0.000f, 1.000f};
inline constexpr color blueviolet {0.541f, 0.169f, 0.886f};
inline constexpr color brown {0.647f, 0.165f, 0.165f};
inline constexpr color burlywood {0.871f, 0.722f, 0.529f};
inline constexpr color cadetblue {0.373f, 0.620f, 0.627f};
inline constexpr color chartreuse {0.498f, 1.000f, 0.000f};
inline constexpr color chocolate {0.824f, 0.412f, 0.118f};
inline constexpr color coral {1.000f, 0.498f, 0.314f};
inline constexpr color cornflowerblue {0.392f, 0.584f, 0.929f};
inline constexpr color cornsilk {1.000f, 0.973f, 0.863f};
inline constexpr color crimson {0.863f, 0.078f, 0.235f};
inline constexpr color cyan {0.000f, 1.000f, 1.000f};
inline constexpr color darkblue {0.000f, 0.000f, 0.545f};
inline constexpr color darkcyan {0.000f, 0.545f, 0.545f};
inline constexpr color darkgoldenrod {0.722f, 0.525f, 0.043f};
inline constexpr color darkgray {0.663f, 0.663f, 0.663f};
inline constexpr color darkgrey {0.663f, 0.663f, 0.663f};
inline constexpr color darkgreen {0.000f, 0.392f, 0.000f};
inline constexpr color darkkhaki {0.741f, 0.718f, 0.420f};
inline constexpr color darkmagenta {0.545f, 0.000f, 0.545f};
inline constexpr color darkolivegreen {0.333f, 0.420f, 0.184f};
inline constexpr color darkorange {1.000f, 0.549f, 0.000f};
inline constexpr color darkorchid {0.600f, 0.196f, 0.800f};
inline constexpr color darkred {0.545f, 0.000f, 0.000f};
inline constexpr color darksalmon {0.914f, 0.588f, 0.478f};
inline constexpr color darkseagreen {0.561f, 0.737f, 0.561f};
inline constexpr color darkslateblue {0.282f, 0.239f, 0.545f};
inline constexpr color darkslategray {0.184f, 0.310f, 0.310f};
inline constexpr color darkslategrey {0.184f, 0.310f, 0.310f};
inline constexpr color darkturquoise {0.000f, 0.808f, 0.820f};
inline constexpr color darkviolet {0.580f, 0.000f, 0.827f};
inline constexpr color deeppink {1.000f, 0.078f, 0.576f};
inline constexpr color deepskyblue {0.000f, 0.749f, 1.000f};
inline constexpr color dimgray {0.412f, 0.412f, 0.412f};
inline constexpr color dimgrey {0.412f, 0.412f, 0.412f};
inline constexpr color dodgerblue {0.118f, 0.565f, 1.000f};
inline constexpr color firebrick {0.698f, 0.133f, 0.133f};
inline constexpr color floralwhite {1.000f, 0.980f, 0.941f};
inline constexpr color forestgreen {0.133f, 0.545f, 0.133f};
inline constexpr color fuchsia {1.000f, 0.000f, 1.000f};
inline constexpr color gainsboro {0.863f, 0.863f, 0.863f};
inline constexpr color ghostwhite {0.973f, 0.973f, 1.000f};
inline constexpr color gold {1.000f, 0.843f, 0.000f};
inline constexpr color goldenrod {0.855f, 0.647f, 0.125f};
inline constexpr color gray {0.502f, 0.502f, 0.502f};
inline constexpr color grey {0.502f, 0.502f, 0.502f};
inline constexpr color green {0.000f, 0.502f, 0.000f};
inline constexpr color greenyellow {0.678f, 1.000f, 0.184f};
inline constexpr color honeydew {0.941f, 1.000f, 0.941f};
inline constexpr color hotpink {1.000f, 0.412f, 0.706f};
inline constexpr color indianred {0.804f, 0.361f, 0.361f};
inline constexpr color indigo {0.294f, 0.000f, 0.510f};
inline constexpr color ivory {1.000f, 1.000f, 0.941f};
inline constexpr color khaki {0.941f, 0.902f, 0.549f};
inline constexpr color lavender {0.902f, 0.902f, 0.980f};
inline constexpr color lavenderblush {1.000f, 0.941f, 0.961f};
inline constexpr color lawngreen {0.486f, 0.988f, 0.000f};
inline constexpr color lemonchiffon {1.000f, 0.980f, 0.804f};
inline constexpr color lightblue {0.678f, 0.847f, 0.902f};
inline constexpr color lightcoral {0.941f, 0.502f, 0.502f};
inline constexpr color lightcyan {0.878f, 1.000f, 1.000f};
inline constexpr color lightgoldenrodyellow{0.980f, 0.980f, 0.824f};
inline constexpr color lightgray {0.827f, 0.827f, 0.827f};
inline constexpr color lightgrey {0.827f, 0.827f, 0.827f};
inline constexpr color lightgreen {0.565f, 0.933f, 0.565f};
inline constexpr color lightpink {1.000f, 0.714f, 0.757f};
inline constexpr color lightsalmon {1.000f, 0.627f, 0.478f};
inline constexpr color lightseagreen {0.125f, 0.698f, 0.667f};
inline constexpr color lightskyblue {0.529f, 0.808f, 0.980f};
inline constexpr color lightslategray {0.467f, 0.533f, 0.600f};
inline constexpr color lightslategrey {0.467f, 0.533f, 0.600f};
inline constexpr color lightsteelblue {0.690f, 0.769f, 0.871f};
inline constexpr color lightyellow {1.000f, 1.000f, 0.878f};
inline constexpr color lime {0.000f, 1.000f, 0.000f};
inline constexpr color limegreen {0.196f, 0.804f, 0.196f};
inline constexpr color linen {0.980f, 0.941f, 0.902f};
inline constexpr color magenta {1.000f, 0.000f, 1.000f};
inline constexpr color maroon {0.502f, 0.000f, 0.000f};
inline constexpr color mediumaquamarine {0.400f, 0.804f, 0.667f};
inline constexpr color mediumblue {0.000f, 0.000f, 0.804f};
inline constexpr color mediumorchid {0.729f, 0.333f, 0.827f};
inline constexpr color mediumpurple {0.576f, 0.439f, 0.859f};
inline constexpr color mediumseagreen {0.235f, 0.702f, 0.443f};
inline constexpr color mediumslateblue {0.482f, 0.408f, 0.933f};
inline constexpr color mediumspringgreen {0.000f, 0.980f, 0.604f};
inline constexpr color mediumturquoise {0.282f, 0.820f, 0.800f};
inline constexpr color mediumvioletred {0.780f, 0.082f, 0.522f};
inline constexpr color midnightblue {0.098f, 0.098f, 0.439f};
inline constexpr color mintcream {0.961f, 1.000f, 0.980f};
inline constexpr color mistyrose {1.000f, 0.894f, 0.882f};
inline constexpr color moccasin {1.000f, 0.894f, 0.710f};
inline constexpr color navajowhite {1.000f, 0.871f, 0.678f};
inline constexpr color navy {0.000f, 0.000f, 0.502f};
inline constexpr color oldlace {0.992f, 0.961f, 0.902f};
inline constexpr color olive {0.502f, 0.502f, 0.000f};
inline constexpr color olivedrab {0.420f, 0.557f, 0.137f};
inline constexpr color orange {1.000f, 0.647f, 0.000f};
inline constexpr color orangered {1.000f, 0.271f, 0.000f};
inline constexpr color orchid {0.855f, 0.439f, 0.839f};
inline constexpr color palegoldenrod {0.933f, 0.910f, 0.667f};
inline constexpr color palegreen {0.596f, 0.984f, 0.596f};
inline constexpr color paleturquoise {0.686f, 0.933f, 0.933f};
inline constexpr color palevioletred {0.859f, 0.439f, 0.576f};
inline constexpr color papayawhip {1.000f, 0.937f, 0.835f};
inline constexpr color peachpuff {1.000f, 0.855f, 0.725f};
inline constexpr color peru {0.804f, 0.522f, 0.247f};
inline constexpr color pink {1.000f, 0.753f, 0.796f};
inline constexpr color plum {0.867f, 0.627f, 0.867f};
inline constexpr color powderblue {0.690f, 0.878f, 0.902f};
inline constexpr color purple {0.502f, 0.000f, 0.502f};
inline constexpr color rebeccapurple {0.400f, 0.200f, 0.600f};
inline constexpr color red {1.000f, 0.000f, 0.000f};
inline constexpr color rosybrown {0.737f, 0.561f, 0.561f};
inline constexpr color royalblue {0.255f, 0.412f, 0.882f};
inline constexpr color saddlebrown {0.545f, 0.271f, 0.075f};
inline constexpr color salmon {0.980f, 0.502f, 0.447f};
inline constexpr color sandybrown {0.957f, 0.643f, 0.376f};
inline constexpr color seagreen {0.180f, 0.545f, 0.341f};
inline constexpr color seashell {1.000f, 0.961f, 0.933f};
inline constexpr color sienna {0.627f, 0.322f, 0.176f};
inline constexpr color silver {0.753f, 0.753f, 0.753f};
inline constexpr color skyblue {0.529f, 0.808f, 0.922f};
inline constexpr color slateblue {0.416f, 0.353f, 0.804f};
inline constexpr color slategray {0.439f, 0.502f, 0.565f};
inline constexpr color slategrey {0.439f, 0.502f, 0.565f};
inline constexpr color snow {1.000f, 0.980f, 0.980f};
inline constexpr color springgreen {0.000f, 1.000f, 0.498f};
inline constexpr color steelblue {0.275f, 0.510f, 0.706f};
inline constexpr color tan {0.824f, 0.706f, 0.549f};
inline constexpr color teal {0.000f, 0.502f, 0.502f};
inline constexpr color thistle {0.847f, 0.749f, 0.847f};
inline constexpr color tomato {1.000f, 0.388f, 0.278f};
inline constexpr color transparent {0.0f, 0.0f, 0.0f, 0.0f};
inline constexpr color turquoise {0.251f, 0.878f, 0.816f};
inline constexpr color violet {0.933f, 0.510f, 0.933f};
inline constexpr color wheat {0.961f, 0.871f, 0.702f};
inline constexpr color white {1.000f, 1.000f, 1.000f};
inline constexpr color whitesmoke {0.961f, 0.961f, 0.961f};
inline constexpr color yellow {1.000f, 1.000f, 0.000f};
inline constexpr color yellowgreen {0.604f, 0.804f, 0.196f};
}
}
#endif
|
[
"alexy.pellegrini@laposte.net"
] |
alexy.pellegrini@laposte.net
|
aa8bfa8e26d47563cc26d232dcfa6c07cabba028
|
0aed890310c711019c934b208ae3041bf6f6206b
|
/opengl游戏编程/openglgame/第12章/Collide/GLWindow.h
|
39884dc1ba0ea11a813cba4a6439eae0060b73da
|
[] |
no_license
|
Kranfeit/OpenGlBooks
|
80ef6c534c4221c00659459f009d704e2fe3f10b
|
cfb317ee96e97909f459640dd239bdd26b1a61f2
|
refs/heads/master
| 2022-03-15T14:25:52.644434
| 2019-11-04T20:38:38
| 2019-11-04T20:38:38
| null | 0
| 0
| null | null | null | null |
GB18030
|
C++
| false
| false
| 2,777
|
h
|
//========================================================
/**
* @file GLWindows.h
*
* 项目描述: 碰撞检测演示
* 文件描述: 程序窗口类
* 适用平台: Windows98/2000/NT/XP
*
* 作者: WWBOSS
* 电子邮件: wwboss123@gmail.com
* 创建日期: 2006-09-13
* 修改日期: 2006-10-10
*
*/
//========================================================
#ifndef __GLWINDOW_H__
#define __GLWINDOW_H__
#include <windows.h> /**< 包含windows.h头文件 */
/** windows窗口类 */
class GLWindow
{
public:
/** 重要的窗口函数 */
/** 构造函数 */
GLWindow();
/** 创建windows窗口 */
bool Create(const char * window_title, const char * class_name, bool fullscreen,HINSTANCE h_instance, LPVOID lpParam);
/** 删除OpenGL窗口 */
void Destroy();
/** 改变窗口的显示设置 */
bool ChangeScreenSetting();
/** 当窗口大小改变时,通知OpenGL调整大小 */
void ReshapeGL();
/** Swap Buffers (Double Buffering) */
void SwapBuffers() { ::SwapBuffers(m_hDC); }
/** 下面函数为设置/返回窗口类的属性 */
/** 设置窗口左上角的位置 */
void SetPosX(int x);
void SetPosX(unsigned short x) { SetPosX((signed short)x); }
void SetPosY(int y);
void SetPosY(unsigned short y) { SetPosY((signed short)y); }
/** 返回窗口的大小 */
int GetWidth();
int GetHeight();
/** 设置窗口的大小 */
void SetWidth(int width);
void SetHeight(int height);
/** 返回窗口左上角的位置 */
int GetPosX();
int GetPosY();
/** 设置窗口的颜色位深 */
void SetHiColor() { m_BitsPerPixel = 16; }
void SetTrueColor() { m_BitsPerPixel = 32; }
//void SetFullScreen(bool mode) { m_IsFullScreen = mode; }
//bool GetFullScreen() { return m_IsFullScreen; }
/** 重载运算符,可以让GL_Window m_Window声明后的m_Window作为窗口句柄使用 */
operator HWND() { return m_hWnd; }
HWND GetHwnd() { return m_hWnd; }
HDC GetHDC() { return m_hDC; }
private:
HWND m_hWnd; /**< 窗口句柄 */
HDC m_hDC; /**< 设备描述表 */
HGLRC m_hRC; /**< OpenGL渲染描述表 */
int m_WindowPosX; /**< 窗口的左上角的X位置 */
int m_WindowPosY; /**< 窗口的左上角的Y位置 */
int m_WindowWidth; /**< 窗口的宽度 */
int m_WindowHeight; /**< 窗口的高度 */
int m_ScreenWidth; /**< 全屏的宽度 */
int m_ScreenHeight; /**< 全屏的高度 */
int m_BitsPerPixel; /**< 颜色位深 */
bool m_IsFullScreen; /**< 是否全屏 */
};
#endif // __GLWINDOW_H__
|
[
"twtravel@126.com"
] |
twtravel@126.com
|
c80c23fc220067bac2da59ca6dfebbf7f141614d
|
07b8e2b217cf07b4cf0fe4bdf2521228fcea6a6d
|
/TwoExecutablesOneMakefile/aux.cpp
|
129dfe812356dfe319e50ff4013a269954f256c9
|
[] |
no_license
|
HMedeirosDosReis/CSC35500-Fall2020
|
6705d7002fdca8df5618fd746463e69a8dc9c729
|
f3462eb42c77537db8d7de671909198b59db4b71
|
refs/heads/main
| 2023-01-22T19:07:28.906706
| 2020-11-18T22:41:46
| 2020-11-18T22:41:46
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 101
|
cpp
|
#include <iostream>
using namespace std;
void myPrint(const string &msg)
{
cout << msg << endl;
}
|
[
"sblythe@lindenwood.edu"
] |
sblythe@lindenwood.edu
|
cd399dca149c02afc8e7a67765f861fb0d75cb72
|
fc22e37fd7cbfba12882ab6a27e5077be6ab5906
|
/src/muz/rel/dl_table.h
|
1bee7cb47aa1890d0ed7aaeef8d85d821a09a0b4
|
[
"MIT"
] |
permissive
|
typesAreSpaces/z3-interp-plus
|
fc4854193aea65c5a540c343bb29984492c1e766
|
cc421ef2276e06bebbc278dcd6a4d284edce21b2
|
refs/heads/master
| 2023-08-06T12:00:01.406896
| 2023-07-20T22:44:52
| 2023-07-20T22:44:52
| 284,618,312
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 3,720
|
h
|
/*++
Copyright (c) 2006 Microsoft Corporation
Module Name:
dl_table.h
Abstract:
<abstract>
Author:
Krystof Hoder (t-khoder) 2010-09-01.
Revision History:
--*/
#ifndef DL_TABLE_H_
#define DL_TABLE_H_
#include<iostream>
#include<list>
#include<utility>
#include "ast/ast.h"
#include "util/bit_vector.h"
#include "util/buffer.h"
#include "util/hashtable.h"
#include "util/map.h"
#include "util/ref_vector.h"
#include "util/vector.h"
#include "util/union_find.h"
#include "muz/rel/dl_base.h"
#include "muz/base/dl_util.h"
#include "util/bit_vector.h"
namespace datalog {
class context;
class variable_intersection;
// -----------------------------------
//
// hashtable_table
//
// -----------------------------------
class hashtable_table;
class hashtable_table_plugin : public table_plugin {
friend class hashtable_table;
protected:
class join_fn;
public:
typedef hashtable_table table;
hashtable_table_plugin(relation_manager & manager)
: table_plugin(symbol("hashtable"), manager) {}
table_base * mk_empty(const table_signature & s) override;
table_join_fn * mk_join_fn(const table_base & t1, const table_base & t2,
unsigned col_cnt, const unsigned * cols1, const unsigned * cols2) override;
};
class hashtable_table : public table_base {
friend class hashtable_table_plugin;
friend class hashtable_table_plugin::join_fn;
class our_iterator_core;
typedef hashtable<table_fact, svector_hash_proc<table_element_hash>,
vector_eq_proc<table_fact> > storage;
storage m_data;
hashtable_table(hashtable_table_plugin & plugin, const table_signature & sig)
: table_base(plugin, sig) {}
public:
hashtable_table_plugin & get_plugin() const
{ return static_cast<hashtable_table_plugin &>(table_base::get_plugin()); }
void add_fact(const table_fact & f) override {
m_data.insert(f);
}
void remove_fact(const table_element* fact) override {
table_fact f(get_signature().size(), fact);
m_data.remove(f);
}
bool contains_fact(const table_fact & f) const override {
return m_data.contains(f);
}
iterator begin() const override;
iterator end() const override;
unsigned get_size_estimate_rows() const override { return m_data.size(); }
unsigned get_size_estimate_bytes() const override { return m_data.size()*get_signature().size()*8; }
bool knows_exact_size() const override { return true; }
};
// -----------------------------------
//
// bitvector_table
//
// -----------------------------------
class bitvector_table;
class bitvector_table_plugin : public table_plugin {
public:
typedef bitvector_table table;
bitvector_table_plugin(relation_manager & manager)
: table_plugin(symbol("bitvector"), manager) {}
bool can_handle_signature(const table_signature & s) override;
table_base * mk_empty(const table_signature & s) override;
};
class bitvector_table : public table_base {
friend class bitvector_table_plugin;
class bv_iterator;
bit_vector m_bv;
unsigned m_num_cols;
unsigned_vector m_shift;
unsigned_vector m_mask;
unsigned fact2offset(const table_element* f) const;
void offset2fact(unsigned offset, table_fact& f) const;
bitvector_table(bitvector_table_plugin & plugin, const table_signature & sig);
public:
void add_fact(const table_fact & f) override;
void remove_fact(const table_element* fact) override;
bool contains_fact(const table_fact & f) const override;
iterator begin() const override;
iterator end() const override;
};
};
#endif /* DL_TABLE_H_ */
|
[
"jabelcastellanosjoo@unm.edu"
] |
jabelcastellanosjoo@unm.edu
|
e7cdf7f4446444aff1427ee7eadffdf5be761ef6
|
b7eb9e077d16555be877e3ea43bdd55ae8e0a532
|
/Monopoly/Special.h
|
89778687fc74699071fc2d43dcb05fab29878baf
|
[] |
no_license
|
AWilliams24Uclan/Monopoly
|
5b7d2566f2222d0dd18dc77ed812d6794e5cba9f
|
dd28c55bc40f1eb4e510604f8e2c5b57e755be9a
|
refs/heads/master
| 2020-04-30T18:30:00.089213
| 2019-03-21T19:25:01
| 2019-03-21T19:25:01
| 177,010,186
| 0
| 1
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 104
|
h
|
#pragma once
#include "Square.h"
class Special : public Square
{
public:
Special();
~Special();
};
|
[
"AWilliams24@uclan.ac.uk"
] |
AWilliams24@uclan.ac.uk
|
c7c4c027fb9524b4700a2103d33c9b5629f734ca
|
5be7ec24889fd14b2f1d32b127c44bdcfe379bda
|
/Magic_Square.cpp
|
a131b04a7382751ddb4efb62f0aaf8188c9f2d72
|
[] |
no_license
|
utpalendubarman/JWoC_Algorithms
|
54dd055caa433ba099a66afe1f4268850be8fefa
|
5162fb57dd7232d5de5c7039213a9835a136856b
|
refs/heads/master
| 2020-12-29T18:21:02.521195
| 2020-02-06T13:40:49
| 2020-02-06T13:40:49
| 238,697,510
| 1
| 0
| null | 2020-02-06T13:39:55
| 2020-02-06T13:39:54
| null |
UTF-8
|
C++
| false
| false
| 2,477
|
cpp
|
#include <iostream>
#include <cstdio>
#include <string>
#include <sstream>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <ctime>
#include <cassert>
using namespace std;
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
#define vi vector<int>
#define vpii vector<pii>
#define SZ(x) ((int)(x.size()))
#define fi first
#define se second
#define FOR(i,n) for(int (i)=0;(i)<(n);++(i))
#define FORI(i,n) for(int (i)=1;(i)<=(n);++(i))
#define IN(x,y) ((y).find((x))!=(y).end())
#define ALL(t) t.begin(),t.end()
#define FOREACH(i,t) for (typeof(t.begin()) i=t.begin(); i!=t.end(); i++)
#define REP(i,a,b) for(int (i)=(a);(i)<=(b);++i)
#define REPD(i,a,b) for(int (i)=(a); (i)>=(b);--i)
#define REMAX(a,b) (a)=max((a),(b));
#define REMIN(a,b) (a)=min((a),(b));
#define DBG cerr << "debug here" << endl;
#define DBGV(vari) cerr << #vari<< " = "<< (vari) <<endl;
typedef long long ll;
const int INF = 1e9;
const int MINV = 1;
const int MAXV = 10;
vector<vi> magic_squares;
void print_magic_square(vi v)
{
FOR(i, 3)
{
FOR(j, 3)
{
cout << v[3 * i + j] << " ";
}
cout << endl;
}
}
bool is_magic_square(vi v)
{
int a[3][3];
FOR(i, 3)
{
FOR(j, 3)
{
a[i][j] = v[3 * i + j];
}
}
int s = 0;
FOR(j, 3) s += a[0][j];
REP(i, 1, 2)
{
int tmp = 0;
FOR(j, 3) tmp += a[i][j];
if(tmp != s) return 0;
}
FOR(j, 3)
{
int tmp = 0;
FOR(i, 3) tmp += a[i][j];
if(tmp != s) return 0;
}
int tmp = 0;
FOR(i, 3) tmp += a[i][i];
if(tmp != s) return 0;
tmp = 0;
FOR(i, 3) tmp += a[2 - i][i];
if(tmp != s) return 0;
return 1;
}
void find_magic_squares()
{
vi v(9);
FOR(i, 9) v[i] = i + 1;
do
{
if(is_magic_square(v))
{
magic_squares.pb(v);
}
} while(next_permutation(ALL(v)));
}
int diff(vi a, vi b)
{
int res = 0;
FOR(i, 9) res += abs(a[i] - b[i]);
return res;
}
int main()
{
ios_base::sync_with_stdio(0);
vi v(9);
FOR(i, 9) cin >> v[i];
int res = INF;
find_magic_squares();
FOR(i, magic_squares.size())
{
//print_magic_square(magic_squares[i]);
//cout << "########" << endl;
REMIN(res, diff(v, magic_squares[i]));
}
cout << res << endl;
}
|
[
"mahmood199@gaudentas199@gmail.com"
] |
mahmood199@gaudentas199@gmail.com
|
d325c18b160b69005c96d1c016e2eaa05419d6e5
|
4dfa6232cf91f1c04d50809915078dc71fb371b4
|
/src/core/include/megbrain/graph/symbol_var.h
|
ea819a5550657b02a1fb04aaf6c6e01c225a7661
|
[
"LicenseRef-scancode-generic-cla",
"Apache-2.0"
] |
permissive
|
hookex/MegEngine
|
81c0539a3247873bdabe0e6f22e265e22249e98a
|
47fd33880d2db3cae98c55911bb29328cdd5d7e4
|
refs/heads/master
| 2022-08-01T02:04:06.431689
| 2020-05-22T11:10:17
| 2020-05-22T11:10:17
| 250,200,281
| 1
| 0
|
NOASSERTION
| 2020-03-26T08:22:39
| 2020-03-26T08:22:39
| null |
UTF-8
|
C++
| false
| false
| 8,588
|
h
|
/**
* \file src/core/include/megbrain/graph/symbol_var.h
* MegEngine is Licensed under the Apache License, Version 2.0 (the "License")
*
* Copyright (c) 2014-2020 Megvii Inc. All rights reserved.
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT ARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*/
#pragma once
#include "megbrain/graph/var_node.h"
namespace mgb {
namespace cg {
/*!
* \brief Wrap a VarNode* for operator overloading
*/
class SymbolVar {
VarNode *m_node = nullptr;
public:
SymbolVar() = default;
SymbolVar(cg::VarNode *node): m_node(node)
{}
cg::VarNode* node() const {
return m_node;
}
DType dtype() const {
return m_node->dtype();
}
/*!
* \brief if the value is immutable and equals to some value at every
* position, return it
*
* Note: the shape may be larger than (1, )
*/
Maybe<DTypeScalar> as_immutable_scalar() const;
//! similar to as_immutable_scalar(), but also require shape to be (1, )
Maybe<DTypeScalar> as_immutable_scalar_require_shape() const;
/*!
* \brief insert an operation with signle output into underlying graph
* Implemented in graph/cg.h
*/
template<typename Node, typename ...Args>
inline SymbolVar insert_single_output_opr(Args&& ...args) const;
/*!
* \brief set a new name; note that the underlying VarNode would be
* modified, not this SymbolVar itself
*/
SymbolVar rename(const std::string &name) const;
SymbolVar reshape(const TensorShape &tshape) const;
SymbolVar reshape(SymbolVar tshape) const;
SymbolVar broadcast(const TensorShape &tshape) const;
SymbolVar broadcast(SymbolVar tshape) const;
SymbolVar symshape() const;
SymbolVar flatten() const;
const TensorShape& shape() const {
return m_node->shape();
}
TensorFormat format() const {
return m_node->format();
}
SymbolVar operator + (const SymbolVar &rhs) const;
SymbolVar operator - (const SymbolVar &rhs) const;
SymbolVar operator * (const SymbolVar &rhs) const;
SymbolVar operator / (const SymbolVar &rhs) const;
SymbolVar operator < (const SymbolVar &rhs) const;
SymbolVar operator <= (const SymbolVar &rhs) const;
SymbolVar operator > (const SymbolVar &rhs) const {
return rhs < *this;
}
SymbolVar operator - () const;
#define DEF_CT_OPR(_op) \
template<typename ctype> \
typename ctype_enable_if<ctype, SymbolVar>::type \
operator _op (ctype v) const { \
return *this _op make_scalar(v); \
}
DEF_CT_OPR(+)
DEF_CT_OPR(-)
DEF_CT_OPR(*)
DEF_CT_OPR(/)
DEF_CT_OPR(>)
DEF_CT_OPR(<)
DEF_CT_OPR(<=)
#undef DEF_CT_OPR
/*!
* \brief fill the tensor with a constant value, but retaining the dtype
*/
template<typename ctype>
typename ctype_enable_if<ctype, SymbolVar>::type
fill_retain_dtype(ctype val) const {
DTypeScalar dval{dtype()};
dval.set_retain_dtype(val);
return make_scalar(dval).broadcast(symshape());
}
/*!
* \brief make a const scalar value on given computing graph and
* computing node
*/
static SymbolVar make_scalar(
DTypeScalar value, ComputingGraph &cg, CompNode cn);
/*!
* \brief make a const scalar value using computing graph and comp node
* provided by this var
*/
SymbolVar make_scalar(DTypeScalar value) const {
return make_scalar(
value, *node()->owner_graph(), node()->comp_node());
}
/*!
* \brief make a scalar with given value and dtype of this symvar
*/
template<typename ctype>
typename ctype_enable_if<ctype, SymbolVar>::type
make_scalar_dt(ctype val) const {
DTypeScalar dval{dtype()};
dval.set_retain_dtype(val);
return make_scalar(dval);
}
/*!
* \brief get value in eager evaluation mode
*
* This essentially synchronizes the dispatch queue and then call
* dev_tensor()
*/
const DeviceTensorND& eager_eval_get_value() const;
bool allow_shape_change() const {
return m_node->allow_shape_change();
}
};
using SymbolVarArray = SmallVector<SymbolVar>;
class SymbolVarArrayView;
/*!
* \brief View SymbolVarArray or VarNodeArray as VarNode* list.
*
* This class is intended for passing a list of VarNode* in function parameters,
* so unnecessary copy/conversion between VarNodeArray and SymbolVarArray can be
* avoided.
*/
class VarNodeArrayView final : NonCopyableObj {
static_assert(sizeof(SymbolVar) == sizeof(VarNode*), "bad size");
static_assert(alignof(SymbolVar) == alignof(VarNode*), "bad align");
VarNode* const* m_begin = nullptr;
VarNode* const* m_end = nullptr;
void check_idx(size_t idx) const;
public:
VarNodeArrayView() = default;
VarNodeArrayView(const VarNodeArray& arr)
: m_begin{arr.data()}, m_end{m_begin + arr.size()} {}
VarNodeArrayView(const SymbolVarArray& arr)
: m_begin{reinterpret_cast<VarNode* const*>(arr.data())},
m_end{m_begin + arr.size()} {}
VarNodeArrayView(VarNode* const* begin, VarNode* const* end)
: m_begin{begin}, m_end{end} {}
template <size_t nr>
VarNodeArrayView(const std::array<SymbolVar, nr>& arr)
: m_begin{reinterpret_cast<VarNode* const*>(arr.data())},
m_end{m_begin + arr.size()} {}
inline explicit VarNodeArrayView(const SymbolVarArrayView& arr);
VarNodeArrayView(std::initializer_list<VarNode*> s)
: m_begin{s.begin()}, m_end{s.end()} {}
VarNodeArrayView(std::initializer_list<SymbolVar> s)
: m_begin{reinterpret_cast<VarNode* const*>(s.begin())},
m_end{m_begin + s.size()} {}
VarNode* operator[](size_t idx) const { return m_begin[idx]; }
VarNode* at(size_t idx) const {
check_idx(idx);
return m_begin[idx];
}
size_t size() const { return m_end - m_begin; }
bool empty() const { return m_begin == m_end; }
VarNode* const* begin() const { return m_begin; }
VarNode* const* end() const { return m_end; }
};
/*!
* \brief Similar to VarNodeArrayView, but accessors return SymbolVarArray
* instead.
*
* Note: Implicit conversion only works from VarNodeArrayView to
* SymbolVarArrayView. This is because the preferred use of SymbolVarArrayView
* is for easily accessing items as SymbolVar when the parameter type is
* VarNodeArrayView.
*/
class SymbolVarArrayView final : NonCopyableObj {
SymbolVar const* m_begin = nullptr;
SymbolVar const* m_end = nullptr;
void check_idx(size_t idx) const;
public:
SymbolVarArrayView(const VarNodeArrayView& arr)
: m_begin{reinterpret_cast<SymbolVar const*>(arr.begin())},
m_end{m_begin + arr.size()} {}
SymbolVarArrayView(std::initializer_list<SymbolVar> s)
: m_begin{s.begin()}, m_end{s.end()} {}
SymbolVar operator[](size_t idx) const { return m_begin[idx]; }
SymbolVar at(size_t idx) const {
check_idx(idx);
return m_begin[idx];
}
size_t size() const { return m_end - m_begin; }
bool empty() const { return m_begin == m_end; }
SymbolVar const* begin() const { return m_begin; }
SymbolVar const* end() const { return m_end; }
};
VarNodeArrayView::VarNodeArrayView(const SymbolVarArrayView& arr)
: m_begin{reinterpret_cast<VarNode* const*>(arr.begin())},
m_end{m_begin + arr.size()} {}
#define DEF_CT_OPR(_op) \
template<typename ctype> \
typename ctype_enable_if<ctype, SymbolVar>::type \
operator _op (ctype lhs, const SymbolVar &rhs) { \
return rhs.make_scalar(lhs) _op rhs; \
}
DEF_CT_OPR(+)
DEF_CT_OPR(-)
DEF_CT_OPR(*)
DEF_CT_OPR(/)
DEF_CT_OPR(>)
DEF_CT_OPR(<)
DEF_CT_OPR(<=)
#undef DEF_CT_OPR
} // namespace cg
} // namespace mgb
// vim: syntax=cpp.doxygen foldmethod=marker foldmarker=f{{{,f}}}
|
[
"megengine@megvii.com"
] |
megengine@megvii.com
|
bcefe3e2b64e0d7bb897e178e81e9d2b6b04df4d
|
09b7c4832d426944ff9637c07272cef0cea68b30
|
/src/interface/Fonts.hpp
|
fff0818241cd8bfb6d0a8f3f11d22d16ee7172e5
|
[] |
no_license
|
RFEphemeration/farb
|
4383b2f58e6d9b843a531506718c60cafd73b3f4
|
9178984ee2868bf55526100aada06044f1abad12
|
refs/heads/master
| 2023-05-26T11:35:08.318504
| 2020-12-19T00:36:43
| 2020-12-19T00:36:43
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 335
|
hpp
|
#ifndef FARB_FONTS_HPP
#define FARB_FONTS_HPP
#include "../core/BuiltinTypedefs.h"
#include "../core/NamedType.hpp"
namespace Farb
{
namespace UI
{
NAMED_TYPE_TAG(FontName);
using FontName = NamedType<std::string, FontNameTag>;
//NAMED_TYPE(std::string, FontName);
} // namespace UI
} // namespace Farb
#endif // FARB_FONTS_HPP
|
[
"robinson.farrar@gmail.com"
] |
robinson.farrar@gmail.com
|
b4a09a4edb7940f081cc5de1d1099c81c3904383
|
ab40ea169e25f47725596f7c699fd60ac998dd18
|
/lib/Cm/BtSet.cc
|
cf17711af783863ce78df39dca4f98553bd9aeaf
|
[] |
no_license
|
weiyj/v6eval-3.3.2-linux
|
6530b7feac13acf253f819e9edebc12535527e54
|
e63b2e8bbbd333ff3417e8a549a9e3a171e3c4ea
|
refs/heads/master
| 2021-01-10T20:36:28.556490
| 2010-04-02T17:22:18
| 2012-03-09T02:23:25
| 9,726,015
| 1
| 1
| null | null | null | null |
ISO-8859-7
|
C++
| false
| false
| 5,092
|
cc
|
/*
* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
* Yokogawa Electric Corporation, YDC Corporation,
* IPA (Information-technology Promotion Agency, Japan).
* All rights reserved.
*
* Redistribution and use of this software in source and binary forms, with
* or without modification, are permitted provided that the following
* conditions and disclaimer are agreed and accepted by the user:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* 3. Neither the names of the copyrighters, the name of the project which
* is related to this software (hereinafter referred to as "project") nor
* the names of the contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* 4. No merchantable use may be permitted without prior written
* notification to the copyrighters. However, using this software for the
* purpose of testing or evaluating any products including merchantable
* products may be permitted without any notification to the copyrighters.
*
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHTERS, THE PROJECT AND
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING
* BUT NOT LIMITED THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE, ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHTERS, THE PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT,STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*
* $TAHI: v6eval/lib/Cm/BtSet.cc,v 1.6 2001/10/12 04:56:13 tanaka Exp $
*/
#include "BtSet.h"
//IMPLEMENTATION
const u_long noObjectEntry=0xffffffff;
u_long BtSet::noOfElements() const {return noOfElements_;}
u_long BtSet::size() const {return capacity();}
BtSet::~BtSet() {noOfElements_=0;}
BtSet& BtSet::operator=(const BtSet& s) {
return (BtSet&)BtArray::operator=(s);}
BtSet::BtSet(u_long s):BtArray(s>1?s*2:2),noOfElements_(0) {}
BtSet::BtSet(const BtSet &a):BtArray(a.capacity()),noOfElements_(0) {
*this=a;}
BtSet::BtSet(ELEMENTS elm,...):BtArray(defaultArraySize*2),noOfElements_(0) {
addElementsFrom(elm);}
uint32_t BtSet::hashElement(const ELEMENTS o) const {
u_long x=(long)o;
return x;}
bool BtSet::isSame(const ELEMENTS a,const ELEMENTS b) const {
return a==b;}
ELEMENTS BtSet::findAt(const ELEMENTS o,u_long& s) const {
s=noObjectEntry;
u_long size=capacity(), u;
if(size==0) return 0;
u_long hash=hashElement(o);
ELEMENTS* top=elements();
ELEMENTS* end=top+size;
ELEMENTS* p;
for(p=top+(hash%size),u=size;u>0;p++,u--) {
ELEMENTS c;
if(p>=end) {p=top;}
if(((c=*p)==0) || isSame(c,o)) {
s=p-top; return c;}}
return 0;}
void BtSet::rehash(u_long at) {
u_long size=capacity(), u, i;
ELEMENTS* top=elements();
for(i=at+1,u=size-1;u>0;i++,u--) {
if(i>=size) {i=0;}
ELEMENTS o=top[i];
if(o==0) return; /* ΙΤΟ’Β³ */
u_long hash=hashElement(o)%size;
if((at<i)?(hash<=at||i<hash):(i<hash&&hash<=at)) {
top[at]=o; top[i]=0; at=i;}}}
ELEMENTS BtSet::addIfAbsent(ELEMENTS o,u_long& s) {
u_long c=capacity();
u_long n=noOfElements();
if(n*3>c*2) expand();
ELEMENTS old=findAt(o,s);
u_long u=s;
if(old==0&&u!=noObjectEntry) {
noOfElements_++; atPut(u,o);
return o;}
return old;}
//----------------------------------------------------------------------
// ADDED: o
// EXIST: 0
ELEMENTS BtSet::add(ELEMENTS o) {
u_long n;
if(o==0) return 0;
ELEMENTS add=addIfAbsent(o,n);
return add==o?o:0;}
//----------------------------------------------------------------------
// ADDED: add
// EXIST: delete o and return old
ELEMENTS BtSet::filter(ELEMENTS o) {
u_long n;
if(o==0) return 0;
ELEMENTS add=addIfAbsent(o,n);
if(add!=0 && add!=o) {
deleteElement(o); return add;}
return add;}
//----------------------------------------------------------------------
// REPLACED: old
// ADDED: 0
// NOT ADDED: 0
ELEMENTS BtSet::replace(ELEMENTS o) {
u_long n;
if(o==0) return 0;
ELEMENTS add=addIfAbsent(o,n);
if(add!=0) {
if(add!=o) {atPut(n,o);}
return add==o?0:add;}
return 0;}
ELEMENTS BtSet::remove(const ELEMENTS o) {
u_long n;
ELEMENTS old=findAt(o,n);
if(old==0) return 0;
removeAt(n); noOfElements_--;
rehash(n);
return old;}
void BtSet::expand() {
noOfElements_=0;
BtArray::expand();}
void BtSet::deleteContents() {
BtArray::deleteContents();
noOfElements_=0;}
|
[
"weiyj.lk@gmail.com"
] |
weiyj.lk@gmail.com
|
90092ccf0306cd1521e1d0b31e6f6d1cc0b10fb1
|
c30d569807cb17258e06652985499d11cc3110c6
|
/test.cpp
|
598e38fc58eddfe71be38e5793636faa55634177
|
[] |
no_license
|
lialan/runtime_template
|
988fd0b7186481a19ea3527fa11b0b01395a9c8d
|
01ba89691bc80e609ec767fc53e7040603fe516f
|
refs/heads/master
| 2023-08-18T21:55:59.150456
| 2021-10-23T03:22:40
| 2021-10-23T03:22:40
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 2,678
|
cpp
|
#include <iostream>
#include <sstream>
#include <fstream>
#include <fmt/core.h>
#include <dlfcn.h>
#include <vector>
static void gen_source_code(std::string t1, std::string t2, std::string file) {
std::cout << "Generating library function source code:" << std::endl;
std::ifstream header_file;
header_file.open("./header.inc");
std::stringstream ss;
ss << header_file.rdbuf();
// manually generate a wrapper function(number of arguments must match):
ss << fmt::format("extern \"C\" void foowrapper({0} *a, {1} *b)", t1, t2) << std::endl;
ss << "{" << std::endl;
ss << fmt::format(" foo<{0}, {1}>(a, b);", t1, t2) << std::endl;
ss << "}" << std::endl << std::endl;
std::cout << ss.str() << std::endl;
std::ofstream out(file);
out << ss.str();
out.close();
}
static void gen_dylib(std::string infile, std::string outfile) {
std::cout << "compiling to library." << std::endl;
std::system(fmt::format("c++ -g -shared -fPIC -o {0} {1}", outfile, infile).c_str());
}
static void *load_dylib(std::string sofile) {
std::cout << "trying to load library." << std::endl;
void *handle = dlopen(sofile.c_str(), RTLD_NOW);
if (!handle) {
std::cerr << "Cannot open library: " << dlerror() << '\n';
abort();
}
std::cout << "Successfully loaded library.\n" << std::endl;
return handle;
}
// args are pointer to some types.
void* specialize_template(std::vector<std::string> arg_types) {
std::string source_file = "/tmp/template.cc";
std::string dylib_file = "/tmp/templatelib.so";
gen_source_code(arg_types[0], arg_types[1], source_file);
gen_dylib(source_file, dylib_file);
return load_dylib(dylib_file);
}
// here args are of the type indicated in the template specialization parameters.
// but we erased args type info because we do not know it until runtime.
// this is for codegen.
void call_dylib(void* handle, std::string name, char *args[]) {
dlerror();
using wrapper_t = void (*)(void*, void*);
// find symbol entry:
wrapper_t wrapper_ptr = (wrapper_t)(dlsym(handle, "foowrapper"));
const char* dlsym_error = dlerror();
if (dlsym_error) {
std::cout << "failed to load symbol (" << "foowrapper" << ")" << std::endl;
dlclose(handle);
abort();
}
wrapper_ptr((void*)(args[0]), (void*)(args[1]));
}
int main(int argc, char *argv[]) {
std::string t1(argv[1]);
std::string t2(argv[2]);
void* template_dylib = specialize_template({t1, t2});
int a = 10;
float b = 20.00;
char* args[2]; // ugly but it shows the idea.
args[0] = reinterpret_cast<char*>(&a);
args[1] = reinterpret_cast<char*>(&b);
call_dylib(template_dylib, "foowrapper", args);
return 0;
}
|
[
"alan.li@me.com"
] |
alan.li@me.com
|
dea0822bdf8a8aeb48e0e41742f0e1886d900c55
|
ef5504db423f7b0258d8bdefacb12236d76f2bb6
|
/src/vbh/sdk/plugin/vbh_crypt_client_service/vbh_crypt_client_service.cpp
|
ccf443d041a8fa62d910fe557f968df87fdd1793
|
[] |
no_license
|
tafchain/vprotocol
|
cc0fc6f7453072a6941af761bb79f1a33dca6127
|
bd2b5b83046d8af7746617a130fb56be230ce4cc
|
refs/heads/master
| 2023-06-02T12:44:19.228025
| 2021-06-17T07:49:42
| 2021-06-17T07:49:42
| 377,747,826
| 0
| 0
| null | null | null | null |
GB18030
|
C++
| false
| false
| 59,831
|
cpp
|
#include "dsc/mem_mng/dsc_allocator.h"
#include "dsc/configure/dsc_configure.h"
#include "common/vbh_comm_error_code.h"
#include "common/vbh_comm_msg_def.h"
#include "common/vbh_comm_wrap_msg_def.h"
#include "common/vbh_comm_func.h"
#include "common/vbh_encrypt_lib.h"
#include "vbh_crypt_client_service/vbh_crypt_client_service.h"
CVbhCryptClientService::IBaseSession::IBaseSession(CVbhCryptClientService& rRegistUserService)
: m_rClientBaseService(rRegistUserService)
{
}
CVbhCryptClientService::CRegistUserSession::CRegistUserSession(CVbhCryptClientService& rClientBaseService)
: IBaseSession(rClientBaseService)
{
}
CVbhCryptClientService::CProposeSession::CProposeSession(CVbhCryptClientService& rRegistUserService)
: IBaseSession(rRegistUserService)
{
}
CVbhCryptClientService::CQueryUserSession::CQueryUserSession(CVbhCryptClientService& rRegistUserService)
: IBaseSession(rRegistUserService)
{
}
CVbhCryptClientService::CQueryTransactionSession::CQueryTransactionSession(CVbhCryptClientService& rRegistUserService)
: IBaseSession(rRegistUserService)
{
}
ACE_INT32 CVbhCryptClientService::OnInit(void)
{
if (CDscHtsClientService::OnInit())
{
DSC_RUN_LOG_ERROR("bc user client service init failed!");
return -1;
}
if (this->LoadPeerInfo())
{
DSC_RUN_LOG_WARNING("load bc kernel addr info failed");
return -1;
}
//读取背书节点个数// TODO:将来会有一个详细的背书策略数据库需要读取
if (VBH::GetVbhProfileInt("ENDORSE_PEER_COUNT", m_nEndorsePeerCount))
{
DSC_RUN_LOG_WARNING("cann't read 'ENDORSE_PEER_COUNT' configure item value");
return -1;
}
if (m_nEndorsePeerCount <= 0)
{
DSC_RUN_LOG_WARNING("'ENDORSE_PEER_COUNT' [%d] cann't be zero or negative value", m_nEndorsePeerCount);
return -1;
}
//读取peer的公钥,用于非对称加密通信
if (VBH::GetVbhProfileString("PEER_PUBLIC_KEY", m_peerPublicKey))
{
DSC_RUN_LOG_WARNING("cann't read 'PEER_PUBLIC_KEY' configure item value");
return -1;
}
if (m_peerPublicKey.empty())
{
DSC_RUN_LOG_WARNING("'PEER_PUBLIC_KEY' cann't be empty");
return -1;
}
ACE_OS::srand(ACE_OS::time(0));
for (auto peer_it = m_lstBcPeer.begin(); peer_it != m_lstBcPeer.end(); ++peer_it)
{
CVbhPeer& rPeer = *peer_it;
for (auto svr_it = rPeer.m_lstEndorserAddr.begin(); svr_it != rPeer.m_lstEndorserAddr.end(); ++svr_it)
{
CEndorserAddr& bcServer = *svr_it;
PROT_COMM::CDscIpAddr remoteAddr(bcServer.m_strIpAddr, bcServer.m_nPort);
this->DoConnect(remoteAddr, NULL, bcServer.m_nHandleID);
}
}
return 0;
}
ACE_INT32 CVbhCryptClientService::OnExit(void)
{
CHandleSession* pHandleSession;
for (auto it = m_mapHandleSession.begin(); it != m_mapHandleSession.end();)
{
pHandleSession = it.second;
++it;
DSC_THREAD_TYPE_DEALLOCATE(pHandleSession);
}
CRegistUserSession* pRegistUserSession;
for (auto it = m_mapRegistUserSession.begin(); it != m_mapRegistUserSession.end();)
{
pRegistUserSession = it.second;
this->CancelDscTimer(pRegistUserSession);
++it;
DSC_THREAD_TYPE_DEALLOCATE(pRegistUserSession);
}
CUnRegistUserSession* pUnRegistUserSession;
for (auto it = m_mapUnRegistUserSession.begin(); it != m_mapUnRegistUserSession.end();)
{
pUnRegistUserSession = it.second;
this->CancelDscTimer(pUnRegistUserSession);
++it;
DSC_THREAD_TYPE_DEALLOCATE(pUnRegistUserSession);
}
CQueryUserSession* pQueryUserSession;
for (auto it = m_mapQueryUserSession.begin(); it != m_mapQueryUserSession.end();)
{
pQueryUserSession = it.second;
this->CancelDscTimer(pQueryUserSession);
++it;
DSC_THREAD_TYPE_DEALLOCATE(pQueryUserSession);
}
CProposeSession* pLaunchTransSession;
for (auto it = m_mapProposeSession.begin(); it != m_mapProposeSession.end();)
{
pLaunchTransSession = it.second;
this->CancelDscTimer(pLaunchTransSession);
++it;
DSC_THREAD_TYPE_DEALLOCATE(pLaunchTransSession);
}
for (ACE_UINT32 i = 0; i < m_vbhPeerConnSumInfo.m_nPeerSessionNum; ++i)
{
CVbhPeerConnectionInfo& rPeerSession = m_vbhPeerConnSumInfo.m_parrPeerConnInfo[i];
DSC_DELETE_ARRAY(rPeerSession.m_ppMcpHandler);
}
DSC_DELETE_ARRAY(m_vbhPeerConnSumInfo.m_parrPeerConnInfo);
if (m_pCallback)
{
m_pCallback->OnExit();
}
return CDscHtsClientService::OnExit();
}
void CVbhCryptClientService::OnRegistUserResponse(ACE_INT32 nReturnCode, CRegistUserSession* pRegistUserSession, DSC::CDscBlob& genUserKey)
{
DSC::CDscBlob userKey(pRegistUserSession->m_userKey.data(), pRegistUserSession->m_userKey.size());
DSC::CDscBlob cryptUserKey(pRegistUserSession->m_encodedClientCryptKey.data(), pRegistUserSession->m_encodedClientCryptKey.size());
this->OnRegistUserRsp(nReturnCode, pRegistUserSession->m_nChannelID, userKey, cryptUserKey, genUserKey);
}
void CVbhCryptClientService::OnRelease(CRegistUserSession* pRegistUserSession)
{
//从所有的背书 handle-session中删除本 regist-user-session
CHandleSession* pHandleSession;
for (ACE_UINT32 idx = 0; idx < pRegistUserSession->m_arrHandleSession.Size(); ++idx)
{
pHandleSession = pRegistUserSession->m_arrHandleSession[idx];
pHandleSession->m_arrSession.Erase(pRegistUserSession);
}
DSC_THREAD_TYPE_DELETE(pRegistUserSession);
}
void CVbhCryptClientService::OnTimeOut(CRegistUserSession* pRegistUserSession)
{
m_mapRegistUserSession.Erase(pRegistUserSession);
if (pRegistUserSession->m_bCompleteRegistRsp) //已经完成应答,等待事务完成后的最终通知
{
}
else //没有完成背书,还在第一阶段
{
DSC::CDscBlob genUserKey;
OnRegistUserResponse(VBH::EN_TIMEOUT_ERROR_TYPE, pRegistUserSession, genUserKey);
}
OnRelease(pRegistUserSession);
}
void CVbhCryptClientService::OnNetError(CRegistUserSession* pRegistUserSession)
{
this->CancelDscTimer(pRegistUserSession);
m_mapRegistUserSession.Erase(pRegistUserSession);
if (pRegistUserSession->m_bCompleteRegistRsp) //已经完成应答,等待事务完成后的最终通知
{
}
else //没有完成背书,还在第一阶段
{
DSC::CDscBlob genUserKey;
OnRegistUserResponse(VBH::EN_NETWORK_ERROR_TYPE, pRegistUserSession, genUserKey);
}
OnRelease(pRegistUserSession);
}
void CVbhCryptClientService::OnProposeResponse(const ACE_INT32 nReturnCode, CProposeSession* pProposeSession, const ACE_UINT16 nOrderID, const ACE_UINT32 nSequenceNumber,
const ACE_UINT32 nTransIdx, const ACE_UINT64 nBlockID, DSC::CDscShortList<VBH::CConciseOnCreateInformationKey>& lstCreatedInfoKey)
{
DSC::CDscBlob userKey(pProposeSession->m_userKey.data(), pProposeSession->m_userKey.size());
DSC::CDscBlob blobTransKey;
VBH::COrderGenerateTransactionKey transKey;
DSC::CDscShortList<VBH::COnCreateKey> lstOnCreateKey;
char* pTransKey;
size_t nTransKeyLen;
transKey.m_nOrderID = nOrderID;
transKey.m_nSequenceNumber = nSequenceNumber;
transKey.m_nTransIdx = nTransIdx;
transKey.m_nBlockID = nBlockID;
DEF_ENCODE(transKey, pTransKey, nTransKeyLen);
blobTransKey.Set(pTransKey, nTransKeyLen);
this->OnProposeRsp(nReturnCode, pProposeSession->m_nChannelID, userKey, blobTransKey);
}
void CVbhCryptClientService::OnRelease(CProposeSession* pProposeSession)
{
//从所有的背书 handle-session中删除本 propose-session
CHandleSession* pHandleSession;
for (ACE_UINT32 idx = 0; idx < pProposeSession->m_arrHandleSession.Size(); ++idx)
{
pHandleSession = pProposeSession->m_arrHandleSession[idx];
pHandleSession->m_arrSession.Erase(pProposeSession);
}
DSC_THREAD_TYPE_DEALLOCATE(pProposeSession);
}
void CVbhCryptClientService::OnTimeOut(CProposeSession* pProposeSession)
{
m_mapProposeSession.Erase(pProposeSession);
if (pProposeSession->m_bCompleteRegistRsp)
{
}
else
{
OnProposeResponse(VBH::EN_TIMEOUT_ERROR_TYPE, pProposeSession, 0, 0, 0, 0, lstCreatedInfoKey);
this->OnProposeRsp(nReturnCode, pProposeSession->m_nChannelID, userKey, blobTransKey);
}
OnRelease(pProposeSession);
}
void CVbhCryptClientService::OnNetError(CProposeSession* pProposeSession)
{
this->CancelDscTimer(pProposeSession);
m_mapProposeSession.Erase(pProposeSession);
if (pProposeSession->m_bCompleteRegistRsp)
{
}
else
{
DSC::CDscShortList<VBH::CConciseOnCreateInformationKey> lstCreatedInfoKey;
OnProposeResponse(VBH::EN_NETWORK_ERROR_TYPE, pProposeSession, 0, 0, 0, 0, lstCreatedInfoKey);
}
OnRelease(pProposeSession);
}
void CVbhCryptClientService::OnRelease(CQueryUserSession* pQueryUserSession, ACE_INT32 nReturnCode, DSC::CDscBlob& userInfo)
{
DSC::CDscBlob userKey(pQueryUserSession->m_userKey.data(), pQueryUserSession->m_userKey.size());
this->OnGetUserInfoRsp(nReturnCode, pQueryUserSession->m_nChannelID, userKey, userInfo);
pQueryUserSession->m_pHandleSession->m_arrSession.Erase(pQueryUserSession);
DSC_THREAD_TYPE_DEALLOCATE(pQueryUserSession);
}
void CVbhCryptClientService::OnTimeOut(CQueryUserSession* pQueryUserSession)
{
this->CancelDscTimer(pQueryUserSession);
m_mapQueryUserSession.Erase(pQueryUserSession);
DSC::CDscBlob userInfo;
OnRelease(pQueryUserSession, VBH::EN_TIMEOUT_ERROR_TYPE, userInfo);
}
void CVbhCryptClientService::OnNetError(CQueryUserSession* pQueryUserSession)
{
DSC::CDscBlob userInfo;
this->CancelDscTimer(pQueryUserSession);
m_mapQueryUserSession.Erase(pQueryUserSession);
OnRelease(pQueryUserSession, VBH::EN_NETWORK_ERROR_TYPE, userInfo);
}
void CVbhCryptClientService::OnRelease(CQueryTransactionSession* pQueryTransSession, ACE_INT32 nReturnCode, DSC::CDscBlob& transInfo)
{
DSC::CDscBlob transKey(pQueryTransSession->m_transKey.data(), pQueryTransSession->m_transKey.size());
DSC::CDscBlob userKey(pQueryTransSession->m_userKey.data(), pQueryTransSession->m_userKey.size());
OnGetTransInfoRsp(nReturnCode, pQueryTransSession->m_nChannelID, userKey, transKey, transInfo);
pQueryTransSession->m_pHandleSession->m_arrSession.Erase(pQueryTransSession);
DSC_THREAD_TYPE_DEALLOCATE(pQueryTransSession);
}
void CVbhCryptClientService::OnTimeOut(CQueryTransactionSession* pQueryTransSession)
{
DSC::CDscBlob transInfo;
m_mapQueryTransSession.Erase(pQueryTransSession);
OnRelease(pQueryTransSession, VBH::EN_TIMEOUT_ERROR_TYPE, transInfo);
}
void CVbhCryptClientService::OnNetError(CQueryTransactionSession* pQueryTransSession)
{
DSC::CDscBlob transInfo;
this->CancelDscTimer(pQueryTransSession);
m_mapQueryTransSession.Erase(pQueryTransSession);
OnRelease(pQueryTransSession, VBH::EN_NETWORK_ERROR_TYPE, transInfo);
}
ACE_INT32 CVbhCryptClientService::OnHtsMsg(VBH::CCryptRegistUserEsCltRsp& rRegistUserRsp, CMcpHandler* pMcpHandler)
{
CRegistUserSession* pRegistUserSession = m_mapRegistUserSession.Find(rRegistUserRsp.m_nCltSessionID);
//1.找session
if (pRegistUserSession)
{
ACE_INT32 nReturnCode = rRegistUserRsp.m_nReturnCode;
if (nReturnCode == VBH::EN_OK_TYPE)
{
//2.解密、解码
int nDecryptBufLen;
char* pDecryptBuf = VBH::vbhDecrypt((unsigned char*)m_peerEnvelopeKey.data(), nDecryptBufLen, rRegistUserRsp.m_userData.GetBuffer(), rRegistUserRsp.m_userData.GetSize());
if (pDecryptBuf)
{
bool bAllowRegist;
DSC::CDscBlob userInitInfo;
DSC::CDscBlob nonce;
DSC::CDscBlob svrPubKey;
DSC::CDscBlob cltPriKey;
DSC::CDscBlob envelopeKey;
VBH::CCryptRegistUserEsCltRspDataWrapper wrapper(bAllowRegist, userInitInfo, nonce, svrPubKey, cltPriKey, envelopeKey);
if (DSC::Decode(wrapper, pDecryptBuf, nDecryptBufLen))
{
DSC_RUN_LOG_ERROR("decode error.");
nReturnCode = VBH::EN_DECODE_ERROR_TYPE;
}
else
{
if (VBH::IsEqual(pRegistUserSession->m_strNonce, nonce))
{
if (bAllowRegist) //同意创建
{
//3.背书
if (pRegistUserSession->m_ccGenerateUserInfo.empty()) //初次收到应答
{
VBH::Assign(pRegistUserSession->m_ccGenerateUserInfo, userInitInfo);
++pRegistUserSession->m_nSucceedRspNum;
}
else//第N次收到应答 N>1
{
if (VBH::IsEqual(pRegistUserSession->m_ccGenerateUserInfo, userInitInfo))
{
++pRegistUserSession->m_nSucceedRspNum;
}
else
{
DSC_RUN_LOG_ERROR("endorse failed.");
nReturnCode = VBH::EN_SYSTEM_ERROR_TYPE;
}
}
//是选中的endorser节点发送的应答
if ((nReturnCode == VBH::EN_OK_TYPE) && (pMcpHandler == pRegistUserSession->m_pSubmitEsMcpHandleSession->m_pMcpHandler))
{
pRegistUserSession->m_nEsSessionID = rRegistUserRsp.m_nEsSessionID; //endorser session-id
//4.生成秘钥文件
if (VBH::EncodeClientCryptKey(pRegistUserSession->m_encodedClientCryptKey, svrPubKey, cltPriKey, envelopeKey))
{
DSC_RUN_LOG_ERROR("encode client crypt key error.");
nReturnCode = VBH::EN_SYSTEM_ERROR_TYPE;
}
}
//TODO: 背书策略或许会调整
if ((nReturnCode == VBH::EN_OK_TYPE) && (pRegistUserSession->m_nSucceedRspNum >= m_nEndorsePeerCount)) //背书通过
{
//组织回应答(再次提交注册事务)
int nEncryptBufLen;
char* pEncryptBuf = VBH::vbhEncrypt((unsigned char*)m_peerEnvelopeKey.data(), nEncryptBufLen,
pRegistUserSession->m_strNonce.data(), pRegistUserSession->m_strNonce.size());
if (DSC_LIKELY(pEncryptBuf))
{
//5.向服务端提交
VBH::CCryptSubmitRegistTransactionCltEsReq req;
req.m_nEsSessionID = pRegistUserSession->m_nEsSessionID;
req.m_userData.Set(pEncryptBuf, nEncryptBufLen);
if (DSC_UNLIKELY(this->SendHtsMsg(req, pRegistUserSession->m_pSubmitEsMcpHandleSession->m_pMcpHandler)))
{
DSC_RUN_LOG_ERROR("send hts msg failed.");
nReturnCode = VBH::EN_NETWORK_ERROR_TYPE;
}
DSC_THREAD_FREE(pEncryptBuf);
}
else
{
DSC_RUN_LOG_ERROR("encrypt error.");
nReturnCode = VBH::EN_ENCRYPT_ERROR_TYPE;
}
}
else
{
//不用处理
}
}
else //拒绝创建
{
DSC_RUN_LOG_INFO("regist user is denied by peer:%d", GetPeerID(pMcpHandler->GetHandleID()));
nReturnCode = VBH::EN_REGIST_USER_IS_REFUSED;
}
}
else
{
DSC_RUN_LOG_WARNING("nonce is error.");
nReturnCode = VBH::EN_NONCE_VERIFY_ERROR_TYPE;
}
}
DSC_THREAD_FREE(pDecryptBuf);
}
else
{
DSC_RUN_LOG_ERROR("decrypt error.");
nReturnCode = VBH::EN_DECRYPT_ERROR_TYPE;
}
}
else
{
DSC_RUN_LOG_INFO("regist user rsp return failed, error code:%d, channelID:%d", rRegistUserRsp.m_nReturnCode, pRegistUserSession->m_nChannelID);
}
if (nReturnCode != VBH::EN_OK_TYPE)
{
//出错后,向选中的提交节点发送取消事务的消息//网络出错就不再发送
if (nReturnCode != VBH::EN_NETWORK_ERROR_TYPE)
{
VBH::CCryptCancelRegistUserCltEsReq req;
int nEncryptBufLen;
char* pEncryptBuf = VBH::vbhEncrypt((unsigned char*)m_peerEnvelopeKey.data(), nEncryptBufLen,
pRegistUserSession->m_strNonce.data(), pRegistUserSession->m_strNonce.size());
if (pEncryptBuf)
{
req.m_nEsSessionID = pRegistUserSession->m_nEsSessionID;
req.m_userData.Set(pEncryptBuf, nEncryptBufLen);
this->SendHtsMsg(req, pRegistUserSession->m_pSubmitEsMcpHandleSession->m_pMcpHandler);
DSC_THREAD_FREE(pEncryptBuf);
}
else
{
DSC_RUN_LOG_ERROR("encrypt error.");
}
}
//向客户端上层业务应答,//删除session
DSC::CDscBlob genUserKey;
this->CancelDscTimer(pRegistUserSession);
m_mapRegistUserSession.Erase(pRegistUserSession);
OnRegistUserResponse(nReturnCode, pRegistUserSession, genUserKey);
OnRelease(pRegistUserSession); //删除session
}
}
else
{
DSC_RUN_LOG_ERROR("can not find session, session-id:%d", pRegistUserSession->m_nCltSessionID);
}
return 0;
}
ACE_INT32 CVbhCryptClientService::OnHtsMsg(VBH::CCryptSubmitRegistTransactionEsCltRsp& rSubmitTransRsp, CMcpHandler* pMcpHandler)
{
CRegistUserSession* pRegistUserSession = m_mapRegistUserSession.Find(rSubmitTransRsp.m_nCltSessionID);
if (pRegistUserSession)
{
ACE_INT32 nReturnCode = rSubmitTransRsp.m_nReturnCode;
if (nReturnCode == VBH::EN_OK_TYPE)
{
//1. 解密数据
int nDecryptBufLen;
char* pDecryptBuf = VBH::vbhDecrypt((unsigned char*)pRegistUserSession->m_envelopeKey.data(), nDecryptBufLen,
rSubmitTransRsp.m_userData.GetBuffer(), rSubmitTransRsp.m_userData.GetSize());
if (DSC_LIKELY(pDecryptBuf))
{
VBH::COrderGenerateKey orderGenKey;
DSC::CDscBlob nonce;
VBH::CCryptSubmitRegistTransactionEsCltRspDataWrapper wrapper(orderGenKey, nonce);
//2. 解码解密后的数据,得到应答实际内容
if (DSC::Decode(wrapper, pDecryptBuf, nDecryptBufLen))
{
nReturnCode = VBH::EN_DECODE_ERROR_TYPE;
DSC_RUN_LOG_INFO("decode error.");
}
else
{
//3. 校验nonce
if (VBH::IsEqual(pRegistUserSession->m_strNonce, nonce))
{
DSC::CDscBlob genUserKey;
char* pGenUserKey;
size_t nGenUserKeyLen;
DEF_ENCODE(orderGenKey, pGenUserKey, nGenUserKeyLen);
genUserKey.Set(pGenUserKey, nGenUserKeyLen);
//返回给用户应答
this->OnRegistUserResponse(nReturnCode, pRegistUserSession, genUserKey);
if (pRegistUserSession->m_bWaitNotify)//如果客户等待通知,则重置定时器,
{
this->ResetDscTimer(pRegistUserSession, EN_SESSION_WAIT_NOTIFY_TIMEOUT_VALUE);
pRegistUserSession->m_bCompleteRegistRsp = true;
}
else //客户不等待通知,则 ,删除session
{
this->CancelDscTimer(pRegistUserSession);
m_mapRegistUserSession.Erase(pRegistUserSession);
this->OnRelease(pRegistUserSession);
}
}
else
{
nReturnCode = VBH::EN_NONCE_VERIFY_ERROR_TYPE;
DSC_RUN_LOG_INFO("verify nonce failed.");
}
}
DSC_THREAD_FREE(pDecryptBuf);
}
else
{
nReturnCode = VBH::EN_DECRYPT_ERROR_TYPE;
DSC_RUN_LOG_INFO("decrypt_error");
}
}
else
{
DSC_RUN_LOG_INFO("submit regist transaction rsp return failed, error code:%d, channelID:%d", rSubmitTransRsp.m_nReturnCode, pRegistUserSession->m_nChannelID);
}
}
else
{
DSC_RUN_LOG_WARNING("can not find regist session, session-id:%d", rSubmitTransRsp.m_nCltSessionID);
}
return 0;
}
ACE_INT32 CVbhCryptClientService::OnHtsMsg(VBH::CCryptUnRegistUserRsp& rUnRegistUserRsp, CMcpHandler* pMcpHandler)
{
return 0;
}
ACE_INT32 CVbhCryptClientService::OnHtsMsg(VBH::CCryptSubmitProposalEsCltRsp& rSubmitProposalRsp, CMcpHandler* pMcpHandler)
{
CProposeSession* pProposeSession = m_mapProposeSession.Find(rSubmitProposalRsp.m_nCltSessionID);
if (DSC_UNLIKELY(NULL == pProposeSession))
{
DSC_RUN_LOG_WARNING("submit proposal rsp timeout");
}
else
{
ACE_INT32 nReturnCode = rSubmitProposalRsp.m_nReturnCode;
if (DSC_LIKELY(nReturnCode == VBH::EN_OK_TYPE))
{
int nDecryptBufLen;
char* pDecryptBuf = VBH::vbhDecrypt((unsigned char*)pProposeSession->m_envelopeKey.data(), nDecryptBufLen, rSubmitProposalRsp.m_userData.GetBuffer(), rSubmitProposalRsp.m_userData.GetSize());
if (DSC_LIKELY(pDecryptBuf))
{
DSC::CDscBlob transContent; //事务内容, 参与背书
DSC::CDscBlob nonce;
VBH::CCryptSubmitProposalEsCltRspDataWrapper userData(transContent, nonce);
if (DSC_UNLIKELY(DSC::Decode(userData, pDecryptBuf, nDecryptBufLen)))
{
DSC_RUN_LOG_ERROR("decode error.");
nReturnCode = VBH::EN_DECODE_ERROR_TYPE;
}
else
{
if (VBH::IsEqual(pProposeSession->m_strNonce, nonce))
{
if (pProposeSession->m_transContent.empty())
{
VBH::Assign(pProposeSession->m_transContent, transContent);
++pProposeSession->m_nSucceedRspNum;
}
else
{
if (pProposeSession->m_transContent.IsEqual(transContent.GetBuffer(), transContent.GetSize()))
{
++pProposeSession->m_nSucceedRspNum;
}
else
{
DSC_RUN_LOG_ERROR("endorse failed.");
nReturnCode = VBH::EN_SYSTEM_ERROR_TYPE;
}
}
//是选中的节点发送的应答
if ((nReturnCode == VBH::EN_OK_TYPE) && (pMcpHandler == pProposeSession->m_pSubmitEsMcpHandleSession->m_pMcpHandler))
{
pProposeSession->m_nEsSessionID = rSubmitProposalRsp.m_nEsSessionID; //记录endorser session-id
}
//TODO: 背书策略或许会调整
if (pProposeSession->m_nSucceedRspNum >= m_nEndorsePeerCount)
{
int nEncryptBufLen;
char* pEncryptBuf = VBH::vbhEncrypt((unsigned char*)pProposeSession->m_envelopeKey.data(), nEncryptBufLen,
pProposeSession->m_strNonce.data(), pProposeSession->m_strNonce.size());
if (DSC_LIKELY(pEncryptBuf))
{
VBH::CCryptSubmitProposalTransactionCltEsReq req;
req.m_nEsSessionID = pProposeSession->m_nEsSessionID;
req.m_userData.Set(pEncryptBuf, nEncryptBufLen);
if (DSC_UNLIKELY(this->SendHtsMsg(req, pProposeSession->m_pSubmitEsMcpHandleSession->m_pMcpHandler)))
{
DSC_RUN_LOG_ERROR("send hts msg failed.");
nReturnCode = VBH::EN_NETWORK_ERROR_TYPE;
}
DSC_THREAD_FREE(pEncryptBuf);
}
else
{
DSC_RUN_LOG_ERROR("encrypt error.");
nReturnCode = VBH::EN_ENCRYPT_ERROR_TYPE;
}
}
else
{
//无需处理,再等下一应答消息
}
}
else
{
DSC_RUN_LOG_WARNING("nonce is error.");
nReturnCode = VBH::EN_NONCE_VERIFY_ERROR_TYPE;
}
}
DSC_THREAD_FREE(pDecryptBuf);
}
else
{
DSC_RUN_LOG_ERROR("decrypt error.");
nReturnCode = VBH::EN_DECRYPT_ERROR_TYPE;
}
}
else
{
DSC_RUN_LOG_INFO("submit proposal rsp return failed, error code:%d, channelID:%d",
rSubmitProposalRsp.m_nReturnCode, pProposeSession->m_nChannelID);
}
if (nReturnCode != VBH::EN_OK_TYPE)
{
// 不是网络错误的情况下, 出错后,向选中的提交节点发送取消事务的消息
if (nReturnCode != VBH::EN_NETWORK_ERROR_TYPE)
{
VBH::CCryptCancelProposalTransactionCltEsReq req;
int nEncryptBufLen;
char* pEncryptBuf = VBH::vbhEncrypt((unsigned char*)m_peerEnvelopeKey.data(), nEncryptBufLen, pProposeSession->m_strNonce.data(), pProposeSession->m_strNonce.size());
if (pEncryptBuf)
{
req.m_nEsSessionID = pProposeSession->m_nEsSessionID;
req.m_userData.Set(pEncryptBuf, nEncryptBufLen);
this->SendHtsMsg(req, pProposeSession->m_pSubmitEsMcpHandleSession->m_pMcpHandler);
DSC_THREAD_FREE(pEncryptBuf);
}
else
{
DSC_RUN_LOG_ERROR("encrypt error.");
}
}
//向客户端上层通知 //删除session
DSC::CDscShortList<VBH::CConciseOnCreateInformationKey> lstCreatedInfoKey;
this->CancelDscTimer(pProposeSession);
m_mapProposeSession.Erase(pProposeSession);
OnProposeResponse(nReturnCode, pProposeSession, 0, 0, 0, 0, lstCreatedInfoKey);
OnRelease(pProposeSession);
}
}
return 0;
}
ACE_INT32 CVbhCryptClientService::OnHtsMsg(VBH::CCryptSubmitProposalTransactionEsCltRsp& rSubmitTransRsp, CMcpHandler* pMcpHandler)
{
CProposeSession* pProposeSession = m_mapProposeSession.Find(rSubmitTransRsp.m_nCltSessionID);
if (pProposeSession)
{
ACE_INT32 nReturnCode = rSubmitTransRsp.m_nReturnCode;
if (nReturnCode == VBH::EN_OK_TYPE)
{
//1. 解密数据
int nDecryptBufLen;
char* pDecryptBuf = VBH::vbhDecrypt((unsigned char*)pProposeSession->m_envelopeKey.data(), nDecryptBufLen,
rSubmitTransRsp.m_userData.GetBuffer(), rSubmitTransRsp.m_userData.GetSize());
if (DSC_LIKELY(pDecryptBuf))
{
VBH::COrderGenerateTransactionKey genTransKey;
DSC::CDscBlob nonce;
VBH::CCryptSubmitProposalTransactionEsCltRspDataWrapper wrapper(genTransKey, nonce);
//2. 解码解密后的数据,得到应答实际内容
if (DSC::Decode(wrapper, pDecryptBuf, nDecryptBufLen))
{
nReturnCode = VBH::EN_DECODE_ERROR_TYPE;
DSC_RUN_LOG_INFO("decode error.");
}
else
{
//3. 校验nonce
if (VBH::IsEqual(pProposeSession->m_strNonce, nonce))
{
//返回提案应答
this->OnProposeResponse(nReturnCode, pProposeSession, wrapper.m_nOrderID, wrapper.m_nSequenceNumber, wrapper.m_nTransIdx, wrapper.m_nBlockID, lstCreatedInfoKey);
if (pProposeSession->m_bWaitNotify)//如果客户等待通知,则重置定时器,//TODO: 另起session
{
this->ResetDscTimer(pProposeSession, EN_SESSION_WAIT_NOTIFY_TIMEOUT_VALUE);
pProposeSession->m_bCompleteRegistRsp = true;
}
else //客户不等待通知,则删除session
{
this->CancelDscTimer(pProposeSession);
m_mapProposeSession.Erase(pProposeSession);
this->OnRelease(pProposeSession);
}
}
else
{
nReturnCode = VBH::EN_NONCE_VERIFY_ERROR_TYPE;
DSC_RUN_LOG_INFO("verify nonce failed.");
}
}
DSC_THREAD_FREE(pDecryptBuf);
}
else
{
nReturnCode = VBH::EN_DECRYPT_ERROR_TYPE;
DSC_RUN_LOG_INFO("decrypt_error");
}
}
else
{
DSC_RUN_LOG_INFO("submit proposal transaction rsp return failed, error code:%d, channelID:%d", rSubmitTransRsp.m_nReturnCode, pProposeSession->m_nChannelID);
}
}
else
{
DSC_RUN_LOG_WARNING("can not find propose session, session-id:%d", rSubmitTransRsp.m_nCltSessionID);
}
return 0;
}
ACE_INT32 CVbhCryptClientService::OnHtsMsg(VBH::CCryptQueryUserInfoEdsCltRsp& rQueryUserRsp, CMcpHandler* pMcpHandler)
{
CQueryUserSession* pUserSession = m_mapQueryUserSession.Erase(rQueryUserRsp.m_nSessionID);
if (DSC_LIKELY(pUserSession))
{
ACE_INT32 nReturnCode = rQueryUserRsp.m_nReturnCode;
char* pDecryptBuf;
DSC::CDscBlob userInfo;
if (nReturnCode == VBH::EN_OK_TYPE)
{
int nDecryptBufLen;
pDecryptBuf = VBH::vbhDecrypt((unsigned char*)pUserSession->m_envelopeKey.data(), nDecryptBufLen, rQueryUserRsp.m_userData.GetBuffer(), rQueryUserRsp.m_userData.GetSize());
if (DSC_LIKELY(pDecryptBuf))
{
DSC::CDscBlob nonce;
VBH::CCryptQueryUserInfoRspWrapper userData(userInfo, nonce);
if (DSC::Decode(userData, pDecryptBuf, nDecryptBufLen))
{
DSC_RUN_LOG_ERROR("decode error.");
nReturnCode = VBH::EN_DECRYPT_ERROR_TYPE;
}
else
{
if (!VBH::IsEqual(pUserSession->m_strNonce, nonce))
{
DSC_RUN_LOG_ERROR("verify nonce failed.");
nReturnCode = VBH::EN_NONCE_VERIFY_ERROR_TYPE;
}
}
}
else
{
DSC_RUN_LOG_ERROR("decrypt error.");
nReturnCode = VBH::EN_DECRYPT_ERROR_TYPE;
}
}
else
{
DSC_RUN_LOG_ERROR("query user info rsp return failed, error code:%d, channelID:%d", rQueryUserRsp.m_nReturnCode, pUserSession->m_nChannelID);
pDecryptBuf = NULL;
}
this->CancelDscTimer(pUserSession);
this->OnRelease(pUserSession, nReturnCode, userInfo);
if (pDecryptBuf)
{
DSC_THREAD_FREE(pDecryptBuf);
}
}
else
{
DSC_RUN_LOG_ERROR("can not find query user session.");
}
return 0;
}
ACE_INT32 CVbhCryptClientService::OnHtsMsg(VBH::CCryptQueryTransInfoEsCltRsp& rQueryTransRsp, CMcpHandler* pMcpHandler)
{
CQueryTransactionSession* pQuerySession = m_mapQueryTransSession.Erase(rQueryTransRsp.m_nCltSessionID);
if (DSC_LIKELY(pQuerySession))
{
ACE_INT32 nReturnCode = rQueryTransRsp.m_nReturnCode;
char* pDecryptBuf;
DSC::CDscBlob transInfo;
if (nReturnCode == VBH::EN_OK_TYPE)
{
int nDecryptBufLen;
pDecryptBuf = VBH::vbhDecrypt((unsigned char*)pQuerySession->m_envelopeKey.data(), nDecryptBufLen, rQueryTransRsp.m_userData.GetBuffer(), rQueryTransRsp.m_userData.GetSize());
if (DSC_LIKELY(pDecryptBuf))
{
DSC::CDscBlob nonce;
VBH::CCryptQueryTransactionRspDataWrapper wrapper(nonce, transInfo);
if (DSC_UNLIKELY(DSC::Decode(wrapper, pDecryptBuf, nDecryptBufLen)))
{
nReturnCode = VBH::EN_DECRYPT_ERROR_TYPE;
DSC_RUN_LOG_INFO("decode error.");
}
else
{
if (!VBH::IsEqual(pQuerySession->m_strNonce, nonce))
{
nReturnCode = VBH::EN_NONCE_VERIFY_ERROR_TYPE;
DSC_RUN_LOG_INFO("verify nonce failed.");
}
}
}
else
{
nReturnCode = VBH::EN_DECRYPT_ERROR_TYPE;
}
}
else
{
DSC_RUN_LOG_INFO("query transaction rsp return failed, error code:%d, channelID:%d", rQueryTransRsp.m_nReturnCode, pQuerySession->m_nChannelID);
pDecryptBuf = NULL;
}
this->CancelDscTimer(pQuerySession);
this->OnRelease(pQuerySession, nReturnCode, transInfo);
if (pDecryptBuf)
{
DSC_THREAD_FREE(pDecryptBuf);
}
}
else
{
DSC_RUN_LOG_WARNING("query user rsp timeout");
}
return 0;
}
void CVbhCryptClientService::OnDscMsg(VBH::CInitBcUserSdk& rInitUserSdk, const CDscMsg::CDscMsgAddr& rSrcMsgAddr)
{
if (m_pCallback)
{
DSC_RUN_LOG_WARNING("repleat init regist user msg");
}
else
{
m_pCallback = (VBH_SDK::IClientSdkMsgCallback*)rInitUserSdk.m_pCallBack;
if(m_bReady)
{
m_pCallback->OnReady();
}
}
}
void CVbhCryptClientService::OnDscMsg(VBH::CRegistUserApiCltReq& rRegistUserReq, const CDscMsg::CDscMsgAddr& rSrcMsgAddr)
{
ACE_INT32 nReturnCode = this->RegistUser(rRegistUserReq);
if (DSC_UNLIKELY(nReturnCode))
{
VBH_SDK::CRegistUserRsp rsp;
rsp.m_nReturnCode = nReturnCode;
rsp.m_nChannelID = rRegistUserReq.m_nChannelID;
rsp.m_pUserKey = rRegistUserReq.m_userKey.GetBuffer();
rsp.m_nUserKeyLen = rRegistUserReq.m_userKey.GetSize();
rsp.m_pGenUserKey = NULL;
rsp.m_nGenUserKeyLen = 0;
m_pCallback->OnRegistUserRsp(rsp);
DSC_RUN_LOG_WARNING("regist user failed, error code:%d", nReturnCode);
}
}
void CVbhCryptClientService::OnDscMsg(VBH::CCryptUnRegistUserReq& rUnRegistUserReq, const CDscMsg::CDscMsgAddr& rSrcMsgAddr)
{
ACE_INT32 nReturnCode = this->UnRegistUser(rUnRegistUserReq);
if (DSC_UNLIKELY(nReturnCode))
{
VBH_SDK::CUnRegistUserRsp rsp;
rsp.m_nReturnCode = nReturnCode;
rsp.m_nChannelID = rUnRegistUserReq.m_nChannelID;
//TODO: 取消注册的完整性暂时不考虑
//rsp.m_pUserKey = rUnRegistUserReq.m_userKey.GetBuffer();
//rsp.m_nUserKeyLen = rUnRegistUserReq.m_userKey.GetSize();
m_pCallback->OnUnRegistUserRsp(rsp);
DSC_RUN_LOG_INFO("regist user failed, error code:%d", nReturnCode);
}
}
void CVbhCryptClientService::OnDscMsg(VBH::CProposeApiCltReq& rProposeApiCltReq, const CDscMsg::CDscMsgAddr& rSrcMsgAddr)
{
ACE_INT32 nReturnCode = this->Propose(rProposeApiCltReq);
if (DSC_UNLIKELY(nReturnCode))
{
VBH_SDK::CProposeRsp rsp;
rsp.m_nReturnCode = nReturnCode;
rsp.m_nChannelID = rProposeApiCltReq.m_nChannelID;
rsp.m_pUserKey = rProposeApiCltReq.m_userKey.GetBuffer();
rsp.m_nUserKeyLen = rProposeApiCltReq.m_userKey.GetSize();
m_pCallback->OnLaunchTransRsp(rsp);
DSC_RUN_LOG_WARNING("set user info failed, error code:%d, error string:%s", nReturnCode, VBH::GetErrorString(nReturnCode));
}
}
void CVbhCryptClientService::OnDscMsg(VBH::CQueryUserInfoApiCltReq& rQuerUserReq, const CDscMsg::CDscMsgAddr& rSrcMsgAddr)
{
ACE_INT32 nReturnCode = this->GetUserInfo(rQuerUserReq);
if (DSC_UNLIKELY(nReturnCode))
{
VBH_SDK::CGetUserInfoRsp rsp;
rsp.m_nReturnCode = nReturnCode;
rsp.m_nChannelID = rQuerUserReq.m_nChannelID;
rsp.m_pUserKey = rQuerUserReq.m_userKey.GetBuffer();
rsp.m_nUserKeyLen = rQuerUserReq.m_userKey.GetSize();
rsp.m_pUserUserInfo = NULL;
rsp.m_nUserUserInfoLen = 0;
m_pCallback->OnGetUserInfoRsp(rsp);
DSC_RUN_LOG_WARNING("get user info failed, error code:%d, error string:%s", rsp.m_nReturnCode, VBH::GetErrorString(rsp.m_nReturnCode));
}
}
void CVbhCryptClientService::OnDscMsg(VBH::CQueryTransInfoApiCltReq& rQueryTransReq, const CDscMsg::CDscMsgAddr& rSrcMsgAddr)
{
ACE_INT32 nReturnCode = this->GetTransInfo(rQueryTransReq);
if (DSC_UNLIKELY(nReturnCode))
{
VBH_SDK::CGetTransactionInfoRsp rsp;
rsp.m_nReturnCode = nReturnCode;
rsp.m_nChannelID = rQueryTransReq.m_nChannelID;
rsp.m_pUserKey = rQueryTransReq.m_userKey.GetBuffer();
rsp.m_nUserKeyLen = rQueryTransReq.m_userKey.GetSize();
rsp.m_pTransKey = rQueryTransReq.m_transKey.GetBuffer();
rsp.m_nTransKeyLen = rQueryTransReq.m_transKey.GetSize();
rsp.m_pTransInfo = NULL;
rsp.m_nTransInfoLen = 0;
m_pCallback->OnGetTransInfoRsp(rsp);
DSC_RUN_LOG_WARNING("get transaction failed, error code:%d", nReturnCode);
}
}
ACE_INT32 CVbhCryptClientService::OnConnectedNodify(CMcpClientHandler* pMcpClientHandler)
{
const ACE_INT32 nPeerID = this->GetPeerID(pMcpClientHandler->GetHandleID());
CVbhPeerConnectionInfo* pPeerSession = NULL;
bool bReady = false;
ACE_ASSERT(nPeerID != -1);
if (m_vbhPeerConnSumInfo.m_parrPeerConnInfo)
{
for (ACE_UINT32 i = 0; i < m_vbhPeerConnSumInfo.m_nPeerSessionNum; ++i)
{
if (m_vbhPeerConnSumInfo.m_parrPeerConnInfo[i].m_nPeerID == nPeerID)
{
pPeerSession = m_vbhPeerConnSumInfo.m_parrPeerConnInfo + i;
break;
}
}
if (!pPeerSession)
{
CVbhPeerConnectionInfo* parrPeerSession;
DSC_NEW_ARRAY(parrPeerSession, CVbhPeerConnectionInfo, m_vbhPeerConnSumInfo.m_nPeerSessionNum + 1);
ACE_OS::memcpy(parrPeerSession, m_vbhPeerConnSumInfo.m_parrPeerConnInfo, sizeof(CVbhPeerConnectionInfo) * m_vbhPeerConnSumInfo.m_nPeerSessionNum);
DSC_DELETE_ARRAY(m_vbhPeerConnSumInfo.m_parrPeerConnInfo);
m_vbhPeerConnSumInfo.m_parrPeerConnInfo = parrPeerSession;
pPeerSession = m_vbhPeerConnSumInfo.m_parrPeerConnInfo + m_vbhPeerConnSumInfo.m_nPeerSessionNum;
pPeerSession->m_nPeerID = nPeerID;
++m_vbhPeerConnSumInfo.m_nPeerSessionNum;
m_vbhPeerConnSumInfo.m_nIndex = abs(ACE_OS::rand_r(&m_seed)) % m_vbhPeerConnSumInfo.m_nPeerSessionNum; //连接的peer数变动时,重新计算一遍随机值,保证每个peer被选为背书peer的机会均等
}
}
else
{
m_vbhPeerConnSumInfo.m_nPeerSessionNum = 1;
DSC_NEW_ARRAY(m_vbhPeerConnSumInfo.m_parrPeerConnInfo, CVbhPeerConnectionInfo, m_vbhPeerConnSumInfo.m_nPeerSessionNum);
pPeerSession = m_vbhPeerConnSumInfo.m_parrPeerConnInfo;
pPeerSession->m_nPeerID = nPeerID;
bReady = true;
}
if (pPeerSession->m_ppMcpHandler)
{
CMcpHandlerPtr* ppMcpHandler;
DSC_NEW_ARRAY(ppMcpHandler, CMcpHandlerPtr, pPeerSession->m_nHandleIDNum + 1);
ACE_OS::memcpy(ppMcpHandler, pPeerSession->m_ppMcpHandler, sizeof(CMcpHandlerPtr) * pPeerSession->m_nHandleIDNum);
DSC_DELETE_ARRAY(pPeerSession->m_ppMcpHandler);
pPeerSession->m_ppMcpHandler = ppMcpHandler;
pPeerSession->m_ppMcpHandler[pPeerSession->m_nHandleIDNum] = pMcpClientHandler;
++pPeerSession->m_nHandleIDNum;
pPeerSession->m_nIndex = abs(ACE_OS::rand_r(&m_seed)) % pPeerSession->m_nHandleIDNum; //当连接数变动时,重新计算一遍随机值,保证session平均的发送到每个endorser
}
else
{
pPeerSession->m_nHandleIDNum = 1;
DSC_NEW_ARRAY(pPeerSession->m_ppMcpHandler, CMcpHandlerPtr, pPeerSession->m_nHandleIDNum);
*pPeerSession->m_ppMcpHandler = pMcpClientHandler;
}
if (bReady)
{
this->OnReady();
}
return 0;
}
void CVbhCryptClientService::OnNetworkError(CMcpHandler* pMcpHandler)
{
const ACE_INT32 nPeerID = this->GetPeerID(pMcpHandler->GetHandleID());
//断连后,更新和peer的连接信息以及和某个peer的endorser的连接信息
ACE_ASSERT(nPeerID != -1);
for (ACE_UINT32 i = 0; i < m_vbhPeerConnSumInfo.m_nPeerSessionNum; ++i)
{
if (m_vbhPeerConnSumInfo.m_parrPeerConnInfo[i].m_nPeerID == nPeerID)
{
CVbhPeerConnectionInfo& rBcPeerSession = m_vbhPeerConnSumInfo.m_parrPeerConnInfo[i];
for (ACE_UINT32 j = 0; j < rBcPeerSession.m_nHandleIDNum; ++j)
{
if (rBcPeerSession.m_ppMcpHandler[j] == pMcpHandler)
{
if (rBcPeerSession.m_nHandleIDNum > 1)
{
CMcpHandlerPtr* ppMcpHandler;
ACE_UINT32 n = 0;
DSC_NEW_ARRAY(ppMcpHandler, CMcpHandlerPtr, rBcPeerSession.m_nHandleIDNum - 1);
for (ACE_UINT32 k = 0; k < rBcPeerSession.m_nHandleIDNum; ++k)
{
if (rBcPeerSession.m_ppMcpHandler[k] != pMcpHandler)
{
ppMcpHandler[n++] = rBcPeerSession.m_ppMcpHandler[k];
}
}
DSC_DELETE_ARRAY(rBcPeerSession.m_ppMcpHandler);
rBcPeerSession.m_ppMcpHandler = ppMcpHandler;
--rBcPeerSession.m_nHandleIDNum;
if (rBcPeerSession.m_nIndex >= rBcPeerSession.m_nHandleIDNum)
{
rBcPeerSession.m_nIndex = 0;
}
}
else
{
DSC_DELETE_ARRAY(rBcPeerSession.m_ppMcpHandler);
rBcPeerSession.m_ppMcpHandler = NULL;
if (m_vbhPeerConnSumInfo.m_nPeerSessionNum > 1)
{
CVbhPeerConnectionInfo* parrPeerSession;
ACE_UINT32 n = 0;
DSC_NEW_ARRAY(parrPeerSession, CVbhPeerConnectionInfo, m_vbhPeerConnSumInfo.m_nPeerSessionNum - 1);
for (ACE_UINT32 k = 0; k < m_vbhPeerConnSumInfo.m_nPeerSessionNum; ++k)
{
if (m_vbhPeerConnSumInfo.m_parrPeerConnInfo[k].m_nPeerID != nPeerID)
{
parrPeerSession[n++] = m_vbhPeerConnSumInfo.m_parrPeerConnInfo[k];
}
}
DSC_DELETE_ARRAY(m_vbhPeerConnSumInfo.m_parrPeerConnInfo);
m_vbhPeerConnSumInfo.m_parrPeerConnInfo = parrPeerSession;
--m_vbhPeerConnSumInfo.m_nPeerSessionNum;
if (m_vbhPeerConnSumInfo.m_nIndex >= m_vbhPeerConnSumInfo.m_nPeerSessionNum)
{
m_vbhPeerConnSumInfo.m_nIndex = 0;
}
}
else
{
DSC_DELETE_ARRAY(m_vbhPeerConnSumInfo.m_parrPeerConnInfo);
m_vbhPeerConnSumInfo.m_parrPeerConnInfo = NULL;
m_vbhPeerConnSumInfo.m_nPeerSessionNum = 0;
m_vbhPeerConnSumInfo.m_nIndex = 0;
}
}
break;
}
}
}
}
//断连后,删除在该连接上的所有session
CHandleSession* pHandleSession = m_mapHandleSession.Erase(pMcpHandler->GetHandleID());
if (pHandleSession)
{
CDscTypeArray<IBaseSession>& arrSession = pHandleSession->m_arrSession;
const ACE_UINT32 nSize = arrSession.Size();
for (ACE_UINT32 i = 0; i < nSize; ++i)
{
arrSession[i]->OnNetError();
}
DSC_THREAD_TYPE_DEALLOCATE(pHandleSession);
}
//如果和所有的peer都断连了,通知上层应用
if (!m_vbhPeerConnSumInfo.m_nPeerSessionNum)
{
this->OnAbnormal();
}
CDscHtsClientService::OnNetworkError(pMcpHandler);
}
ACE_INT32 CVbhCryptClientService::RegistUser(VBH::CRegistUserApiCltReq& rRegistUserReq)
{
ACE_INT32 nReturnCode = VBH::EN_OK_TYPE;
if (m_vbhPeerConnSumInfo.m_nPeerSessionNum < m_nEndorsePeerCount)
{
DSC_RUN_LOG_WARNING("connected peer num:%d cann't less than configed endorse peer count:%d", m_vbhPeerConnSumInfo.m_nPeerSessionNum, m_nEndorsePeerCount);
nReturnCode = VBH::EN_NETWORK_ERROR_TYPE;
}
else
{
CRegistUserSession* pRegistUserSession = DSC_THREAD_TYPE_NEW(CRegistUserSession) CRegistUserSession(*this);
VBH::Assign(pRegistUserSession->m_userKey, rRegistUserReq.m_userKey);
VBH::Assign(pRegistUserSession->m_userInfo, rRegistUserReq.m_userInfo);
pRegistUserSession->m_strNonce = ACE_OS::rand_r(&m_seed);
pRegistUserSession->m_nCcID = rRegistUserReq.m_nCcID;
pRegistUserSession->m_nChannelID = rRegistUserReq.m_nChannelID;
pRegistUserSession->m_bWaitNotify = rRegistUserReq.m_bWaitNotify;
bool bSubmitNode; //标记是否是被选中的
DSC::CDscBlob nonce(pRegistUserSession->m_strNonce.data(), pRegistUserSession->m_strNonce.size());
VBH::CCryptRegistUserCltEsReqDataWrapper wrapper(rRegistUserReq.m_bWaitNotify, bSubmitNode, pRegistUserSession->m_nCcID, pRegistUserSession->m_nChannelID, rRegistUserReq.m_userKey, rRegistUserReq.m_userInfo, nonce);
char* pTrueMsgBuf;
size_t nTrueMsgBufLen; //标记被选中的消息 编码后缓冲区
char* pFalseMsgBuf;
size_t nFalseMsgBufLen; //标记未被选中的消息 编码后缓冲区
bSubmitNode = true;
DSC::Encode(wrapper, pTrueMsgBuf, nTrueMsgBufLen);
bSubmitNode = false;
DSC::Encode(wrapper, pFalseMsgBuf, nFalseMsgBufLen);
//如果Encode失败,则表明系统已经出了严重的问题,正常情况下是不会的;故对Encode执行结果不做判断
char* pEncryptTrueMsgBuf;
int nEncryptTrueMsgBufLen;
char* pEncryptFalseMsgBuf;
int nEncryptFalseMsgBufLen;
//TODO: 将来肯定要调整,暂时先用从数据库中读取到的对称秘钥对数据进行加密
pEncryptTrueMsgBuf = VBH::vbhEncrypt((unsigned char*)m_peerEnvelopeKey.data(), nEncryptTrueMsgBufLen, pTrueMsgBuf, nTrueMsgBufLen);
pEncryptFalseMsgBuf = VBH::vbhEncrypt((unsigned char*)m_peerEnvelopeKey.data(), nEncryptFalseMsgBufLen, pFalseMsgBuf, nFalseMsgBufLen);
DSC_THREAD_SIZE_FREE(pTrueMsgBuf, nTrueMsgBufLen);
DSC_THREAD_SIZE_FREE(pFalseMsgBuf, nFalseMsgBufLen); //释放Encode时释放的资源
if (DSC_LIKELY(pEncryptTrueMsgBuf && pEncryptFalseMsgBuf))
{
VBH::CCryptRegistUserCltEsReq req;
req.m_nCltSessionID = m_nSessionID;
CMcpHandler* pMcpHandler;
ACE_UINT32 nHandleID;
CHandleSession* pHandleSession;
const ACE_INT32 nRand = abs(ACE_OS::rand_r(&m_seed)) % m_nEndorsePeerCount; //TODO:将来背书策略有调整
for (ACE_INT32 i = 0; i < m_nEndorsePeerCount; ++i)
{
//记录 regist-user-session 所用的 handler,并将 handler 放入对应的 handle-session中
pMcpHandler = this->GetMcpHandler();
nHandleID = pMcpHandler->GetHandleID();
pHandleSession = m_mapHandleSession.Find(nHandleID);
if (!pHandleSession)
{
pHandleSession = DSC_THREAD_TYPE_NEW(CHandleSession) CHandleSession;
pHandleSession->m_pMcpHandler = pMcpHandler;
m_mapHandleSession.DirectInsert(nHandleID, pHandleSession);
}
//记录handle-session和 regist-user-session 的勾连关系
pRegistUserSession->m_arrHandleSession.Insert(pHandleSession);
pHandleSession->m_arrSession.Insert(pRegistUserSession);
if (nRand == i)
{
pRegistUserSession->m_pSubmitEsMcpHandleSession = pHandleSession;
req.m_userData.Set(pEncryptTrueMsgBuf, nEncryptTrueMsgBufLen);
}
else
{
req.m_userData.Set(pEncryptFalseMsgBuf, nEncryptFalseMsgBufLen);
}
if (DSC_UNLIKELY(this->SendHtsMsg(req, pMcpHandler)))
{
DSC_RUN_LOG_ERROR("network error.");
OnNetError(pRegistUserSession);
nReturnCode = VBH::EN_NETWORK_ERROR_TYPE;
break;
}
}
if (nReturnCode == VBH::EN_OK_TYPE)
{
pRegistUserSession->m_nCltSessionID = m_nSessionID;
SetDscTimer(pRegistUserSession, EN_SESSION_TIMEOUT_VALUE);
m_mapRegistUserSession.DirectInsert(m_nSessionID, pRegistUserSession);
++m_nSessionID;
}
else
{
//不需要处理
}
}
else
{
DSC_RUN_LOG_ERROR("encrypt error.");
DSC_THREAD_TYPE_DELETE(pRegistUserSession);
nReturnCode = VBH::EN_SYSTEM_ERROR_TYPE;
}
if (pEncryptTrueMsgBuf)
{
DSC_THREAD_FREE(pEncryptTrueMsgBuf);
}
if (pEncryptFalseMsgBuf)
{
DSC_THREAD_FREE(pEncryptFalseMsgBuf);
}
}
return nReturnCode;
}
ACE_INT32 CVbhCryptClientService::UnRegistUser(VBH::CCryptUnRegistUserReq& rUnRegistUserReq)
{
//TODO:
return -1;
}
ACE_INT32 CVbhCryptClientService::Propose(VBH::CProposeApiCltReq& rProposeReq)
{
ACE_INT32 nReturnCode = VBH::EN_OK_TYPE;
if (m_vbhPeerConnSumInfo.m_nPeerSessionNum < m_nEndorsePeerCount)
{
DSC_RUN_LOG_WARNING("connected peer num:%d cann't less than configed endorse peer count:%d", m_vbhPeerConnSumInfo.m_nPeerSessionNum, m_nEndorsePeerCount);
nReturnCode = VBH::EN_NETWORK_ERROR_TYPE;
}
else
{
CProposeSession* pProposeSession = DSC_THREAD_TYPE_NEW(CProposeSession) CProposeSession(*this);
CDscString svrPubKey; //服务端公钥
CDscString cltPriKey; //客户端私钥 //session中目前不保存着两个秘钥,所以声明为栈变量
if (DSC_UNLIKELY(VBH::DecodeClientCryptKey(rProposeReq.m_cryptUserKey, svrPubKey, cltPriKey, pProposeSession->m_envelopeKey)))
{
DSC_THREAD_TYPE_DELETE(pProposeSession);
DSC_RUN_LOG_ERROR("decode client crypt key error.");
nReturnCode = VBH::EN_DECRYPT_ERROR_TYPE;
}
else
{
VBH::CCryptSubmitProposalCltEsReq req;
if (DSC::Decode(req.m_genUserKey, rProposeReq.m_userKey.GetBuffer(), rProposeReq.m_userKey.GetSize())) //从字符串中解码出系统生成的user-key
{
DSC_THREAD_TYPE_DELETE(pProposeSession);
DSC_RUN_LOG_ERROR("decode generate user key error.");
nReturnCode = VBH::EN_DECRYPT_ERROR_TYPE;
}
else
{
char* pTrueMsgBuf;
size_t nTrueMsgBufLen;
char* pFalseMsgBuf;
size_t nFalseMsgBufLen;
bool bSubmitNode; //通知endorser保留session,用于后续commit transaction
pProposeSession->m_strNonce = ACE_OS::rand_r(&m_seed);
DSC::CDscBlob nonce(pProposeSession->m_strNonce.data(), pProposeSession->m_strNonce.size());
VBH::CCryptSubmitProposalCltEsReqDataWrapper proposalWrapper(pProposeSession->m_bWaitNotify, bSubmitNode, rProposeReq.m_nCcID,
rProposeReq.m_nActionID, rProposeReq.m_proposal, nonce);
bSubmitNode = true;
DSC::Encode(proposalWrapper, pTrueMsgBuf, nTrueMsgBufLen);
bSubmitNode = false;
DSC::Encode(proposalWrapper, pFalseMsgBuf, nFalseMsgBufLen);
char* pTrueEncryptBuf;
int nTrueEncryptBufLen;
char* pFalseEncryptBuf;
int nFalseEncryptBufLen;
pTrueEncryptBuf = VBH::vbhEncrypt((unsigned char*)pProposeSession->m_envelopeKey.data(), nTrueEncryptBufLen, pTrueMsgBuf, nTrueMsgBufLen);
pFalseEncryptBuf = VBH::vbhEncrypt((unsigned char*)pProposeSession->m_envelopeKey.data(), nFalseEncryptBufLen, pFalseMsgBuf, nFalseMsgBufLen);
DSC_THREAD_SIZE_FREE(pTrueMsgBuf, nTrueMsgBufLen);
DSC_THREAD_SIZE_FREE(pFalseMsgBuf, nFalseMsgBufLen);
if (DSC_LIKELY(pTrueEncryptBuf && pFalseEncryptBuf))
{
req.m_nChannelID = rProposeReq.m_nChannelID;
req.m_nCltSessionID = m_nSessionID;
CMcpHandler* pMcpHandler;
ACE_UINT32 nHandleID;
CHandleSession* pHandleSession;
const ACE_INT32 nRand = abs(ACE_OS::rand_r(&m_seed)) % m_nEndorsePeerCount; //TODO:将来背书策略有调整
for (ACE_INT32 i = 0; i < m_nEndorsePeerCount; ++i)
{
//记录 propose-session 所用的 handler,并将 handler 放入对应的 handle-session中
pMcpHandler = this->GetMcpHandler();
nHandleID = pMcpHandler->GetHandleID();
pHandleSession = m_mapHandleSession.Find(nHandleID);
if (!pHandleSession)
{
pHandleSession = DSC_THREAD_TYPE_NEW(CHandleSession) CHandleSession;
pHandleSession->m_pMcpHandler = pMcpHandler;
m_mapHandleSession.DirectInsert(nHandleID, pHandleSession);
}
//记录handle-session和 propose-session的勾连关系
pProposeSession->m_arrHandleSession.Insert(pHandleSession);
pHandleSession->m_arrSession.Insert(pProposeSession);
if (nRand == i)
{
pProposeSession->m_pSubmitEsMcpHandleSession = pHandleSession;
req.m_userData.Set(pTrueEncryptBuf, nTrueEncryptBufLen);
}
else
{
req.m_userData.Set(pFalseEncryptBuf, nFalseEncryptBufLen);
}
if (DSC_UNLIKELY(this->SendHtsMsg(req, pMcpHandler)))
{
OnNetError(pProposeSession); //释放session
nReturnCode = VBH::EN_NETWORK_ERROR_TYPE;
break;
}
}
if (nReturnCode == VBH::EN_OK_TYPE)
{
VBH::Assign(pProposeSession->m_userKey, rProposeReq.m_userKey);
pProposeSession->m_nCltSessionID = m_nSessionID;
this->SetDscTimer(pProposeSession, CVbhCryptClientService::EN_SESSION_TIMEOUT_VALUE);
m_mapProposeSession.Insert(m_nSessionID, pProposeSession);
++m_nSessionID;
}
else
{
//网络出错不处理了
}
}
else
{
DSC_THREAD_TYPE_DEALLOCATE(pProposeSession);
DSC_RUN_LOG_ERROR("encrypt error.");
nReturnCode = VBH::EN_ENCRYPT_ERROR_TYPE;
}
if (pTrueEncryptBuf)
{
DSC_THREAD_FREE(pTrueEncryptBuf);
}
if (pFalseEncryptBuf)
{
DSC_THREAD_FREE(pFalseEncryptBuf);
}
}
}
}
return nReturnCode;
}
ACE_INT32 CVbhCryptClientService::GetUserInfo(VBH::CQueryUserInfoApiCltReq& rQueryUserReq)
{
ACE_INT32 nReturnCode = VBH::EN_OK_TYPE;
CQueryUserSession* pQueryUserSession = DSC_THREAD_TYPE_NEW(CQueryUserSession) CQueryUserSession(*this);
CDscString svrPubKey;
CDscString cltPriKey; //临时存储解码出的秘钥,因为session中暂时不要这两个秘钥
//从查询消息中取出服务端公钥和客户端私钥
if (VBH::DecodeClientCryptKey(rQueryUserReq.m_cryptUserKey, svrPubKey, cltPriKey, pQueryUserSession->m_envelopeKey))
{
DSC_THREAD_TYPE_DEALLOCATE(pQueryUserSession);
DSC_RUN_LOG_ERROR("decode client crypt key error.");
nReturnCode = VBH::EN_DECRYPT_ERROR_TYPE;
}
else
{
VBH::CCryptQueryUserInfoCltEsReq req;
VBH::Assign(pQueryUserSession->m_userKey, rQueryUserReq.m_userKey);
if (DSC::Decode(req.m_genUserKey, rQueryUserReq.m_userKey.GetBuffer(), rQueryUserReq.m_userKey.GetSize()))
{
DSC_THREAD_TYPE_DEALLOCATE(pQueryUserSession);
DSC_RUN_LOG_ERROR("decode user key failed.");
nReturnCode = VBH::EN_DECODE_ERROR_TYPE;
}
else
{
char* pEncryptBuf;
int nEncryptBufLen;
pQueryUserSession->m_strNonce = ACE_OS::rand_r(&m_seed);
pEncryptBuf = VBH::vbhEncrypt((unsigned char*)pQueryUserSession->m_envelopeKey.data(), nEncryptBufLen,
pQueryUserSession->m_strNonce.data(), pQueryUserSession->m_strNonce.size());
if (DSC_LIKELY(pEncryptBuf))
{
CMcpHandler* pMcpHandler = this->GetMcpHandler();
req.m_nCltSessionID = m_nSessionID;
req.m_nChannelID = rQueryUserReq.m_nChannelID;
req.m_userData.Set(pEncryptBuf, nEncryptBufLen);
if (this->SendHtsMsg(req, pMcpHandler))
{
DSC_THREAD_TYPE_DEALLOCATE(pQueryUserSession);
nReturnCode = VBH::EN_NETWORK_ERROR_TYPE;
}
else
{
//记录 query-user-session 所用的 handler,并将 handler 放入对应的 handle-session中
ACE_UINT32 nHandleID = pMcpHandler->GetHandleID();
CHandleSession* pHandleSession = m_mapHandleSession.Find(nHandleID);
if (!pHandleSession)
{
pHandleSession = DSC_THREAD_TYPE_NEW(CHandleSession) CHandleSession;
pHandleSession->m_pMcpHandler = pMcpHandler;
m_mapHandleSession.DirectInsert(nHandleID, pHandleSession);
}
//记录handle-session和 propose-session的勾连关系
pQueryUserSession->m_pHandleSession = pHandleSession;
pHandleSession->m_arrSession.Insert(pQueryUserSession);
pQueryUserSession->m_nCltSessionID = m_nSessionID;
pQueryUserSession->m_nChannelID = rQueryUserReq.m_nChannelID;
this->SetDscTimer(pQueryUserSession, CVbhCryptClientService::EN_SESSION_TIMEOUT_VALUE);
m_mapQueryUserSession.Insert(m_nSessionID, pQueryUserSession);
++m_nSessionID;
}
DSC_THREAD_FREE(pEncryptBuf);
}
else
{
DSC_THREAD_TYPE_DEALLOCATE(pQueryUserSession);
DSC_RUN_LOG_ERROR("encrypt error.");
nReturnCode = VBH::EN_ENCRYPT_ERROR_TYPE;
}
}
}
return nReturnCode;
}
ACE_INT32 CVbhCryptClientService::GetTransInfo(VBH::CQueryTransInfoApiCltReq& rQueryTransReq)
{
ACE_INT32 nReturnCode = VBH::EN_OK_TYPE;
CQueryTransactionSession* pQueryTransSession = DSC_THREAD_TYPE_NEW(CQueryTransactionSession) CQueryTransactionSession(*this);
CDscString svrPubKey;
CDscString cltPriKey; //临时存储解码出的秘钥,因为session中暂时不要这两个秘钥
if (VBH::DecodeClientCryptKey(rQueryTransReq.m_cryptUserKey, svrPubKey, cltPriKey, pQueryTransSession->m_envelopeKey))
{
DSC_THREAD_TYPE_DEALLOCATE(pQueryTransSession);
DSC_RUN_LOG_ERROR("decode client crypt key failed.");
nReturnCode = VBH::EN_DECRYPT_ERROR_TYPE;
}
else
{
VBH::CCryptQueryTransInfoCltEsReq req;
VBH::Assign(pQueryTransSession->m_userKey, rQueryTransReq.m_userKey);
VBH::Assign(pQueryTransSession->m_transKey, rQueryTransReq.m_transKey);
if (DSC::Decode(req.m_genUserKey, rQueryTransReq.m_userKey.GetBuffer(), rQueryTransReq.m_userKey.GetSize()))
{
DSC_THREAD_TYPE_DEALLOCATE(pQueryTransSession);
DSC_RUN_LOG_ERROR("decode user key error.");
nReturnCode = VBH::EN_DECODE_ERROR_TYPE;
}
else
{
VBH::COrderGenerateTransactionKey transKey;
if (DSC::Decode(transKey, rQueryTransReq.m_transKey.GetBuffer(), rQueryTransReq.m_transKey.GetSize()))
{
DSC_THREAD_TYPE_DEALLOCATE(pQueryTransSession);
DSC_RUN_LOG_ERROR("decode transaction key error.");
nReturnCode = VBH::EN_DECODE_ERROR_TYPE;
}
else
{
pQueryTransSession->m_strNonce = ACE_OS::rand_r(&m_seed);
DSC::CDscBlob nonce(pQueryTransSession->m_strNonce.data(), pQueryTransSession->m_strNonce.size());
VBH::CCryptQueryTransactionReqDataWrapper wrapper(nonce, transKey);
char* pMsgBuf;
size_t nMsgBufLen;
DSC::Encode(wrapper, pMsgBuf, nMsgBufLen);
if (pMsgBuf)
{
int nEncryptBufLen;
char* pEncryptBuf = VBH::vbhEncrypt((unsigned char*)pQueryTransSession->m_envelopeKey.data(), nEncryptBufLen, pMsgBuf, nMsgBufLen);
DSC_THREAD_SIZE_FREE(pMsgBuf, nMsgBufLen);
if (pEncryptBuf)
{
CMcpHandler* pMcpHandler = this->GetMcpHandler();
req.m_nCltSessionID = m_nSessionID;
req.m_nChannelID = rQueryTransReq.m_nChannelID;
req.m_userData.Set(pEncryptBuf, nEncryptBufLen);
if (this->SendHtsMsg(req, pMcpHandler))
{
DSC_THREAD_TYPE_DEALLOCATE(pQueryTransSession);
nReturnCode = VBH::EN_NETWORK_ERROR_TYPE;
}
else
{
//记录 query-trans-session 所用的 handler,并将 handler 放入对应的 handle-session中
ACE_UINT32 nHandleID = pMcpHandler->GetHandleID();
CHandleSession* pHandleSession = m_mapHandleSession.Find(nHandleID);
if (!pHandleSession)
{
pHandleSession = DSC_THREAD_TYPE_NEW(CHandleSession) CHandleSession;
pHandleSession->m_pMcpHandler = pMcpHandler;
m_mapHandleSession.DirectInsert(nHandleID, pHandleSession);
}
//记录handle-session和 propose-session的勾连关系
pQueryTransSession->m_pHandleSession = pHandleSession;
pHandleSession->m_arrSession.Insert(pQueryTransSession);
pQueryTransSession->m_nCltSessionID = m_nSessionID;
this->SetDscTimer(pQueryTransSession, EN_SESSION_TIMEOUT_VALUE);
m_mapQueryTransSession.Insert(m_nSessionID, pQueryTransSession);
++m_nSessionID;
}
DSC_THREAD_FREE(pEncryptBuf);
}
else
{
DSC_THREAD_TYPE_DEALLOCATE(pQueryTransSession);
nReturnCode = VBH::EN_ENCRYPT_ERROR_TYPE;
}
}
else
{
DSC_THREAD_TYPE_DEALLOCATE(pQueryTransSession);
DSC_RUN_LOG_ERROR("encode error.");
nReturnCode = VBH::EN_SYSTEM_ERROR_TYPE;
}
}
}
}
return nReturnCode;
}
ACE_INT32 CVbhCryptClientService::GetPeerID(const ACE_UINT32 nHandleID)
{
for (DSC::CDscList <CVbhPeer>::iterator peer_it = m_lstBcPeer.begin(); peer_it != m_lstBcPeer.end(); ++peer_it)
{
CVbhPeer& rPeer = *peer_it;
for (DSC::CDscList <CEndorserAddr>::iterator svr_it = rPeer.m_lstEndorserAddr.begin(); svr_it != rPeer.m_lstEndorserAddr.end(); ++svr_it)
{
if (nHandleID == svr_it->m_nHandleID)
{
return rPeer.m_nPeerID;
}
}
}
return -1;
}
CMcpHandler* CVbhCryptClientService::GetMcpHandler(void)
{
if (m_vbhPeerConnSumInfo.m_nPeerSessionNum)
{
if (m_vbhPeerConnSumInfo.m_nIndex >= m_vbhPeerConnSumInfo.m_nPeerSessionNum)
{
m_vbhPeerConnSumInfo.m_nIndex = 0;
}
CVbhPeerConnectionInfo& rBcPeerSession = m_vbhPeerConnSumInfo.m_parrPeerConnInfo[m_vbhPeerConnSumInfo.m_nIndex];
++m_vbhPeerConnSumInfo.m_nIndex;
if (rBcPeerSession.m_nIndex >= rBcPeerSession.m_nHandleIDNum)
{
rBcPeerSession.m_nIndex = 0;
}
return rBcPeerSession.m_ppMcpHandler[rBcPeerSession.m_nIndex++];
}
return NULL;
}
class CBlockchainAddr
{
public:
CBlockchainAddr()
: m_IpAddr("ES_IP_ADDR")
, m_port("ES_PORT")
, m_peerID("PEER_ID")
{
}
public:
PER_BIND_ATTR(m_IpAddr, m_port, m_peerID);
public:
CColumnWrapper< CDscString > m_IpAddr;
CColumnWrapper< ACE_INT32 > m_port;
CColumnWrapper< ACE_INT32 > m_peerID;
};
class CBcAddrCriterion : public CSelectCriterion
{
public:
virtual void SetCriterion(CPerSelect& rPerSelect)
{
rPerSelect.OrderByAsc("PEER_ID");
}
};
ACE_INT32 CVbhCryptClientService::LoadPeerInfo(void)
{
CTableWrapper< CCollectWrapper<CBlockchainAddr> > lstEndorserAddr("ES_CFG");
CDscDatabase database;
CDBConnection dbConnection;
CBcAddrCriterion criterion;
if (CDscDatabaseFactoryDemon::instance()->CreateDatabase(database, dbConnection))
{
DSC_RUN_LOG_ERROR("connect database failed.");
return -1;
}
if (::PerSelect(lstEndorserAddr, database, dbConnection, &criterion))
{
DSC_RUN_LOG_ERROR("select from ES_CFG failed");
return -1;
}
CVbhPeer* pVbhPeer = NULL;
ACE_INT32 nPeerID = std::numeric_limits<ACE_INT32>::min();
for (auto it = lstEndorserAddr->begin(); it != lstEndorserAddr->end(); ++it)
{
if (nPeerID != *it->m_peerID)
{
CVbhPeer vbhPeer;
m_lstBcPeer.push_back(vbhPeer);
pVbhPeer = &m_lstBcPeer.back();
nPeerID = *it->m_peerID;
pVbhPeer->m_nPeerID = nPeerID;
}
CEndorserAddr endorserAddr;
endorserAddr.m_nHandleID = this->AllocHandleID();
endorserAddr.m_strIpAddr = *it->m_IpAddr;
endorserAddr.m_nPort = *it->m_port;
if (pVbhPeer)
{
pVbhPeer->m_lstEndorserAddr.push_back(endorserAddr);
}
else
{
DSC_RUN_LOG_ERROR("invalid PEER_ID value: %d", *it->m_peerID);
return -1;
}
}
return 0;
}
void CVbhCryptClientService::OnReady(void)
{
m_bReady = true;
if (m_pCallback)
{
m_pCallback->OnReady();
}
}
void CVbhCryptClientService::OnAbnormal(void)
{
m_bReady = false;
if (m_pCallback)
{
m_pCallback->OnAbnormal();
}
}
void CVbhCryptClientService::OnRegistUserRsp(const ACE_INT32 nReturnCode, ACE_INT32 nChannelID, DSC::CDscBlob& userKey, DSC::CDscBlob& cryptKey, DSC::CDscBlob& genUserKey)
{
VBH_SDK::CRegistUserRsp rsp;
rsp.m_nReturnCode = nReturnCode;
rsp.m_nChannelID = nChannelID;
rsp.m_pUserKey = userKey.GetBuffer();
rsp.m_nUserKeyLen = userKey.GetSize();
rsp.m_pCryptUserKey = cryptKey.GetBuffer();
rsp.m_nCryptUserKeyLen = cryptKey.GetSize();
rsp.m_pGenUserKey = genUserKey.GetBuffer();
rsp.m_nGenUserKeyLen = genUserKey.GetSize();
m_pCallback->OnRegistUserRsp(rsp);
}
void CVbhCryptClientService::OnUnRegistUserRsp(const ACE_INT32 nReturnCode, ACE_INT32 nChannelID, DSC::CDscBlob& userKey)
{
VBH_SDK::CUnRegistUserRsp rsp;
rsp.m_nReturnCode = nReturnCode;
rsp.m_nChannelID = nChannelID;
rsp.m_pUserKey = userKey.GetBuffer();
rsp.m_nUserKeyLen = userKey.GetSize();
m_pCallback->OnUnRegistUserRsp(rsp);
}
void CVbhCryptClientService::OnProposeRsp(const ACE_INT32 nReturnCode, ACE_INT32 nChannelID, DSC::CDscBlob& userKey, DSC::CDscBlob& transKey)
{
VBH_SDK::CProposeRsp rsp;
rsp.m_nReturnCode = nReturnCode;
rsp.m_nChannelID = nChannelID;
rsp.m_pUserKey = userKey.GetBuffer();
rsp.m_nUserKeyLen = userKey.GetSize();
rsp.m_pTransKey = transKey.GetBuffer();
rsp.m_nTransKeyLen = transKey.GetSize();
m_pCallback->OnLaunchTransRsp(rsp);
}
void CVbhCryptClientService::OnGetUserInfoRsp(const ACE_INT32 nReturnCode, ACE_INT32 nChannelID, DSC::CDscBlob& userKey, DSC::CDscBlob& userInfo)
{
VBH_SDK::CGetUserInfoRsp rsp;
rsp.m_nReturnCode = nReturnCode;
rsp.m_nChannelID = nChannelID;
rsp.m_pUserKey = userKey.GetBuffer();
rsp.m_nUserKeyLen = userKey.GetSize();
rsp.m_pUserUserInfo = userInfo.GetBuffer();
rsp.m_nUserUserInfoLen = userInfo.GetSize();
m_pCallback->OnGetUserInfoRsp(rsp);
}
void CVbhCryptClientService::OnGetTransInfoRsp(const ACE_INT32 nReturnCode, ACE_INT32 nChannelID, DSC::CDscBlob& userKey, DSC::CDscBlob& transKey, DSC::CDscBlob& transInfo)
{
VBH_SDK::CGetTransactionInfoRsp rsp;
rsp.m_nReturnCode = nReturnCode;
rsp.m_nChannelID = nChannelID;
rsp.m_pUserKey = userKey.GetBuffer();
rsp.m_nUserKeyLen = userKey.GetSize();
rsp.m_pTransKey = transKey.GetBuffer();
rsp.m_nTransKeyLen = transKey.GetSize();
rsp.m_pTransInfo = transInfo.GetBuffer();
rsp.m_nTransInfoLen = transInfo.GetSize();
m_pCallback->OnGetTransInfoRsp(rsp);
}
|
[
"coreteam@tafchain.com"
] |
coreteam@tafchain.com
|
cab1a99e67c1bd9a48e571d4b578cdf6be94b763
|
3841f7991232e02c850b7e2ff6e02712e9128b17
|
/小浪底泥沙三维/EV_Xld/jni/src/EV_SpatialIndex_Java/wrapper/octree/baseoctreemanager_wrapperjava.cpp
|
40a00b8feaa24cf715ad104598bfbe1917da3c5b
|
[] |
no_license
|
15831944/BeijingEVProjects
|
62bf734f1cb0a8be6fed42cf6b207f9dbdf99e71
|
3b5fa4c4889557008529958fc7cb51927259f66e
|
refs/heads/master
| 2021-07-22T14:12:15.106616
| 2017-10-15T11:33:06
| 2017-10-15T11:33:06
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 735
|
cpp
|
/* This file is produced by the JNI AutoWrapper Utility
Copyright (c) 2012 by EarthView Image Inc */
#include "spatialindex/octree/baseoctreemanager.h"
#include <jni.h>
#include "core_java/global_reference.h"
#include "core_java/jni_load.h"
#include <typeinfo>
namespace EarthView
{
namespace World
{
namespace Spatial
{
namespace Octree
{
extern "C" JNIEXPORT jintArray JNICALL Java_com_earthview_world_spatial_octree_OctreeManagerTypeHelper_getEnumValues (JNIEnv *__env, jclass __clazz)
{
jint enum_values[] = {
OMT_NULL,
OMT_DB,
OMT_Web
};
jintArray array = __env->NewIntArray(3);
__env->SetIntArrayRegion(array, 0, 3, enum_values);
return array;
}
}
}
}
}
|
[
"yanguanqi@aliyun.com"
] |
yanguanqi@aliyun.com
|
6953d212f934d20826e01bbdbc497903af2f27a6
|
1e3da17ce5d361ebc72375afc2598ba025cdc7d8
|
/myitem.cpp
|
2231f1d681c9cb8a2ececa923922c7d0b0e2f3e7
|
[] |
no_license
|
wehao/MyMaterial
|
dd707d9693c70acdef9610bee805856e68d5993f
|
5aba573c12f803fa9c20fbd4c53f53c7720420d0
|
refs/heads/master
| 2020-09-22T13:38:28.468923
| 2016-09-09T09:01:56
| 2016-09-09T09:01:56
| 67,687,674
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 677
|
cpp
|
#include "myitem.h"
#include <QColor>
#include <QPen>
#include <QPainter>
MyItem::MyItem(QQuickItem *parent)
:QQuickPaintedItem(parent)
{ }
QColor MyItem::color()const
{
return m_color;
}
void MyItem::setColor(const QColor &color)
{
if(color != m_color)
m_color = color;
//emit(colorChanged);
}
void MyItem::paint(QPainter *painter)
{
QPen pen(m_color, 2);
painter->setPen(pen);
painter->setRenderHints(QPainter::Antialiasing, true);
painter->drawEllipse(QRect(0,0,300,300));
painter->drawArc(50,50,100,100,30 * 16,120 * 16);
painter->drawArc(150,50,100,100,30 * 16,120 * 16);
painter->drawArc(100,170,100,80,-0,-2880);
}
|
[
"chenweihao@flyaudio.cn"
] |
chenweihao@flyaudio.cn
|
9d391ea300ac6ea4931f047e7d7bb3a93fd18d49
|
fbdc06812e06e27746cf171398b6b740084c99d9
|
/ClassNObjects/person_deepCpy/main.cpp
|
c76066596b0959b7a3c5aabebc57e18a23721a29
|
[] |
no_license
|
frozenbanana/DV1497
|
dd7fbb6a9e4e560bb22ed62f9e02c108554a0056
|
038707c9932f1f32b3c113d10a31301b42c4c9a2
|
refs/heads/master
| 2021-01-10T11:06:32.322934
| 2016-02-27T20:17:55
| 2016-02-27T20:17:55
| 50,668,307
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 197
|
cpp
|
#include "person.h"
int main(){
Person p1("Eva", 23);
p1.introduce();
Person p2 = p1;
p2.introduce();
p1.changeNameAndAge("sara",80);
p1.introduce();
p2.introduce();
return 0;
}
|
[
"henrybergstrom1@gmail.com"
] |
henrybergstrom1@gmail.com
|
39f7ddfa235d48cc9d1dd32fa8ec7e16b0080c2c
|
230b7714d61bbbc9a75dd9adc487706dffbf301e
|
/base/fuchsia/scoped_service_binding_unittest.cc
|
3858ae2b268557ec2a9d2194718a200271577f27
|
[
"BSD-3-Clause"
] |
permissive
|
byte4byte/cloudretro
|
efe4f8275f267e553ba82068c91ed801d02637a7
|
4d6e047d4726c1d3d1d119dfb55c8b0f29f6b39a
|
refs/heads/master
| 2023-02-22T02:59:29.357795
| 2021-01-25T02:32:24
| 2021-01-25T02:32:24
| 197,294,750
| 1
| 2
|
BSD-3-Clause
| 2019-09-11T19:35:45
| 2019-07-17T01:48:48
| null |
UTF-8
|
C++
| false
| false
| 4,006
|
cc
|
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "base/fuchsia/scoped_service_binding.h"
#include "base/fuchsia/service_directory_test_base.h"
#include "base/run_loop.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace base {
namespace fuchsia {
class ScopedServiceBindingTest : public ServiceDirectoryTestBase {};
// Verifies that ScopedServiceBinding allows connection more than once.
TEST_F(ScopedServiceBindingTest, ConnectTwice) {
auto stub = public_service_directory_client_
->ConnectToService<testfidl::TestInterface>();
auto stub2 = public_service_directory_client_
->ConnectToService<testfidl::TestInterface>();
VerifyTestInterface(&stub, ZX_OK);
VerifyTestInterface(&stub2, ZX_OK);
}
// Verify that if we connect twice to a prefer-new bound service, the existing
// connection gets closed.
TEST_F(ScopedServiceBindingTest, SingleClientPreferNew) {
// Teardown the default multi-client binding and create a prefer-new one.
service_binding_ = nullptr;
ScopedSingleClientServiceBinding<testfidl::TestInterface,
ScopedServiceBindingPolicy::kPreferNew>
binding(service_directory_.get(), &test_service_);
// Connect the first client, and verify that it is functional.
auto existing_client = public_service_directory_client_
->ConnectToService<testfidl::TestInterface>();
VerifyTestInterface(&existing_client, ZX_OK);
// Connect the second client, so the existing one should be disconnected and
// the new should be functional.
auto new_client = public_service_directory_client_
->ConnectToService<testfidl::TestInterface>();
RunLoop().RunUntilIdle();
EXPECT_FALSE(existing_client);
VerifyTestInterface(&new_client, ZX_OK);
}
// Verify that if we connect twice to a prefer-existing bound service, the new
// connection gets closed.
TEST_F(ScopedServiceBindingTest, SingleClientPreferExisting) {
// Teardown the default multi-client binding and create a prefer-existing one.
service_binding_ = nullptr;
ScopedSingleClientServiceBinding<testfidl::TestInterface,
ScopedServiceBindingPolicy::kPreferExisting>
binding(service_directory_.get(), &test_service_);
// Connect the first client, and verify that it is functional.
auto existing_client = public_service_directory_client_
->ConnectToService<testfidl::TestInterface>();
VerifyTestInterface(&existing_client, ZX_OK);
// Connect the second client, then verify that the it gets closed and the
// existing one remains functional.
auto new_client = public_service_directory_client_
->ConnectToService<testfidl::TestInterface>();
RunLoop().RunUntilIdle();
EXPECT_FALSE(new_client);
VerifyTestInterface(&existing_client, ZX_OK);
}
// Verify that the default single-client binding policy is prefer-new.
TEST_F(ScopedServiceBindingTest, SingleClientDefaultIsPreferNew) {
// Teardown the default multi-client binding and create a prefer-new one.
service_binding_ = nullptr;
ScopedSingleClientServiceBinding<testfidl::TestInterface> binding(
service_directory_.get(), &test_service_);
// Connect the first client, and verify that it is functional.
auto existing_client = public_service_directory_client_
->ConnectToService<testfidl::TestInterface>();
VerifyTestInterface(&existing_client, ZX_OK);
// Connect the second client, so the existing one should be disconnected and
// the new should be functional.
auto new_client = public_service_directory_client_
->ConnectToService<testfidl::TestInterface>();
RunLoop().RunUntilIdle();
EXPECT_FALSE(existing_client);
VerifyTestInterface(&new_client, ZX_OK);
}
} // namespace fuchsia
} // namespace base
|
[
"commit-bot@chromium.org"
] |
commit-bot@chromium.org
|
cd51c3de098f0c8c54651644691252f5d3edd2c9
|
dfd47d4de1169f0a390e94a53711345918a2d8d6
|
/Patrick_Schoonheym/firstProject/mainwindow.h
|
0d8325e11f02642ae552ed137264ec41369788c7
|
[] |
no_license
|
CasperTI/THO78-Roborescue
|
b801e83ec96d1c658296a6cee7019f67aad4ac60
|
54e3e3711560afbeb7d6637f4e3024e9e4addd4f
|
refs/heads/master
| 2021-01-16T18:44:06.105845
| 2015-03-13T11:14:06
| 2015-03-13T11:14:06
| 32,157,567
| 0
| 0
| null | 2015-03-13T13:33:21
| 2015-03-13T13:33:21
| null |
UTF-8
|
C++
| false
| false
| 655
|
h
|
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QFileDialog>
#include <iostream>
#include <vector>
#include <string>
#include "map.h"
#include "gui.h"
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
void addImage(const QString & name);
private slots:
void on_openFileButton_clicked();
void on_StartButton_clicked();
private:
Ui::MainWindow *ui;
std::vector<QPixmap> images;
std::vector<Gui*> guis;
QPoint SCREEN_SIZE;
QString mapName;
Map* map;
};
#endif // MAINWINDOW_H
|
[
"patrick.schoonheym@student.hu.nl"
] |
patrick.schoonheym@student.hu.nl
|
27e41edc52da76cff9568496deca3651572d7f62
|
1003b415e50030887aaefd3d01f914ebec6cf69d
|
/src/currentia/core/scheduler/policy/scheduling-policy.h
|
e9b69d260498de09bf1a63260ef5e20f68679abc
|
[] |
no_license
|
mooz/currentia
|
dd61872a53b51c9902fa08b601ed1b24af669891
|
5d52dcfc441340f149b591a377cb7be5d91d2b69
|
refs/heads/master
| 2016-09-06T17:52:54.737166
| 2014-11-20T14:06:16
| 2014-11-20T14:06:16
| 26,914,125
| 1
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,380
|
h
|
// -*- c++ -*-
#ifndef CURRENTIA_SCHEDULING_POLICY_H_
#define CURRENTIA_SCHEDULING_POLICY_H_
#include "currentia/core/operator/operator.h"
#include "currentia/core/operator/operator-visitor-serializer.h"
#include "currentia/trait/pointable.h"
namespace currentia {
class SchedulingPolicy : public Pointable<SchedulingPolicy> {
protected:
Operator::ptr_t root_operator_;
const std::vector<Operator*> operators_;
int number_of_operators_;
public:
SchedulingPolicy(const Operator::ptr_t& root_operator):
root_operator_(root_operator),
operators_(OperatorVisitorSerializer::serialize_tree(root_operator)),
number_of_operators_(operators_.size()) {
}
virtual Operator* get_next_operator() = 0;
virtual ~SchedulingPolicy() = 0;
virtual void reset() {}
};
SchedulingPolicy::~SchedulingPolicy() {};
// We should arrange a factory class per a policy
class SchedulingPolicyFactory : public Pointable<SchedulingPolicyFactory> {
public:
SchedulingPolicyFactory() {}
virtual SchedulingPolicy*
create_policy_in_heap(const Operator::ptr_t& root_operator) const = 0;
virtual ~SchedulingPolicyFactory() = 0;
};
SchedulingPolicyFactory::~SchedulingPolicyFactory() {};
}
#endif /* ! CURRENTIA_SCHEDULING_POLICY_H_ */
|
[
"stillpedant@gmail.com"
] |
stillpedant@gmail.com
|
9e731a7d60aac5a81ef0c65a747eb1d895b31af1
|
8cf18bc9ae140963f8f6b28045b28b7b9a590b11
|
/qwt/src/qwt_dial.cpp
|
1ca80dbce41b5f3718b6a4fa32c7fd985f8557a2
|
[
"Apache-2.0",
"LGPL-2.1-only",
"Qwt-exception-1.0"
] |
permissive
|
sergrt/Gen61850Sv
|
8163759f980368da8f1a8379f994d7ca8cbcb717
|
f07de932a16d2a6ca9a482633fa60b97042ed3f9
|
refs/heads/master
| 2023-07-22T12:46:47.643745
| 2023-07-11T20:24:51
| 2023-07-11T20:24:51
| 47,840,893
| 9
| 7
|
Apache-2.0
| 2022-06-30T08:47:34
| 2015-12-11T17:28:03
|
C++
|
UTF-8
|
C++
| false
| false
| 19,506
|
cpp
|
/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
* Qwt Widget Library
* Copyright (C) 1997 Josef Wilgen
* Copyright (C) 2002 Uwe Rathmann
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the Qwt License, Version 1.0
*****************************************************************************/
#include "qwt_dial.h"
#include "qwt_dial_needle.h"
#include "qwt_math.h"
#include "qwt_scale_engine.h"
#include "qwt_scale_map.h"
#include "qwt_round_scale_draw.h"
#include "qwt_painter.h"
#include <qpainter.h>
#include <qpalette.h>
#include <qpixmap.h>
#include <qevent.h>
#include <qalgorithms.h>
#include <qmath.h>
#include <qstyle.h>
#include <qstyleoption.h>
#include <qapplication.h>
static inline double qwtAngleDist( double a1, double a2 )
{
double dist = qAbs( a2 - a1 );
if ( dist > 360.0 )
dist -= 360.0;
return dist;
}
static inline bool qwtIsOnArc( double angle, double min, double max )
{
if ( min < max )
{
return ( angle >= min ) && ( angle <= max );
}
else
{
return ( angle >= min ) || ( angle <= max );
}
}
static inline double qwtBoundedAngle( double min, double angle, double max )
{
double from = qwtNormalizeDegrees( min );
double to = qwtNormalizeDegrees( max );
double a;
if ( qwtIsOnArc( angle, from, to ) )
{
a = angle;
if ( a < min )
a += 360.0;
}
else
{
if ( qwtAngleDist( angle, from ) <
qwtAngleDist( angle, to ) )
{
a = min;
}
else
{
a = max;
}
}
return a;
}
class QwtDial::PrivateData
{
public:
PrivateData():
frameShadow( Sunken ),
lineWidth( 0 ),
mode( RotateNeedle ),
origin( 90.0 ),
minScaleArc( 0.0 ),
maxScaleArc( 0.0 ),
needle( NULL ),
arcOffset( 0.0 ),
mouseOffset( 0.0 )
{
}
~PrivateData()
{
delete needle;
}
Shadow frameShadow;
int lineWidth;
QwtDial::Mode mode;
double origin;
double minScaleArc;
double maxScaleArc;
double scalePenWidth;
QwtDialNeedle *needle;
double arcOffset;
double mouseOffset;
QPixmap pixmapCache;
};
/*!
\brief Constructor
\param parent Parent widget
Create a dial widget with no needle. The scale is initialized
to [ 0.0, 360.0 ] and 360 steps ( QwtAbstractSlider::setTotalSteps() ).
The origin of the scale is at 90°,
The value is set to 0.0.
The default mode is QwtDial::RotateNeedle.
*/
QwtDial::QwtDial( QWidget* parent ):
QwtAbstractSlider( parent )
{
d_data = new PrivateData;
setFocusPolicy( Qt::TabFocus );
QPalette p = palette();
for ( int i = 0; i < QPalette::NColorGroups; i++ )
{
const QPalette::ColorGroup colorGroup =
static_cast<QPalette::ColorGroup>( i );
// Base: background color of the circle inside the frame.
// WindowText: background color of the circle inside the scale
p.setColor( colorGroup, QPalette::WindowText,
p.color( colorGroup, QPalette::Base ) );
}
setPalette( p );
QwtRoundScaleDraw* scaleDraw = new QwtRoundScaleDraw();
scaleDraw->setRadius( 0 );
setScaleDraw( scaleDraw );
setScaleArc( 0.0, 360.0 ); // scale as a full circle
setScaleMaxMajor( 10 );
setScaleMaxMinor( 5 );
setValue( 0.0 );
}
//! Destructor
QwtDial::~QwtDial()
{
delete d_data;
}
/*!
Sets the frame shadow value from the frame style.
\param shadow Frame shadow
\sa setLineWidth(), QFrame::setFrameShadow()
*/
void QwtDial::setFrameShadow( Shadow shadow )
{
if ( shadow != d_data->frameShadow )
{
invalidateCache();
d_data->frameShadow = shadow;
if ( lineWidth() > 0 )
update();
}
}
/*!
\return Frame shadow
/sa setFrameShadow(), lineWidth(), QFrame::frameShadow()
*/
QwtDial::Shadow QwtDial::frameShadow() const
{
return d_data->frameShadow;
}
/*!
Sets the line width of the frame
\param lineWidth Line width
\sa setFrameShadow()
*/
void QwtDial::setLineWidth( int lineWidth )
{
if ( lineWidth < 0 )
lineWidth = 0;
if ( d_data->lineWidth != lineWidth )
{
invalidateCache();
d_data->lineWidth = lineWidth;
update();
}
}
/*!
\return Line width of the frame
\sa setLineWidth(), frameShadow(), lineWidth()
*/
int QwtDial::lineWidth() const
{
return d_data->lineWidth;
}
/*!
\return bounding rectangle of the circle inside the frame
\sa setLineWidth(), scaleInnerRect(), boundingRect()
*/
QRect QwtDial::innerRect() const
{
const int lw = lineWidth();
return boundingRect().adjusted( lw, lw, -lw, -lw );
}
/*!
\return bounding rectangle of the dial including the frame
\sa setLineWidth(), scaleInnerRect(), innerRect()
*/
QRect QwtDial::boundingRect() const
{
const QRect cr = contentsRect();
const double dim = qMin( cr.width(), cr.height() );
QRect inner( 0, 0, dim, dim );
inner.moveCenter( cr.center() );
return inner;
}
/*!
\return rectangle inside the scale
\sa setLineWidth(), boundingRect(), innerRect()
*/
QRect QwtDial::scaleInnerRect() const
{
QRect rect = innerRect();
const QwtAbstractScaleDraw *sd = scaleDraw();
if ( sd )
{
int scaleDist = qCeil( sd->extent( font() ) );
scaleDist++; // margin
rect.adjust( scaleDist, scaleDist, -scaleDist, -scaleDist );
}
return rect;
}
/*!
\brief Change the mode of the dial.
\param mode New mode
In case of QwtDial::RotateNeedle the needle is rotating, in case of
QwtDial::RotateScale, the needle points to origin()
and the scale is rotating.
The default mode is QwtDial::RotateNeedle.
\sa mode(), setValue(), setOrigin()
*/
void QwtDial::setMode( Mode mode )
{
if ( mode != d_data->mode )
{
invalidateCache();
d_data->mode = mode;
sliderChange();
}
}
/*!
\return Mode of the dial.
\sa setMode(), origin(), setScaleArc(), value()
*/
QwtDial::Mode QwtDial::mode() const
{
return d_data->mode;
}
/*!
Invalidate the internal caches used to speed up repainting
*/
void QwtDial::invalidateCache()
{
d_data->pixmapCache = QPixmap();
}
/*!
Paint the dial
\param event Paint event
*/
void QwtDial::paintEvent( QPaintEvent *event )
{
QPainter painter( this );
painter.setClipRegion( event->region() );
QStyleOption opt;
opt.init(this);
style()->drawPrimitive(QStyle::PE_Widget, &opt, &painter, this);
if ( d_data->mode == QwtDial::RotateScale )
{
painter.save();
painter.setRenderHint( QPainter::Antialiasing, true );
drawContents( &painter );
painter.restore();
}
const QRect r = contentsRect();
if ( r.size() != d_data->pixmapCache.size() )
{
d_data->pixmapCache = QwtPainter::backingStore( this, r.size() );
d_data->pixmapCache.fill( Qt::transparent );
QPainter p( &d_data->pixmapCache );
p.setRenderHint( QPainter::Antialiasing, true );
p.translate( -r.topLeft() );
if ( d_data->mode != QwtDial::RotateScale )
drawContents( &p );
if ( lineWidth() > 0 )
drawFrame( &p );
if ( d_data->mode != QwtDial::RotateNeedle )
drawNeedle( &p );
}
painter.drawPixmap( r.topLeft(), d_data->pixmapCache );
if ( d_data->mode == QwtDial::RotateNeedle )
drawNeedle( &painter );
if ( hasFocus() )
drawFocusIndicator( &painter );
}
/*!
Draw the focus indicator
\param painter Painter
*/
void QwtDial::drawFocusIndicator( QPainter *painter ) const
{
QwtPainter::drawFocusRect( painter, this, boundingRect() );
}
/*!
Draw the frame around the dial
\param painter Painter
\sa lineWidth(), frameShadow()
*/
void QwtDial::drawFrame( QPainter *painter )
{
QwtPainter::drawRoundFrame( painter, boundingRect(),
palette(), lineWidth(), d_data->frameShadow );
}
/*!
\brief Draw the contents inside the frame
QPalette::Window is the background color outside of the frame.
QPalette::Base is the background color inside the frame.
QPalette::WindowText is the background color inside the scale.
\param painter Painter
\sa boundingRect(), innerRect(),
scaleInnerRect(), QWidget::setPalette()
*/
void QwtDial::drawContents( QPainter *painter ) const
{
if ( testAttribute( Qt::WA_NoSystemBackground ) ||
palette().brush( QPalette::Base ) !=
palette().brush( QPalette::Window ) )
{
const QRectF br = boundingRect();
painter->save();
painter->setPen( Qt::NoPen );
painter->setBrush( palette().brush( QPalette::Base ) );
painter->drawEllipse( br );
painter->restore();
}
const QRectF insideScaleRect = scaleInnerRect();
if ( palette().brush( QPalette::WindowText ) !=
palette().brush( QPalette::Base ) )
{
painter->save();
painter->setPen( Qt::NoPen );
painter->setBrush( palette().brush( QPalette::WindowText ) );
painter->drawEllipse( insideScaleRect );
painter->restore();
}
const QPointF center = insideScaleRect.center();
const double radius = 0.5 * insideScaleRect.width();
painter->save();
drawScale( painter, center, radius );
painter->restore();
painter->save();
drawScaleContents( painter, center, radius );
painter->restore();
}
/*!
Draw the needle
\param painter Painter
\param center Center of the dial
\param radius Length for the needle
\param direction Direction of the needle in degrees, counter clockwise
\param colorGroup ColorGroup
*/
void QwtDial::drawNeedle( QPainter *painter, const QPointF ¢er,
double radius, double direction, QPalette::ColorGroup colorGroup ) const
{
if ( d_data->needle )
{
direction = 360.0 - direction; // counter clockwise
d_data->needle->draw( painter, center, radius, direction, colorGroup );
}
}
void QwtDial::drawNeedle( QPainter *painter ) const
{
if ( !isValid() )
return;
QPalette::ColorGroup colorGroup;
if ( isEnabled() )
colorGroup = hasFocus() ? QPalette::Active : QPalette::Inactive;
else
colorGroup = QPalette::Disabled;
const QRectF sr = scaleInnerRect();
painter->save();
painter->setRenderHint( QPainter::Antialiasing, true );
drawNeedle( painter, sr.center(), 0.5 * sr.width(),
scaleMap().transform( value() ) + 270.0, colorGroup );
painter->restore();
}
/*!
Draw the scale
\param painter Painter
\param center Center of the dial
\param radius Radius of the scale
*/
void QwtDial::drawScale( QPainter *painter,
const QPointF ¢er, double radius ) const
{
QwtRoundScaleDraw *sd = const_cast<QwtRoundScaleDraw *>( scaleDraw() );
if ( sd == NULL )
return;
sd->setRadius( radius );
sd->moveCenter( center );
QPalette pal = palette();
const QColor textColor = pal.color( QPalette::Text );
pal.setColor( QPalette::WindowText, textColor ); // ticks, backbone
painter->setFont( font() );
painter->setPen( QPen( textColor, sd->penWidth() ) );
painter->setBrush( Qt::red );
sd->draw( painter, pal );
}
/*!
Draw the contents inside the scale
Paints nothing.
\param painter Painter
\param center Center of the contents circle
\param radius Radius of the contents circle
*/
void QwtDial::drawScaleContents( QPainter *painter,
const QPointF ¢er, double radius ) const
{
Q_UNUSED(painter);
Q_UNUSED(center);
Q_UNUSED(radius);
}
/*!
Set a needle for the dial
\param needle Needle
\warning The needle will be deleted, when a different needle is
set or in ~QwtDial()
*/
void QwtDial::setNeedle( QwtDialNeedle *needle )
{
if ( needle != d_data->needle )
{
if ( d_data->needle )
delete d_data->needle;
d_data->needle = needle;
update();
}
}
/*!
\return needle
\sa setNeedle()
*/
const QwtDialNeedle *QwtDial::needle() const
{
return d_data->needle;
}
/*!
\return needle
\sa setNeedle()
*/
QwtDialNeedle *QwtDial::needle()
{
return d_data->needle;
}
//! \return the scale draw
QwtRoundScaleDraw *QwtDial::scaleDraw()
{
return static_cast<QwtRoundScaleDraw *>( abstractScaleDraw() );
}
//! \return the scale draw
const QwtRoundScaleDraw *QwtDial::scaleDraw() const
{
return static_cast<const QwtRoundScaleDraw *>( abstractScaleDraw() );
}
/*!
Set an individual scale draw
The motivation for setting a scale draw is often
to overload QwtRoundScaleDraw::label() to return
individual tick labels.
\param scaleDraw Scale draw
\warning The previous scale draw is deleted
*/
void QwtDial::setScaleDraw( QwtRoundScaleDraw *scaleDraw )
{
setAbstractScaleDraw( scaleDraw );
sliderChange();
}
/*!
Change the arc of the scale
\param minArc Lower limit
\param maxArc Upper limit
\sa minScaleArc(), maxScaleArc()
*/
void QwtDial::setScaleArc( double minArc, double maxArc )
{
if ( minArc != 360.0 && minArc != -360.0 )
minArc = ::fmod( minArc, 360.0 );
if ( maxArc != 360.0 && maxArc != -360.0 )
maxArc = ::fmod( maxArc, 360.0 );
double minScaleArc = qMin( minArc, maxArc );
double maxScaleArc = qMax( minArc, maxArc );
if ( maxScaleArc - minScaleArc > 360.0 )
maxScaleArc = minScaleArc + 360.0;
if ( ( minScaleArc != d_data->minScaleArc ) ||
( maxScaleArc != d_data->maxScaleArc ) )
{
d_data->minScaleArc = minScaleArc;
d_data->maxScaleArc = maxScaleArc;
invalidateCache();
sliderChange();
}
}
/*!
Set the lower limit for the scale arc
\param min Lower limit of the scale arc
\sa setScaleArc(), setMaxScaleArc()
*/
void QwtDial::setMinScaleArc( double min )
{
setScaleArc( min, d_data->maxScaleArc );
}
/*!
\return Lower limit of the scale arc
\sa setScaleArc()
*/
double QwtDial::minScaleArc() const
{
return d_data->minScaleArc;
}
/*!
Set the upper limit for the scale arc
\param max Upper limit of the scale arc
\sa setScaleArc(), setMinScaleArc()
*/
void QwtDial::setMaxScaleArc( double max )
{
setScaleArc( d_data->minScaleArc, max );
}
/*!
\return Upper limit of the scale arc
\sa setScaleArc()
*/
double QwtDial::maxScaleArc() const
{
return d_data->maxScaleArc;
}
/*!
\brief Change the origin
The origin is the angle where scale and needle is relative to.
\param origin New origin
\sa origin()
*/
void QwtDial::setOrigin( double origin )
{
invalidateCache();
d_data->origin = origin;
sliderChange();
}
/*!
The origin is the angle where scale and needle is relative to.
\return Origin of the dial
\sa setOrigin()
*/
double QwtDial::origin() const
{
return d_data->origin;
}
/*!
\return Size hint
\sa minimumSizeHint()
*/
QSize QwtDial::sizeHint() const
{
int sh = 0;
if ( scaleDraw() )
sh = qCeil( scaleDraw()->extent( font() ) );
const int d = 6 * sh + 2 * lineWidth();
QSize hint( d, d );
if ( !isReadOnly() )
hint = hint.expandedTo( QApplication::globalStrut() );
return hint;
}
/*!
\return Minimum size hint
\sa sizeHint()
*/
QSize QwtDial::minimumSizeHint() const
{
int sh = 0;
if ( scaleDraw() )
sh = qCeil( scaleDraw()->extent( font() ) );
const int d = 3 * sh + 2 * lineWidth();
return QSize( d, d );
}
/*!
\brief Determine what to do when the user presses a mouse button.
\param pos Mouse position
\retval True, when the inner circle contains pos
\sa scrolledTo()
*/
bool QwtDial::isScrollPosition( const QPoint &pos ) const
{
const QRegion region( innerRect(), QRegion::Ellipse );
if ( region.contains( pos ) && ( pos != innerRect().center() ) )
{
double angle = QLineF( rect().center(), pos ).angle();
if ( d_data->mode == QwtDial::RotateScale )
angle = 360.0 - angle;
double valueAngle =
qwtNormalizeDegrees( 90.0 - scaleMap().transform( value() ) );
d_data->mouseOffset = qwtNormalizeDegrees( angle - valueAngle );
d_data->arcOffset = scaleMap().p1();
return true;
}
return false;
}
/*!
\brief Determine the value for a new position of the
slider handle.
\param pos Mouse position
\return Value for the mouse position
\sa isScrollPosition()
*/
double QwtDial::scrolledTo( const QPoint &pos ) const
{
double angle = QLineF( rect().center(), pos ).angle();
if ( d_data->mode == QwtDial::RotateScale )
{
angle += scaleMap().p1() - d_data->arcOffset;
angle = 360.0 - angle;
}
angle = qwtNormalizeDegrees( angle - d_data->mouseOffset );
angle = qwtNormalizeDegrees( 90.0 - angle );
if ( scaleMap().pDist() >= 360.0 )
{
if ( angle < scaleMap().p1() )
angle += 360.0;
if ( !wrapping() )
{
double boundedAngle = angle;
const double arc = angle - scaleMap().transform( value() );
if ( qAbs( arc ) > 180.0 )
{
boundedAngle = ( arc > 0 )
? scaleMap().p1() : scaleMap().p2();
}
d_data->mouseOffset += ( boundedAngle - angle );
angle = boundedAngle;
}
}
else
{
const double boundedAngle =
qwtBoundedAngle( scaleMap().p1(), angle, scaleMap().p2() );
if ( !wrapping() )
d_data->mouseOffset += ( boundedAngle - angle );
angle = boundedAngle;
}
return scaleMap().invTransform( angle );
}
/*!
Change Event handler
\param event Change event
Invalidates internal paint caches if necessary
*/
void QwtDial::changeEvent( QEvent *event )
{
switch( event->type() )
{
case QEvent::EnabledChange:
case QEvent::FontChange:
case QEvent::StyleChange:
case QEvent::PaletteChange:
case QEvent::LanguageChange:
case QEvent::LocaleChange:
{
invalidateCache();
break;
}
default:
break;
}
QwtAbstractSlider::changeEvent( event );
}
/*!
Wheel Event handler
\param event Wheel event
*/
void QwtDial::wheelEvent( QWheelEvent *event )
{
const QRegion region( innerRect(), QRegion::Ellipse );
if ( region.contains( event->pos() ) )
QwtAbstractSlider::wheelEvent( event );
}
void QwtDial::setAngleRange( double angle, double span )
{
QwtRoundScaleDraw *sd = const_cast<QwtRoundScaleDraw *>( scaleDraw() );
if ( sd )
{
angle = qwtNormalizeDegrees( angle - 270.0 );
sd->setAngleRange( angle, angle + span );
}
}
/*!
Invalidate the internal caches and call
QwtAbstractSlider::scaleChange()
*/
void QwtDial::scaleChange()
{
invalidateCache();
QwtAbstractSlider::scaleChange();
}
void QwtDial::sliderChange()
{
setAngleRange( d_data->origin + d_data->minScaleArc,
d_data->maxScaleArc - d_data->minScaleArc );
if ( mode() == RotateScale )
{
const double arc = scaleMap().transform( value() ) - scaleMap().p1();
setAngleRange( d_data->origin - arc,
d_data->maxScaleArc - d_data->minScaleArc );
}
QwtAbstractSlider::sliderChange();
}
|
[
"cookierama@gmail.com"
] |
cookierama@gmail.com
|
4dc6b23c8656e05a965262e96263e7339a6744fa
|
9b7267949e18554a9de9e53c282fcb36bd813f54
|
/Config_Licenses.hpp
|
6ca2fb041dda0978f7dba820f211d98b17e8379f
|
[] |
no_license
|
Kronyxxx/Prices
|
2ac8cb1f9583178fb40f1014e880b76a0e74b7d2
|
e1c2d306eb1102356057432a8fe6b66e59841aa5
|
refs/heads/master
| 2021-01-20T17:50:49.244372
| 2016-06-27T20:04:09
| 2016-06-27T20:04:09
| 62,008,386
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 4,003
|
hpp
|
/*
* class:
* variable = Variable Name
* displayName = License Name
* price = License Price
* illegal = Illegal License
* side = side indicator
*/
class Licenses {
//Civilian Licenses
class driver {
variable = "driver";
displayName = "STR_License_Driver";
price = 250;
illegal = false;
side = "civ";
};
class boat {
variable = "boat";
displayName = "STR_License_Boat";
price = 450;
illegal = false;
side = "civ";
};
class pilot {
variable = "pilot";
displayName = "STR_License_Pilot";
price = 2500;
illegal = false;
side = "civ";
};
class trucking {
variable = "trucking";
displayName = "STR_License_Truck";
price = 1500;
illegal = false;
side = "civ";
};
class gun {
variable = "gun";
displayName = "STR_License_Firearm";
price = 2500;
illegal = false;
side = "civ";
};
class dive {
variable = "dive";
displayName = "STR_License_Diving";
price = 2500;
illegal = false;
side = "civ";
};
class home {
variable = "home";
displayName = "STR_License_Home";
price = 25000;
illegal = false;
side = "civ";
};
//Processing Licenses
class oil {
variable = "oil";
displayName = "STR_License_Oil";
price = 15000;
illegal = false;
side = "civ";
};
class diamond {
variable = "diamond";
displayName = "STR_License_Diamond";
price = 17500;
illegal = false;
side = "civ";
};
class salt {
variable = "salt";
displayName = "STR_License_Salt";
price = 10000;
illegal = false;
side = "civ";
};
class sand {
variable = "sand";
displayName = "STR_License_Sand";
price = 10000;
illegal = false;
side = "civ";
};
class iron {
variable = "iron";
displayName = "STR_License_Iron";
price = 12500;
illegal = false;
side = "civ";
};
class copper {
variable = "copper";
displayName = "STR_License_Copper";
price = 11500;
illegal = false;
side = "civ";
};
class cement {
variable = "cement";
displayName = "STR_License_Cement";
price = 10000;
illegal = false;
side = "civ";
};
class medmarijuana {
variable = "medmarijuana";
displayName = "STR_License_Medmarijuana";
price = 20000;
illegal = false;
side = "civ";
};
//Illegal Licenses
class cocaine {
variable = "cocaine";
displayName = "STR_License_Cocaine";
price = 10000;
illegal = true;
side = "civ";
};
class heroin {
variable = "heroin";
displayName = "STR_License_Heroin";
price = 12500;
illegal = true;
side = "civ";
};
class marijuana {
variable = "marijuana";
displayName = "STR_License_Marijuana";
price = 7500;
illegal = true;
side = "civ";
};
class rebel {
variable = "rebel";
displayName = "STR_License_Rebel";
price = 5000;
illegal = true;
side = "civ";
};
//Cop Licenses
class cAir {
variable = "cAir";
displayName = "STR_License_Pilot";
price = 25000;
illegal = false;
side = "cop";
};
class cg {
variable = "cg";
displayName = "STR_License_CG";
price = 25000;
illegal = false;
side = "cop";
};
//Medic Licenses
class mAir {
variable = "mAir";
displayName = "STR_License_Pilot";
price = 10000;
illegal = false;
side = "med";
};
};
|
[
"twsmattmcc@gmail.com"
] |
twsmattmcc@gmail.com
|
18db19df85f5a7d0ff702427ee536cb39c350f5a
|
f82a47fb66163fd9ab83ff5e9f4f5ef4e52171c7
|
/src/main/native/calcPeople/MeaCalcFun.h
|
df4515f0ba874097e2afc34cc61db3a6481ede9f
|
[] |
no_license
|
ruby-github/09001color
|
ffc4afc30a187bcbb5528bd0143976840909d489
|
0c637efced23df8dfde1b0a97d61b51cac0a10a0
|
refs/heads/master
| 2021-01-18T03:31:19.785131
| 2017-04-01T10:28:03
| 2017-04-01T10:28:03
| 85,908,115
| 0
| 1
| null | null | null | null |
GB18030
|
C++
| false
| false
| 203,592
|
h
|
#ifndef __MEACALCFUN_H_
#define __MEACALCFUN_H_
#include "calcPeople/MeaResult.h"
#include "display/gui_global.h"
/***************************计算函数**********************************/
class MeaCalcFun {
public:
static int DoNothing(float data[], float *result, int state, int item, int save);
static int CalcGW_LMP(unsigned int LMP_Y, unsigned int LMP_M, unsigned int LMP_D);
static int CalcGW_Ovul(unsigned int LMP_Y, unsigned int LMP_M, unsigned int LMP_D);
static void CalcEDCB_LMP(unsigned int LMP_Y, unsigned int LMP_M, unsigned int LMP_D, char* retval);
static void CalcEDCB_Ovul(unsigned int LMP_Y, unsigned int LMP_M, unsigned int LMP_D, char* retval);
//产科
static int CalcGWMan(CalcInfoTmp *calcInfo, float data[], int item, int save, int *position, const int parPosi);
static int EDCBCalc(CalcInfoTmp *calcInfo, float data[], int item, int save, int *position, const int parPosi);
static int EFWCalc(CalcInfoTmp *calcInfo, float data[], int item, int save, int *position, const int parPosi);
static int SectionCalc(CalcInfoTmp *calcInfo, float data[], int item, int save, int *calcPosi, const int parPosi);
static void InitCustomTable();
static bool SaveCustomTable();
#ifdef VET
static int CalcGWManVet(CalcInfoTmp *calcInfo, float data[], int item, int save, int *position, const int parPosi);
#endif
private:
MeaCalcFun();
~MeaCalcFun();
static MeaResult *m_ptrMeaResult;
static int CalcGWUser(const float data, int *gw, const int obTable[]);
static int CalcGWUser(const float data, int *gw, const int obTable[],int k);
static int CalcGW(const float data, int *gw, const int obTable[]);
static int CalcGW(const float data, int *gw, const int obTable[],int k);
#ifdef VET
static int CalcGWVet(const float data, int *gw, const int obTable[][2]);
#endif
static void CalcAGW(void);
static int EDCB(int gw, int *EDCB);
static int EDCBFormula(const int gpLen, int gw, int *EDCB);
static int EFWGetData(const int item, const int state, const int method, float data[]);
static int CalcGetValue(const float currValue, float value[][MEA_MULTI], const int allItem[], const int currItem, const int itemNums, const int state);
static int CalcGetPar(CalcInfoTmp *calcInfo, const float currValue[], float value[][MEA_MULTI], const int currItem, const int parPosi, const int state);
static float CalcFormula(CalcInfoTmp *calcInfo, float value[][MEA_MULTI]);
static int FindSection(int item, int *section);
static void SetTableMaxMin(int table[]);
static int CalcPSAD(void);
static void CalcEDCB(unsigned int start_year, unsigned int start_month, unsigned int start_day, int dop, char* retval);
};
enum EOBGwMethod {
GW_START, CER_START, CER_GOLDSTEIN = CER_START, CER_USER,
HL_START, HL_JEANTY = HL_START, HL_USER,
BPD_START, BPD_HADLOCK = BPD_START, BPD_MERZ, BPD_LASSER, BPD_REMPEN, BPD_TOKYO, BPD_USER,
FL_START, FL_HADLOCK = FL_START, FL_MERZ, FL_JEANTY, FL_TOKYO, FL_USER,
CRL_START, CRL_HADLOCK =CRL_START, CRL_ROBINSON, CRL_HANSMAN, CRL_LASSER, CRL_TOKYO, CRL_USER,
GS_START, GS_HELLMAN = GS_START, GS_REMPEN, GS_TOKYO, GS_USER,
AC_START, AC_HADLOCK = AC_START, AC_MERZ, AC_LASSER, AC_TOKYO, AC_USER,
HC_START, HC_HADLOCK = HC_START, HC_MERZ, HC_LASSER, HC_USER,
TAD_START, TAD_MERZ = TAD_START, TAD_USER,
APAD_START, APAD_MERZ = APAD_START, APAD_USER,
THD_START, THD_HANDMAN = THD_START, THD_USER,
OFD_START, OFD_KOREAN = OFD_START, OFD_USER,
OOD_START, OOD_JEANTY = OOD_START, OOD_USER,
TIBIA_START, TIBIA_JEANTY = TIBIA_START, TIBIA_USER,
TTD_START, TTD_HANSMANN = TTD_START, TTD_USER,
ULNA_START, ULNA_JEANTY = ULNA_START, ULNA_USER,
FTA_START, FTA_OSAKA = FTA_START, FTA_USER,
GW_END
};
enum EOBEfwMethod {
EFW_START, EFW_HADLOCK1=EFW_START, EFW_HADLOCK2, EFW_HADLOCK3, EFW_HADLOCK4, EFW_SHEPARD, EFW_HANSMAN, EFW_TOKYO, EFW_END
};
const titleUnitInfo VolInfo[] = {{"Diameter", CM}, {"Vol", CM3}, {"\0", NOUNIT}};//VOL_SPHEROID
const titleUnitInfo HrInfo[] = {{"Time", SEC}, {"HR", BPM}, {"\0", NOUNIT}};//HR_D
const titleUnitInfo PgmaxInfo[] = {{"Vmax", CMS}, {"PG max", MMHG}, {"\0", NOUNIT}};//PGMAX
const titleUnitInfo RiInfo[] = {{"PS", CMS}, {"ED", CMS}, {"RI", NOUNIT}, {"\0", NOUNIT}};//RI
const titleUnitInfo PsEdInfo[] = {{"PS", CMS}, {"ED", CMS}, {"\0", NOUNIT}};//PSED
const titleUnitInfo SdInfo[] = {{"PS", CMS}, {"ED", CMS}, {"RI", NOUNIT}, {"S/D", NOUNIT}, {"\0", NOUNIT}};//SD
const titleUnitInfo RationAngleInfo[] = {{"Angle1", ANG}, {"Angle2", ANG}, {"Ratio", NOUNIT}, {"\0", NOUNIT}};//RATIO_ANGLE
const titleUnitInfo SimpsonsEdvInfo[] = {{"LVAd", CM2}, {"LVLd", CM}, {"EDV", CM3}, {"\0", NOUNIT}};//SIMPSONS EDV
const titleUnitInfo SimpsonsEsvInfo[] = {{"LVAs", CM2}, {"LVLs", CM}, {"ESV", CM3}, {"\0", NOUNIT}};//SIMPSONS ESV
const titleUnitInfo AlEdvInfo[] = {{"LVAd", CM2}, {"LVLd", CM}, {"EDV", CM3}, {"\0", NOUNIT}};//AL EDV
const titleUnitInfo AlEsvInfo[] = {{"LVAs", CM2}, {"LVLs", CM}, {"ESV", CM3}, {"\0", NOUNIT}};//AL ESV
const titleUnitInfo SlopeMInfo[] = {{"Dist", CM}, {"Slope", CMS}, {"\0", NOUNIT}};//DIST_SLOPE_M
const titleUnitInfo P12tInfo[] = {{"Vmax", CMS}, {"P1/2t", SEC}, {"Slope", CMS2}, {"\0", NOUNIT}};//P12T
const titleUnitInfo HipInfo[] = {{"α", ANG}, {"β", ANG}, {"\0", NOUNIT}};//HIP
const titleUnitInfo SacInfo[] = {{"Diam1", CM}, {"Diam2", CM},{"Diam3", CM},{"mean Diam",CM}, {"\0", NOUNIT}};//Sac
/******************************Basic Measure**************************************/
#if 1
const MultiItemInfo BasicMultiInfo[] = {
{D2_VOLUME_1DIST, D2_VOLUME_1DIST_MULTI, VOL_SPHEROID, "\0", VolInfo, NULL },
{D_HR, D_HR_MULTI, HR_D, "\0", HrInfo, NULL },
{D_PGMAX, D_PGMAX_MULTI, PGMAX, "\0", PgmaxInfo, NULL },
{D_RI, D_RI_MULTI, RI, "\0", RiInfo, NULL },
{D_SD, D_SD_MULTI, SD, "\0", SdInfo, NULL },//转义字符
{D2_RATIO_ANGLE, D2_RATIO_ANGLE_MULTI, RATIO_ANGLE, "\0", RationAngleInfo, NULL },
};
const SingleItemInfo BasicInfo[] = {
{ D2_DIST_DOT, DIST_DOT, N_("Distance"), CM, NULL},
{ D2_DIST_LINE, DIST_LINE, N_("Dist-2Line"), CM, NULL},
{ D2_LEN_TRACK, LENGTH_TRACK, N_("Length"), CM, NULL},
{ D2_LEN_DOT, LENGTH_DOT, N_("Length-Point"), CM, NULL},
{ D2_AREA_TRACK, AREA_TRACK, N_("Area"), CM2, NULL},
{ D2_AREA_DOT, AREA_DOT, N_("Area-Point"), CM2, NULL},
{ D2_AREA_ELLIPSE, AREA_ELLIPSE, N_("Area-Ellipse"), CM2, NULL},
{ D2_AREA_RECTANGLE, AREA_REC, N_("Area-Rectangle"), CM2, NULL},
{ D2_VOLUME_3DIST, VOL_3AXIS, N_("Volume-3 Dist."), CM3, NULL},
{ D2_VOLUME_ELLIPSE, VOL_ELLIPSE1, N_("Volume"), CM3, NULL},
{ D2_VOLUME_ELLIPSE_1DIST, VOL_ELLIPSE2, N_("Volume-Ellipse 1 Dist."), CM3, NULL},
{ D2_VOLUME_1DIST, VOL_SPHEROID, N_("Volume-1 Dist."), D2_VOLUME_1DIST_MULTI, NULL},
{ D2_ANGLE_DOT, ANGLE_3DOT, N_("Angle-3 Point"), ANG, NULL},
{ D2_ANGLE_LINE, ANGLE_2LINE, N_("Angle"), ANG, NULL},
{ D2_DEPTH, DEPTH_DIST, N_("Depth"), CM, NULL},
{ M_TIME, TIME_M, N_("Time(M)"), SEC, NULL},
{ M_SLOPE, SLOPE, N_("Slope(M)"), CMS, NULL},
{ M_VEL, VEL_M, N_("Vel(M)"), CMS, NULL},
{ M_HR, HR_M, N_("HR(M)"), BPM, NULL},
{ M_DEPTH, DEPTH_DIST_M, N_("Dist(M)"), CM, NULL},
{ D_AUTO_TRACK, VEL_D, N_("Auto Trace(D)"), NOUNIT, NULL},
{ D_MANUAL_TRACK, MEASURE_TRACK, N_("Trace(D)"), NOUNIT, NULL},
{ D_VEL, VEL_D, N_("Velocity(D)"), CMS, NULL},
{ D_RI, RI, N_("RI(D)"), D_RI_MULTI, NULL},
{ D_SD, SD, N_("PS / ED(D)"), D_SD_MULTI, NULL},
{ D_TIME, TIME_D, N_("Time(D)"), SEC, NULL},
{ D_ACCEL, ACCEL, N_("Accel(D)"), CMS2, NULL},
{ D_PI, PI_D, N_("PI(D)"), NOUNIT, NULL},
{ D_HR, HR_D, N_("HR(D)"), D_HR_MULTI, NULL},
{ D_PGMAX, PGMAX, N_("PG max(D)"), D_PGMAX_MULTI, NULL},
{ D_PGMEAN, PGMEAN, N_("PG mean(D)"), MMHG, NULL},
{ D2_ANGUSTY_DIST, ANGUSTY_DIST_DOT, N_("Distance Angusty"), NOUNIT, NULL},
{ D2_RATIO_DIST, RATIO_DIST_DOT, N_("Distance Ratio"), NOUNIT, NULL},
{ D2_ANGUSTY_AREA, ANGUSTY_AREA, N_("Area Angusty"), NOUNIT, NULL},
{ D2_RATIO_AREA, RATIO_AREA, N_("Area Ratio"), NOUNIT, NULL},
{ D2_RATIO_D_P, RATIO_D_P, N_("Dist Peri Ratio"), NOUNIT, NULL},
{ D2_RATIO_VOL, RATIO_VOL, N_("Volume Ratio"), NOUNIT, NULL},
{ D2_RATIO_ANGLE, RATIO_ANGLE, N_("Angle Ratio"), D2_RATIO_ANGLE_MULTI, NULL},
{ D2_EF, EF, N_("EF(M)"), PERCENT, NULL},
{ D2_PROFILE, PROFILE, N_("Profile"), NOUNIT, NULL},
{ D2_HISTOGRAM, HISTOGRAM, N_("Histogram"), NOUNIT, NULL},
{ D2_IMT, MEA_TYPE_END, N_("IMT"),UNIT_END, NULL},
{ D2_IMT_ABOVE, IMT_ABOVE, N_("IMT-Above"),UNIT_END, NULL},
{ D2_IMT_BELOW, IMT_BELOW, N_("IMT-Below"),UNIT_END, NULL},
};
#endif
/******************************Abdo Measure**************************************/
const CalcResultInfo AbdoGBVol = {ABD_GB_VOL, {ABD_GALLBLAD_L, ABD_GALLBLAD_W, ABD_GALLBLAD_H, NO_PAR, NO_PAR}, "GB Vol", CM3, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo AbdoSpleenVol = {ABD_CALC_SPLEEN_VOL, {ABD_SPLEEN_L, ABD_SPLEEN_W, ABD_SPLEEN_H, NO_PAR, NO_PAR}, "Spleen Vol", CM3, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo AbdoPancreasVol = {ABD_PANC_VOL, {ABD_PANCREAS_L, ABD_PANCREAS_W, ABD_PANCREAS_H, NO_PAR, NO_PAR}, "Pancreas Vol", CM3, MeaCalcFun::SectionCalc, NULL};
const CalcInfoArray AbdoGBVolCalc = {&AbdoGBVol, NULL};
const CalcInfoArray AbdoSpleenVolCalc = {&AbdoSpleenVol, NULL};
const CalcInfoArray AbdoPancreasVolCalc = {&AbdoPancreasVol, NULL};
const SingleItemInfo AbdoInfo[] = {
//Abdo General
{ ABD_GALLBLAD_VOL, MEA_TYPE_END, N_("Gallbladder Vol"), UNIT_END, NULL},
{ ABD_GALLBLAD_L, DIST_DOT, N_("Gallbladder L"), CM, &AbdoGBVolCalc},
{ ABD_GALLBLAD_W, DIST_DOT, N_("Gallbladder W"), CM, &AbdoGBVolCalc},
{ ABD_GALLBLAD_H, DIST_DOT, N_("Gallbladder H"), CM, &AbdoGBVolCalc},
{ ABD_CBD_DIAM, DIST_DOT, N_("CBD Diam"), CM, NULL},
{ ABD_GB_WALL, DIST_DOT, N_("GB Wall"), CM, NULL},
{ ABD_LIVER_L, DIST_DOT, N_("Liver L"), CM, NULL},
{ ABD_SPLEEN_VOL, MEA_TYPE_END, N_("Spleen Vol"), UNIT_END, NULL},
{ ABD_SPLEEN_L, DIST_DOT, N_("Spleen L"), CM, &AbdoSpleenVolCalc},
{ ABD_SPLEEN_W, DIST_DOT, N_("Spleen W"), CM, &AbdoSpleenVolCalc},
{ ABD_SPLEEN_H, DIST_DOT, N_("Spleen H"), CM, &AbdoSpleenVolCalc},
{ ABD_PANCREAS_VOL, MEA_TYPE_END, N_("Pancreas Vol"), UNIT_END, NULL},
{ ABD_PANCREAS_L, DIST_DOT, N_("Pancreas L"), CM, &AbdoPancreasVolCalc},
{ ABD_PANCREAS_W, DIST_DOT, N_("Pancreas W"), CM, &AbdoPancreasVolCalc},
{ ABD_PANCREAS_H, DIST_DOT, N_("Pancreas H"), CM, &AbdoPancreasVolCalc},
{ ABD_AO_DIST_DIAM, DIST_DOT, N_("Ao Dist Diam"), CM, NULL},
{ ABD_AO_MID_DIAM, DIST_DOT, N_("Ao Mid Diam"), CM, NULL},
{ ABD_AO_PROX_DIAM, DIST_DOT, N_("Ao Prox Diam"), CM, NULL},
//Abdo Arterial
{ ABD_DIST_AO, PSED, N_("Dist Ao"), ABD_DIST_AO_MULTI, NULL},
{ ABD_CELIAC_A, RI, N_("Celiac A"), ABD_CELIAC_A_MULTI, NULL},
{ ABD_COM_HEP_A, PSED, N_("Com Hep A"), ABD_COM_HEP_A_MULTI, NULL},
{ ABD_L_HEP_A, PSED, N_("L Hep A"), ABD_L_HEP_A_MULTI, NULL},
{ ABD_R_HEP_A, PSED, N_("R Hep A"), ABD_R_HEP_A_MULTI, NULL},
{ ABD_GDA, PSED, N_("GDA"), ABD_GDA_MULTI, NULL},
{ ABD_IMA, RI, N_("IMA"), ABD_IMA_MULTI, NULL},
{ ABD_SMA, RI, N_("SMA"), ABD_SMA_MULTI, NULL},
{ ABD_SPLENIC_A, PSED, N_("Splenic A"), ABD_SPLENIC_A_MULTI, NULL},
//Abdo venous
{ ABD_PROX_IVC, PSED, N_("Prox IVC"), ABD_PROX_IVC_MULTI, NULL},
{ ABD_DIST_IVC, PSED, N_("Dist IVC"), ABD_DIST_IVC_MULTI, NULL},
{ ABD_L_HEP_V, PSED, N_("L Hep V"), ABD_L_HEP_V_MULTI, NULL},
{ ABD_M_HEP_V, PSED, N_("M Hep V"), ABD_M_HEP_V_MULTI, NULL},
{ ABD_R_HEP_V, PSED, N_("R Hep V"), ABD_R_HEP_V_MULTI, NULL},
{ ABD_L_PORT_V, PSED, N_("L Port V"), ABD_L_PORT_V_MULTI, NULL},
{ ABD_M_PORT_V, PSED, N_("M Port V"), ABD_M_PORT_V_MULTI, NULL},
{ ABD_R_PORT_V, PSED, N_("R Port V"), ABD_R_PORT_V_MULTI, NULL},
{ ABD_SPLENIC_V, PSED, N_("Splenic V"), ABD_SPLENIC_V_MULTI, NULL},
{ ABD_IMV, PSED, N_("IMV"), ABD_IMV_MULTI, NULL},
{ ABD_SMV, PSED, N_("SMV"), ABD_SMV_MULTI, NULL},
};
const PtrOfCalcInfo AbdoCalcInfoPtr[ABD_CALC_END - ABD_CALC_START] = {
{ABD_GB_VOL, &AbdoGBVol},
{ABD_CALC_SPLEEN_VOL, &AbdoSpleenVol},
{ABD_PANC_VOL, &AbdoPancreasVol}
};
const MultiItemInfo AbdoMultiInfo[] = {
{ABD_DIST_AO, ABD_DIST_AO_MULTI, PSED, "Dist Ao", PsEdInfo, NULL },
{ABD_CELIAC_A, ABD_CELIAC_A_MULTI, RI, "Celiac A", RiInfo, NULL },
{ABD_COM_HEP_A, ABD_COM_HEP_A_MULTI, PSED, "Com Hep A", PsEdInfo, NULL },
{ABD_L_HEP_A, ABD_L_HEP_A_MULTI, PSED, "L Hep A", PsEdInfo, NULL },
{ABD_R_HEP_A, ABD_R_HEP_A_MULTI, PSED, "R Hep A", PsEdInfo, NULL },
{ABD_GDA, ABD_GDA_MULTI, PSED, "GDA", PsEdInfo, NULL },
{ABD_IMA, ABD_IMA_MULTI, RI, "IMA", RiInfo, NULL },
{ABD_SMA, ABD_SMA_MULTI, RI, "SMA", RiInfo, NULL },
{ABD_SPLENIC_A, ABD_SPLENIC_A_MULTI, PSED, "Splenic A", PsEdInfo, NULL },
{ABD_PROX_IVC, ABD_PROX_IVC_MULTI, PSED, "Prox IVC", PsEdInfo, NULL },
{ABD_DIST_IVC, ABD_DIST_IVC_MULTI, PSED, "Dist IVC", PsEdInfo, NULL },
{ABD_L_HEP_V, ABD_L_HEP_V_MULTI, PSED, "L Hep V", PsEdInfo, NULL },
{ABD_M_HEP_V, ABD_M_HEP_V_MULTI, PSED, "M Hep V", PsEdInfo, NULL },
{ABD_R_HEP_V, ABD_R_HEP_V_MULTI, PSED, "R Hep V", PsEdInfo, NULL },
{ABD_L_PORT_V, ABD_L_PORT_V_MULTI, PSED, "L Port V", PsEdInfo, NULL },
{ABD_M_PORT_V, ABD_M_PORT_V_MULTI, PSED, "M Port V", PsEdInfo, NULL },
{ABD_R_PORT_V, ABD_R_PORT_V_MULTI, PSED, "R Port V", PsEdInfo, NULL },
{ABD_SPLENIC_V, ABD_SPLENIC_V_MULTI, PSED, "Splenic V", PsEdInfo, NULL },
{ABD_IMV, ABD_IMV_MULTI, PSED, "IMV", PsEdInfo, NULL },
{ABD_SMV, ABD_SMV_MULTI, PSED, "SMV", PsEdInfo, NULL },
};
/******************************Adult Measure**************************************/
const CalcResultInfo AdultCI2DCubed = {ADULT_CI_2DCUBED, {ADULT_CO_2DCUBED, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "CI(Cubed)", LMINM2, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo AdultCI2DTeich = {ADULT_CI_2DTEICH, {ADULT_CO_2DTEICH, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "CI(Teich)", LMINM2, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo AdultCIMMCubed = {ADULT_CI_MMCUBED, {ADULT_CO_MMCUBED, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "CI(Cubed)", LMINM2, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo AdultCIMMTeich = {ADULT_CI_MMTEICH, {ADULT_CO_MMTEICH, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "CI(Teich)", LMINM2, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo AdultCIA2C = {ADULT_CI_A2C, {ADULT_CO_A2C, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "CI(A2C)", LMINM2, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo AdultCIA4C = {ADULT_CI_A4C, {ADULT_CO_A4C, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "CI(A4C)", LMINM2, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo AdultCIAL = {ADULT_CI_AL, {ADULT_CO_AL, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "CI(A/L)", LMINM2, MeaCalcFun::SectionCalc, NULL};
const CalcInfoArray AdultCO2DCubedCalc = {&AdultCI2DCubed, NULL};
const CalcInfoArray AdultCO2DTeichCalc = {&AdultCI2DTeich, NULL};
const CalcInfoArray AdultCOMMCubedCalc = {&AdultCIMMCubed, NULL};
const CalcInfoArray AdultCOMMTeichCalc = {&AdultCIMMTeich, NULL};
const CalcInfoArray AdultCOA2CCalc = {&AdultCIA2C, NULL};
const CalcInfoArray AdultCOA4CCalc = {&AdultCIA4C, NULL};
const CalcInfoArray AdultCOALCalc = {&AdultCIAL, NULL};
const CalcResultInfo AdultSI2DCubed = {ADULT_SI_2DCUBED, {ADULT_SV_2DCUBED, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "SI(Cubed)", NOUNIT, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo AdultSI2DTeich = {ADULT_SI_2DTEICH, {ADULT_SV_2DTEICH, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "SI(Teich)", NOUNIT, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo AdultSIMMCubed = {ADULT_SI_MMCUBED, {ADULT_SV_MMCUBED, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "SI(Cubed)", NOUNIT, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo AdultSIMMTeich = {ADULT_SI_MMTEICH, {ADULT_SV_MMTEICH, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "SI(Teich)", NOUNIT, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo AdultSIA2C = {ADULT_SI_A2C, {ADULT_SV_A2C, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "SI(A2C)", NOUNIT, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo AdultSIA4C = {ADULT_SI_A4C, {ADULT_SV_A4C, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "SI(A4C)", NOUNIT, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo AdultSIAL = {ADULT_SI_AL, {ADULT_SV_AL, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "SI(A/L)", NOUNIT, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo AdultCO2DCubed = {ADULT_CO_2DCUBED, {ADULT_SV_2DCUBED, ADULT_HR_LV, NO_PAR, NO_PAR, NO_PAR}, "CO(Cubed)", LMIN, MeaCalcFun::SectionCalc, &AdultCO2DCubedCalc};
const CalcResultInfo AdultCO2DTeich = {ADULT_CO_2DTEICH, {ADULT_SV_2DTEICH, ADULT_HR_LV, NO_PAR, NO_PAR, NO_PAR}, "CO(Teich)", LMIN, MeaCalcFun::SectionCalc, &AdultCO2DTeichCalc};
const CalcResultInfo AdultCOMMCubed = {ADULT_CO_MMCUBED, {ADULT_SV_MMCUBED, ADULT_HR_LV, NO_PAR, NO_PAR, NO_PAR}, "CO(Cubed)", LMIN, MeaCalcFun::SectionCalc, &AdultCOMMCubedCalc};
const CalcResultInfo AdultCOMMTeich = {ADULT_CO_MMTEICH, {ADULT_SV_MMTEICH, ADULT_HR_LV, NO_PAR, NO_PAR, NO_PAR}, "CO(Teich)", LMIN, MeaCalcFun::SectionCalc, &AdultCOMMTeichCalc};
const CalcResultInfo AdultCOA2C = {ADULT_CO_A2C, {ADULT_SV_A2C, ADULT_HR_LV, NO_PAR, NO_PAR, NO_PAR}, "CO(A2C)", LMIN, MeaCalcFun::SectionCalc, &AdultCOA2CCalc};
const CalcResultInfo AdultCOA4C = {ADULT_CO_A4C, {ADULT_SV_A4C, ADULT_HR_LV, NO_PAR, NO_PAR, NO_PAR}, "CO(A4C)", LMIN, MeaCalcFun::SectionCalc, &AdultCOA4CCalc};
const CalcResultInfo AdultCOAL = {ADULT_CO_AL, {ADULT_SV_AL, ADULT_HR_LV, NO_PAR, NO_PAR, NO_PAR}, "CO(A/L)", LMIN, MeaCalcFun::SectionCalc, &AdultCOALCalc};
const CalcInfoArray AdultSV2DCubedCalc = {&AdultSI2DCubed, &AdultCO2DCubed, NULL};
const CalcInfoArray AdultSV2DTeichCalc = {&AdultSI2DTeich, &AdultCO2DTeich, NULL};
const CalcInfoArray AdultSVMMCubedCalc = {&AdultSIMMCubed, &AdultCOMMCubed, NULL};
const CalcInfoArray AdultSVMMTeichCalc = {&AdultSIMMTeich, &AdultCOMMTeich, NULL};
const CalcInfoArray AdultSVA2CCalc = {&AdultSIA2C, &AdultCOA2C, NULL};
const CalcInfoArray AdultSVA4CCalc = {&AdultSIA4C, &AdultCOA4C, NULL};
const CalcInfoArray AdultSVALCalc = {&AdultSIAL, &AdultCOAL, NULL};
//const CalcResultInfo AdultEF = {ADULT_EF, {ADULT_EDV, ADULT_ESV, NO_PAR, NO_PAR, NO_PAR}, "EF", CM3, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo AdultEF2DCubed = {ADULT_EF_2DCUBED, {ADULT_EDV_2DCUBED, ADULT_ESV_2DCUBED, NO_PAR, NO_PAR, NO_PAR}, "EF(Cubed)", PERCENT, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo AdultEF2DTeich = {ADULT_EF_2DTEICH, {ADULT_EDV_2DTEICH, ADULT_ESV_2DTEICH, NO_PAR, NO_PAR, NO_PAR}, "EF(Teich)", PERCENT, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo AdultEFMMCubed = {ADULT_EF_MMCUBED, {ADULT_EDV_MMCUBED, ADULT_ESV_MMCUBED, NO_PAR, NO_PAR, NO_PAR}, "EF(Cubed)", PERCENT, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo AdultEFMMTeich = {ADULT_EF_MMTEICH, {ADULT_EDV_MMTEICH, ADULT_ESV_MMTEICH, NO_PAR, NO_PAR, NO_PAR}, "EF(Teich)", PERCENT, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo AdultEFA2C = {ADULT_EF_A2C, {ADULT_A2CD, ADULT_A2CS, NO_PAR, NO_PAR, NO_PAR}, "EF(A2C)", PERCENT, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo AdultEFA4C = {ADULT_EF_A4C, {ADULT_A4CD, ADULT_A4CS, NO_PAR, NO_PAR, NO_PAR}, "EF(A4C)", PERCENT, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo AdultEFAL = {ADULT_EF_AL, {ADULT_LVDAL, ADULT_LVSAL, NO_PAR, NO_PAR, NO_PAR}, "EF(AL)", PERCENT, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo AdultSV2DCubed = {ADULT_SV_2DCUBED, {ADULT_EDV_2DCUBED, ADULT_ESV_2DCUBED, NO_PAR, NO_PAR, NO_PAR}, "SV(Cubed)", CM3, MeaCalcFun::SectionCalc, &AdultSV2DCubedCalc};
const CalcResultInfo AdultSV2DTeich = {ADULT_SV_2DTEICH, {ADULT_EDV_2DTEICH, ADULT_ESV_2DTEICH, NO_PAR, NO_PAR, NO_PAR}, "SV(Teich)", CM3, MeaCalcFun::SectionCalc, &AdultSV2DTeichCalc};
const CalcResultInfo AdultSVMMCubed = {ADULT_SV_MMCUBED, {ADULT_EDV_MMCUBED, ADULT_ESV_MMCUBED, NO_PAR, NO_PAR, NO_PAR}, "SV(Cubed)", CM3, MeaCalcFun::SectionCalc, &AdultSVMMCubedCalc};
const CalcResultInfo AdultSVMMTeich = {ADULT_SV_MMTEICH, {ADULT_EDV_MMTEICH, ADULT_ESV_MMTEICH, NO_PAR, NO_PAR, NO_PAR}, "SV(Teich)", CM3, MeaCalcFun::SectionCalc, &AdultSVMMTeichCalc};
const CalcResultInfo AdultSVA2C = {ADULT_SV_A2C, {ADULT_A2CD, ADULT_A2CS, NO_PAR, NO_PAR, NO_PAR}, "SV(A2C)", CM3, MeaCalcFun::SectionCalc, &AdultSVA2CCalc};
const CalcResultInfo AdultSVA4C = {ADULT_SV_A4C, {ADULT_A4CD, ADULT_A4CS, NO_PAR, NO_PAR, NO_PAR}, "SV(A4C)", CM3, MeaCalcFun::SectionCalc, &AdultSVA4CCalc};
const CalcResultInfo AdultSVAL = {ADULT_SV_AL, {ADULT_LVDAL, ADULT_LVSAL, NO_PAR, NO_PAR, NO_PAR}, "SV(AL)", CM3, MeaCalcFun::SectionCalc, &AdultSVALCalc};
const CalcInfoArray AdultEDV2DCubedCalc = {&AdultSV2DCubed, &AdultEF2DCubed, NULL};
const CalcInfoArray AdultEDV2DTeichCalc = {&AdultSV2DTeich, &AdultEF2DTeich, NULL};
const CalcInfoArray AdultEDVMMCubedCalc = {&AdultSVMMCubed, &AdultEFMMCubed, NULL};
const CalcInfoArray AdultEDVMMTeichCalc = {&AdultSVMMTeich, &AdultEFMMTeich, NULL};
const CalcInfoArray AdultESV2DCubedCalc = {&AdultSV2DCubed, &AdultEF2DCubed, NULL};
const CalcInfoArray AdultESV2DTeichCalc = {&AdultSV2DTeich, &AdultEF2DTeich, NULL};
const CalcInfoArray AdultESVMMCubedCalc = {&AdultSVMMCubed, &AdultEFMMCubed, NULL};
const CalcInfoArray AdultESVMMTeichCalc = {&AdultSVMMTeich, &AdultEFMMTeich, NULL};
const CalcResultInfo AdultEDV2DCubed = {ADULT_EDV_2DCUBED, {ADULT_LVIDD, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "EDV(Cubed)", CM3, MeaCalcFun::SectionCalc, &AdultEDV2DCubedCalc};
const CalcResultInfo AdultEDV2DTeich = {ADULT_EDV_2DTEICH, {ADULT_LVIDD, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "EDV(Teich)", CM3, MeaCalcFun::SectionCalc, &AdultEDV2DTeichCalc};
const CalcResultInfo AdultEDVMMCubed = {ADULT_EDV_MMCUBED, {ADULT_LVIDD_MM, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "EDV(Cubed)", CM3, MeaCalcFun::SectionCalc, &AdultEDVMMCubedCalc};
const CalcResultInfo AdultEDVMMTeich = {ADULT_EDV_MMTEICH, {ADULT_LVIDD_MM, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "EDV(Teich)", CM3, MeaCalcFun::SectionCalc, &AdultEDVMMTeichCalc};
const CalcResultInfo AdultESV2DCubed = {ADULT_ESV_2DCUBED, {ADULT_LVIDS, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "ESV(Cubed)", CM3, MeaCalcFun::SectionCalc, &AdultESV2DCubedCalc};
const CalcResultInfo AdultESV2DTeich = {ADULT_ESV_2DTEICH, {ADULT_LVIDS, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "ESV(Teich)", CM3, MeaCalcFun::SectionCalc, AdultESV2DTeichCalc};
const CalcResultInfo AdultESVMMCubed = {ADULT_ESV_MMCUBED, {ADULT_LVIDS_MM, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "ESV(Cubed)", CM3, MeaCalcFun::SectionCalc, AdultESVMMCubedCalc};
const CalcResultInfo AdultESVMMTeich = {ADULT_ESV_MMTEICH, {ADULT_LVIDS_MM, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "ESV(Teich)", CM3, MeaCalcFun::SectionCalc, AdultESVMMTeichCalc};
const CalcResultInfo AdultMVAP12t = {ADULT_MVA_P12T, {ADULT_MV_P12T, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "MVA", CM2, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo AdultAVAVmax = {ADULT_AVA_VMAX, {ADULT_LVOT_AREA, ADULT_LVOT_VMAX, ADULT_AV_VMAX, NO_PAR, NO_PAR}, "AVA", CM2, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo AdultMVEA = {ADULT_MV_EA_RATIO, {ADULT_MV_PEAK_E_V, ADULT_MV_PEAK_A_V, NO_PAR, NO_PAR, NO_PAR }, "MV E/A", NOUNIT, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo AdultPulmSD = {ADULT_PULM_SD_RATIO, {ADULT_PULM_SYS_V, ADULT_PULM_DIAS_V, NO_PAR, NO_PAR, NO_PAR }, "Pulm S/D", NOUNIT, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo AdultPVAVmax = {ADULT_PVA_VMAX, {ADULT_RVOT_AREA, ADULT_RVOT_VMAX, ADULT_PV_VMAX, NO_PAR, NO_PAR}, "PVA", CM2, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo AdultFS = {ADULT_FS, {ADULT_LVIDD, ADULT_LVIDS, NO_PAR, NO_PAR, NO_PAR}, "FS", PERCENT, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo AdultFSMM = {ADULT_FS_MM, {ADULT_LVIDD_MM, ADULT_LVIDS_MM, NO_PAR, NO_PAR, NO_PAR}, "FS", PERCENT, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo AdultIVSPer = {ADULT_IVS_PER, {ADULT_IVSD, ADULT_IVSS, NO_PAR, NO_PAR, NO_PAR}, "IVS%", PERCENT, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo AdultIVSPerMM = {ADULT_IVS_PER_MM, {ADULT_IVSD_MM, ADULT_IVSS_MM, NO_PAR, NO_PAR, NO_PAR}, "IVS%", PERCENT, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo AdultIVSLVPW = {ADULT_IVS_LVPW_RATIO, {ADULT_IVSD, ADULT_LVPWD, NO_PAR, NO_PAR, NO_PAR}, "IVS/LVPW", NOUNIT, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo AdultIVSLVPWMM = {ADULT_IVS_LVPW_RATIO_MM, {ADULT_IVSD_MM, ADULT_LVPWD_MM, NO_PAR, NO_PAR, NO_PAR}, "IVS/LVPW", NOUNIT, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo AdultLAAO = {ADULT_LA_AO_RATIO, {ADULT_LA_DIMEN, ADULT_AOR_DIAM, NO_PAR, NO_PAR, NO_PAR}, "LA/Ao", NOUNIT, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo AdultLVMassIndexCubed = {ADULT_LVMASS_INDEX, {ADULT_LVMASS, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "LVMWI", NOUNIT, MeaCalcFun::SectionCalc, NULL};
const CalcInfoArray AdultLVMassCalc = {&AdultLVMassIndexCubed, NULL};
const CalcInfoArray AdultLVOTAreaCalc = {&AdultAVAVmax, NULL};
const CalcInfoArray AdultRVOTAreaCalc = {&AdultPVAVmax, NULL};
const CalcResultInfo AdultLVMass = {ADULT_LVMASS, {ADULT_IVSD_MM, ADULT_LVIDD_MM, ADULT_LVPWD_MM, NO_PAR, NO_PAR}, "LVMW", NOUNIT, MeaCalcFun::SectionCalc, &AdultLVMassCalc};
const CalcResultInfo AdultLVOTArea = {ADULT_LVOT_AREA, {ADULT_LVOT_DIAM, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "LVOT Area", CM2, MeaCalcFun::SectionCalc, &AdultLVOTAreaCalc};
const CalcResultInfo AdultRVOTArea = {ADULT_RVOT_AREA, {ADULT_RVOT_DIAM, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "RVOT Area", CM2, MeaCalcFun::SectionCalc, &AdultRVOTAreaCalc};
const CalcResultInfo AdultTVArea = {ADULT_TV_AREA, {ADULT_TV_DIAM, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "TV Area", CM2, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo AdultAIPISA = {ADULT_AI_PISA, {ADULT_AI_RADIUS, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "AI PISA", CM2, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo AdultMVPISA = {ADULT_MV_PISA, {ADULT_MV_RADIUS, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "MV PISA", CM2, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo AdultMRPISA = {ADULT_MR_PISA, {ADULT_MR_RADIUS, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "MR PISA", CM2, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo AdultTVPISA = {ADULT_TV_PISA, {ADULT_TV_RADIUS, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "TV PISA", CM2, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo AdultTVEA = {ADULT_TV_EA_RATIO, {ADULT_TV_PEAK_E_V, ADULT_TV_PEAK_A_V, NO_PAR, NO_PAR, NO_PAR}, "TV E/A", NOUNIT, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo AdultLVPWPer = {ADULT_LVPW_PER, {ADULT_LVPWS, ADULT_LVPWD, NO_PAR, NO_PAR, NO_PAR}, "LVPW%", PERCENT, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo AdultLVPWPerMM = {ADULT_LVPW_PER_MM, {ADULT_LVPWS_MM, ADULT_LVPWD_MM, NO_PAR, NO_PAR, NO_PAR}, "LVPW%", PERCENT, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo AdultLAAOMM = {ADULT_LA_AO_RATIO_MM, {ADULT_LA_DIMEN_MM, ADULT_AOR_DIAM_MM, NO_PAR, NO_PAR, NO_PAR}, "LA/Ao", NOUNIT, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo AdultLVPEPET = {ADULT_LV_PEP_ET_RATIO, {ADULT_LV_PEP, ADULT_LV_ET, NO_PAR, NO_PAR, NO_PAR}, "LV PEP/ET", NOUNIT, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo AdultRVPEPET = {ADULT_RV_PEP_ET_RATIO, {ADULT_RV_PEP, ADULT_RV_ET, NO_PAR, NO_PAR,NO_PAR }, "RV PEP/ET", NOUNIT, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo AdultTeiIndex = {ADULT_TEI_INDEX, {ADULT_IVRT, ADULT_IVCT, ADULT_LV_ET, NO_PAR,NO_PAR }, "Tei Index", NOUNIT, MeaCalcFun::SectionCalc, NULL};
const CalcInfoArray AdultLVLDApicalCalc = {NULL};
const CalcInfoArray AdultLVIDsCalc = {&AdultESV2DCubed, &AdultESV2DTeich, &AdultFS, NULL};
const CalcInfoArray AdultLVPWsCalc = {&AdultLVPWPer, NULL};
const CalcInfoArray AdultLVOTDiamCalc = {&AdultLVOTArea, NULL};
const CalcInfoArray AdultLVIDdCalc = {&AdultEDV2DCubed, &AdultEDV2DTeich, &AdultFS, NULL};//再查,应该有第4项
const CalcInfoArray AdultLVPWdCalc = {&AdultIVSLVPW, &AdultLVPWPer, NULL};
const CalcInfoArray AdultRVOTDiamCalc = {&AdultRVOTArea, NULL};
const CalcInfoArray AdultIVSdCalc = {&AdultIVSPer, &AdultIVSLVPW, NULL};
//const CalcInfoArray AdultIVSdCalc = {&AdultIVSLVPW, &AdultIVSPer, NULL};
const CalcInfoArray AdultIVSsCalc = {&AdultIVSPer, NULL};
const CalcInfoArray AdultLADimenCalc = {&AdultLAAO, NULL};
const CalcInfoArray AdultAoRDiamCalc = {&AdultLAAO, NULL};
const CalcInfoArray AdultIVSdMMCalc = {&AdultIVSPerMM, &AdultIVSLVPWMM, &AdultLVMass, NULL};
const CalcInfoArray AdultLVIDdMMCalc = {&AdultEDVMMCubed, &AdultEDVMMTeich, &AdultFSMM, &AdultLVMass, NULL};//再查,应该有第4项
const CalcInfoArray AdultLVPWdMMCalc = {&AdultIVSLVPWMM, &AdultLVPWPerMM, &AdultLVMass, NULL};
const CalcInfoArray AdultIVSsMMCalc = {&AdultIVSPerMM, NULL};
const CalcInfoArray AdultLVIDsMMCalc = {&AdultESVMMCubed, &AdultESVMMTeich, &AdultFSMM, NULL};
const CalcInfoArray AdultLVPWsMMCalc = {&AdultLVPWPerMM, NULL};
const CalcInfoArray AdultAoRDiamMMCalc = {&AdultLAAOMM, NULL};
const CalcInfoArray AdultLADiamMMCalc = {&AdultLAAOMM, NULL};
const CalcInfoArray AdultLVETCalc = {&AdultLVPEPET, &AdultTeiIndex, NULL};
const CalcInfoArray AdultLVPEPCalc = {&AdultLVPEPET, NULL};
const CalcInfoArray AdultRVETCalc = {&AdultRVPEPET, NULL};
const CalcInfoArray AdultRVPEPCalc = {&AdultRVPEPET, NULL};
const CalcInfoArray AdultLvotVmaxCalc = {&AdultAVAVmax, NULL};
const CalcInfoArray AdultMVP12tCalc = {&AdultMVAP12t, NULL};
const CalcInfoArray AdultAvVmaxCalc = {&AdultAVAVmax, NULL};
const CalcInfoArray AdultMVPeakECalc = {&AdultMVEA, NULL};
const CalcInfoArray AdultMVPeakACalc = {&AdultMVEA, NULL};
const CalcInfoArray AdultTVDiamCalc = {&AdultTVArea, NULL};
const CalcInfoArray AdultAIRadiusCalc = {&AdultAIPISA, NULL};
const CalcInfoArray AdultMVRadiusCalc = {&AdultMVPISA, NULL};
const CalcInfoArray AdultMRRadiusCalc = {&AdultMRPISA, NULL};
const CalcInfoArray AdultTVRadiusCalc = {&AdultTVPISA, NULL};
const CalcInfoArray AdultTVPeakECalc = {&AdultTVEA, NULL};
const CalcInfoArray AdultTVPeakACalc = {&AdultTVEA, NULL};
const CalcInfoArray AdultPulmDiasCalc = {&AdultPulmSD, NULL};
const CalcInfoArray AdultPulmSysCalc = {&AdultPulmSD, NULL};
const CalcInfoArray AdultRvotVmaxCalc = {&AdultPVAVmax, NULL};
const CalcInfoArray AdultPvVmaxCalc = {&AdultPVAVmax, NULL};
const CalcInfoArray AdultIVRTCalc = {&AdultTeiIndex, NULL};
const CalcInfoArray AdultIVCTCalc = {&AdultTeiIndex, NULL};
const CalcInfoArray AdultA2CdCalc = {&AdultSVA2C, &AdultEFA2C, NULL};
const CalcInfoArray AdultA4CdCalc = {&AdultSVA4C, &AdultEFA4C, NULL};
const CalcInfoArray AdultA2CsCalc = {&AdultSVA2C, &AdultEFA2C, NULL};
const CalcInfoArray AdultA4CsCalc = {&AdultSVA4C, &AdultEFA4C, NULL};
const CalcInfoArray AdultLVdALCalc = {&AdultSVAL, &AdultEFAL, NULL};
const CalcInfoArray AdultLVsALCalc = {&AdultSVAL, &AdultEFAL, NULL};
const PtrOfCalcInfo AdultCalcInfoPtr[ADULT_CALC_END - ADULT_CALC_START] = {
{ADULT_EDV_2DCUBED, &AdultEDV2DCubed},
{ADULT_EDV_2DTEICH, &AdultEDV2DTeich},
{ADULT_EDV_MMCUBED, &AdultEDVMMCubed},
{ADULT_EDV_MMTEICH, &AdultEDVMMTeich},
{ADULT_ESV_2DCUBED, &AdultESV2DCubed},
{ADULT_ESV_2DTEICH, &AdultESV2DTeich},
{ADULT_ESV_MMCUBED, &AdultESVMMCubed},
{ADULT_ESV_MMTEICH, &AdultESVMMTeich},
{ADULT_SV_2DCUBED, &AdultSV2DCubed},
{ADULT_SV_2DTEICH, &AdultSV2DTeich},
{ADULT_SV_MMCUBED, &AdultSVMMCubed},
{ADULT_SV_MMTEICH, &AdultSVMMTeich},
{ADULT_SV_A2C, &AdultSVA2C},
{ADULT_SV_A4C, &AdultSVA4C},
{ADULT_SV_AL, &AdultSVAL},
{ADULT_SI_2DCUBED, &AdultSI2DCubed},
{ADULT_SI_2DTEICH, &AdultSI2DTeich},
{ADULT_SI_MMCUBED, &AdultSIMMCubed},
{ADULT_SI_MMTEICH, &AdultSIMMTeich},
{ADULT_SI_A2C, &AdultSIA2C},
{ADULT_SI_A4C, &AdultSIA4C},
{ADULT_SI_AL, &AdultSIAL},
{ADULT_CO_2DCUBED, &AdultCO2DCubed},
{ADULT_CO_2DTEICH, &AdultCO2DTeich},
{ADULT_CO_MMCUBED, &AdultCOMMCubed},
{ADULT_CO_MMTEICH, &AdultCOMMTeich},
{ADULT_CO_A2C, &AdultCOA2C},
{ADULT_CO_A4C, &AdultCOA4C},
{ADULT_CO_AL, &AdultCOAL},
{ADULT_CI_2DCUBED, &AdultCI2DCubed},
{ADULT_CI_2DTEICH, &AdultCI2DTeich},
{ADULT_CI_MMCUBED, &AdultCIMMCubed},
{ADULT_CI_MMTEICH, &AdultCIMMTeich},
{ADULT_CI_A2C, &AdultCIA2C},
{ADULT_CI_A4C, &AdultCIA4C},
{ADULT_CI_AL, &AdultCIAL},
{ADULT_EF_2DCUBED, &AdultEF2DCubed},
{ADULT_EF_2DTEICH, &AdultEF2DTeich},
{ADULT_EF_MMCUBED, &AdultEFMMCubed},
{ADULT_EF_MMTEICH, &AdultEFMMTeich},
{ADULT_EF_A2C, &AdultEFA2C},
{ADULT_EF_A4C, &AdultEFA4C},
{ADULT_EF_AL, &AdultEFAL},
{ADULT_FS, &AdultFS},
{ADULT_FS_MM, &AdultFSMM},
{ADULT_IVS_PER, &AdultIVSPer},
{ADULT_IVS_PER_MM, &AdultIVSPerMM},
{ADULT_IVS_LVPW_RATIO, &AdultIVSLVPW},
{ADULT_IVS_LVPW_RATIO_MM, &AdultIVSLVPWMM},
{ADULT_LA_AO_RATIO, &AdultLAAO},
{ADULT_LA_AO_RATIO_MM, &AdultLAAOMM},
{ADULT_LVMASS, &AdultLVMass},
{ADULT_LVMASS_INDEX, &AdultLVMassIndexCubed},
{ADULT_LVOT_AREA, &AdultLVOTArea},
{ADULT_RVOT_AREA, &AdultRVOTArea},
{ADULT_TV_AREA, &AdultTVArea},
{ADULT_AI_PISA, &AdultAIPISA},
{ADULT_MV_PISA, &AdultMVPISA},
{ADULT_MR_PISA, &AdultMRPISA},
{ADULT_TV_PISA, &AdultTVPISA},
{ADULT_AVA_VMAX, &AdultAVAVmax},
{ADULT_PVA_VMAX, &AdultPVAVmax},
{ADULT_MVA_P12T, &AdultMVAP12t},
{ADULT_MV_EA_RATIO, &AdultMVEA},
{ADULT_TV_EA_RATIO, &AdultTVEA},
{ADULT_LVPW_PER, &AdultLVPWPer},
{ADULT_LVPW_PER_MM, &AdultLVPWPerMM},
{ADULT_LV_PEP_ET_RATIO, &AdultLVPEPET},
{ADULT_RV_PEP_ET_RATIO, &AdultRVPEPET},
{ADULT_PULM_SD_RATIO, &AdultPulmSD},
{ADULT_TEI_INDEX, &AdultTeiIndex},
};
const MultiItemInfo AdultMultiInfo[] = {
{ ADULT_A2CD, ADULT_A2CD_MULTI, SIMPSONS, "A2Cd", SimpsonsEdvInfo, &AdultA2CdCalc},
{ ADULT_A2CS, ADULT_A2CS_MULTI, SIMPSONS, "A2Cs", SimpsonsEsvInfo, &AdultA2CdCalc},
{ ADULT_A4CD, ADULT_A4CD_MULTI, SIMPSONS, "A4Cd", SimpsonsEdvInfo, &AdultA4CdCalc},
{ ADULT_A4CS, ADULT_A4CS_MULTI, SIMPSONS, "A4Cs", SimpsonsEsvInfo, &AdultA4CsCalc},
{ ADULT_LVDAL, ADULT_LVDAL_MULTI, AL, "LVd(A/L)", AlEdvInfo, &AdultLVdALCalc},
{ ADULT_LVSAL, ADULT_LVSAL_MULTI, AL, "LVs(A/L)", AlEsvInfo, &AdultLVsALCalc},
// { ADULT_LVDAL, ADULT_LVDAL_MULTI, DIST_SLOPE_M, "LVDAL", {{"Dist", CM}, {"Slope", CMS}, {"\0", NOUNIT}, {"\0", NOUNIT}}, NULL },
// { ADULT_LVSAL, ADULT_LVSAL_MULTI, DIST_SLOPE_M, "LVSAL", {{"Dist", CM}, {"Slope", CMS}, {"\0", NOUNIT}, {"\0", NOUNIT}}, NULL },
{ ADULT_MV_DE_EXC, ADULT_MV_DE_EXC_MULTI, DIST_SLOPE_M, "MV D-E Exc", SlopeMInfo, NULL },
{ ADULT_TV_DE_EXC, ADULT_TV_DE_EXC_MULTI, DIST_SLOPE_M, "TV D-E Exc", SlopeMInfo, NULL },
{ ADULT_AV_VMAX, ADULT_AV_VMAX_MULTI, PGMAX, "AV Vmax", PgmaxInfo, &AdultAvVmaxCalc },
{ ADULT_LVOT_VMAX, ADULT_LVOT_VMAX_MULTI, PGMAX, "LVOT Vmax", PgmaxInfo, &AdultLvotVmaxCalc },
{ ADULT_AI_P12T, ADULT_AI_P12T_MULTI, P12T, "AI P1/2t", P12tInfo, NULL },
{ ADULT_AI_VMAX, ADULT_AI_VMAX_MULTI, PGMAX, "AI Vmax", PgmaxInfo, NULL },
{ ADULT_AI_END_DIAS_V, ADULT_AI_END_DIAS_V_MULTI, PGMAX, "AI End Dias V", PgmaxInfo, NULL },
{ ADULT_HR_AV, ADULT_HR_AV_MULTI, HR_D, "HR-AV", HrInfo, NULL },
{ ADULT_HR_MV, ADULT_HR_MV_MULTI, HR_D, "HR-MV", HrInfo, NULL },
{ ADULT_MV_P12T, ADULT_MV_P12T_MULTI, P12T, "MV P1/2t", P12tInfo, &AdultMVP12tCalc},
{ ADULT_MV_PEAK_E_V, ADULT_MV_PEAK_E_V_MULTI, PGMAX, "MV Peak E", PgmaxInfo, &AdultMVPeakECalc },
{ ADULT_MV_PEAK_A_V, ADULT_MV_PEAK_A_V_MULTI, PGMAX, "MV Peak A", PgmaxInfo, &AdultMVPeakACalc },
{ ADULT_HR_TV, ADULT_HR_TV_MULTI, HR_D, "HR-TV", HrInfo, NULL },
{ ADULT_TV_PEAK_E_V, ADULT_TV_PEAK_E_V_MULTI, PGMAX, "TV Peak E", PgmaxInfo, &AdultTVPeakECalc },
{ ADULT_TV_PEAK_A_V, ADULT_TV_PEAK_A_V_MULTI, PGMAX, "TV Peak A", PgmaxInfo, &AdultTVPeakACalc },
{ ADULT_HR_PV, ADULT_HR_PV_MULTI, HR_D, "HR-PV", HrInfo, NULL },
{ ADULT_PV_VMAX, ADULT_PV_VMAX_MULTI, PGMAX, "PV Vmax", PgmaxInfo, &AdultPvVmaxCalc },
{ ADULT_PI_END_DIAS_V, ADULT_PI_END_DIAS_V_MULTI, PGMAX, "PI End Dias Vel", PgmaxInfo, NULL},
{ ADULT_PULM_DIAS_V, ADULT_PULM_DIAS_V_MULTI, PGMAX, "Pulm Dias Vel", PgmaxInfo, &AdultPulmDiasCalc},
{ ADULT_PULM_SYS_V, ADULT_PULM_SYS_V_MULTI, PGMAX, "Pulm Sys Vel", PgmaxInfo, &AdultPulmSysCalc},
{ ADULT_RVOT_VMAX, ADULT_RVOT_VMAX_MULTI, PGMAX, "RVOT Vmax", PgmaxInfo, &AdultRvotVmaxCalc },
};
const SingleItemInfo AdultInfo[] = {
//2D Dimensions
{ADULT_LVLD_APICAL, DIST_DOT, N_("LVLd Apical(2D)"), CM, &AdultLVLDApicalCalc},
{ADULT_LVIDS, DIST_DOT, N_("LVIDs(2D)"), CM, &AdultLVIDsCalc},
{ADULT_LVPWS, DIST_DOT, N_("LVPWs(2D)"), CM, &AdultLVPWsCalc},
{ADULT_LVOT_DIAM, DIST_DOT, N_("LVOT Diam(2D)"), CM, &AdultLVOTDiamCalc},
{ADULT_LVIDD, DIST_DOT, N_("LVIDd(2D)"), CM, &AdultLVIDdCalc},
{ADULT_LVPWD, DIST_DOT, N_("LVPWd(2D)"), CM, &AdultLVPWdCalc},
{ADULT_LVAD_ENDO, AREA_TRACK, N_("LVAd SAx Endo(2D)"), CM2, NULL},
{ADULT_LVAD_EPI, AREA_TRACK, N_("LVAd SAx Epi(2D)"), CM2, NULL},
{ADULT_RVIDD, DIST_DOT, N_("RVIDd(2D)"), CM, NULL},
{ADULT_RVAWD, DIST_DOT, N_("RVAWd(2D)"), CM, NULL},
{ADULT_RVOT_DIAM, DIST_DOT, N_("RVOT Diam(2D)"), CM, &AdultRVOTDiamCalc},
{ADULT_IVSD, DIST_DOT, N_("IVSd(2D)"), CM, &AdultIVSdCalc},
{ADULT_IVSS, DIST_DOT, N_("IVSs(2D)"), CM, &AdultIVSsCalc},
{ADULT_LA_DIMEN, DIST_DOT, N_("LA Dimen(2D)"), CM, &AdultLADimenCalc},
//2D Vessels
{ADULT_AOR_DIAM, DIST_DOT, N_("AoR Diam(2D)"), CM, &AdultAoRDiamCalc},
{ADULT_ISTHMUS_DIAM, DIST_DOT, N_("Ao Isthmus Diam(2D)"), CM, NULL},
{ADULT_ASC_AO_DIAM, DIST_DOT, N_("Asc Ao Diam(2D)"), CM, NULL},
{ADULT_DESC_AO_DIAM, DIST_DOT, N_("Desc Ao Diam(2D)"), CM, NULL},
{ADULT_MPA_DIAM, DIST_DOT, N_("MPA Diam(2D)"), CM, NULL},
{ADULT_LPA_DIAM, DIST_DOT, N_("LPA Diam(2D)"), CM, NULL},
{ADULT_RPA_DIAM, DIST_DOT, N_("RPA Diam(2D) "), CM, NULL},
//2D EF & Volume
{ADULT_A2CD, DIST_DOT, N_("A2Cd(2D)"), ADULT_A2CD_MULTI, &AdultA2CdCalc},
{ADULT_A2CS, DIST_DOT, N_("A2Cs(2D)"), ADULT_A2CS_MULTI, &AdultA2CsCalc},
{ADULT_A4CD, DIST_DOT, N_("A4Cd(2D)"), ADULT_A4CD_MULTI, &AdultA4CdCalc},
{ADULT_A4CS, DIST_DOT, N_("A4Cs(2D)"), ADULT_A4CS_MULTI, &AdultA4CdCalc},
{ADULT_LVDAL, DIST_DOT, N_("LVd(A/L)(2D)"), ADULT_LVDAL_MULTI, &AdultLVdALCalc},
{ADULT_LVSAL, DIST_DOT, N_("LVs(A/L)(2D)"), ADULT_LVSAL_MULTI, &AdultLVdALCalc},
//2D Valves
{ADULT_AV_AREA, AREA_TRACK, N_("AV Area(2D)"), CM2, NULL},
{ADULT_AI_RADIUS, DIST_DOT, N_("AI Radius(2D)"), CM, &AdultAIRadiusCalc},
{ADULT_MV_DIAM, DIST_DOT, N_("MV Diam(2D)"), CM, NULL},
{ADULT_MV_RADIUS, DIST_DOT, N_("MV Radius(2D)"), CM, &AdultMVRadiusCalc},
{ADULT_MV_AREA, AREA_TRACK, N_("MV Area(Planim)(2D)"), CM2, NULL},
{ADULT_MR_RADIUS, DIST_DOT, N_("MR Radius(2D)"), CM, &AdultMRRadiusCalc},
{ADULT_TV_DIAM, DIST_DOT, N_("TV Diam(2D)"), CM, &AdultTVDiamCalc},
{ADULT_TV_RADIUS, DIST_DOT, N_("TV Radius(2D)"), CM, &AdultTVRadiusCalc},
//M Dimensions
{ADULT_RVAWD_MM, DEPTH_DIST_M, N_("RVAWd(M)"), CM, NULL},
{ADULT_RVIDD_MM, DEPTH_DIST_M, N_("RVIDd(M)"), CM, NULL},
{ADULT_IVSD_MM, DEPTH_DIST_M, N_("IVSd(M)"), CM, &AdultIVSdMMCalc},
{ADULT_LVIDD_MM, DEPTH_DIST_M, N_("LVIDd(M)"), CM, &AdultLVIDdMMCalc},
{ADULT_LVPWD_MM, DEPTH_DIST_M, N_("LVPWd(M)"), CM, &AdultLVPWdMMCalc},
{ADULT_IVSS_MM, DEPTH_DIST_M, N_("IVSs(M)"), CM, &AdultIVSsMMCalc},
{ADULT_LVIDS_MM, DEPTH_DIST_M, N_("LVIDs(M)"), CM, &AdultLVIDsMMCalc},
{ADULT_LVPWS_MM, DEPTH_DIST_M, N_("LVPWs(M)"), CM, &AdultLVPWsMMCalc},
{ADULT_HR_LV, HR_M, N_("HR-LV(M)"), BPM, NULL},
{ADULT_LVOT_DIAM_MM, DEPTH_DIST_M, N_("LVOT Diam(M)"), CM, NULL},
{ADULT_AOR_DIAM_MM, DEPTH_DIST_M, N_("AoR Diam(M)"), CM, &AdultAoRDiamMMCalc},
{ADULT_LA_DIMEN_MM, DEPTH_DIST_M, N_("LA Dimen(M)"), CM, &AdultLADiamMMCalc},
//M Aortic Valve
{ADULT_LV_ET, TIME_M, N_("LV ET(M)"), SEC, &AdultLVETCalc},
{ADULT_LV_PEP, TIME_M, N_("LV PEP(M)"), SEC, &AdultLVPEPCalc},
{ADULT_AV_CUSP_SEP, DEPTH_DIST_M, N_("AV Cusp Sep(M)"), CM, NULL},
//M Mitral Valve
{ADULT_MV_DE_EXC, DIST_SLOPE_M, N_("MV D-E Exc(M)"), ADULT_MV_DE_EXC_MULTI, NULL},//显示距离和斜率
{ADULT_MV_DE_SLOPE, SLOPE, N_("MV D-E Slope(M)"), CMS, NULL},//仅显示斜率
{ADULT_MV_EF_SEP, DEPTH_DIST_M, N_("MV E-F Sep(M)"), CM, NULL},
{ADULT_MV_EF_SLOPE, SLOPE, N_("MV E-F Slope(M)"), CMS, NULL},//仅显示斜率
{ADULT_MV_EPSS, DEPTH_DIST_M, N_("MV EPSS(M)"), CM, NULL},
{ADULT_MV_AC_INTERVAL, TIME_M, N_("MV A-C Interval(M)"), SEC, NULL},
//M Tricuspid Valve
{ADULT_TV_DE_EXC, DIST_SLOPE_M, N_("TV D-E Exc(M)"), ADULT_TV_DE_EXC_MULTI, NULL},//显示距离和斜率
{ADULT_TV_DE_SLOPE, SLOPE, N_("TV D-E Slope(M)"), CMS, NULL},
{ADULT_TV_EF_SLOPE, SLOPE, N_("TV E-F Slope(M)"), CMS, NULL},
{ADULT_TV_AC_INTERVAL, TIME_M, N_("TV A-C Interval(M)"), SEC, NULL},
//M Pulmonic Valve
{ADULT_LATE_DIAS_SLOPE, SLOPE, N_("Late Dias Slope(M)"), CMS, NULL},
{ADULT_A_WAVE_AMP, DIST_DOT, N_("A Wave Amp(M)"), CM, NULL},
{ADULT_BC_SLOPE, SLOPE, N_("B-C Slope(M)"), CMS, NULL},
{ADULT_RV_ET, TIME_M, N_("RV ET(M)"), SEC, &AdultRVETCalc},
{ADULT_RV_PEP, TIME_M, N_("RV PEP(M)"), SEC, &AdultRVPEPCalc},
//D Aortic Valve
{ADULT_AV_ACC_T, TIME_D, N_("AV Accel Time(D)"), SEC, NULL},
{ADULT_AV_DEC_T, TIME_D, N_("AV Decel Time(D)"), SEC, NULL},
{ADULT_AV_VMAX, PGMAX, N_("AV Vmax(D)"), ADULT_AV_VMAX_MULTI, &AdultAvVmaxCalc},
{ADULT_LVOT_ACC_T, TIME_D, N_("LVOT Accel Time(D)"), SEC, NULL},
{ADULT_LVOT_VMAX, PGMAX, N_("LVOT Vmax(D)"), ADULT_LVOT_VMAX_MULTI, &AdultLvotVmaxCalc},
{ADULT_AI_ACC_T, TIME_D, N_("AI Accel Time(D)"), SEC, NULL},
{ADULT_AI_P12T, P12T, N_("AI P1/2t(D)"), ADULT_AI_P12T_MULTI, NULL},//压力降半时间,实际上要显示Vmax, P1/2t, Slope
{ADULT_AI_DEC_SLOPE, SLOPE_D, N_("AI Dec Slope(D)"), CMS2, NULL},
// {ADULT_AI_ALIAS_V, DIALOG_BOX, "AI Alias Vel", CMS, NULL},//弹出对话框,选择测量或输入
{ADULT_AI_VMAX, PGMAX, N_("AI Vmax(D)"), ADULT_AI_VMAX_MULTI, NULL},
{ADULT_AI_END_DIAS_V, PGMAX, N_("AI End Dias Vel(D)"), ADULT_AI_END_DIAS_V_MULTI, NULL},//测量速度和压力阶差
{ADULT_VTI,INTEGRAL_TRACK,N_("VTI(D)"), CM, NULL},
{ADULT_HR_AV, HR_D, N_("HR-AV(D)"), ADULT_HR_AV_MULTI, NULL},
//D Mitral Valve
{ADULT_HR_MV, HR_D, N_("HR-MV(D)"), ADULT_HR_MV_MULTI, NULL},
{ADULT_MV_P12T, P12T, N_("MV P1/2t(D)"), ADULT_MV_P12T_MULTI, &AdultMVP12tCalc},//压力降半时间,实际上要显示Vmax, P1/2t, Slope
// {ADULT_MV_ALIAS_V, VEL_D, "MV Alias Vel", CM, NULL},//弹出对话框,选择测量或输入
{ADULT_MV_PEAK_E_V, PGMAX, N_("MV Peak E Vel(D)"), ADULT_MV_PEAK_E_V_MULTI, &AdultMVPeakECalc},//测量速度和压力阶差
{ADULT_MV_PEAK_A_V, PGMAX, N_("MV Peak A Vel(D)"), ADULT_MV_PEAK_A_V_MULTI, &AdultMVPeakECalc},//测量速度和压力阶差
{ADULT_MV_A_DUR, TIME_D, N_("MV A Dur(D)"), SEC, NULL},
{ADULT_IVRT, TIME_D, N_("IVRT(D)"), SEC, &AdultIVRTCalc},
{ADULT_MV_DEC_T, TIME_D, N_("MV Decel Time(D)"), SEC, NULL},
{ADULT_MV_DEC_SLOPE, SLOPE_D, N_("MV Decel Slope(D)"), CMS2, NULL},
{ADULT_IVCT, TIME_D, N_("IVCT(D)"), SEC, &AdultIVCTCalc},
{ADULT_MV_ACC_T, TIME_D, N_("MV Accel Time(D)"), SEC, NULL},
{ADULT_MV_VMAX, VEL_D, N_("MV Vmax(D)"), CMS, NULL},//仅速度测量
{ADULT_MR_VMAX, VEL_D, N_("MR Vmax(D)"), CMS, NULL},//仅速度测量
// {ADULT_MR_ALIAS_V, VEL_D, "MR Alias Vel", CM, NULL},//弹出对话框,选择测量或输入
//D Pulmonic Valve
{ADULT_HR_TV, HR_D, N_("HR-TV(D)"), ADULT_HR_TV_MULTI, NULL},
{ADULT_TV_VMAX, VEL_D, N_("TV Vmax(D)"), CMS, NULL},//测量速度和压力阶差
{ADULT_TR_VMAX, VEL_D, N_("TR Vmax(D)"), CMS, NULL},//测量速度和压力阶差
// {ADULT_RA_PRESSURE, VEL_D, "RA Pressure", CM, NULL},//弹出对话框,选择或输入数据
{ADULT_TV_ACC_T, TIME_D, N_("TV Accel Time(D)"), SEC, NULL},
{ADULT_TV_PEAK_E_V, PGMAX, N_("TV Peak E Vel(D)"), ADULT_TV_PEAK_E_V_MULTI, &AdultTVPeakECalc},//测量速度和压力阶差
{ADULT_TV_PEAK_A_V, PGMAX, N_("TV Peak A Vel(D)"), ADULT_TV_PEAK_A_V_MULTI, &AdultTVPeakACalc},//测量速度和压力阶差
//D Tricuspid Valve
{ADULT_HR_PV, HR_D, N_("HR-PV(D)"), ADULT_HR_PV_MULTI, NULL},
{ADULT_PV_VMAX, PGMAX, N_("PV Vmax(D)"), ADULT_PV_VMAX_MULTI, &AdultPvVmaxCalc},//测量速度和压力阶差
{ADULT_PV_ACC_T, TIME_D, N_("PV Accel Time(D)"), SEC, NULL},
{ADULT_PI_END_DIAS_V, PGMAX, N_("PI End Dias Vel(D)"), ADULT_PI_END_DIAS_V_MULTI, NULL},//测量速度和压力阶差
{ADULT_PULM_DIAS_V, PGMAX, N_("Pulm Dias Vel(D)"), ADULT_PULM_DIAS_V_MULTI, &AdultPulmDiasCalc},//测量速度和压力阶差
{ADULT_PULM_SYS_V, PGMAX, N_("Pulm Sys Vel(D)"), ADULT_PULM_SYS_V_MULTI, &AdultPulmSysCalc},//测量速度和压力阶差
{ADULT_RVOT_VMAX, PGMAX, N_("RVOT Vmax(D)"), ADULT_RVOT_VMAX_MULTI, &AdultRvotVmaxCalc},
};
/******************************OB Measure**************************************/
const CalcResultInfo OBCerEDCB = {OB_CER_EDCB, {OB_CER, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "EDD", NOUNIT, MeaCalcFun::EDCBCalc, NULL};
//const CalcInfoArray fkdakfdakOBCerGWCalc = {&OBCerEDCB, NULL};
const CalcResultInfo OBCerGW = {OB_CER_GW, {OB_CER, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "GW", NOUNIT, MeaCalcFun::CalcGWMan, NULL};
const CalcResultInfo OBHLEDCB = {OB_HL_EDCB, {OB_HL, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "EDD", NOUNIT, MeaCalcFun::EDCBCalc, NULL};
//const CalcInfoArray OBHLGWCalc = {&OBHLEDCB, NULL};
const CalcResultInfo OBHLGW = {OB_HL_GW, {OB_HL, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "GW", NOUNIT, MeaCalcFun::CalcGWMan, NULL};
const CalcResultInfo OBBPDEDCB = {OB_BPD_EDCB, {OB_BPD, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "EDD", NOUNIT, MeaCalcFun::EDCBCalc, NULL};
//const CalcInfoArray OBBPDGWCalc = {&OBBPDEDCB, NULL};
const CalcResultInfo OBBPDGW = {OB_BPD_GW, {OB_BPD, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "GW", NOUNIT, MeaCalcFun::CalcGWMan, NULL};
const CalcResultInfo OBFLEDCB = {OB_FL_EDCB, {OB_FL, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "EDD", NOUNIT, MeaCalcFun::EDCBCalc, NULL};
//const CalcInfoArray OBFLGWCalc = {&OBFLEDCB, NULL};
const CalcResultInfo OBFLGW = {OB_FL_GW, {OB_FL, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "GW", NOUNIT, MeaCalcFun::CalcGWMan, NULL};
const CalcResultInfo OBCRLEDCB = {OB_CRL_EDCB, {OB_CRL, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "EDD", NOUNIT, MeaCalcFun::EDCBCalc, NULL};
//const CalcInfoArray OBCRLGWCalc = {&OBCRLEDCB, NULL};
const CalcResultInfo OBCRLGW = {OB_CRL_GW, {OB_CRL, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "GW", NOUNIT, MeaCalcFun::CalcGWMan, NULL};
const CalcResultInfo OBGSEDCB = {OB_GS_EDCB, {OB_GS, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "EDD", NOUNIT, MeaCalcFun::EDCBCalc, NULL};
//const CalcInfoArray OBGSGWCalc = {&OBGSEDCB, NULL};
const CalcResultInfo OBGSGW = {OB_GS_GW, {OB_GS, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "GW", NOUNIT, MeaCalcFun::CalcGWMan, NULL};
const CalcResultInfo OBACEDCB = {OB_AC_EDCB, {OB_AC, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "EDD", NOUNIT, MeaCalcFun::EDCBCalc, NULL};
//const CalcInfoArray OBACGWCalc = {&OBACEDCB, NULL};
const CalcResultInfo OBACGW = {OB_AC_GW, {OB_AC, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "GW", NOUNIT, MeaCalcFun::CalcGWMan, NULL};
const CalcResultInfo OBHCEDCB = {OB_HC_EDCB, {OB_HC, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "EDD", NOUNIT, MeaCalcFun::EDCBCalc, NULL};
//const CalcInfoArray OBHCGWCalc = {&OBHCEDCB, NULL};
const CalcResultInfo OBHCGW = {OB_HC_GW, {OB_HC, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "GW", NOUNIT, MeaCalcFun::CalcGWMan, NULL};
const CalcResultInfo OBTADEDCB = {OB_TAD_EDCB, {OB_TAD, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "EDD", NOUNIT, MeaCalcFun::EDCBCalc, NULL};
//const CalcInfoArray OBTADGWCalc = {&OBTADEDCB, NULL};
const CalcResultInfo OBTADGW = {OB_TAD_GW, {OB_TAD, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "GW", NOUNIT, MeaCalcFun::CalcGWMan, NULL};
const CalcResultInfo OBAPADEDCB = {OB_APAD_EDCB, {OB_APAD, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "EDD", NOUNIT, MeaCalcFun::EDCBCalc, NULL};
//const CalcInfoArray OBAPADGWCalc = {&OBAPADEDCB, NULL};
const CalcResultInfo OBAPADGW = {OB_APAD_GW, {OB_APAD, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "GW", NOUNIT, MeaCalcFun::CalcGWMan, NULL};
const CalcResultInfo OBTHDEDCB = {OB_THD_EDCB, {OB_THD, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "EDD", NOUNIT, MeaCalcFun::EDCBCalc, NULL};
//const CalcInfoArray OBTHDGWCalc = {&OBTHDEDCB, NULL};
const CalcResultInfo OBTHDGW = {OB_THD_GW, {OB_THD, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "GW", NOUNIT, MeaCalcFun::CalcGWMan, NULL};
const CalcResultInfo OBOFDEDCB = {OB_OFD_EDCB, {OB_OFD, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "EDD", NOUNIT, MeaCalcFun::EDCBCalc, NULL};
//const CalcInfoArray OBOFDGWCalc = {&OBOFDEDCB, NULL};
const CalcResultInfo OBOFDGW = {OB_OFD_GW, {OB_OFD, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "GW", NOUNIT, MeaCalcFun::CalcGWMan, NULL};
const CalcResultInfo OBOODEDCB = {OB_OOD_EDCB, {OB_OOD, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "EDD", NOUNIT, MeaCalcFun::EDCBCalc, NULL};
//const CalcInfoArray OBOODGWCalc = {&OBOODEDCB, NULL};
const CalcResultInfo OBOODGW = {OB_OOD_GW, {OB_OOD, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "GW", NOUNIT, MeaCalcFun::CalcGWMan, NULL};
const CalcResultInfo OBTibiaEDCB = {OB_TIBIA_EDCB, {OB_TIBIA, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "EDD", NOUNIT, MeaCalcFun::EDCBCalc, NULL};
//const CalcInfoArray OBTibiaGWCalc = {&OBTibiaEDCB, NULL};
const CalcResultInfo OBTibiaGW = {OB_TIBIA_GW, {OB_TIBIA, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "GW", NOUNIT, MeaCalcFun::CalcGWMan, NULL};
const CalcResultInfo OBTTDEDCB = {OB_TTD_EDCB, {OB_TTD, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "EDD", NOUNIT, MeaCalcFun::EDCBCalc, NULL};
//const CalcInfoArray OBTTDGWCalc = {&OBTTDEDCB, NULL};
const CalcResultInfo OBTTDGW = {OB_TTD_GW, {OB_TTD, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "GW", NOUNIT, MeaCalcFun::CalcGWMan, NULL};
const CalcResultInfo OBUlnaEDCB = {OB_ULNA_EDCB, {OB_ULNA, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "EDD", NOUNIT, MeaCalcFun::EDCBCalc, NULL};
//const CalcInfoArray OBUlnaGWCalc = {&OBUlnaEDCB, NULL};
const CalcResultInfo OBUlnaGW = {OB_ULNA_GW, {OB_ULNA, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "GW", NOUNIT, MeaCalcFun::CalcGWMan, NULL};
//const CalcResultInfo OBEfw = {OB_EFW, {OB_EFW_METH, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "EFW", KG, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo OBEfwHadlock1 = {OB_EFW_HADLOCK1, {OB_AC, OB_FL, NO_PAR, NO_PAR, NO_PAR}, "EFW", KG, MeaCalcFun::EFWCalc, NULL};
const CalcResultInfo OBEfwHadlock2 = {OB_EFW_HADLOCK2, {OB_AC, OB_BPD, OB_FL, NO_PAR, NO_PAR}, "EFW", KG, MeaCalcFun::EFWCalc, NULL};
const CalcResultInfo OBEfwHadlock3 = {OB_EFW_HADLOCK3, {OB_AC, OB_HC, OB_FL, NO_PAR, NO_PAR}, "EFW", KG, MeaCalcFun::EFWCalc, NULL};
const CalcResultInfo OBEfwHadlock4 = {OB_EFW_HADLOCK4, {OB_AC, OB_BPD, OB_HC, OB_FL, NO_PAR}, "EFW", KG, MeaCalcFun::EFWCalc, NULL};
const CalcResultInfo OBEfwShepard = {OB_EFW_SHEPARD, {OB_BPD, OB_AC, NO_PAR, NO_PAR, NO_PAR}, "EFW", KG, MeaCalcFun::EFWCalc, NULL};
const CalcResultInfo OBEfwHansmenn = {OB_EFW_HANSMAN, {OB_BPD, OB_TAD, OB_FL, NO_PAR, NO_PAR}, "EFW", KG, MeaCalcFun::EFWCalc, NULL};
const CalcResultInfo OBEfwTokyo = {OB_EFW_TOKYO, {OB_BPD, OB_TAD, OB_APAD, OB_FL, NO_PAR}, "EFW", KG, MeaCalcFun::EFWCalc, NULL};
const CalcResultInfo OBAFI = {OB_CALC_AFI, {OB_AFI_LUQ, OB_AFI_LLQ, OB_AFI_RUQ, OB_AFI_RLQ, NO_PAR}, "AFI", CM, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo OBLOvVol = {OB_CALC_L_OV_VOL, {OB_L_OV_L, OB_L_OV_W, OB_L_OV_H, NO_PAR, NO_PAR}, "Vol", CM3, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo OBROvVol = {OB_CALC_R_OV_VOL, {OB_R_OV_L, OB_R_OV_W, OB_R_OV_H, NO_PAR, NO_PAR}, "Vol", CM3, MeaCalcFun::SectionCalc, NULL};
//const CalcResultInfo OBMeanSac = {OB_MEAN_SAC, {OB_SAC1, OB_SAC2, OB_SAC3, NO_PAR, NO_PAR}, "mean Sac", CM, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo OBAoPa = {OB_AO_PA_RATIO, {OB_AOR_DIAM, OB_MPA_DIAM, NO_PAR, NO_PAR, NO_PAR}, "Ao/PA", NOUNIT, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo OBHrtCThrC = {OB_HRTC_THRC_RATIO, {OB_HRTC_2D, OB_THC, NO_PAR, NO_PAR, NO_PAR}, "HrtC/ThrC", NOUNIT, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo OBLaAo = {OB_LA_AO_RTAIO, {OB_LA_DIMEN, OB_AOR_DIAM, NO_PAR, NO_PAR, NO_PAR}, "LA/Ao", NOUNIT, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo OBLaRa = {OB_LA_RA_RATIO, {OB_LA_DIMEN, OB_RA_DIMEN, NO_PAR, NO_PAR, NO_PAR}, "LA/RA", NOUNIT, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo OBLvRv = {OB_LV_RV_RATIO, {OB_LV_DIMEN, OB_RV_DIMEN, NO_PAR, NO_PAR, NO_PAR}, "LV/RV", NOUNIT, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo OBHCAC = {OB_HC_AC_RATIO, {OB_HC, OB_AC, NO_PAR, NO_PAR, NO_PAR}, "HC/AC", NOUNIT, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo OBFLBPD = {OB_FL_BPD_RATIO, {OB_FL, OB_BPD, NO_PAR, NO_PAR, NO_PAR}, "FL/BPD", NOUNIT, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo OBFLAC = {OB_FL_AC_RATIO, {OB_FL, OB_AC, NO_PAR, NO_PAR, NO_PAR}, "FL/AC", NOUNIT, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo OBBPDa = {OB_BPDA, {OB_BPD, OB_OFD, NO_PAR, NO_PAR, NO_PAR}, "BPDa", NOUNIT, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo OBCI = {OB_CI, {OB_BPD, OB_OFD, NO_PAR, NO_PAR, NO_PAR}, "CI", NOUNIT, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo OBFTAGW = {OB_FTA_GW, {OB_FTA, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "GW", NOUNIT, MeaCalcFun::CalcGWMan, NULL};//12.05
const CalcResultInfo OBFTAEDCB = {OB_FTA_EDCB, {OB_FTA, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "EDD", NOUNIT, MeaCalcFun::EDCBCalc, NULL};//12.05
const CalcInfoArray OBCerCalc = {&OBCerGW, &OBCerEDCB, NULL};
const CalcInfoArray OBHLCalc = {&OBHLGW, &OBHLEDCB, NULL};
const CalcInfoArray OBBPDCalc = {&OBBPDGW, &OBBPDEDCB, &OBEfwHadlock2, &OBEfwHadlock4, &OBEfwShepard, &OBEfwHansmenn, &OBEfwTokyo,&OBFLBPD, &OBBPDa, &OBCI, NULL};
const CalcInfoArray OBFLCalc = {&OBFLGW, &OBFLEDCB, &OBEfwHadlock1, &OBEfwHadlock2, &OBEfwHadlock3, &OBEfwHadlock4, &OBEfwTokyo, &OBFLBPD, &OBFLAC, NULL};
const CalcInfoArray OBGSCalc = {&OBGSGW, &OBGSEDCB, NULL};
const CalcInfoArray OBACCalc = {&OBACGW, &OBACEDCB, &OBEfwHadlock1, &OBEfwHadlock2, &OBEfwHadlock3, &OBEfwHadlock4, &OBEfwShepard, &OBHCAC, &OBFLAC, NULL};
const CalcInfoArray OBHCCalc = {&OBHCGW, &OBHCEDCB, &OBEfwHadlock3, &OBEfwHadlock4, &OBHCAC, NULL};
const CalcInfoArray OBTADCalc = {&OBTADGW, &OBTADEDCB, &OBEfwHansmenn, &OBEfwTokyo, NULL};
const CalcInfoArray OBAPADCalc = {&OBAPADGW, &OBAPADEDCB, &OBEfwTokyo, NULL};
const CalcInfoArray OBOFDCalc = {&OBOFDGW, &OBOFDEDCB, &OBBPDa, &OBCI, NULL};
const CalcInfoArray OBTHDCalc = {&OBTHDGW, &OBTHDEDCB, NULL};
const CalcInfoArray OBOODCalc = {&OBOODGW, &OBOODEDCB, NULL};
const CalcInfoArray OBTibiaCalc = {&OBTibiaGW, &OBTibiaEDCB, NULL};
const CalcInfoArray OBTTDCalc = {&OBTTDGW, &OBTTDEDCB, NULL};
const CalcInfoArray OBUlnaCalc = {&OBUlnaGW, &OBUlnaEDCB, NULL};
const CalcInfoArray OBAFICalc = {&OBAFI, NULL};
const CalcInfoArray OBCRLCalc = {&OBCRLGW, &OBCRLEDCB, NULL};
//const CalcInfoArray OBSacCalc = {&OBMeanSac, NULL};
const CalcInfoArray OBLOvVolCalc = {&OBLOvVol, NULL};
const CalcInfoArray OBROvVolCalc = {&OBROvVol, NULL};
const CalcInfoArray OBHrtCThrCCalc = {&OBHrtCThrC, NULL};
const CalcInfoArray OBAoRDiamCalc = {&OBAoPa, &OBLaAo, NULL};
const CalcInfoArray OBMPADiamCalc = {&OBAoPa, NULL};
const CalcInfoArray OBLaDimenCalc = {&OBLaRa, &OBLaAo, NULL};
const CalcInfoArray OBRaDimenCalc = {&OBLaRa, NULL};
const CalcInfoArray OBLvDimenCalc = {&OBLvRv, NULL};
const CalcInfoArray OBRvDimenCalc = {&OBLvRv, NULL};
const CalcInfoArray OBFTACalc = {&OBFTAGW,&OBFTAEDCB, NULL}; //12.05
const PtrOfCalcInfo OBCalcInfoPtr[OB_CALC_END - OB_CALC_START] = {
{OB_CER_GW, &OBCerGW},
{OB_CER_EDCB, &OBCerEDCB},
{OB_HL_GW, &OBHLGW},
{OB_HL_EDCB, &OBHLEDCB},
{OB_BPD_GW, &OBBPDGW},
{OB_BPD_EDCB, &OBBPDEDCB},
{OB_FL_GW, &OBFLGW},
{OB_FL_EDCB, &OBFLEDCB},
{OB_OOD_GW, &OBOODGW},
{OB_OOD_EDCB, &OBOODEDCB},
{OB_TIBIA_GW, &OBTibiaGW},
{OB_TIBIA_EDCB, &OBTibiaEDCB},
{OB_TTD_GW, &OBTTDGW},
{OB_TTD_EDCB, &OBTTDEDCB},
{OB_ULNA_GW, &OBUlnaGW},
{OB_ULNA_EDCB, &OBUlnaEDCB},
{OB_CRL_GW, &OBCRLGW},
{OB_CRL_EDCB, &OBCRLEDCB},
{OB_GS_GW, &OBGSGW},
{OB_GS_EDCB, &OBGSEDCB},
{OB_AC_GW, &OBACGW},
{OB_AC_EDCB, &OBACEDCB},
{OB_HC_GW, &OBHCGW},
{OB_HC_EDCB, &OBHCEDCB},
{OB_TAD_GW, &OBTADGW},
{OB_TAD_EDCB, &OBTADEDCB},
{OB_APAD_GW, &OBAPADGW},
{OB_APAD_EDCB, &OBAPADEDCB},
{OB_THD_GW, &OBTHDGW},
{OB_THD_EDCB, &OBTHDEDCB},
{OB_OFD_GW, &OBOFDGW},
{OB_OFD_EDCB, &OBOFDEDCB},
{OB_EFW_HADLOCK1, &OBEfwHadlock1},
{OB_EFW_HADLOCK2, &OBEfwHadlock2},
{OB_EFW_HADLOCK3, &OBEfwHadlock3},
{OB_EFW_HADLOCK4, &OBEfwHadlock4},
{OB_EFW_SHEPARD, &OBEfwShepard},
{OB_EFW_HANSMAN, &OBEfwHansmenn},
{OB_EFW_TOKYO, &OBEfwTokyo},
{OB_CALC_AFI, &OBAFI},
{OB_CALC_L_OV_VOL, &OBLOvVol},
{OB_CALC_R_OV_VOL, &OBROvVol},
//{OB_MEAN_SAC, &OBMeanSac},
{OB_AO_PA_RATIO, &OBAoPa},
{OB_HRTC_THRC_RATIO, &OBHrtCThrC},
{OB_LA_AO_RTAIO, &OBLaAo},
{OB_LA_RA_RATIO, &OBLaRa},
{OB_LV_RV_RATIO, &OBLvRv},
{OB_HC_AC_RATIO, &OBHCAC},
{OB_FL_BPD_RATIO, &OBFLBPD},
{OB_FL_AC_RATIO, &OBFLAC},
{OB_BPDA, &OBBPDa},
{OB_CI, &OBCI},
{OB_FTA_GW, &OBFTAGW}, //12.05
{OB_FTA_EDCB, &OBFTAEDCB}, //12.05
};
const MultiItemInfo OBMultiInfo[] = {
#ifdef EMP_322
#else
{OB_DESC_AO, OB_DESC_AO_MULTI, RI, "Desc Ao", RiInfo, NULL },
{OB_L_MCA, OB_L_MCA_MULTI, PSED, "L MCA", PsEdInfo, NULL },
{OB_R_MCA, OB_R_MCA_MULTI, PSED, "R MCA", PsEdInfo, NULL },
{OB_L_UTERINE_A, OB_L_UTERINE_A_MULTI, RI, "L Uterine A", RiInfo, NULL },
{OB_R_UTERINE_A, OB_R_UTERINE_A_MULTI, RI, "R Uterine A", RiInfo, NULL },
{OB_THORACIC_AO, OB_THORACIC_AO_MULTI, RI, "Thoracic Ao", RiInfo, NULL },
{OB_UMBILICAL_A, OB_UMBILICAL_A_MULTI, RI, "Umbilical A", RiInfo, NULL },
#endif
{OB_SAC, OB_SAC_MULTI, SAC_3AXIS, "Sac", SacInfo, NULL }
};
const SingleItemInfo OBInfo[] = {
{OB_CER, DIST_DOT, N_("CER"), CM, &OBCerCalc},
{OB_CIST_MAG, DIST_DOT, N_("Cist Magna"), CM, NULL},
{OB_OOD, DIST_DOT, N_("OOD"), CM, &OBOODCalc},
{OB_TIBIA, DIST_DOT, N_("Tibia"), CM, &OBTibiaCalc},
{OB_TTD, DIST_DOT, N_("TTD"), CM, &OBTTDCalc},
// {OB_HUMERUS, DIST_DOT, N_("Humerus"), CM, NULL},
{OB_IOD, DIST_DOT, N_("IOD"), CM, NULL},
{OB_RADIUS, DIST_DOT, N_("Radius"), CM, NULL},
{OB_ULNA, DIST_DOT, N_("Ulna"), CM, &OBUlnaCalc},
{OB_FIBULA, DIST_DOT, N_("Fibula"), CM, NULL},
{OB_NUCHFOLD, DIST_DOT, N_("Nuch Fold"), CM, NULL},
#ifdef EMP_322
#else
{OB_UMBILICAL_A, RI, N_("Umbilical A"), OB_UMBILICAL_A_MULTI, NULL},
{OB_L_MCA, PSED, N_("L MCA"), OB_L_MCA_MULTI, NULL},
{OB_R_MCA, PSED, N_("R MCA"), OB_R_MCA_MULTI, NULL},
#endif
{OB_AFI, MEA_TYPE_END, N_("AFI"), UNIT_END, NULL},
{OB_AFI_LUQ, DIST_DOT, N_("AFI1"), CM, &OBAFICalc},
{OB_AFI_LLQ, DIST_DOT, N_("AFI2"), CM, &OBAFICalc},
{OB_AFI_RUQ, DIST_DOT, N_("AFI3"), CM, &OBAFICalc},
{OB_AFI_RLQ, DIST_DOT, N_("AFI4"), CM, &OBAFICalc},
// {OB_BPP, DIST_DOT, N_("BPP"), CM, NULL},//生物物理相评分,对话框
{OB_CRL, DIST_DOT, N_("CRL"), CM, &OBCRLCalc},
{OB_NT, DIST_DOT, N_("NT"), CM, NULL},
{OB_CERV, DIST_DOT, N_("Cerv Length"), CM, NULL},
/*
{OB_SAC1, DIST_DOT, N_("Sac Diam1"), CM, &OBSacCalc},
{OB_SAC2, DIST_DOT, N_("Sac Diam2"), CM, &OBSacCalc},
{OB_SAC3, DIST_DOT, N_("Sac Diam3"), CM, &OBSacCalc},
*/
{OB_SAC, SAC_3AXIS, N_("Sac Diam"), OB_SAC_MULTI, NULL},
{OB_YOLK_SAC, DIST_DOT, N_("Yolk Sac"), CM, NULL},
{OB_L_OV_VOL, MEA_TYPE_END, N_("L Ov Vol"), UNIT_END, NULL},
{OB_L_OV_H, DIST_DOT, N_("L Ov Height"), CM, &OBLOvVolCalc},
{OB_L_OV_L, DIST_DOT, N_("L Ov Length"), CM, &OBLOvVolCalc},
{OB_L_OV_W, DIST_DOT, N_("L Ov Width"), CM, &OBLOvVolCalc},
{OB_R_OV_VOL, MEA_TYPE_END, N_("R Ov Vol"), UNIT_END, NULL},
{OB_R_OV_H, DIST_DOT, N_("R Ov Height"), CM, &OBROvVolCalc},
{OB_R_OV_L, DIST_DOT, N_("R Ov Length"), CM, &OBROvVolCalc},
{OB_R_OV_W, DIST_DOT, N_("R Ov Width"), CM, &OBROvVolCalc},
{OB_RA_DIMEN, DIST_DOT, N_("RA Dimension"), CM, &OBRaDimenCalc},
{OB_RA_LEN, DIST_DOT, N_("RA Length"), CM, NULL},
{OB_RA_WIDTH, DIST_DOT, N_("RA Width"), CM, NULL},
{OB_RV_DIMEN, DIST_DOT, N_("RV Dimension"), CM, &OBRvDimenCalc},
{OB_RV_LEN, DIST_DOT, N_("RV Length"), CM, NULL},
{OB_RV_WIDTH, DIST_DOT, N_("RV Width"), CM, NULL},
{OB_RVOT, DIST_DOT, N_("RVOT Diam"), CM, NULL},
{OB_IVS_2D, DIST_DOT, N_("IVS(2D)"), CM, NULL},
{OB_LA_DIMEN, DIST_DOT, N_("LA Dimension"), CM, &OBLaDimenCalc},
{OB_LA_LEN, DIST_DOT, N_("LA Length"), CM, NULL},
{OB_LA_WIDTH, DIST_DOT, N_("LA Width"), CM, NULL},
{OB_LV_DIMEN, DIST_DOT, N_("LV Dimension"), CM, &OBLvDimenCalc},
{OB_LV_LEN, DIST_DOT, N_("LV Length"), CM, NULL},
{OB_LV_WIDTH, DIST_DOT, N_("LV Width"), CM, NULL},
{OB_LVOT_DIAM, DIST_DOT, N_("LVOT Diam"), CM, NULL},
{OB_HA_2D, AREA_ELLIPSE, N_("Heart Area"), CM2, &OBHrtCThrCCalc},//椭圆面积
{OB_HRTC_2D, PERI_ELLIPSE, N_("Heart Circ"), CM, &OBHrtCThrCCalc},//椭圆周长
{OB_HR, HR_M, N_("Heart Rate"), BPM, NULL},
{OB_THC, PERI_ELLIPSE, N_("ThrC"), CM, &OBHrtCThrCCalc},//胸周长
{OB_AOR_DIAM, DIST_DOT, N_("AoR Diam"), CM, &OBAoRDiamCalc},
{OB_AO_ANNUL, DIST_DOT, N_("Ao Annul Diam"), CM, NULL},
{OB_ASC_AO_DIAM, DIST_DOT, N_("Asc Ao Diam(2D)"), CM, NULL},
#ifdef EMP_322
#else
{OB_DESC_AO, RI, N_("Desc Ao"), OB_DESC_AO_MULTI, NULL},
#endif
{OB_DESC_AO_DIAM, DIST_DOT, N_("Desc Ao Diam(2D)"), CM, NULL},
{OB_DUCT_ART_DIAM, DIST_DOT, N_("Duct Art Diam(2D)"), CM, NULL},
{OB_DUCT_VEN, DIST_DOT, N_("Duct Ven"), CM, NULL},//还未知道是测什么
{OB_MV_ANNUL_DIAM, DIST_DOT, N_("MV Annul Diam"), CM, NULL},
{OB_TV_ANNUL_DIAM, DIST_DOT, N_("TV Annul Diam"), CM, NULL},
{OB_MPA_DIAM, DIST_DOT, N_("MPA Diam(2D)"), CM, &OBMPADiamCalc},
#ifdef EMP_322
#else
{OB_THORACIC_AO, RI, N_("Thoracic Ao"), OB_THORACIC_AO_MULTI, NULL},//胸主动脉
#endif
{OB_GS, DIST_DOT, N_("GS"), CM, &OBGSCalc},
{OB_BPD, DIST_DOT, N_("BPD"), CM, &OBBPDCalc},
{OB_AC, PERI_ELLIPSE, N_("AC"), CM, &OBACCalc},//周长
{OB_HC, PERI_ELLIPSE, N_("HC"), CM, &OBHCCalc},//周长
{OB_HL, DIST_DOT, N_("HL"), CM, &OBHLCalc},
{OB_FL, DIST_DOT, N_("FL"), CM, &OBFLCalc},
{OB_TAD, DIST_DOT,N_( "TAD"), CM, &OBTADCalc},
{OB_APAD, DIST_DOT, N_("APAD"), CM, &OBAPADCalc},
{OB_THD, DIST_DOT, N_("THD"), CM, &OBTHDCalc},
{OB_OFD, DIST_DOT, N_("OFD"), CM, &OBOFDCalc},
{OB_FTA, AREA_ELLIPSE, N_("FTA"), CM2, &OBFTACalc},//面积测量12.05
//{OB_FTA, DIST_DOT, N_("FTA"), CM, NULL},//面积测量
{OB_EAR, DIST_DOT, N_("Ear"), CM, NULL},
{OB_ORIBIT1, DIST_DOT, N_("Orbit1"), CM, NULL},
{OB_ORIBIT2, DIST_DOT, N_("Orbit2"), CM, NULL},
{OB_POST_FOSSA, DIST_DOT, N_("Post Fossa"), CM, NULL},
{OB_MANDIBLE, DIST_DOT, N_("Mandible"), CM, NULL},
{OB_NASAL, DIST_DOT, N_("Nasal"), CM, NULL},
{OB_CLAVICLE, DIST_DOT, N_("Clavicle"), CM, NULL},
{OB_M_PHALANX5, DIST_DOT, N_("M Phalanx 5"), CM, NULL},
{OB_L_FOOT_L, DIST_DOT, N_("L Foot L"), CM, NULL},//关于脚的测量忘了
{OB_L_FOOT_A, ANGLE_3DOT, N_("L Foot A"), ANG, NULL},//关于脚的测量忘了
{OB_R_FOOT_L, DIST_DOT, N_("R Foot L"), CM, NULL},//关于脚的测量忘了
{OB_R_FOOT_A, ANGLE_3DOT, N_("R Foot A"), ANG, NULL},//关于脚的测量忘了
{OB_BLADDER_AP, DIST_DOT, N_("Bladder AP"), CM, NULL},
{OB_BLADDER_L, DIST_DOT, N_("Bladder L"), CM, NULL},
{OB_BLADDER_TR, DIST_DOT, N_("Bladder Tr"), CM, NULL},
{OB_L_RENAL_AP, DIST_DOT, N_("L Renal AP"), CM, NULL},
{OB_L_RENAL_L, DIST_DOT, N_("L Renal L"), CM, NULL},
{OB_L_RENAL_TR, DIST_DOT, N_("L Renal Tr"), CM, NULL},
{OB_L_RENAL_PELVIS, DIST_DOT, N_("L Renal Pelvis"), CM, NULL},
{OB_R_RENAL_AP, DIST_DOT, N_("R Renal AP"), CM, NULL},
{OB_R_RENAL_L, DIST_DOT, N_("R Renal L"), CM, NULL},
{OB_R_RENAL_TR, DIST_DOT, N_("R Renal Tr"), CM, NULL},
{OB_R_RENAL_PELVIS, DIST_DOT, N_("R Renal Pelvis"), CM, NULL},
{OB_ADR_GLAND_AP, DIST_DOT, N_("Adr Gland AP"), CM, NULL},
{OB_ADR_GLAND_L, DIST_DOT, N_("Adr Gland L"), CM, NULL},
{OB_ADR_GLAND_TR, DIST_DOT, N_("Adr Gland Tr"), CM, NULL},
{OB_URETER_AP, DIST_DOT, N_("Ureter AP"), CM, NULL},
{OB_URETER_TR, DIST_DOT, N_("Ureter Tr"), CM, NULL},
{OB_L_LUNG_DIAM, DIST_DOT, N_("L Lung Diam"), CM, NULL},
{OB_R_LUNG_DIAM, DIST_DOT, N_("R Lung Diam"), CM, NULL},
#ifdef EMP_322
#else
{OB_L_UTERINE_A, RI, N_("L Uterine A"), OB_L_UTERINE_A_MULTI, NULL},//子宫动脉,没写清测啥
{OB_R_UTERINE_A, RI, N_("R Uterine A"), OB_R_UTERINE_A_MULTI, NULL},//子宫动脉,没写清测啥
#endif
{OB_PELVIS_AP, DIST_DOT, N_("Pelvis AP"), CM, NULL},
{OB_PELVIS_L, DIST_DOT, N_("Pelvis L"), CM, NULL},
{OB_PELVIS_TR, DIST_DOT, N_("Pelvis Tr"), CM, NULL},
{OB_SCAPULA, DIST_DOT, N_("Scapul"), CM, NULL}
};
const SingleItemInfo EFWInfo[] = {
{ OB_EFW_NEW, MEA_TYPE_END, N_("EFW"), UNIT_END, NULL}
};
/******************************GYN Measure**************************************/
//const CalcResultInfo GYNBladderVol = {GYN_CALC_BLADDER_VOL, "Bladder Vol", CM3, MeaCalcFun::GallBladderVolCalc};
const CalcResultInfo GYNBladderVol = {GYN_CALC_BLADDER_VOL, {GYN_BLADDER_L, GYN_BLADDER_W, GYN_BLADDER_H, NO_PAR, NO_PAR}, "Bladder Vol", CM3, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo GYNPVBladderVol = {GYN_CALC_PV_BLADDER_VOL, {GYN_PV_BLADDER_L, GYN_PV_BLADDER_W, GYN_PV_BLADDER_H, NO_PAR, NO_PAR}, "PV Bladder Vol", CM3, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo GYNLOvVol = {GYN_CALC_L_OV_VOL, {GYN_L_OV_LENGTH, GYN_L_OV_WIDTH, GYN_L_OV_HEIGHT, NO_PAR, NO_PAR}, "L Ov Vol", CM3, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo GYNROvVol = {GYN_CALC_R_OV_VOL, {GYN_R_OV_LENGTH, GYN_R_OV_WIDTH, GYN_R_OV_HEIGHT, NO_PAR, NO_PAR}, "R Ov Vol", CM3, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo GYNUterusVol = {GYN_CALC_UTERUS_VOL, {GYN_UTERUS_LENGTH, GYN_UTERUS_WIDTH, GYN_UTERUS_HEIGHT, NO_PAR, NO_PAR}, "Uterus Vol", CM3, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo GYNLFOLL1Vol = {GYN_L_FOLL1_VOL, {GYN_L_FOLL1, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "L Foll1 Vol", CM3, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo GYNLFOLL2Vol = {GYN_L_FOLL2_VOL, {GYN_L_FOLL2, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "L Foll2 Vol", CM3, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo GYNLFOLL3Vol = {GYN_L_FOLL3_VOL, {GYN_L_FOLL3, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "L Foll3 Vol", CM3, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo GYNLFOLL4Vol = {GYN_L_FOLL4_VOL, {GYN_L_FOLL4, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "L Foll4 Vol", CM3, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo GYNLFOLL5Vol = {GYN_L_FOLL5_VOL, {GYN_L_FOLL5, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "L Foll5 Vol", CM3, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo GYNLFOLL6Vol = {GYN_L_FOLL6_VOL, {GYN_L_FOLL6, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "L Foll6 Vol", CM3, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo GYNLFOLL7Vol = {GYN_L_FOLL7_VOL, {GYN_L_FOLL7, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "L Foll7 Vol", CM3, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo GYNLFOLL8Vol = {GYN_L_FOLL8_VOL, {GYN_L_FOLL8, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "L Foll8 Vol", CM3, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo GYNLFOLL9Vol = {GYN_L_FOLL9_VOL, {GYN_L_FOLL9, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "L Foll9 Vol", CM3, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo GYNLFOLL10Vol = {GYN_L_FOLL10_VOL, {GYN_L_FOLL10, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "L Foll10 Vol", CM3, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo GYNRFOLL1Vol = {GYN_R_FOLL1_VOL, {GYN_R_FOLL1, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "R Foll1 Vol", CM3, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo GYNRFOLL2Vol = {GYN_R_FOLL2_VOL, {GYN_R_FOLL2, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "R Foll2 Vol", CM3, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo GYNRFOLL3Vol = {GYN_R_FOLL3_VOL, {GYN_R_FOLL3, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "R Foll3 Vol", CM3, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo GYNRFOLL4Vol = {GYN_R_FOLL4_VOL, {GYN_R_FOLL4, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "R Foll4 Vol", CM3, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo GYNRFOLL5Vol = {GYN_R_FOLL5_VOL, {GYN_R_FOLL5, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "R Foll5 Vol", CM3, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo GYNRFOLL6Vol = {GYN_R_FOLL6_VOL, {GYN_R_FOLL6, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "R Foll6 Vol", CM3, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo GYNRFOLL7Vol = {GYN_R_FOLL7_VOL, {GYN_R_FOLL7, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "R Foll7 Vol", CM3, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo GYNRFOLL8Vol = {GYN_R_FOLL8_VOL, {GYN_R_FOLL8, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "R Foll8 Vol", CM3, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo GYNRFOLL9Vol = {GYN_R_FOLL9_VOL, {GYN_R_FOLL9, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "R Foll9 Vol", CM3, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo GYNRFOLL10Vol = {GYN_R_FOLL10_VOL, {GYN_R_FOLL10, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "R Foll10 Vol", CM3, MeaCalcFun::SectionCalc, NULL};
/*
const CalcResultInfo GYNFIBROID1Vol = {GYN_FIBROID1_VOL, {GYN_FIBROID1, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "Fibroid1 Vol", CM3, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo GYNFIBROID2Vol = {GYN_FIBROID2_VOL, {GYN_FIBROID2, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "Fibroid2 Vol", CM3, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo GYNFIBROID3Vol = {GYN_FIBROID3_VOL, {GYN_FIBROID3, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "Fibroid3 Vol", CM3, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo GYNFIBROID4Vol = {GYN_FIBROID4_VOL, {GYN_FIBROID4, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "Fibroid4 Vol", CM3, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo GYNFIBROID5Vol = {GYN_FIBROID5_VOL, {GYN_FIBROID5, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "Fibroid5 Vol", CM3, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo GYNFIBROID6Vol = {GYN_FIBROID6_VOL, {GYN_FIBROID6, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "Fibroid6 Vol", CM3, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo GYNFIBROID7Vol = {GYN_FIBROID7_VOL, {GYN_FIBROID7, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "Fibroid7 Vol", CM3, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo GYNFIBROID8Vol = {GYN_FIBROID8_VOL, {GYN_FIBROID8, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "Fibroid8 Vol", CM3, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo GYNFIBROID9Vol = {GYN_FIBROID9_VOL, {GYN_FIBROID9, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "Fibroid9 Vol", CM3, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo GYNFIBROID10Vol = {GYN_FIBROID10_VOL, {GYN_FIBROID10, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "Fibroid10 Vol", CM3, MeaCalcFun::SectionCalc, NULL};
*/
const CalcInfoArray GYNBladderCalc = {&GYNBladderVol, NULL};
const CalcInfoArray GYNPVBladderCalc = {&GYNPVBladderVol, NULL};
const CalcInfoArray GYNLOvCalc = {&GYNLOvVol, NULL};
const CalcInfoArray GYNROvCalc = {&GYNROvVol, NULL};
const CalcInfoArray GYNUterusCalc = {&GYNUterusVol, NULL};
const CalcInfoArray GYNLFOLL1Calc = {&GYNLFOLL1Vol, NULL};
const CalcInfoArray GYNLFOLL2Calc = {&GYNLFOLL2Vol, NULL};
const CalcInfoArray GYNLFOLL3Calc = {&GYNLFOLL3Vol, NULL};
const CalcInfoArray GYNLFOLL4Calc = {&GYNLFOLL4Vol, NULL};
const CalcInfoArray GYNLFOLL5Calc = {&GYNLFOLL5Vol, NULL};
const CalcInfoArray GYNLFOLL6Calc = {&GYNLFOLL6Vol, NULL};
const CalcInfoArray GYNLFOLL7Calc = {&GYNLFOLL7Vol, NULL};
const CalcInfoArray GYNLFOLL8Calc = {&GYNLFOLL8Vol, NULL};
const CalcInfoArray GYNLFOLL9Calc = {&GYNLFOLL9Vol, NULL};
const CalcInfoArray GYNLFOLL10Calc = {&GYNLFOLL10Vol, NULL};
const CalcInfoArray GYNRFOLL1Calc = {&GYNRFOLL1Vol, NULL};
const CalcInfoArray GYNRFOLL2Calc = {&GYNRFOLL2Vol, NULL};
const CalcInfoArray GYNRFOLL3Calc = {&GYNRFOLL3Vol, NULL};
const CalcInfoArray GYNRFOLL4Calc = {&GYNRFOLL4Vol, NULL};
const CalcInfoArray GYNRFOLL5Calc = {&GYNRFOLL5Vol, NULL};
const CalcInfoArray GYNRFOLL6Calc = {&GYNRFOLL6Vol, NULL};
const CalcInfoArray GYNRFOLL7Calc = {&GYNRFOLL7Vol, NULL};
const CalcInfoArray GYNRFOLL8Calc = {&GYNRFOLL8Vol, NULL};
const CalcInfoArray GYNRFOLL9Calc = {&GYNRFOLL9Vol, NULL};
const CalcInfoArray GYNRFOLL10Calc = {&GYNRFOLL10Vol, NULL};
/*
const CalcInfoArray GYNFIBROID1Calc = {&GYNFIBROID1Vol, NULL};
const CalcInfoArray GYNFIBROID2Calc = {&GYNFIBROID2Vol, NULL};
const CalcInfoArray GYNFIBROID3Calc = {&GYNFIBROID3Vol, NULL};
const CalcInfoArray GYNFIBROID4Calc = {&GYNFIBROID4Vol, NULL};
const CalcInfoArray GYNFIBROID5Calc = {&GYNFIBROID5Vol, NULL};
const CalcInfoArray GYNFIBROID6Calc = {&GYNFIBROID6Vol, NULL};
const CalcInfoArray GYNFIBROID7Calc = {&GYNFIBROID7Vol, NULL};
const CalcInfoArray GYNFIBROID8Calc = {&GYNFIBROID8Vol, NULL};
const CalcInfoArray GYNFIBROID9Calc = {&GYNFIBROID9Vol, NULL};
const CalcInfoArray GYNFIBROID10Calc = {&GYNFIBROID10Vol, NULL};
*/
const PtrOfCalcInfo GYNCalcInfoPtr[GYN_CALC_END - GYN_CALC_START] = {
{GYN_CALC_BLADDER_VOL, &GYNBladderVol},
{GYN_CALC_PV_BLADDER_VOL, &GYNPVBladderVol},
{GYN_CALC_L_OV_VOL, &GYNLOvVol},
{GYN_CALC_R_OV_VOL, &GYNROvVol},
{GYN_CALC_UTERUS_VOL, &GYNUterusVol},
{GYN_L_FOLL1_VOL, &GYNLFOLL1Vol},
{GYN_L_FOLL2_VOL, &GYNLFOLL2Vol},
{GYN_L_FOLL3_VOL, &GYNLFOLL3Vol},
{GYN_L_FOLL4_VOL, &GYNLFOLL4Vol},
{GYN_L_FOLL5_VOL, &GYNLFOLL5Vol},
{GYN_L_FOLL6_VOL, &GYNLFOLL6Vol},
{GYN_L_FOLL7_VOL, &GYNLFOLL7Vol},
{GYN_L_FOLL8_VOL, &GYNLFOLL8Vol},
{GYN_L_FOLL9_VOL, &GYNLFOLL9Vol},
{GYN_L_FOLL10_VOL, &GYNLFOLL10Vol},
{GYN_R_FOLL1_VOL, &GYNRFOLL1Vol},
{GYN_R_FOLL2_VOL, &GYNRFOLL2Vol},
{GYN_R_FOLL3_VOL, &GYNRFOLL3Vol},
{GYN_R_FOLL4_VOL, &GYNRFOLL4Vol},
{GYN_R_FOLL5_VOL, &GYNRFOLL5Vol},
{GYN_R_FOLL6_VOL, &GYNRFOLL6Vol},
{GYN_R_FOLL7_VOL, &GYNRFOLL7Vol},
{GYN_R_FOLL8_VOL, &GYNRFOLL8Vol},
{GYN_R_FOLL9_VOL, &GYNRFOLL9Vol},
{GYN_R_FOLL10_VOL, &GYNRFOLL10Vol},
/* {GYN_FIBROID1_VOL, &GYNFIBROID1Vol},
{GYN_FIBROID2_VOL, &GYNFIBROID2Vol},
{GYN_FIBROID3_VOL, &GYNFIBROID3Vol},
{GYN_FIBROID4_VOL, &GYNFIBROID4Vol},
{GYN_FIBROID5_VOL, &GYNFIBROID5Vol},
{GYN_FIBROID6_VOL, &GYNFIBROID6Vol},
{GYN_FIBROID7_VOL, &GYNFIBROID7Vol},
{GYN_FIBROID8_VOL, &GYNFIBROID8Vol},
{GYN_FIBROID9_VOL, &GYNFIBROID9Vol},
{GYN_FIBROID10_VOL, &GYNFIBROID10Vol}
*/
};
const MultiItemInfo GYNMultiInfo[] = {
#ifdef EMP_322
#else
{GYN_L_OVARIAN_A, GYN_L_OVARIAN_A_MULTI, SD, "L OV A", SdInfo, NULL },
{GYN_R_OVARIAN_A, GYN_R_OVARIAN_A_MULTI, SD, "R OV A", SdInfo, NULL },
{GYN_L_UTERINE_A, GYN_L_UTERINE_A_MULTI, SD, "L Ut A", SdInfo, NULL },
{GYN_R_UTERINE_A, GYN_R_UTERINE_A_MULTI, SD, "R Ut A", SdInfo, NULL },
#endif
};
const SingleItemInfo GYNInfo[] = {
{GYN_BLADDER_VOL, MEA_TYPE_END, N_("Bladder Vol(Gyn)"), UNIT_END, NULL},
{GYN_BLADDER_H, DIST_DOT, N_("Bladder H"), CM, &GYNBladderCalc},
{GYN_BLADDER_L, DIST_DOT, N_("Bladder L"), CM, &GYNBladderCalc},
{GYN_BLADDER_W, DIST_DOT, N_("Bladder W"), CM, &GYNBladderCalc},
{GYN_PV_BLADDER_VOL, MEA_TYPE_END, N_("PV Bladder Vol(Gyn)"), UNIT_END, NULL},
{GYN_PV_BLADDER_H, DIST_DOT, N_("PV Bladder H"), CM, &GYNPVBladderCalc},
{GYN_PV_BLADDER_L, DIST_DOT, N_("PV Bladder L"), CM, &GYNPVBladderCalc},
{GYN_PV_BLADDER_W, DIST_DOT, N_("PV Bladder W"), CM, &GYNPVBladderCalc},
{GYN_L_OV_VOL, MEA_TYPE_END, N_("L Ov Vol"), UNIT_END, NULL},
{GYN_L_OV_HEIGHT, DIST_DOT, N_("L Ov Height"), CM, &GYNLOvCalc},
{GYN_L_OV_LENGTH, DIST_DOT, N_("L Ov Length"), CM, &GYNLOvCalc},
{GYN_L_OV_WIDTH, DIST_DOT, N_("L Ov Width"), CM, &GYNLOvCalc},
#ifdef EMP_322
#else
{GYN_L_OVARIAN_A, SD, N_("L Ovarian A"), GYN_L_OVARIAN_A_MULTI, NULL},
#endif
{GYN_R_OV_VOL, MEA_TYPE_END, N_("R Ov Vol"), UNIT_END, NULL},
{GYN_R_OV_HEIGHT, DIST_DOT, N_("R Ov Height"), CM, &GYNROvCalc},
{GYN_R_OV_LENGTH, DIST_DOT, N_("R Ov Length"), CM, &GYNROvCalc},
{GYN_R_OV_WIDTH, DIST_DOT, N_("R Ov Width"), CM, &GYNROvCalc},
#ifdef EMP_322
#else
{GYN_R_OVARIAN_A, SD, N_("R Ovarian A"), GYN_R_OVARIAN_A_MULTI, NULL},
#endif
{GYN_CERV_LENGTH, DIST_DOT, N_("Cerv Length"), CM, NULL},
{GYN_ENDO_THICK, DIST_DOT, N_("Endo Thick"), CM, NULL},
{GYN_UTERUS_VOL, MEA_TYPE_END, N_("Uterus Vol"), UNIT_END, NULL},
{GYN_UTERUS_HEIGHT, DIST_DOT, N_("Uterus Height"), CM, &GYNUterusCalc},
{GYN_UTERUS_LENGTH, DIST_DOT, N_("Uterus Length"), CM, &GYNUterusCalc},
{GYN_UTERUS_WIDTH, DIST_DOT, N_("Uterus Width"), CM, &GYNUterusCalc},
{GYN_L_UTERINE_A_DIAM, DIST_DOT, N_("L Uterine A Diam"), CM, NULL},
#ifdef EMP_322
#else
{GYN_L_UTERINE_A, SD, N_("L Uterine A"), GYN_L_UTERINE_A_MULTI, NULL},
#endif
{GYN_R_UTERINE_A_DIAM, DIST_DOT, N_("R Uterine A Diam"), CM, NULL},
#ifdef EMP_322
#else
{GYN_R_UTERINE_A, SD, N_("R Uterine A"), GYN_R_UTERINE_A_MULTI, NULL},
#endif
{GYN_FHR, HR_M, N_("FHR"), BPM, NULL},
{GYN_L_FOLL1, DIST_DOT, N_("L Foll1"), CM, &GYNLFOLL1Calc},
{GYN_L_FOLL2, DIST_DOT, N_("L Foll2"), CM, &GYNLFOLL2Calc},
{GYN_L_FOLL3, DIST_DOT, N_("L Foll3"), CM, &GYNLFOLL3Calc},
{GYN_L_FOLL4, DIST_DOT, N_("L Foll4"), CM, &GYNLFOLL4Calc},
{GYN_L_FOLL5, DIST_DOT, N_("L Foll5"), CM, &GYNLFOLL5Calc},
{GYN_L_FOLL6, DIST_DOT, N_("L Foll6"), CM, &GYNLFOLL6Calc},
{GYN_L_FOLL7, DIST_DOT, N_("L Foll7"), CM, &GYNLFOLL7Calc},
{GYN_L_FOLL8, DIST_DOT, N_("L Foll8"), CM, &GYNLFOLL8Calc},
{GYN_L_FOLL9, DIST_DOT, N_("L Foll9"), CM, &GYNLFOLL9Calc},
{GYN_L_FOLL10, DIST_DOT, N_("L Foll10"), CM, &GYNLFOLL10Calc},
{GYN_R_FOLL1, DIST_DOT, N_("R Foll1"), CM, &GYNRFOLL1Calc},
{GYN_R_FOLL2, DIST_DOT, N_("R Foll2"), CM, &GYNRFOLL2Calc},
{GYN_R_FOLL3, DIST_DOT, N_("R Foll3"), CM, &GYNRFOLL3Calc},
{GYN_R_FOLL4, DIST_DOT, N_("R Foll4"), CM, &GYNRFOLL4Calc},
{GYN_R_FOLL5, DIST_DOT, N_("R Foll5"), CM, &GYNRFOLL5Calc},
{GYN_R_FOLL6, DIST_DOT, N_("R Foll6"), CM, &GYNRFOLL6Calc},
{GYN_R_FOLL7, DIST_DOT, N_("R Foll7"), CM, &GYNRFOLL7Calc},
{GYN_R_FOLL8, DIST_DOT, N_("R Foll8"), CM, &GYNRFOLL8Calc},
{GYN_R_FOLL9, DIST_DOT, N_("R Foll9"), CM, &GYNRFOLL9Calc},
{GYN_R_FOLL10, DIST_DOT, N_("R Foll10"), CM, &GYNRFOLL10Calc},
{GYN_FIBROID1, DIST_DOT, N_("Fibroid1"), CM, NULL},
{GYN_FIBROID2, DIST_DOT, N_("Fibroid2"), CM, NULL},
{GYN_FIBROID3, DIST_DOT, N_("Fibroid3"), CM, NULL},
{GYN_FIBROID4, DIST_DOT, N_("Fibroid4"), CM, NULL},
{GYN_FIBROID5, DIST_DOT, N_("Fibroid5"), CM, NULL},
{GYN_FIBROID6, DIST_DOT, N_("Fibroid6"), CM, NULL},
{GYN_FIBROID7, DIST_DOT, N_("Fibroid7"), CM, NULL},
{GYN_FIBROID8, DIST_DOT, N_("Fibroid8"), CM, NULL},
{GYN_FIBROID9, DIST_DOT, N_("Fibroid9"), CM, NULL},
{GYN_FIBROID10, DIST_DOT, N_("Fibroid10"), CM, NULL},
};
/******************************UR Measure**************************************/
const CalcResultInfo URBladderVol = {UR_CALC_BLADDER_VOL, {UR_BLADDER_L, UR_BLADDER_W, UR_BLADDER_H, NO_PAR, NO_PAR}, "Bladder Vol", CM3, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo URPVBladderVol = {UR_CALC_PV_BLADDER_VOL, {UR_PV_BLADDER_L, UR_PV_BLADDER_W, UR_PV_BLADDER_H, NO_PAR, NO_PAR}, "PV Bladder Vol", CM3, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo URProstateVol = {UR_CALC_PROSTATE_VOL, {UR_PROSTATE_L, UR_PROSTATE_W, UR_PROSTATE_H, NO_PAR, NO_PAR}, "Prostate Vol", CM3, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo URLKidVol = {UR_CALC_L_KID_VOL, {UR_L_KID_L, UR_L_KID_W, UR_L_KID_H, NO_PAR, NO_PAR}, "L KID Vol", CM3, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo URRKidVol = {UR_CALC_R_KID_VOL, {UR_R_KID_L, UR_R_KID_W, UR_R_KID_H, NO_PAR, NO_PAR}, "R KID Vol", CM3, MeaCalcFun::SectionCalc, NULL};
const CalcInfoArray URBladderVolCalc = {&URBladderVol, NULL};
const CalcInfoArray URPVBladderVolCalc = {&URPVBladderVol, NULL};
const CalcInfoArray URProstateVolCalc = {&URProstateVol, NULL};
const CalcInfoArray URLKidVolCalc = {&URLKidVol, NULL};
const CalcInfoArray URRKidVolCalc = {&URRKidVol, NULL};
const PtrOfCalcInfo URCalcInfoPtr[UR_CALC_END - UR_CALC_START] = {
{UR_CALC_BLADDER_VOL, &URBladderVol},
{UR_CALC_PV_BLADDER_VOL, &URPVBladderVol},
{UR_CALC_PROSTATE_VOL, &URProstateVol},
{UR_CALC_L_KID_VOL, &URLKidVol},
{UR_CALC_R_KID_VOL, &URRKidVol}
};
const MultiItemInfo URMultiInfo[] = {
#ifdef EMP_322
#else
{ UR_L_DIST_REN_A, UR_L_DIST_REN_A_MULTI, RI, "L Dist Ren A", RiInfo, NULL },
{ UR_L_MAIN_REN_A, UR_L_MAIN_REN_A_MULTI, RI, "L Main Ren A", RiInfo, NULL },
{ UR_L_REN_V, UR_L_REN_V_MULTI, RI, "L Ren V", RiInfo, NULL },
{ UR_R_DIST_REN_A, UR_R_DIST_REN_A_MULTI, RI, "R Dist Ren A", RiInfo, NULL },
{ UR_R_MAIN_REN_A, UR_R_MAIN_REN_A_MULTI, RI, "R Main Ren A", RiInfo, NULL },
{ UR_R_REN_V, UR_R_REN_V_MULTI, RI, "R Ren V", RiInfo, NULL },
#endif
};
const SingleItemInfo URInfo[] = {
{UR_BLADDER_VOL, MEA_TYPE_END, N_("Bladder Vol"), UNIT_END, NULL},
{UR_BLADDER_H, DIST_DOT, N_("Bladder H"), CM, &URBladderVolCalc},
{UR_BLADDER_L, DIST_DOT, N_("Bladder L"), CM, &URBladderVolCalc},
{UR_BLADDER_W, DIST_DOT, N_("Bladder W"), CM, &URBladderVolCalc},
{UR_PV_BLADDER_VOL, MEA_TYPE_END, N_("PV Bladder Vol"), UNIT_END, NULL},
{UR_PV_BLADDER_H, DIST_DOT, N_("PV Bladder H"), CM, &URPVBladderVolCalc},
{UR_PV_BLADDER_L, DIST_DOT, N_("PV Bladder L"), CM, &URPVBladderVolCalc},
{UR_PV_BLADDER_W, DIST_DOT, N_("PV Bladder W"), CM, &URPVBladderVolCalc},
{UR_PROSTATE_VOL, MEA_TYPE_END, N_("Prostate Vol"), UNIT_END, NULL},
{UR_PROSTATE_H, DIST_DOT, N_("Prostate H"), CM, &URProstateVolCalc},
{UR_PROSTATE_L, DIST_DOT, N_("Prostate L"), CM, &URProstateVolCalc},
{UR_PROSTATE_W, DIST_DOT, N_("Prostate W"), CM, &URProstateVolCalc},
{UR_L_KID_VOL, MEA_TYPE_END, N_("L Kid Vol"), UNIT_END, NULL},
{UR_L_KID_H, DIST_DOT, N_("L Kid H"), CM, &URLKidVolCalc},
{UR_L_KID_L, DIST_DOT, N_("L Kid L"), CM, &URLKidVolCalc},
{UR_L_KID_W, DIST_DOT, N_("L Kid W"), CM, &URLKidVolCalc},
#ifdef EMP_322
#else
{UR_L_DIST_REN_A, RI, N_("L Dist Ren A"), UR_L_DIST_REN_A_MULTI, NULL},
{UR_L_MAIN_REN_A, RI, N_("L Main Ren A"), UR_L_MAIN_REN_A_MULTI, NULL},
{UR_L_REN_V, RI, N_("L Ren V"), UR_L_REN_V_MULTI, NULL},
#endif
{UR_L_URETER_AP, DIST_DOT, N_("L Ureter AP"), CM, NULL},
{UR_L_URETER_TR, DIST_DOT, N_("L Ureter Tr"), CM, NULL},
{UR_R_KID_VOL, MEA_TYPE_END, N_("R Kid Vol"), UNIT_END, NULL},
{UR_R_KID_H, DIST_DOT, N_("R Kid H"), CM, &URRKidVolCalc},
{UR_R_KID_L, DIST_DOT, N_("R Kid L"), CM, &URRKidVolCalc},
{UR_R_KID_W, DIST_DOT, N_("R Kid W"), CM, &URRKidVolCalc},
#ifdef EMP_322
#else
{UR_R_DIST_REN_A, RI, N_("R Dist Ren A"), UR_R_DIST_REN_A_MULTI, NULL},
{UR_R_MAIN_REN_A, RI, N_("R Main Ren A"), UR_R_MAIN_REN_A_MULTI, NULL},
{UR_R_REN_V, RI, N_("R Ren V"), UR_R_REN_V_MULTI, NULL},
#endif
{UR_R_URETER_AP, DIST_DOT, N_("R Ureter AP"), CM, NULL},
{UR_R_URETER_TR, DIST_DOT, N_("R Ureter Tr"), CM, NULL},
};
#ifndef VET
/******************************SP Measure**************************************/
const CalcResultInfo SPLBreLesion1Vol = {SP_BRE_L_LESION1_VOL_C, {SP_BRE_L_LESION1_L, SP_BRE_L_LESION1_W, SP_BRE_L_LESION1_H, NO_PAR, NO_PAR}, "L Lesion1 Vol", CM3, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo SPLBreLesion2Vol = {SP_BRE_L_LESION2_VOL_C, {SP_BRE_L_LESION2_L, SP_BRE_L_LESION2_W, SP_BRE_L_LESION2_H, NO_PAR, NO_PAR}, "L Lesion2 Vol", CM3, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo SPLBreLesion3Vol = {SP_BRE_L_LESION3_VOL_C, {SP_BRE_L_LESION3_L, SP_BRE_L_LESION3_W, SP_BRE_L_LESION3_H, NO_PAR, NO_PAR}, "L Lesion3 Vol", CM3, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo SPLBreLesion4Vol = {SP_BRE_L_LESION4_VOL_C, {SP_BRE_L_LESION4_L, SP_BRE_L_LESION4_W, SP_BRE_L_LESION4_H, NO_PAR, NO_PAR}, "L Lesion4 Vol", CM3, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo SPLBreLesion5Vol = {SP_BRE_L_LESION5_VOL_C, {SP_BRE_L_LESION5_L, SP_BRE_L_LESION5_W, SP_BRE_L_LESION5_H, NO_PAR, NO_PAR}, "L Lesion5 Vol", CM3, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo SPRBreLesion1Vol = {SP_BRE_R_LESION1_VOL_C, {SP_BRE_R_LESION1_L, SP_BRE_R_LESION1_W, SP_BRE_R_LESION1_H, NO_PAR, NO_PAR}, "R Lesion1 Vol", CM3, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo SPRBreLesion2Vol = {SP_BRE_R_LESION2_VOL_C, {SP_BRE_R_LESION2_L, SP_BRE_R_LESION2_W, SP_BRE_R_LESION2_H, NO_PAR, NO_PAR}, "R Lesion2 Vol", CM3, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo SPRBreLesion3Vol = {SP_BRE_R_LESION3_VOL_C, {SP_BRE_R_LESION3_L, SP_BRE_R_LESION3_W, SP_BRE_R_LESION3_H, NO_PAR, NO_PAR}, "R Lesion3 Vol", CM3, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo SPRBreLesion4Vol = {SP_BRE_R_LESION4_VOL_C, {SP_BRE_R_LESION4_L, SP_BRE_R_LESION4_W, SP_BRE_R_LESION4_H, NO_PAR, NO_PAR}, "R Lesion4 Vol", CM3, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo SPRBreLesion5Vol = {SP_BRE_R_LESION5_VOL_C, {SP_BRE_R_LESION5_L, SP_BRE_R_LESION5_W, SP_BRE_R_LESION5_H, NO_PAR, NO_PAR}, "R Lesion5 Vol", CM3, MeaCalcFun::SectionCalc, NULL};
#endif
#ifdef VET //Ve
const CalcResultInfo SPBre1Lesion1Vol = {SP_BRE1_LESION1_VOL_C, {SP_BRE1_LESION1_L, SP_BRE1_LESION1_W, SP_BRE1_LESION1_H, NO_PAR, NO_PAR}, "Bre1 Le1 Vol", CM3, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo SPBre1Lesion2Vol = {SP_BRE1_LESION2_VOL_C, {SP_BRE1_LESION2_L, SP_BRE1_LESION2_W, SP_BRE1_LESION2_H, NO_PAR, NO_PAR}, "Bre1 Le2 Vol", CM3, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo SPBre1Lesion3Vol = {SP_BRE1_LESION3_VOL_C, {SP_BRE1_LESION3_L, SP_BRE1_LESION3_W, SP_BRE1_LESION3_H, NO_PAR, NO_PAR}, "Bre1 Le3 Vol", CM3, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo SPBre1Lesion4Vol = {SP_BRE1_LESION4_VOL_C, {SP_BRE1_LESION4_L, SP_BRE1_LESION4_W, SP_BRE1_LESION4_H, NO_PAR, NO_PAR}, "Bre1 Le4 Vol", CM3, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo SPBre1Lesion5Vol = {SP_BRE1_LESION5_VOL_C, {SP_BRE1_LESION5_L, SP_BRE1_LESION5_W, SP_BRE1_LESION5_H, NO_PAR, NO_PAR}, "Bre1 Le5 Vol", CM3, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo SPBre2Lesion1Vol = {SP_BRE2_LESION1_VOL_C, {SP_BRE2_LESION1_L, SP_BRE2_LESION1_W, SP_BRE2_LESION1_H, NO_PAR, NO_PAR}, "Bre2 Le1 Vol", CM3, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo SPBre2Lesion2Vol = {SP_BRE2_LESION2_VOL_C, {SP_BRE2_LESION2_L, SP_BRE2_LESION2_W, SP_BRE2_LESION2_H, NO_PAR, NO_PAR}, "Bre2 Le2 Vol", CM3, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo SPBre2Lesion3Vol = {SP_BRE2_LESION3_VOL_C, {SP_BRE2_LESION3_L, SP_BRE2_LESION3_W, SP_BRE2_LESION3_H, NO_PAR, NO_PAR}, "Bre2 Le3 Vol", CM3, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo SPBre2Lesion4Vol = {SP_BRE2_LESION4_VOL_C, {SP_BRE2_LESION4_L, SP_BRE2_LESION4_W, SP_BRE2_LESION4_H, NO_PAR, NO_PAR}, "Bre2 Le4 Vol", CM3, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo SPBre2Lesion5Vol = {SP_BRE2_LESION5_VOL_C, {SP_BRE2_LESION5_L, SP_BRE2_LESION5_W, SP_BRE2_LESION5_H, NO_PAR, NO_PAR}, "Bre2 Le5 Vol", CM3, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo SPBre3Lesion1Vol = {SP_BRE3_LESION1_VOL_C, {SP_BRE3_LESION1_L, SP_BRE3_LESION1_W, SP_BRE3_LESION1_H, NO_PAR, NO_PAR}, "Bre3 Le1 Vol", CM3, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo SPBre3Lesion2Vol = {SP_BRE3_LESION2_VOL_C, {SP_BRE3_LESION2_L, SP_BRE3_LESION2_W, SP_BRE3_LESION2_H, NO_PAR, NO_PAR}, "Bre3 Le2 Vol", CM3, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo SPBre3Lesion3Vol = {SP_BRE3_LESION3_VOL_C, {SP_BRE3_LESION3_L, SP_BRE3_LESION3_W, SP_BRE3_LESION3_H, NO_PAR, NO_PAR}, "Bre3 Le3 Vol", CM3, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo SPBre3Lesion4Vol = {SP_BRE3_LESION4_VOL_C, {SP_BRE3_LESION4_L, SP_BRE3_LESION4_W, SP_BRE3_LESION4_H, NO_PAR, NO_PAR}, "Bre3 Le4 Vol", CM3, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo SPBre3Lesion5Vol = {SP_BRE3_LESION5_VOL_C, {SP_BRE3_LESION5_L, SP_BRE3_LESION5_W, SP_BRE3_LESION5_H, NO_PAR, NO_PAR}, "Bre3 Le5 Vol", CM3, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo SPBre4Lesion1Vol = {SP_BRE4_LESION1_VOL_C, {SP_BRE4_LESION1_L, SP_BRE4_LESION1_W, SP_BRE4_LESION1_H, NO_PAR, NO_PAR}, "Bre4 Le1 Vol", CM3, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo SPBre4Lesion2Vol = {SP_BRE4_LESION2_VOL_C, {SP_BRE4_LESION2_L, SP_BRE4_LESION2_W, SP_BRE4_LESION2_H, NO_PAR, NO_PAR}, "Bre4 Le2 Vol", CM3, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo SPBre4Lesion3Vol = {SP_BRE4_LESION3_VOL_C, {SP_BRE4_LESION3_L, SP_BRE4_LESION3_W, SP_BRE4_LESION3_H, NO_PAR, NO_PAR}, "Bre4 Le3 Vol", CM3, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo SPBre4Lesion4Vol = {SP_BRE4_LESION4_VOL_C, {SP_BRE4_LESION4_L, SP_BRE4_LESION4_W, SP_BRE4_LESION4_H, NO_PAR, NO_PAR}, "Bre4 Le4 Vol", CM3, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo SPBre4Lesion5Vol = {SP_BRE4_LESION5_VOL_C, {SP_BRE4_LESION5_L, SP_BRE4_LESION5_W, SP_BRE4_LESION5_H, NO_PAR, NO_PAR}, "Bre4 Le5 Vol", CM3, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo SPBre5Lesion1Vol = {SP_BRE5_LESION1_VOL_C, {SP_BRE5_LESION1_L, SP_BRE5_LESION1_W, SP_BRE5_LESION1_H, NO_PAR, NO_PAR}, "Bre5 Le1 Vol", CM3, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo SPBre5Lesion2Vol = {SP_BRE5_LESION2_VOL_C, {SP_BRE5_LESION2_L, SP_BRE5_LESION2_W, SP_BRE5_LESION2_H, NO_PAR, NO_PAR}, "Bre5 Le2 Vol", CM3, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo SPBre5Lesion3Vol = {SP_BRE5_LESION3_VOL_C, {SP_BRE5_LESION3_L, SP_BRE5_LESION3_W, SP_BRE5_LESION3_H, NO_PAR, NO_PAR}, "Bre5 Le3 Vol", CM3, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo SPBre5Lesion4Vol = {SP_BRE5_LESION4_VOL_C, {SP_BRE5_LESION4_L, SP_BRE5_LESION4_W, SP_BRE5_LESION4_H, NO_PAR, NO_PAR}, "Bre5 Le4 Vol", CM3, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo SPBre5Lesion5Vol = {SP_BRE5_LESION5_VOL_C, {SP_BRE5_LESION5_L, SP_BRE5_LESION5_W, SP_BRE5_LESION5_H, NO_PAR, NO_PAR}, "Bre5 Le5 Vol", CM3, MeaCalcFun::SectionCalc, NULL};
#endif
const CalcResultInfo SPLTesVol = {SP_L_TESTIS_VOL_C, {SP_L_TESTIS_L, SP_L_TESTIS_W, SP_L_TESTIS_H, NO_PAR, NO_PAR}, "L Tes Vol", CM3, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo SPRTesVol = {SP_R_TESTIS_VOL_C, {SP_R_TESTIS_L, SP_R_TESTIS_W, SP_R_TESTIS_H, NO_PAR, NO_PAR}, "R Tes Vol", CM3, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo SPLTesLesion1Vol = {SP_TES_L_LESION1_VOL_C, {SP_TES_L_LESION1_L, SP_TES_L_LESION1_W, SP_TES_L_LESION1_H, NO_PAR, NO_PAR}, "L Lesion1 Vol", CM3, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo SPLTesLesion2Vol = {SP_TES_L_LESION2_VOL_C, {SP_TES_L_LESION2_L, SP_TES_L_LESION2_W, SP_TES_L_LESION2_H, NO_PAR, NO_PAR}, "L Lesion2 Vol", CM3, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo SPLTesLesion3Vol = {SP_TES_L_LESION3_VOL_C, {SP_TES_L_LESION3_L, SP_TES_L_LESION3_W, SP_TES_L_LESION3_H, NO_PAR, NO_PAR}, "L Lesion3 Vol", CM3, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo SPLTesLesion4Vol = {SP_TES_L_LESION4_VOL_C, {SP_TES_L_LESION4_L, SP_TES_L_LESION4_W, SP_TES_L_LESION4_H, NO_PAR, NO_PAR}, "L Lesion4 Vol", CM3, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo SPLTesLesion5Vol = {SP_TES_L_LESION5_VOL_C, {SP_TES_L_LESION5_L, SP_TES_L_LESION5_W, SP_TES_L_LESION5_H, NO_PAR, NO_PAR}, "L Lesion5 Vol", CM3, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo SPRTesLesion1Vol = {SP_TES_R_LESION1_VOL_C, {SP_TES_R_LESION1_L, SP_TES_R_LESION1_W, SP_TES_R_LESION1_H, NO_PAR, NO_PAR}, "R Lesion1 Vol", CM3, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo SPRTesLesion2Vol = {SP_TES_R_LESION2_VOL_C, {SP_TES_R_LESION2_L, SP_TES_R_LESION2_W, SP_TES_R_LESION2_H, NO_PAR, NO_PAR}, "R Lesion2 Vol", CM3, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo SPRTesLesion3Vol = {SP_TES_R_LESION3_VOL_C, {SP_TES_R_LESION3_L, SP_TES_R_LESION3_W, SP_TES_R_LESION3_H, NO_PAR, NO_PAR}, "R Lesion3 Vol", CM3, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo SPRTesLesion4Vol = {SP_TES_R_LESION4_VOL_C, {SP_TES_R_LESION4_L, SP_TES_R_LESION4_W, SP_TES_R_LESION4_H, NO_PAR, NO_PAR}, "R Lesion4 Vol", CM3, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo SPRTesLesion5Vol = {SP_TES_R_LESION5_VOL_C, {SP_TES_R_LESION5_L, SP_TES_R_LESION5_W, SP_TES_R_LESION5_H, NO_PAR, NO_PAR}, "R Lesion5 Vol", CM3, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo SPThyLesion1Vol = {SP_THY_LESION1_VOL_C, {SP_THY_LESION1_L, SP_THY_LESION1_W, SP_THY_LESION1_H, NO_PAR, NO_PAR}, "Lesion1 Vol", CM3, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo SPThyLesion2Vol = {SP_THY_LESION2_VOL_C, {SP_THY_LESION2_L, SP_THY_LESION2_W, SP_THY_LESION2_H, NO_PAR, NO_PAR}, "Lesion2 Vol", CM3, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo SPThyLesion3Vol = {SP_THY_LESION3_VOL_C, {SP_THY_LESION3_L, SP_THY_LESION3_W, SP_THY_LESION3_H, NO_PAR, NO_PAR}, "Lesion3 Vol", CM3, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo SPThyLesion4Vol = {SP_THY_LESION4_VOL_C, {SP_THY_LESION4_L, SP_THY_LESION4_W, SP_THY_LESION4_H, NO_PAR, NO_PAR}, "Lesion4 Vol", CM3, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo SPThyLesion5Vol = {SP_THY_LESION5_VOL_C, {SP_THY_LESION5_L, SP_THY_LESION5_W, SP_THY_LESION5_H, NO_PAR, NO_PAR}, "Lesion5 Vol", CM3, MeaCalcFun::SectionCalc, NULL};
#ifdef VET
#else
const CalcInfoArray SPLBreLesion1VolCalc = {&SPLBreLesion1Vol, NULL};
const CalcInfoArray SPLBreLesion2VolCalc = {&SPLBreLesion2Vol, NULL};
const CalcInfoArray SPLBreLesion3VolCalc = {&SPLBreLesion3Vol, NULL};
const CalcInfoArray SPLBreLesion4VolCalc = {&SPLBreLesion4Vol, NULL};
const CalcInfoArray SPLBreLesion5VolCalc = {&SPLBreLesion5Vol, NULL};
const CalcInfoArray SPRBreLesion1VolCalc = {&SPRBreLesion1Vol, NULL};
const CalcInfoArray SPRBreLesion2VolCalc = {&SPRBreLesion2Vol, NULL};
const CalcInfoArray SPRBreLesion3VolCalc = {&SPRBreLesion3Vol, NULL};
const CalcInfoArray SPRBreLesion4VolCalc = {&SPRBreLesion4Vol, NULL};
const CalcInfoArray SPRBreLesion5VolCalc = {&SPRBreLesion5Vol, NULL};
#endif
#ifdef VET //Vet
const CalcInfoArray SPBre1Lesion1VolCalc = {&SPBre1Lesion1Vol, NULL};
const CalcInfoArray SPBre1Lesion2VolCalc = {&SPBre1Lesion2Vol, NULL};
const CalcInfoArray SPBre1Lesion3VolCalc = {&SPBre1Lesion3Vol, NULL};
const CalcInfoArray SPBre1Lesion4VolCalc = {&SPBre1Lesion4Vol, NULL};
const CalcInfoArray SPBre1Lesion5VolCalc = {&SPBre1Lesion5Vol, NULL};
const CalcInfoArray SPBre2Lesion1VolCalc = {&SPBre2Lesion1Vol, NULL};
const CalcInfoArray SPBre2Lesion2VolCalc = {&SPBre2Lesion2Vol, NULL};
const CalcInfoArray SPBre2Lesion3VolCalc = {&SPBre2Lesion3Vol, NULL};
const CalcInfoArray SPBre2Lesion4VolCalc = {&SPBre2Lesion4Vol, NULL};
const CalcInfoArray SPBre2Lesion5VolCalc = {&SPBre2Lesion5Vol, NULL};
const CalcInfoArray SPBre3Lesion1VolCalc = {&SPBre3Lesion1Vol, NULL};
const CalcInfoArray SPBre3Lesion2VolCalc = {&SPBre3Lesion2Vol, NULL};
const CalcInfoArray SPBre3Lesion3VolCalc = {&SPBre3Lesion3Vol, NULL};
const CalcInfoArray SPBre3Lesion4VolCalc = {&SPBre3Lesion4Vol, NULL};
const CalcInfoArray SPBre3Lesion5VolCalc = {&SPBre3Lesion5Vol, NULL};
const CalcInfoArray SPBre4Lesion1VolCalc = {&SPBre4Lesion1Vol, NULL};
const CalcInfoArray SPBre4Lesion2VolCalc = {&SPBre4Lesion2Vol, NULL};
const CalcInfoArray SPBre4Lesion3VolCalc = {&SPBre4Lesion3Vol, NULL};
const CalcInfoArray SPBre4Lesion4VolCalc = {&SPBre4Lesion4Vol, NULL};
const CalcInfoArray SPBre4Lesion5VolCalc = {&SPBre4Lesion5Vol, NULL};
const CalcInfoArray SPBre5Lesion1VolCalc = {&SPBre5Lesion1Vol, NULL};
const CalcInfoArray SPBre5Lesion2VolCalc = {&SPBre5Lesion2Vol, NULL};
const CalcInfoArray SPBre5Lesion3VolCalc = {&SPBre5Lesion3Vol, NULL};
const CalcInfoArray SPBre5Lesion4VolCalc = {&SPBre5Lesion4Vol, NULL};
const CalcInfoArray SPBre5Lesion5VolCalc = {&SPBre5Lesion5Vol, NULL};
#endif
const CalcInfoArray SPLTesVolCalc = {&SPLTesVol, NULL};
const CalcInfoArray SPRTesVolCalc = {&SPRTesVol, NULL};
const CalcInfoArray SPLTesLesion1VolCalc = {&SPLTesLesion1Vol, NULL};
const CalcInfoArray SPLTesLesion2VolCalc = {&SPLTesLesion2Vol, NULL};
const CalcInfoArray SPLTesLesion3VolCalc = {&SPLTesLesion3Vol, NULL};
const CalcInfoArray SPLTesLesion4VolCalc = {&SPLTesLesion4Vol, NULL};
const CalcInfoArray SPLTesLesion5VolCalc = {&SPLTesLesion5Vol, NULL};
const CalcInfoArray SPRTesLesion1VolCalc = {&SPRTesLesion1Vol, NULL};
const CalcInfoArray SPRTesLesion2VolCalc = {&SPRTesLesion2Vol, NULL};
const CalcInfoArray SPRTesLesion3VolCalc = {&SPRTesLesion3Vol, NULL};
const CalcInfoArray SPRTesLesion4VolCalc = {&SPRTesLesion4Vol, NULL};
const CalcInfoArray SPRTesLesion5VolCalc = {&SPRTesLesion5Vol, NULL};
const CalcInfoArray SPThyLesion1VolCalc = {&SPThyLesion1Vol, NULL};
const CalcInfoArray SPThyLesion2VolCalc = {&SPThyLesion2Vol, NULL};
const CalcInfoArray SPThyLesion3VolCalc = {&SPThyLesion3Vol, NULL};
const CalcInfoArray SPThyLesion4VolCalc = {&SPThyLesion4Vol, NULL};
const CalcInfoArray SPThyLesion5VolCalc = {&SPThyLesion5Vol, NULL};
#ifndef VET
const PtrOfCalcInfo SPCalcInfoPtr[SP_CALC_END - SP_CALC_START] = {
{SP_BRE_L_LESION1_VOL_C, &SPLBreLesion1Vol},
{SP_BRE_L_LESION2_VOL_C, &SPLBreLesion2Vol},
{SP_BRE_L_LESION3_VOL_C, &SPLBreLesion3Vol},
{SP_BRE_L_LESION4_VOL_C, &SPLBreLesion4Vol},
{SP_BRE_L_LESION5_VOL_C, &SPLBreLesion5Vol},
{SP_BRE_R_LESION1_VOL_C, &SPRBreLesion1Vol},
{SP_BRE_R_LESION2_VOL_C, &SPRBreLesion2Vol},
{SP_BRE_R_LESION3_VOL_C, &SPRBreLesion3Vol},
{SP_BRE_R_LESION4_VOL_C, &SPRBreLesion4Vol},
{SP_BRE_R_LESION5_VOL_C, &SPRBreLesion5Vol},
{SP_L_TESTIS_VOL_C, &SPLTesVol},
{SP_R_TESTIS_VOL_C, &SPRTesVol},
{SP_TES_L_LESION1_VOL_C, &SPLTesLesion1Vol},
{SP_TES_L_LESION2_VOL_C, &SPLTesLesion2Vol},
{SP_TES_L_LESION3_VOL_C, &SPLTesLesion3Vol},
{SP_TES_L_LESION4_VOL_C, &SPLTesLesion4Vol},
{SP_TES_L_LESION5_VOL_C, &SPLTesLesion5Vol},
{SP_TES_R_LESION1_VOL_C, &SPRTesLesion1Vol},
{SP_TES_R_LESION2_VOL_C, &SPRTesLesion2Vol},
{SP_TES_R_LESION3_VOL_C, &SPRTesLesion3Vol},
{SP_TES_R_LESION4_VOL_C, &SPRTesLesion4Vol},
{SP_TES_R_LESION5_VOL_C, &SPRTesLesion5Vol},
{SP_THY_LESION1_VOL_C, &SPThyLesion1Vol},
{SP_THY_LESION2_VOL_C, &SPThyLesion2Vol},
{SP_THY_LESION3_VOL_C, &SPThyLesion3Vol},
{SP_THY_LESION4_VOL_C, &SPThyLesion4Vol},
{SP_THY_LESION5_VOL_C, &SPThyLesion5Vol},
};
#endif //Vet
#ifdef VET
const PtrOfCalcInfo SPCalcInfoPtr[SP_CALC_END - SP_CALC_START] = {
{SP_BRE1_LESION1_VOL_C, &SPBre1Lesion1Vol},
{SP_BRE1_LESION2_VOL_C, &SPBre1Lesion2Vol},
{SP_BRE1_LESION3_VOL_C, &SPBre1Lesion3Vol},
{SP_BRE1_LESION4_VOL_C, &SPBre1Lesion4Vol},
{SP_BRE1_LESION5_VOL_C, &SPBre1Lesion5Vol},
{SP_BRE2_LESION1_VOL_C, &SPBre2Lesion1Vol},
{SP_BRE2_LESION2_VOL_C, &SPBre2Lesion2Vol},
{SP_BRE2_LESION3_VOL_C, &SPBre2Lesion3Vol},
{SP_BRE2_LESION4_VOL_C, &SPBre2Lesion4Vol},
{SP_BRE2_LESION5_VOL_C, &SPBre2Lesion5Vol},
{SP_BRE3_LESION1_VOL_C, &SPBre3Lesion1Vol},
{SP_BRE3_LESION2_VOL_C, &SPBre3Lesion2Vol},
{SP_BRE3_LESION3_VOL_C, &SPBre3Lesion3Vol},
{SP_BRE3_LESION4_VOL_C, &SPBre3Lesion4Vol},
{SP_BRE3_LESION5_VOL_C, &SPBre3Lesion5Vol},
{SP_BRE4_LESION1_VOL_C, &SPBre4Lesion1Vol},
{SP_BRE4_LESION2_VOL_C, &SPBre4Lesion2Vol},
{SP_BRE4_LESION3_VOL_C, &SPBre4Lesion3Vol},
{SP_BRE4_LESION4_VOL_C, &SPBre4Lesion4Vol},
{SP_BRE4_LESION5_VOL_C, &SPBre4Lesion5Vol},
{SP_BRE5_LESION1_VOL_C, &SPBre5Lesion1Vol},
{SP_BRE5_LESION2_VOL_C, &SPBre5Lesion2Vol},
{SP_BRE5_LESION3_VOL_C, &SPBre5Lesion3Vol},
{SP_BRE5_LESION4_VOL_C, &SPBre5Lesion4Vol},
{SP_BRE5_LESION5_VOL_C, &SPBre5Lesion5Vol},
{SP_L_TESTIS_VOL_C, &SPLTesVol},
{SP_R_TESTIS_VOL_C, &SPRTesVol},
{SP_TES_L_LESION1_VOL_C, &SPLTesLesion1Vol},
{SP_TES_L_LESION2_VOL_C, &SPLTesLesion2Vol},
{SP_TES_L_LESION3_VOL_C, &SPLTesLesion3Vol},
{SP_TES_L_LESION4_VOL_C, &SPLTesLesion4Vol},
{SP_TES_L_LESION5_VOL_C, &SPLTesLesion5Vol},
{SP_TES_R_LESION1_VOL_C, &SPRTesLesion1Vol},
{SP_TES_R_LESION2_VOL_C, &SPRTesLesion2Vol},
{SP_TES_R_LESION3_VOL_C, &SPRTesLesion3Vol},
{SP_TES_R_LESION4_VOL_C, &SPRTesLesion4Vol},
{SP_TES_R_LESION5_VOL_C, &SPRTesLesion5Vol},
{SP_THY_LESION1_VOL_C, &SPThyLesion1Vol},
{SP_THY_LESION2_VOL_C, &SPThyLesion2Vol},
{SP_THY_LESION3_VOL_C, &SPThyLesion3Vol},
{SP_THY_LESION4_VOL_C, &SPThyLesion4Vol},
{SP_THY_LESION5_VOL_C, &SPThyLesion5Vol},
};
#endif
const MultiItemInfo SPMultiInfo[] = {
#ifdef EMP_322
#else
{ SP_L_TESTIS_ARTERY, SP_L_TESTIS_ARTERY_MULTI, SD, "L Testis A", SdInfo, NULL },
{ SP_R_TESTIS_ARTERY, SP_R_TESTIS_ARTERY_MULTI, SD, "R Testis A", SdInfo, NULL },
{ SP_SUPA_L_LOBE, SP_SUPA_L_LOBE_MULTI, SD, "Supa L Lobe", SdInfo, NULL },
{ SP_INFA_L_LOBE, SP_INFA_L_LOBE_MULTI, SD, "Infa L Lobe", SdInfo, NULL },
{ SP_SUPA_R_LOBE, SP_SUPA_R_LOBE_MULTI, SD, "Supa R Lobe", SdInfo, NULL },
{ SP_INFA_R_LOBE, SP_INFA_R_LOBE_MULTI, SD, "Infa R Lobe", SdInfo, NULL },
#endif
};
#ifndef VET
const SingleItemInfo SPInfo[] = {
{SP_L_GALACT_THICK, DIST_DOT, N_("L Galact Thick"), CM, NULL},
{SP_R_GALACT_THICK, DIST_DOT, N_("R Galact Thick"), CM, NULL},
{SP_BRE_L_LESION1_VOL, MEA_TYPE_END, N_("Breast L Lesion1 Vol"), UNIT_END, NULL},
{SP_BRE_L_LESION1_L, DIST_DOT, N_("Breast L Lesion1 L"), CM, &SPLBreLesion1VolCalc},
{SP_BRE_L_LESION1_W, DIST_DOT, N_("Breast L Lesion1 W"), CM, &SPLBreLesion1VolCalc},
{SP_BRE_L_LESION1_H, DIST_DOT, N_("Breast L Lesion1 H"), CM, &SPLBreLesion1VolCalc},
{SP_BRE_L_LESION2_VOL, MEA_TYPE_END, N_("Breast L Lesion2 Vol"), UNIT_END, NULL},
{SP_BRE_L_LESION2_L, DIST_DOT, N_("Breast L Lesion2 L"), CM, &SPLBreLesion2VolCalc},
{SP_BRE_L_LESION2_W, DIST_DOT, N_("Breast L Lesion2 W"), CM, &SPLBreLesion2VolCalc},
{SP_BRE_L_LESION2_H, DIST_DOT, N_("Breast L Lesion2 H"), CM, &SPLBreLesion2VolCalc},
{SP_BRE_L_LESION3_VOL, MEA_TYPE_END, N_("Breast L Lesion3 Vol"), UNIT_END, NULL},
{SP_BRE_L_LESION3_L, DIST_DOT, N_("Breast L Lesion3 L"), CM, &SPLBreLesion3VolCalc},
{SP_BRE_L_LESION3_W, DIST_DOT, N_("Breast L Lesion3 W"), CM, &SPLBreLesion3VolCalc},
{SP_BRE_L_LESION3_H, DIST_DOT, N_("Breast L Lesion3 H"), CM, &SPLBreLesion3VolCalc},
{SP_BRE_L_LESION4_VOL, MEA_TYPE_END, N_("Breast L Lesion4 Vol"), UNIT_END, NULL},
{SP_BRE_L_LESION4_L, DIST_DOT, N_("Breast L Lesion4 L"), CM, &SPLBreLesion4VolCalc},
{SP_BRE_L_LESION4_W, DIST_DOT, N_("Breast L Lesion4 W"), CM, &SPLBreLesion4VolCalc},
{SP_BRE_L_LESION4_H, DIST_DOT, N_("Breast L Lesion4 H"), CM, &SPLBreLesion4VolCalc},
{SP_BRE_L_LESION5_VOL, MEA_TYPE_END,N_( "Breast L Lesion5 Vol"), UNIT_END, NULL},
{SP_BRE_L_LESION5_L, DIST_DOT, N_("Breast L Lesion5 L"), CM, &SPLBreLesion5VolCalc},
{SP_BRE_L_LESION5_W, DIST_DOT, N_("Breast L Lesion5 W"), CM, &SPLBreLesion5VolCalc},
{SP_BRE_L_LESION5_H, DIST_DOT, N_("Breast L Lesion5 H"), CM, &SPLBreLesion5VolCalc},
{SP_BRE_R_LESION1_VOL, MEA_TYPE_END, N_("Breast R Lesion1 Vol"), UNIT_END, NULL},
{SP_BRE_R_LESION1_L, DIST_DOT, N_("Breast R Lesion1 L"), CM, &SPRBreLesion1VolCalc},
{SP_BRE_R_LESION1_W, DIST_DOT, N_("Breast R Lesion1 W"), CM, &SPRBreLesion1VolCalc},
{SP_BRE_R_LESION1_H, DIST_DOT, N_("Breast R Lesion1 H"), CM, &SPRBreLesion1VolCalc},
{SP_BRE_R_LESION2_VOL, MEA_TYPE_END, N_("Breast R Lesion2 Vol"), UNIT_END, NULL},
{SP_BRE_R_LESION2_L, DIST_DOT, N_("Breast R Lesion2 L"), CM, &SPRBreLesion2VolCalc},
{SP_BRE_R_LESION2_W, DIST_DOT, N_("Breast R Lesion2 W"), CM, &SPRBreLesion2VolCalc},
{SP_BRE_R_LESION2_H, DIST_DOT, N_("Breast R Lesion2 H"), CM, &SPRBreLesion2VolCalc},
{SP_BRE_R_LESION3_VOL, MEA_TYPE_END, N_("Breast R Lesion3 Vol"), UNIT_END, NULL},
{SP_BRE_R_LESION3_L, DIST_DOT, N_("Breast R Lesion3 L"), CM, &SPRBreLesion3VolCalc},
{SP_BRE_R_LESION3_W, DIST_DOT, N_("Breast R Lesion3 W"), CM, &SPRBreLesion3VolCalc},
{SP_BRE_R_LESION3_H, DIST_DOT, N_("Breast R Lesion3 H"), CM, &SPRBreLesion3VolCalc},
{SP_BRE_R_LESION4_VOL, MEA_TYPE_END, N_("Breast R Lesion4 Vol"), UNIT_END, NULL},
{SP_BRE_R_LESION4_L, DIST_DOT, N_("Breast R Lesion4 L"), CM, &SPRBreLesion4VolCalc},
{SP_BRE_R_LESION4_W, DIST_DOT, N_("Breast R Lesion4 W"), CM, &SPRBreLesion4VolCalc},
{SP_BRE_R_LESION4_H, DIST_DOT, N_("Breast R Lesion4 H"), CM, &SPRBreLesion4VolCalc},
{SP_BRE_R_LESION5_VOL, MEA_TYPE_END, N_("Breast R Lesion5 Vol"), UNIT_END, NULL},
{SP_BRE_R_LESION5_L, DIST_DOT, N_("Breast R Lesion5 L"), CM, &SPRBreLesion5VolCalc},
{SP_BRE_R_LESION5_W, DIST_DOT, N_("Breast R Lesion5 W"), CM, &SPRBreLesion5VolCalc},
{SP_BRE_R_LESION5_H, DIST_DOT, N_("Breast R Lesion5 H"), CM, &SPRBreLesion5VolCalc},
{SP_L_TESTIS_VOL, MEA_TYPE_END,N_( "L Testis Vol"), UNIT_END, NULL},
{SP_L_TESTIS_L, DIST_DOT, N_("L Testis L"), CM, &SPLTesVolCalc},
{SP_L_TESTIS_W, DIST_DOT, N_("L Testis W"), CM, &SPLTesVolCalc},
{SP_L_TESTIS_H, DIST_DOT, N_("L Testis H"), CM, &SPLTesVolCalc},
#ifdef EMP_322
#else
{SP_L_TESTIS_ARTERY, SD, N_("L Testis Artery"), SP_L_TESTIS_ARTERY_MULTI, NULL},
#endif
{SP_R_TESTIS_VOL, MEA_TYPE_END, N_("R Testis Vol"), UNIT_END, NULL},
{SP_R_TESTIS_L, DIST_DOT, N_("R Testis L"), CM, &SPRTesVolCalc},
{SP_R_TESTIS_W, DIST_DOT, N_("R Testis W"), CM, &SPRTesVolCalc},
{SP_R_TESTIS_H, DIST_DOT, N_("R Testis H"), CM, &SPRTesVolCalc},
#ifdef EMP_322
#else
{SP_R_TESTIS_ARTERY, SD, N_("R Testis Artery"), SP_R_TESTIS_ARTERY_MULTI, NULL},
#endif
{SP_TES_L_LESION1_VOL, MEA_TYPE_END, N_("Testis L Lesion1 Vol"), UNIT_END, NULL},
{SP_TES_L_LESION1_L, DIST_DOT, N_("Testis L Lesion1 L"), CM, &SPLTesLesion1VolCalc},
{SP_TES_L_LESION1_W, DIST_DOT, N_("Testis L Lesion1 W"), CM, &SPLTesLesion1VolCalc},
{SP_TES_L_LESION1_H, DIST_DOT, N_("Testis L Lesion1 H"), CM, &SPLTesLesion1VolCalc},
{SP_TES_L_LESION2_VOL, MEA_TYPE_END, N_("Testis L Lesion2 Vol"), UNIT_END, NULL},
{SP_TES_L_LESION2_L, DIST_DOT, N_("Testis L Lesion2 L"), CM, &SPLTesLesion2VolCalc},
{SP_TES_L_LESION2_W, DIST_DOT, N_("Testis L Lesion2 W"), CM, &SPLTesLesion2VolCalc},
{SP_TES_L_LESION2_H, DIST_DOT, N_("Testis L Lesion2 H"), CM, &SPLTesLesion2VolCalc},
{SP_TES_L_LESION3_VOL, MEA_TYPE_END, N_("Testis L Lesion3 Vol"), UNIT_END, NULL},
{SP_TES_L_LESION3_L, DIST_DOT, N_("Testis L Lesion3 L"), CM, &SPLTesLesion3VolCalc},
{SP_TES_L_LESION3_W, DIST_DOT, N_("Testis L Lesion3 W"), CM, &SPLTesLesion3VolCalc},
{SP_TES_L_LESION3_H, DIST_DOT, N_("Testis L Lesion3 H"), CM, &SPLTesLesion3VolCalc},
{SP_TES_L_LESION4_VOL, MEA_TYPE_END, N_("Testis L Lesion4 Vol"), UNIT_END, NULL},
{SP_TES_L_LESION4_L, DIST_DOT, N_("Testis L Lesion4 L"), CM, &SPLTesLesion4VolCalc},
{SP_TES_L_LESION4_W, DIST_DOT, N_("Testis L Lesion4 W"), CM, &SPLTesLesion4VolCalc},
{SP_TES_L_LESION4_H, DIST_DOT, N_("Testis L Lesion4 H"), CM, &SPLTesLesion4VolCalc},
{SP_TES_L_LESION5_VOL, MEA_TYPE_END, N_("Testis L Lesion5 Vol"), UNIT_END, NULL},
{SP_TES_L_LESION5_L, DIST_DOT, N_("Testis L Lesion5 L"), CM, &SPLTesLesion5VolCalc},
{SP_TES_L_LESION5_W, DIST_DOT, N_("Testis L Lesion5 W"), CM, &SPLTesLesion5VolCalc},
{SP_TES_L_LESION5_H, DIST_DOT, N_("Testis L Lesion5 H"), CM, &SPLTesLesion5VolCalc},
{SP_TES_R_LESION1_VOL, MEA_TYPE_END, N_("Testis R Lesion1 Vol"), UNIT_END, NULL},
{SP_TES_R_LESION1_L, DIST_DOT, N_("Testis R Lesion1 L"), CM, &SPRTesLesion1VolCalc},
{SP_TES_R_LESION1_W, DIST_DOT, N_("Testis R Lesion1 W"), CM, &SPRTesLesion1VolCalc},
{SP_TES_R_LESION1_H, DIST_DOT, N_("Testis R Lesion1 H"), CM, &SPRTesLesion1VolCalc},
{SP_TES_R_LESION2_VOL, MEA_TYPE_END, N_("Testis R Lesion2 Vol"), UNIT_END, NULL},
{SP_TES_R_LESION2_L, DIST_DOT, N_("Testis R Lesion2 L"), CM, &SPRTesLesion2VolCalc},
{SP_TES_R_LESION2_W, DIST_DOT, N_("Testis R Lesion2 W"), CM, &SPRTesLesion2VolCalc},
{SP_TES_R_LESION2_H, DIST_DOT, N_("Testis R Lesion2 H"), CM, &SPRTesLesion2VolCalc},
{SP_TES_R_LESION3_VOL, MEA_TYPE_END, N_("Testis R Lesion3 Vol"), UNIT_END, NULL},
{SP_TES_R_LESION3_L, DIST_DOT, N_("Testis R Lesion3 L"), CM, &SPRTesLesion3VolCalc},
{SP_TES_R_LESION3_W, DIST_DOT, N_("Testis R Lesion3 W"), CM, &SPRTesLesion3VolCalc},
{SP_TES_R_LESION3_H, DIST_DOT, N_("Testis R Lesion3 H"), CM, &SPRTesLesion3VolCalc},
{SP_TES_R_LESION4_VOL, MEA_TYPE_END, N_("Testis R Lesion4 Vol"), UNIT_END, NULL},
{SP_TES_R_LESION4_L, DIST_DOT, N_("Testis R Lesion4 L"), CM, &SPRTesLesion4VolCalc},
{SP_TES_R_LESION4_W, DIST_DOT, N_("Testis R Lesion4 W"), CM, &SPRTesLesion4VolCalc},
{SP_TES_R_LESION4_H, DIST_DOT, N_("Testis R Lesion4 H"), CM, &SPRTesLesion4VolCalc},
{SP_TES_R_LESION5_VOL, MEA_TYPE_END, N_("Testis R Lesion5 Vol"), UNIT_END, NULL},
{SP_TES_R_LESION5_L, DIST_DOT, N_("Testis R Lesion5 L"), CM, &SPRTesLesion5VolCalc},
{SP_TES_R_LESION5_W, DIST_DOT, N_("Testis R Lesion5 W"), CM, &SPRTesLesion5VolCalc},
{SP_TES_R_LESION5_H, DIST_DOT, N_("Testis R Lesion5 H"), CM, &SPRTesLesion5VolCalc},
{SP_ISTHMUS_AP, DIST_DOT, N_("Isthmus AP"), CM, NULL},
{SP_LONG_L_LOBE, DIST_DOT, N_("Long L Lobe"), CM, NULL},
{SP_AP_L_LOBE, DIST_DOT, N_("AP L Lobe"), CM, NULL},
{SP_TR_L_LOBE, DIST_DOT, N_("Tr L Lobe"), CM, NULL},
{SP_LONG_R_LOBE, DIST_DOT, N_("Long R Lobe"), CM, NULL},
{SP_AP_R_LOBE, DIST_DOT, N_("AP R Lobe"), CM, NULL},
{SP_TR_R_LOBE, DIST_DOT, N_("Tr R Lobe"), CM, NULL},
#ifdef EMP_322
#else
{SP_SUPA_L_LOBE, SD, N_("Supa L Lobe"), SP_SUPA_L_LOBE_MULTI, NULL},
{SP_INFA_L_LOBE, SD, N_("Infa L Lobe"), SP_INFA_L_LOBE_MULTI, NULL},
{SP_SUPA_R_LOBE, SD, N_("Supa R Lobe"), SP_SUPA_R_LOBE_MULTI, NULL},
{SP_INFA_R_LOBE, SD, N_("Infa R Lobe"), SP_INFA_R_LOBE_MULTI, NULL},
#endif
{SP_THY_LESION1_VOL, MEA_TYPE_END, N_("Thyroid Lesion1 Vol"), UNIT_END, NULL},
{SP_THY_LESION1_L, DIST_DOT, N_("Thyroid Lesion1 L"), CM, &SPThyLesion1VolCalc},
{SP_THY_LESION1_W, DIST_DOT, N_("Thyroid Lesion1 W"), CM, &SPThyLesion1VolCalc},
{SP_THY_LESION1_H, DIST_DOT, N_("Thyroid Lesion1 H"), CM, &SPThyLesion1VolCalc},
{SP_THY_LESION2_VOL, MEA_TYPE_END, N_("Thyroid Lesion2 Vol"), UNIT_END, NULL},
{SP_THY_LESION2_L, DIST_DOT, N_("Thyroid Lesion2 L"), CM, &SPThyLesion2VolCalc},
{SP_THY_LESION2_W, DIST_DOT, N_("Thyroid Lesion2 W"), CM, &SPThyLesion2VolCalc},
{SP_THY_LESION2_H, DIST_DOT, N_("Thyroid Lesion2 H"), CM, &SPThyLesion2VolCalc},
{SP_THY_LESION3_VOL, MEA_TYPE_END, N_("Thyroid Lesion3 Vol"), UNIT_END, NULL},
{SP_THY_LESION3_L, DIST_DOT, N_("Thyroid Lesion3 L"), CM, &SPThyLesion3VolCalc},
{SP_THY_LESION3_W, DIST_DOT, N_("Thyroid Lesion3 W"), CM, &SPThyLesion3VolCalc},
{SP_THY_LESION3_H, DIST_DOT, N_("Thyroid Lesion3 H"), CM, &SPThyLesion3VolCalc},
{SP_THY_LESION4_VOL, MEA_TYPE_END, N_("Thyroid Lesion4 Vol"), UNIT_END, NULL},
{SP_THY_LESION4_L, DIST_DOT, N_("Thyroid Lesion4 L"), CM, &SPThyLesion4VolCalc},
{SP_THY_LESION4_W, DIST_DOT, N_("Thyroid Lesion4 W"), CM, &SPThyLesion4VolCalc},
{SP_THY_LESION4_H, DIST_DOT, N_("Thyroid Lesion4 H"), CM, &SPThyLesion4VolCalc},
{SP_THY_LESION5_VOL, MEA_TYPE_END, N_("Thyroid Lesion5 Vol"), UNIT_END, NULL},
{SP_THY_LESION5_L, DIST_DOT, N_("Thyroid Lesion5 L"), CM, &SPThyLesion5VolCalc},
{SP_THY_LESION5_W, DIST_DOT, N_("Thyroid Lesion5 W"), CM, &SPThyLesion5VolCalc},
{SP_THY_LESION5_H, DIST_DOT, N_("Thyroid Lesion5 H"), CM, &SPThyLesion5VolCalc},
{SP_L_EYE_OA, DIST_DOT, N_("L Eye OA"), CM, NULL},
{SP_L_EYE_LENS, DIST_DOT, N_("L Eye Lens"), CM, NULL},
{SP_L_EYE_AC, DIST_DOT, N_("L Eye AC"), CM, NULL},
{SP_L_EYE_ON, DIST_DOT, N_("L Eye ON"), CM, NULL},
{SP_R_EYE_OA, DIST_DOT, N_("R Eye OA"), CM, NULL},
{SP_R_EYE_LENS, DIST_DOT, N_("R Eye Lens"), CM, NULL},
{SP_R_EYE_AC, DIST_DOT, N_("R Eye AC"), CM, NULL},
{SP_R_EYE_ON, DIST_DOT, N_("R Eye ON"), CM, NULL},
};
#else
const SingleItemInfo SPInfo[] = {
{SP_GALACT1_THICK, DIST_DOT, N_("Galact1 Thick"), CM, NULL},
{SP_GALACT2_THICK, DIST_DOT, N_("Galact2 Thick"), CM, NULL},
{SP_GALACT3_THICK, DIST_DOT, N_("Galact3 Thick"), CM, NULL},
{SP_GALACT4_THICK, DIST_DOT, N_("Galact4 Thick"), CM, NULL},
{SP_GALACT5_THICK, DIST_DOT, N_("Galact5 Thick"), CM, NULL},
{SP_BRE1_LESION1_VOL, MEA_TYPE_END, N_("Bre1 Le1 Vol"), UNIT_END, NULL},
{SP_BRE1_LESION1_L, DIST_DOT, N_("Bre1 Le1 L"), CM, &SPBre1Lesion1VolCalc},
{SP_BRE1_LESION1_W, DIST_DOT, N_("Bre1 Le1 W"), CM, &SPBre1Lesion1VolCalc},
{SP_BRE1_LESION1_H, DIST_DOT, N_("Bre1 Le1 H"), CM, &SPBre1Lesion1VolCalc},
{SP_BRE1_LESION2_VOL, MEA_TYPE_END, N_("Bre1 Le2 Vol"), UNIT_END, NULL},
{SP_BRE1_LESION2_L, DIST_DOT, N_("Bre1 Le2 L"), CM, &SPBre1Lesion2VolCalc},
{SP_BRE1_LESION2_W, DIST_DOT, N_("Bre1 Le2 W"), CM, &SPBre1Lesion2VolCalc},
{SP_BRE1_LESION2_H, DIST_DOT, N_("Bre1 Le2 H"), CM, &SPBre1Lesion2VolCalc},
{SP_BRE1_LESION3_VOL, MEA_TYPE_END, N_("Bre1 Le3 Vol"), UNIT_END, NULL},
{SP_BRE1_LESION3_L, DIST_DOT, N_("Bre1 Le3 L"), CM, &SPBre1Lesion3VolCalc},
{SP_BRE1_LESION3_W, DIST_DOT, N_("Bre1 Le3 W"), CM, &SPBre1Lesion3VolCalc},
{SP_BRE1_LESION3_H, DIST_DOT, N_("Bre1 Le3 H"), CM, &SPBre1Lesion3VolCalc},
{SP_BRE1_LESION4_VOL, MEA_TYPE_END, N_("Bre1 Le4 Vol"), UNIT_END, NULL},
{SP_BRE1_LESION4_L, DIST_DOT, N_("Bre1 Le4 L"), CM, &SPBre1Lesion4VolCalc},
{SP_BRE1_LESION4_W, DIST_DOT, N_("Bre1 Le4 W"), CM, &SPBre1Lesion4VolCalc},
{SP_BRE1_LESION4_H, DIST_DOT, N_("Bre1 Le4 H"), CM, &SPBre1Lesion4VolCalc},
{SP_BRE1_LESION5_VOL, MEA_TYPE_END, N_("Bre1 Le5 Vol"), UNIT_END, NULL},
{SP_BRE1_LESION5_L, DIST_DOT, N_("Bre1 Le5 L"), CM, &SPBre1Lesion5VolCalc},
{SP_BRE1_LESION5_W, DIST_DOT, N_("Bre1 Le5 W"), CM, &SPBre1Lesion5VolCalc},
{SP_BRE1_LESION5_H, DIST_DOT, N_("Bre1 Le5 H"), CM, &SPBre1Lesion5VolCalc},
{SP_BRE2_LESION1_VOL, MEA_TYPE_END, N_("Bre2 Le1 Vol"), UNIT_END, NULL},
{SP_BRE2_LESION1_L, DIST_DOT, N_("Bre2 Le1 L"), CM, &SPBre2Lesion1VolCalc},
{SP_BRE2_LESION1_W, DIST_DOT, N_("Bre2 Le1 W"), CM, &SPBre2Lesion1VolCalc},
{SP_BRE2_LESION1_H, DIST_DOT, N_("Bre2 Le1 H"), CM, &SPBre2Lesion1VolCalc},
{SP_BRE2_LESION2_VOL, MEA_TYPE_END, N_("Bre2 Le2 Vol"), UNIT_END, NULL},
{SP_BRE2_LESION2_L, DIST_DOT, N_("Bre2 Le2 L"), CM, &SPBre2Lesion2VolCalc},
{SP_BRE2_LESION2_W, DIST_DOT, N_("Bre2 Le2 W"), CM, &SPBre2Lesion2VolCalc},
{SP_BRE2_LESION2_H, DIST_DOT, N_("Bre2 Le2 H"), CM, &SPBre2Lesion2VolCalc},
{SP_BRE2_LESION3_VOL, MEA_TYPE_END, N_("Bre2 Le3 Vol"), UNIT_END, NULL},
{SP_BRE2_LESION3_L, DIST_DOT, N_("Bre2 Le3 L"), CM, &SPBre2Lesion3VolCalc},
{SP_BRE2_LESION3_W, DIST_DOT, N_("Bre2 Le3 W"), CM, &SPBre2Lesion3VolCalc},
{SP_BRE2_LESION3_H, DIST_DOT, N_("Bre2 Le3 H"), CM, &SPBre2Lesion3VolCalc},
{SP_BRE2_LESION4_VOL, MEA_TYPE_END, N_("Bre2 Le4 Vol"), UNIT_END, NULL},
{SP_BRE2_LESION4_L, DIST_DOT, N_("Bre2 Le4 L"), CM, &SPBre2Lesion4VolCalc},
{SP_BRE2_LESION4_W, DIST_DOT, N_("Bre2 Le4 W"), CM, &SPBre2Lesion4VolCalc},
{SP_BRE2_LESION4_H, DIST_DOT, N_("Bre2 Le4 H"), CM, &SPBre2Lesion4VolCalc},
{SP_BRE2_LESION5_VOL, MEA_TYPE_END, N_("Bre2 Le5 Vol"), UNIT_END, NULL},
{SP_BRE2_LESION5_L, DIST_DOT, N_("Bre2 Le5 L"), CM, &SPBre2Lesion5VolCalc},
{SP_BRE2_LESION5_W, DIST_DOT, N_("Bre2 Le5 W"), CM, &SPBre2Lesion5VolCalc},
{SP_BRE2_LESION5_H, DIST_DOT, N_("Bre2 Le5 H"), CM, &SPBre2Lesion5VolCalc},
{SP_BRE3_LESION1_VOL, MEA_TYPE_END, N_("Bre3 Le1 Vol"), UNIT_END, NULL},
{SP_BRE3_LESION1_L, DIST_DOT, N_("Bre3 Le1 L"), CM, &SPBre3Lesion1VolCalc},
{SP_BRE3_LESION1_W, DIST_DOT, N_("Bre3 Le1 W"), CM, &SPBre3Lesion1VolCalc},
{SP_BRE3_LESION1_H, DIST_DOT, N_("Bre3 Le1 H"), CM, &SPBre3Lesion1VolCalc},
{SP_BRE3_LESION2_VOL, MEA_TYPE_END, N_("Bre3 Le2 Vol"), UNIT_END, NULL},
{SP_BRE3_LESION2_L, DIST_DOT, N_("Bre3 Le2 L"), CM, &SPBre3Lesion2VolCalc},
{SP_BRE3_LESION2_W, DIST_DOT, N_("Bre3 Le2 W"), CM, &SPBre3Lesion2VolCalc},
{SP_BRE3_LESION2_H, DIST_DOT, N_("Bre3 Le2 H"), CM, &SPBre3Lesion2VolCalc},
{SP_BRE3_LESION3_VOL, MEA_TYPE_END, N_("Bre3 Le3 Vol"), UNIT_END, NULL},
{SP_BRE3_LESION3_L, DIST_DOT, N_("Bre3 Le3 L"), CM, &SPBre3Lesion3VolCalc},
{SP_BRE3_LESION3_W, DIST_DOT, N_("Bre3 Le3 W"), CM, &SPBre3Lesion3VolCalc},
{SP_BRE3_LESION3_H, DIST_DOT, N_("Bre3 Le3 H"), CM, &SPBre3Lesion3VolCalc},
{SP_BRE3_LESION4_VOL, MEA_TYPE_END, N_("Bre3 Le4 Vol"), UNIT_END, NULL},
{SP_BRE3_LESION4_L, DIST_DOT, N_("Bre3 Le4 L"), CM, &SPBre3Lesion4VolCalc},
{SP_BRE3_LESION4_W, DIST_DOT, N_("Bre3 Le4 W"), CM, &SPBre3Lesion4VolCalc},
{SP_BRE3_LESION4_H, DIST_DOT, N_("Bre3 Le4 H"), CM, &SPBre3Lesion4VolCalc},
{SP_BRE3_LESION5_VOL, MEA_TYPE_END, N_("Bre3 Le5 Vol"), UNIT_END, NULL},
{SP_BRE3_LESION5_L, DIST_DOT, N_("Bre3 Le5 L"), CM, &SPBre3Lesion5VolCalc},
{SP_BRE3_LESION5_W, DIST_DOT, N_("Bre3 Le5 W"), CM, &SPBre3Lesion5VolCalc},
{SP_BRE3_LESION5_H, DIST_DOT, N_("Bre3 Le5 H"), CM, &SPBre3Lesion5VolCalc},
{SP_BRE4_LESION1_VOL, MEA_TYPE_END, N_("Bre4 Le1 Vol"), UNIT_END, NULL},
{SP_BRE4_LESION1_L, DIST_DOT, N_("Bre4 Le1 L"), CM, &SPBre4Lesion1VolCalc},
{SP_BRE4_LESION1_W, DIST_DOT, N_("Bre4 Le1 W"), CM, &SPBre4Lesion1VolCalc},
{SP_BRE4_LESION1_H, DIST_DOT, N_("Bre4 Le1 H"), CM, &SPBre4Lesion1VolCalc},
{SP_BRE4_LESION2_VOL, MEA_TYPE_END, N_("Bre4 Le2 Vol"), UNIT_END, NULL},
{SP_BRE4_LESION2_L, DIST_DOT, N_("Bre4 Le2 L"), CM, &SPBre4Lesion2VolCalc},
{SP_BRE4_LESION2_W, DIST_DOT, N_("Bre4 Le2 W"), CM, &SPBre4Lesion2VolCalc},
{SP_BRE4_LESION2_H, DIST_DOT, N_("Bre4 Le2 H"), CM, &SPBre4Lesion2VolCalc},
{SP_BRE4_LESION3_VOL, MEA_TYPE_END, N_("Bre4 Le3 Vol"), UNIT_END, NULL},
{SP_BRE4_LESION3_L, DIST_DOT, N_("Bre4 Le3 L"), CM, &SPBre4Lesion3VolCalc},
{SP_BRE4_LESION3_W, DIST_DOT, N_("Bre4 Le3 W"), CM, &SPBre4Lesion3VolCalc},
{SP_BRE4_LESION3_H, DIST_DOT, N_("Bre4 Le3 H"), CM, &SPBre4Lesion3VolCalc},
{SP_BRE4_LESION4_VOL, MEA_TYPE_END, N_("Bre4 Le4 Vol"), UNIT_END, NULL},
{SP_BRE4_LESION4_L, DIST_DOT, N_("Bre4 Le4 L"), CM, &SPBre4Lesion4VolCalc},
{SP_BRE4_LESION4_W, DIST_DOT, N_("Bre4 Le4 W"), CM, &SPBre4Lesion4VolCalc},
{SP_BRE4_LESION4_H, DIST_DOT, N_("Bre4 Le4 H"), CM, &SPBre4Lesion4VolCalc},
{SP_BRE4_LESION5_VOL, MEA_TYPE_END, N_("Bre4 Le5 Vol"), UNIT_END, NULL},
{SP_BRE4_LESION5_L, DIST_DOT, N_("Bre4 Le5 L"), CM, &SPBre4Lesion5VolCalc},
{SP_BRE4_LESION5_W, DIST_DOT, N_("Bre4 Le5 W"), CM, &SPBre4Lesion5VolCalc},
{SP_BRE4_LESION5_H, DIST_DOT, N_("Bre4 Le5 H"), CM, &SPBre4Lesion5VolCalc},
{SP_BRE5_LESION1_VOL, MEA_TYPE_END, N_("Bre5 Le1 Vol"), UNIT_END, NULL},
{SP_BRE5_LESION1_L, DIST_DOT, N_("Bre5 Le1 L"), CM, &SPBre5Lesion1VolCalc},
{SP_BRE5_LESION1_W, DIST_DOT, N_("Bre5 Le1 W"), CM, &SPBre5Lesion1VolCalc},
{SP_BRE5_LESION1_H, DIST_DOT, N_("Bre5 Le1 H"), CM, &SPBre5Lesion1VolCalc},
{SP_BRE5_LESION2_VOL, MEA_TYPE_END, N_("Bre5 Le2 Vol"), UNIT_END, NULL},
{SP_BRE5_LESION2_L, DIST_DOT, N_("Bre5 Le2 L"), CM, &SPBre5Lesion2VolCalc},
{SP_BRE5_LESION2_W, DIST_DOT, N_("Bre5 Le2 W"), CM, &SPBre5Lesion2VolCalc},
{SP_BRE5_LESION2_H, DIST_DOT, N_("Bre5 Le2 H"), CM, &SPBre5Lesion2VolCalc},
{SP_BRE5_LESION3_VOL, MEA_TYPE_END, N_("Bre5 Le3 Vol"), UNIT_END, NULL},
{SP_BRE5_LESION3_L, DIST_DOT, N_("Bre5 Le3 L"), CM, &SPBre5Lesion3VolCalc},
{SP_BRE5_LESION3_W, DIST_DOT, N_("Bre5 Le3 W"), CM, &SPBre5Lesion3VolCalc},
{SP_BRE5_LESION3_H, DIST_DOT, N_("Bre5 Le3 H"), CM, &SPBre5Lesion3VolCalc},
{SP_BRE5_LESION4_VOL, MEA_TYPE_END, N_("Bre5 Le4 Vol"), UNIT_END, NULL},
{SP_BRE5_LESION4_L, DIST_DOT, N_("Bre5 Le4 L"), CM, &SPBre5Lesion4VolCalc},
{SP_BRE5_LESION4_W, DIST_DOT, N_("Bre5 Le4 W"), CM, &SPBre5Lesion4VolCalc},
{SP_BRE5_LESION4_H, DIST_DOT, N_("Bre5 Le4 H"), CM, &SPBre5Lesion4VolCalc},
{SP_BRE5_LESION5_VOL, MEA_TYPE_END, N_("Bre5 Le5 Vol"), UNIT_END, NULL},
{SP_BRE5_LESION5_L, DIST_DOT, N_("Bre5 Le5 L"), CM, &SPBre5Lesion5VolCalc},
{SP_BRE5_LESION5_W, DIST_DOT, N_("Bre5 Le5 W"), CM, &SPBre5Lesion5VolCalc},
{SP_BRE5_LESION5_H, DIST_DOT, N_("Bre5 Le5 H"), CM, &SPBre5Lesion5VolCalc},
{SP_L_TESTIS_VOL, MEA_TYPE_END,N_( "L Testis Vol"), UNIT_END, NULL},
{SP_L_TESTIS_L, DIST_DOT, N_("L Testis L"), CM, &SPLTesVolCalc},
{SP_L_TESTIS_W, DIST_DOT, N_("L Testis W"), CM, &SPLTesVolCalc},
{SP_L_TESTIS_H, DIST_DOT, N_("L Testis H"), CM, &SPLTesVolCalc},
{SP_L_TESTIS_ARTERY, SD, N_("L Testis Artery"), SP_L_TESTIS_ARTERY_MULTI, NULL},
{SP_R_TESTIS_VOL, MEA_TYPE_END, N_("R Testis Vol"), UNIT_END, NULL},
{SP_R_TESTIS_L, DIST_DOT, N_("R Testis L"), CM, &SPRTesVolCalc},
{SP_R_TESTIS_W, DIST_DOT, N_("R Testis W"), CM, &SPRTesVolCalc},
{SP_R_TESTIS_H, DIST_DOT, N_("R Testis H"), CM, &SPRTesVolCalc},
{SP_R_TESTIS_ARTERY, SD, N_("R Testis Artery"), SP_R_TESTIS_ARTERY_MULTI, NULL},
{SP_TES_L_LESION1_VOL, MEA_TYPE_END, N_("Testis L Lesion1 Vol"), UNIT_END, NULL},
{SP_TES_L_LESION1_L, DIST_DOT, N_("Testis L Lesion1 L"), CM, &SPLTesLesion1VolCalc},
{SP_TES_L_LESION1_W, DIST_DOT, N_("Testis L Lesion1 W"), CM, &SPLTesLesion1VolCalc},
{SP_TES_L_LESION1_H, DIST_DOT, N_("Testis L Lesion1 H"), CM, &SPLTesLesion1VolCalc},
{SP_TES_L_LESION2_VOL, MEA_TYPE_END, N_("Testis L Lesion2 Vol"), UNIT_END, NULL},
{SP_TES_L_LESION2_L, DIST_DOT, N_("Testis L Lesion2 L"), CM, &SPLTesLesion2VolCalc},
{SP_TES_L_LESION2_W, DIST_DOT, N_("Testis L Lesion2 W"), CM, &SPLTesLesion2VolCalc},
{SP_TES_L_LESION2_H, DIST_DOT, N_("Testis L Lesion2 H"), CM, &SPLTesLesion2VolCalc},
{SP_TES_L_LESION3_VOL, MEA_TYPE_END, N_("Testis L Lesion3 Vol"), UNIT_END, NULL},
{SP_TES_L_LESION3_L, DIST_DOT, N_("Testis L Lesion3 L"), CM, &SPLTesLesion3VolCalc},
{SP_TES_L_LESION3_W, DIST_DOT, N_("Testis L Lesion3 W"), CM, &SPLTesLesion3VolCalc},
{SP_TES_L_LESION3_H, DIST_DOT, N_("Testis L Lesion3 H"), CM, &SPLTesLesion3VolCalc},
{SP_TES_L_LESION4_VOL, MEA_TYPE_END, N_("Testis L Lesion4 Vol"), UNIT_END, NULL},
{SP_TES_L_LESION4_L, DIST_DOT, N_("Testis L Lesion4 L"), CM, &SPLTesLesion4VolCalc},
{SP_TES_L_LESION4_W, DIST_DOT, N_("Testis L Lesion4 W"), CM, &SPLTesLesion4VolCalc},
{SP_TES_L_LESION4_H, DIST_DOT, N_("Testis L Lesion4 H"), CM, &SPLTesLesion4VolCalc},
{SP_TES_L_LESION5_VOL, MEA_TYPE_END, N_("Testis L Lesion5 Vol"), UNIT_END, NULL},
{SP_TES_L_LESION5_L, DIST_DOT, N_("Testis L Lesion5 L"), CM, &SPLTesLesion5VolCalc},
{SP_TES_L_LESION5_W, DIST_DOT, N_("Testis L Lesion5 W"), CM, &SPLTesLesion5VolCalc},
{SP_TES_L_LESION5_H, DIST_DOT, N_("Testis L Lesion5 H"), CM, &SPLTesLesion5VolCalc},
{SP_TES_R_LESION1_VOL, MEA_TYPE_END, N_("Testis R Lesion1 Vol"), UNIT_END, NULL},
{SP_TES_R_LESION1_L, DIST_DOT, N_("Testis R Lesion1 L"), CM, &SPRTesLesion1VolCalc},
{SP_TES_R_LESION1_W, DIST_DOT, N_("Testis R Lesion1 W"), CM, &SPRTesLesion1VolCalc},
{SP_TES_R_LESION1_H, DIST_DOT, N_("Testis R Lesion1 H"), CM, &SPRTesLesion1VolCalc},
{SP_TES_R_LESION2_VOL, MEA_TYPE_END, N_("Testis R Lesion2 Vol"), UNIT_END, NULL},
{SP_TES_R_LESION2_L, DIST_DOT, N_("Testis R Lesion2 L"), CM, &SPRTesLesion2VolCalc},
{SP_TES_R_LESION2_W, DIST_DOT, N_("Testis R Lesion2 W"), CM, &SPRTesLesion2VolCalc},
{SP_TES_R_LESION2_H, DIST_DOT, N_("Testis R Lesion2 H"), CM, &SPRTesLesion2VolCalc},
{SP_TES_R_LESION3_VOL, MEA_TYPE_END, N_("Testis R Lesion3 Vol"), UNIT_END, NULL},
{SP_TES_R_LESION3_L, DIST_DOT, N_("Testis R Lesion3 L"), CM, &SPRTesLesion3VolCalc},
{SP_TES_R_LESION3_W, DIST_DOT, N_("Testis R Lesion3 W"), CM, &SPRTesLesion3VolCalc},
{SP_TES_R_LESION3_H, DIST_DOT, N_("Testis R Lesion3 H"), CM, &SPRTesLesion3VolCalc},
{SP_TES_R_LESION4_VOL, MEA_TYPE_END, N_("Testis R Lesion4 Vol"), UNIT_END, NULL},
{SP_TES_R_LESION4_L, DIST_DOT, N_("Testis R Lesion4 L"), CM, &SPRTesLesion4VolCalc},
{SP_TES_R_LESION4_W, DIST_DOT, N_("Testis R Lesion4 W"), CM, &SPRTesLesion4VolCalc},
{SP_TES_R_LESION4_H, DIST_DOT, N_("Testis R Lesion4 H"), CM, &SPRTesLesion4VolCalc},
{SP_TES_R_LESION5_VOL, MEA_TYPE_END, N_("Testis R Lesion5 Vol"), UNIT_END, NULL},
{SP_TES_R_LESION5_L, DIST_DOT, N_("Testis R Lesion5 L"), CM, &SPRTesLesion5VolCalc},
{SP_TES_R_LESION5_W, DIST_DOT, N_("Testis R Lesion5 W"), CM, &SPRTesLesion5VolCalc},
{SP_TES_R_LESION5_H, DIST_DOT, N_("Testis R Lesion5 H"), CM, &SPRTesLesion5VolCalc},
{SP_ISTHMUS_AP, DIST_DOT, N_("Isthmus AP"), CM, NULL},
{SP_LONG_L_LOBE, DIST_DOT, N_("Long L Lobe"), CM, NULL},
{SP_AP_L_LOBE, DIST_DOT, N_("AP L Lobe"), CM, NULL},
{SP_TR_L_LOBE, DIST_DOT, N_("Tr L Lobe"), CM, NULL},
{SP_LONG_R_LOBE, DIST_DOT, N_("Long R Lobe"), CM, NULL},
{SP_AP_R_LOBE, DIST_DOT, N_("AP R Lobe"), CM, NULL},
{SP_TR_R_LOBE, DIST_DOT, N_("Tr R Lobe"), CM, NULL},
{SP_SUPA_L_LOBE, SD, N_("Supa L Lobe"), SP_SUPA_L_LOBE_MULTI, NULL},
{SP_INFA_L_LOBE, SD, N_("Infa L Lobe"), SP_INFA_L_LOBE_MULTI, NULL},
{SP_SUPA_R_LOBE, SD, N_("Supa R Lobe"), SP_SUPA_R_LOBE_MULTI, NULL},
{SP_INFA_R_LOBE, SD, N_("Infa R Lobe"), SP_INFA_R_LOBE_MULTI, NULL},
{SP_THY_LESION1_VOL, MEA_TYPE_END, N_("Thyroid Lesion1 Vol"), UNIT_END, NULL},
{SP_THY_LESION1_L, DIST_DOT, N_("Thyroid Lesion1 L"), CM, &SPThyLesion1VolCalc},
{SP_THY_LESION1_W, DIST_DOT, N_("Thyroid Lesion1 W"), CM, &SPThyLesion1VolCalc},
{SP_THY_LESION1_H, DIST_DOT, N_("Thyroid Lesion1 H"), CM, &SPThyLesion1VolCalc},
{SP_THY_LESION2_VOL, MEA_TYPE_END, N_("Thyroid Lesion2 Vol"), UNIT_END, NULL},
{SP_THY_LESION2_L, DIST_DOT, N_("Thyroid Lesion2 L"), CM, &SPThyLesion2VolCalc},
{SP_THY_LESION2_W, DIST_DOT, N_("Thyroid Lesion2 W"), CM, &SPThyLesion2VolCalc},
{SP_THY_LESION2_H, DIST_DOT, N_("Thyroid Lesion2 H"), CM, &SPThyLesion2VolCalc},
{SP_THY_LESION3_VOL, MEA_TYPE_END, N_("Thyroid Lesion3 Vol"), UNIT_END, NULL},
{SP_THY_LESION3_L, DIST_DOT, N_("Thyroid Lesion3 L"), CM, &SPThyLesion3VolCalc},
{SP_THY_LESION3_W, DIST_DOT, N_("Thyroid Lesion3 W"), CM, &SPThyLesion3VolCalc},
{SP_THY_LESION3_H, DIST_DOT, N_("Thyroid Lesion3 H"), CM, &SPThyLesion3VolCalc},
{SP_THY_LESION4_VOL, MEA_TYPE_END, N_("Thyroid Lesion4 Vol"), UNIT_END, NULL},
{SP_THY_LESION4_L, DIST_DOT, N_("Thyroid Lesion4 L"), CM, &SPThyLesion4VolCalc},
{SP_THY_LESION4_W, DIST_DOT, N_("Thyroid Lesion4 W"), CM, &SPThyLesion4VolCalc},
{SP_THY_LESION4_H, DIST_DOT, N_("Thyroid Lesion4 H"), CM, &SPThyLesion4VolCalc},
{SP_THY_LESION5_VOL, MEA_TYPE_END, N_("Thyroid Lesion5 Vol"), UNIT_END, NULL},
{SP_THY_LESION5_L, DIST_DOT, N_("Thyroid Lesion5 L"), CM, &SPThyLesion5VolCalc},
{SP_THY_LESION5_W, DIST_DOT, N_("Thyroid Lesion5 W"), CM, &SPThyLesion5VolCalc},
{SP_THY_LESION5_H, DIST_DOT, N_("Thyroid Lesion5 H"), CM, &SPThyLesion5VolCalc},
{SP_L_EYE_OA, DIST_DOT, N_("L Eye OA"), CM, NULL},
{SP_L_EYE_LENS, DIST_DOT, N_("L Eye Lens"), CM, NULL},
{SP_L_EYE_AC, DIST_DOT, N_("L Eye AC"), CM, NULL},
{SP_L_EYE_ON, DIST_DOT, N_("L Eye ON"), CM, NULL},
{SP_R_EYE_OA, DIST_DOT, N_("R Eye OA"), CM, NULL},
{SP_R_EYE_LENS, DIST_DOT, N_("R Eye Lens"), CM, NULL},
{SP_R_EYE_AC, DIST_DOT, N_("R Eye AC"), CM, NULL},
{SP_R_EYE_ON, DIST_DOT, N_("R Eye ON"), CM, NULL},
};
#endif
/******************************Fetal Measure**************************************/
const CalcResultInfo FetalCO2DTeich = {FETAL_CO_2DTEICH, {FETAL_SV_2DTEICH, FETAL_HR_LV_MM, NO_PAR, NO_PAR, NO_PAR}, "CO(Teich)", LMIN, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo FetalCOMMTeich = {FETAL_CO_MMTEICH, {FETAL_SV_MMTEICH, FETAL_HR_LV_MM, NO_PAR, NO_PAR, NO_PAR}, "CO(Teich)", LMIN, MeaCalcFun::SectionCalc, NULL};
const CalcInfoArray FetalSV2DTeichCalc = {&FetalCO2DTeich, NULL};
const CalcInfoArray FetalSVMMTeichCalc = {&FetalCOMMTeich, NULL};
const CalcResultInfo FetalSV2DTeich = {FETAL_SV_2DTEICH, {FETAL_EDV_2DTEICH, FETAL_ESV_2DTEICH, NO_PAR, NO_PAR, NO_PAR}, "SV(Teich)", CM3, MeaCalcFun::SectionCalc, &FetalSV2DTeichCalc};
const CalcResultInfo FetalSVMMTeich = {FETAL_SV_MMTEICH, {FETAL_EDV_MMTEICH, FETAL_ESV_MMTEICH, NO_PAR, NO_PAR, NO_PAR}, "SV(Teich)", CM3, MeaCalcFun::SectionCalc, &FetalSVMMTeichCalc};
const CalcResultInfo FetalEF2DTeich = {FETAL_EF_2DTEICH, {FETAL_EDV_2DTEICH, FETAL_ESV_2DTEICH, NO_PAR, NO_PAR, NO_PAR}, "EF(Teich)", PERCENT, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo FetalEFMMTeich = {FETAL_EF_MMTEICH, {FETAL_EDV_MMTEICH, FETAL_ESV_MMTEICH, NO_PAR, NO_PAR, NO_PAR}, "EF(Teich)", PERCENT, MeaCalcFun::SectionCalc, NULL};
const CalcInfoArray FetalEDV2DTeichCalc = {&FetalSV2DTeich, &FetalEF2DTeich, NULL};
const CalcInfoArray FetalEDVMMTeichCalc = {&FetalSVMMTeich, &FetalEFMMTeich, NULL};
const CalcInfoArray FetalESV2DTeichCalc = {&FetalSV2DTeich, &FetalEF2DTeich, NULL};
const CalcInfoArray FetalESVMMTeichCalc = {&FetalSVMMTeich, &FetalEFMMTeich, NULL};
const CalcResultInfo FetalAoPa = {FETAL_AO_PA_RATIO, {FETAL_AOR_DIAM, FETAL_MPA_DIAM, NO_PAR, NO_PAR, NO_PAR}, "Ao/PA", NOUNIT, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo FetalEDV2DTeich = {FETAL_EDV_2DTEICH, {FETAL_LVIDD, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "EDV", CM3, MeaCalcFun::SectionCalc, &FetalEDV2DTeichCalc};
const CalcResultInfo FetalEDVMMTeich = {FETAL_EDV_MMTEICH, {FETAL_LVIDD_MM, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "EDV", CM3, MeaCalcFun::SectionCalc, &FetalEDVMMTeichCalc};
const CalcResultInfo FetalESV2DTeich = {FETAL_ESV_2DTEICH, {FETAL_LVIDS, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "ESV", CM3, MeaCalcFun::SectionCalc, &FetalESV2DTeichCalc};
const CalcResultInfo FetalESVMMTeich = {FETAL_ESV_MMTEICH, {FETAL_LVIDS_MM, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "ESV", CM3, MeaCalcFun::SectionCalc, &FetalESVMMTeichCalc};
//const CalcResultInfo FetalEF2DTeich = {FETAL_EF_2DTEICH, {FETAL_EDV_2DTEICH, FETAL_ESV_2DTEICH, NO_PAR, NO_PAR, NO_PAR}, "EF", NOUNIT, MeaCalcFun::SectionCalc, NULL};
//const CalcResultInfo FetalEFMMTeich = {FETAL_EF_MMTEICH, {FETAL_EDV_MMTEICH, FETAL_ESV_MMTEICH, NO_PAR, NO_PAR, NO_PAR}, "EF", NOUNIT, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo FetalFS2DTeich = {FETAL_FS_2DTEICH, {FETAL_LVIDD, FETAL_LVIDS, NO_PAR, NO_PAR, NO_PAR}, "FS", PERCENT, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo FetalFSMMTeich = {FETAL_FS_MMTEICH, {FETAL_LVIDD_MM, FETAL_LVIDS_MM, NO_PAR, NO_PAR, NO_PAR}, "FS", PERCENT, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo FetalHrtCThrC = {FETAL_HRTC_THRC_RATIO, {FETAL_HEART_CIRC, FETAL_THORAX_CIRC, NO_PAR, NO_PAR, NO_PAR}, "HrtC/ThrC", NOUNIT, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo FetalIVSPer = {FETAL_IVS_PER, {FETAL_IVSD, FETAL_IVSS, NO_PAR, NO_PAR, NO_PAR}, "IVS%", PERCENT, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo FetalIVSPerMM = {FETAL_IVS_PER_MM, {FETAL_IVSD_MM, FETAL_IVSS_MM, NO_PAR, NO_PAR, NO_PAR}, "IVS%", PERCENT, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo FetalIVSLVPW = {FETAL_IVS_LVPW_RATIO, {FETAL_IVSD, FETAL_LVPWD, NO_PAR, NO_PAR, NO_PAR}, "IVS/LVPW", NOUNIT, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo FetalLAAO = {FETAL_LA_AO_RATIO, {FETAL_LA_W, FETAL_AOR_DIAM, NO_PAR, NO_PAR, NO_PAR}, "LA/Ao", NOUNIT, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo FetalLAAOMM = {FETAL_LA_AO_RATIO_MM, {FETAL_LA_DIMEN_MM, FETAL_AOR_DIAM_MM, NO_PAR, NO_PAR, NO_PAR}, "LA/Ao", NOUNIT, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo FetalLVRV = {FETAL_LV_RV_RATIO, {FETAL_LV_W, FETAL_RV_W, NO_PAR, NO_PAR, NO_PAR}, "LV/RV", NOUNIT, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo FetalLARA = {FETAL_LA_RA_RATIO, {FETAL_LA_W, FETAL_RA_W, NO_PAR, NO_PAR, NO_PAR}, "LA/RA", NOUNIT, MeaCalcFun::SectionCalc, NULL};
//const CalcResultInfo FetalLVEF = {FETAL_LV_EF, {, , , , }, "LV EF", NOUNIT, NULL};
//const CalcResultInfo FetalLVMass = {FETAL_LV_MASS, {, , , , }, "LV Mass", NOUNIT, NULL};
const CalcResultInfo FetalLVMass = {FETAL_LV_MASS, {FETAL_IVSD_MM, FETAL_LVIDD_MM, FETAL_LVPWD_MM, NO_PAR, NO_PAR}, "LV Mass", NOUNIT, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo FetalLVPEPET = {FETAL_LV_PEP_ET_RATIO, {FETAL_LV_PEP_MM, FETAL_LV_ET_MM, NO_PAR, NO_PAR, NO_PAR}, "LV PEP/ET", NOUNIT, MeaCalcFun::SectionCalc, NULL};
//const CalcResultInfo FetalLVRV = {FETAL_LV_RV_RATIO, {, , , , }, "LV/RV", NOUNIT, NULL};
//const CalcResultInfo FetalLVETc = {FETAL_LVETC, {, , , , }, "LVETc", NOUNIT, NULL};
const CalcResultInfo FetalLVETc = {FETAL_LVETC, {FETAL_LV_ET_MM, FETAL_HR_AV_MM, NO_PAR, NO_PAR, NO_PAR}, "LV ETc", SEC, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo FetalLVOTArea = {FETAL_LVOT_AREA, {FETAL_LVOT_DIAM, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "LVOT Area", CM2, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo FetalLVPEPc = {FETAL_LVPEPC, {FETAL_LV_PEP_MM, FETAL_HR_AV_MM, NO_PAR, NO_PAR, NO_PAR}, "LVPEPc", SEC, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo FetalLVPWPer = {FETAL_LVPW_PER, {FETAL_LVPWS, FETAL_LVPWD, NO_PAR, NO_PAR, NO_PAR}, "LVPW%", PERCENT, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo FetalLVPWPerMM = {FETAL_LVPW_PER_MM, {FETAL_LVPWS_MM, FETAL_LVPWD_MM, NO_PAR, NO_PAR, NO_PAR}, "LVPW%", PERCENT, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo FetalIvsLvpwMM = {FETAL_IVS_LVPW_MM, {FETAL_IVSD_MM, FETAL_LVPWD_MM, NO_PAR, NO_PAR, NO_PAR}, "IVS/LVPW", NOUNIT, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo FetalMeanVCF = {FETAL_MEAN_VCF, {FETAL_LVIDD_MM, FETAL_LVIDS_MM, FETAL_LV_ET_MM, NO_PAR, NO_PAR}, "mean VCF", CIRCS, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo FetalMeanVCFc = {FETAL_MEAN_VCFC, {FETAL_LVIDD_MM, FETAL_LVIDS_MM, FETAL_LV_ET_MM, FETAL_HR_AV_MM, NO_PAR}, "mean VCFc", CIRCS, MeaCalcFun::SectionCalc, NULL};
//const CalcResultInfo FetalQpQs = {FETAL_QP_QS_RATIO, {, , , , }, "Qp/Qs", NOUNIT, NULL};
//const CalcResultInfo FetalRVEF = {FETAL_RV_EF, {, , , , }, "RV EF", NOUNIT, NULL};
const CalcResultInfo FetalRVPEPET = {FETAL_RV_PEP_ET_RATIO, {FETAL_RV_PEP_MM, FETAL_RV_ET_MM, NO_PAR, NO_PAR, NO_PAR}, "RV PEP/ET", NOUNIT, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo FetalRVOTArea = {FETAL_RVOT_AREA, {FETAL_RVOT_DIAM, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "RVOT Area", CM2, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo FetalRVPEPc = {FETAL_RVPEPC, {FETAL_RV_PEP_MM, FETAL_HR_PV_MM, NO_PAR, NO_PAR, NO_PAR}, "RVPEPc", SEC, MeaCalcFun::SectionCalc, NULL};
//const CalcResultInfo FetalSV = {FETAL_SV, {, , , , }, "SV", NOUNIT, NULL};
const CalcResultInfo FetalMVEA = {FETAL_MV_EA_RATIO, {FETAL_MV_PEAK_E, FETAL_MV_PEAK_A, NO_PAR, NO_PAR, NO_PAR}, "MV E/A", NOUNIT, MeaCalcFun::SectionCalc, NULL};
//const CalcResultInfo FetalThrc = {FETAL_THRC, {, , , , }, "Thrc", NOUNIT, NULL};
const CalcResultInfo FetalTVEA = {FETAL_TV_EA_RATIO, {FETAL_TV_PEAK_E, FETAL_TV_PEAK_A, NO_PAR, NO_PAR, NO_PAR}, "TV E/A", NOUNIT, MeaCalcFun::SectionCalc, NULL};
//const CalcInfoArray FetalLVIDd2DCalc = {&FetalEDV2DTeich, &FetalFS2DTeich, &FetalEF2DTeich, NULL};
const CalcInfoArray FetalLVIDd2DCalc = {&FetalEDV2DTeich, &FetalFS2DTeich, NULL};
const CalcInfoArray FetalLVPWdCalc = {&FetalLVPWPer, &FetalIVSLVPW, NULL};
//const CalcInfoArray FetalLVIDs2DCalc = {&FetalESV2DTeich, &FetalFS2DTeich, &FetalEF2DTeich, NULL};
const CalcInfoArray FetalLVIDs2DCalc = {&FetalESV2DTeich, &FetalFS2DTeich, NULL};
const CalcInfoArray FetalLVPWsCalc = {&FetalLVPWPer, NULL};
const CalcInfoArray FetalIVSd2DCalc = {&FetalIVSPer, &FetalIVSLVPW, NULL};
const CalcInfoArray FetalIVSs2DCalc = {&FetalIVSPer, NULL};
const CalcInfoArray FetalLVRVCalc = {&FetalLVRV, NULL};
const CalcInfoArray FetalLARACalc = {&FetalLARA, NULL};
const CalcInfoArray FetalLaCalc = {&FetalLAAO, &FetalLARA, NULL};
const CalcInfoArray FetalLaMMCalc = {&FetalLAAOMM, NULL};
const CalcInfoArray FetalAoRCalc = {&FetalAoPa, &FetalLAAO, NULL};
const CalcInfoArray FetalAoRMMCalc = {&FetalLAAOMM, NULL};
const CalcInfoArray FetalMPACalc = {&FetalAoPa, NULL};
const CalcInfoArray FetalLvotCalc = {&FetalLVOTArea, NULL};
const CalcInfoArray FetalRvotCalc = {&FetalRVOTArea, NULL};
const CalcInfoArray FetalHrCThrCCalc = {&FetalHrtCThrC, NULL};
//const CalcInfoArray FetalLVIDdMCalc = {&FetalEDVMMTeich, &FetalFSMMTeich, &FetalEFMMTeich, &FetalMeanVCF, &FetalMeanVCFc, &FetalLVMass, NULL};
//const CalcInfoArray FetalLVIDsMCalc = {&FetalESVMMTeich, &FetalFSMMTeich, &FetalEFMMTeich, &FetalMeanVCF, &FetalMeanVCFc, NULL};
const CalcInfoArray FetalLVIDdMCalc = {&FetalEDVMMTeich, &FetalFSMMTeich, &FetalMeanVCF, &FetalMeanVCFc, &FetalLVMass, NULL};
const CalcInfoArray FetalLVIDsMCalc = {&FetalESVMMTeich, &FetalFSMMTeich, &FetalMeanVCF, &FetalMeanVCFc, NULL};
const CalcInfoArray FetalIVSdMCalc = {&FetalIVSPerMM, &FetalIvsLvpwMM, &FetalLVMass, NULL};
const CalcInfoArray FetalIVSsMCalc = {&FetalIVSPerMM, NULL};
const CalcInfoArray FetalLVPWdMCalc = {&FetalLVPWPerMM, &FetalIvsLvpwMM, &FetalLVMass, NULL};
const CalcInfoArray FetalLVPWsMCalc = {&FetalLVPWPerMM, NULL};
const CalcInfoArray FetalLVETCalc = {&FetalLVETc, &FetalLVPEPET, &FetalMeanVCF, &FetalMeanVCFc, NULL};
const CalcInfoArray FetalLVPEPCalc = {&FetalLVPEPET, &FetalLVPEPc, NULL};
const CalcInfoArray FetalHRAVCalc = {&FetalLVETc, &FetalLVPEPc, &FetalMeanVCFc, NULL};
const CalcInfoArray FetalRVETCalc = {&FetalRVPEPET, NULL};
const CalcInfoArray FetalRVPEPCalc = {&FetalRVPEPc, &FetalRVPEPET, NULL};
const CalcInfoArray FetalHRPVCalc = {&FetalRVPEPc, NULL};
const CalcInfoArray FetalMVEACalc = {&FetalMVEA, NULL};
const CalcInfoArray FetalTVEACalc = {&FetalTVEA, NULL};
const PtrOfCalcInfo FetalCalcInfoPtr[FETAL_CALC_END - FETAL_CALC_START] = {
{FETAL_AO_PA_RATIO, &FetalAoPa},
{FETAL_CO_2DTEICH, &FetalCO2DTeich},
{FETAL_CO_MMTEICH, &FetalCOMMTeich},
{FETAL_EDV_2DTEICH, &FetalEDV2DTeich},
{FETAL_EDV_MMTEICH, &FetalEDVMMTeich},
{FETAL_ESV_2DTEICH, &FetalESV2DTeich},
{FETAL_ESV_MMTEICH, &FetalESVMMTeich},
{FETAL_EF_2DTEICH, &FetalEF2DTeich},
{FETAL_EF_MMTEICH, &FetalEFMMTeich},
{FETAL_FS_2DTEICH, &FetalFS2DTeich},
{FETAL_FS_MMTEICH, &FetalFSMMTeich},
{FETAL_HRTC_THRC_RATIO, &FetalHrtCThrC},
{FETAL_IVS_PER, &FetalIVSPer},
{FETAL_IVS_PER_MM, &FetalIVSPerMM},
{FETAL_IVS_LVPW_RATIO, &FetalIVSLVPW},
{FETAL_LA_AO_RATIO, &FetalLAAO},
{FETAL_LA_AO_RATIO_MM, &FetalLAAOMM},
{FETAL_LA_RA_RATIO, &FetalLARA},
{FETAL_LV_MASS, &FetalLVMass},
{FETAL_LV_PEP_ET_RATIO, &FetalLVPEPET},
{FETAL_LV_RV_RATIO, &FetalLVRV},
{FETAL_LVETC, &FetalLVETc},
{FETAL_LVOT_AREA, &FetalLVOTArea},
{FETAL_LVPEPC, &FetalLVPEPc},
{FETAL_LVPW_PER, &FetalLVPWPer},
{FETAL_LVPW_PER_MM, &FetalLVPWPerMM},
{FETAL_IVS_LVPW_MM, &FetalIvsLvpwMM},
{FETAL_MEAN_VCF, &FetalMeanVCF},
{FETAL_MEAN_VCFC, &FetalMeanVCFc},
{FETAL_RV_PEP_ET_RATIO, &FetalRVPEPET},
{FETAL_RVOT_AREA, &FetalRVOTArea},
{FETAL_RVPEPC, &FetalRVPEPc},
{FETAL_SV_2DTEICH, &FetalSV2DTeich},
{FETAL_SV_MMTEICH, &FetalSVMMTeich},
{FETAL_MV_EA_RATIO, &FetalMVEA},
{FETAL_TV_EA_RATIO, &FetalTVEA},
};
const SingleItemInfo FetalInfo[] = {
//Fetal 2D Dimen
{FETAL_RVAWD, DIST_DOT, N_("RVAWd(2D)"), CM, NULL},
{FETAL_RVIDD, DIST_DOT,N_("RVIDd(2D)"), CM, NULL},
{FETAL_IVSD, DIST_DOT,N_("IVSd(2D)"), CM, &FetalIVSd2DCalc},
{FETAL_LVIDD, DIST_DOT,N_("LVIDd(2D)"), CM, &FetalLVIDd2DCalc },
{FETAL_LVPWD, DIST_DOT,N_("LVPWd(2D)"), CM, &FetalLVPWdCalc },
{FETAL_IVSS, DIST_DOT,N_("IVSs(2D)"), CM, &FetalIVSs2DCalc},
{FETAL_LVIDS, DIST_DOT,N_("LVIDs(2D)"), CM, &FetalLVIDs2DCalc },
{FETAL_LVPWS, DIST_DOT,N_("LVPWs(2D)"), CM, &FetalLVPWsCalc },
{FETAL_LV_L, DIST_DOT,N_("LV Length(2D)"), CM, NULL},
{FETAL_LV_W, DIST_DOT,N_("LV Width(2D)"), CM, &FetalLVRVCalc},
{FETAL_LV_WALL_W, DIST_DOT,N_("LV Wall Width(2D)"), CM, NULL},
{FETAL_IVS_W, DIST_DOT, N_("IVS Width(2D)"), CM, NULL},
{FETAL_RV_L, DIST_DOT, N_("RV Length(2D)"), CM, NULL},
{FETAL_RV_W, DIST_DOT, N_("RV Width(2D)"), CM, &FetalLVRVCalc},
{FETAL_RV_WALL_W, DIST_DOT, N_("RV Wall Width(2D)"), CM, NULL},
{FETAL_LA_L, DIST_DOT, N_("LA Length(2D)"), CM, NULL},
{FETAL_LA_W, DIST_DOT, N_("LA Width(2D)"), CM, &FetalLaCalc},
// {FETAL_LA_DIMEN, DIST_DOT, N_("LA Dimen"), CM, &FetalLaCalc},
{FETAL_LA_DIMEN, DIST_DOT, N_("LA Dimen(2D)"), CM, NULL},
{FETAL_RA_L, DIST_DOT, N_("RA Length(2D)"), CM, NULL},
{FETAL_RA_W, DIST_DOT, N_("RA Width(2D)"), CM, &FetalLARACalc},
{FETAL_RPA_DIAM_DIM, DIST_DOT, N_("RPA Diam(2D)"), CM, NULL},
{FETAL_LVOT_DIAM, DIST_DOT, N_("LVOT Diam(2D)"), CM, &FetalLvotCalc},
{FETAL_RVOT_DIAM, DIST_DOT, N_("RVOT Diam(2D)"), CM, &FetalRvotCalc},
{FETAL_HEART_AREA, AREA_ELLIPSE, N_("Heart Area(2D)"), CM2, NULL},//椭圆法面积
{FETAL_HEART_CIRC, PERI_ELLIPSE, N_("Heart Circ(2D)"), CM, &FetalHrCThrCCalc},//椭圆法周长
{FETAL_THORAX_CIRC, PERI_ELLIPSE, N_("Thorax Circ(2D)"), CM, &FetalHrCThrCCalc},//椭圆法周长
//Fetal 2D Vessels
{FETAL_AOR_DIAM, DIST_DOT, N_("AoR Diam(2D)"), CM, &FetalAoRCalc },
{FETAL_ASC_AO_DIAM, DIST_DOT, N_("Asc Ao Diam(2D)"), CM, NULL},
{FETAL_AO_ARCH_DIAM, DIST_DOT, N_("Ao Arch Diam(2D)"), CM, NULL},
{FETAL_AO_ISTHMUS_DIAM, DIST_DOT, N_("Ao Isthmus Diam(2D)"), CM, NULL},
{FETAL_DESC_AO_DIAM, DIST_DOT, N_("Desc Ao Diam(2D)"), CM, NULL},
{FETAL_DUCT_ART_DIAM, DIST_DOT, N_("Duct Art Diam(2D)"), CM, NULL},
{FETAL_MPA_DIAM, DIST_DOT, N_("MPA Diam(2D)"), CM, &FetalMPACalc },
{FETAL_RPA_DIAM_VES, DIST_DOT, N_("RPA Diam(2D-Ves)"), CM, NULL},
{FETAL_LPA_DIAM, DIST_DOT, N_("LPA Diam(2D)"), CM, NULL},
{FETAL_SVC_DIAM, DIST_DOT, N_("SVC Diam(2D)"), CM, NULL},
{FETAL_IVC_DIAM, DIST_DOT, N_("IVC Diam(2D)"), CM, NULL},
//Fetal 2D Valves
{FETAL_AO_AN_DIAM, DIST_DOT, N_("Ao Annul Diam(2D)"), CM, NULL},
{FETAL_AO_AN_CIRC, PERI_TRACK, N_("Ao Annul Circ(2D)"), CM, NULL},//轨迹法测周长
{FETAL_MV_AN_DIAM, DIST_DOT, N_("MV Annul Diam(2D)"), CM, NULL},
{FETAL_MV_AN_CIRC, PERI_TRACK, N_("MV Annul Circ(2D)"), CM, NULL},//轨迹法测周长
{FETAL_PV_AN_DIAM, DIST_DOT, N_("PV Annul Diam(2D)"), CM, NULL},
{FETAL_TV_AN_DIAM, DIST_DOT, N_("TV Annul Diam(2D)"), CM, NULL},
//Fetal M Dimen
{FETAL_RVAWD_MM, DEPTH_DIST_M, N_("RVAWd(M)"), CM, NULL},
{FETAL_RVIDD_MM, DEPTH_DIST_M, N_("RVIDd(M)"), CM, NULL},
{FETAL_IVSD_MM, DEPTH_DIST_M, N_("IVSd(M)"), CM, &FetalIVSdMCalc},
{FETAL_LVIDD_MM, DEPTH_DIST_M, N_("LVIDd(M)"), CM, &FetalLVIDdMCalc },//MeanVCFC可以再考虑,其有一个参数LVETc也是计算出来的
{FETAL_LVPWD_MM, DEPTH_DIST_M, N_("LVPWd(M)"), CM, &FetalLVPWdMCalc},
{FETAL_IVSS_MM, DEPTH_DIST_M, N_("IVSs(M)"), CM, &FetalIVSsMCalc},
{FETAL_LVIDS_MM, DEPTH_DIST_M, N_("LVIDs(M)"), CM, &FetalLVIDsMCalc},//MeanVCFC可以再考虑,其有一个参数LVETc也是计算出来的
{FETAL_LVPWS_MM, DEPTH_DIST_M, N_("LVPWs(M)"), CM, &FetalLVPWsMCalc},
{FETAL_HR_LV_MM, HR_M, N_("HR-LV(M)"), BPM, NULL},
{FETAL_LA_DIMEN_MM, DEPTH_DIST_M, N_("LA Dimen(M)"), CM, &FetalLaMMCalc},
{FETAL_LA_WALL_DIAM_MM, DEPTH_DIST_M, N_("LA Wall Diam(M)"), CM, NULL},
{FETAL_RA_WALL_DIAM_MM, DEPTH_DIST_M, N_("RA Wall Diam(M)"), CM, NULL},
//Fetal M Vessels
{FETAL_AOR_DIAM_MM, DEPTH_DIST_M, N_("AoR Diam(M)"), CM, &FetalAoRMMCalc},
{FETAL_ASC_AO_DIAM_MM, DEPTH_DIST_M, N_("Asc Ao Diam(M)"), CM, NULL},
{FETAL_AO_ARCH_DIAM_MM, DEPTH_DIST_M, N_("Ao Arch Diam(M)"), CM, NULL},
{FETAL_AO_ISTHMUS_DIAM_MM, DEPTH_DIST_M, N_("Ao Isthmus Diam(M)"), CM, NULL},
{FETAL_DESC_AO_DIAM_MM, DEPTH_DIST_M, N_("Desc Ao Diam(M)"), CM, NULL},
{FETAL_DUCT_ART_DIAM_MM, DEPTH_DIST_M, N_("Duct Art Diam(M)"), CM, NULL},
{FETAL_LPA_DIAM_MM, DEPTH_DIST_M, N_("LPA Diam(M)"), CM, NULL},
{FETAL_MPA_DIAM_MM, DEPTH_DIST_M, N_("MPA Diam(M)"), CM, NULL},
{FETAL_RPA_DIAM_MM, DEPTH_DIST_M, N_("RPA Diam(M)"), CM, NULL},
//Fetal M AV and MV
{FETAL_LV_ET_MM, TIME_M, N_("LV ET(M)"), SEC, &FetalLVETCalc },
{FETAL_LV_PEP_MM, TIME_M, N_("LV PEP(M)"), SEC, &FetalLVPEPCalc },
{FETAL_AV_CUSP_SEP_MM, DEPTH_DIST_M, N_("AV Cusp Sep(M)"), CM, NULL },
{FETAL_HR_AV_MM, HR_M, N_("HR-AV(M)"), BPM, &FetalHRAVCalc },
{FETAL_MV_DE_EXC_MM, DEPTH_DIST_M, N_("MV D-E Exc(M)"), CM, NULL},
{FETAL_MV_DE_SLOPE_MM, SLOPE, N_("MV D-E Slope(M)"), CMS, NULL},//仅显示斜率
{FETAL_MV_EF_SLOPE_MM, SLOPE, N_("MV E-F Slope(M)"), CMS, NULL},//仅显示斜率
{FETAL_MV_EF_SEP_MM, DEPTH_DIST_M, N_("MV E-F Sep(M)"), CM, NULL},
{FETAL_MV_EPSS_MM, DEPTH_DIST_M, N_("MV EPSS(M)"), CM, NULL},
{FETAL_MV_AC_INTERVAL_MM, TIME_M, N_("MV A-C Interval(M)"), SEC, NULL},
//Fetal M PV and TV
{FETAL_LATE_DIAS_SLOPE_MM, SLOPE, N_("Late Dias Slope(M)"), CMS, NULL},//仅显示斜率
{FETAL_A_WAVE_AMP_MM, DEPTH_DIST_M, N_("A Wave Amp(M)"), CM, NULL },
{FETAL_BC_SLOPE_MM, SLOPE, N_("B-C Slope(M)"), CMS, NULL},//仅显示斜率
{FETAL_RV_ET_MM, TIME_M, N_("RV ET(M)"), SEC, &FetalRVETCalc},
{FETAL_RV_PEP_MM, TIME_M, N_("RV PEP(M)"), SEC, &FetalRVPEPCalc },
{FETAL_HR_PV_MM, HR_M, N_("HR-PV(M)"), BPM, &FetalHRPVCalc },
{FETAL_TV_DE_EXC_MM, DIST_SLOPE_M, N_("TV D-E Exc(M)"), FETAL_TV_DE_EXC_MULTI, NULL},//显示距离和斜率
{FETAL_TV_DE_SLOPE_MM, SLOPE, N_("TV D-E Slope(M)"), CMS, NULL},//仅显示斜率
{FETAL_TV_EF_SLOPE_MM, SLOPE, N_("TV E-F Slope(M)"), CMS, NULL},//仅显示斜率
{FETAL_TV_AC_INTERVAL_MM, TIME_M, N_("TV A-C Interval(M)"), SEC, NULL},
//Fetal D Utero and Placenta
{FETAL_PLACENTA, SD, N_("Placenta(D)"), FETAL_PLACENTA_MULTI, NULL},//测PS, ED, RI, S/D
{FETAL_UM_A, SD, N_("Umbilical A(D)"), FETAL_UM_A_MULTI, NULL},//测PS, ED, RI, S/D
{FETAL_UM_V, VEL_D, N_("Umbilical V(D)"), CMS, NULL},//仅测速度
{FETAL_L_UT_A, SD, N_("L Uterine A(D)"), FETAL_L_UT_A_MULTI, NULL},//测PS, ED, RI, S/D
{FETAL_R_UT_A, SD, N_("R Uterine A(D)"), FETAL_R_UT_A_MULTI, NULL},//测PS, ED, RI, S/D
{FETAL_L_OV_A, SD, N_("L Ovarian A(D)"), FETAL_L_OV_A_MULTI, NULL},//测PS, ED, RI, S/D
{FETAL_R_OV_A, SD, N_("R Ovarian A(D)"), FETAL_R_OV_A_MULTI, NULL},//测PS, ED, RI, S/D
//Fetal D Vessels
{FETAL_FROAMEN_OVALE, PGMAX, N_("Foramen Ovale(D)"), FETAL_FROAMEN_OVALE_MULTI, NULL},
{FETAL_DUCT_ART, SD, N_("Duct Art(D)"), FETAL_DUCT_ART_MULTI, NULL},//测PS, ED, RI, S/D
{FETAL_L_COR_A, PGMAX, N_("L Coronary A(D)"), FETAL_L_COR_A_MULTI, NULL},
{FETAL_R_COR_A, PGMAX, N_("R Coronary A(D)"), FETAL_R_COR_A_MULTI, NULL},
{FETAL_AOR, PGMAX, N_("AoR(D)"), FETAL_AOR_MULTI, NULL},
{FETAL_ASC_AO, PGMAX, N_("Asc Ao(D)"), FETAL_ASC_AO_MULTI, NULL},
{FETAL_AO_ARCH, PGMAX, N_("Ao Arch(D)"), FETAL_AO_ARCH_MULTI, NULL},
{FETAL_AO_ISTHMUS, PGMAX, N_("Ao Isthmus(D)"), FETAL_AO_ISTHMUS_MULTI, NULL},
{FETAL_DESC_AO, PGMAX, N_("Desc Ao(D)"), FETAL_DESC_AO_MULTI, NULL},
{FETAL_MPA, PGMAX, N_("MPA(D)"), FETAL_MPA_MULTI, NULL},
{FETAL_LPA, PGMAX, N_("LPA(D)"), FETAL_LPA_MULTI, NULL},
{FETAL_RPA, PGMAX, N_("RPA(D)"), FETAL_RPA_MULTI, NULL},
// {FETAL_PULM_V, PGMAX, N_("Pulm V"), FETAL_PULM_V_MULTI, NULL},//仅速度测量
{FETAL_PULM_V, VEL_D, N_("Pulm V(D)"), CMS, NULL},//仅速度测量
{FETAL_DUCT_VEN, SD, N_("Duct Ven(D)"), FETAL_DUCT_VEN_MULTI, NULL},//测PS, ED, RI, S/D
//Fetal D AV and MV
{FETAL_LVOT_ACC_TIME, TIME_D, N_("LVOT Acc Time(D)"), SEC, NULL},
{FETAL_LVOT_VMAX, PGMAX, N_("LVOT Vmax(D)"), FETAL_LVOT_VMAX_MULTI, NULL},
{FETAL_AV_ACC_TIME, TIME_D, N_("AV Acc Time(D)"), SEC, NULL},
{FETAL_AV_VMAX, PGMAX, N_("AV Vmax(D)"), FETAL_AV_VMAX_MULTI, NULL},
{FETAL_AI_ACC_TIME, TIME_D, N_("AI Acc Time(D)"), SEC, NULL},
{FETAL_AI_END_DIAS_VEL, PGMAX, N_("AI End Dias Vel(D)"), FETAL_AI_END_DIAS_VEL_MULTI, NULL},
{FETAL_AI_VMAX, PGMAX, N_("AI Vmax(D)"), FETAL_AI_VMAX_MULTI, NULL},
{FETAL_HR_AV, HR_D, N_("HR-AV(D)"), FETAL_HR_AV_MULTI, NULL},
{FETAL_HR_MV, HR_D, N_("HR-MV(D)"), FETAL_HR_MV_MULTI, NULL},
{FETAL_MV_PEAK_E, VEL_D, N_("MV Peak E(D)"), CMS, &FetalMVEACalc},
{FETAL_MV_PEAK_A, VEL_D, N_("MV Peak A(D)"), CMS, &FetalMVEACalc},
{FETAL_MV_ACC_TIME, TIME_D, N_("MV Acc Time(D)"), SEC, NULL},
{FETAL_MV_DEC_TIME, TIME_D, N_("MV Dec Time(D)"), SEC, NULL},
{FETAL_MV_VMAX, PGMAX, N_("MV Vmax(D)"), FETAL_MV_VMAX_MULTI, NULL},
{FETAL_MR_VMAX, PGMAX, N_("MR Vmax(D)"), FETAL_MR_VMAX_MULTI, NULL},
//Fetal D PV and TV
{FETAL_RVOT_ACC_TIME, TIME_D, N_("RVOT Acc Time(D)"), SEC, NULL},
{FETAL_RVOT_VMAX, PGMAX, N_("RVOT Vmax(D)"), FETAL_RVOT_VMAX_MULTI, NULL},
{FETAL_PV_ACC_TIME, TIME_D, N_("PV Acc Time(D)"), SEC, NULL},
{FETAL_PV_VMAX, PGMAX, N_("PV Vmax(D)"), FETAL_PV_VMAX_MULTI, NULL},
{FETAL_HR_PV, HR_D, N_("HR-PV(D)"), FETAL_HR_PV_MULTI, NULL},
{FETAL_TV_PEAK_A, VEL_D, N_("TV Peak A(D)"), CMS, &FetalTVEACalc},
{FETAL_TV_PEAK_E, VEL_D, N_("TV Peak E(D)"), CMS, &FetalTVEACalc},
{FETAL_TV_ACC_TIME, TIME_D, N_("TV Acc Time(D)"), SEC, NULL},
{FETAL_TV_DEC_TIME, TIME_D, N_("TV Dec Time(D)"), SEC, NULL},
{FETAL_TV_VMAX, PGMAX, N_("TV Vmax(D)"), FETAL_TV_VMAX_MULTI, NULL},
{FETAL_TR_VMAX, PGMAX, N_("TR Vmax(D)"), FETAL_TR_VMAX_MULTI, NULL},
{FETAL_HR_TV, HR_D, N_("HR-TV(D)"), FETAL_HR_TV_MULTI, NULL},
//Fetal D Peripheral Vasc
{FETAL_THORACIC_AO, SD, N_("Thoracic Ao(D)"), FETAL_THORACIC_AO_MULTI, NULL},//测PS, ED, RI, S/D
{FETAL_L_RENAL_A, SD, N_("L Renal A(D)"), FETAL_L_RENAL_A_MULTI, NULL},//测PS, ED, RI, S/D
{FETAL_R_RENAL_A, SD, N_("R Renal A(D)"), FETAL_R_RENAL_A_MULTI, NULL},//测PS, ED, RI, S/D
{FETAL_HEPATIC_A, SD, N_("Hepatic A(D)"), FETAL_HEPATIC_A_MULTI, NULL},//测PS, ED, RI, S/D
{FETAL_HEPATIC_V, SD, N_("Hepatic V(D)"), FETAL_HEPATIC_V_MULTI, NULL},//测PS, ED, RI, S/D
{FETAL_SPLENIC_A, SD, N_("Splenic A(D)"), FETAL_SPLENIC_A_MULTI, NULL},//测PS, ED, RI, S/D
{FETAL_L_MCA, SD, N_("L MCA(D)"), FETAL_L_MCA_MULTI, NULL},//测PS, ED, RI, S/D
{FETAL_R_MCA, SD, N_("R MCA(D)"), FETAL_R_MCA_MULTI, NULL},//测PS, ED, RI, S/D
{FETAL_L_ICA, SD, N_("L ICA(D)"), FETAL_L_ICA_MULTI, NULL},//测PS, ED, RI, S/D
{FETAL_R_ICA, SD, N_("R ICA(D)"), FETAL_R_ICA_MULTI, NULL},//测PS, ED, RI, S/D
{FETAL_SVC, SD, N_("SVC(D)"), FETAL_SVC_MULTI, NULL},//测PS, ED, RI, S/D
{FETAL_IVC, SD, N_("IVC(D)"), FETAL_IVC_MULTI, NULL}//测PS, ED, RI, S/D
};
const MultiItemInfo FetalMultiInfo[] = {
{ FETAL_TV_DE_EXC_MM, FETAL_TV_DE_EXC_MULTI, DIST_SLOPE_M, "TV D-E Exc", SlopeMInfo, NULL },
{ FETAL_PLACENTA, FETAL_PLACENTA_MULTI, SD, "Placenta", SdInfo, NULL },
{ FETAL_UM_A, FETAL_UM_A_MULTI, SD, "Umbilical A", SdInfo, NULL },
{ FETAL_L_UT_A, FETAL_L_UT_A_MULTI, SD, "L Uterine A", SdInfo, NULL },
{ FETAL_R_UT_A, FETAL_R_UT_A_MULTI, SD, "R Uterine A", SdInfo, NULL },
{ FETAL_L_OV_A, FETAL_L_OV_A_MULTI, SD, "L Ovarian A", SdInfo, NULL },
{ FETAL_R_OV_A, FETAL_R_OV_A_MULTI, SD, "R Ovarian A", SdInfo, NULL },
{ FETAL_FROAMEN_OVALE, FETAL_FROAMEN_OVALE_MULTI, PGMAX, "Foramen Ovale", PgmaxInfo, NULL },
{ FETAL_DUCT_ART, FETAL_DUCT_ART_MULTI, SD, "Duct Art", SdInfo, NULL },
{ FETAL_L_COR_A, FETAL_L_COR_A_MULTI, PGMAX, "L Coronary A", PgmaxInfo, NULL },
{ FETAL_R_COR_A, FETAL_R_COR_A_MULTI, PGMAX, "R Corenary A", PgmaxInfo, NULL },
{ FETAL_AOR, FETAL_AOR_MULTI, PGMAX, "AoR", PgmaxInfo, NULL },
{ FETAL_ASC_AO, FETAL_ASC_AO_MULTI, PGMAX, "Asc Ao", PgmaxInfo, NULL },
{ FETAL_AO_ARCH, FETAL_AO_ARCH_MULTI, PGMAX, "Ao Arch", PgmaxInfo, NULL },
{ FETAL_AO_ISTHMUS, FETAL_AO_ISTHMUS_MULTI, PGMAX, "Ao Isthmus", PgmaxInfo, NULL },
{ FETAL_DESC_AO, FETAL_DESC_AO_MULTI, PGMAX, "Desc Ao", PgmaxInfo, NULL },
{ FETAL_MPA, FETAL_MPA_MULTI, PGMAX, "MPA", PgmaxInfo, NULL },
{ FETAL_LPA, FETAL_LPA_MULTI, PGMAX, "LPA", PgmaxInfo, NULL },
{ FETAL_RPA, FETAL_RPA_MULTI, PGMAX, "RPA", PgmaxInfo, NULL },
// { FETAL_PULM_V, FETAL_PULM_V_MULTI, PGMAX, "Pulm V", {{"Vmax", CMS}, {"PG max", MMHG}, {"\0", NOUNIT}, {"\0", NOUNIT}}, NULL },
{ FETAL_DUCT_VEN, FETAL_DUCT_VEN_MULTI, SD, "Duct Ven", SdInfo, NULL },
{ FETAL_LVOT_VMAX, FETAL_LVOT_VMAX_MULTI, PGMAX, "LVOT Vmax", PgmaxInfo, NULL },
{ FETAL_AV_VMAX, FETAL_AV_VMAX_MULTI, PGMAX, "AV Vmax", PgmaxInfo, NULL },
{ FETAL_AI_END_DIAS_VEL, FETAL_AI_END_DIAS_VEL_MULTI, PGMAX, "AI End Dias Vel", PgmaxInfo, NULL },
{ FETAL_AI_VMAX, FETAL_AI_VMAX_MULTI, PGMAX, "AI Vmax", PgmaxInfo, NULL },
{ FETAL_HR_AV, FETAL_HR_AV_MULTI, HR_D, "HR-AV", HrInfo, NULL },
{ FETAL_HR_MV, FETAL_HR_MV_MULTI, HR_D, "HR-MV", HrInfo, NULL },
{ FETAL_MV_VMAX, FETAL_MV_VMAX_MULTI, PGMAX, "MV Vmax", PgmaxInfo, NULL },
{ FETAL_MR_VMAX, FETAL_MR_VMAX_MULTI, PGMAX, "MR Vmax", PgmaxInfo, NULL },
{ FETAL_RVOT_VMAX, FETAL_RVOT_VMAX_MULTI, PGMAX, "RVOT Vmax", PgmaxInfo, NULL },
{ FETAL_PV_VMAX, FETAL_PV_VMAX_MULTI, PGMAX, "PV Vmax", PgmaxInfo, NULL },
{ FETAL_HR_PV, FETAL_HR_PV_MULTI, HR_D, "HR-PV", HrInfo, NULL },
{ FETAL_TV_VMAX, FETAL_TV_VMAX_MULTI, PGMAX, "TV Vmax", PgmaxInfo, NULL },
{ FETAL_TR_VMAX, FETAL_TR_VMAX_MULTI, PGMAX, "TR Vmax", PgmaxInfo, NULL },
{ FETAL_HR_TV, FETAL_HR_TV_MULTI, HR_D, "HR-TV", HrInfo, NULL },
{ FETAL_THORACIC_AO, FETAL_THORACIC_AO_MULTI, SD, "Thoracic Ao", SdInfo, NULL },
{ FETAL_L_RENAL_A, FETAL_L_RENAL_A_MULTI, SD, "L Renal A", SdInfo, NULL },
{ FETAL_R_RENAL_A, FETAL_R_RENAL_A_MULTI, SD, "R Renal A", SdInfo, NULL },
{ FETAL_HEPATIC_A, FETAL_HEPATIC_A_MULTI, SD, "Hepatic A", SdInfo, NULL },
{ FETAL_HEPATIC_V, FETAL_HEPATIC_V_MULTI, SD, "Hepatic V", SdInfo, NULL },
{ FETAL_SPLENIC_A, FETAL_SPLENIC_A_MULTI, SD, "Splenic A", SdInfo, NULL },
{ FETAL_L_MCA, FETAL_L_MCA_MULTI, SD, "L MCA", SdInfo, NULL },
{ FETAL_R_MCA, FETAL_R_MCA_MULTI, SD, "R MCA", SdInfo, NULL },
{ FETAL_L_ICA, FETAL_L_ICA_MULTI, SD, "L ICA", SdInfo, NULL },
{ FETAL_R_ICA, FETAL_R_ICA_MULTI, SD, "R ICA", SdInfo, NULL },
{ FETAL_SVC, FETAL_SVC_MULTI, SD, "SVC", SdInfo, NULL },
{ FETAL_IVC, FETAL_IVC_MULTI, SD, "IVC", SdInfo, NULL },
};
/******************************VS Measure**************************************/
//const CalcResultInfo VSIcaCca = {VS_ICA_CCA_RATIO, "ICA/CCA", NOUNIT, MeaCalcFun::ICACCACalc};
const CalcResultInfo VSLIcaCcaRatio = {VS_L_ICA_CCA_RATIO, {VS_L_ICA, VS_L_CCA, NO_PAR, NO_PAR, NO_PAR}, "L ICA/CCA", NOUNIT, MeaCalcFun::SectionCalc, NULL};
const CalcResultInfo VSRIcaCcaRatio = {VS_R_ICA_CCA_RATIO, {VS_R_ICA, VS_R_CCA, NO_PAR, NO_PAR, NO_PAR}, "R ICA/CCA", NOUNIT, MeaCalcFun::SectionCalc, NULL};
const CalcInfoArray VSLIcaCcaCalc = {&VSLIcaCcaRatio, NULL};
const CalcInfoArray VSRIcaCcaCalc = {&VSRIcaCcaRatio, NULL};
const PtrOfCalcInfo VSCalcInfoPtr[VS_CALC_END - VS_CALC_START] = {
{VS_L_ICA_CCA_RATIO, &VSLIcaCcaRatio},
{VS_R_ICA_CCA_RATIO, &VSRIcaCcaRatio},
};
const SingleItemInfo VSInfo[] = {
{VS_L_CCA, PSED, N_("L CCA"), VS_L_CCA_MULTI, &VSLIcaCcaCalc},
{VS_R_CCA, PSED, N_("R CCA"), VS_R_CCA_MULTI, &VSRIcaCcaCalc},
{VS_L_DIST_CCA, PSED, N_("L Dist CCA"), VS_L_DIST_CCA_MULTI, NULL},
{VS_R_DIST_CCA, PSED, N_("R Dist CCA"), VS_R_DIST_CCA_MULTI, NULL},
{VS_L_MID_CCA, PSED, N_("L Mid CCA"), VS_L_MID_CCA_MULTI, NULL},
{VS_R_MID_CCA, PSED, N_("R Mid CCA"), VS_R_MID_CCA_MULTI, NULL},
{VS_L_PROX_CCA, PSED, N_("L Prox CCA"), VS_L_PROX_CCA_MULTI, NULL},
{VS_R_PROX_CCA, PSED, N_("R Prox CCA"), VS_R_PROX_CCA_MULTI, NULL},
{VS_L_ICA, PSED, N_("L ICA"), VS_L_ICA_MULTI, &VSLIcaCcaCalc},
{VS_R_ICA, PSED, N_("R ICA"), VS_R_ICA_MULTI, &VSRIcaCcaCalc},
{VS_L_DIST_ICA, PSED, N_("L Dist ICA"), VS_L_DIST_ICA_MULTI, NULL},
{VS_R_DIST_ICA, PSED, N_("R Dist ICA"), VS_R_DIST_ICA_MULTI, NULL},
{VS_L_MID_ICA, PSED, N_("L Mid ICA"), VS_L_MID_ICA_MULTI, NULL},
{VS_R_MID_ICA, PSED, N_("R Mid ICA"), VS_R_MID_ICA_MULTI, NULL},
{VS_L_PROX_ICA, PSED, N_("L Prox ICA"), VS_L_PROX_ICA_MULTI, NULL},
{VS_R_PROX_ICA, PSED, N_("R Prox ICA"), VS_R_PROX_ICA_MULTI, NULL},
{VS_L_DIST_LSV, PSED, N_("L Dist LSV"), VS_L_DIST_LSV_MULTI, NULL},
{VS_R_DIST_LSV, PSED, N_("R Dist LSV"), VS_R_DIST_LSV_MULTI, NULL},
{VS_L_MID_LSV, PSED, N_("L Mid LSV"), VS_L_MID_LSV_MULTI, NULL},
{VS_R_MID_LSV, PSED, N_("R Mid LSV"), VS_R_MID_LSV_MULTI, NULL},
{VS_L_PROX_LSV, PSED, N_("L Prox LSV"), VS_L_PROX_LSV_MULTI, NULL},
{VS_R_PROX_LSV, PSED, N_("R Prox LSV"), VS_R_PROX_LSV_MULTI, NULL},
{VS_L_DIST_CEPH_V, PSED, N_("L Dist Ceph V"), VS_L_DIST_CEPH_V_MULTI, NULL},
{VS_R_DIST_CEPH_V, PSED, N_("R Dist Ceph V"), VS_R_DIST_CEPH_V_MULTI, NULL},
{VS_L_MID_CEPH_V, PSED, N_("L Mid Ceph V"), VS_L_MID_CEPH_V_MULTI, NULL},
{VS_R_MID_CEPH_V, PSED, N_("R Mid Ceph V"), VS_R_MID_CEPH_V_MULTI, NULL},
{VS_L_PROX_CEPH_V, PSED, N_("L Prox Ceph V"), VS_L_PROX_CEPH_V_MULTI, NULL},
{VS_R_PROX_CEPH_V, PSED, N_("R Prox Ceph V"), VS_R_PROX_CEPH_V_MULTI, NULL},
{VS_L_PROX_ECA, PSED, N_("L Prox ECA"), VS_L_PROX_ECA_MULTI, NULL},
{VS_R_PROX_ECA, PSED, N_("R Prox ECA"), VS_R_PROX_ECA_MULTI, NULL},
{VS_L_BRACHIOCEPH_A, PSED, N_("L Brachioceph A"), VS_L_BRACHIOCEPH_A_MULTI, NULL},
{VS_R_BRACHIOCEPH_A, PSED, N_("R Brachioceph A"), VS_R_BRACHIOCEPH_A_MULTI, NULL},
{VS_L_BRACHIOCEPH_V, PSED, N_("L Brachioceph V"), VS_L_BRACHIOCEPH_V_MULTI, NULL},
{VS_R_BRACHIOCEPH_V, PSED, N_("R Brachioceph V"), VS_R_BRACHIOCEPH_V_MULTI, NULL},
{VS_L_BULB, PSED, N_("L Bulb"), VS_L_BULB_MULTI, NULL},
{VS_R_BULB, PSED, N_("R Bulb"), VS_R_BULB_MULTI, NULL},
{VS_L_VERTEBRAL_A, PSED, N_("L Vertebral A"), VS_L_VERTEBRAL_A_MULTI, NULL},
{VS_R_VERTEBRAL_A, PSED, N_("R Vertebral A"), VS_R_VERTEBRAL_A_MULTI, NULL},
{VS_L_IJV, PSED, N_("L IJV"), VS_L_IJV_MULTI, NULL},
{VS_R_IJV, PSED, N_("R IJV"), VS_R_IJV_MULTI, NULL},
{VS_L_MID_SCL_A, PSED, N_("L Mid SCL A"), VS_L_MID_SCL_A_MULTI, NULL},
{VS_R_MID_SCL_A, PSED, N_("R Mid SCL A"), VS_R_MID_SCL_A_MULTI, NULL},
{VS_L_PROX_SCL_A, PSED, N_("L Prox SCL A"), VS_L_PROX_SCL_A_MULTI, NULL},
{VS_R_PROX_SCL_A, PSED, N_("R Prox SCL A"), VS_R_PROX_SCL_A_MULTI, NULL},
{VS_L_MID_SCL_V, PSED, N_("L Mid SCL V"), VS_L_MID_SCL_V_MULTI, NULL},
{VS_R_MID_SCL_V, PSED, N_("R Mid SCL V"), VS_R_MID_SCL_V_MULTI, NULL},
{VS_L_PROX_SCL_V, PSED, N_("L Prox SCL V"), VS_L_PROX_SCL_V_MULTI, NULL},
{VS_R_PROX_SCL_V, PSED, N_("R Prox SCL V"), VS_R_PROX_SCL_V_MULTI, NULL},
{VS_L_CFA, RI, N_("L CFA"), VS_L_CFA_MULTI, NULL},
{VS_R_CFA, RI, N_("R CFA"), VS_R_CFA_MULTI, NULL},
{VS_L_CFV, PSED, N_("L CFV"), VS_L_CFV_MULTI, NULL},
{VS_R_CFV, PSED, N_("R CFV"), VS_R_CFV_MULTI, NULL},
{VS_L_COM_ILIAC_A, RI, N_("L Com Iliac A"), VS_L_COM_ILIAC_A_MULTI, NULL},
{VS_R_COM_ILIAC_A, RI, N_("R Com Iliac A"), VS_R_COM_ILIAC_A_MULTI, NULL},
{VS_L_COM_ILIAC_V, PSED, N_("L Com Iliac V"), VS_L_COM_ILIAC_V_MULTI, NULL},
{VS_R_COM_ILIAC_V, PSED, N_("R Com Iliac V"), VS_R_COM_ILIAC_V_MULTI, NULL},
{VS_L_DIST_ATA, RI, N_("L Dist ATA"), VS_L_DIST_ATA_MULTI, NULL},
{VS_R_DIST_ATA, RI, N_("R Dist ATA"), VS_R_DIST_ATA_MULTI, NULL},
{VS_L_MID_ATA, RI, N_("L Mid ATA"), VS_L_MID_ATA_MULTI, NULL},
{VS_R_MID_ATA, RI, N_("R Mid ATA"), VS_R_MID_ATA_MULTI, NULL},
{VS_L_PROX_ATA, RI, N_("L Prox ATA"), VS_L_PROX_ATA_MULTI, NULL},
{VS_R_PROX_ATA, RI, N_("R Prox ATA"), VS_R_PROX_ATA_MULTI, NULL},
{VS_L_DIST_ATV, PSED, N_("L Dist ATV"), VS_L_DIST_ATV_MULTI, NULL},
{VS_R_DIST_ATV, PSED, N_("R Dist ATV"), VS_R_DIST_ATV_MULTI, NULL},
{VS_L_MID_ATV, PSED, N_("L Mid ATV"), VS_L_MID_ATV_MULTI, NULL},
{VS_R_MID_ATV, PSED, N_("R Mid ATV"), VS_R_MID_ATV_MULTI, NULL},
{VS_L_PROX_ATV, PSED, N_("L Prox ATV"), VS_L_PROX_ATV_MULTI, NULL},
{VS_R_PROX_ATV, PSED, N_("R Prox ATV"), VS_R_PROX_ATV_MULTI, NULL},
{VS_L_DIST_GSV_CALF, PSED, N_("L Dist GSV Calf"), VS_L_DIST_GSV_CALF_MULTI, NULL},
{VS_R_DIST_GSV_CALF, PSED, N_("R Dist GSV Calf"), VS_R_DIST_GSV_CALF_MULTI, NULL},
{VS_L_MID_GSV_CALF, PSED, N_("L Mid GSV Calf"), VS_L_MID_GSV_CALF_MULTI, NULL},
{VS_R_MID_GSV_CALF, PSED, N_("R Mid GSV Calf"), VS_R_MID_GSV_CALF_MULTI, NULL},
{VS_L_PROX_GSV_CALF, PSED, N_("L Prox GSV Calf"), VS_L_PROX_GSV_CALF_MULTI, NULL},
{VS_R_PROX_GSV_CALF, PSED, N_("R Prox GSV Calf"), VS_R_PROX_GSV_CALF_MULTI, NULL},
{VS_L_DIST_GSV_THIGH, PSED, N_("L Dist GSV Thigh"), VS_L_DIST_GSV_THIGH_MULTI, NULL},
{VS_R_DIST_GSV_THIGH, PSED, N_("R Dist GSV Thigh"), VS_R_DIST_GSV_THIGH_MULTI, NULL},
{VS_L_MID_GSV_THIGH, PSED, N_("L Mid GSV Thigh"), VS_L_MID_GSV_THIGH_MULTI, NULL},
{VS_R_MID_GSV_THIGH, PSED, N_("R Mid GSV Thigh"), VS_R_MID_GSV_THIGH_MULTI, NULL},
{VS_L_PROX_GSV_THIGH, PSED, N_("L Prox GSV Thigh"), VS_L_PROX_GSV_THIGH_MULTI, NULL},
{VS_R_PROX_GSV_THIGH, PSED, N_("R Prox GSV Thigh"), VS_R_PROX_GSV_THIGH_MULTI, NULL},
{VS_L_DIST_PERO_A, RI, N_("L Dist Pero A"), VS_L_DIST_PERO_A_MULTI, NULL},
{VS_R_DIST_PERO_A, RI, N_("R Dist Pero A"), VS_R_DIST_PERO_A_MULTI, NULL},
{VS_L_MID_PERO_A, RI, N_("L Mid Pero A"), VS_L_MID_PERO_A_MULTI, NULL},
{VS_R_MID_PERO_A, RI, N_("R Mid Pero A"), VS_R_MID_PERO_A_MULTI, NULL},
{VS_L_PROX_PERO_A, RI, N_("L Prox Pero A"), VS_L_PROX_PERO_A_MULTI, NULL},
{VS_R_PROX_PERO_A, RI, N_("R Prox Pero A"), VS_R_PROX_PERO_A_MULTI, NULL},
{VS_L_DIST_PERO_V, PSED, N_("L Dist Pero V"), VS_L_DIST_PERO_V_MULTI, NULL},
{VS_R_DIST_PERO_V, PSED, N_("R Dist Pero V"), VS_R_DIST_PERO_V_MULTI, NULL},
{VS_L_MID_PERO_V, PSED, N_("L Mid Pero V"), VS_L_MID_PERO_V_MULTI, NULL},
{VS_R_MID_PERO_V, PSED, N_("R Mid Pero V"), VS_R_MID_PERO_V_MULTI, NULL},
{VS_L_PROX_PERO_V, PSED, N_("L Prox Pero V"), VS_L_PROX_PERO_V_MULTI, NULL},
{VS_R_PROX_PERO_V, PSED, N_("R Prox Pero V"), VS_R_PROX_PERO_V_MULTI, NULL},
{VS_L_DIST_POP_A, RI, N_("L Dist Pop A"), VS_L_DIST_POP_A_MULTI, NULL},
{VS_R_DIST_POP_A, RI, N_("R Dist Pop A"), VS_R_DIST_POP_A_MULTI, NULL},
{VS_L_MID_POP_A, RI, N_("L Mid Pop A"), VS_L_MID_POP_A_MULTI, NULL},
{VS_R_MID_POP_A, RI, N_("R Mid Pop A"), VS_R_MID_POP_A_MULTI, NULL},
{VS_L_PROX_POP_A, RI, N_("L Prox Pop A"), VS_L_PROX_POP_A_MULTI, NULL},
{VS_R_PROX_POP_A, RI, N_("R Prox Pop A"), VS_R_PROX_POP_A_MULTI, NULL},
{VS_L_DIST_POP_V, PSED, N_("L Dist Pop V"), VS_L_DIST_POP_V_MULTI, NULL},
{VS_R_DIST_POP_V, PSED, N_("R Dist Pop V"), VS_R_DIST_POP_V_MULTI, NULL},
{VS_L_MID_POP_V, PSED, N_("L Mid Pop V"), VS_L_MID_POP_V_MULTI, NULL},
{VS_R_MID_POP_V, PSED, N_("R Mid Pop V"), VS_R_MID_POP_V_MULTI, NULL},
{VS_L_PROX_POP_V, PSED, N_("L Prox Pop V"), VS_L_PROX_POP_V_MULTI, NULL},
{VS_R_PROX_POP_V, PSED, N_("R Prox Pop V"), VS_R_PROX_POP_V_MULTI, NULL},
{VS_L_DIST_PTA, RI, N_("L Dist PTA"), VS_L_DIST_PTA_MULTI, NULL},
{VS_R_DIST_PTA, RI, N_("R Dist PTA"), VS_R_DIST_PTA_MULTI, NULL},
{VS_L_MID_PTA, RI, N_("L Mid PTA"), VS_L_MID_PTA_MULTI, NULL},
{VS_R_MID_PTA, RI, N_("R Mid PTA"), VS_R_MID_PTA_MULTI, NULL},
{VS_L_PROX_PTA, RI, N_("L Prox PTA"), VS_L_PROX_PTA_MULTI, NULL},
{VS_R_PROX_PTA, RI, N_("R Prox PTA"), VS_R_PROX_PTA_MULTI, NULL},
{VS_L_DIST_PTV, PSED, N_("L Dist PTV"), VS_L_DIST_PTV_MULTI, NULL},
{VS_R_DIST_PTV, PSED, N_("R Dist PTV"), VS_R_DIST_PTV_MULTI, NULL},
{VS_L_MID_PTV, PSED, N_("L Mid PTV"), VS_L_MID_PTV_MULTI, NULL},
{VS_R_MID_PTV, PSED, N_("R Mid PTV"), VS_R_MID_PTV_MULTI, NULL},
{VS_L_PROX_PTV, PSED, N_("L Prox PTV"), VS_L_PROX_PTV_MULTI, NULL},
{VS_R_PROX_PTV, PSED, N_("R Prox PTV"), VS_R_PROX_PTV_MULTI, NULL},
{VS_L_DIST_SFA, RI, N_("L Dist SFA"), VS_L_DIST_SFA_MULTI, NULL},
{VS_R_DIST_SFA, RI, N_("R Dist SFA"), VS_R_DIST_SFA_MULTI, NULL},
{VS_L_MID_SFA, RI, N_("L Mid SFA"), VS_L_MID_SFA_MULTI, NULL},
{VS_R_MID_SFA, RI, N_("R Mid SFA"), VS_R_MID_SFA_MULTI, NULL},
{VS_L_PROX_SFA, RI, N_("L Prox SFA"), VS_L_PROX_SFA_MULTI, NULL},
{VS_R_PROX_SFA, RI, N_("R Prox SFA"), VS_R_PROX_SFA_MULTI, NULL},
{VS_L_DIST_SFV, PSED, N_("L Dist SFV"), VS_L_DIST_SFV_MULTI, NULL},
{VS_R_DIST_SFV, PSED, N_("R Dist SFV"), VS_R_DIST_SFV_MULTI, NULL},
{VS_L_MID_SFV, PSED, N_("L Mid SFV"), VS_L_MID_SFV_MULTI, NULL},
{VS_R_MID_SFV, PSED, N_("R Mid SFV"), VS_R_MID_SFV_MULTI, NULL},
{VS_L_PROX_SFV, PSED, N_("L Prox SFV"), VS_L_PROX_SFV_MULTI, NULL},
{VS_R_PROX_SFV, PSED, N_("R Prox SFV"), VS_R_PROX_SFV_MULTI, NULL},
{VS_L_DOR_PEDIS, RI, N_("L Dor Pedis"), VS_L_DOR_PEDIS_MULTI, NULL},
{VS_R_DOR_PEDIS, RI, N_("R Dor Pedis"), VS_R_DOR_PEDIS_MULTI, NULL},
{VS_L_EXT_ILIAC_A, RI, N_("L Ext Iliac A"), VS_L_EXT_ILIAC_A_MULTI, NULL},
{VS_R_EXT_ILIAC_A, RI, N_("R Ext Iliac A"), VS_R_EXT_ILIAC_A_MULTI, NULL},
{VS_L_EXT_ILIAC_V, PSED, N_("L Ext Iliac V"), VS_L_EXT_ILIAC_V_MULTI, NULL},
{VS_R_EXT_ILIAC_V, PSED, N_("R Ext Iliac V"), VS_R_EXT_ILIAC_V_MULTI, NULL},
{VS_L_INT_ILIAC_A, RI, N_("L Int Iliac A"), VS_L_INT_ILIAC_A_MULTI, NULL},
{VS_R_INT_ILIAC_A, RI, N_("R Int Iliac A"), VS_R_INT_ILIAC_A_MULTI, NULL},
{VS_L_INT_ILIAC_V, PSED, N_("L Int Iliac V"), VS_L_INT_ILIAC_V_MULTI, NULL},
{VS_R_INT_ILIAC_V, PSED, N_("R Int Iliac V"), VS_R_INT_ILIAC_V_MULTI, NULL},
{VS_L_LAT_SURAL_V, PSED, N_("L Lat Sural V"), VS_L_LAT_SURAL_V_MULTI, NULL},
{VS_R_LAT_SURAL_V, PSED, N_("R Lat Sural V"), VS_R_LAT_SURAL_V_MULTI, NULL},
{VS_L_PROX_PFA, RI, N_("L Prox PFA"), VS_L_PROX_PFA_MULTI, NULL},
{VS_R_PROX_PFA, RI, N_("R Prox PFA"), VS_R_PROX_PFA_MULTI, NULL},
{VS_L_SFJ, PSED, N_("L SFJ"), VS_L_SFJ_MULTI, NULL},
{VS_R_SFJ, PSED, N_("R SFJ"), VS_R_SFJ_MULTI, NULL},
{VS_L_ANTECUBE, RI, N_("L Antecube"), VS_L_ANTECUBE_MULTI, NULL},
{VS_R_ANTECUBE, RI, N_("R Antecube"), VS_R_ANTECUBE_MULTI, NULL},
{VS_L_AX_A, RI, N_("L Ax A"), VS_L_AX_A_MULTI, NULL},
{VS_R_AX_A, RI, N_("R Ax A"), VS_R_AX_A_MULTI, NULL},
{VS_L_AX_V, PSED, N_("L Ax V"), VS_L_AX_V_MULTI, NULL},
{VS_R_AX_V, PSED, N_("R Ax V"), VS_R_AX_V_MULTI, NULL},
{VS_L_DIST_BASILIC_V, PSED, N_("L Dist Basilic V"), VS_L_DIST_BASILIC_V_MULTI, NULL},
{VS_R_DIST_BASILIC_V, PSED, N_("R Dist Basilic V"), VS_R_DIST_BASILIC_V_MULTI, NULL},
{VS_L_MID_BASILIC_V, PSED, N_("L Mid Basilic V"), VS_L_MID_BASILIC_V_MULTI, NULL},
{VS_R_MID_BASILIC_V, PSED, N_("R Mid Basilic V"), VS_R_MID_BASILIC_V_MULTI, NULL},
{VS_L_PROX_BASILIC_V, PSED, N_("L Prox Basilic V"), VS_L_PROX_BASILIC_V_MULTI, NULL},
{VS_R_PROX_BASILIC_V, PSED, N_("R Prox Basilic V"), VS_R_PROX_BASILIC_V_MULTI, NULL},
{VS_L_DIST_BRACH_A, RI, N_("L Dist Brach A"), VS_L_DIST_BRACH_A_MULTI, NULL},
{VS_R_DIST_BRACH_A, RI, N_("R Dist Brach A"), VS_R_DIST_BRACH_A_MULTI, NULL},
{VS_L_PROX_BRACH_A, RI, N_("L Prox Brach A"), VS_L_PROX_BRACH_A_MULTI, NULL},
{VS_R_PROX_BRACH_A, RI, N_("R Prox Brach A"), VS_R_PROX_BRACH_A_MULTI, NULL},
{VS_L_DIST_BRACH_V, RI, N_("L Dist Brach V"), VS_L_DIST_BRACH_V_MULTI, NULL},
{VS_R_DIST_BRACH_V, RI, N_("R Dist Brach V"), VS_R_DIST_BRACH_V_MULTI, NULL},
{VS_L_PROX_BRACH_V, RI, N_("L Prox Brach V"), VS_L_PROX_BRACH_V_MULTI, NULL},
{VS_R_PROX_BRACH_V, RI, N_("R Prox Brach V"), VS_R_PROX_BRACH_V_MULTI, NULL},
{VS_L_DIST_RAD_A, RI, N_("L Dist Rad A"), VS_L_DIST_RAD_A_MULTI, NULL},
{VS_R_DIST_RAD_A, RI, N_("R Dist Rad A"), VS_R_DIST_RAD_A_MULTI, NULL},
{VS_L_MID_RAD_A, RI, N_("L Mid Rad A"), VS_L_MID_RAD_A_MULTI, NULL},
{VS_R_MID_RAD_A, RI, N_("R Mid Rad A"), VS_R_MID_RAD_A_MULTI, NULL},
{VS_L_PROX_RAD_A, RI, N_("L Prox Rad A"), VS_L_PROX_RAD_A_MULTI, NULL},
{VS_R_PROX_RAD_A, RI, N_("R Prox Rad A"), VS_R_PROX_RAD_A_MULTI, NULL},
{VS_L_DIST_RAD_V, PSED, N_("L Dist Rad V"), VS_L_DIST_RAD_V_MULTI, NULL},
{VS_R_DIST_RAD_V, PSED, N_("R Dist Rad V"), VS_R_DIST_RAD_V_MULTI, NULL},
{VS_L_MID_RAD_V, PSED, N_("L Mid Rad V"), VS_L_MID_RAD_V_MULTI, NULL},
{VS_R_MID_RAD_V, PSED, N_("R Mid Rad V"), VS_R_MID_RAD_V_MULTI, NULL},
{VS_L_PROX_RAD_V, PSED, N_("L Prox Rad V"), VS_L_PROX_RAD_V_MULTI, NULL},
{VS_R_PROX_RAD_V, PSED, N_("R Prox Rad V"), VS_R_PROX_RAD_V_MULTI, NULL},
{VS_L_DIST_ULNAR_A, RI, N_("L Dist Ulnar A"), VS_L_DIST_ULNAR_A_MULTI, NULL},
{VS_R_DIST_ULNAR_A, RI, N_("R Dist Ulnar A"), VS_R_DIST_ULNAR_A_MULTI, NULL},
{VS_L_MID_ULNAR_A, RI, N_("L Mid Ulnar A"), VS_L_MID_ULNAR_A_MULTI, NULL},
{VS_R_MID_ULNAR_A, RI, N_("R Mid Ulnar A"), VS_R_MID_ULNAR_A_MULTI, NULL},
{VS_L_PROX_ULNAR_A, RI, N_("L Prox Ulnar A"), VS_L_PROX_ULNAR_A_MULTI, NULL},
{VS_R_PROX_ULNAR_A, RI, N_("R Prox Ulnar A"), VS_R_PROX_ULNAR_A_MULTI, NULL},
{VS_L_DIST_ULNAR_V, PSED, N_("L Dist Ulnar V"), VS_L_DIST_ULNAR_V_MULTI, NULL},
{VS_R_DIST_ULNAR_V, PSED, N_("R Dist Ulnar V"), VS_R_DIST_ULNAR_V_MULTI, NULL},
{VS_L_MID_ULNAR_V, PSED, N_("L Mid Ulnar V"), VS_L_MID_ULNAR_V_MULTI, NULL},
{VS_R_MID_ULNAR_V, PSED, N_("R Mid Ulnar V"), VS_R_MID_ULNAR_V_MULTI, NULL},
{VS_L_PROX_ULNAR_V, PSED, N_("L Prox Ulnar V"), VS_L_PROX_ULNAR_V_MULTI, NULL},
{VS_R_PROX_ULNAR_V, PSED, N_("R Prox Ulnar V"), VS_R_PROX_ULNAR_V_MULTI, NULL},
// {VS_L_MID_SCL_A, PSED, "L Mid SCL A", VS_L_MID_SCL_A_MULTI, NULL},
// {VS_R_MID_SCL_A, PSED, "R Mid SCL A", VS_R_MID_SCL_A_MULTI, NULL},
// {VS_L_PROX_SCL_A, PSED, "L Prox SCL A", VS_L_PROX_SCL_A_MULTI, NULL},
// {VS_R_PROX_SCL_A, PSED, "R Prox SCL A", VS_R_PROX_SCL_A_MULTI, NULL},
// {VS_L_MID_SCL_V, PSED, "L Mid SCL V", VS_L_MID_SCL_V_MULTI, NULL},
// {VS_R_MID_SCL_V, PSED, "R Mid SCL V", VS_R_MID_SCL_V_MULTI, NULL},
// {VS_L_PROX_SCL_V, PSED, "L Prox SCL V", VS_L_PROX_SCL_V_MULTI, NULL},
// {VS_R_PROX_SCL_V, PSED, "R Prox SCL V", VS_R_PROX_SCL_V_MULTI, NULL},
};
/*
*VS和TCD是以有多项测量的测量项为主的科别,在VSMultiInfo和TCDMultiInfo中,如果某项是单项测量,
*则titleUnit[MEA_MULTI-1].unitItem存储此单项测量的枚举号,程序根据此枚举号寻找它在VSInfo中的位置
* */
const MultiItemInfo VSMultiInfo[] = {
{VS_L_CCA, VS_L_CCA_MULTI, PSED, "L CCA", PsEdInfo, &VSLIcaCcaCalc},
{VS_R_CCA, VS_R_CCA_MULTI, PSED, "R CCA", PsEdInfo, &VSRIcaCcaCalc},
{VS_L_DIST_CCA, VS_L_DIST_CCA_MULTI, PSED, "L Dist CCA", PsEdInfo, NULL},
{VS_R_DIST_CCA, VS_R_DIST_CCA_MULTI, PSED, "R Dist CCA", PsEdInfo, NULL},
{VS_L_MID_CCA, VS_L_MID_CCA_MULTI, PSED, "L Mid CCA", PsEdInfo, NULL},
{VS_R_MID_CCA, VS_R_MID_CCA_MULTI, PSED, "R Mid CCA", PsEdInfo, NULL},
{VS_L_PROX_CCA, VS_L_PROX_CCA_MULTI, PSED, "L Prox CCA", PsEdInfo, NULL},
{VS_R_PROX_CCA, VS_R_PROX_CCA_MULTI, PSED, "R Prox CCA", PsEdInfo, NULL},
{VS_L_ICA, VS_L_ICA_MULTI, PSED, "L ICA", PsEdInfo, &VSLIcaCcaCalc}, //所有ICA的测量文档上写的都是Vel测量,实际上动脉不应该只测一个速度,在纸质资料上漏写了,所以误认为只有速度测量
{VS_R_ICA, VS_R_ICA_MULTI, PSED, "R ICA", PsEdInfo, &VSRIcaCcaCalc},
{VS_L_DIST_ICA, VS_L_DIST_ICA_MULTI, PSED, "L Dist ICA", PsEdInfo, NULL},
{VS_R_DIST_ICA, VS_R_DIST_ICA_MULTI, PSED, "R Dist ICA", PsEdInfo, NULL},
{VS_L_MID_ICA, VS_L_MID_ICA_MULTI, PSED, "L Mid ICA", PsEdInfo, NULL},
{VS_R_MID_ICA, VS_R_MID_ICA_MULTI, PSED, "R Mid ICA", PsEdInfo, NULL},
{VS_L_PROX_ICA, VS_L_PROX_ICA_MULTI, PSED, "L Prox ICA", PsEdInfo, NULL},
{VS_R_PROX_ICA, VS_R_PROX_ICA_MULTI, PSED, "R Prox ICA", PsEdInfo, NULL},
{VS_L_DIST_LSV, VS_L_DIST_LSV_MULTI, PSED, "L Dist LSV", PsEdInfo, NULL},
{VS_R_DIST_LSV, VS_R_DIST_LSV_MULTI, PSED, "R Dist LSV", PsEdInfo, NULL},
{VS_L_MID_LSV, VS_L_MID_LSV_MULTI, PSED, "L Mid LSV", PsEdInfo, NULL},
{VS_R_MID_LSV, VS_R_MID_LSV_MULTI, PSED, "R Mid LSV", PsEdInfo, NULL},
{VS_L_PROX_LSV, VS_L_PROX_LSV_MULTI, PSED, "L Prox LSV", PsEdInfo, NULL},
{VS_R_PROX_LSV, VS_R_PROX_LSV_MULTI, PSED, "R Prox LSV", PsEdInfo, NULL},
{VS_L_DIST_CEPH_V, VS_L_DIST_CEPH_V_MULTI, PSED, "L Dist Ceph V", PsEdInfo, NULL},
{VS_R_DIST_CEPH_V, VS_R_DIST_CEPH_V_MULTI, PSED, "R Dist Ceph V", PsEdInfo, NULL},
{VS_L_MID_CEPH_V, VS_L_MID_CEPH_V_MULTI, PSED, "L Mid Ceph V", PsEdInfo, NULL},
{VS_R_MID_CEPH_V, VS_R_MID_CEPH_V_MULTI, PSED, "R Mid Ceph V", PsEdInfo, NULL},
{VS_L_PROX_CEPH_V, VS_L_PROX_CEPH_V_MULTI, PSED, "L Prox Ceph V", PsEdInfo, NULL},
{VS_R_PROX_CEPH_V, VS_R_PROX_CEPH_V_MULTI, PSED, "R Prox Ceph V", PsEdInfo, NULL},
{VS_L_PROX_ECA, VS_L_PROX_ECA_MULTI, PSED, "L Prox ECA", PsEdInfo, NULL},
{VS_R_PROX_ECA, VS_R_PROX_ECA_MULTI, PSED, "R Prox ECA", PsEdInfo, NULL},
{VS_L_BRACHIOCEPH_A, VS_L_BRACHIOCEPH_A_MULTI, PSED, "L Brachioceph A", PsEdInfo, NULL},
{VS_R_BRACHIOCEPH_A, VS_R_BRACHIOCEPH_A_MULTI, PSED, "R Brachioceph A", PsEdInfo, NULL},
{VS_L_BRACHIOCEPH_V, VS_L_BRACHIOCEPH_V_MULTI, PSED, "L Brachioceph V", PsEdInfo, NULL},
{VS_R_BRACHIOCEPH_V, VS_R_BRACHIOCEPH_V_MULTI, PSED, "R Brachioceph V", PsEdInfo, NULL},
{VS_L_BULB, VS_L_BULB_MULTI, PSED, "L Bulb", PsEdInfo, NULL},
{VS_R_BULB, VS_R_BULB_MULTI, PSED, "R Bulb", PsEdInfo, NULL},
{VS_L_VERTEBRAL_A, VS_L_VERTEBRAL_A_MULTI, PSED, "L Vertebral A", PsEdInfo, NULL},
{VS_R_VERTEBRAL_A, VS_R_VERTEBRAL_A_MULTI, PSED, "R Vertebral A", PsEdInfo, NULL},
{VS_L_IJV, VS_L_IJV_MULTI, PSED, "L IJV", PsEdInfo, NULL},
{VS_R_IJV, VS_R_IJV_MULTI, PSED, "R IJV", PsEdInfo, NULL},
{VS_L_CFA, VS_L_CFA_MULTI, RI, "L CFA", RiInfo, NULL},
{VS_R_CFA, VS_R_CFA_MULTI, RI, "R CFA", RiInfo, NULL},
{VS_L_CFV, VS_L_CFV_MULTI, PSED, "L CFV", PsEdInfo, NULL},
{VS_R_CFV, VS_R_CFV_MULTI, PSED, "R CFV", PsEdInfo, NULL},
{VS_L_COM_ILIAC_A, VS_L_COM_ILIAC_A_MULTI, RI, "L Com Iliac A", RiInfo, NULL},
{VS_R_COM_ILIAC_A, VS_R_COM_ILIAC_A_MULTI, RI, "R Com Iliac A", RiInfo, NULL},
{VS_L_COM_ILIAC_V, VS_L_COM_ILIAC_V_MULTI, PSED, "L Com Iliac V", PsEdInfo, NULL},
{VS_R_COM_ILIAC_V, VS_R_COM_ILIAC_V_MULTI, PSED, "R Com Iliac V", PsEdInfo, NULL},
{VS_L_DIST_ATA, VS_L_DIST_ATA_MULTI, RI, "L Dist ATA", RiInfo, NULL},
{VS_R_DIST_ATA, VS_R_DIST_ATA_MULTI, RI, "R Dist ATA", RiInfo, NULL},
{VS_L_MID_ATA, VS_L_MID_ATA_MULTI, RI, "L Mid ATA", RiInfo, NULL},
{VS_R_MID_ATA, VS_R_MID_ATA_MULTI, RI, "R Mid ATA", RiInfo, NULL},
{VS_L_PROX_ATA, VS_L_PROX_ATA_MULTI, RI, "L Prox ATA", RiInfo, NULL},
{VS_R_PROX_ATA, VS_R_PROX_ATA_MULTI, RI, "R Prox ATA", RiInfo, NULL},
{VS_L_DIST_ATV, VS_L_DIST_ATV_MULTI, PSED, "L Dist ATV", PsEdInfo, NULL},
{VS_R_DIST_ATV, VS_R_DIST_ATV_MULTI, PSED, "R Dist ATV", PsEdInfo, NULL},
{VS_L_MID_ATV, VS_L_MID_ATV_MULTI, PSED, "L Mid ATV", PsEdInfo, NULL},
{VS_R_MID_ATV, VS_R_MID_ATV_MULTI, PSED, "R Mid ATV", PsEdInfo, NULL},
{VS_L_PROX_ATV, VS_L_PROX_ATV_MULTI, PSED, "L Prox ATV", PsEdInfo, NULL},
{VS_R_PROX_ATV, VS_R_PROX_ATV_MULTI, PSED, "R Prox ATV", PsEdInfo, NULL},
{VS_L_DIST_GSV_CALF, VS_L_DIST_GSV_CALF_MULTI, PSED, "L Dist GSV Calf", PsEdInfo, NULL},
{VS_R_DIST_GSV_CALF, VS_R_DIST_GSV_CALF_MULTI, PSED, "R Dist GSV Calf", PsEdInfo, NULL},
{VS_L_MID_GSV_CALF, VS_L_MID_GSV_CALF_MULTI, PSED, "L Mid GSV Calf", PsEdInfo, NULL},
{VS_R_MID_GSV_CALF, VS_R_MID_GSV_CALF_MULTI, PSED, "R Mid GSV Calf", PsEdInfo, NULL},
{VS_L_PROX_GSV_CALF, VS_L_PROX_GSV_CALF_MULTI, PSED, "L Prox GSV Calf", PsEdInfo, NULL},
{VS_R_PROX_GSV_CALF, VS_R_PROX_GSV_CALF_MULTI, PSED, "R Prox GSV Calf", PsEdInfo, NULL},
{VS_L_DIST_GSV_THIGH, VS_L_DIST_GSV_THIGH_MULTI, PSED, "L Dist GSV Thigh", PsEdInfo, NULL},
{VS_R_DIST_GSV_THIGH, VS_R_DIST_GSV_THIGH_MULTI, PSED, "R Dist GSV Thigh", PsEdInfo, NULL},
{VS_L_MID_GSV_THIGH, VS_L_MID_GSV_THIGH_MULTI, PSED, "L Mid GSV Thigh", PsEdInfo, NULL},
{VS_R_MID_GSV_THIGH, VS_R_MID_GSV_THIGH_MULTI, PSED, "R Mid GSV Thigh", PsEdInfo, NULL},
{VS_L_PROX_GSV_THIGH, VS_L_PROX_GSV_THIGH_MULTI, PSED, "L Prox GSV Thigh", PsEdInfo, NULL},
{VS_R_PROX_GSV_THIGH, VS_R_PROX_GSV_THIGH_MULTI, PSED, "R Prox GSV Thigh", PsEdInfo, NULL},
{VS_L_DIST_PERO_A, VS_L_DIST_PERO_A_MULTI, RI, "L Dist Pero A", RiInfo, NULL},
{VS_R_DIST_PERO_A, VS_R_DIST_PERO_A_MULTI, RI, "R Dist Pero A", RiInfo, NULL},
{VS_L_MID_PERO_A, VS_L_MID_PERO_A_MULTI, RI, "L Mid Pero A", RiInfo, NULL},
{VS_R_MID_PERO_A, VS_R_MID_PERO_A_MULTI, RI, "R Mid Pero A", RiInfo, NULL},
{VS_L_PROX_PERO_A, VS_L_PROX_PERO_A_MULTI, RI, "L Prox Pero A", RiInfo, NULL},
{VS_R_PROX_PERO_A, VS_R_PROX_PERO_A_MULTI, RI, "R Prox Pero A", RiInfo, NULL},
{VS_L_DIST_PERO_V, VS_L_DIST_PERO_V_MULTI, PSED, "L Dist Pero V", PsEdInfo, NULL},
{VS_R_DIST_PERO_V, VS_R_DIST_PERO_V_MULTI, PSED, "R Dist Pero V", PsEdInfo, NULL},
{VS_L_MID_PERO_V, VS_L_MID_PERO_V_MULTI, PSED, "L Mid Pero V", PsEdInfo, NULL},
{VS_R_MID_PERO_V, VS_R_MID_PERO_V_MULTI, PSED, "R Mid Pero V", PsEdInfo, NULL},
{VS_L_PROX_PERO_V, VS_L_PROX_PERO_V_MULTI, PSED, "L Prox Pero V", PsEdInfo, NULL},
{VS_R_PROX_PERO_V, VS_R_PROX_PERO_V_MULTI, PSED, "R Prox Pero V", PsEdInfo, NULL},
{VS_L_DIST_POP_A, VS_L_DIST_POP_A_MULTI, RI, "L Dist Pop A", RiInfo, NULL},
{VS_R_DIST_POP_A, VS_R_DIST_POP_A_MULTI, RI, "R Dist Pop A", RiInfo, NULL},
{VS_L_MID_POP_A, VS_L_MID_POP_A_MULTI, RI, "L Mid Pop A", RiInfo, NULL},
{VS_R_MID_POP_A, VS_R_MID_POP_A_MULTI, RI, "R Mid Pop A", RiInfo, NULL},
{VS_L_PROX_POP_A, VS_L_PROX_POP_A_MULTI, RI, "L Prox Pop A", RiInfo, NULL},
{VS_R_PROX_POP_A, VS_R_PROX_POP_A_MULTI, RI, "R Prox Pop A", RiInfo, NULL},
{VS_L_DIST_POP_V, VS_L_DIST_POP_V_MULTI, PSED, "L Dist Pop V", PsEdInfo, NULL},
{VS_R_DIST_POP_V, VS_R_DIST_POP_V_MULTI, PSED, "R Dist Pop V", PsEdInfo, NULL},
{VS_L_MID_POP_V, VS_L_MID_POP_V_MULTI, PSED, "L Mid Pop V", PsEdInfo, NULL},
{VS_R_MID_POP_V, VS_R_MID_POP_V_MULTI, PSED, "R Mid Pop V", PsEdInfo, NULL},
{VS_L_PROX_POP_V, VS_L_PROX_POP_V_MULTI, PSED, "L Prox Pop V", PsEdInfo, NULL},
{VS_R_PROX_POP_V, VS_R_PROX_POP_V_MULTI, PSED, "R Prox Pop V", PsEdInfo, NULL},
{VS_L_DIST_PTA, VS_L_DIST_PTA_MULTI, RI, "L Dist PTA", RiInfo, NULL},
{VS_R_DIST_PTA, VS_R_DIST_PTA_MULTI, RI, "R Dist PTA", RiInfo, NULL},
{VS_L_MID_PTA, VS_L_MID_PTA_MULTI, RI, "L Mid PTA", RiInfo, NULL},
{VS_R_MID_PTA, VS_R_MID_PTA_MULTI, RI, "R Mid PTA", RiInfo, NULL},
{VS_L_PROX_PTA, VS_L_PROX_PTA_MULTI, RI, "L Prox PTA", RiInfo, NULL},
{VS_R_PROX_PTA, VS_R_PROX_PTA_MULTI, RI, "R Prox PTA", RiInfo, NULL},
{VS_L_DIST_PTV, VS_L_DIST_PTV_MULTI, PSED, "L Dist PTV", PsEdInfo, NULL},
{VS_R_DIST_PTV, VS_R_DIST_PTV_MULTI, PSED, "R Dist PTV", PsEdInfo, NULL},
{VS_L_MID_PTV, VS_L_MID_PTV_MULTI, PSED, "L Mid PTV", PsEdInfo, NULL},
{VS_R_MID_PTV, VS_R_MID_PTV_MULTI, PSED, "R Mid PTV", PsEdInfo, NULL},
{VS_L_PROX_PTV, VS_L_PROX_PTV_MULTI, PSED, "L Prox PTV", PsEdInfo, NULL},
{VS_R_PROX_PTV, VS_R_PROX_PTV_MULTI, PSED, "R Prox PTV", PsEdInfo, NULL},
{VS_L_DIST_SFA, VS_L_DIST_SFA_MULTI, RI, "L Dist SFA", RiInfo, NULL},
{VS_R_DIST_SFA, VS_R_DIST_SFA_MULTI, RI, "R Dist SFA", RiInfo, NULL},
{VS_L_MID_SFA, VS_L_MID_SFA_MULTI, RI, "L Mid SFA", RiInfo, NULL},
{VS_R_MID_SFA, VS_R_MID_SFA_MULTI, RI, "R Mid SFA", RiInfo, NULL},
{VS_L_PROX_SFA, VS_L_PROX_SFA_MULTI, RI, "L Prox SFA", RiInfo, NULL},
{VS_R_PROX_SFA, VS_R_PROX_SFA_MULTI, RI, "R Prox SFA", RiInfo, NULL},
{VS_L_DIST_SFV, VS_L_DIST_SFV_MULTI, PSED, "L Dist SFV", PsEdInfo, NULL},
{VS_R_DIST_SFV, VS_R_DIST_SFV_MULTI, PSED, "R Dist SFV", PsEdInfo, NULL},
{VS_L_MID_SFV, VS_L_MID_SFV_MULTI, PSED, "L Mid SFV", PsEdInfo, NULL},
{VS_R_MID_SFV, VS_R_MID_SFV_MULTI, PSED, "R Mid SFV", PsEdInfo, NULL},
{VS_L_PROX_SFV, VS_L_PROX_SFV_MULTI, PSED, "L Prox SFV", PsEdInfo, NULL},
{VS_R_PROX_SFV, VS_R_PROX_SFV_MULTI, PSED, "R Prox SFV", PsEdInfo, NULL},
{VS_L_DOR_PEDIS, VS_L_DOR_PEDIS_MULTI, RI, "L Dor Pedis", RiInfo, NULL},
{VS_R_DOR_PEDIS, VS_R_DOR_PEDIS_MULTI, RI, "R Dor Pedis", RiInfo, NULL},
{VS_L_EXT_ILIAC_A, VS_L_EXT_ILIAC_A_MULTI, RI, "L Ext Iliac A", RiInfo, NULL},
{VS_R_EXT_ILIAC_A, VS_R_EXT_ILIAC_A_MULTI, RI, "R Ext Iliac A", RiInfo, NULL},
{VS_L_EXT_ILIAC_V, VS_L_EXT_ILIAC_V_MULTI, PSED, "L Ext Iliac V", PsEdInfo, NULL},
{VS_R_EXT_ILIAC_V, VS_R_EXT_ILIAC_V_MULTI, PSED, "R Ext Iliac V", PsEdInfo, NULL},
{VS_L_INT_ILIAC_A, VS_L_INT_ILIAC_A_MULTI, RI, "L Int Iliac A", RiInfo, NULL},
{VS_R_INT_ILIAC_A, VS_R_INT_ILIAC_A_MULTI, RI, "R Int Iliac A", RiInfo, NULL},
{VS_L_INT_ILIAC_V, VS_L_INT_ILIAC_V_MULTI, PSED, "L Int Iliac V", PsEdInfo, NULL},
{VS_R_INT_ILIAC_V, VS_R_INT_ILIAC_V_MULTI, PSED, "R Int Iliac V", PsEdInfo, NULL},
{VS_L_LAT_SURAL_V, VS_L_LAT_SURAL_V_MULTI, PSED, "L Lat Sural V", PsEdInfo, NULL},
{VS_R_LAT_SURAL_V, VS_R_LAT_SURAL_V_MULTI, PSED, "R Lat Sural V", PsEdInfo, NULL},
{VS_L_PROX_PFA, VS_L_PROX_PFA_MULTI, RI, "L Prox PFA", RiInfo, NULL},
{VS_R_PROX_PFA, VS_R_PROX_PFA_MULTI, RI, "R Prox PFA", RiInfo, NULL},
{VS_L_SFJ, VS_L_SFJ_MULTI, PSED, "L SFJ", PsEdInfo, NULL},
{VS_R_SFJ, VS_R_SFJ_MULTI, PSED, "R SFJ", PsEdInfo, NULL},
{VS_L_ANTECUBE, VS_L_ANTECUBE_MULTI, RI, "L Antecube", RiInfo, NULL},
{VS_R_ANTECUBE, VS_R_ANTECUBE_MULTI, RI, "R Antecube", RiInfo, NULL},
{VS_L_AX_A, VS_L_AX_A_MULTI, RI, "L Ax A", RiInfo, NULL},
{VS_R_AX_A, VS_R_AX_A_MULTI, RI, "R Ax A", RiInfo, NULL},
{VS_L_AX_V, VS_L_AX_V_MULTI, PSED, "L Ax V", PsEdInfo, NULL},
{VS_R_AX_V, VS_R_AX_V_MULTI, PSED, "R Ax V", PsEdInfo, NULL},
{VS_L_DIST_BASILIC_V, VS_L_DIST_BASILIC_V_MULTI, PSED, "L Dist Basilic V", PsEdInfo, NULL},
{VS_R_DIST_BASILIC_V, VS_R_DIST_BASILIC_V_MULTI, PSED, "R Dist Basilic V", PsEdInfo, NULL},
{VS_L_MID_BASILIC_V, VS_L_MID_BASILIC_V_MULTI, PSED, "L Mid Basilic V", PsEdInfo, NULL},
{VS_R_MID_BASILIC_V, VS_R_MID_BASILIC_V_MULTI, PSED, "R Mid Basilic V", PsEdInfo, NULL},
{VS_L_PROX_BASILIC_V, VS_L_PROX_BASILIC_V_MULTI, PSED, "L Prox Basilic V", PsEdInfo, NULL},
{VS_R_PROX_BASILIC_V, VS_R_PROX_BASILIC_V_MULTI, PSED, "R Prox Basilic V", PsEdInfo, NULL},
{VS_L_DIST_BRACH_A, VS_L_DIST_BRACH_A_MULTI, RI, "L Dist Brach A", RiInfo, NULL},
{VS_R_DIST_BRACH_A, VS_R_DIST_BRACH_A_MULTI, RI, "R Dist Brach A", RiInfo, NULL},
{VS_L_PROX_BRACH_A, VS_L_PROX_BRACH_A_MULTI, RI, "L Prox Brach A", RiInfo, NULL},
{VS_R_PROX_BRACH_A, VS_R_PROX_BRACH_A_MULTI, RI, "R Prox Brach A", RiInfo, NULL},
{VS_L_DIST_BRACH_V, VS_L_DIST_BRACH_V_MULTI, RI, "L Dist Brach V", RiInfo, NULL},
{VS_R_DIST_BRACH_V, VS_R_DIST_BRACH_V_MULTI, RI, "R Dist Brach V", RiInfo, NULL},
{VS_L_PROX_BRACH_V, VS_L_PROX_BRACH_V_MULTI, RI, "L Prox Brach V", RiInfo, NULL},
{VS_R_PROX_BRACH_V, VS_R_PROX_BRACH_V_MULTI, RI, "R Prox Brach V", RiInfo, NULL},
{VS_L_DIST_RAD_A, VS_L_DIST_RAD_A_MULTI, RI, "L Dist Rad A", RiInfo, NULL},
{VS_R_DIST_RAD_A, VS_R_DIST_RAD_A_MULTI, RI, "R Dist Rad A", RiInfo, NULL},
{VS_L_MID_RAD_A, VS_L_MID_RAD_A_MULTI, RI, "L Mid Rad A", RiInfo, NULL},
{VS_R_MID_RAD_A, VS_R_MID_RAD_A_MULTI, RI, "R Mid Rad A", RiInfo, NULL},
{VS_L_PROX_RAD_A, VS_L_PROX_RAD_A_MULTI, RI, "L Prox Rad A", RiInfo, NULL},
{VS_R_PROX_RAD_A, VS_R_PROX_RAD_A_MULTI, RI, "R Prox Rad A", RiInfo, NULL},
{VS_L_DIST_RAD_V, VS_L_DIST_RAD_V_MULTI, PSED, "L Dist Rad V", PsEdInfo, NULL},
{VS_R_DIST_RAD_V, VS_R_DIST_RAD_V_MULTI, PSED, "R Dist Rad V", PsEdInfo, NULL},
{VS_L_MID_RAD_V, VS_L_MID_RAD_V_MULTI, PSED, "L Mid Rad V", PsEdInfo, NULL},
{VS_R_MID_RAD_V, VS_R_MID_RAD_V_MULTI, PSED, "R Mid Rad V", PsEdInfo, NULL},
{VS_L_PROX_RAD_V, VS_L_PROX_RAD_V_MULTI, PSED, "L Prox Rad V", PsEdInfo, NULL},
{VS_R_PROX_RAD_V, VS_R_PROX_RAD_V_MULTI, PSED, "R Prox Rad V", PsEdInfo, NULL},
{VS_L_DIST_ULNAR_A, VS_L_DIST_ULNAR_A_MULTI, RI, "L Dist Ulnar A", RiInfo, NULL},
{VS_R_DIST_ULNAR_A, VS_R_DIST_ULNAR_A_MULTI, RI, "R Dist Ulnar A", RiInfo, NULL},
{VS_L_MID_ULNAR_A, VS_L_MID_ULNAR_A_MULTI, RI, "L Mid Ulnar A", RiInfo, NULL},
{VS_R_MID_ULNAR_A, VS_R_MID_ULNAR_A_MULTI, RI, "R Mid Ulnar A", RiInfo, NULL},
{VS_L_PROX_ULNAR_A, VS_L_PROX_ULNAR_A_MULTI, RI, "L Prox Ulnar A", RiInfo, NULL},
{VS_R_PROX_ULNAR_A, VS_R_PROX_ULNAR_A_MULTI, RI, "R Prox Ulnar A", RiInfo, NULL},
{VS_L_DIST_ULNAR_V, VS_L_DIST_ULNAR_V_MULTI, PSED, "L Dist Ulnar V", PsEdInfo, NULL},
{VS_R_DIST_ULNAR_V, VS_R_DIST_ULNAR_V_MULTI, PSED, "R Dist Ulnar V", PsEdInfo, NULL},
{VS_L_MID_ULNAR_V, VS_L_MID_ULNAR_V_MULTI, PSED, "L Mid Ulnar V", PsEdInfo, NULL},
{VS_R_MID_ULNAR_V, VS_R_MID_ULNAR_V_MULTI, PSED, "R Mid Ulnar V", PsEdInfo, NULL},
{VS_L_PROX_ULNAR_V, VS_L_PROX_ULNAR_V_MULTI, PSED, "L Prox Ulnar V", PsEdInfo, NULL},
{VS_R_PROX_ULNAR_V, VS_R_PROX_ULNAR_V_MULTI, PSED, "R Prox Ulnar V", PsEdInfo, NULL},
{VS_L_MID_SCL_A, VS_L_MID_SCL_A_MULTI, PSED, "L Mid SCL A", PsEdInfo, NULL},
{VS_R_MID_SCL_A, VS_R_MID_SCL_A_MULTI, PSED, "R Mid SCL A", PsEdInfo, NULL},
{VS_L_PROX_SCL_A, VS_L_PROX_SCL_A_MULTI, PSED, "L Prox SCL A", PsEdInfo, NULL},
{VS_R_PROX_SCL_A, VS_R_PROX_SCL_A_MULTI, PSED, "R Prox SCL A", PsEdInfo, NULL},
{VS_L_MID_SCL_V, VS_L_MID_SCL_V_MULTI, PSED, "L Mid SCL V", PsEdInfo, NULL},
{VS_R_MID_SCL_V, VS_R_MID_SCL_V_MULTI, PSED, "R Mid SCL V", PsEdInfo, NULL},
{VS_L_PROX_SCL_V, VS_L_PROX_SCL_V_MULTI, PSED, "L Prox SCL V", PsEdInfo, NULL},
{VS_R_PROX_SCL_V, VS_R_PROX_SCL_V_MULTI, PSED, "R Prox SCL V", PsEdInfo, NULL},
};
/******************************TCD Measure*************************/
const SingleItemInfo TCDInfo[] = {
{TCD_L_ACA, SD, N_("L ACA"), TCD_L_ACA_MULTI, NULL},
{TCD_R_ACA, SD, N_("R ACA"), TCD_R_ACA_MULTI, NULL},
{TCD_L_VERTEBRAL_A, SD, N_("L Vertebral A"), TCD_L_VERTEBRAL_A_MULTI, NULL},
{TCD_R_VERTEBRAL_A, SD, N_("R Vertebral A"), TCD_R_VERTEBRAL_A_MULTI, NULL},
{TCD_L_MCA, SD, N_("L MCA"), TCD_L_MCA_MULTI, NULL},
{TCD_R_MCA, SD, N_("R MCA"), TCD_R_MCA_MULTI, NULL},
{TCD_L_PCA, SD, N_("L PCA"), TCD_L_PCA_MULTI, NULL},
{TCD_R_PCA, SD, N_("R PCA"), TCD_R_PCA_MULTI, NULL},
{TCD_BASILAR_A, SD, N_("Basilar A"), TCD_BASILAR_A_MULTI, NULL},
};
const MultiItemInfo TCDMultiInfo[] = {
{TCD_L_ACA, TCD_L_ACA_MULTI, SD, "L ACA", SdInfo, NULL},
{TCD_R_ACA, TCD_R_ACA_MULTI, SD, "R ACA", SdInfo, NULL},
{TCD_L_VERTEBRAL_A, TCD_L_VERTEBRAL_A_MULTI, SD, "L Vertebral A", SdInfo, NULL},
{TCD_R_VERTEBRAL_A, TCD_R_VERTEBRAL_A_MULTI, SD, "R Vertebral A", SdInfo, NULL},
{TCD_L_MCA, TCD_L_MCA_MULTI, SD, "L MCA", SdInfo, NULL},
{TCD_R_MCA, TCD_R_MCA_MULTI, SD, "R MCA", SdInfo, NULL},
{TCD_L_PCA, TCD_L_PCA_MULTI, SD, "L PCA", SdInfo, NULL},
{TCD_R_PCA, TCD_R_PCA_MULTI, SD, "R PCA", SdInfo, NULL},
{TCD_BASILAR_A, TCD_BASILAR_A_MULTI, SD, "Basilar A", SdInfo, NULL},
};
/******************************Ortho Measure*************************/
const SingleItemInfo OrthoInfo[] = {
{ORTHO_LT_HIP, HIP, N_("L Hip"), ORTHO_LT_HIP_MULTI, NULL},
{ORTHO_RT_HIP, HIP, N_("R Hip"), ORTHO_RT_HIP_MULTI, NULL},
};
const MultiItemInfo OrthoMultiInfo[] = {
{ORTHO_LT_HIP, ORTHO_LT_HIP_MULTI, HIP, "L Hip", HipInfo, NULL},
{ORTHO_RT_HIP, ORTHO_RT_HIP_MULTI, HIP, "R Hip", HipInfo, NULL},
};
#ifdef VET
/*
const SingleItemInfo TDInfo[] = {
{TD_LESION1_AREA, AREA_TRACK, N_("Lesion 1"), TD_LESION1_AREA_MULTI, NULL},
{TD_LESION2_AREA, AREA_TRACK, N_("Lesion 2"), TD_LESION2_AREA_MULTI, NULL},
{TD_LESION3_AREA, AREA_TRACK, N_("Lesion 3"), TD_LESION3_AREA_MULTI, NULL},
{TD_LESION4_AREA, AREA_TRACK, N_("Lesion 4"), TD_LESION4_AREA_MULTI, NULL},
{TD_LESION5_AREA, AREA_TRACK, N_("Lesion 5"), TD_LESION5_AREA_MULTI, NULL},
{TD_LESION6_AREA, AREA_TRACK, N_("Lesion 6"), TD_LESION6_AREA_MULTI, NULL},
{TD_LESION7_AREA, AREA_TRACK, N_("Lesion 7"), TD_LESION7_AREA_MULTI, NULL},
{TD_LESION8_AREA, AREA_TRACK, N_("Lesion 8"), TD_LESION8_AREA_MULTI, NULL},
{TD_LESION9_AREA, AREA_TRACK, N_("Lesion 9"), TD_LESION9_AREA_MULTI, NULL},
{TD_LESION10_AREA, AREA_TRACK, N_("Lesion 10"), TD_LESION10_AREA_MULTI, NULL},
};
*/
const SingleItemInfo TDInfo[] = {
//Lesion1
{TD_LES1_AREA, AREA_TRACK, N_("Lesion1 Area"), CM2, NULL},
{TD_LES1_AREA1, AREA_TRACK, N_("Lesion1 Area 1"), CM2, NULL},
{TD_LES1_AREA2, AREA_TRACK, N_("Lesion1 Area 2"), CM2, NULL},
{TD_LES1_AREA3, AREA_TRACK, N_("Lesion1 Area 3"), CM2, NULL},
//Lesion2
{TD_LES2_AREA, AREA_TRACK, N_("Lesion2 Area"), CM2, NULL},
{TD_LES2_AREA1, AREA_TRACK, N_("Lesion2 Area 1"), CM2, NULL},
{TD_LES2_AREA2, AREA_TRACK, N_("Lesion2 Area 2"), CM2, NULL},
{TD_LES2_AREA3, AREA_TRACK, N_("Lesion2 Area 3"), CM2, NULL},
//Lesion3
{TD_LES3_AREA, AREA_TRACK, N_("Lesion3 Area"), CM2, NULL},
{TD_LES3_AREA1, AREA_TRACK, N_("Lesion3 Area 1"), CM2, NULL},
{TD_LES3_AREA2, AREA_TRACK, N_("Lesion3 Area 2"), CM2, NULL},
{TD_LES3_AREA3, AREA_TRACK, N_("Lesion3 Area 3"), CM2, NULL},
//Lesion4
{TD_LES4_AREA, AREA_TRACK, N_("Lesion4 Area"), CM2, NULL},
{TD_LES4_AREA1, AREA_TRACK, N_("Lesion4 Area 1"), CM2, NULL},
{TD_LES4_AREA2, AREA_TRACK, N_("Lesion4 Area 2"), CM2, NULL},
{TD_LES4_AREA3, AREA_TRACK, N_("Lesion4 Area 3"), CM2, NULL},
//Lesion5
{TD_LES5_AREA, AREA_TRACK, N_("Lesion5 Area"), CM2, NULL},
{TD_LES5_AREA1, AREA_TRACK, N_("Lesion5 Area 1"), CM2, NULL},
{TD_LES5_AREA2, AREA_TRACK, N_("Lesion5 Area 2"), CM2, NULL},
{TD_LES5_AREA3, AREA_TRACK, N_("Lesion5 Area 3"), CM2, NULL},
//Lesion6
{TD_LES6_AREA, AREA_TRACK, N_("Lesion6 Area"), CM2, NULL},
{TD_LES6_AREA1, AREA_TRACK, N_("Lesion6 Area 1"), CM2, NULL},
{TD_LES6_AREA2, AREA_TRACK, N_("Lesion6 Area 2"), CM2, NULL},
{TD_LES6_AREA3, AREA_TRACK, N_("Lesion6 Area 3"), CM2, NULL},
//Lesion7
{TD_LES7_AREA, AREA_TRACK, N_("Lesion7 Area"), CM2, NULL},
{TD_LES7_AREA1, AREA_TRACK, N_("Lesion7 Area 1"), CM2, NULL},
{TD_LES7_AREA2, AREA_TRACK, N_("Lesion7 Area 2"), CM2, NULL},
{TD_LES7_AREA3, AREA_TRACK, N_("Lesion7 Area 3"), CM2, NULL},
//Lesion8
{TD_LES8_AREA, AREA_TRACK, N_("Lesion8 Area"), CM2, NULL},
{TD_LES8_AREA1, AREA_TRACK, N_("Lesion8 Area 1"), CM2, NULL},
{TD_LES8_AREA2, AREA_TRACK, N_("Lesion8 Area 2"), CM2, NULL},
{TD_LES8_AREA3, AREA_TRACK, N_("Lesion8 Area 3"), CM2, NULL},
//Lesion9
{TD_LES9_AREA, AREA_TRACK, N_("Lesion9 Area"), CM2, NULL},
{TD_LES9_AREA1, AREA_TRACK, N_("Lesion9 Area 1"), CM2, NULL},
{TD_LES9_AREA2, AREA_TRACK, N_("Lesion9 Area 2"), CM2, NULL},
{TD_LES9_AREA3, AREA_TRACK, N_("Lesion9 Area 3"), CM2, NULL},
//Lesion10
{TD_LES10_AREA, AREA_TRACK, N_("Lesion10 Area"), CM2, NULL},
{TD_LES10_AREA1, AREA_TRACK, N_("Lesion10 Area 1"), CM2, NULL},
{TD_LES10_AREA2, AREA_TRACK, N_("Lesion10 Area 2"), CM2, NULL},
{TD_LES10_AREA3, AREA_TRACK, N_("Lesion10 Area 3"), CM2, NULL},
//Lesion11
{TD_LES11_AREA, AREA_TRACK, N_("Lesion11 Area"), CM2, NULL},
{TD_LES11_AREA1, AREA_TRACK, N_("Lesion11 Area 1"), CM2, NULL},
{TD_LES11_AREA2, AREA_TRACK, N_("Lesion11 Area 2"), CM2, NULL},
{TD_LES11_AREA3, AREA_TRACK, N_("Lesion11 Area 3"), CM2, NULL},
};
const MultiItemInfo TDMultiInfo[] = {
/*
{TD_AREA_RATIO1, TD_LESION1_AREA_MULTI, AREA_TRACK, "Lesion 1", AreaInfo, NULL},
{TD_AREA_RATIO2, TD_LESION2_AREA_MULTI, AREA_TRACK, "Lesion 2", AreaInfo, NULL},
{TD_AREA_RATIO3, TD_LESION3_AREA_MULTI, AREA_TRACK, "Lesion 3", AreaInfo, NULL},
{TD_AREA_RATIO4, TD_LESION4_AREA_MULTI, AREA_TRACK, "Lesion 4", AreaInfo, NULL},
{TD_AREA_RATIO5, TD_LESION5_AREA_MULTI, AREA_TRACK, "Lesion 5", AreaInfo, NULL},
{TD_AREA_RATIO6, TD_LESION6_AREA_MULTI, AREA_TRACK, "Lesion 6", AreaInfo, NULL},
{TD_AREA_RATIO7, TD_LESION7_AREA_MULTI, AREA_TRACK, "Lesion 7", AreaInfo, NULL},
{TD_AREA_RATIO8, TD_LESION8_AREA_MULTI, AREA_TRACK, "Lesion 8", AreaInfo, NULL},
{TD_AREA_RATIO9, TD_LESION9_AREA_MULTI, AREA_TRACK, "Lesion 9", AreaInfo, NULL},
{TD_AREA_RATIO10, TD_LESION10_AREA_MULTI, AREA_TRACK, "Lesion 10", AreaInfo, NULL},
{TD_AREA_RATIO11, TD_LESION11_AREA_MULTI, AREA_TRACK, "Lesion 11", AreaInfo, NULL},
*/
};
//添加 动物超 产科
//hlx 1.11
const CalcResultInfo AnOBDogGSDGW = {ANOB_DOG_GSD_GW, {ANOB_DOG_GSD, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "GW", NOUNIT, MeaCalcFun::CalcGWManVet, NULL};
const CalcResultInfo AnOBDogGSDEDCB = {ANOB_DOG_GSD_EDCB, {ANOB_DOG_GSD, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "EDD", NOUNIT, MeaCalcFun::EDCBCalc, NULL};
const CalcResultInfo AnOBDogCRLGW = {ANOB_DOG_CRL_GW, {ANOB_DOG_CRL, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "GW", NOUNIT, MeaCalcFun::CalcGWManVet, NULL};
const CalcResultInfo AnOBDogCRLEDCB = {ANOB_DOG_CRL_EDCB, {ANOB_DOG_CRL, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "EDD", NOUNIT, MeaCalcFun::EDCBCalc, NULL};
const CalcResultInfo AnOBDogHDGW = {ANOB_DOG_HD_GW, {ANOB_DOG_HD, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "GW", NOUNIT, MeaCalcFun::CalcGWManVet,NULL};
const CalcResultInfo AnOBDogHDEDCB = {ANOB_DOG_HD_EDCB, {ANOB_DOG_HD, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "EDD", NOUNIT, MeaCalcFun::EDCBCalc, NULL};
const CalcResultInfo AnOBDogBDGW = {ANOB_DOG_BD_GW, {ANOB_DOG_BD, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "GW", NOUNIT, MeaCalcFun::CalcGWManVet,NULL};
const CalcResultInfo AnOBDogBDEDCB = {ANOB_DOG_BD_EDCB, {ANOB_DOG_BD, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "EDD", NOUNIT, MeaCalcFun::EDCBCalc, NULL};
//Cat
const CalcResultInfo AnOBCatHDGW = {ANOB_CAT_HD_GW, {ANOB_CAT_HD, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "GW", NOUNIT, MeaCalcFun::CalcGWManVet, NULL};
const CalcResultInfo AnOBCatBDGW = {ANOB_CAT_BD_GW, {ANOB_CAT_BD, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "GW", NOUNIT, MeaCalcFun::CalcGWManVet, NULL};
const CalcResultInfo AnOBCatHDEDCB = {ANOB_CAT_HD_EDCB, {ANOB_CAT_HD, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "EDD", NOUNIT, MeaCalcFun::EDCBCalc, NULL};
const CalcResultInfo AnOBCatBDEDCB = {ANOB_CAT_BD_EDCB, {ANOB_CAT_BD, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "EDD", NOUNIT, MeaCalcFun::EDCBCalc, NULL};
//sheep
const CalcResultInfo AnOBSheepCRLGW = {ANOB_SHEEP_CRL_GW, {ANOB_SHEEP_CRL, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "GW", NOUNIT, MeaCalcFun::CalcGWManVet, NULL};
const CalcResultInfo AnOBSheepCRLEDCB = {ANOB_SHEEP_CRL_EDCB, {ANOB_SHEEP_CRL, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "EDD", NOUNIT, MeaCalcFun::EDCBCalc, NULL};
//swine
const CalcResultInfo AnOBSwineHLGW = {ANOB_SWINE_HL_GW, {ANOB_SWINE_HL, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "GW", NOUNIT, MeaCalcFun::CalcGWManVet, NULL};
const CalcResultInfo AnOBSwineHLEDCB = {ANOB_SWINE_HL_EDCB, {ANOB_SWINE_HL, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "EDD", NOUNIT, MeaCalcFun::EDCBCalc, NULL};
const CalcResultInfo AnOBSwineSLGW = {ANOB_SWINE_SL_GW, {ANOB_SWINE_SL, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "GW", NOUNIT, MeaCalcFun::CalcGWManVet, NULL};
const CalcResultInfo AnOBSwineSLEDCB = {ANOB_SWINE_SL_EDCB, {ANOB_SWINE_SL, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "EDD", NOUNIT, MeaCalcFun::EDCBCalc, NULL};
//Bovine
const CalcResultInfo AnOBBovineKCRLGW = {ANOB_BOVINE_KCRL_GW, {ANOB_BOVINE_KCRL, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "GW", NOUNIT, MeaCalcFun::CalcGWManVet, NULL};
const CalcResultInfo AnOBBovineKCRLEDCB = {ANOB_BOVINE_KCRL_EDCB, {ANOB_BOVINE_KCRL, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "EDD", NOUNIT, MeaCalcFun::EDCBCalc, NULL};
const CalcResultInfo AnOBBovineWCRLGW = {ANOB_BOVINE_WCRL_GW, {ANOB_BOVINE_WCRL, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "GW", NOUNIT, MeaCalcFun::CalcGWManVet, NULL};
const CalcResultInfo AnOBBovineWCRLEDCB = {ANOB_BOVINE_WCRL_EDCB, {ANOB_BOVINE_WCRL, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "EDD", NOUNIT, MeaCalcFun::EDCBCalc, NULL};
const CalcResultInfo AnOBBovineHCRLGW = {ANOB_BOVINE_HCRL_GW, {ANOB_BOVINE_HCRL, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "GW", NOUNIT, MeaCalcFun::CalcGWManVet, NULL};
const CalcResultInfo AnOBBovineHCRLEDCB = {ANOB_BOVINE_HCRL_EDCB, {ANOB_BOVINE_HCRL, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "EDD", NOUNIT, MeaCalcFun::EDCBCalc, NULL};
const CalcResultInfo AnOBBovineBBDGW = {ANOB_BOVINE_BBD_GW, {ANOB_BOVINE_BBD, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "GW", NOUNIT, MeaCalcFun::CalcGWManVet, NULL};
const CalcResultInfo AnOBBovineBBDEDCB = {ANOB_BOVINE_BBD_EDCB, {ANOB_BOVINE_BBD, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "EDD", NOUNIT, MeaCalcFun::EDCBCalc, NULL};
const CalcResultInfo AnOBBovineBTDGW = {ANOB_BOVINE_BTD_GW, {ANOB_BOVINE_BTD, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "GW", NOUNIT, MeaCalcFun::CalcGWManVet, NULL};
const CalcResultInfo AnOBBovineBTDEDCB = {ANOB_BOVINE_BTD_EDCB, {ANOB_BOVINE_BTD, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "EDD", NOUNIT, MeaCalcFun::EDCBCalc, NULL};
const CalcResultInfo AnOBBovineBUDGW = {ANOB_BOVINE_BUD_GW, {ANOB_BOVINE_BUD, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "GW", NOUNIT, MeaCalcFun::CalcGWManVet, NULL};
const CalcResultInfo AnOBBovineBUDEDCB = {ANOB_BOVINE_BUD_EDCB, {ANOB_BOVINE_BUD, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "EDD", NOUNIT, MeaCalcFun::EDCBCalc, NULL};
//Equine
const CalcResultInfo AnOBEquineGSDGW = {ANOB_EQUINE_GSD_GW, {ANOB_EQUINE_GSD,NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "GW", NOUNIT, MeaCalcFun::CalcGWManVet, NULL};
const CalcResultInfo AnOBEquineGSDEDCB = {ANOB_EQUINE_GSD_EDCB, {ANOB_EQUINE_GSD, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "EDD", NOUNIT, MeaCalcFun::EDCBCalc, NULL};
const CalcResultInfo AnOBEquineERDGW = {ANOB_EQUINE_ERD_GW, {ANOB_EQUINE_ERD,NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "GW", NOUNIT, MeaCalcFun::CalcGWManVet, NULL};
const CalcResultInfo AnOBEquineERDEDCB = {ANOB_EQUINE_ERD_EDCB, {ANOB_EQUINE_ERD, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "EDD", NOUNIT, MeaCalcFun::EDCBCalc, NULL};
const CalcResultInfo AnOBEquineESDGW = {ANOB_EQUINE_ESD_GW, {ANOB_EQUINE_ESD,NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "GW", NOUNIT, MeaCalcFun::CalcGWManVet, NULL};
const CalcResultInfo AnOBEquineESDEDCB = {ANOB_EQUINE_ESD_EDCB, {ANOB_EQUINE_ESD, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "EDD", NOUNIT, MeaCalcFun::EDCBCalc, NULL};
const CalcResultInfo AnOBEquineEEDGW = {ANOB_EQUINE_EED_GW, {ANOB_EQUINE_EED,NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "GW", NOUNIT, MeaCalcFun::CalcGWManVet, NULL};
const CalcResultInfo AnOBEquineEEDEDCB = {ANOB_EQUINE_EED_EDCB, {ANOB_EQUINE_EED, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, "EDD", NOUNIT, MeaCalcFun::EDCBCalc, NULL};
const CalcInfoArray AnOBDogGSDCalc = {&AnOBDogGSDGW, &AnOBDogGSDEDCB, NULL};
const CalcInfoArray AnOBDogCRLCalc = {&AnOBDogCRLGW, &AnOBDogCRLEDCB, NULL};
const CalcInfoArray AnOBDogHDCalc = {&AnOBDogHDGW, &AnOBDogHDEDCB, NULL};
const CalcInfoArray AnOBDogBDCalc = {&AnOBDogBDGW, &AnOBDogBDEDCB, NULL};
const CalcInfoArray AnOBCatHDCalc = {&AnOBCatHDGW, &AnOBCatHDEDCB, NULL};
const CalcInfoArray AnOBCatBDCalc = {&AnOBCatBDGW, &AnOBCatBDEDCB, NULL};
const CalcInfoArray AnOBSheepCRLCalc = {&AnOBSheepCRLGW, &AnOBSheepCRLEDCB, NULL};
const CalcInfoArray AnOBSwineHLCalc = {&AnOBSwineHLGW, &AnOBSwineHLEDCB, NULL};
const CalcInfoArray AnOBSwineSLCalc = {&AnOBSwineSLGW, &AnOBSwineSLEDCB, NULL};
const CalcInfoArray AnOBBovineKCRLCalc = {&AnOBBovineKCRLGW, &AnOBBovineKCRLEDCB, NULL};
const CalcInfoArray AnOBBovineWCRLCalc = {&AnOBBovineWCRLGW, &AnOBBovineWCRLEDCB, NULL};
const CalcInfoArray AnOBBovineHCRLCalc = {&AnOBBovineHCRLGW, &AnOBBovineHCRLEDCB, NULL};
const CalcInfoArray AnOBBovineBBDCalc = {&AnOBBovineBBDGW, &AnOBBovineBBDEDCB, NULL};
const CalcInfoArray AnOBBovineBTDCalc = {&AnOBBovineBTDGW, &AnOBBovineBTDEDCB, NULL};
const CalcInfoArray AnOBBovineBUDCalc = {&AnOBBovineBUDGW, &AnOBBovineBUDEDCB, NULL};
const CalcInfoArray AnOBEquineGSDCalc = {&AnOBEquineGSDGW, &AnOBEquineGSDEDCB, NULL};
const CalcInfoArray AnOBEquineERDCalc = {&AnOBEquineERDGW, &AnOBEquineERDEDCB, NULL};
const CalcInfoArray AnOBEquineESDCalc = {&AnOBEquineESDGW, &AnOBEquineESDEDCB, NULL};
const CalcInfoArray AnOBEquineEEDCalc = {&AnOBEquineEEDGW, &AnOBEquineEEDEDCB, NULL};
//hlx 12.28
const PtrOfCalcInfo AnOBCalcInfoPtr[ANOB_CALC_END - ANOB_CALC_START] = {
{ANOB_DOG_GSD_GW, &AnOBDogGSDGW},
{ANOB_DOG_GSD_EDCB, &AnOBDogGSDEDCB},
{ANOB_DOG_CRL_GW, &AnOBDogCRLGW},
{ANOB_DOG_CRL_EDCB, &AnOBDogCRLEDCB},
{ANOB_DOG_HD_GW, &AnOBDogHDGW},
{ANOB_DOG_HD_EDCB, &AnOBDogHDEDCB},
{ANOB_DOG_BD_GW, &AnOBDogBDGW},
{ANOB_DOG_BD_EDCB, &AnOBDogBDEDCB},
{ANOB_CAT_HD_GW, &AnOBCatHDGW},
{ANOB_CAT_HD_EDCB, &AnOBCatHDEDCB},
{ANOB_CAT_BD_GW, &AnOBCatBDGW},
{ANOB_CAT_BD_EDCB, &AnOBCatBDEDCB},
{ANOB_SHEEP_CRL_GW, &AnOBSheepCRLGW},
{ANOB_SHEEP_CRL_EDCB, &AnOBSheepCRLEDCB},
{ANOB_SWINE_SL_GW, &AnOBSwineSLGW},
{ANOB_SWINE_SL_EDCB, &AnOBSwineSLEDCB},
{ANOB_SWINE_HL_GW, &AnOBSwineHLGW},
{ANOB_SWINE_HL_EDCB, &AnOBSwineHLEDCB},
{ANOB_BOVINE_KCRL_GW, &AnOBBovineKCRLGW},
{ANOB_BOVINE_KCRL_EDCB, &AnOBBovineKCRLEDCB},
{ANOB_BOVINE_WCRL_GW, &AnOBBovineWCRLGW},
{ANOB_BOVINE_WCRL_EDCB, &AnOBBovineWCRLEDCB},
{ANOB_BOVINE_HCRL_GW, &AnOBBovineHCRLGW},
{ANOB_BOVINE_HCRL_EDCB, &AnOBBovineHCRLEDCB},
{ANOB_BOVINE_BBD_GW, &AnOBBovineBBDGW},
{ANOB_BOVINE_BBD_EDCB, &AnOBBovineBBDEDCB},
{ANOB_BOVINE_BTD_GW, &AnOBBovineBTDGW},
{ANOB_BOVINE_BTD_EDCB, &AnOBBovineBTDEDCB},
{ANOB_BOVINE_BUD_GW, &AnOBBovineBUDGW},
{ANOB_BOVINE_BUD_EDCB, &AnOBBovineBUDEDCB},
{ANOB_EQUINE_GSD_GW, &AnOBEquineGSDGW},
{ANOB_EQUINE_GSD_EDCB, &AnOBEquineGSDEDCB},
{ANOB_EQUINE_ERD_GW, &AnOBEquineERDGW},
{ANOB_EQUINE_ERD_EDCB, &AnOBEquineERDEDCB},
{ANOB_EQUINE_ESD_GW, &AnOBEquineESDGW},
{ANOB_EQUINE_ESD_EDCB, &AnOBEquineESDEDCB},
{ANOB_EQUINE_EED_GW, &AnOBEquineEEDGW},
{ANOB_EQUINE_EED_EDCB, &AnOBEquineEEDEDCB},
};
//添加 动物超 产科
//hlx 12.23
const SingleItemInfo AnOBInfo[] = {
//dog
{ANOB_DOG_GSD, DIST_DOT, N_("Dog GSD"), CM, &AnOBDogGSDCalc},
{ANOB_DOG_CRL, DIST_DOT, N_("Dog CRL"), CM, &AnOBDogCRLCalc},
{ANOB_DOG_HD, DIST_DOT, N_("Dog HD"), CM, &AnOBDogHDCalc},
{ANOB_DOG_BD, DIST_DOT, N_("Dog BD"), CM, &AnOBDogBDCalc},
//cat
{ANOB_CAT_HD, DIST_DOT, N_("Cat HD"), CM, &AnOBCatHDCalc},
{ANOB_CAT_BD, DIST_DOT, N_("Cat BD"), CM, &AnOBCatBDCalc},
//sheep
{ANOB_SHEEP_CRL, DIST_DOT, N_("Sheep CRL"), CM, &AnOBSheepCRLCalc},
//swine
{ANOB_SWINE_HL, DIST_DOT, N_("Swine HL"), CM, &AnOBSwineHLCalc},
{ANOB_SWINE_SL, DIST_DOT, N_("Swine SL"), CM, &AnOBSwineSLCalc},
//bovine
{ANOB_BOVINE_KCRL, DIST_DOT, N_("Bovine K-CRL"), CM, &AnOBBovineKCRLCalc},
{ANOB_BOVINE_WCRL, DIST_DOT, N_("Bovine W-CRL"), CM, &AnOBBovineWCRLCalc},
{ANOB_BOVINE_HCRL, DIST_DOT, N_("Bovine H-CRL"), CM, &AnOBBovineHCRLCalc},
{ANOB_BOVINE_BBD, DIST_DOT, N_("Bovine BBD"), CM, &AnOBBovineBBDCalc},
{ANOB_BOVINE_BTD, DIST_DOT, N_("Bovine BTD"), CM, &AnOBBovineBTDCalc},
{ANOB_BOVINE_BUD, DIST_DOT, N_("Bovine BUD"), CM, &AnOBBovineBUDCalc},
//equine
{ANOB_EQUINE_GSD, DIST_DOT, N_("Equine GSD"), CM, &AnOBEquineGSDCalc},
{ANOB_EQUINE_ERD, DIST_DOT, N_("Equine ERD"), CM, &AnOBEquineERDCalc},
{ANOB_EQUINE_ESD, DIST_DOT, N_("Equine ESD"), CM, &AnOBEquineESDCalc},
{ANOB_EQUINE_EED, DIST_DOT, N_("Equine EED"), CM, &AnOBEquineEEDCalc}
};
const MultiItemInfo AnOBMultiInfo[] = {
};
#endif
#if 1
/******************************有多种计算方法的计算项**************************************/
//const CalcMultiMethod MethodCalc[] ={
// {ADULT_EDV, {ADULT_EDV_2DCUBED, ADULT_EDV_2DTEICH, ADULT_EDV_MMCUBED, ADULT_EDV_MMTEICH, NO_PAR, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, {&AdultEDV2DCubed, &AdultEDV2DTeich, &AdultEDVMMCubed, &AdultEDVMMTeich, NULL, NULL, NULL, NULL, NULL}},
// {ADULT_ESV, {ADULT_ESV_2DCUBED, ADULT_ESV_2DTEICH, ADULT_ESV_MMCUBED, ADULT_ESV_MMTEICH, NO_PAR, NO_PAR, NO_PAR, NO_PAR, NO_PAR}, {&AdultESV2DCubed, &AdultESV2DTeich, &AdultESVMMCubed, &AdultESVMMTeich, NULL, NULL, NULL, NULL, NULL}},
// {OB_EFW, {OB_EFW_HADLOCK1, OB_EFW_HADLOCK2, OB_EFW_HADLOCK3, OB_EFW_HADLOCK4, OB_EFW_SHEPARD, OB_EFW_HANSMAN, OB_EFW_TOKYO, NO_PAR, NO_PAR}, {&OBEfwHadlock1, &OBEfwHadlock2, &OBEfwHadlock3, &OBEfwHadlock4, &OBEfwShepard, &OBEfwHansmenn, &OBEfwTokyo, NULL, NULL}},
//};
#endif
#endif
|
[
"admin@git.com"
] |
admin@git.com
|
3632fd826b2304cb17f5d94db4f82bedb6de4bce
|
e2e43225e5304a73db68a7da22b1fd89b8ce1b8e
|
/Classdesign/imagedata.h
|
35fb8c83c28cb359c48305821726f9af5fe68235
|
[] |
no_license
|
mitchellmar/Classdesign
|
2b81a10716c8f12e7d97aa67a7f444f3b9c13d53
|
866b84b9b8be34b54d8a75a2d132ca13c59a486d
|
refs/heads/master
| 2023-03-11T07:11:41.886405
| 2021-02-27T04:21:07
| 2021-02-27T04:21:07
| 338,467,708
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,267
|
h
|
#include <string>
class imagedata{
public:
imagedata(std::string filename, std::string imagetype, std::string datecreated
, double size, std::string authname, std::string imgdim, std::string aperture,
std::string exposure, int iso, bool flash);
std::string getfilename() const;
std::string getimagetype() const;
std::string getdatecreated() const;
double getsize() const;
std::string getauthname() const;
std::string getimgdim() const;
std::string getaperature() const;
std::string getexposure() const;
int getiso() const;
bool getflash() const;
void setfilename(std::string newfilename);
void setimagetype(std::string newimagetype);
void setdatecreated(int newday, int newmonth, int newyear);
void setsize(double newsize);
void setauthname(std::string newname);
void setimgdim(int newwidth, int newheight);
void setaperature(int newaperature);
void setexposure(int newexposure);
void setiso(int newiso);
void setflash(bool newflash);
private:
std::string myfilename;
std::string myimagetype;
std::string mydatecreated;
double mysize;
std::string myauthname;
std::string myimgdim;
std::string myaperature;
std::string myexposure;
int myiso;
bool myflash;
};
std::ostream& operator<<(std::ostream& out, const imagedata& param);
|
[
"mitchell_k_mar@yahoo.com"
] |
mitchell_k_mar@yahoo.com
|
de873b857bb92ae239d711a8c6d3e89afc3bcdf2
|
30fc3d57d206018979d23b7284f40b0219c1a84c
|
/extensions/flens/crs.tcc
|
e5cd270259d1777ab9ffa89ec50b0ff3b66fe795
|
[] |
no_license
|
MazenAli/LAWA
|
80b7b0e4b7a7eac8d2a8056284800b017a372c87
|
389362e745c83f647b896b71e749efe1033e092e
|
refs/heads/master
| 2021-01-24T13:14:46.764675
| 2019-04-14T09:57:45
| 2019-04-14T09:57:45
| 40,306,125
| 1
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 16,361
|
tcc
|
/*
* Copyright (c) 2007, Michael Lehn
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1) Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2) Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3) Neither the name of the FLENS development group nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <cassert>
namespace flens {
namespace extensions {
//-- CRS -----------------------------------------------------------------------
// -- constructors -------------------------------------------------------------
template <typename T, CRS_Storage Storage>
CRS<T, Storage>::CRS()
: _numRows(0)
{
}
template <typename T, CRS_Storage Storage>
CRS<T, Storage>::CRS(FLENS_DEFAULT_INDEXTYPE numRows, FLENS_DEFAULT_INDEXTYPE numCols, FLENS_DEFAULT_INDEXTYPE approxBandwidth)
: rows(numRows+1), _numRows(numRows), _numCols(numCols), _k(approxBandwidth)
{
}
template <typename T, CRS_Storage Storage>
CRS<T, Storage>::~CRS()
{
}
// -- operators ----------------------------------------------------------------
template <typename T, CRS_Storage Storage>
CRS<T, Storage> &
CRS<T, Storage>::operator*=(T alpha)
{
values *= alpha;
return *this;
}
template <typename T, CRS_Storage Storage>
CRS<T, Storage> &
CRS<T, Storage>::operator/=(T alpha)
{
values /= alpha;
return *this;
}
// -- methods ------------------------------------------------------------------
template <typename T, CRS_Storage Storage>
typename CRS<T, Storage>::Initializer *
CRS<T, Storage>::initializer()
{
return new Initializer(*this, _k);
}
template <typename T, CRS_Storage Storage>
typename CRS<T, Storage>::Initializer *
CRS<T, Storage>::initializer(Initializer *rhs)
{
return new Initializer(*this, _k, (*rhs)._coordinates,(*rhs)._lastSortedCoord);
}
template <typename T, CRS_Storage Storage>
void
CRS<T, Storage>::allocate(FLENS_DEFAULT_INDEXTYPE numNonZeros)
{
values.engine().resize(numNonZeros);
columns.engine().resize(numNonZeros);
rows(1) = 1;
rows(_numRows+1) = numNonZeros+1;
}
template <typename T, CRS_Storage Storage>
FLENS_DEFAULT_INDEXTYPE
CRS<T, Storage>::numRows() const
{
return _numRows;
}
template <typename T, CRS_Storage Storage>
FLENS_DEFAULT_INDEXTYPE
CRS<T, Storage>::numCols() const
{
return _numCols;
}
template <typename T, CRS_Storage Storage>
FLENS_DEFAULT_INDEXTYPE
CRS<T, Storage>::numNonZeros() const
{
return rows(_numRows+1)-rows(1);
}
template <typename T, CRS_Storage Storage>
typename CRS<T, Storage>::const_iterator
CRS<T, Storage>::begin() const
{
return const_iterator(*this, 1);
}
template <typename T, CRS_Storage Storage>
typename CRS<T, Storage>::iterator
CRS<T, Storage>::begin()
{
return iterator(*this, 1);
}
template <typename T, CRS_Storage Storage>
typename CRS<T, Storage>::const_iterator
CRS<T, Storage>::end() const
{
return const_iterator(*this, numNonZeros()+1);
}
template <typename T, CRS_Storage Storage>
typename CRS<T, Storage>::iterator
CRS<T, Storage>::end()
{
return iterator(*this, numNonZeros()+1);
}
} // namespace extensions
#define CRS extensions::CRS
//-- CRS_Coordinate ------------------------------------------------------------
template <typename T>
CRS_Coordinate<T>::CRS_Coordinate(FLENS_DEFAULT_INDEXTYPE _row, FLENS_DEFAULT_INDEXTYPE _col, T _value)
: row(_row), col(_col), value(_value)
{
}
//-- CRS_CoordinateCmp ---------------------------------------------------------
template <typename T>
bool
CRS_CoordinateCmp::operator()(const CRS_Coordinate<T> &a,
const CRS_Coordinate<T> &b) const
{
if (a.row<b.row) {
return true;
}
if ((a.row==b.row) && (a.col<b.col)) {
return true;
}
return false;
}
//-- CRS_Initializer -----------------------------------------------------------
template <typename T, CRS_Storage Storage>
CRS_Initializer<T, Storage>::CRS_Initializer(CRS<T, Storage> &crs, FLENS_DEFAULT_INDEXTYPE k)
: _coordinates(_tmp_coordinates), _lastSortedCoord(0), _isSorted(true), _crs(crs)
{
_coordinates.reserve(k*crs.numRows());
}
template <typename T, CRS_Storage Storage>
CRS_Initializer<T, Storage>::CRS_Initializer(CRS<T, Storage> &crs, FLENS_DEFAULT_INDEXTYPE /*k*/,
std::vector<CRS_Coordinate<T> > &coordinates,
size_t lastSortedCoord)
: _coordinates(coordinates), _lastSortedCoord(lastSortedCoord), _isSorted(true), _crs(crs)
{
std::cout << "CRS_Initializer: coord-length="<< _coordinates.size() << ", lastSorted: " << _lastSortedCoord << std::endl;
// _coordinates.reserve(k*crs.numRows());
}
template <typename T, CRS_Storage Storage>
CRS_Initializer<T, Storage>::~CRS_Initializer()
{
sort();
// check for empty rows and insert 0 on diagonal if needed
std::vector<FLENS_DEFAULT_INDEXTYPE> fillIn;
FLENS_DEFAULT_INDEXTYPE row = 0;
for (std::size_t k=0; k<_coordinates.size(); ++k) {
FLENS_DEFAULT_INDEXTYPE rowDiff = _coordinates[k].row - row;
for (FLENS_DEFAULT_INDEXTYPE r=1; r<rowDiff; ++r) {
fillIn.push_back(row+r);
}
row += rowDiff;
if ((Storage==CRS_UpperTriangular) && (rowDiff>0)) {
if (_coordinates[k].row!=_coordinates[k].col) {
fillIn.push_back(_coordinates[k].row);
}
}
if ((Storage==CRS_LowerTriangular)
&& (k<_coordinates.size()-1)
&& (_coordinates[k].row<_coordinates[k+1].row)) {
if (_coordinates[k].row!=_coordinates[k].col) {
fillIn.push_back(_coordinates[k].row);
}
}
}
if (Storage==CRS_LowerTriangular) {
FLENS_DEFAULT_INDEXTYPE k = _coordinates.size();
if (_coordinates[k-1].row!=_coordinates[k-1].col) {
fillIn.push_back(_coordinates[k-1].row);
}
}
for (; row<_crs.numRows(); ++row) {
fillIn.push_back(row+1);
}
// add fillins
if (fillIn.size()>0) {
for (size_t k=0; k<fillIn.size(); ++k) {
operator()(fillIn[k], // fillIn[k]
_crs.numCols()) = T(0);
}
sort();
}
// allocate memory for the crs format
_crs.allocate(_coordinates.size());
// convert coordinate format to crs
row = 1;
for (size_t k=0; k<_coordinates.size(); ++k) {
if (_coordinates[k].row>row) {
assert(_coordinates[k].row-row==1);
_crs.rows(row+1) = k+1;
row = _coordinates[k].row;
}
_crs.columns(k+1) = _coordinates[k].col;
_crs.values(k+1) = _coordinates[k].value;
}
_crs.rows(row+1) = _coordinates.size()+1;
#ifndef NDEBUG
if (Storage==CRS_UpperTriangular) {
for (FLENS_DEFAULT_INDEXTYPE i=1; i<=_crs.numRows(); ++i) {
if (_crs.columns(_crs.rows(i))!=i) {
assert(0);
}
}
}
if (Storage==CRS_LowerTriangular) {
for (FLENS_DEFAULT_INDEXTYPE i=1; i<=_crs.numRows(); ++i) {
assert(_crs.rows(i+1)-1>0);
if (_crs.columns(_crs.rows(i+1)-1)!=i) {
assert(0);
}
}
}
#endif // NDEBUG
}
template <typename T, CRS_Storage Storage>
void
CRS_Initializer<T, Storage>::sort()
{
// sort
if (!_isSorted) {
std::sort(_coordinates.begin()+_lastSortedCoord,
_coordinates.end(),
_less);
}
if ((_lastSortedCoord>0) && (_lastSortedCoord<_coordinates.size())) {
std::inplace_merge(_coordinates.begin(),
_coordinates.begin() + _lastSortedCoord,
_coordinates.end(),
_less);
}
_isSorted = true;
// eliminate duplicates
size_t i, I;
for (i=0, I=1; I<_coordinates.size(); ++i, ++I) {
while ((I<_coordinates.size())
&& (!_less(_coordinates[i], _coordinates[I])))
{
_coordinates[i].value += _coordinates[I].value;
_coordinates[I].value = T(0);
++I;
}
if (I<_coordinates.size()) {
_coordinates[i+1] = _coordinates[I];
}
}
if ((i<_coordinates.size()) && (I-i-1>0)) {
_coordinates.erase(_coordinates.end()-(I-i-1), _coordinates.end());
}
_lastSortedCoord = _coordinates.size();
}
template <typename T, CRS_Storage Storage>
T &
CRS_Initializer<T, Storage>::operator()(FLENS_DEFAULT_INDEXTYPE row, FLENS_DEFAULT_INDEXTYPE col)
{
assert(row>=1);
assert(row<=_crs.numRows());
assert(col>=1);
assert(col<=_crs.numCols());
FLENS_DEFAULT_INDEXTYPE r = -1,
c = -1;
if (Storage==CRS_General) {
r = row;
c = col;
}
if (Storage==CRS_UpperTriangular) {
r = std::min(row, col);
c = std::max(row, col);
}
if (Storage==CRS_LowerTriangular) {
r = std::max(row, col);
c = std::min(row, col);
}
assert((r>0) && (c>0));
if (_coordinates.size()>=_coordinates.capacity()) {
sort();
_coordinates.reserve(_coordinates.capacity() + _crs.numRows());
}
// add new coordinate, check if coord.-list is still sorted
_coordinates.push_back(CRS_Coordinate<T>(r, c, T(0)));
size_t lastIndex = _coordinates.size()-1;
if ((lastIndex>0) && _isSorted) {
if (_less(_coordinates[lastIndex-1], _coordinates[lastIndex])) {
_lastSortedCoord = lastIndex;
} else {
_isSorted = false;
}
}
return _coordinates[lastIndex].value;
}
//-- CRS_ConstIterator ---------------------------------------------------------
template <typename T, CRS_Storage Storage>
CRS_ConstIterator<T, Storage>::CRS_ConstIterator(const CRS_ConstIterator &rhs)
: _crs(rhs._crs), _pos(rhs._pos)
{
if (_pos<=_crs.numNonZeros()) {
FLENS_DEFAULT_INDEXTYPE col = _crs.columns(_pos);
FLENS_DEFAULT_INDEXTYPE row = _crs.numRows()+1;
for (FLENS_DEFAULT_INDEXTYPE i=1; i<=_crs.numRows(); ++i) {
if ((_pos>=_crs.rows(i)) && (_pos<_crs.rows(i+1))) {
row = i;
break;
}
}
_value.first = key_type(row, col);
_value.second = _crs.values(_pos);
}
}
template <typename T, CRS_Storage Storage>
CRS_ConstIterator<T, Storage>::CRS_ConstIterator(const
CRS_Iterator<T, Storage> &rhs)
: _crs(rhs._crs), _pos(rhs._pos)
{
if (_pos<=_crs.numNonZeros()) {
FLENS_DEFAULT_INDEXTYPE col = _crs.columns(_pos);
FLENS_DEFAULT_INDEXTYPE row = _crs.numRows()+1;
for (FLENS_DEFAULT_INDEXTYPE i=1; i<=_crs.numRows(); ++i) {
if ((_pos>=_crs.rows(i)) && (_pos<_crs.rows(i+1))) {
row = i;
break;
}
}
_value.first = key_type(row, col);
_value.second = _crs.values(_pos);
}
}
template <typename T, CRS_Storage Storage>
CRS_ConstIterator<T, Storage>::CRS_ConstIterator(const CRS<T, Storage> &crs,
FLENS_DEFAULT_INDEXTYPE pos)
: _crs(crs), _pos(pos)
{
if (pos<=_crs.numNonZeros()) {
FLENS_DEFAULT_INDEXTYPE col = _crs.columns(_pos);
FLENS_DEFAULT_INDEXTYPE row = _crs.numRows()+1;
for (FLENS_DEFAULT_INDEXTYPE i=1; i<=_crs.numRows(); ++i) {
if ((pos>=_crs.rows(i)) && (pos<_crs.rows(i+1))) {
row = i;
break;
}
}
_value.first = key_type(row, col);
_value.second = _crs.values(_pos);
}
}
template <typename T, CRS_Storage Storage>
bool
CRS_ConstIterator<T, Storage>::operator==(const CRS_ConstIterator &rhs) const
{
return ((&_crs==&rhs._crs) && (_pos==rhs._pos));
}
template <typename T, CRS_Storage Storage>
bool
CRS_ConstIterator<T, Storage>::operator!=(const CRS_ConstIterator &rhs) const
{
return !(*this==rhs);
}
template <typename T, CRS_Storage Storage>
CRS_ConstIterator<T, Storage> &
CRS_ConstIterator<T, Storage>::operator++()
{
++_pos;
if (_pos<=_crs.numNonZeros()) {
if (_pos>=_crs.rows(_value.first.first+1)) {
++_value.first.first;
}
_value.first.second = _crs.columns(_pos);
_value.second = _crs.values(_pos);
}
return *this;
}
template <typename T, CRS_Storage Storage>
const typename CRS_ConstIterator<T, Storage>::value_type &
CRS_ConstIterator<T, Storage>::operator*() const
{
return _value;
}
template <typename T, CRS_Storage Storage>
const typename CRS_ConstIterator<T, Storage>::value_type *
CRS_ConstIterator<T, Storage>::operator->() const
{
return &_value;
}
//-- CRS_Iterator --------------------------------------------------------------
template <typename T, CRS_Storage Storage>
CRS_Iterator<T, Storage>::CRS_Iterator(const CRS_Iterator &rhs)
: _crs(rhs._crs), _pos(rhs._pos)
{
if (_pos<=_crs.numNonZeros()) {
FLENS_DEFAULT_INDEXTYPE col = _crs.columns(_pos);
FLENS_DEFAULT_INDEXTYPE row = _crs.numRows()+1;
for (FLENS_DEFAULT_INDEXTYPE i=1; i<=_crs.numRows(); ++i) {
if ((_pos>=_crs.rows(i)) && (_pos<_crs.rows(i+1))) {
row = i;
break;
}
}
_value.first = key_type(row, col);
_value.second = _crs.values(_pos);
}
}
template <typename T, CRS_Storage Storage>
CRS_Iterator<T, Storage>::CRS_Iterator(const CRS<T, Storage> &crs, FLENS_DEFAULT_INDEXTYPE pos)
: _crs(crs), _pos(pos)
{
if (pos<=_crs.numNonZeros()) {
FLENS_DEFAULT_INDEXTYPE col = _crs.columns(_pos);
FLENS_DEFAULT_INDEXTYPE row = _crs.numRows()+1;
for (FLENS_DEFAULT_INDEXTYPE i=1; i<=_crs.numRows(); ++i) {
if ((pos>=_crs.rows(i)) && (pos<_crs.rows(i+1))) {
row = i;
break;
}
}
_value.first = key_type(row, col);
_value.second = _crs.values(_pos);
}
}
template <typename T, CRS_Storage Storage>
bool
CRS_Iterator<T, Storage>::operator==(const CRS_Iterator &rhs) const
{
return ((&_crs==&rhs._crs) && (_pos==rhs._pos));
}
template <typename T, CRS_Storage Storage>
bool
CRS_Iterator<T, Storage>::operator!=(const CRS_Iterator &rhs) const
{
return !(*this==rhs);
}
template <typename T, CRS_Storage Storage>
CRS_Iterator<T, Storage> &
CRS_Iterator<T, Storage>::operator++()
{
++_pos;
if (_pos<=_crs.numNonZeros()) {
if (_pos>=_crs.rows(_value.first.first+1)) {
++_value.first.first;
}
_value.first.second = _crs.columns(_pos);
_value.second = _crs.values(_pos);
}
return *this;
}
template <typename T, CRS_Storage Storage>
typename CRS_Iterator<T, Storage>::value_type &
CRS_Iterator<T, Storage>::operator*()
{
return _value;
}
template <typename T, CRS_Storage Storage>
typename CRS_Iterator<T, Storage>::value_type *
CRS_Iterator<T, Storage>::operator->()
{
return &_value;
}
} // namespace flens
#undef CRS
|
[
"mazen.ali90@gmail.com"
] |
mazen.ali90@gmail.com
|
9772c3faed3a8374c3e5ea51df5a377dd8f2e4e9
|
e92516dda914c02e08a3fab30ab0729852b9b3ca
|
/OS_Runner/gui.hpp
|
f12b168ce3523a62bee43d7c6aa3393c004a9012
|
[] |
no_license
|
DenisPerez/OS_Proyects
|
3de9ffde17ece89b9b58e238204328634a3bc2c9
|
0fb66366dd6040725edf538d465cb26f2c0b655b
|
refs/heads/master
| 2020-09-27T01:57:54.692492
| 2019-12-06T20:05:09
| 2019-12-06T20:05:09
| 226,396,914
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 489
|
hpp
|
#pragma once
#ifndef GUI_HPP
#define GUI_HPP
#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include <FL/Fl_Gl_Window.H>
#include <FL/gl.h>
extern "C" {
#include "data.h"
}
#include "ogl.hpp"
class GlGui : public Fl_Gl_Window {
public:
GlGui(Fl_Window * parent, int x, int y, int w, int h, const char * l);
protected:
virtual void draw();
virtual int handle(int);
private:
Fl_Window * parent;
std::string title;
bool initialized;
data_t * game_data;
};
#endif
|
[
"denisadrian@gmail.com"
] |
denisadrian@gmail.com
|
51a2a8853a4b30859ada8b57454c5c35d1c92dc6
|
6197258fbe796f9e578b77da274907559d2cfb06
|
/MFC_Exia_Debugger/MFC_Exia_Debugger.cpp
|
dd831cd5d71d233d5466df5780bcf08f121b72dd
|
[] |
no_license
|
Jackie-Yang/MFC_Exia_Debugger
|
0228d240fa80776e11cf42135d14df40ae6356d2
|
9784a4981886082fc9e1e5cd86897735a8a8d1ca
|
refs/heads/master
| 2021-06-23T01:09:12.824609
| 2017-06-12T02:01:20
| 2017-06-12T02:01:20
| 88,024,022
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 2,968
|
cpp
|
// MFC_Exia_Debugger.cpp : 定义应用程序的类行为。
//
#include "stdafx.h"
#include "MFC_Exia_Debugger.h"
#include "MFC_Exia_DebuggerDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
// CMFC_Exia_DebuggerApp
BEGIN_MESSAGE_MAP(CMFC_Exia_DebuggerApp, CWinApp)
ON_COMMAND(ID_HELP, &CWinApp::OnHelp)
END_MESSAGE_MAP()
// CMFC_Exia_DebuggerApp 构造
CMFC_Exia_DebuggerApp::CMFC_Exia_DebuggerApp()
{
// 支持重新启动管理器
m_dwRestartManagerSupportFlags = AFX_RESTART_MANAGER_SUPPORT_RESTART;
// TODO: 在此处添加构造代码,
// 将所有重要的初始化放置在 InitInstance 中
}
//// CMFC_Exia_DebuggerApp 析构
//CMFC_Exia_DebuggerApp::~CMFC_Exia_DebuggerApp()
//{
// // TODO: 在此处添加析构代码,
//
//}
// 唯一的一个 CMFC_Exia_DebuggerApp 对象
CMFC_Exia_DebuggerApp theApp;
// CMFC_Exia_DebuggerApp 初始化
BOOL CMFC_Exia_DebuggerApp::InitInstance()
{
// 如果一个运行在 Windows XP 上的应用程序清单指定要
// 使用 ComCtl32.dll 版本 6 或更高版本来启用可视化方式,
//则需要 InitCommonControlsEx()。 否则,将无法创建窗口。
INITCOMMONCONTROLSEX InitCtrls;
InitCtrls.dwSize = sizeof(InitCtrls);
// 将它设置为包括所有要在应用程序中使用的
// 公共控件类。
InitCtrls.dwICC = ICC_WIN95_CLASSES;
InitCommonControlsEx(&InitCtrls);
CWinApp::InitInstance();
AfxEnableControlContainer();
// 创建 shell 管理器,以防对话框包含
// 任何 shell 树视图控件或 shell 列表视图控件。
CShellManager *pShellManager = new CShellManager;
// 激活“Windows Native”视觉管理器,以便在 MFC 控件中启用主题
CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerWindows));
// 标准初始化
// 如果未使用这些功能并希望减小
// 最终可执行文件的大小,则应移除下列
// 不需要的特定初始化例程
// 更改用于存储设置的注册表项
// TODO: 应适当修改该字符串,
// 例如修改为公司或组织名
SetRegistryKey(_T("应用程序向导生成的本地应用程序"));
CMFC_Exia_DebuggerDlg dlg;
m_pMainWnd = &dlg;
INT_PTR nResponse = dlg.DoModal();
if (nResponse == IDOK)
{
// TODO: 在此放置处理何时用
// “确定”来关闭对话框的代码
}
else if (nResponse == IDCANCEL)
{
// TODO: 在此放置处理何时用
// “取消”来关闭对话框的代码
}
else if (nResponse == -1)
{
TRACE(traceAppMsg, 0, "警告: 对话框创建失败,应用程序将意外终止。\n");
TRACE(traceAppMsg, 0, "警告: 如果您在对话框上使用 MFC 控件,则无法 #define _AFX_NO_MFC_CONTROLS_IN_DIALOGS。\n");
}
// 删除上面创建的 shell 管理器。
if (pShellManager != NULL)
{
delete pShellManager;
}
// 由于对话框已关闭,所以将返回 FALSE 以便退出应用程序,
// 而不是启动应用程序的消息泵。
return FALSE;
}
|
[
"921622129@qq.com"
] |
921622129@qq.com
|
6768d4ae119745a086793777661f8e1b6374693f
|
63ed1beba797e818c11725d6917f7e70109d6aff
|
/Ray Tracer/SceneObject.h
|
856a4806371b1e2b3b51266f1b6284baa6c534db
|
[] |
no_license
|
JoBri93/ZGK-RayTracer
|
166423332cbc44ff601a5bc5fd07d6848d49086d
|
520865789aacd94bfcd114f8eb36e19276f064ea
|
refs/heads/master
| 2021-10-25T21:03:25.785731
| 2019-04-07T15:15:39
| 2019-04-07T15:15:39
| 173,940,469
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 351
|
h
|
#pragma once
#include <glm\glm.hpp>
#include "FreeImage.h"
class CSceneObject
{
public:
CSceneObject(void);
~CSceneObject(void);
float reflect;
float shininess;
float absorption;
float refraction;
glm::vec3 amb;
glm::vec3 diff;
glm::vec3 spec;
virtual float intersect( CRay* ray ) = 0;
virtual glm::vec3 objectNorm(CRay* ray) = 0;
};
|
[
"joanna.brinken@vp.pl"
] |
joanna.brinken@vp.pl
|
369b965c11df96025c19fe93a44cdf97f2fdb751
|
a07d1ae886800fe3758203683d6067089322b78c
|
/src/armnn/layers/PreCompiledLayer.cpp
|
963924ded5312a9df3c805665f3cb5347031d123
|
[
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] |
permissive
|
oubotong/arm-secure-nn-1
|
7a896f15e20636493a485b5a8ea71081bb8af12a
|
a92eba03be9a4df62f21d2494869e74b44de3364
|
refs/heads/master
| 2023-03-17T17:22:54.972293
| 2020-04-14T14:36:58
| 2020-04-14T14:36:58
| 557,095,350
| 1
| 0
|
MIT
| 2022-10-25T04:11:50
| 2022-10-25T04:11:49
| null |
UTF-8
|
C++
| false
| false
| 1,682
|
cpp
|
//
// Copyright © 2017 Arm Ltd. All rights reserved.
// SPDX-License-Identifier: MIT
//
#include "PreCompiledLayer.hpp"
#include "LayerCloneBase.hpp"
#include "backendsCommon/Workload.hpp"
#include <armnn/TypesUtils.hpp>
namespace armnn
{
PreCompiledLayer::PreCompiledLayer(const PreCompiledDescriptor& param, const char* name)
: LayerWithParameters(param.m_NumInputSlots, param.m_NumOutputSlots, LayerType::PreCompiled, param, name)
{}
PreCompiledLayer::~PreCompiledLayer()
{}
PreCompiledLayer* PreCompiledLayer::Clone(Graph& graph) const
{
PreCompiledLayer* clone = CloneBase<PreCompiledLayer>(graph, m_Param, GetName());
clone->m_PreCompiledObject.reset(const_cast<PreCompiledLayer*>(this)->m_PreCompiledObject.release());
return clone;
}
std::unique_ptr<IWorkload> PreCompiledLayer::CreateWorkload(const armnn::Graph& graph,
const armnn::IWorkloadFactory& factory) const
{
PreCompiledQueueDescriptor descriptor;
descriptor.m_PreCompiledObject = m_PreCompiledObject.get();
return factory.CreatePreCompiled(descriptor, PrepInfoAndDesc(descriptor, graph));
}
void PreCompiledLayer::ValidateTensorShapesFromInputs()
{
// NOTE: since the PreCompiledLayer is an internal layer created from a valid SubgraphView,
// we do not need to validate its input shapes
}
void PreCompiledLayer::SetPreCompiledObject(PreCompiledObjectPtr preCompiledObject)
{
m_PreCompiledObject = std::move(preCompiledObject);
}
void PreCompiledLayer::Accept(ILayerVisitor& visitor) const
{
throw armnn::Exception("PreCompiledLayer should not appear in an input graph");
}
} // namespace armnn
|
[
"i.am.renju.liu@gmail.com"
] |
i.am.renju.liu@gmail.com
|
e5d83737fcd21af951e49395dab3b46e53905b00
|
ac7f42629767beb880e858b7ddfdfa13ea2d9dc8
|
/fibonacci/main.cpp
|
182387a5c1bd6e02298b16fbca6282d4c8faf2a0
|
[] |
no_license
|
Mooonside/Leetcode
|
d6a7adca8f447d7af31672be82975f143a120a1a
|
4cf1e3cf5d5f79391d7e8cf7916fcc2c744b7c2e
|
refs/heads/master
| 2021-01-01T16:11:41.536091
| 2017-08-26T04:05:47
| 2017-08-26T04:05:47
| 95,767,595
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 300
|
cpp
|
#include <iostream>
using namespace std;
int main() {
int *array = new int[30+1];
array[0] = 0;
array[1] = 1;
int i = 2;
while(i<=30){
array[i] = array[i-1]+array[i-2];
i++;
}
int times;
while(cin>>times){
cout<<array[times]<<endl;
}
}
|
[
"yifeng-chen@outlook.com"
] |
yifeng-chen@outlook.com
|
092af86d1c309c2f225a7105f37650b8969fb424
|
5ec06dab1409d790496ce082dacb321392b32fe9
|
/clients/cpp-restsdk/generated/model/ComAdobeCqScreensImplRemoteImplDistributedHttpClientImplInfo.cpp
|
ed37d5d17fc8391f9eeedb26ed92d0e91822f785
|
[
"Apache-2.0"
] |
permissive
|
shinesolutions/swagger-aem-osgi
|
e9d2385f44bee70e5bbdc0d577e99a9f2525266f
|
c2f6e076971d2592c1cbd3f70695c679e807396b
|
refs/heads/master
| 2022-10-29T13:07:40.422092
| 2021-04-09T07:46:03
| 2021-04-09T07:46:03
| 190,217,155
| 3
| 3
|
Apache-2.0
| 2022-10-05T03:26:20
| 2019-06-04T14:23:28
| null |
UTF-8
|
C++
| false
| false
| 7,805
|
cpp
|
/**
* Adobe Experience Manager OSGI config (AEM) API
* Swagger AEM OSGI is an OpenAPI specification for Adobe Experience Manager (AEM) OSGI Configurations API
*
* OpenAPI spec version: 1.0.0-pre.0
* Contact: opensource@shinesolutions.com
*
* NOTE: This class is auto generated by OpenAPI-Generator 3.2.1-SNAPSHOT.
* https://openapi-generator.tech
* Do not edit the class manually.
*/
#include "ComAdobeCqScreensImplRemoteImplDistributedHttpClientImplInfo.h"
namespace org {
namespace openapitools {
namespace client {
namespace model {
ComAdobeCqScreensImplRemoteImplDistributedHttpClientImplInfo::ComAdobeCqScreensImplRemoteImplDistributedHttpClientImplInfo()
{
m_Pid = utility::conversions::to_string_t("");
m_PidIsSet = false;
m_Title = utility::conversions::to_string_t("");
m_TitleIsSet = false;
m_Description = utility::conversions::to_string_t("");
m_DescriptionIsSet = false;
m_PropertiesIsSet = false;
}
ComAdobeCqScreensImplRemoteImplDistributedHttpClientImplInfo::~ComAdobeCqScreensImplRemoteImplDistributedHttpClientImplInfo()
{
}
void ComAdobeCqScreensImplRemoteImplDistributedHttpClientImplInfo::validate()
{
// TODO: implement validation
}
web::json::value ComAdobeCqScreensImplRemoteImplDistributedHttpClientImplInfo::toJson() const
{
web::json::value val = web::json::value::object();
if(m_PidIsSet)
{
val[utility::conversions::to_string_t("pid")] = ModelBase::toJson(m_Pid);
}
if(m_TitleIsSet)
{
val[utility::conversions::to_string_t("title")] = ModelBase::toJson(m_Title);
}
if(m_DescriptionIsSet)
{
val[utility::conversions::to_string_t("description")] = ModelBase::toJson(m_Description);
}
if(m_PropertiesIsSet)
{
val[utility::conversions::to_string_t("properties")] = ModelBase::toJson(m_Properties);
}
return val;
}
void ComAdobeCqScreensImplRemoteImplDistributedHttpClientImplInfo::fromJson(web::json::value& val)
{
if(val.has_field(utility::conversions::to_string_t("pid")))
{
setPid(ModelBase::stringFromJson(val[utility::conversions::to_string_t("pid")]));
}
if(val.has_field(utility::conversions::to_string_t("title")))
{
setTitle(ModelBase::stringFromJson(val[utility::conversions::to_string_t("title")]));
}
if(val.has_field(utility::conversions::to_string_t("description")))
{
setDescription(ModelBase::stringFromJson(val[utility::conversions::to_string_t("description")]));
}
if(val.has_field(utility::conversions::to_string_t("properties")))
{
if(!val[utility::conversions::to_string_t("properties")].is_null())
{
std::shared_ptr<ComAdobeCqScreensImplRemoteImplDistributedHttpClientImplProperties> newItem(new ComAdobeCqScreensImplRemoteImplDistributedHttpClientImplProperties());
newItem->fromJson(val[utility::conversions::to_string_t("properties")]);
setProperties( newItem );
}
}
}
void ComAdobeCqScreensImplRemoteImplDistributedHttpClientImplInfo::toMultipart(std::shared_ptr<MultipartFormData> multipart, const utility::string_t& prefix) const
{
utility::string_t namePrefix = prefix;
if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t("."))
{
namePrefix += utility::conversions::to_string_t(".");
}
if(m_PidIsSet)
{
multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t("pid"), m_Pid));
}
if(m_TitleIsSet)
{
multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t("title"), m_Title));
}
if(m_DescriptionIsSet)
{
multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t("description"), m_Description));
}
if(m_PropertiesIsSet)
{
if (m_Properties.get())
{
m_Properties->toMultipart(multipart, utility::conversions::to_string_t("properties."));
}
}
}
void ComAdobeCqScreensImplRemoteImplDistributedHttpClientImplInfo::fromMultiPart(std::shared_ptr<MultipartFormData> multipart, const utility::string_t& prefix)
{
utility::string_t namePrefix = prefix;
if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t("."))
{
namePrefix += utility::conversions::to_string_t(".");
}
if(multipart->hasContent(utility::conversions::to_string_t("pid")))
{
setPid(ModelBase::stringFromHttpContent(multipart->getContent(utility::conversions::to_string_t("pid"))));
}
if(multipart->hasContent(utility::conversions::to_string_t("title")))
{
setTitle(ModelBase::stringFromHttpContent(multipart->getContent(utility::conversions::to_string_t("title"))));
}
if(multipart->hasContent(utility::conversions::to_string_t("description")))
{
setDescription(ModelBase::stringFromHttpContent(multipart->getContent(utility::conversions::to_string_t("description"))));
}
if(multipart->hasContent(utility::conversions::to_string_t("properties")))
{
if(multipart->hasContent(utility::conversions::to_string_t("properties")))
{
std::shared_ptr<ComAdobeCqScreensImplRemoteImplDistributedHttpClientImplProperties> newItem(new ComAdobeCqScreensImplRemoteImplDistributedHttpClientImplProperties());
newItem->fromMultiPart(multipart, utility::conversions::to_string_t("properties."));
setProperties( newItem );
}
}
}
utility::string_t ComAdobeCqScreensImplRemoteImplDistributedHttpClientImplInfo::getPid() const
{
return m_Pid;
}
void ComAdobeCqScreensImplRemoteImplDistributedHttpClientImplInfo::setPid(utility::string_t value)
{
m_Pid = value;
m_PidIsSet = true;
}
bool ComAdobeCqScreensImplRemoteImplDistributedHttpClientImplInfo::pidIsSet() const
{
return m_PidIsSet;
}
void ComAdobeCqScreensImplRemoteImplDistributedHttpClientImplInfo::unsetPid()
{
m_PidIsSet = false;
}
utility::string_t ComAdobeCqScreensImplRemoteImplDistributedHttpClientImplInfo::getTitle() const
{
return m_Title;
}
void ComAdobeCqScreensImplRemoteImplDistributedHttpClientImplInfo::setTitle(utility::string_t value)
{
m_Title = value;
m_TitleIsSet = true;
}
bool ComAdobeCqScreensImplRemoteImplDistributedHttpClientImplInfo::titleIsSet() const
{
return m_TitleIsSet;
}
void ComAdobeCqScreensImplRemoteImplDistributedHttpClientImplInfo::unsetTitle()
{
m_TitleIsSet = false;
}
utility::string_t ComAdobeCqScreensImplRemoteImplDistributedHttpClientImplInfo::getDescription() const
{
return m_Description;
}
void ComAdobeCqScreensImplRemoteImplDistributedHttpClientImplInfo::setDescription(utility::string_t value)
{
m_Description = value;
m_DescriptionIsSet = true;
}
bool ComAdobeCqScreensImplRemoteImplDistributedHttpClientImplInfo::descriptionIsSet() const
{
return m_DescriptionIsSet;
}
void ComAdobeCqScreensImplRemoteImplDistributedHttpClientImplInfo::unsetDescription()
{
m_DescriptionIsSet = false;
}
std::shared_ptr<ComAdobeCqScreensImplRemoteImplDistributedHttpClientImplProperties> ComAdobeCqScreensImplRemoteImplDistributedHttpClientImplInfo::getProperties() const
{
return m_Properties;
}
void ComAdobeCqScreensImplRemoteImplDistributedHttpClientImplInfo::setProperties(std::shared_ptr<ComAdobeCqScreensImplRemoteImplDistributedHttpClientImplProperties> value)
{
m_Properties = value;
m_PropertiesIsSet = true;
}
bool ComAdobeCqScreensImplRemoteImplDistributedHttpClientImplInfo::propertiesIsSet() const
{
return m_PropertiesIsSet;
}
void ComAdobeCqScreensImplRemoteImplDistributedHttpClientImplInfo::unsetProperties()
{
m_PropertiesIsSet = false;
}
}
}
}
}
|
[
"cliffano@gmail.com"
] |
cliffano@gmail.com
|
9258c85104c97941ee8f272f8a1b90bbabbb331a
|
89870ca1f16af0f2ba65ec0175cd089da852afbc
|
/codeforces/round-594-div-2/planting_tree_b.cpp
|
92a5c6c81bf365082f6e63d3796e06d1ff111ee4
|
[] |
no_license
|
Merisho/comprog
|
3b8ce833f0f16dbcfa252f9c6678c160bf081a11
|
fb4829ba93fcb376078a5baccda0c07ce35d6d04
|
refs/heads/master
| 2023-08-18T00:10:45.535195
| 2023-08-11T07:16:02
| 2023-08-11T07:16:02
| 216,174,595
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 476
|
cpp
|
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main()
{
vector<int> a;
int n;
cin >> n;
for (int i = 0; i < n; i++) {
int ai;
cin >> ai;
a.push_back(ai);
}
sort(a.begin(), a.end());
long long h = 0;
long long v = 0;
int s = a.size();
for (int i = 0; i < s / 2; i++) {
v += a[i];
h += a[s - 1 - i];
}
if (s % 2 == 1) {
h += a[s / 2];
}
cout << v * v + h * h;
return 0;
}
|
[
"merishot@gmail.com"
] |
merishot@gmail.com
|
a4c8e9c0a8713b30a695c3d1922c2f69d8ea9b3c
|
367be98d4ed7dde14d05f988c1606aaa60a60eb3
|
/sstmac/software/process/app_manager.cc
|
25cbba67baac4ae868932a629cc45d57032b5540
|
[
"BSD-3-Clause"
] |
permissive
|
nlslatt/sst-macro
|
acd3f043468cd13ab0843dff85493737ea5a843f
|
c0feb7e8d12bde3f0b1a505452276473f9b07ca3
|
refs/heads/master
| 2021-01-15T12:15:40.773962
| 2016-04-07T21:30:26
| 2016-04-07T21:39:55
| 59,328,703
| 0
| 0
| null | 2016-05-20T21:54:18
| 2016-05-20T21:54:17
| null |
UTF-8
|
C++
| false
| false
| 3,302
|
cc
|
#include <sstmac/common/runtime.h>
#include <sstmac/hardware/interconnect/interconnect.h>
#include <sstmac/software/process/app.h>
#include <sstmac/software/process/app_manager.h>
#include <sstmac/hardware/interconnect/interconnect_fwd.h>
#include <sprockit/sim_parameters.h>
#include <sprockit/keyword_registration.h>
ImplementFactory(sstmac::sw::app_manager);
RegisterNamespaces("app_manager");
namespace sstmac {
namespace sw {
std::map<int, app_manager*> app_manager::static_app_managers_;
app_manager::app_manager()
{
}
app_manager::~app_manager()
{
delete app_template_;
}
hw::node*
app_manager::node_at(node_id nid) const
{
return interconn_->node_at(nid);
}
void
app_manager::set_interconnect(hw::interconnect* interconn)
{
interconn_ = interconn;
top_ = interconn->topol();
}
void
app_manager::init_factory_params(sprockit::sim_parameters* params)
{
launch_prefix_ = sprockit::printf("launch_app%d", int(aid_));
appname_ = params->get_param(launch_prefix_);
if (params->has_param(launch_prefix_ + "_core_affinities")) {
params->get_vector_param(launch_prefix_ + "_core_affinities",
core_affinities_);
}
app_template_ = sw::app_factory::get_value(appname_, params);
app_template_->init_argv(aid_, params);
STATIC_INIT_INTERCONNECT(params)
}
app_manager*
app_manager::static_app_manager(int aid, sprockit::sim_parameters* params)
{
if (!static_app_managers_[aid]){
sprockit::sim_parameters* app_params = params->top_parent()->get_namespace("app_manager");
std::string param_name = sprockit::printf("launch_app%d_type", aid);
app_manager* mgr = app_manager_factory::get_optional_param(
param_name, "skeleton", app_params, app_id(aid), 0/*no parallel runtime*/);
static_app_managers_[aid] = mgr;
sstmac_runtime::register_app_manager(app_id(aid), mgr);
mgr->allocate_and_index_jobs();
}
return static_app_managers_[aid];
}
std::string
app_manager::getenv(const std::string &name) const
{
shell_var_map::const_iterator it = shell_env_.find(name);
if (it == shell_env_.end()) {
return "";
}
return it->second;
}
std::string
app_manager::hostname(sw::task_id tid) const
{
task_to_hostname_map::const_iterator it = hostnames_.find(tid);
if (it == hostnames_.end()) {
spkt_throw_printf(sprockit::value_error,
"environment::get_hostname: unable to find hostname for task %d",
int(tid));
}
return it->second;
}
void
app_manager::add_hostname(sw::task_id tid, const std::string &name,
node_id addr)
{
hostnames_[tid] = name;
inet_addrs_[name] = addr;
}
node_id
app_manager::node_address(const std::string& name) const
{
hostname_to_addr_map::const_iterator it = inet_addrs_.find(name);
if (it == inet_addrs_.end()) {
spkt_throw_printf(
sprockit::value_error,
"unable to find nodaddress for hostname %s",
name.c_str());
}
return it->second;
}
node_id
app_manager::node_for_task(sw::task_id tid) const
{
task_to_node_map::const_iterator it = nodeids_.find(tid);
if (it == nodeids_.end()) {
spkt_throw_printf(sprockit::value_error,
"sstmac_runtime::get_node: can not find task %d",
int(tid));
}
return it->second;
}
}
}
|
[
"jjwilke@s940740ca.ca.sandia.gov"
] |
jjwilke@s940740ca.ca.sandia.gov
|
753a8aaa9060abc77a07a0d674668a432ada0b14
|
a91dc94108160573b0cee8d9dbfda6b06db7e036
|
/170111_3DFrameWork_Actor/170111_3DFrameWork_Actor/CollisionDetection/BoundingSphere.cpp
|
2a69d41302c8c578123914c5877c043cfde22704
|
[] |
no_license
|
YaYaCreatea/ATY_Project1
|
765e201a80e8bf90f5b92779ed4cc77a59e17779
|
ff6fd30907047607b82d92f756bb5d491f4e7090
|
refs/heads/master
| 2021-07-17T05:33:07.966231
| 2017-10-19T02:14:12
| 2017-10-19T02:14:12
| null | 0
| 0
| null | null | null | null |
SHIFT_JIS
|
C++
| false
| false
| 936
|
cpp
|
#include "BoundingSphere.h"
//コンストラクタ
BoundingSphere::BoundingSphere(const GSvector3 & center, float radius)
:center{ center }, radius{ radius }
{
}
//コンストラクタ
BoundingSphere::BoundingSphere(float radius)
: BoundingSphere{ {0.0f,0.0f,0.0f},radius }
{
}
//平行移動
BoundingSphere BoundingSphere::translate(const GSvector3 & position) const
{
return{ center + position,radius };
}
//座標変換
BoundingSphere BoundingSphere::transform(const GSmatrix4 & matrix) const
{
return{ matrix.transform(center),radius*matrix.getScale().y };
}
//交差しているか?
bool BoundingSphere::intersects(const BoundingSphere & other) const
{
return gsCollisionSphereAndSphere(¢er, radius, &other.center, other.radius) == GS_TRUE;
}
//デバッグ表示
void BoundingSphere::draw() const
{
glPushMatrix();
glTranslatef(center.x, center.y, center.z);
glutWireSphere(radius,16,16);
glPopMatrix();
}
|
[
"ATYcreateaChiya619@gmail.com"
] |
ATYcreateaChiya619@gmail.com
|
2b1bd3e10a992a1e982275cd5b8adac95dcead58
|
97f638a3554614e93d3a374234a9c0de53c94d86
|
/samples/Cpp/HelloCpp/Classes/HelloWorldScene.cpp
|
abc43cc976150e48b4acd0647f55092f6a5bec12
|
[] |
no_license
|
keeptotheend/cocos2dx-classical
|
e5e0643e9c343c571b6e6bf78433c9211298ca67
|
cb2381e41db31bee42f7e9b94069949969c18279
|
refs/heads/master
| 2020-07-10T00:54:56.372516
| 2016-04-18T09:02:46
| 2016-04-18T09:02:46
| 56,835,469
| 1
| 0
| null | 2016-04-22T07:28:20
| 2016-04-22T07:28:20
| null |
UTF-8
|
C++
| false
| false
| 2,946
|
cpp
|
#include "HelloWorldScene.h"
#include "AppMacros.h"
USING_NS_CC;
CCScene* HelloWorld::scene()
{
// 'scene' is an autorelease object
CCScene *scene = CCScene::create();
// 'layer' is an autorelease object
HelloWorld *layer = HelloWorld::create();
// add layer as a child to scene
scene->addChild(layer);
// return the scene
return scene;
}
// on "init" you need to initialize your instance
bool HelloWorld::init()
{
//////////////////////////////
// 1. super init first
if ( !CCLayer::init() )
{
return false;
}
CCSize visibleSize = CCDirector::sharedDirector()->getVisibleSize();
CCPoint origin = CCDirector::sharedDirector()->getVisibleOrigin();
/////////////////////////////
// 2. add a menu item with "X" image, which is clicked to quit the program
// you may modify it.
// add a "close" icon to exit the progress. it's an autorelease object
CCMenuItemImage *pCloseItem = CCMenuItemImage::create(
"CloseNormal.png",
"CloseSelected.png",
this,
menu_selector(HelloWorld::menuCloseCallback));
pCloseItem->setPosition(ccp(origin.x + visibleSize.width - pCloseItem->getContentSize().width/2 ,
origin.y + pCloseItem->getContentSize().height/2));
// create menu, it's an autorelease object
CCMenu* pMenu = CCMenu::create(pCloseItem, NULL);
pMenu->setPosition(CCPointZero);
this->addChild(pMenu, 1);
/////////////////////////////
// 3. add your codes below...
// add a label shows "Hello World"
// create and initialize a label
CCLabelTTF* pLabel = CCLabelTTF::create("Hello World", "Arial", TITLE_FONT_SIZE);
pLabel->enableShadow(CCSizeMake(2.5, 2.5), 0xff333333, 1);
// position the label on the center of the screen
pLabel->setPosition(ccp(origin.x + visibleSize.width/2,
origin.y + visibleSize.height - pLabel->getContentSize().height));
// add the label as a child to this layer
this->addChild(pLabel, 1);
// add "HelloWorld" splash screen"
CCSprite* pSprite = CCSprite::create("HelloWorld.png");
// position the sprite on the center of the screen
pSprite->setPosition(ccp(visibleSize.width/2 + origin.x, visibleSize.height/2 + origin.y));
// add the sprite as a child to this layer
this->addChild(pSprite, 0);
return true;
}
void HelloWorld::menuCloseCallback(CCObject* pSender)
{
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT) || (CC_TARGET_PLATFORM == CC_PLATFORM_WP8)
CCMessageBox("You pressed the close button. Windows Store Apps do not implement a close button.","Alert");
#else
CCDirector::sharedDirector()->terminate();
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
exit(0);
#endif
#endif
}
|
[
"stubma@gmail.com"
] |
stubma@gmail.com
|
2781af35d7e1792909a828d9f264226a67616255
|
7af554ff51603fd9f01903577be9836aba03e3f1
|
/src/BuildEvents.cc
|
382ad8f3d916891e07a3f184b7dcc79771c712c6
|
[] |
no_license
|
wimmer-k/Salvador
|
eaf042ab918eb5f958cad496273e535d84f028c7
|
9241b66b298c6231a95d8787a75567afee32094f
|
refs/heads/master
| 2021-12-15T00:50:48.146849
| 2021-12-13T16:46:23
| 2021-12-13T16:46:23
| 51,063,680
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 12,757
|
cc
|
#include "BuildEvents.hh"
using namespace std;
/*!
Initialyze the event building
\param brtr tree with input bigrips data
\param watr tree with input wasabi data
\param eutr tree with input eurica data
*/
void BuildEvents::Init(TTree* brtr, TTree* watr, TTree* eutr){
flastevent = -1;
fhasBR = false;
fhasWA = false;
fhasEU = false;
fBRentries = 0;
fWAentries = 0;
fEUentries = 0;
if(brtr!=NULL)
fhasBR = true;
if(watr!=NULL)
fhasWA = true;
if(eutr!=NULL)
fhasEU = true;
fBRtr = brtr;
fWAtr = watr;
fEUtr = eutr;
fBRentry = 0;
fWAentry = 0;
fEUentry = 0;
fnbytes = 0;
fBRts = 0;
fbeam = new Beam;
for(unsigned short f=0;f<NFPLANES;f++){
ffp[f] = new FocalPlane;
}
fWAts = 0;
fwasabi = new WASABI;
fEUts = 0;
feurica = new EURICA;
fEUeventinfo = NULL;
fEUcluster = NULL;
fEUclusterAB = NULL;
//local copy for intermediate storing
flocalBRts = 0;
flocalbeam = new Beam;
for(unsigned short f=0;f<NFPLANES;f++){
flocalfp[f] = new FocalPlane;
}
flocalWAts = 0;
flocalwasabi = new WASABI;
flocalEUts = 0;
flocaleurica = new EURICA;
if(fhasBR){
fBRtr->SetBranchAddress("timestamp",&flocalBRts);
fBRtr->SetBranchAddress("beam",&flocalbeam);
for(unsigned short f=0;f<NFPLANES;f++){
fBRtr->SetBranchAddress(Form("fp%d",fpID[f]),&flocalfp[f]);
}
fBRentries = fBRtr->GetEntries();
cout << fBRentries << " entries in BigRIPS tree" << endl;
}
if(fhasWA){
fWAtr->SetBranchAddress("timestamp",&flocalWAts);
fWAtr->SetBranchAddress("wasabi",&flocalwasabi);
fWAentries = fWAtr->GetEntries();
cout << fWAentries << " entries in WASABI tree" << endl;
}
if(fhasEU){
fEUtr->SetBranchAddress("EventInfo",&fEUeventinfo);
fEUtr->SetBranchAddress("GeCluster",&fEUcluster);
fEUtr->SetBranchAddress("GeAddback",&fEUclusterAB);
fEUentries = fEUtr->GetEntries();
cout << fEUentries << " entries in EURICA tree" << endl;
}
fmtr = new TTree("tr","merged tree");
fmtr->Branch("beam",&fbeam,320000);
for(unsigned short f=0;f<NFPLANES;f++){
fmtr->Branch(Form("fp%d",fpID[f]),&ffp[f],320000);
}
fmtr->Branch("brTS",&fBRts,320000);
fmtr->Branch("brentry",&fBRentry,320000);
fmtr->Branch("wasabi",&fwasabi,320000);
fmtr->Branch("waTS",&fWAts,320000);
fmtr->Branch("waentry",&fWAentry,320000);
fmtr->Branch("eurica",&feurica,320000);
fmtr->Branch("euTS",&fEUts,320000);
fmtr->Branch("euentry",&fEUentry,320000);
fmtr->BranchRef();
if(fverbose>-1){
Int_t status = 0;
if(fhasBR){
status = fBRtr->GetEvent(0);
if(status<0)
cout << "first BigRIPS entry faulty!" << endl;
cout << "first BigRIPS timestamp: " << flocalBRts << endl;
status = fBRtr->GetEvent(fBRentries-1);
if(status<0)
cout << "last BigRIPS entry faulty!" << endl;
cout << "last BigRIPS timestamp: " << flocalBRts << endl;
}
if(fhasWA){
status = fWAtr->GetEvent(0);
if(status<0)
cout << "first WASABI entry faulty!" << endl;
cout << "first WASABI timestamp: " << flocalWAts << endl;
status = fWAtr->GetEvent(fWAentries-1);
if(status<0)
cout << "last WASABI entry faulty!" << endl;
cout << "last WASABI timestamp: " << flocalWAts << endl;;
}
if(fhasEU){
status = fEUtr->GetEvent(0);
if(status<0)
cout << "first EURICA entry faulty!" << endl;
flocalEUts =((TArtEventInfo*) fEUeventinfo->At(0))->GetTimeStamp();
cout << "first EURICA timestamp: " << flocalEUts << endl;
status = fEUtr->GetEvent(fEUentries-1);
if(status<0)
cout << "last EURICA entry faulty!" << endl;
flocalEUts =((TArtEventInfo*) fEUeventinfo->At(0))->GetTimeStamp();
cout << "last EURICA timestamp: " << flocalEUts << endl;
}
}
flocalBRts = 0;
flocalWAts = 0;
flocalEUts = 0;
flocalbeam->Clear();
for(unsigned short f=0;f<NFPLANES;f++){
flocalfp[f]->Clear();
}
flocalwasabi->Clear();
flocaleurica->Clear();
flastBRts = 0;
flastWAts = 0;
flastEUts = 0;
fBRtsjump = false;
fWAtsjump = false;
fEUtsjump = false;
}
bool BuildEvents::ReadBigRIPS(){
if(fverbose>1)
cout << __PRETTY_FUNCTION__ << endl;
flocalbeam->Clear();
for(unsigned short f=0;f<NFPLANES;f++){
flocalfp[f]->Clear();
}
flocalBRts = 0;
if(fBRentry==fBRentries){
return false;
}
Int_t status = fBRtr->GetEvent(fBRentry);
if(fverbose>2)
cout << "status " << status << endl;
if(status == -1){
cerr<<"Error occured, couldn't read entry "<<fBRentry<<" from tree "<<fBRtr->GetName()<<endl;
return false;
}
else if(status == 0){
cerr<<"Error occured, entry "<<fBRentry<<" in tree "<<fBRtr->GetName()<<" in file doesn't exist"<<endl;
return false;
}
fnbytes += status;
if(flocalBRts<flastBRts){
cout << endl << "BigRIPS timestamp jump detected. this = " << flocalBRts << ", last = " << flastBRts << endl;
fBRtsjump = true;
return false;
}
if(fverbose>0)
cout << "read new bigrips with TS = " << flocalBRts << " tof = "<< flocalbeam->GetTOF(0)+48<< endl;
fBRentry++;
detector* det = new detector;
det->TS = flocalBRts;
det->ID = 0;
fdetectors.push_back(det);
flastBRts = flocalBRts;
return true;
}
bool BuildEvents::ReadWASABI(){
if(fverbose>1)
cout << __PRETTY_FUNCTION__ << endl;
flocalwasabi->Clear();
flocalWAts = 0;
if(fWAentry==fWAentries){
return false;
}
Int_t status = fWAtr->GetEvent(fWAentry);
if(fverbose>2)
cout << "status " << status << endl;
if(status == -1){
cerr<<"Error occured, couldn't read entry "<<fWAentry<<" from tree "<<fWAtr->GetName()<<endl;
return false;
}
else if(status == 0){
cerr<<"Error occured, entry "<<fWAentry<<" in tree "<<fWAtr->GetName()<<" in file doesn't exist"<<endl;
return false;
}
fnbytes += status;
if(flocalWAts<flastWAts){
cout <<"WASABI timestamp jump detected. this = " << flocalWAts << ", last = " << flastWAts << endl;
fWAtsjump = true;
return false;
}
if(fverbose>0)
cout << "read new wasabi with TS = " << flocalWAts << endl;
fWAentry++;
detector* det = new detector;
det->TS = flocalWAts;
det->ID = 1;
fdetectors.push_back(det);
flastWAts = flocalWAts;
return true;
}
bool BuildEvents::ReadEURICA(){
if(fverbose>1)
cout << __PRETTY_FUNCTION__ << endl;
if(fEUentry==fEUentries){
return false;
}
Int_t status = fEUtr->GetEvent(fEUentry);
if(fverbose>2)
cout << "status " << status << endl;
if(status == -1){
cerr<<"Error occured, couldn't read entry "<<fEUentry<<" from tree "<<fEUtr->GetName()<<endl;
return false;
}
else if(status == 0){
cerr<<"Error occured, entry "<<fEUentry<<" in tree "<<fEUtr->GetName()<<" in file doesn't exist"<<endl;
return false;
}
fnbytes += status;
flocalEUts = ((TArtEventInfo*) fEUeventinfo->At(0))->GetTimeStamp();
if(flocalEUts<flastEUts){
cout <<"EURICA timestamp jump detected. this = " << flocalEUts << ", last = " << flastEUts << endl;
fEUtsjump = true;
return false;
}
if(fverbose>0)
cout << "read new eurica with TS = " << flocalEUts << endl;
//cout << "fEUcluster->GetEntries() " << fEUcluster->GetEntries() << "\tfEUclusterAB->GetEntries() " << fEUclusterAB->GetEntries() << endl;
for(int i=0;i<fEUcluster->GetEntries();i++){
TArtGeCluster *hit =(TArtGeCluster*) fEUcluster->At(i);
if(hit->GetEnergy()>1){
if(fverbose>2)
cout << fEUentry << "\t" << i <<"\t" << hit->GetEnergy() << "\t" << hit->GetTiming() << endl;
EURICAHit *euhit = new EURICAHit(hit->GetChannel(),hit->GetEnergy(),hit->GetTiming(),1,flocalEUts);
flocaleurica->AddHit(euhit);
}
}
for(int i=0;i<fEUclusterAB->GetEntries();i++){
TArtGeCluster *hit =(TArtGeCluster*) fEUclusterAB->At(i);
if(hit->GetEnergy()>1){
if(fverbose>2)
cout << fEUentry << "\t" << i <<"\t" << hit->GetEnergy() << "\t" << hit->GetTiming() << endl;
EURICAHit *euhit = new EURICAHit(hit->GetChannel(),hit->GetEnergy(),hit->GetTiming(),1,flocalEUts);
flocaleurica->AddHitAB(euhit);
}
}
fEUentry++;
detector* det = new detector;
det->TS = flocalEUts;
det->ID = 2;
fdetectors.push_back(det);
flastEUts = flocalEUts;
return true;
}
bool BuildEvents::ReadEach(){
flastBRts = 0;
flastWAts = 0;
flastEUts = 0;
bool success = false;
if(fhasEU)
success += ReadEURICA();
if(fhasWA)
success += ReadWASABI();
if(fhasBR)
success += ReadBigRIPS();
if(success)
return true;
else{
cout << "failed to read from all WASABI, EURICA, and BigRIPS." << endl;
return false;
}
}
void BuildEvents::CloseEvent(){
if(fverbose>0)
cout << __PRETTY_FUNCTION__ << endl;
// // bool printme = false;
// if(fBRts>0 && fWAts >0){
// //printme = true;
// cout << "fBRentry = " << fBRentry << "\tfBRts = " << fBRts << ", fWAentry = " << fWAentry << "\tfWAts = " << fWAts << "\tmult = " << fwasabi->GetMult()<< endl;
// cout << "BR AoQ = " << fbeam->GetAQ(1) << " Z = " << fbeam->GetZ(1) << endl;
// fwasabi->Print();
// }
if(fverbose>0 && fBRts>0){
cout << "closing event with local TS = " << flocalBRts << " tof = "<< flocalbeam->GetTOF(0)+48<< endl;
cout << "closing event with set TS = " << fBRts << " tof = "<< fbeam->GetTOF(0)+48<< endl;
}
switch(fmode){
default:
case 0: //write all events
fmtr->Fill();
break;
case 1://isomer data BR and WA coincidence
if(fBRts>0 && fWAts >0)
fmtr->Fill();
break;
}
fBRts = 0;
fbeam->Clear();
for(unsigned short f=0;f<NFPLANES;f++){
ffp[f]->Clear();
}
fWAts = 0;
fwasabi->Clear();
fEUts = 0;
feurica->Clear();
// if(printme){
// cout << "after clearing " << endl;
// fwasabi->Print();
// }
if(fverbose>0)
cout << "end "<< __PRETTY_FUNCTION__ << endl;
}
bool BuildEvents::Merge(){
if(fverbose>1)
cout << __PRETTY_FUNCTION__ << endl;
if(fverbose>1){
cout << "before sorting" << endl;
for(vector<detector*>::iterator det=fdetectors.begin(); det!=fdetectors.end(); det++){
cout << "ID = " << (*det)->ID << ", TS = " << (*det)->TS << endl;
}
}
sort(fdetectors.begin(), fdetectors.end(),TSComparer());
if(fverbose>1){
cout << "after sorting" << endl;
for(vector<detector*>::iterator det=fdetectors.begin(); det!=fdetectors.end(); det++){
cout << "ID = " << (*det)->ID << ", TS = " << (*det)->TS << endl;
}
}
switch(fdetectors.at(0)->ID){
case 0: //BigRIPS
if(fBRts>0){
if(fverbose>1)
cout << "has already BigRIPS" << endl;
CloseEvent();
}
else if(flocalBRts - fcurrentts > fwindow){
if(fverbose>0)
cout << "BR larger than window" << endl;
CloseEvent();
}
fBRts = flocalBRts;
fbeam = (Beam*)flocalbeam->Clone();
for(unsigned short f=0;f<NFPLANES;f++){
ffp[f] = (FocalPlane*)flocalfp[f]->Clone(Form("fp_%d",f));
}
fcurrentts = fBRts;
fdetectors.erase(fdetectors.begin());
if(!ReadBigRIPS()&&fBRtsjump==false)
cout << "failed to read BigRIPS, end of file" << endl;
break;
case 1: //WASABI
if(flocalWAts - fcurrentts > fwindow){
if(fverbose>0)
cout << "WA larger than window" << endl;
CloseEvent();
}
fWAts = flocalWAts;
fwasabi = (WASABI*)flocalwasabi->Clone();
flocalwasabi->Clear();
fcurrentts = fWAts;
fdetectors.erase(fdetectors.begin());
if(!ReadWASABI()&&fWAtsjump==false)
cout << "failed to read WASABI, end of file" << endl;
break;
case 2: //EURICA
if(flocalEUts - fcurrentts > fwindow){
if(fverbose>0)
cout << "EU larger than window" << endl;
CloseEvent();
}
fEUts = flocalEUts;
feurica->AddHits(flocaleurica->GetHits());
feurica->AddHitsAB(flocaleurica->GetHitsAB());
flocaleurica->Clear();
fcurrentts = fEUts;
fdetectors.erase(fdetectors.begin());
if(!ReadEURICA()&&fEUtsjump==false)
cout << "failed to read EURICA, end of file" << endl;
break;
default:
break;
}
if(flastevent>0 && flastevent == (int)(fBRentry + fWAentry + fEUentry)){
cout << "last event reached " << endl;
return false;
}
if(fdetectors.size()==0){
if(fhasBR && fhasEU && fhasWA && fEUtsjump==true && fWAtsjump==true && fBRtsjump==true){
cout << "all timestamps jumped" << endl;
fEUtsjump = false;
fWAtsjump = false;
fBRtsjump = false;
return ReadEach();
}
if(fhasBR & fhasWA && fWAtsjump==true && fBRtsjump==true){
cout << "all timestamps jumped" << endl;
fWAtsjump = false;
fBRtsjump = false;
return ReadEach();
}
cout << "all files finished " << endl;
return false;
}
return true;
}
|
[
"wimmer@phys.s.u-tokyo.ac.jp"
] |
wimmer@phys.s.u-tokyo.ac.jp
|
56caa534f3655f9130ad83200fb21a75da56d60b
|
d97a35a1c944efb6250c71fdc25ac9af5c640e68
|
/ip/hls/pixel_unpack/solution1/syn/systemc/pixel_unpack.h
|
8e95d487c51728349713add1120f8e9c928671b9
|
[
"BSD-3-Clause"
] |
permissive
|
DeLaVlag/C-VHDL-FPGA-Pynq-z1
|
d8e1e4e1de732c227850b8794c21805ff52c883e
|
af565af98d6eabb55c5212b0b1d0832a04ce2349
|
refs/heads/master
| 2021-09-13T22:42:46.752639
| 2018-02-06T20:02:45
| 2018-02-06T20:02:45
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 10,688
|
h
|
// ==============================================================
// RTL generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC
// Version: 2016.1
// Copyright (C) 1986-2016 Xilinx, Inc. All Rights Reserved.
//
// ===========================================================
#ifndef _pixel_unpack_HH_
#define _pixel_unpack_HH_
#include "systemc.h"
#include "AESL_pkg.h"
#include "pixel_unpack_AXILiteS_s_axi.h"
namespace ap_rtl {
template<unsigned int C_S_AXI_AXILITES_ADDR_WIDTH = 5,
unsigned int C_S_AXI_AXILITES_DATA_WIDTH = 32>
struct pixel_unpack : public sc_module {
// Port declarations 31
sc_in_clk ap_clk;
sc_in< sc_logic > ap_rst_n;
sc_in< sc_lv<32> > in_stream_TDATA;
sc_in< sc_logic > in_stream_TVALID;
sc_out< sc_logic > in_stream_TREADY;
sc_in< sc_lv<1> > in_stream_TUSER;
sc_in< sc_lv<1> > in_stream_TLAST;
sc_out< sc_lv<24> > out_stream_TDATA;
sc_out< sc_logic > out_stream_TVALID;
sc_in< sc_logic > out_stream_TREADY;
sc_out< sc_lv<1> > out_stream_TUSER;
sc_out< sc_lv<1> > out_stream_TLAST;
sc_in< sc_logic > s_axi_AXILiteS_AWVALID;
sc_out< sc_logic > s_axi_AXILiteS_AWREADY;
sc_in< sc_uint<C_S_AXI_AXILITES_ADDR_WIDTH> > s_axi_AXILiteS_AWADDR;
sc_in< sc_logic > s_axi_AXILiteS_WVALID;
sc_out< sc_logic > s_axi_AXILiteS_WREADY;
sc_in< sc_uint<C_S_AXI_AXILITES_DATA_WIDTH> > s_axi_AXILiteS_WDATA;
sc_in< sc_uint<C_S_AXI_AXILITES_DATA_WIDTH/8> > s_axi_AXILiteS_WSTRB;
sc_in< sc_logic > s_axi_AXILiteS_ARVALID;
sc_out< sc_logic > s_axi_AXILiteS_ARREADY;
sc_in< sc_uint<C_S_AXI_AXILITES_ADDR_WIDTH> > s_axi_AXILiteS_ARADDR;
sc_out< sc_logic > s_axi_AXILiteS_RVALID;
sc_in< sc_logic > s_axi_AXILiteS_RREADY;
sc_out< sc_uint<C_S_AXI_AXILITES_DATA_WIDTH> > s_axi_AXILiteS_RDATA;
sc_out< sc_lv<2> > s_axi_AXILiteS_RRESP;
sc_out< sc_logic > s_axi_AXILiteS_BVALID;
sc_in< sc_logic > s_axi_AXILiteS_BREADY;
sc_out< sc_lv<2> > s_axi_AXILiteS_BRESP;
sc_in_clk control;
sc_in< sc_logic > ap_rst_n_control;
sc_signal< sc_logic > ap_var_for_const0;
// Module declarations
pixel_unpack(sc_module_name name);
SC_HAS_PROCESS(pixel_unpack);
~pixel_unpack();
sc_trace_file* mVcdFile;
ofstream mHdltvinHandle;
ofstream mHdltvoutHandle;
pixel_unpack_AXILiteS_s_axi<C_S_AXI_AXILITES_ADDR_WIDTH,C_S_AXI_AXILITES_DATA_WIDTH>* pixel_unpack_AXILiteS_s_axi_U;
sc_signal< sc_logic > ap_rst_n_inv;
sc_signal< sc_lv<32> > mode;
sc_signal< sc_lv<32> > mode_0_data_reg;
sc_signal< sc_logic > mode_0_vld_reg;
sc_signal< sc_logic > mode_0_ack_out;
sc_signal< sc_logic > in_stream_TDATA_blk_n;
sc_signal< sc_lv<16> > ap_CS_fsm;
sc_signal< sc_logic > ap_sig_cseq_ST_pp4_stg0_fsm_11;
sc_signal< bool > ap_sig_66;
sc_signal< sc_logic > ap_reg_ppiten_pp4_it0;
sc_signal< sc_logic > ap_reg_ppiten_pp4_it1;
sc_signal< sc_logic > ap_sig_cseq_ST_pp4_stg1_fsm_12;
sc_signal< bool > ap_sig_78;
sc_signal< sc_logic > ap_sig_cseq_ST_pp4_stg2_fsm_13;
sc_signal< bool > ap_sig_87;
sc_signal< sc_logic > ap_sig_cseq_ST_st11_fsm_10;
sc_signal< bool > ap_sig_96;
sc_signal< sc_logic > ap_sig_cseq_ST_st7_fsm_6;
sc_signal< bool > ap_sig_104;
sc_signal< sc_logic > ap_sig_cseq_ST_st5_fsm_4;
sc_signal< bool > ap_sig_112;
sc_signal< sc_logic > ap_sig_cseq_ST_st3_fsm_2;
sc_signal< bool > ap_sig_120;
sc_signal< sc_logic > out_stream_TDATA_blk_n;
sc_signal< sc_logic > ap_sig_cseq_ST_pp4_stg3_fsm_14;
sc_signal< bool > ap_sig_129;
sc_signal< sc_logic > ap_sig_cseq_ST_st8_fsm_7;
sc_signal< bool > ap_sig_144;
sc_signal< sc_logic > ap_sig_cseq_ST_st9_fsm_8;
sc_signal< bool > ap_sig_152;
sc_signal< sc_logic > ap_sig_cseq_ST_st10_fsm_9;
sc_signal< bool > ap_sig_160;
sc_signal< sc_logic > ap_sig_cseq_ST_st6_fsm_5;
sc_signal< bool > ap_sig_169;
sc_signal< sc_logic > ap_sig_cseq_ST_st4_fsm_3;
sc_signal< bool > ap_sig_178;
sc_signal< sc_logic > ap_rst_n_control_inv;
sc_signal< sc_lv<8> > reg_181;
sc_signal< sc_logic > ap_sig_ioackin_out_stream_TREADY;
sc_signal< sc_lv<8> > grp_fu_151_p4;
sc_signal< sc_lv<8> > reg_185;
sc_signal< sc_lv<8> > reg_189;
sc_signal< sc_lv<16> > reg_193;
sc_signal< sc_lv<1> > grp_fu_136_p1;
sc_signal< sc_lv<1> > last_2_reg_342;
sc_signal< sc_lv<1> > last_1_reg_347;
sc_signal< sc_lv<1> > last_reg_352;
sc_signal< sc_lv<1> > empty_reg_360_1;
sc_signal< sc_lv<1> > empty_reg_360_2;
sc_signal< sc_lv<24> > tmp_2_fu_264_p1;
sc_signal< sc_lv<24> > tmp_2_reg_366;
sc_signal< sc_lv<1> > empty_4_reg_371_1;
sc_signal< sc_lv<1> > empty_4_reg_371_2;
sc_signal< sc_lv<16> > tmp_4_fu_268_p1;
sc_signal< sc_lv<16> > tmp_4_reg_377;
sc_signal< sc_lv<1> > last_9_2_fu_303_p2;
sc_signal< sc_lv<1> > last_9_2_reg_382;
sc_signal< sc_lv<8> > tmp_6_fu_309_p1;
sc_signal< sc_lv<8> > tmp_6_reg_387;
sc_signal< sc_lv<24> > p_Result_3_3_reg_392;
sc_signal< sc_logic > ap_sig_cseq_ST_st2_fsm_1;
sc_signal< bool > ap_sig_281;
sc_signal< sc_lv<32> > grp_read_fu_96_p2;
sc_signal< sc_lv<24> > p_Result_2_fu_201_p3;
sc_signal< sc_lv<24> > p_Result_14_1_fu_210_p4;
sc_signal< sc_lv<24> > p_Result_8_fu_225_p1;
sc_signal< sc_lv<24> > p_Result_8_1_fu_230_p1;
sc_signal< sc_lv<24> > p_Result_6_fu_239_p1;
sc_signal< sc_lv<24> > p_Result_6_1_fu_244_p1;
sc_signal< sc_lv<24> > p_Result_6_2_fu_249_p1;
sc_signal< sc_lv<24> > p_Result_6_3_fu_254_p1;
sc_signal< sc_lv<24> > tmp_9_fu_259_p1;
sc_signal< sc_lv<24> > p_Result_3_1_fu_323_p3;
sc_signal< sc_lv<24> > p_Result_3_2_fu_331_p3;
sc_signal< sc_lv<1> > has_user_V_2_fu_290_p2;
sc_signal< sc_logic > ap_reg_ioackin_out_stream_TREADY;
sc_signal< sc_lv<16> > tmp_12_fu_197_p1;
sc_signal< sc_lv<16> > tmp_11_fu_221_p1;
sc_signal< sc_lv<8> > tmp_10_fu_235_p1;
sc_signal< sc_lv<1> > tmp4_fu_284_p2;
sc_signal< sc_lv<1> > tmp5_fu_297_p2;
sc_signal< sc_logic > ap_sig_cseq_ST_st18_fsm_15;
sc_signal< bool > ap_sig_544;
sc_signal< sc_lv<16> > ap_NS_fsm;
static const sc_logic ap_const_logic_1;
static const sc_logic ap_const_logic_0;
static const sc_lv<16> ap_ST_st1_fsm_0;
static const sc_lv<16> ap_ST_st2_fsm_1;
static const sc_lv<16> ap_ST_st3_fsm_2;
static const sc_lv<16> ap_ST_st4_fsm_3;
static const sc_lv<16> ap_ST_st5_fsm_4;
static const sc_lv<16> ap_ST_st6_fsm_5;
static const sc_lv<16> ap_ST_st7_fsm_6;
static const sc_lv<16> ap_ST_st8_fsm_7;
static const sc_lv<16> ap_ST_st9_fsm_8;
static const sc_lv<16> ap_ST_st10_fsm_9;
static const sc_lv<16> ap_ST_st11_fsm_10;
static const sc_lv<16> ap_ST_pp4_stg0_fsm_11;
static const sc_lv<16> ap_ST_pp4_stg1_fsm_12;
static const sc_lv<16> ap_ST_pp4_stg2_fsm_13;
static const sc_lv<16> ap_ST_pp4_stg3_fsm_14;
static const sc_lv<16> ap_ST_st18_fsm_15;
static const sc_lv<32> ap_const_lv32_0;
static const sc_lv<32> ap_const_lv32_B;
static const sc_lv<1> ap_const_lv1_1;
static const sc_lv<32> ap_const_lv32_C;
static const sc_lv<32> ap_const_lv32_D;
static const sc_lv<32> ap_const_lv32_A;
static const sc_lv<32> ap_const_lv32_6;
static const sc_lv<32> ap_const_lv32_4;
static const sc_lv<32> ap_const_lv32_2;
static const sc_lv<32> ap_const_lv32_E;
static const sc_lv<32> ap_const_lv32_7;
static const sc_lv<32> ap_const_lv32_8;
static const sc_lv<32> ap_const_lv32_9;
static const sc_lv<32> ap_const_lv32_5;
static const sc_lv<32> ap_const_lv32_3;
static const int C_S_AXI_DATA_WIDTH;
static const sc_lv<32> ap_const_lv32_1;
static const sc_lv<1> ap_const_lv1_0;
static const sc_lv<32> ap_const_lv32_F;
static const sc_lv<32> ap_const_lv32_18;
static const sc_lv<32> ap_const_lv32_1F;
static const sc_lv<32> ap_const_lv32_10;
static const sc_lv<32> ap_const_lv32_17;
// Thread declarations
void thread_ap_var_for_const0();
void thread_ap_clk_no_reset_();
void thread_ap_rst_n_control_inv();
void thread_ap_rst_n_inv();
void thread_ap_sig_104();
void thread_ap_sig_112();
void thread_ap_sig_120();
void thread_ap_sig_129();
void thread_ap_sig_144();
void thread_ap_sig_152();
void thread_ap_sig_160();
void thread_ap_sig_169();
void thread_ap_sig_178();
void thread_ap_sig_281();
void thread_ap_sig_544();
void thread_ap_sig_66();
void thread_ap_sig_78();
void thread_ap_sig_87();
void thread_ap_sig_96();
void thread_ap_sig_cseq_ST_pp4_stg0_fsm_11();
void thread_ap_sig_cseq_ST_pp4_stg1_fsm_12();
void thread_ap_sig_cseq_ST_pp4_stg2_fsm_13();
void thread_ap_sig_cseq_ST_pp4_stg3_fsm_14();
void thread_ap_sig_cseq_ST_st10_fsm_9();
void thread_ap_sig_cseq_ST_st11_fsm_10();
void thread_ap_sig_cseq_ST_st18_fsm_15();
void thread_ap_sig_cseq_ST_st2_fsm_1();
void thread_ap_sig_cseq_ST_st3_fsm_2();
void thread_ap_sig_cseq_ST_st4_fsm_3();
void thread_ap_sig_cseq_ST_st5_fsm_4();
void thread_ap_sig_cseq_ST_st6_fsm_5();
void thread_ap_sig_cseq_ST_st7_fsm_6();
void thread_ap_sig_cseq_ST_st8_fsm_7();
void thread_ap_sig_cseq_ST_st9_fsm_8();
void thread_ap_sig_ioackin_out_stream_TREADY();
void thread_grp_fu_136_p1();
void thread_grp_fu_151_p4();
void thread_grp_read_fu_96_p2();
void thread_has_user_V_2_fu_290_p2();
void thread_in_stream_TDATA_blk_n();
void thread_in_stream_TREADY();
void thread_last_9_2_fu_303_p2();
void thread_mode_0_ack_out();
void thread_out_stream_TDATA();
void thread_out_stream_TDATA_blk_n();
void thread_out_stream_TLAST();
void thread_out_stream_TUSER();
void thread_out_stream_TVALID();
void thread_p_Result_14_1_fu_210_p4();
void thread_p_Result_2_fu_201_p3();
void thread_p_Result_3_1_fu_323_p3();
void thread_p_Result_3_2_fu_331_p3();
void thread_p_Result_6_1_fu_244_p1();
void thread_p_Result_6_2_fu_249_p1();
void thread_p_Result_6_3_fu_254_p1();
void thread_p_Result_6_fu_239_p1();
void thread_p_Result_8_1_fu_230_p1();
void thread_p_Result_8_fu_225_p1();
void thread_tmp4_fu_284_p2();
void thread_tmp5_fu_297_p2();
void thread_tmp_10_fu_235_p1();
void thread_tmp_11_fu_221_p1();
void thread_tmp_12_fu_197_p1();
void thread_tmp_2_fu_264_p1();
void thread_tmp_4_fu_268_p1();
void thread_tmp_6_fu_309_p1();
void thread_tmp_9_fu_259_p1();
void thread_ap_NS_fsm();
void thread_hdltv_gen();
};
}
using namespace ap_rtl;
#endif
|
[
"m.a.van.der.vlag@hr.nl"
] |
m.a.van.der.vlag@hr.nl
|
f0664835692629ce18a3a2b68cd7badf23be4f39
|
5ad92e61fd0b5b238a95b922e111cbae79584e1b
|
/src/Frameworks/PythonFramework/PythonValueFollowerLinear.cpp
|
d5809c2e64935fdfdc92add1fdabf4f8f49b1cb1
|
[
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] |
permissive
|
hsjsjsjdjwksks/Mengine
|
f44022d19411ff67514de5efe2ef166a63189b85
|
41c659ccf76236ee8cb206b8aa6849aa83f8ca26
|
refs/heads/master
| 2022-12-16T23:29:25.644129
| 2020-09-15T22:25:25
| 2020-09-15T22:25:25
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 2,666
|
cpp
|
#include "PythonValueFollowerLinear.h"
namespace Mengine
{
//////////////////////////////////////////////////////////////////////////
PythonValueFollowerLinear::PythonValueFollowerLinear()
: m_cacheValue( 0.f )
{
}
//////////////////////////////////////////////////////////////////////////
PythonValueFollowerLinear::~PythonValueFollowerLinear()
{
}
//////////////////////////////////////////////////////////////////////////
bool PythonValueFollowerLinear::initialize( float _value, float _speed, const pybind::object & _cb, const pybind::args & _args )
{
this->resetValue( _value );
this->setSpeed( _speed );
this->setCb( _cb, _args );
m_cacheValue = _value;
return true;
}
//////////////////////////////////////////////////////////////////////////
void PythonValueFollowerLinear::setSpeed( float _value )
{
m_valueFollower.setSpeed( _value );
}
//////////////////////////////////////////////////////////////////////////
float PythonValueFollowerLinear::getSpeed() const
{
float value = m_valueFollower.getSpeed();
return value;
}
//////////////////////////////////////////////////////////////////////////
void PythonValueFollowerLinear::setFollow( float _value )
{
m_valueFollower.setFollow( _value );
}
//////////////////////////////////////////////////////////////////////////
float PythonValueFollowerLinear::getFollow() const
{
float value = m_valueFollower.getFollow();
return value;
}
//////////////////////////////////////////////////////////////////////////
void PythonValueFollowerLinear::setValue( float _value )
{
m_valueFollower.setValue( _value );
}
//////////////////////////////////////////////////////////////////////////
float PythonValueFollowerLinear::getValue() const
{
float value = m_valueFollower.getValue();
return value;
}
//////////////////////////////////////////////////////////////////////////
void PythonValueFollowerLinear::resetValue( float _value )
{
m_valueFollower.reset( _value );
}
//////////////////////////////////////////////////////////////////////////
bool PythonValueFollowerLinear::_affect( const UpdateContext * _context, float * const _used )
{
m_valueFollower.update( _context, _used );
float value = m_valueFollower.getValue();
if( m_cacheValue != value )
{
m_cacheValue = value;
this->callCb( value );
}
return false;
}
}
|
[
"irov13@mail.ru"
] |
irov13@mail.ru
|
b83ff9ba4c1d27d598b15110fa5daa2042e398c3
|
0aa376a84f94297a197e028b5a84b8c41d02cab4
|
/windows/runner/main.cpp
|
2e3f2645a3280f3fa30e8f51287616afcb226a26
|
[] |
no_license
|
AmjadAli29/new_aws_auth
|
48d24b285380c3b90fdadba5cd3f90dc4c095f11
|
4cb5184ae8acfe6bd4617254dbb8970de6e21759
|
refs/heads/master
| 2023-03-24T09:30:17.995893
| 2021-03-12T07:19:08
| 2021-03-12T07:19:08
| 346,971,451
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,222
|
cpp
|
#include <flutter/dart_project.h>
#include <flutter/flutter_view_controller.h>
#include <windows.h>
#include "flutter_window.h"
#include "run_loop.h"
#include "utils.h"
int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev,
_In_ wchar_t *command_line, _In_ int show_command) {
// Attach to console when present (e.g., 'flutter run') or create a
// new console when running with a debugger.
if (!::AttachConsole(ATTACH_PARENT_PROCESS) && ::IsDebuggerPresent()) {
CreateAndAttachConsole();
}
// Initialize COM, so that it is available for use in the library and/or
// plugins.
::CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED);
RunLoop run_loop;
flutter::DartProject project(L"data");
std::vector<std::string> command_line_arguments =
GetCommandLineArguments();
project.set_dart_entrypoint_arguments(std::move(command_line_arguments));
FlutterWindow window(&run_loop, project);
Win32Window::Point origin(10, 10);
Win32Window::Size size(1280, 720);
if (!window.CreateAndShow(L"new_aws_auth", origin, size)) {
return EXIT_FAILURE;
}
window.SetQuitOnClose(true);
run_loop.Run();
::CoUninitialize();
return EXIT_SUCCESS;
}
|
[
"amjadalibrw1@gmail.com"
] |
amjadalibrw1@gmail.com
|
919465fa5c8ece35257634b03664a4f04d63bf41
|
0d6560bb341dca5ab9a5c0f4c9fb3970e2fdb035
|
/POSCAT/upload/code/acmicpc/1924.cpp
|
7d113bc7e3078e27c201c81e23d53581dedce409
|
[] |
no_license
|
yougatup/yougatup.github.io
|
7737d70baceab147fed645d40cd63f66f2be22bd
|
194626540a90b15d9b9279e185886c701385bb7f
|
refs/heads/master
| 2020-04-12T05:39:11.078724
| 2016-10-14T01:28:23
| 2016-10-14T01:28:23
| 65,126,836
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 334
|
cpp
|
#include <iostream>
#include <string>
using namespace std;
int main()
{
int x,y;
int i,sum=0;
string week[]={"MON","TUE","WED","THU","FRI","SAT","SUN"};
int month[]={0,31,28,31,30,31,30,31,31,30,31,30,31};
cin>>x>>y;
for(i=1;i<x;i++)
sum+=month[i];
sum+=y-1;
cout<<week[sum%7]<<endl;
return 0;
}
|
[
"yougatup@gmail.com"
] |
yougatup@gmail.com
|
b3f1bb62969f75ffa59bbc5d63f8a6232762e81e
|
db7ffb184efb3b9d83c65066b0fa11e4c8c034d5
|
/find_second_largest_element_dx/main.cpp
|
1f4b44e30fa62b12ecc6ab14c0a7960ee52f4bb6
|
[] |
no_license
|
sakishum/My_Algorithm
|
ef17e85c6303b074030f14f492791356636dfb8a
|
7a00f5eeef22ba9feb85c9fdba77ad1c04728fc7
|
refs/heads/master
| 2021-01-22T08:10:35.923075
| 2017-02-13T23:51:00
| 2017-02-13T23:51:00
| 81,883,503
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,157
|
cpp
|
#include <cstdlib>
#include <iostream>
// You could either initialize largest and second to an appropriate lower bound,
// or to the first two items in the list(check which one is bigger, and don't forget
// to check if the list has least two items).
// O(n)
int find_second(int array[], int len) {
if (!len || len == 1) {
return -1;
}
int count = 0;
int maxVal = array[0] > array[1] ? array[0] : array[1];
int smaxVal = array[0] + array[1] - maxVal;
for (int i = 2; i != len; ++i) {
if (array[i] > maxVal) {
smaxVal = maxVal;
maxVal = array[i];
} else if (array[i] < maxVal && array[i] > smaxVal) {
smaxVal = array[i];
}
++count;
std::cout << "large: " << maxVal << ", second: " << smaxVal << std::endl;
}
std::cout << "len: " << len << ", i: " << count << std::endl;
return smaxVal;
}
int main(void) {
int array[] = {4,2,5,3,8,6,9,1,0,7};
//int array[] = {3};
for (int i = 0; i != sizeof(array)/sizeof(array[0]); ++i) {
std::cout << array[i] << ", ";
}
std::cout << std::endl;
std::cout << "second largest element is " << find_second(array, sizeof(array)/sizeof(array[0])) << std::endl;
return EXIT_SUCCESS;
}
|
[
"sakishum11118@gmail.com"
] |
sakishum11118@gmail.com
|
321a20002de328e286e770ca8f069adcfce20f55
|
664df3a535be1546be80041996f3a9c7a3114beb
|
/Source/TrianglesTechDemo/TrianglesTechDemoCharacter.cpp
|
29ec5acbafaa297961583a5a3fc6f344c36bdef8
|
[] |
no_license
|
TytusNawara/TrianglesTechDemo
|
97735000924a4b3be7040ec51e5ce95d4072d34f
|
9c76aaa2de19c7c977af4e7ab37bc38c48ea7d10
|
refs/heads/main
| 2023-03-24T00:00:23.275162
| 2021-03-15T21:35:37
| 2021-03-15T21:35:37
| 347,967,953
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 5,953
|
cpp
|
// Copyright Epic Games, Inc. All Rights Reserved.
#include "TrianglesTechDemoCharacter.h"
#include "HeadMountedDisplayFunctionLibrary.h"
#include "Camera/CameraComponent.h"
#include "Components/CapsuleComponent.h"
#include "Components/InputComponent.h"
#include "GameFramework/CharacterMovementComponent.h"
#include "GameFramework/Controller.h"
#include "GameFramework/SpringArmComponent.h"
//////////////////////////////////////////////////////////////////////////
// ATrianglesTechDemoCharacter
ATrianglesTechDemoCharacter::ATrianglesTechDemoCharacter()
{
// Set size for collision capsule
GetCapsuleComponent()->InitCapsuleSize(42.f, 96.0f);
// set our turn rates for input
BaseTurnRate = 45.f;
BaseLookUpRate = 45.f;
// Don't rotate when the controller rotates. Let that just affect the camera.
bUseControllerRotationPitch = false;
bUseControllerRotationYaw = false;
bUseControllerRotationRoll = false;
// Configure character movement
GetCharacterMovement()->bOrientRotationToMovement = true; // Character moves in the direction of input...
GetCharacterMovement()->RotationRate = FRotator(0.0f, 540.0f, 0.0f); // ...at this rotation rate
GetCharacterMovement()->JumpZVelocity = 600.f;
GetCharacterMovement()->AirControl = 0.2f;
// Create a camera boom (pulls in towards the player if there is a collision)
CameraBoom = CreateDefaultSubobject<USpringArmComponent>(TEXT("CameraBoom"));
CameraBoom->SetupAttachment(RootComponent);
CameraBoom->TargetArmLength = 300.0f; // The camera follows at this distance behind the character
CameraBoom->bUsePawnControlRotation = true; // Rotate the arm based on the controller
// Create a follow camera
FollowCamera = CreateDefaultSubobject<UCameraComponent>(TEXT("FollowCamera"));
FollowCamera->SetupAttachment(CameraBoom, USpringArmComponent::SocketName); // Attach the camera to the end of the boom and let the boom adjust to match the controller orientation
FollowCamera->bUsePawnControlRotation = false; // Camera does not rotate relative to arm
// Note: The skeletal mesh and anim blueprint references on the Mesh component (inherited from Character)
// are set in the derived blueprint asset named MyCharacter (to avoid direct content references in C++)
}
//////////////////////////////////////////////////////////////////////////
// Input
void ATrianglesTechDemoCharacter::SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent)
{
// Set up gameplay key bindings
check(PlayerInputComponent);
PlayerInputComponent->BindAction("Jump", IE_Pressed, this, &ACharacter::Jump);
PlayerInputComponent->BindAction("Jump", IE_Released, this, &ACharacter::StopJumping);
PlayerInputComponent->BindAxis("MoveForward", this, &ATrianglesTechDemoCharacter::MoveForward);
PlayerInputComponent->BindAxis("MoveRight", this, &ATrianglesTechDemoCharacter::MoveRight);
// We have 2 versions of the rotation bindings to handle different kinds of devices differently
// "turn" handles devices that provide an absolute delta, such as a mouse.
// "turnrate" is for devices that we choose to treat as a rate of change, such as an analog joystick
PlayerInputComponent->BindAxis("Turn", this, &APawn::AddControllerYawInput);
PlayerInputComponent->BindAxis("TurnRate", this, &ATrianglesTechDemoCharacter::TurnAtRate);
PlayerInputComponent->BindAxis("LookUp", this, &APawn::AddControllerPitchInput);
PlayerInputComponent->BindAxis("LookUpRate", this, &ATrianglesTechDemoCharacter::LookUpAtRate);
// handle touch devices
PlayerInputComponent->BindTouch(IE_Pressed, this, &ATrianglesTechDemoCharacter::TouchStarted);
PlayerInputComponent->BindTouch(IE_Released, this, &ATrianglesTechDemoCharacter::TouchStopped);
// VR headset functionality
PlayerInputComponent->BindAction("ResetVR", IE_Pressed, this, &ATrianglesTechDemoCharacter::OnResetVR);
}
void ATrianglesTechDemoCharacter::OnResetVR()
{
// If TrianglesTechDemo is added to a project via 'Add Feature' in the Unreal Editor the dependency on HeadMountedDisplay in TrianglesTechDemo.Build.cs is not automatically propagated
// and a linker error will result.
// You will need to either:
// Add "HeadMountedDisplay" to [YourProject].Build.cs PublicDependencyModuleNames in order to build successfully (appropriate if supporting VR).
// or:
// Comment or delete the call to ResetOrientationAndPosition below (appropriate if not supporting VR)
UHeadMountedDisplayFunctionLibrary::ResetOrientationAndPosition();
}
void ATrianglesTechDemoCharacter::TouchStarted(ETouchIndex::Type FingerIndex, FVector Location)
{
Jump();
}
void ATrianglesTechDemoCharacter::TouchStopped(ETouchIndex::Type FingerIndex, FVector Location)
{
StopJumping();
}
void ATrianglesTechDemoCharacter::TurnAtRate(float Rate)
{
// calculate delta for this frame from the rate information
AddControllerYawInput(Rate * BaseTurnRate * GetWorld()->GetDeltaSeconds());
}
void ATrianglesTechDemoCharacter::LookUpAtRate(float Rate)
{
// calculate delta for this frame from the rate information
AddControllerPitchInput(Rate * BaseLookUpRate * GetWorld()->GetDeltaSeconds());
}
void ATrianglesTechDemoCharacter::MoveForward(float Value)
{
if ((Controller != nullptr) && (Value != 0.0f))
{
// find out which way is forward
const FRotator Rotation = Controller->GetControlRotation();
const FRotator YawRotation(0, Rotation.Yaw, 0);
// get forward vector
const FVector Direction = FRotationMatrix(YawRotation).GetUnitAxis(EAxis::X);
AddMovementInput(Direction, Value);
}
}
void ATrianglesTechDemoCharacter::MoveRight(float Value)
{
if ( (Controller != nullptr) && (Value != 0.0f) )
{
// find out which way is right
const FRotator Rotation = Controller->GetControlRotation();
const FRotator YawRotation(0, Rotation.Yaw, 0);
// get right vector
const FVector Direction = FRotationMatrix(YawRotation).GetUnitAxis(EAxis::Y);
// add movement in that direction
AddMovementInput(Direction, Value);
}
}
|
[
"tytusnawara@gmail.com"
] |
tytusnawara@gmail.com
|
455d7ef623522397cbed9fb3e28d91ffcd314988
|
c99563482d18ebb50c3bdd3feb3e3f821f7cccc4
|
/src/qt/notificator.h
|
f5488519bdf2342a2e18f6a54495ce480fed0481
|
[
"MIT"
] |
permissive
|
matsuiny2004/BookCoin
|
afa85971ae01a17a9d53c3fdcdc1cca7db05270e
|
23ad19110babe6b0cdd80b62eec314d3c270938b
|
refs/heads/master
| 2020-04-13T22:01:41.080231
| 2018-11-18T17:39:14
| 2018-11-18T17:39:14
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 2,875
|
h
|
// Copyright (c) 2011-2015 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef BITCOIN_QT_NOTIFICATOR_H
#define BITCOIN_QT_NOTIFICATOR_H
#if defined(HAVE_CONFIG_H)
#include "config/book-config.h"
#endif
#include <QIcon>
#include <QObject>
QT_BEGIN_NAMESPACE
class QSystemTrayIcon;
#ifdef USE_DBUS
class QDBusInterface;
#endif
QT_END_NAMESPACE
/** Cross-platform desktop notification client. */
class Notificator: public QObject
{
Q_OBJECT
public:
/** Create a new notificator.
@note Ownership of trayIcon is not transferred to this object.
*/
Notificator(const QString &programName, QSystemTrayIcon *trayIcon, QWidget *parent);
~Notificator();
// Message class
enum Class
{
Information, /**< Informational message */
Warning, /**< Notify user of potential problem */
Critical /**< An error occurred */
};
public Q_SLOTS:
/** Show notification message.
@param[in] cls general message class
@param[in] title title shown with message
@param[in] text message content
@param[in] icon optional icon to show with message
@param[in] millisTimeout notification timeout in milliseconds (defaults to 10 seconds)
@note Platform implementations are free to ignore any of the provided fields except for \a text.
*/
void notify(Class cls, const QString &title, const QString &text,
const QIcon &icon = QIcon(), int millisTimeout = 10000);
private:
QWidget *parent;
enum Mode {
None, /**< Ignore informational notifications, and show a modal pop-up dialog for Critical notifications. */
Freedesktop, /**< Use DBus org.freedesktop.Notifications */
QSystemTray, /**< Use QSystemTray::showMessage */
Growl12, /**< Use the Growl 1.2 notification system (Mac only) */
Growl13, /**< Use the Growl 1.3 notification system (Mac only) */
UserNotificationCenter /**< Use the 10.8+ User Notification Center (Mac only) */
};
QString programName;
Mode mode;
QSystemTrayIcon *trayIcon;
#ifdef USE_DBUS
QDBusInterface *interface;
void notifyDBus(Class cls, const QString &title, const QString &text, const QIcon &icon, int millisTimeout);
#endif
void notifySystray(Class cls, const QString &title, const QString &text, const QIcon &icon, int millisTimeout);
#ifdef Q_OS_MAC
void notifyGrowl(Class cls, const QString &title, const QString &text, const QIcon &icon);
void notifyMacUserNotificationCenter(Class cls, const QString &title, const QString &text, const QIcon &icon);
#endif
};
#endif // BITCOIN_QT_NOTIFICATOR_H
|
[
"bookcoin@protonmail.com"
] |
bookcoin@protonmail.com
|
5b89d0fce4e8a3ac8fee801f7a36dfec3fad3f3b
|
1147139acfd471508adeedb652a3f88dbe54496c
|
/hcnet-core/src/util/Fs.cpp
|
af804c8309f88f078fe625b2e4bf4d32877ec2de
|
[
"Apache-2.0",
"BSD-3-Clause",
"BSL-1.0",
"MIT",
"LicenseRef-scancode-public-domain",
"BSD-2-Clause"
] |
permissive
|
shanhashcah/HcNet-coreV15-test
|
f8287643138e1717d2a5f3f80696ed69c5261e06
|
f893161cce060e90aa6cd60eed448415823773cb
|
refs/heads/master
| 2023-01-24T13:42:23.257709
| 2020-12-08T07:54:51
| 2020-12-08T07:54:51
| 312,516,694
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 13,357
|
cpp
|
// Copyright 2015 Hcnet Development Foundation and contributors. Licensed
// under the Apache License, Version 2.0. See the COPYING file at the root
// of this distribution or at http://www.apache.org/licenses/LICENSE-2.0
#include "util/Fs.h"
#include "crypto/Hex.h"
#include "util/FileSystemException.h"
#include "util/Logging.h"
#include <Tracy.hpp>
#include <fmt/format.h>
#include <map>
#include <regex>
#include <sstream>
#ifdef _WIN32
#include <direct.h>
// Latest version of VC++ complains without this define (confused by C++ 17)
#define _SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING 1
#include <experimental/filesystem>
#include <io.h>
#else
#include <dirent.h>
#include <sys/resource.h>
#include <sys/stat.h>
#endif
#include <cstdio>
namespace hcnet
{
namespace fs
{
#ifdef _WIN32
#include <Shellapi.h>
#include <Windows.h>
#include <psapi.h>
static std::map<std::string, HANDLE> lockMap;
void
lockFile(std::string const& path)
{
ZoneScoped;
std::ostringstream errmsg;
if (lockMap.find(path) != lockMap.end())
{
errmsg << "file already locked by this process: " << path;
throw std::runtime_error(errmsg.str());
}
HANDLE h = ::CreateFile(path.c_str(), GENERIC_WRITE,
0, // don't allow sharing
NULL, CREATE_ALWAYS,
FILE_ATTRIBUTE_NORMAL | FILE_ATTRIBUTE_TEMPORARY |
FILE_FLAG_DELETE_ON_CLOSE,
NULL);
if (h == INVALID_HANDLE_VALUE)
{
// not sure if there is more verbose info that can be obtained here
errmsg << "unable to create lock file: " << path;
throw FileSystemException(errmsg.str());
}
lockMap.insert(std::make_pair(path, h));
}
void
unlockFile(std::string const& path)
{
ZoneScoped;
auto it = lockMap.find(path);
if (it != lockMap.end())
{
::CloseHandle(it->second);
lockMap.erase(it);
}
else
{
throw std::runtime_error("file was not locked");
}
}
void
flushFileChanges(native_handle_t fh)
{
ZoneScoped;
if (FlushFileBuffers(fh) == FALSE)
{
FileSystemException::failWithGetLastError(
"fs::flushFileChanges() failed on _get_osfhandle(): ");
}
}
bool
shouldUseRandomAccessHandle(std::string const& path)
{
// Named pipes use stream mode, everything else uses random access.
return path.find("\\\\.\\pipe\\") != 0;
}
native_handle_t
openFileToWrite(std::string const& path)
{
ZoneScoped;
HANDLE h = ::CreateFile(
path.c_str(),
GENERIC_READ | GENERIC_WRITE, // DesiredAccess
FILE_SHARE_READ | FILE_SHARE_WRITE, // ShareMode
NULL, // SecurityAttributes
CREATE_ALWAYS, // CreationDisposition
(FILE_ATTRIBUTE_NORMAL | FILE_FLAG_OVERLAPPED), // FlagsAndAttributes
NULL); // TemplateFile
if (h == INVALID_HANDLE_VALUE)
{
FileSystemException::failWithGetLastError(
std::string("fs::openFileToWrite() failed on CreateFile(\"") +
path + std::string("\"): "));
}
return h;
}
bool
durableRename(std::string const& src, std::string const& dst,
std::string const& dir)
{
ZoneScoped;
if (MoveFileExA(src.c_str(), dst.c_str(), MOVEFILE_WRITE_THROUGH) == 0)
{
FileSystemException::failWithGetLastError(
"fs::durableRename() failed on MoveFileExA(): ");
}
return true;
}
bool
exists(std::string const& name)
{
ZoneScoped;
if (name.empty())
return false;
if (GetFileAttributes(name.c_str()) == INVALID_FILE_ATTRIBUTES)
{
if (GetLastError() == ERROR_FILE_NOT_FOUND ||
GetLastError() == ERROR_PATH_NOT_FOUND)
{
return false;
}
else
{
std::string msg("error accessing path: ");
throw FileSystemException(msg + name);
}
}
return true;
}
bool
mkdir(std::string const& name)
{
ZoneScoped;
bool b = _mkdir(name.c_str()) == 0;
CLOG(DEBUG, "Fs") << (b ? "created dir " : "failed to create dir ") << name;
return b;
}
void
deltree(std::string const& d)
{
ZoneScoped;
namespace fs = std::experimental::filesystem;
fs::remove_all(fs::path(d));
}
std::vector<std::string>
findfiles(std::string const& p,
std::function<bool(std::string const& name)> predicate)
{
ZoneScoped;
using namespace std;
namespace fs = std::experimental::filesystem;
std::vector<std::string> res;
for (auto& entry : fs::directory_iterator(fs::path(p)))
{
if (fs::is_regular_file(entry.status()))
{
auto n = entry.path().filename().string();
if (predicate(n))
{
res.emplace_back(n);
}
}
}
return res;
}
#else
#include <cerrno>
#include <fcntl.h>
#include <ftw.h>
#include <sys/file.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
static std::map<std::string, int> lockMap;
void
lockFile(std::string const& path)
{
ZoneScoped;
std::ostringstream errmsg;
if (lockMap.find(path) != lockMap.end())
{
errmsg << "file is already locked by this process: " << path;
throw std::runtime_error(errmsg.str());
}
int fd = open(path.c_str(), O_RDWR | O_CREAT, S_IRWXU);
if (fd == -1)
{
errmsg << "unable to open lock file: " << path << " ("
<< strerror(errno) << ")";
throw FileSystemException(errmsg.str());
}
int r = flock(fd, LOCK_EX | LOCK_NB);
if (r != 0)
{
close(fd);
errmsg << "unable to flock file: " << path << " (" << strerror(errno)
<< ")";
throw FileSystemException(errmsg.str());
}
lockMap.insert(std::make_pair(path, fd));
}
void
unlockFile(std::string const& path)
{
ZoneScoped;
auto it = lockMap.find(path);
if (it != lockMap.end())
{
// cannot unlink to avoid potential race
close(it->second);
lockMap.erase(it);
}
else
{
throw std::runtime_error("file was not locked");
}
}
void
flushFileChanges(native_handle_t fd)
{
ZoneScoped;
while (fsync(fd) == -1)
{
if (errno == EINTR)
{
continue;
}
FileSystemException::failWithErrno(
"fs::flushFileChanges() failed on fsync(): ");
}
}
bool
shouldUseRandomAccessHandle(std::string const& path)
{
return false;
}
native_handle_t
openFileToWrite(std::string const& path)
{
ZoneScoped;
int fd;
while ((fd = ::open(path.c_str(), O_CREAT | O_WRONLY | O_APPEND, 0644)) ==
-1)
{
if (errno == EINTR)
{
continue;
}
FileSystemException::failWithErrno(std::string("fs::openFile(\"") +
path + "\") failed: ");
}
return fd;
}
bool
durableRename(std::string const& src, std::string const& dst,
std::string const& dir)
{
ZoneScoped;
if (rename(src.c_str(), dst.c_str()) != 0)
{
return false;
}
int dfd;
while ((dfd = open(dir.c_str(), O_RDONLY)) == -1)
{
if (errno == EINTR)
{
continue;
}
FileSystemException::failWithErrno(
std::string("Failed to open directory ") + dir + " :");
}
while (fsync(dfd) == -1)
{
if (errno == EINTR)
{
continue;
}
FileSystemException::failWithErrno(
std::string("Failed to fsync directory ") + dir + " :");
}
while (close(dfd) == -1)
{
if (errno == EINTR)
{
continue;
}
FileSystemException::failWithErrno(
std::string("Failed to close directory ") + dir + " :");
}
return true;
}
bool
exists(std::string const& name)
{
ZoneScoped;
struct stat buf;
if (stat(name.c_str(), &buf) == -1)
{
if (errno == ENOENT)
{
return false;
}
else
{
std::string msg("error accessing path: ");
throw FileSystemException(msg + name);
}
}
return true;
}
bool
mkdir(std::string const& name)
{
ZoneScoped;
bool b = ::mkdir(name.c_str(), 0700) == 0;
CLOG(DEBUG, "Fs") << (b ? "created dir " : "failed to create dir ") << name;
return b;
}
namespace
{
int
nftw_deltree_callback(char const* name, struct stat const* st, int flag,
struct FTW* ftw)
{
ZoneScoped;
CLOG(DEBUG, "Fs") << "deleting: " << name;
if (flag == FTW_DP)
{
if (rmdir(name) != 0)
{
throw FileSystemException(std::string{"rmdir of "} + name +
" failed");
}
}
else
{
if (std::remove(name) != 0)
{
throw FileSystemException(std::string{"std::remove of "} + name +
" failed");
}
}
return 0;
}
}
void
deltree(std::string const& d)
{
ZoneScoped;
if (nftw(d.c_str(), nftw_deltree_callback, FOPEN_MAX, FTW_DEPTH) != 0)
{
throw FileSystemException("nftw failed in deltree for " + d);
}
}
std::vector<std::string>
findfiles(std::string const& path,
std::function<bool(std::string const& name)> predicate)
{
ZoneScoped;
auto dir = opendir(path.c_str());
auto result = std::vector<std::string>{};
if (!dir)
{
return result;
}
try
{
while (auto entry = readdir(dir))
{
auto name = std::string{entry->d_name};
if (predicate(name))
{
result.push_back(name);
}
}
closedir(dir);
return result;
}
catch (...)
{
// small RAII class could do here
closedir(dir);
throw;
}
}
#endif
PathSplitter::PathSplitter(std::string path) : mPath{std::move(path)}, mPos{0}
{
}
std::string
PathSplitter::next()
{
auto slash = mPath.find('/', mPos);
mPos = slash == std::string::npos ? mPath.length() : slash;
auto r = mPos == 0 ? "/" : mPath.substr(0, mPos);
mPos++;
auto mLastSlash = mPos;
while (mLastSlash < mPath.length() && mPath[mLastSlash] == '/')
mLastSlash++;
if (mLastSlash > mPos)
mPath.erase(mPos, mLastSlash - mPos);
return r;
}
bool
PathSplitter::hasNext() const
{
return mPos < mPath.length();
}
bool
mkpath(const std::string& path)
{
ZoneScoped;
auto splitter = PathSplitter{path};
while (splitter.hasNext())
{
auto subpath = splitter.next();
if (!exists(subpath) && !mkdir(subpath))
{
return false;
}
}
return true;
}
std::string
hexStr(uint32_t checkpointNum)
{
return fmt::format("{:08x}", checkpointNum);
}
std::string
hexDir(std::string const& hexStr)
{
static const std::regex rx(
"([[:xdigit:]]{2})([[:xdigit:]]{2})([[:xdigit:]]{2}).*");
std::smatch sm;
bool matched = std::regex_match(hexStr, sm, rx);
assert(matched);
return (std::string(sm[1]) + "/" + std::string(sm[2]) + "/" +
std::string(sm[3]));
}
std::string
baseName(std::string const& type, std::string const& hexStr,
std::string const& suffix)
{
return type + "-" + hexStr + "." + suffix;
}
std::string
remoteDir(std::string const& type, std::string const& hexStr)
{
return type + "/" + hexDir(hexStr);
}
std::string
remoteName(std::string const& type, std::string const& hexStr,
std::string const& suffix)
{
return remoteDir(type, hexStr) + "/" + baseName(type, hexStr, suffix);
}
void
checkGzipSuffix(std::string const& filename)
{
static const std::string suf(".gz");
if (!(filename.size() >= suf.size() &&
equal(suf.rbegin(), suf.rend(), filename.rbegin())))
{
throw std::runtime_error("filename does not end in .gz");
}
}
void
checkNoGzipSuffix(std::string const& filename)
{
static const std::string suf(".gz");
if (filename.size() >= suf.size() &&
equal(suf.rbegin(), suf.rend(), filename.rbegin()))
{
throw std::runtime_error("filename ends in .gz");
}
}
size_t
size(std::ifstream& ifs)
{
ZoneScoped;
assert(ifs.is_open());
ifs.seekg(0, ifs.end);
auto result = ifs.tellg();
ifs.seekg(0, ifs.beg);
return std::max(decltype(result){0}, result);
}
size_t
size(std::string const& filename)
{
ZoneScoped;
std::ifstream ifs;
ifs.open(filename, std::ifstream::binary);
if (ifs)
{
ifs.exceptions(std::ios::badbit);
return size(ifs);
}
else
{
return 0;
}
}
#ifdef _WIN32
int
getMaxConnections()
{
// on Windows, there is no limit on handles
// only limits based on ephemeral ports, etc
return 32000;
}
#else
int
getMaxConnections()
{
struct rlimit rl;
if (getrlimit(RLIMIT_NOFILE, &rl) == 0)
{
// leave some buffer
return (rl.rlim_cur * 3) / 4;
}
// could not query the limit, default to a value that should work
return 64;
}
#endif
}
}
|
[
"ubuntu@ip-172-31-10-191.us-west-1.compute.internal"
] |
ubuntu@ip-172-31-10-191.us-west-1.compute.internal
|
ae1cc7589b4853f8060e7ee87bc449b800da4641
|
d1120d6a0db57fb3252be42dc5ece3a2dbbc07f2
|
/Myprojects/sCoreLib/TTimer.h
|
87b9318b974cc06320d9963dd36333604b821073
|
[] |
no_license
|
shjii/Map-Tool
|
c8da9b53017ad162e11c498b66313c9c5710f8a4
|
597b5f8c541094f1090b003175cc1955b64ebbe4
|
refs/heads/master
| 2023-05-09T06:59:32.359465
| 2021-05-26T07:05:22
| 2021-05-26T07:05:22
| 315,503,404
| 0
| 0
| null | null | null | null |
UHC
|
C++
| false
| false
| 854
|
h
|
#pragma once
#include "TStd.h"
// 1, 게임 실행 시간 누적 기능
// 2, 1 Frame 경과 시간 저장
// 3, 1초 동안 프레임 카운터
// ********* 모든 클래스는 반드시 다음과 같은 함수를 구현한다. *******
class TTimer : public TSingleton<TTimer>
{
public:
// 1, 게임 실행 시간 누적 기능
float m_fGameTimer;
// 2, 1 Frame 경과 시간 저장
float m_fSecondPerFrame;
// 3, 1초 동안 프레임 카운터
int m_iFPS;
WCHAR m_szBuffer[256] = { 0, };
float m_fBeforeTime;
public:
bool Reset();
// 초기화 및 준비 작업 구현
bool Init();
// 프레임 단위로 계산작업
bool Frame();
// 프레임 단위로 드로우(렌더링)
bool Render();
// 소멸 및 삭제 기능 구현
bool Release();
public:
TTimer();
virtual ~TTimer();
};
#define g_Timer TTimer::GetInstance()
|
[
"wlgns3282@gmail.com"
] |
wlgns3282@gmail.com
|
6334edd636a07d65ca478f33d6c67986643ad261
|
de7e771699065ec21a340ada1060a3cf0bec3091
|
/test-framework/src/java/org/apache/lucene/util/BaseDocIdSetTestCase.h
|
629480c4d506ff782913076762f2344a0535aa88
|
[] |
no_license
|
sraihan73/Lucene-
|
0d7290bacba05c33b8d5762e0a2a30c1ec8cf110
|
1fe2b48428dcbd1feb3e10202ec991a5ca0d54f3
|
refs/heads/master
| 2020-03-31T07:23:46.505891
| 2018-12-08T14:57:54
| 2018-12-08T14:57:54
| 152,020,180
| 7
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 7,655
|
h
|
#pragma once
#include "stringhelper.h"
#include <any>
#include <memory>
#include <type_traits>
#include <deque>
/*
* Licensed to the Syed Mamun Raihan (sraihan.com) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* sraihan.com licenses this file to You under GPLv3 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
*
* https://www.gnu.org/licenses/gpl-3.0.en.html
*
* 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.
*/
namespace org::apache::lucene::util
{
// C++ TODO: The Java 'import static' statement cannot be converted to C++:
// import static org.apache.lucene.util.BaseBitSetTestCase.randomSet;
using DocIdSet = org::apache::lucene::search::DocIdSet;
/** Base test class for {@link DocIdSet}s. */
template <typename T>
class BaseDocIdSetTestCase : public LuceneTestCase
{
GET_CLASS_NAME(BaseDocIdSetTestCase)
static_assert(std::is_base_of<org.apache.lucene.search.DocIdSet, T>::value,
L"T must inherit from org.apache.lucene.search.DocIdSet");
/** Create a copy of the given {@link BitSet} which has <code>length</code>
* bits. */
public:
virtual T copyOf(std::shared_ptr<BitSet> bs, int length) = 0;
/** Test length=0. */
virtual void testNoBit()
{
std::shared_ptr<BitSet> *const bs = std::make_shared<BitSet>(1);
constexpr T copy = copyOf(bs, 1);
assertEquals(1, bs, copy);
}
/** Test length=1. */
virtual void test1Bit()
{
std::shared_ptr<BitSet> *const bs = std::make_shared<BitSet>(1);
if (random().nextBoolean()) {
bs->set(0);
}
constexpr T copy = copyOf(bs, 1);
assertEquals(1, bs, copy);
}
/** Test length=2. */
virtual void test2Bits()
{
std::shared_ptr<BitSet> *const bs = std::make_shared<BitSet>(2);
if (random().nextBoolean()) {
bs->set(0);
}
if (random().nextBoolean()) {
bs->set(1);
}
constexpr T copy = copyOf(bs, 2);
assertEquals(2, bs, copy);
}
/** Compare the content of the set against a {@link BitSet}. */
virtual void testAgainstBitSet()
{
constexpr int numBits = TestUtil::nextInt(random(), 100, 1 << 20);
// test various random sets with various load factors
for (auto percentSet :
std::deque<float>{0.0f, 0.0001f, random().nextFloat(), 0.9f, 1.0f}) {
std::shared_ptr<BitSet> *const set = randomSet(numBits, percentSet);
constexpr T copy = copyOf(set, numBits);
assertEquals(numBits, set, copy);
}
// test one doc
std::shared_ptr<BitSet> set = std::make_shared<BitSet>(numBits);
set->set(0); // 0 first
T copy = copyOf(set, numBits);
assertEquals(numBits, set, copy);
set->clear(0);
set->set(random().nextInt(numBits));
copy = copyOf(set, numBits); // then random index
assertEquals(numBits, set, copy);
// test regular increments
for (int inc = 2; inc < 1000; inc += TestUtil::nextInt(random(), 1, 100)) {
set = std::make_shared<BitSet>(numBits);
for (int d = random().nextInt(10); d < numBits; d += inc) {
set->set(d);
}
copy = copyOf(set, numBits);
assertEquals(numBits, set, copy);
}
}
/** Test ram usage estimation. */
virtual void testRamBytesUsed()
{
constexpr int iters = 100;
for (int i = 0; i < iters; ++i) {
constexpr int pow = random().nextInt(20);
constexpr int maxDoc = TestUtil::nextInt(random(), 1, 1 << pow);
constexpr int numDocs = TestUtil::nextInt(
random(), 0,
std::min(maxDoc, 1 << TestUtil::nextInt(random(), 0, pow)));
std::shared_ptr<BitSet> *const set = randomSet(maxDoc, numDocs);
std::shared_ptr<DocIdSet> *const copy = copyOf(set, maxDoc);
constexpr int64_t actualBytes = ramBytesUsed(copy, maxDoc);
constexpr int64_t expectedBytes = copy->ramBytesUsed();
assertEquals(expectedBytes, actualBytes);
}
}
/** Assert that the content of the {@link DocIdSet} is the same as the content
* of the {@link BitSet}. */
virtual void assertEquals(int numBits, std::shared_ptr<BitSet> ds1,
T ds2)
{
// nextDoc
std::shared_ptr<DocIdSetIterator> it2 = ds2->begin();
if (it2 == nullptr) {
assertEquals(-1, ds1->nextSetBit(0));
} else {
assertEquals(-1, it2->docID());
for (int doc = ds1->nextSetBit(0); doc != -1;
doc = ds1->nextSetBit(doc + 1)) {
assertEquals(doc, it2->nextDoc());
assertEquals(doc, it2->docID());
}
assertEquals(DocIdSetIterator::NO_MORE_DOCS, it2->nextDoc());
assertEquals(DocIdSetIterator::NO_MORE_DOCS, it2->docID());
}
// nextDoc / advance
it2 = ds2->begin();
if (it2 == nullptr) {
assertEquals(-1, ds1->nextSetBit(0));
} else {
for (int doc = -1; doc != DocIdSetIterator::NO_MORE_DOCS;) {
if (random().nextBoolean()) {
doc = ds1->nextSetBit(doc + 1);
if (doc == -1) {
doc = DocIdSetIterator::NO_MORE_DOCS;
}
assertEquals(doc, it2->nextDoc());
assertEquals(doc, it2->docID());
} else {
constexpr int target =
doc + 1 +
random().nextInt(
random().nextBoolean() ? 64 : std::max(numBits / 8, 1));
doc = ds1->nextSetBit(target);
if (doc == -1) {
doc = DocIdSetIterator::NO_MORE_DOCS;
}
assertEquals(doc, it2->advance(target));
assertEquals(doc, it2->docID());
}
}
}
// bits()
std::shared_ptr<Bits> *const bits = ds2->bits();
if (bits != nullptr) {
// test consistency between bits and iterator
it2 = ds2->begin();
for (int previousDoc = -1, doc = it2->nextDoc();;
previousDoc = doc, doc = it2->nextDoc()) {
constexpr int max =
doc == DocIdSetIterator::NO_MORE_DOCS ? bits->length() : doc;
for (int i = previousDoc + 1; i < max; ++i) {
assertEquals(false, bits->get(i));
}
if (doc == DocIdSetIterator::NO_MORE_DOCS) {
break;
}
assertEquals(true, bits->get(doc));
}
}
}
private:
class Dummy : public std::enable_shared_from_this<Dummy>
{
GET_CLASS_NAME(Dummy)
public:
// C++ TODO: Most Java annotations will not have direct C++ equivalents:
// ORIGINAL LINE: @SuppressWarnings("unused") Object o1, o2;
std::any o1, o2;
};
// same as RamUsageTester.sizeOf but tries to not take into account resources
// that might be shared across instances
private:
int64_t ramBytesUsed(std::shared_ptr<DocIdSet> set,
int length)
{
std::shared_ptr<Dummy> dummy = std::make_shared<Dummy>();
dummy->o1 = copyOf(std::make_shared<BitSet>(length), length);
dummy->o2 = set;
int64_t bytes1 = RamUsageTester::sizeOf(dummy);
dummy->o2 = nullptr;
int64_t bytes2 = RamUsageTester::sizeOf(dummy);
return bytes1 - bytes2;
}
protected:
std::shared_ptr<BaseDocIdSetTestCase> shared_from_this()
{
return std::static_pointer_cast<BaseDocIdSetTestCase>(
LuceneTestCase::shared_from_this());
}
};
} // #include "core/src/java/org/apache/lucene/util/
|
[
"smamunr@fedora.localdomain"
] |
smamunr@fedora.localdomain
|
ed1a14332e7408aab4960e651b9b23df6ee677dc
|
66046fed760cf9dc6b60b77772ef60cf111a616f
|
/HLS_Sobel/sobel.prj/solution1/syn/systemc/FIFO_sobel_img_0_rows_V_channel1.h
|
e1ae74ddfd497b9c6a702b6c9cba11d82aabfceb
|
[] |
no_license
|
manu1991/PFC_Sobel_Zybo
|
a7011ae072b7c76ef9eafe9d410b2b84755ceb7e
|
6e27bfac668e95a811c57baa6313eb6b994d9b35
|
refs/heads/master
| 2021-01-10T07:54:23.171433
| 2016-01-27T20:17:58
| 2016-01-27T20:17:58
| 48,038,643
| 4
| 1
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 5,773
|
h
|
// ==============================================================
// File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC
// Version: 2014.4
// Copyright (C) 2014 Xilinx Inc. All rights reserved.
//
// ==============================================================
#ifndef FIFO_sobel_img_0_rows_V_channel1_HH_
#define FIFO_sobel_img_0_rows_V_channel1_HH_
#include <systemc>
using namespace std;
SC_MODULE(FIFO_sobel_img_0_rows_V_channel1) {
static const unsigned int DATA_WIDTH = 12;
static const unsigned int ADDR_WIDTH = 2;
static const unsigned int FIFO_sobel_img_0_rows_V_channel1_depth = 3;
sc_core::sc_in_clk clk;
sc_core::sc_in< sc_dt::sc_logic > reset;
sc_core::sc_out< sc_dt::sc_logic > if_empty_n;
sc_core::sc_in< sc_dt::sc_logic > if_read_ce;
sc_core::sc_in< sc_dt::sc_logic > if_read;
sc_core::sc_out< sc_dt::sc_lv<DATA_WIDTH> > if_dout;
sc_core::sc_out< sc_dt::sc_logic > if_full_n;
sc_core::sc_in< sc_dt::sc_logic > if_write_ce;
sc_core::sc_in< sc_dt::sc_logic > if_write;
sc_core::sc_in< sc_dt::sc_lv<DATA_WIDTH> > if_din;
sc_core::sc_signal< sc_dt::sc_logic > internal_empty_n;
sc_core::sc_signal< sc_dt::sc_logic > internal_full_n;
sc_core::sc_signal< sc_dt::sc_lv<DATA_WIDTH> > mStorage[FIFO_sobel_img_0_rows_V_channel1_depth];
sc_core::sc_signal< sc_dt::sc_uint<ADDR_WIDTH> > mInPtr;
sc_core::sc_signal< sc_dt::sc_uint<ADDR_WIDTH> > mOutPtr;
sc_core::sc_signal< sc_dt::sc_uint<1> > mFlag_nEF_hint;
sc_core::sc_trace_file* mTrace;
SC_CTOR(FIFO_sobel_img_0_rows_V_channel1) : mTrace(0) {
const char* dump_vcd = std::getenv("AP_WRITE_VCD");
if (dump_vcd && string(dump_vcd) == "1") {
std::string tracefn = "sc_trace_" + std::string(name());
mTrace = sc_core::sc_create_vcd_trace_file( tracefn.c_str());
sc_trace(mTrace, clk, "(port)clk");
sc_trace(mTrace, reset, "(port)reset");
sc_trace(mTrace, if_full_n, "(port)if_full_n");
sc_trace(mTrace, if_write_ce, "(port)if_write_ce");
sc_trace(mTrace, if_write, "(port)if_write");
sc_trace(mTrace, if_din, "(port)if_din");
sc_trace(mTrace, if_empty_n, "(port)if_empty_n");
sc_trace(mTrace, if_read_ce, "(port)if_read_ce");
sc_trace(mTrace, if_read, "(port)if_read");
sc_trace(mTrace, if_dout, "(port)if_dout");
sc_trace(mTrace, mInPtr, "mInPtr");
sc_trace(mTrace, mOutPtr, "mOutPtr");
sc_trace(mTrace, mFlag_nEF_hint, "mFlag_nEF_hint");
}
mInPtr = 0;
mOutPtr = 0;
mFlag_nEF_hint = 0;
SC_METHOD(proc_read_write);
sensitive << clk.pos();
SC_METHOD(proc_dout);
sensitive << mOutPtr;
for (unsigned i = 0; i < FIFO_sobel_img_0_rows_V_channel1_depth; i++) {
sensitive << mStorage[i];
}
SC_METHOD(proc_ptr);
sensitive << mInPtr << mOutPtr<< mFlag_nEF_hint;
SC_METHOD(proc_status);
sensitive << internal_empty_n << internal_full_n;
}
~FIFO_sobel_img_0_rows_V_channel1() {
if (mTrace) sc_core::sc_close_vcd_trace_file(mTrace);
}
void proc_status() {
if_empty_n.write(internal_empty_n.read());
if_full_n.write(internal_full_n.read());
}
void proc_read_write() {
if (reset.read() == sc_dt::SC_LOGIC_1) {
mInPtr.write(0);
mOutPtr.write(0);
mFlag_nEF_hint.write(0);
}
else {
if (if_read_ce.read() == sc_dt::SC_LOGIC_1
&& if_read.read() == sc_dt::SC_LOGIC_1
&& internal_empty_n.read() == sc_dt::SC_LOGIC_1) {
sc_dt::sc_uint<ADDR_WIDTH> ptr;
if (mOutPtr.read().to_uint() == (FIFO_sobel_img_0_rows_V_channel1_depth-1)) {
ptr = 0;
mFlag_nEF_hint.write(~mFlag_nEF_hint.read());
}
else {
ptr = mOutPtr.read();
ptr++;
}
assert(ptr.to_uint() < FIFO_sobel_img_0_rows_V_channel1_depth);
mOutPtr.write(ptr);
}
if (if_write_ce.read() == sc_dt::SC_LOGIC_1
&& if_write.read() == sc_dt::SC_LOGIC_1
&& internal_full_n.read() == sc_dt::SC_LOGIC_1) {
sc_dt::sc_uint<ADDR_WIDTH> ptr;
ptr = mInPtr.read();
mStorage[ptr.to_uint()].write(if_din.read());
if (ptr.to_uint() == (FIFO_sobel_img_0_rows_V_channel1_depth-1)) {
ptr = 0;
mFlag_nEF_hint.write(~mFlag_nEF_hint.read());
} else {
ptr++;
assert(ptr.to_uint() < FIFO_sobel_img_0_rows_V_channel1_depth);
}
mInPtr.write(ptr);
}
}
}
void proc_dout() {
sc_dt::sc_uint<ADDR_WIDTH> ptr = mOutPtr.read();
if (ptr.to_uint() > FIFO_sobel_img_0_rows_V_channel1_depth) {
if_dout.write(sc_dt::sc_lv<DATA_WIDTH>());
}
else {
if_dout.write(mStorage[ptr.to_uint()]);
}
}
void proc_ptr() {
if (mInPtr.read() == mOutPtr.read() && mFlag_nEF_hint.read().to_uint()==0) {
internal_empty_n.write(sc_dt::SC_LOGIC_0);
}
else {
internal_empty_n.write(sc_dt::SC_LOGIC_1);
}
if (mInPtr.read() == mOutPtr.read() && mFlag_nEF_hint.read().to_uint()==1) {
internal_full_n.write(sc_dt::SC_LOGIC_0);
}
else {
internal_full_n.write(sc_dt::SC_LOGIC_1);
}
}
};
#endif //FIFO_sobel_img_0_rows_V_channel1_HH_
|
[
"charnue@correo.ugr.es"
] |
charnue@correo.ugr.es
|
008f5496de71fb3b728c640ae492c9e9d984eab4
|
97c211320795bd62240247bfcc577fbc419542fa
|
/WhatBox/cMessageReceiver.h
|
2221d12686dd2a73eb36c40f274338db364f74e5
|
[] |
no_license
|
NeuroWhAI/Biogram
|
855c6fd4a25739aa5c416f4824cc7339d95da251
|
7e534514220673cb1971469e7b0559da3805d267
|
refs/heads/master
| 2021-01-17T06:01:30.016073
| 2016-06-19T05:19:30
| 2016-06-19T05:19:30
| 48,879,071
| 1
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,092
|
h
|
#pragma once
#include <queue>
#include <thread>
#include "cLock.h"
class cNetMessage;
class cMessageReceiver
{
public:
cMessageReceiver();
~cMessageReceiver();
private:
cLock m_Locker;
enum LockNum
{
LockNum_isEnd,
LockNum_Queue,
LockNum_Sock,
LockNum_Adr,
//-----------------
LockNum_LockNum_Count
};
private:
bool m_isTcp;
SOCKET m_Sock;
std::queue<cNetMessage*> m_RecvQueue;
std::queue<SOCKADDR_IN> m_AdrQueue;
private:
bool m_isEnd;
std::thread* m_pThread;
public:
static void ThreadJob(cMessageReceiver* pThis);
static void UdpThreadJob(cMessageReceiver* pThis);
public:
void PushRecvMsg(cNetMessage* pMsg);
void PushAdr(SOCKADDR_IN Adr);
cNetMessage* Enqueue();
SOCKADDR_IN AdrEnqueue();
cNetMessage* GetBackAndClear();
SOCKADDR_IN GetAdrBackAndClear();
UINT QueSize();
UINT AdrQueSize();
void SetEnd(bool isEnd);
bool isEnd();
void SetSock(SOCKET Sock);
SOCKET GetSock();
void Clear(cNetMessage* pNotDeleteMsg = NULL);
void ClearAdr();
public:
int Start(SOCKET Sock, bool isTcp = true);
int Stop();
};
|
[
"neurowhai@gmail.com"
] |
neurowhai@gmail.com
|
55aae649b1f5c4d139fd410230cb8b84867031f7
|
79f8c48de40a3fa9fe465f2a7b11daf8f3898fea
|
/src/interpreter/interpreter.cc
|
ddb87056edcb2eabccbd37e21a0d53ebaee6c05c
|
[
"BSD-3-Clause",
"bzip2-1.0.6"
] |
permissive
|
lkngin/v8-git-mirror
|
fcd629417d863fd8bf50434ee9184b96a529c781
|
e6e3c6a840035588811f0a208cbe6f9c0f3d53cc
|
refs/heads/master
| 2021-01-16T19:15:27.813087
| 2015-08-01T07:25:23
| 2015-08-01T07:25:30
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 2,437
|
cc
|
// Copyright 2015 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "src/interpreter/interpreter.h"
#include "src/compiler.h"
#include "src/compiler/interpreter-assembler.h"
#include "src/factory.h"
#include "src/interpreter/bytecodes.h"
#include "src/zone.h"
namespace v8 {
namespace internal {
namespace interpreter {
using compiler::Node;
#define __ assembler->
Interpreter::Interpreter(Isolate* isolate) : isolate_(isolate) {}
void Interpreter::Initialize(bool create_heap_objects) {
DCHECK(FLAG_ignition);
if (create_heap_objects) {
Zone zone;
HandleScope scope(isolate_);
Handle<FixedArray> handler_table = isolate_->factory()->NewFixedArray(
static_cast<int>(Bytecode::kLast) + 1, TENURED);
// We rely on the interpreter handler table being immovable, so check that
// it was allocated on the first page (which is always immovable).
DCHECK(isolate_->heap()->old_space()->FirstPage()->Contains(
handler_table->address()));
isolate_->heap()->public_set_interpreter_table(*handler_table);
#define GENERATE_CODE(Name, ...) \
{ \
compiler::InterpreterAssembler assembler(isolate_, &zone, \
Bytecode::k##Name); \
Do##Name(&assembler); \
Handle<Code> code = assembler.GenerateCode(); \
handler_table->set(static_cast<int>(Bytecode::k##Name), *code); \
}
BYTECODE_LIST(GENERATE_CODE)
#undef GENERATE_CODE
}
}
// LoadLiteral0 <dst>
//
// Load literal '0' into the destination register.
void Interpreter::DoLoadLiteral0(compiler::InterpreterAssembler* assembler) {
Node* register_index = __ BytecodeOperand(0);
__ StoreRegister(__ NumberConstant(0), register_index);
__ Dispatch();
}
// LoadSmi8 <dst>, <imm8>
//
// Load an 8-bit integer literal into destination register as a Smi.
void Interpreter::DoLoadSmi8(compiler::InterpreterAssembler* assembler) {
// TODO(rmcilroy) Convert an 8-bit integer to a Smi.
}
// Return
//
// Return the value in register 0.
void Interpreter::DoReturn(compiler::InterpreterAssembler* assembler) {
__ Return();
}
} // namespace interpreter
} // namespace internal
} // namespace v8
|
[
"commit-bot@chromium.org"
] |
commit-bot@chromium.org
|
4ce48c8529025a4cd9a7def2e8def4f2585a4c02
|
d430cb2d1fb44a4c6a2a0d398e01d1499094a923
|
/0074_Search_a_2D_Matrix/Solution1.cpp
|
dae4177f26812fa2f67d40e6643b4d133ef43eda
|
[] |
no_license
|
zhang-junjian/leetcode_solutions
|
9fa77c612d6d2f8261758896abfa6424e7b453b7
|
7cba115e4937dfb120cb724d90965eb15aa8733a
|
refs/heads/master
| 2020-12-07T15:50:45.684171
| 2020-01-09T01:33:09
| 2020-01-09T01:33:09
| 232,745,494
| 1
| 0
| null | 2020-01-09T07:09:39
| 2020-01-09T07:09:38
| null |
UTF-8
|
C++
| false
| false
| 1,175
|
cpp
|
#include<iostream>
#include<vector>
using namespace std;
class Solution {
public:
bool searchMatrix(vector<vector<int>>& matrix, int target) {
if (matrix.size() == 0) return false;
int m = 0, n = matrix[0].size() - 1;
while (m < matrix.size() && n >= 0) {
if (target == matrix[m][n]) {
return true;
} else if (target < matrix[m][n]) {
n--;
} else {
m++;
}
}
return false;
}
};
void test(string test_name, vector<vector<int>> &matrix, int target, bool expected)
{
Solution s;
if (s.searchMatrix(matrix, target) == expected) {
cout << test_name << " success." << endl;
} else {
cout << test_name << " failed." << endl;
}
}
int main()
{
vector<vector<int>> matrix1 = {
{1,3,5,7},
{10,11,16,20},
{23,30,34,50}
};
int target1 = 3;
bool expected1 = true;
test("test1", matrix1, target1, expected1);
vector<vector<int>> matrix2 = matrix1;
int target2 = 13;
bool expected2 = false;
test("test2", matrix2, target2, expected2);
return 0;
}
|
[
"is.li.xiaoyu@qq.com"
] |
is.li.xiaoyu@qq.com
|
0e01c37f1183c47bf188f50257c93747aa212a9d
|
4b11d9942dd5313e1fdd38dbd9c0245ded7b8f71
|
/13_가장 많이 사용된 자릿수/13_가장 많이 사용된 자릿수/Source.cpp
|
5505bb7b4b8a85e17e8fa19aa7a8b4e6ad6eb0c3
|
[] |
no_license
|
mgh3326/algorithm_inflearn
|
383b287834d4f8ac432bee8d30b0a3cced938fe2
|
e69351e942a7440186acbe1c89b41c95f9b94928
|
refs/heads/master
| 2020-06-06T12:12:23.817313
| 2019-08-05T08:20:36
| 2019-08-05T08:20:36
| 192,736,564
| 0
| 0
| null | 2019-11-30T06:08:44
| 2019-06-19T13:21:54
|
C++
|
UTF-8
|
C++
| false
| false
| 375
|
cpp
|
#include<iostream>
int main() {
std::string str;
std::cin >> str;
int arr[10];
for (int i = 0; i < 10; i++)
arr[i] = 0;
for (int i = 0; i < str.length(); i++)
{
arr[str[i]-'0']++;
}
int index = 9;
int max = arr[9];
for (int i = 1; i < 10; i++)
{
if (max < arr[9-i])
{
max = arr[9-i];
index = 9-i;
}
}
std::cout << index << std::endl;
return 0;
}
|
[
"mgh3326@naver.com"
] |
mgh3326@naver.com
|
f4620cc3de8bb5fd68e149622829930e755dc186
|
bd35373d773ef17ea3c4f07398b98237e00a0a6d
|
/programstool/generictree/nodehavingsumofchildrenandnodemaxm.cpp
|
4be8ee0f506fd65b6535df9e6f50cebef53baf86
|
[] |
no_license
|
NilanshBansal/DataStructures
|
e5868a0a38dcc12b4bb0f383dbe65c03548f87c0
|
8ec784a212bca2218cdda754553e68bd522be533
|
refs/heads/master
| 2020-03-21T16:38:18.016299
| 2019-02-22T07:05:57
| 2019-02-22T07:05:57
| 138,782,734
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,455
|
cpp
|
Given a tree, find and return the node for which sum of data of all children and the node itself is maximum. In the sum, data of node itself and data of immediate children is to be taken.
Input format :
Line 1 : Elements in level order form separated by space (as per done in class). Order is -
Root_data, n (No_Of_Child_Of_Root), n children, and so on for every element
Output format : Node with maximum sum.
Sample Input 1 :
5 3 1 2 3 1 15 2 4 5 1 6 0 0 0 0
Sample Output 1 :
1
// Following is the given Tree node structure
/**************
class TreeNode {
TreeNode<T>** children;
int childCount;
public:
T data;
TreeNode(T data); // Constructor
int numChildren();
void addChild(TreeNode<T>* child);
TreeNode<T>* getChild(int index);
void setChild(int index, TreeNode<T>* child);
};
***************/
#include<limits.h>
void maxSumNodehelper(TreeNode<int> *root,TreeNode<int>* &max,int &sumprev)
{
int sum=root->data,i;
for(i=0;i<root->numChildren();i++)
{
sum+=root->getChild(i)->data;
}
if(sum>sumprev)
{
sumprev=sum;
max=root;
}
for(i=0;i<root->numChildren();i++)
{
maxSumNodehelper(root->getChild(i),max,sumprev);
}
}
TreeNode<int>* maxSumNode(TreeNode<int> *root){
// Write your code here
TreeNode<int>* max=NULL;
int sumprev=INT_MIN;
if(root==NULL)
return NULL;
maxSumNodehelper(root,max,sumprev);
return max;
}
|
[
"bansalnilansh@gmail.com"
] |
bansalnilansh@gmail.com
|
b4eadff73144ca7a66deb5847e874072aa96033f
|
fb10cf7c70b5dfec2d2b4aff277c3c46b17520b9
|
/RayTracer/Source/RGBColor.cpp
|
c0651894eaa06f06fc7d50420dfbb5d725deed15
|
[] |
no_license
|
AlanWills/RayTracer
|
3bed903d63f707266c1052f7f12047a8ef596d3d
|
75f60d966f3a535a1a25b1230ca08a3c609ac211
|
refs/heads/master
| 2020-04-18T00:51:37.617733
| 2019-01-27T21:11:20
| 2019-01-27T21:11:20
| 167,094,634
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,353
|
cpp
|
// This file contains the definition of the class RGBColor
#include <math.h>
#include "RGBColor.h"
// -------------------------------------------------------- default constructor
RGBColor::RGBColor(void)
: r(0.0), g(0.0), b(0.0)
{}
// -------------------------------------------------------- constructor
RGBColor::RGBColor(float c)
: r(c), g(c), b(c)
{}
// -------------------------------------------------------- constructor
RGBColor::RGBColor(float _r, float _g, float _b)
: r(_r), g(_g), b(_b)
{}
// -------------------------------------------------------- copy constructor
RGBColor::RGBColor(const RGBColor& c)
: r(c.r), g(c.g), b(c.b)
{}
// -------------------------------------------------------- destructor
RGBColor::~RGBColor(void)
{}
// --------------------------------------------------------assignment operator
RGBColor&
RGBColor::operator= (const RGBColor& rhs) {
if (this == &rhs)
return (*this);
r = rhs.r; g = rhs.g; b = rhs.b;
return (*this);
}
// -------------------------------------------------------- powc
// raise each component to the specified power
// used for color filtering in Chapter 28
RGBColor
RGBColor::powc(float p) const {
return (RGBColor(static_cast<float>(pow(r, p)), static_cast<float>(pow(g, p)), static_cast<float>(pow(b, p))));
}
|
[
"alawills@googlemail.com"
] |
alawills@googlemail.com
|
916e3991e215619c79ed972496d094e4d150bde6
|
0b1cf14eafcd62b3e23bc34a1be6a5f14ddd9341
|
/core/timer.h
|
31e352c6a9faa03aedb6b2d62c4c987b682a7a78
|
[] |
no_license
|
martin-steinegger/FAMSA
|
391ccfcc9c33dcba703f26ce239a3ec6702c844f
|
2519bcbfec68a81770c1776c641307e4e4c174e5
|
refs/heads/master
| 2020-12-04T07:42:07.233515
| 2020-01-03T23:56:23
| 2020-01-03T23:56:23
| 231,681,878
| 1
| 0
| null | 2020-01-03T23:29:00
| 2020-01-03T23:28:59
| null |
UTF-8
|
C++
| false
| false
| 1,186
|
h
|
/*
This file is a part of FAMSA software distributed under GNU GPL 3 licence.
The homepage of the FAMSA project is http://sun.aei.polsl.pl/REFRESH/famsa
Authors: Sebastian Deorowicz, Agnieszka Debudaj-Grabysz, Adam Gudys
*/
#ifndef _TIMER_H
#define _TIMER_H
#ifdef WIN32
#include <windows.h>
// **********************************************************
typedef struct
{
LARGE_INTEGER start;
LARGE_INTEGER stop;
} stop_watch_t;
// **********************************************************
class CStopWatch
{
stop_watch_t timer;
LARGE_INTEGER frequency;
double LIToSecs( LARGE_INTEGER & L);
public:
CStopWatch();
void StartTimer( );
void StopTimer( );
double GetElapsedTime();
};
// **********************************************************
typedef struct
{
ULARGE_INTEGER start;
ULARGE_INTEGER stop;
} thread_watch_t;
#else
#include <sys/time.h>
#include <sys/resource.h>
#include <unistd.h>
typedef struct
{
timeval start;
timeval stop;
} stop_watch_t;
class CStopWatch
{
stop_watch_t timer;
public:
CStopWatch() {};
void StartTimer( );
void StopTimer( );
double GetElapsedTime();
};
typedef timeval thread_watch_t;
#endif
#endif
// ***** EOF
|
[
"adam.gudys@gmail.com"
] |
adam.gudys@gmail.com
|
c0ad6e6166de84efe02b5b82f43227afc149f693
|
669789a63bd5c01df2e68efa7931e74eb52c1742
|
/DDZ_AI/SplitType.h
|
c2005b1a39bf57297cc28d66622d2c64d278e138
|
[] |
no_license
|
qq717337/ddzai
|
d47d4ab3c280a3832abbfd31cf26f8766b812c22
|
9e59e23a6e967ae3a91fb5d234d2bc782ea24eec
|
refs/heads/master
| 2020-03-21T02:26:56.805637
| 2018-03-26T13:39:47
| 2018-03-26T13:39:47
| null | 0
| 0
| null | null | null | null |
GB18030
|
C++
| false
| false
| 4,557
|
h
|
#ifndef _SPLITTYPE_H_
#define _SPLITTYPE_H_
#include <vector>
#include <functional>
#include "Range.h"
#include "CardStyle.h"
//组合的不同拆分方法不建立不同的类了,而是在一个类中完成不同的组装策略,
//例如最优保留炸弹等的,或者最小步数的,或者为了接某一张牌,但是最优的没有,必须拆分对子这种情况,
class SplitMemnto;
class SplitType
{
friend class SplitMemnto;//声明为友元类以便这个类可以访问所有的SplitType的成员
friend class SplitStrategyBase;
#define INSERT_SPLITTYPE(x) x.push_back(cardIndex);\
//std::sort(x.begin(), x.end())
#define INSERT_CHAIN_SPLITTYPE(x) x.push_back(CardRange(startIndex, endIndex))
private:
//是否拆了炸弹
bool m_isSplitBoom;
mutable CardVector Boom;
mutable CardVector Single;
mutable CardVector Double;
mutable CardVector Triple;
mutable std::vector<CardRange>SingleChain; //至少5张
mutable std::vector<CardRange>DoubleChain; //至少3张
mutable std::vector<CardRange>TripleChain;//至少2张
public:
std::string ToString();
void AddBoom(uint8_t cardIndex);
void AddSingle(uint8_t cardIndex);
void AddDouble(uint8_t cardIndex);
void AddTriple(uint8_t cardIndex);
void AddSingleChain(uint8_t startIndex, uint8_t endIndex);
void AddDoubleChain(uint8_t startIndex, uint8_t endIndex);
void AddTripleChain(uint8_t startIndex, uint8_t endIndex);
CardStyle MinValueCardStyle()const;
size_t MinStepCount(bool exceptBoom = false)const; //获取拆分后的牌的最小出完步数
size_t CardCount()const;
size_t CauseExtraSingleDoubleStep(CardRange& range)const;
bool GetLastShotCardStyle(CardStyle* ref)const;
CardStyle GetSingleChainStyle()const;
CardStyle GetDoubleChainStyle()const;
CardStyle GetTripleChainStyle()const;
std::vector<CardStyle> GetTripleStyles(bool erase=false)const;
std::vector<CardStyle>GetAllSplitStyle()const;
//从SingleChain中获取一个单只,forceSplit=true则强制返回一个即使不满足最优拆解
bool RequireSingle(size_t requireCount, CardVector& out,bool splitDouble = true)const;
bool RequireDouble(size_t requireCount, CardVector& out, bool splitTriple = true)const;
bool RequireSingleFromChain(size_t requireCount, CardVector & out, bool forceSplit = false)const;
bool RequireDoubleFromChain(size_t requireCount, CardVector & out, bool forceSplit = false)const;
bool RequireFromAll(size_t requireCount, CardVector & outSingleIndex, CardVector & outDoubleIndex, CardVector & outTripleIndex,
std::function<void(CardVector &, CardVector &, CardVector &)> redefineFunc);
virtual void Reset();
void Sort();
SplitType();
~SplitType();
SplitType(const SplitType& rhs);
SplitType&operator=(const SplitType& rhs);
inline bool operator==(const SplitType & rhs) const
{
return(rhs.m_isSplitBoom==m_isSplitBoom&& rhs.Boom == Boom && rhs.Single == Single && rhs.Double == Double && rhs.Triple == Triple &&
rhs.SingleChain == SingleChain && rhs.DoubleChain == DoubleChain && rhs.TripleChain == TripleChain);
}
inline bool operator!=(const SplitType & rhs) const
{
return(rhs.m_isSplitBoom != m_isSplitBoom && rhs.Boom != Boom || rhs.Single != Single || rhs.Double != Double || rhs.Triple != Triple ||
rhs.SingleChain != SingleChain || rhs.DoubleChain != DoubleChain || rhs.TripleChain != TripleChain);
}
inline bool InSingle(uint8_t cardIndex)const { return std::find(Single.begin(), Single.end(), cardIndex) != Single.end(); }
inline bool InDouble(uint8_t cardIndex)const { return std::find(Double.begin(), Double.end(), cardIndex) != Double.end(); }
inline const bool HasJokerBoom()const { return std::find(Boom.begin(), Boom.end(), CardIndex_JokerBoom) != Single.end(); }
inline const CardVector & GetBoom()const { return Boom; }
inline const CardVector & GetSingle()const { return Single; }
inline const CardVector & GetDouble() const { return Double; }
inline const CardVector & GetTriple()const { return Triple; }
inline const std::vector<CardRange>& GetSingleChain() const { return SingleChain; }
inline const std::vector<CardRange>& GetDoubleChain() const { return DoubleChain; }
inline const std::vector<CardRange>& GetTripleChain() const { return TripleChain; }
inline static const CardStyle* MaxEndValueStyle(const std::vector<CardStyle>& inStyles) {
int maxStyle = 0;
return &(*std::max_element(inStyles.cbegin(), inStyles.cend(), [](CardStyle x, CardStyle y) {
return x.EndValue < y.EndValue;
}));
}
void Backup()const;
void Restore()const;
};
#endif
|
[
"625673575@qq.com"
] |
625673575@qq.com
|
c959e3e190753569a1974f5a6dbaf5f71929775a
|
1c7755187719039b46aae8400cbd5a4e03d4b7c6
|
/Source/Project/SimpleEmail/InternetAccounts.h
|
902b5b3ee7d153e493ad297a9840ccdcba9d5f52
|
[] |
no_license
|
liujiquan/Work
|
dc70b3bd67e2618bf5106e341c4b5c13762c6b6b
|
12964013329fbab4a233a2ac23bff0e173298026
|
refs/heads/master
| 2021-01-10T08:12:22.145734
| 2016-02-18T04:44:52
| 2016-02-18T04:44:52
| 51,979,366
| 1
| 1
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,515
|
h
|
#if !defined(AFX_INTERNETACCOUNTS_H__9A0FA9E8_8FC6_4F46_91B3_6A3FF5D69FA7__INCLUDED_)
#define AFX_INTERNETACCOUNTS_H__9A0FA9E8_8FC6_4F46_91B3_6A3FF5D69FA7__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// InternetAccounts.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// CInternetAccounts dialog
#include "MailUtil.h"
class CInternetAccounts : public CDialog
{
// Construction
public:
CInternetAccounts(CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(CInternetAccounts)
enum { IDD = IDD_DIALOG_ACCOUNT };
CListCtrl m_AccountList;
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CInternetAccounts)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CInternetAccounts)
virtual BOOL OnInitDialog();
afx_msg void OnButtonAdd();
afx_msg void OnButtonModify();
afx_msg void OnClose();
afx_msg void OnButtonDelete();
afx_msg void OnDblclkList2(NMHDR* pNMHDR, LRESULT* pResult);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
public:
void InitAccountListInfo();
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_INTERNETACCOUNTS_H__9A0FA9E8_8FC6_4F46_91B3_6A3FF5D69FA7__INCLUDED_)
|
[
"905047424@qq.com"
] |
905047424@qq.com
|
486e1cb55a063498b54433f4a763f976a62c5a64
|
13b288e309fe8dbff9bd9bd3db37895ecc78b13f
|
/includes/graph.h
|
0ddb61fca17987be9467b480cd5c23af0375f4c2
|
[
"MIT"
] |
permissive
|
Diogo-Miranda/GRAFO
|
00b823a23878ee437fbdd39f97a58c12e0eb5b23
|
32f9079ee22eaeacf79c080ed8390daa0ab5ec0d
|
refs/heads/main
| 2023-07-02T15:54:39.106885
| 2021-08-11T14:05:59
| 2021-08-11T14:05:59
| null | 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 123
|
h
|
#ifndef GRAFO_H
#define GRAFO_H
class Grafo {
public:
Grafo() {
}
};
#endif
|
[
"1277588@sga.pucminas.br"
] |
1277588@sga.pucminas.br
|
b4c0611475e4aee872c430b2262e6810cac8e2e9
|
7ed9ddde7aa126433fccaaf724415d08d59caec2
|
/TalkingScene/WalaberEngine/Walaber/src/Graphics/Color.cpp
|
87764aae4a1042affe777aca8bff9d4259c6d6d1
|
[] |
no_license
|
DannyTking/TalkingScene
|
7b01c92d273d15f0b9c72b2170fdb5a7b95b5e22
|
b73828e69b4324ccb8f26648dbb3b5b8cbddeb8f
|
refs/heads/master
| 2020-12-30T10:36:40.516557
| 2013-12-23T01:34:45
| 2013-12-23T01:34:45
| 13,242,667
| 0
| 2
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 2,946
|
cpp
|
#include "Color.h"
#include <math.h>
namespace Walaber
{
const float Color::MAX_COLOR_DIST_SQR = 200000.0f;
const float Color::CLOSE_ENOUGH_COLOR_DIST = 75.0f;
Color Color::fromHSV( float h, float s, float v )
{
Color ret(0,0,0);
if (s == 0.0f)
{
ret = Color(v,v,v);
return ret;
}
h /= 60.0f;
int i = floor(h);
float f = h - i;
float p = v * (1 - s);
float q = v * (1 - s * f);
float t = v * (1 - s * (1 - f));
switch(i)
{
case 0:
ret = Color(v, t, p);
break;
case 1:
ret = Color(q, v, p);
break;
case 2:
ret = Color(p, v, t);
break;
case 3:
ret = Color(p, q, v);
break;
case 4:
ret = Color(t, p, v);
break;
default:
ret = Color(v, p, q);
}
return ret;
}
bool Color::isCloseEnough(const Color& input, const Color& compareTo)
{
float r = (float)compareTo.R - (float)input.R;
float g = (float)compareTo.G - (float)input.G;
float b = (float)compareTo.B - (float)input.B;
r *= r;
g *= g;
b *= b;
float lenSqr = r + g + b;
return lenSqr < CLOSE_ENOUGH_COLOR_DIST;
}
Color Color::getClosestColor(const Color& input, int& closestColorIndex, const Color* colors, const int numColors)
{
float inpR = (float)input.R;
float inpG = (float)input.G;
float inpB = (float)input.B;
Color nearest;
float distSqr = MAX_COLOR_DIST_SQR;
for(int i = 0; i < numColors; ++i)
{
float compR = (float)colors[i].R;
float compG = (float)colors[i].G;
float compB = (float)colors[i].B;
float lenSqr = ((compR - inpR)*(compR - inpR) + (compG - inpG)*(compG - inpG) + (compB - inpB)*(compB - inpB));
if(lenSqr == 0.0f)
{
nearest = colors[i];
closestColorIndex = i;
break;
}
else if ( lenSqr < distSqr)
{
distSqr = lenSqr;
nearest = colors[i];
closestColorIndex = i;
}
}
return nearest;
}
Color Color::parseColorFromString(std::string colorString)
{
Color ret;
int r, g, b;
sscanf(colorString.c_str(), "%d %d %d", &r, &g, &b);
ret = Color( r, g, b );
return ret;
}
Color Color::parseColorFromStringRGBA(const std::string& colorString)
{
Color ret;
int r, g, b, a;
sscanf(colorString.c_str(), "%d %d %d %d", &r, &g, &b, &a);
ret = Color( r, g, b, a );
return ret;
}
const Color Color::Red = Color(255,0,0);
const Color Color::Green = Color(0,255,0);
const Color Color::Blue = Color(0,0,255);
const Color Color::White = Color(255,255,255);
const Color Color::Black = Color(0,0,0);
const Color Color::Cyan = Color(0,255,255);
const Color Color::Yellow = Color(255,255,0);
const Color Color::Magenta = Color(255,0,255);
const Color Color::Grey = Color(128,128,128);
const Color Color::Purple = Color(155, 0, 255);
const Color Color::Orange = Color(255, 150, 0);
}
|
[
"yangming.tang@chukong-inc.com"
] |
yangming.tang@chukong-inc.com
|
860a6beb921bcfd346a4896fec2697be186a4fc8
|
5171dc6b378cb65018f4373fb75bb45d2a84ae8f
|
/src/spleeter/spleeter.h
|
a1d3bc7388ec784359c7178bad6edca5ff08f3a6
|
[
"MIT"
] |
permissive
|
loretoparisi/spleeterpp
|
91b8e8ed99d07f932adcedba3047f5590110bf52
|
f40e5e167384e2c3d521ea0b7159eb18ef5dff65
|
refs/heads/master
| 2020-11-25T12:13:29.401538
| 2019-12-23T16:57:11
| 2019-12-23T16:57:11
| 228,653,339
| 7
| 0
|
MIT
| 2019-12-17T16:07:48
| 2019-12-17T16:07:47
| null |
UTF-8
|
C++
| false
| false
| 2,471
|
h
|
#ifndef SPEETER_SPLEETER_H_
#define SPEETER_SPLEETER_H_
#include <string>
#include <memory>
#include <unordered_set>
#include <Eigen/Core>
namespace spleeter {
using Waveform = Eigen::Matrix2Xf;
enum SeparationType { TwoStems, FourStems, FiveStems };
/// Initialize the spleeter tools by loading models at the specified path
/// \param path_to_models the path to spleeter exported models.
/// \param separation_types the types of separation required
/// \param err an error code that gets set if something goes wrong
void Initialize(const std::string &path_to_models,
const std::unordered_set<SeparationType> &separation_types,
std::error_code &err);
/// Split the input waveform into vocals and accompaniment
/// \param input the input waveform
/// \param vocals the extracted vocals waveform
/// \param accompaniment the extracted accompaniment waveform
/// \param err an error code that gets set if something goes wrong.
/// std::errc::protocol_error is obtained when the model hasn't been properly
/// initialized
void Split(const Waveform &input, Waveform *vocals, Waveform *accompaniment,
std::error_code &err);
/// Split the input waveform into vocals, drums, bass and other
/// \param input the input waveform
/// \param vocals the extracted vocals waveform
/// \param drums the extracted drums waveform
/// \param bass the extracted bass waveform
/// \param other the extracted other waveform
/// \param err an error code that gets set if something goes wrong.
/// std::errc::protocol_error is obtained when the model hasn't been properly
/// initialized
void Split(const Waveform &input, Waveform *vocals, Waveform *drums,
Waveform *bass, Waveform *other, std::error_code &err);
/// Split the input waveform into vocals, drums, bass, piano and other
/// \param input the input waveform
/// \param vocals the extracted vocals waveform
/// \param drums the extracted drums waveform
/// \param bass the extracted bass waveform
/// \param piano the extracted piano waveform
/// \param other the extracted other waveform
/// \param err an error code that gets set if something goes wrong.
/// std::errc::protocol_error is obtained when the model hasn't been properly
/// initialized
void Split(const Waveform &input, Waveform *vocals, Waveform *drums,
Waveform *bass, Waveform *piano, Waveform *other,
std::error_code &err);
} // namespace spleeter
#endif // SPEETER_SPLEETER_H_
|
[
"guillaume.vincke@gmail.com"
] |
guillaume.vincke@gmail.com
|
9a80d1925b6e447ab2cb0e958be15b5ad66064c7
|
0bb2876a278f069aed3f353fe3e3c09261138801
|
/Stacks & Queues/Duplicate_Brackets.cpp
|
1287b3f21ca3d2b91ddb967f75820fd514e8d060
|
[] |
no_license
|
ranveerraj248/DS-Algo-Basic
|
8de95240ff25a7c36852eb690b020009365e40c5
|
2339ce00c2929fc354a57c8d600ea7f0e34964fe
|
refs/heads/main
| 2023-06-25T14:04:56.938052
| 2021-07-29T03:55:11
| 2021-07-29T03:55:11
| 390,592,397
| 0
| 0
| null | null | null | null |
UTF-8
|
C++
| false
| false
| 1,043
|
cpp
|
// 1. You are given a string exp representing an expression.
// 2. Assume that the expression is balanced i.e. the opening and closing brackets match with each other.
// 3. But, some of the pair of brackets maybe extra/needless.
// 4. You are required to print true if you detect extra brackets and false otherwise.
// e.g.'
// ((a + b) + (c + d)) -> false
// (a + b) + ((c + d)) -> true
#include <iostream>
#include <stack>
#include <string>
using namespace std;
int main()
{
string str;
getline(cin, str);
stack<char> st;
for (int i = 0; i < str.length(); i++)
{
if (str[i] == ')')
{
if (st.top() == '(')
{
cout << "true";
return 0;
}
else
{
while (st.top() != '(')
{
st.pop();
}
st.pop();
}
}
else
{
st.push(str[i]);
}
}
cout << "false" << endl;
return 0;
}
|
[
"ranveerraj248@gmail.com"
] |
ranveerraj248@gmail.com
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.