hexsha
stringlengths
40
40
size
int64
19
11.4M
ext
stringclasses
13 values
lang
stringclasses
1 value
max_stars_repo_path
stringlengths
3
270
max_stars_repo_name
stringlengths
5
110
max_stars_repo_head_hexsha
stringlengths
40
40
max_stars_repo_licenses
listlengths
1
9
max_stars_count
float64
1
191k
max_stars_repo_stars_event_min_datetime
stringlengths
24
24
max_stars_repo_stars_event_max_datetime
stringlengths
24
24
max_issues_repo_path
stringlengths
3
270
max_issues_repo_name
stringlengths
5
116
max_issues_repo_head_hexsha
stringlengths
40
78
max_issues_repo_licenses
listlengths
1
9
max_issues_count
float64
1
67k
max_issues_repo_issues_event_min_datetime
stringlengths
24
24
max_issues_repo_issues_event_max_datetime
stringlengths
24
24
max_forks_repo_path
stringlengths
3
270
max_forks_repo_name
stringlengths
5
116
max_forks_repo_head_hexsha
stringlengths
40
78
max_forks_repo_licenses
listlengths
1
9
max_forks_count
float64
1
105k
max_forks_repo_forks_event_min_datetime
stringlengths
24
24
max_forks_repo_forks_event_max_datetime
stringlengths
24
24
content
stringlengths
19
11.4M
avg_line_length
float64
1.93
229k
max_line_length
int64
12
688k
alphanum_fraction
float64
0.07
0.99
matches
listlengths
1
10
04a4bc91fe43a900a3b2c194787297f215482a9f
7,859
cc
C++
paddle/fluid/operators/mkldnn/pool_mkldnn_op.cc
dingsiyu/Paddle
2c974cc316bce4054bdf28d1f6b4c3bb8bd99d75
[ "Apache-2.0" ]
2
2021-02-04T15:04:21.000Z
2021-02-07T14:20:00.000Z
paddle/fluid/operators/mkldnn/pool_mkldnn_op.cc
cheeryoung79/Paddle
ac2e2e6b7f8e4fa449c824ac9f4d23e3af05c7d3
[ "Apache-2.0" ]
null
null
null
paddle/fluid/operators/mkldnn/pool_mkldnn_op.cc
cheeryoung79/Paddle
ac2e2e6b7f8e4fa449c824ac9f4d23e3af05c7d3
[ "Apache-2.0" ]
1
2021-03-16T13:40:08.000Z
2021-03-16T13:40:08.000Z
/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ #include "paddle/fluid/operators/pool_op.h" #include "paddle/fluid/platform/mkldnn_helper.h" #include "paddle/fluid/platform/mkldnn_reuse.h" namespace paddle { namespace operators { using framework::DataLayout; using mkldnn::memory; using mkldnn::pooling_backward; using mkldnn::pooling_forward; using mkldnn::primitive; using mkldnn::reorder; using mkldnn::stream; using platform::to_void_cast; template <typename T> class PoolMKLDNNOpKernel : public paddle::framework::OpKernel<T> { public: void Compute(const paddle::framework::ExecutionContext& ctx) const override { PADDLE_ENFORCE_EQ(platform::is_cpu_place(ctx.GetPlace()), true, paddle::platform::errors::PreconditionNotMet( "Operator DNNL Pool must use CPUPlace")); auto& dev_ctx = ctx.template device_context<platform::MKLDNNDeviceContext>(); const auto& mkldnn_engine = dev_ctx.GetEngine(); const Tensor* input = ctx.Input<Tensor>("X"); Tensor* output = ctx.Output<Tensor>("Out"); platform::PoolingMKLDNNHandler<T> handler(ctx, dev_ctx, mkldnn_engine, ctx.GetPlace(), input, output, ctx.OutputName("Out")); auto src_memory = handler.AcquireSrcMemory(input); auto dst_memory = handler.AcquireDstMemory(output); auto pool_p = handler.AcquireForwardPrimitive(); auto& astream = platform::MKLDNNDeviceContext::tls().get_stream(); if ((ctx.Attr<bool>("is_test") == false) && (ctx.Attr<std::string>("pooling_type") == "max")) { // Training auto workspace_memory = handler.AcquireWorkspaceMemory(); pool_p->execute(astream, {{MKLDNN_ARG_SRC, *src_memory}, {MKLDNN_ARG_DST, *dst_memory}, {MKLDNN_ARG_WORKSPACE, *workspace_memory}}); } else { // Inference pool_p->execute(astream, {{MKLDNN_ARG_SRC, *src_memory}, {MKLDNN_ARG_DST, *dst_memory}}); } astream.wait(); output->set_layout(DataLayout::kMKLDNN); output->set_format(platform::GetMKLDNNFormat(*dst_memory)); } }; template <typename T> class PoolMKLDNNGradOpKernel : public paddle::framework::OpKernel<T> { public: void Compute(const paddle::framework::ExecutionContext& ctx) const override { PADDLE_ENFORCE_EQ(platform::is_cpu_place(ctx.GetPlace()), true, paddle::platform::errors::PreconditionNotMet( "Operator DNNL PoolGrad must use CPUPlace")); const Tensor* in_x = ctx.Input<Tensor>("X"); const Tensor* out_grad = ctx.Input<Tensor>(framework::GradVarName("Out")); Tensor* in_x_grad = ctx.Output<Tensor>(framework::GradVarName("X")); PADDLE_ENFORCE_EQ( in_x->layout(), DataLayout::kMKLDNN, platform::errors::InvalidArgument("Wrong layout set for Input tensor")); PADDLE_ENFORCE_NE( in_x->format(), MKLDNNMemoryFormat::undef, platform::errors::InvalidArgument("Wrong format set for Input tensor")); PADDLE_ENFORCE_EQ(out_grad->layout(), DataLayout::kMKLDNN, platform::errors::InvalidArgument( "Wrong layout set for Input output_grad tensor")); PADDLE_ENFORCE_NE(out_grad->format(), MKLDNNMemoryFormat::undef, platform::errors::InvalidArgument( "Wrong format set for Input output_grad tensor")); PADDLE_ENFORCE_EQ( ctx.Attr<bool>("is_test"), false, platform::errors::InvalidArgument( "is_test attribute should be set to False in training phase.")); std::string pooling_type = ctx.Attr<std::string>("pooling_type"); std::vector<int> ksize_temp = ctx.Attr<std::vector<int>>("ksize"); std::vector<int64_t> ksize(begin(ksize_temp), end(ksize_temp)); std::vector<int> strides_temp = ctx.Attr<std::vector<int>>("strides"); std::vector<int64_t> strides(begin(strides_temp), end(strides_temp)); std::vector<int> paddings_temp = ctx.Attr<std::vector<int>>("paddings"); std::vector<int64_t> paddings(begin(paddings_temp), end(paddings_temp)); bool global_pooling = ctx.Attr<bool>("global_pooling"); std::string padding_algorithm = ctx.Attr<std::string>("padding_algorithm"); auto in_x_dims = in_x->dims(); framework::DDim data_dims = framework::slice_ddim(in_x_dims, 2, in_x_dims.size()); if (global_pooling) { UpdateKsize(&ksize, data_dims); } UpdatePadding(&paddings, global_pooling, 0, padding_algorithm, data_dims, strides, ksize); platform::PoolingMKLDNNHandler<T>::ComputeAdaptivePoolParameters( ctx, paddle::framework::vectorize(in_x->dims()), ksize, strides); auto& dev_ctx = ctx.template device_context<platform::MKLDNNDeviceContext>(); std::vector<mkldnn::primitive> pipeline; auto diff_src_tz = paddle::framework::vectorize<int64_t>(in_x_grad->dims()); auto diff_dst_tz = paddle::framework::vectorize<int64_t>(out_grad->dims()); // Get an unique name from "argument" name of "Out" variable // This name will be used as key when referring info from device context const std::string key = platform::CreateKey( dev_ctx, diff_src_tz, pooling_type, ksize, strides, paddings, memory::data_type::f32, in_x->format(), ctx.InputName("Out")); platform::PoolingMKLDNNHandler<T> handler( diff_dst_tz, diff_src_tz, ksize, strides, paddings, pooling_type, ctx.Attr<bool>("ceil_mode"), in_x->format(), out_grad->format(), paddle::framework::ToMKLDNNDataType(out_grad->type()), dev_ctx, ctx.GetPlace(), ctx.InputName("Out"), ctx.Attr<bool>("exclusive")); auto diff_dst_memory = handler.AcquireDiffDstMemory(out_grad); auto diff_src_memory = handler.AcquireDiffSrcMemory(in_x_grad); auto pool_bwd_p = handler.AcquireBackwardPrimitive(); auto& astream = platform::MKLDNNDeviceContext::tls().get_stream(); if (pooling_type == "max") { // Max - pooling needs Workspace auto workspace_memory = handler.AcquireWorkspaceMemory(); pool_bwd_p->execute(astream, {{MKLDNN_ARG_DIFF_SRC, *diff_src_memory}, {MKLDNN_ARG_DIFF_DST, *diff_dst_memory}, {MKLDNN_ARG_WORKSPACE, *workspace_memory}}); } else { // Average Pooling pool_bwd_p->execute(astream, {{MKLDNN_ARG_DIFF_SRC, *diff_src_memory}, {MKLDNN_ARG_DIFF_DST, *diff_dst_memory}}); } astream.wait(); in_x_grad->set_layout(DataLayout::kMKLDNN); in_x_grad->set_format(platform::GetMKLDNNFormat(*diff_src_memory)); } // Compute() }; } // namespace operators } // namespace paddle namespace ops = paddle::operators; REGISTER_OP_KERNEL(pool2d, MKLDNN, ::paddle::platform::CPUPlace, ops::PoolMKLDNNOpKernel<float>, ops::PoolMKLDNNOpKernel<int8_t>, ops::PoolMKLDNNOpKernel<uint8_t>, ops::PoolMKLDNNOpKernel<paddle::platform::bfloat16>); REGISTER_OP_KERNEL(pool2d_grad, MKLDNN, ::paddle::platform::CPUPlace, ops::PoolMKLDNNGradOpKernel<float>);
41.582011
80
0.667388
[ "vector" ]
04bc0341fe536612de6a2575c9c62cbd23aea570
2,682
hpp
C++
include/leaf-disk-gen/common.hpp
mgradysaunders/leaf-disk-gen
955df6c7a37bcec7697c708fe8e0886680075fe4
[ "BSD-2-Clause" ]
1
2020-08-17T15:35:20.000Z
2020-08-17T15:35:20.000Z
include/leaf-disk-gen/common.hpp
mgradysaunders/leaf-disk-gen
955df6c7a37bcec7697c708fe8e0886680075fe4
[ "BSD-2-Clause" ]
null
null
null
include/leaf-disk-gen/common.hpp
mgradysaunders/leaf-disk-gen
955df6c7a37bcec7697c708fe8e0886680075fe4
[ "BSD-2-Clause" ]
null
null
null
/* Copyright (c) 2020 M. Grady Saunders * * 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. * * 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. */ /*+-+*/ #pragma once #ifndef LEAF_DISK_GEN_COMMON_HPP #define LEAF_DISK_GEN_COMMON_HPP #include <cassert> #include <iostream> #include <preform/multi.hpp> #include <preform/multi_math.hpp> #include <preform/multi_random.hpp> namespace ld { /** * @defgroup common Common * * `<leaf-disk-gen/common.hpp>` */ /**@{*/ /** * @brief Floating point type. */ typedef double Float; /** * @brief 2-dimensional vector. */ template <typename T> using Vec2 = pre::vec2<T>; /** * @brief 3-dimensional vector. */ template <typename T> using Vec3 = pre::vec3<T>; /** * @brief 3-dimensional matrix. */ template <typename T> using Mat3 = pre::mat3<T>; /** * @brief Permuted congruential generator. */ typedef pre::pcg32 Pcg32; /** * @brief Generate canonical random sample. */ inline Float generateCanonical(Pcg32& pcg) { return pre::generate_canonical<Float>(pcg); } /** * @brief Generate canonical 2-dimensional random sample. */ inline Vec2<Float> generateCanonical2(Pcg32& pcg) { return pre::generate_canonical<Float, 2>(pcg); } /** * @brief Generate canonical 3-dimensional random sample. */ inline Vec3<Float> generateCanonical3(Pcg32& pcg) { return pre::generate_canonical<Float, 3>(pcg); } /**@}*/ } // namespace ld #endif // #ifndef LEAF_DISK_GEN_COMMON_HPP
24.833333
77
0.719612
[ "vector" ]
04bc48b9dac37a1b2b83a520e593ab964e44d44e
2,044
cpp
C++
Homework5/abbreviation.cpp
hidacow/CPPstudy
70f0e9d93684955b53d2361c86a3585e681e9502
[ "MIT" ]
1
2020-10-20T02:54:20.000Z
2020-10-20T02:54:20.000Z
Homework5/abbreviation.cpp
hidacow/CPPstudy
70f0e9d93684955b53d2361c86a3585e681e9502
[ "MIT" ]
null
null
null
Homework5/abbreviation.cpp
hidacow/CPPstudy
70f0e9d93684955b53d2361c86a3585e681e9502
[ "MIT" ]
1
2020-10-23T08:39:44.000Z
2020-10-23T08:39:44.000Z
#include<iostream> #include<string> #include<vector> #include<sstream> using namespace std; string Abbreviate(string str) { string returnstr; istringstream istr(str); vector<string> wordlist; while (istr >> str) wordlist.push_back(str); //add to wordlist for (int i = 0; i < wordlist.size(); i++) { if (wordlist[i].length() == 1) if (wordlist[i][0] == 'a' || wordlist[i][0] == 'A') continue; //skip "a" if (wordlist[i].length() == 2) { if ((wordlist[i][0] == 'a' || wordlist[i][0] == 'A') && (wordlist[i][1] == 'n' || wordlist[i][1] == 'N')) continue; //skip"an" if ((wordlist[i][0] == 'o' || wordlist[i][0] == 'O') && (wordlist[i][1] == 'f' || wordlist[i][1] == 'F')) continue; //skip"of" } if (wordlist[i].length() == 3) { if ((wordlist[i][0] == 'a' || wordlist[i][0] == 'A') && (wordlist[i][1] == 'n' || wordlist[i][1] == 'N') && (wordlist[i][2] == 'd' || wordlist[i][2] == 'D')) continue; //skip"and" if ((wordlist[i][0] == 't' || wordlist[i][0] == 'T') && (wordlist[i][1] == 'h' || wordlist[i][1] == 'H') && (wordlist[i][2] == 'e' || wordlist[i][2] == 'E')) continue; //skip"the" if ((wordlist[i][0] == 'f' || wordlist[i][0] == 'F') && (wordlist[i][1] == 'o' || wordlist[i][1] == 'O') && (wordlist[i][2] == 'r' || wordlist[i][2] == 'R')) continue; //skip"for" } returnstr += wordlist[i][0]; //shouldn't toupper() the letter for (int l = 0; l <= wordlist[i].length(); l++) if (wordlist[i][l] == '-') returnstr += wordlist[i][l + 1]; //add the first letter after "-" even the word after it is "a","an",etc. } return returnstr; } int main() { string str; vector<string>result; int cnt = 0; while (getline(cin, str)) { cout << "Case " << ++cnt << ": " << Abbreviate(str) << endl; } }
37.851852
169
0.454501
[ "vector" ]
04c4bdcfef543da0a09f2f89b34bac9f9c36fcfa
31,815
hxx
C++
src/Filtering/tubeImageMathFilters.hxx
thewtex/TubeTK
7536c6c112e1785cead4d008e8fae5ca8f527f20
[ "Apache-2.0" ]
null
null
null
src/Filtering/tubeImageMathFilters.hxx
thewtex/TubeTK
7536c6c112e1785cead4d008e8fae5ca8f527f20
[ "Apache-2.0" ]
null
null
null
src/Filtering/tubeImageMathFilters.hxx
thewtex/TubeTK
7536c6c112e1785cead4d008e8fae5ca8f527f20
[ "Apache-2.0" ]
null
null
null
/*========================================================================= Library: TubeTK Copyright 2010 Kitware Inc. 28 Corporate Drive, Clifton Park, NY, 12065, USA. All rights reserved. Licensed under the Apache License, Version 2.0 ( the "License" ); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://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 __tubeImageMathFilters_hxx #define __tubeImageMathFilters_hxx #include <itkBinaryBallStructuringElement.h> #include <itkCastImageFilter.h> #include <itkBinaryDilateImageFilter.h> #include <itkBinaryErodeImageFilter.h> #include <itkExtractImageFilter.h> #include <itkHistogramMatchingImageFilter.h> #include <itkImageFileWriter.h> #include <itkMetaImageIO.h> #include <itkMersenneTwisterRandomVariateGenerator.h> #include <itkMirrorPadImageFilter.h> #include <itkNormalizeImageFilter.h> #include <itkNormalVariateGenerator.h> #include <itkRecursiveGaussianImageFilter.h> #include <itkResampleImageFilter.h> #include <itkConnectedThresholdImageFilter.h> #include <itkMedianImageFilter.h> #include "itktubeCVTImageFilter.h" #include "itktubeNJetImageFunction.h" namespace tube { template< unsigned int VDimension > ImageMathFilters<VDimension>:: ImageMathFilters() { m_Input = nullptr; } template< unsigned int VDimension > ImageMathFilters<VDimension>:: ~ImageMathFilters() { m_Input = nullptr; } //------------------------------------------------------------------------ template< unsigned int VDimension > void ImageMathFilters<VDimension>:: ApplyIntensityWindowing( float valMin, float valMax, float outMin, float outMax ) { itk::ImageRegionIterator< ImageType > it2( m_Input, m_Input->GetLargestPossibleRegion() ); it2.GoToBegin(); while( !it2.IsAtEnd() ) { double tf = it2.Get(); tf = ( tf-valMin )/( valMax-valMin ); if( tf<0 ) { tf = 0; } if( tf>1 ) { tf = 1; } tf = ( tf * ( outMax-outMin ) ) + outMin; it2.Set( ( PixelType )tf ); ++it2; } } //------------------------------------------------------------------------ template< unsigned int VDimension > void ImageMathFilters<VDimension>:: ApplyIntensityMultiplicativeBiasCorrection( ImageType * inMeanFieldImage ) { itk::ImageRegionIterator< ImageType > it2( inMeanFieldImage, inMeanFieldImage->GetLargestPossibleRegion() ); int count = 0; double mean = 0; it2.GoToBegin(); while( !it2.IsAtEnd() ) { double tf = it2.Get(); mean += tf; if( tf != 0 ) { ++count; } ++it2; } mean /= count; itk::ImageRegionIterator< ImageType > it3( m_Input, m_Input->GetLargestPossibleRegion() ); it3.GoToBegin(); it2.GoToBegin(); while( !it3.IsAtEnd() ) { double tf = it3.Get(); double tf2 = it2.Get(); if( tf2 != 0 ) { double alpha = mean / tf2; tf = tf * alpha; it3.Set( ( PixelType )tf ); } ++it3; ++it2; } } //------------------------------------------------------------------------ template< unsigned int VDimension > void ImageMathFilters<VDimension>:: ResampleImage( ImageType * ref ) { bool doResample = false; for( unsigned int i = 0; i < VDimension; i++ ) { if( m_Input->GetLargestPossibleRegion().GetSize()[i] != ref->GetLargestPossibleRegion().GetSize()[i] || m_Input->GetLargestPossibleRegion().GetIndex()[i] != ref->GetLargestPossibleRegion().GetIndex()[i] || m_Input->GetSpacing()[i] != ref->GetSpacing()[i] || m_Input->GetOrigin()[i] != ref->GetOrigin()[i] ) { doResample = true; break; } } if( doResample ) { typedef typename itk::ResampleImageFilter< ImageType, ImageType> ResampleFilterType; typename ResampleFilterType::Pointer filter = ResampleFilterType::New(); typename ImageType::Pointer imTemp; filter->SetInput( m_Input ); filter->SetUseReferenceImage( true ); filter->SetReferenceImage( ref ); imTemp = filter->GetOutput(); filter->Update(); m_Input = imTemp; } } //------------------------------------------------------------------------ template< unsigned int VDimension > void ImageMathFilters<VDimension>:: AddUniformNoise( float valMin, float valMax, float noiseMin, float noiseMax, int seed ) { typedef itk::Statistics::MersenneTwisterRandomVariateGenerator UniformGenType; typename UniformGenType::Pointer uniformGen = UniformGenType::New(); std::srand( seed ); uniformGen->Initialize( ( int )seed ); itk::ImageRegionIterator< ImageType > it2( m_Input, m_Input->GetLargestPossibleRegion() ); it2.GoToBegin(); while( !it2.IsAtEnd() ) { double tf = it2.Get(); if( tf >= valMin && tf <= valMax ) { tf += noiseMin + uniformGen->GetVariate() * (noiseMax-noiseMin); it2.Set( ( PixelType )tf ); } ++it2; } } //------------------------------------------------------------------------ template< unsigned int VDimension > void ImageMathFilters<VDimension>:: AddGaussianNoise( float valMin, float valMax, float noiseMean, float noiseStdDev, int seed ) { typedef itk::Statistics::NormalVariateGenerator GaussGenType; typename GaussGenType::Pointer gaussGen = GaussGenType::New(); std::srand( seed ); gaussGen->Initialize( ( int )seed ); itk::ImageRegionIterator< ImageType > it2( m_Input, m_Input->GetLargestPossibleRegion() ); it2.GoToBegin(); while( !it2.IsAtEnd() ) { double tf = it2.Get(); if( tf >= valMin && tf <= valMax ) { tf += gaussGen->GetVariate()*noiseStdDev+noiseMean; it2.Set( ( PixelType )tf ); } ++it2; } } //------------------------------------------------------------------------ template< unsigned int VDimension > void ImageMathFilters<VDimension>:: AddImages( ImageType * input2, float weight1, float weight2 ) { itk::ImageRegionIterator< ImageType > it1( m_Input, m_Input->GetLargestPossibleRegion() ); itk::ImageRegionIterator< ImageType > it2( input2, input2->GetLargestPossibleRegion() ); it1.GoToBegin(); it2.GoToBegin(); while( !it1.IsAtEnd() ) { double tf1 = it1.Get(); double tf2 = it2.Get(); double tf = weight1*tf1 + weight2*tf2; it1.Set( ( PixelType )tf ); ++it1; ++it2; } } //------------------------------------------------------------------------ template< unsigned int VDimension > void ImageMathFilters<VDimension>:: MultiplyImages( ImageType * input2 ) { itk::ImageRegionIterator< ImageType > it1( m_Input, m_Input->GetLargestPossibleRegion() ); itk::ImageRegionIterator< ImageType > it2( input2, input2->GetLargestPossibleRegion() ); it1.GoToBegin(); it2.GoToBegin(); while( !it1.IsAtEnd() && !it2.IsAtEnd() ) { it1.Set( it1.Get() * it2.Get() ); ++it1; ++it2; } } //------------------------------------------------------------------------ template< unsigned int VDimension > void ImageMathFilters<VDimension>:: MirrorAndPadImage( int numPadVoxels ) { typedef itk::MirrorPadImageFilter< ImageType, ImageType > PadFilterType; typename PadFilterType::Pointer padFilter = PadFilterType::New(); padFilter->SetInput( m_Input ); typename PadFilterType::InputImageSizeType bounds; bounds.Fill( numPadVoxels ); padFilter->SetPadBound( bounds ); padFilter->Update(); m_Input = padFilter->GetOutput(); } //------------------------------------------------------------------------ template< unsigned int VDimension > void ImageMathFilters<VDimension>:: NormalizeImage( int normType ) { if( normType == 0 ) { typedef itk::NormalizeImageFilter< ImageType, ImageType > NormFilterType; typename NormFilterType::Pointer normFilter = NormFilterType::New(); normFilter->SetInput( m_Input ); normFilter->Update(); m_Input = normFilter->GetOutput(); } else { unsigned int nBins = 50; itk::ImageRegionIteratorWithIndex< ImageType > it1( m_Input, m_Input->GetLargestPossibleRegion() ); it1.GoToBegin(); double binMin = it1.Get(); double binMax = it1.Get(); while( !it1.IsAtEnd() ) { double tf = it1.Get(); if( tf < binMin ) { binMin = tf; } else { if( tf > binMax ) { binMax = tf; } } ++it1; } int loop = 0; double meanV = 0; double stdDevV = 1; itk::Array<double> bin; bin.set_size( nBins ); while( loop++ < 4 ) { std::cout << "binMin = " << binMin << " : binMax = " << binMax << std::endl; std::cout << " Mean = " << meanV << " : StdDev = " << stdDevV << std::endl; it1.GoToBegin(); bin.Fill( 0 ); while( !it1.IsAtEnd() ) { double tf = it1.Get(); tf = ( tf-binMin )/( binMax-binMin ) * ( nBins-1 ); if( tf>=0 && tf<nBins ) { bin[( int )tf]++; if( tf > 0 ) { bin[( int )( tf - 1 )] += 0.5; } if( tf < nBins-1 ) { bin[( int )( tf + 1 )] += 0.5; } } ++it1; } int maxBin = 0; double maxBinV = bin[0]; for( unsigned int i=1; i<nBins; i++ ) { if( bin[i] >= maxBinV ) { maxBinV = bin[i]; maxBin = i; } } double fwhm = maxBinV / 2; double binFWHMMin = maxBin; while( binFWHMMin>0 && bin[( int )binFWHMMin]>=fwhm ) { --binFWHMMin; } std::cout << " binfwhmmin = " << binFWHMMin << std::endl; binFWHMMin += ( fwhm - bin[( int )binFWHMMin] ) / ( bin[( int )binFWHMMin+1] - bin[( int )binFWHMMin] ); std::cout << " tweak: binfwhmmin = " << binFWHMMin << std::endl; double binFWHMMax = maxBin; while( binFWHMMax<( int )nBins-1 && bin[( int )binFWHMMax]>=fwhm ) { ++binFWHMMax; } std::cout << " binfwhmmax = " << binFWHMMax << std::endl; binFWHMMax -= ( fwhm - bin[( int )binFWHMMax] ) / ( bin[( int )binFWHMMax-1] - bin[( int )binFWHMMax] ); std::cout << " tweak: binfwhmmax = " << binFWHMMax << std::endl; if( binFWHMMax <= binFWHMMin ) { binFWHMMin = maxBin-1; binFWHMMax = maxBin+1; } double minV = ( ( binFWHMMin + 0.5 ) / ( nBins - 1.0 ) ) * ( binMax-binMin ) + binMin; double maxV = ( ( binFWHMMax + 0.5 ) / ( nBins - 1.0 ) ) * ( binMax-binMin ) + binMin; meanV = ( maxV + minV ) / 2.0; // FWHM to StdDev relationship from // https://mathworld.wolfram.com/GaussianFunction.html stdDevV = ( maxV - minV ) / 2.3548; binMin = meanV - 1.5 * stdDevV; binMax = meanV + 1.5 * stdDevV; } std::cout << "FINAL: binMin = " << binMin << " : binMax = " << binMax << std::endl; std::cout << " Mean = " << meanV << " : StdDev = " << stdDevV << std::endl; it1.GoToBegin(); if( normType == 1 ) { while( !it1.IsAtEnd() ) { double tf = it1.Get(); it1.Set( ( tf - meanV ) / stdDevV ); ++it1; } } else { while( !it1.IsAtEnd() ) { double tf = it1.Get(); it1.Set( tf - meanV ); ++it1; } } } } //------------------------------------------------------------------------ template< unsigned int VDimension > void ImageMathFilters<VDimension>:: FuseImages( ImageType * input2, float offset2 ) { itk::ImageRegionIterator< ImageType > it1( m_Input, m_Input->GetLargestPossibleRegion() ); itk::ImageRegionIterator< ImageType > it2( input2, input2->GetLargestPossibleRegion() ); it1.GoToBegin(); it2.GoToBegin(); while( !it1.IsAtEnd() ) { double tf1 = it1.Get(); double tf2 = it2.Get(); if( tf2>tf1 ) { double tf = offset2 + tf2; it1.Set( ( PixelType )tf ); } ++it1; ++it2; } } //------------------------------------------------------------------------ template< unsigned int VDimension > void ImageMathFilters<VDimension>:: MedianImage( int filterSize ) { typedef itk::MedianImageFilter< ImageType, ImageType > FilterType; typename ImageType::Pointer imTemp; typename FilterType::Pointer filter = FilterType::New(); filter->SetInput( m_Input ); typename ImageType::SizeType radius; radius.Fill( filterSize ); filter->SetRadius( radius ); imTemp = filter->GetOutput(); filter->Update(); m_Input = imTemp; } //------------------------------------------------------------------------ template< unsigned int VDimension > void ImageMathFilters<VDimension>:: ThresholdImage( float threshLow, float threshHigh, float valTrue, float valFalse ) { itk::ImageRegionIterator< ImageType > it1( m_Input, m_Input->GetLargestPossibleRegion() ); it1.GoToBegin(); while( !it1.IsAtEnd() ) { double tf1 = it1.Get(); if( tf1 >= threshLow && tf1 <= threshHigh ) { it1.Set( ( PixelType )valTrue ); } else { it1.Set( ( PixelType )valFalse ); } ++it1; } } //------------------------------------------------------------------------ template< unsigned int VDimension > double ImageMathFilters<VDimension> ::ComputeImageStatisticsWithinMaskRange( ImageType * mask, float maskThreshLow, float maskThreshHigh, int mode ) { itk::ImageRegionIterator< ImageType > it1( m_Input, m_Input->GetLargestPossibleRegion() ); itk::ImageRegionIterator< ImageType > it2( mask, mask->GetLargestPossibleRegion() ); it1.GoToBegin(); it2.GoToBegin(); double sum = 0; double sumS = 0; unsigned int count = 0; while( !it1.IsAtEnd() && !it2.IsAtEnd() ) { double maskV = it2.Get(); if( maskV >= maskThreshLow && maskV <= maskThreshHigh ) { sum += it1.Get(); sumS += it1.Get() * it1.Get(); ++count; } ++it1; ++it2; } double mean = sum/count; if( mode == 0 ) { return mean; } else { double stdDev = ( sumS - ( sum*mean ) )/( count-1 ); return stdDev; } } //------------------------------------------------------------------------ template< unsigned int VDimension > void ImageMathFilters<VDimension> ::AbsoluteImage( void ) { itk::ImageRegionIterator< ImageType > it1( m_Input, m_Input->GetLargestPossibleRegion() ); it1.GoToBegin(); while( !it1.IsAtEnd() ) { it1.Set( std::fabs( it1.Get() ) ); ++it1; } } //------------------------------------------------------------------------ template< unsigned int VDimension > void ImageMathFilters<VDimension> ::ReplaceValuesOutsideMaskRange( ImageType * mask, float maskThreshLow, float maskThreshHigh, float valFalse ) { ImageMathFilters<VDimension> imf2 = ImageMathFilters<VDimension>(); imf2.SetInput( mask ); imf2.ResampleImage( m_Input ); itk::ImageRegionIterator< ImageType > it1( m_Input, m_Input->GetLargestPossibleRegion() ); itk::ImageRegionIterator< ImageType > it2( imf2.GetOutput(), imf2.GetOutput()->GetLargestPossibleRegion() ); it1.GoToBegin(); it2.GoToBegin(); while( !it1.IsAtEnd() ) { double tf2 = it2.Get(); if( ! ( tf2 >= maskThreshLow && tf2 <= maskThreshHigh ) ) { it1.Set( ( PixelType )valFalse ); } ++it1; ++it2; } } //------------------------------------------------------------------------ template< unsigned int VDimension > void ImageMathFilters<VDimension> ::MorphImage( int mode, int radius, float foregroundValue, float backgroundValue ) { typedef itk::BinaryBallStructuringElement<PixelType, VDimension> BallType; BallType ball; ball.SetRadius( radius ); ball.CreateStructuringElement(); typedef itk::BinaryErodeImageFilter<ImageType, ImageType, BallType> ErodeFilterType; typedef itk::BinaryDilateImageFilter<ImageType, ImageType, BallType> DilateFilterType; switch( mode ) { case 0: { typename ErodeFilterType::Pointer filter = ErodeFilterType::New(); typename ImageType::Pointer imTemp; filter->SetBackgroundValue( backgroundValue ); filter->SetKernel( ball ); filter->SetErodeValue( foregroundValue ); filter->SetInput( m_Input ); imTemp = filter->GetOutput(); filter->Update(); m_Input = imTemp; break; } case 1: { typename DilateFilterType::Pointer filter = DilateFilterType::New(); typename ImageType::Pointer imTemp; filter->SetKernel( ball ); filter->SetDilateValue( foregroundValue ); filter->SetInput( m_Input ); imTemp = filter->GetOutput(); filter->Update(); m_Input = imTemp; break; } } } //------------------------------------------------------------------------ template< unsigned int VDimension > void ImageMathFilters<VDimension> ::ReplaceValueWithinMaskRange( ImageType * mask, float maskThreshLow, float maskThreshHigh, float imageVal, float newImageVal ) { itk::ImageRegionIterator< ImageType > itIm( m_Input, m_Input->GetLargestPossibleRegion() ); itk::ImageRegionIterator< ImageType > itMask( mask, mask->GetLargestPossibleRegion() ); while( !itIm.IsAtEnd() ) { if( itMask.Get() >= maskThreshLow && itMask.Get() <= maskThreshHigh && itIm.Get() == imageVal ) { itIm.Set( newImageVal ); } ++itIm; ++itMask; } } //------------------------------------------------------------------------ template< unsigned int VDimension > void ImageMathFilters<VDimension> ::BlurImage( float sigma ) { typename itk::RecursiveGaussianImageFilter< ImageType >::Pointer filter; typename ImageType::Pointer imTemp; for( unsigned int i=0; i<VDimension; i++ ) { filter = itk::RecursiveGaussianImageFilter< ImageType >::New(); filter->SetInput( m_Input ); filter->SetNormalizeAcrossScale( true ); filter->SetSigma( sigma ); filter->SetOrder( itk::GaussianOrderEnum::ZeroOrder ); filter->SetDirection( i ); imTemp = filter->GetOutput(); filter->Update(); m_Input = imTemp; } } //------------------------------------------------------------------------ template< unsigned int VDimension > void ImageMathFilters<VDimension> ::BlurOrderImage( float sigma, int order, int direction ) { typename itk::RecursiveGaussianImageFilter< ImageType >::Pointer filter; filter = itk::RecursiveGaussianImageFilter< ImageType >::New(); filter->SetInput( m_Input ); filter->SetNormalizeAcrossScale( true ); filter->SetSigma( sigma ); filter->SetDirection( direction ); switch( order ) { case 0: filter->SetOrder( itk::GaussianOrderEnum::ZeroOrder ); break; case 1: filter->SetOrder( itk::GaussianOrderEnum::FirstOrder ); break; case 2: filter->SetOrder( itk::GaussianOrderEnum::SecondOrder ); break; } typename ImageType::Pointer imTemp = filter->GetOutput(); filter->Update(); m_Input = imTemp; } //------------------------------------------------------------------------ template< unsigned int VDimension > void ImageMathFilters<VDimension> ::CopyImageInformation( ImageType * sourceImage ) { m_Input->SetOrigin( sourceImage->GetOrigin() ); m_Input->SetSpacing( sourceImage->GetSpacing() ); m_Input->SetDirection( sourceImage->GetDirection() ); } //------------------------------------------------------------------------ template< unsigned int VDimension > std::vector<double> ImageMathFilters<VDimension> ::ComputeImageHistogram( unsigned int nBins, float & binMin, float & binSize ) { itk::ImageRegionIteratorWithIndex< ImageType > it1( m_Input, m_Input->GetLargestPossibleRegion() ); it1.GoToBegin(); std::vector<double> bin( nBins, 0 ); double binMax = binMin + binSize*nBins; if( binMin == 0 && binSize == 0 ) { binMin = it1.Get(); binMax = it1.Get(); while( !it1.IsAtEnd() ) { double tf = it1.Get(); if( tf < binMin ) { binMin = tf; } else { if( tf > binMax ) { binMax = tf; } } ++it1; } } binSize = (binMax - binMin) / nBins; std::cout << " binMin = " << binMin << std::endl; std::cout << " binMax = " << binMax << std::endl; std::cout << " binSize = " << binSize << std::endl; while( !it1.IsAtEnd() ) { double tf = it1.Get(); tf = ( tf-binMin )/( binMax-binMin ) * nBins; if( (int)tf<(int)nBins && (int)tf>=0 ) { bin[( int )tf]++; } ++it1; } return bin; } //------------------------------------------------------------------------ template< unsigned int VDimension > void ImageMathFilters<VDimension> ::CorrectIntensitySliceBySliceUsingHistogramMatching( unsigned int numberOfBins, unsigned int numberOfMatchPoints ) { typedef itk::Image<PixelType, 2> ImageType2D; typedef itk::HistogramMatchingImageFilter< ImageType2D, ImageType2D > HistogramMatchFilterType; typename HistogramMatchFilterType::Pointer matchFilter; typename ImageType2D::Pointer im2DRef = ImageType2D::New(); typename ImageType2D::Pointer im2DIn = ImageType2D::New(); typename ImageType2D::SizeType size2D; size2D[0] = m_Input->GetLargestPossibleRegion().GetSize()[0]; size2D[1] = m_Input->GetLargestPossibleRegion().GetSize()[1]; im2DRef->SetRegions( size2D ); im2DRef->Allocate(); im2DIn->SetRegions( size2D ); im2DIn->Allocate(); itk::ImageRegionIterator< ImageType > it3D( m_Input, m_Input->GetLargestPossibleRegion() ); itk::ImageRegionIterator< ImageType > it3DSliceStart( m_Input, m_Input->GetLargestPossibleRegion() ); itk::ImageRegionIterator< ImageType2D > it2DRef( im2DRef, im2DRef->GetLargestPossibleRegion() ); itk::ImageRegionIterator< ImageType2D > it2DIn( im2DIn, im2DIn->GetLargestPossibleRegion() ); unsigned int x; unsigned int y; unsigned int z; it3D.GoToBegin(); unsigned int zMax = 1; if( VDimension == 3 ) { zMax = m_Input->GetLargestPossibleRegion().GetSize()[VDimension-1]; } for( z=0; z<VDimension && z<zMax; z++ ) { it2DRef.GoToBegin(); for( y=0; y<m_Input->GetLargestPossibleRegion().GetSize()[1]; y++ ) { for( x=0; x<m_Input->GetLargestPossibleRegion().GetSize()[0]; x++ ) { it2DRef.Set( it3D.Get() ); ++it2DRef; ++it3D; } } } while( z<zMax ) { it2DIn.GoToBegin(); it3DSliceStart = it3D; for( y=0; y<m_Input->GetLargestPossibleRegion().GetSize()[1]; y++ ) { for( x=0; x<m_Input->GetLargestPossibleRegion().GetSize()[0]; x++ ) { it2DIn.Set( it3D.Get() ); ++it2DIn; ++it3D; } } matchFilter = HistogramMatchFilterType::New(); matchFilter->SetReferenceImage( im2DRef ); matchFilter->SetInput( im2DIn ); matchFilter->SetNumberOfHistogramLevels( numberOfBins ); matchFilter->SetNumberOfMatchPoints( numberOfMatchPoints ); matchFilter->Update(); itk::ImageRegionIterator< ImageType2D > it2DOut( matchFilter->GetOutput(), im2DIn->GetLargestPossibleRegion() ); it2DRef.GoToBegin(); it2DOut.GoToBegin(); it3D = it3DSliceStart; for( y=0; y<m_Input->GetLargestPossibleRegion().GetSize()[1]; y++ ) { for( x=0; x<m_Input->GetLargestPossibleRegion().GetSize()[0]; x++ ) { it2DRef.Set( it2DOut.Get() ); it3D.Set( it2DOut.Get() ); ++it2DRef; ++it2DOut; ++it3D; } } ++z; } } //------------------------------------------------------------------------ template< unsigned int VDimension > void ImageMathFilters<VDimension> ::CorrectIntensityUsingHistogramMatching( unsigned int numberOfBins, unsigned int numberOfMatchPoints, ImageType * ref ) { typedef itk::HistogramMatchingImageFilter< ImageType, ImageType > HistogramMatchFilterType; typename HistogramMatchFilterType::Pointer matchFilter; matchFilter = HistogramMatchFilterType::New(); matchFilter->SetReferenceImage( ref ); matchFilter->SetInput( m_Input ); matchFilter->SetNumberOfHistogramLevels( numberOfBins ); matchFilter->SetNumberOfMatchPoints( numberOfMatchPoints ); matchFilter->Update(); m_Input = matchFilter->GetOutput(); } //------------------------------------------------------------------------ template< unsigned int VDimension > void ImageMathFilters<VDimension> ::Resize( double factor ) { typename ImageType::Pointer imSub2 = ImageType::New(); imSub2->CopyInformation( m_Input ); typename ImageType::SizeType size; typename ImageType::SpacingType spacing; if( factor != 0 ) { for( unsigned int i=0; i<VDimension; i++ ) { size[i] = ( long unsigned int ) ( m_Input->GetLargestPossibleRegion().GetSize()[i] / factor ); spacing[i] = m_Input->GetSpacing()[i]*factor; } } else { for( unsigned int i=0; i<VDimension; i++ ) { spacing[i] = m_Input->GetSpacing()[i]; } double meanSpacing = ( spacing[0] + spacing[1] ) / 2; if( VDimension == 3 ) { meanSpacing = ( meanSpacing + spacing[VDimension-1] ) / 2; } factor = meanSpacing/spacing[0]; size[0] = ( long unsigned int ) ( m_Input->GetLargestPossibleRegion().GetSize()[0]/factor ); factor = meanSpacing/spacing[1]; size[1] = ( long unsigned int ) ( m_Input->GetLargestPossibleRegion().GetSize()[1]/factor ); spacing[0] = meanSpacing; spacing[1] = meanSpacing; if( VDimension == 3 ) { factor = meanSpacing/spacing[VDimension-1]; size[VDimension-1] = ( long unsigned int ) ( m_Input->GetLargestPossibleRegion().GetSize()[VDimension-1] / factor ); spacing[VDimension-1] = meanSpacing; } } imSub2->SetRegions( size ); imSub2->SetSpacing( spacing ); imSub2->Allocate(); this->ResampleImage( imSub2 ); } //------------------------------------------------------------------------ template< unsigned int VDimension > void ImageMathFilters<VDimension> ::Resize( ImageType * ref ) { this->ResampleImage( ref ); } //------------------------------------------------------------------------ template< unsigned int VDimension > void ImageMathFilters<VDimension> ::ExtractSlice( unsigned int dimension, unsigned int slice ) { typedef itk::ExtractImageFilter<ImageType, ImageType> ExtractSliceFilterType; typename ExtractSliceFilterType::Pointer filter = ExtractSliceFilterType::New(); typename ImageType::SizeType size = m_Input->GetLargestPossibleRegion().GetSize(); typename ImageType::IndexType extractIndex; typename ImageType::SizeType extractSize; for( unsigned int d=0; d<ImageType::ImageDimension; ++d ) { extractIndex[d] = 0; extractSize[d] = size[d]; } extractIndex[dimension] = slice; extractSize[dimension] = 1; typename ImageType::RegionType desiredRegion( extractIndex, extractSize ); filter->SetInput( m_Input ); filter->SetExtractionRegion( desiredRegion ); filter->UpdateLargestPossibleRegion(); filter->Update(); m_Input = filter->GetOutput(); } template< unsigned int VDimension > void ImageMathFilters<VDimension> ::EnhanceVessels( double scaleMin, double scaleMax, double numScales ) { double logScaleStep = ( std::log( scaleMax ) - std::log( scaleMin ) ) / ( numScales-1 ); typedef itk::tube::NJetImageFunction< ImageType > ImageFunctionType; typename ImageFunctionType::Pointer imFunc = ImageFunctionType::New(); imFunc->SetInputImage( m_Input ); typename ImageType::Pointer input2 = ImageType::New(); input2->SetRegions( m_Input->GetLargestPossibleRegion() ); input2->SetOrigin( m_Input->GetOrigin() ); input2->SetSpacing( m_Input->GetSpacing() ); input2->CopyInformation( m_Input ); input2->Allocate(); itk::ImageRegionIteratorWithIndex< ImageType > it1( m_Input, m_Input->GetLargestPossibleRegion() ); itk::ImageRegionIterator< ImageType > it2( input2, input2->GetLargestPossibleRegion() ); double ridgeness = 0; double intensity = 0; double scale = scaleMin; std::cout << " Processing scale " << scale << std::endl; it1.GoToBegin(); it2.GoToBegin(); typename ImageFunctionType::ContinuousIndexType cIndx; while( !it1.IsAtEnd() ) { for( unsigned int d=0; d<ImageType::ImageDimension; ++d ) { cIndx[d] = it1.GetIndex()[d]; } ridgeness = imFunc->RidgenessAtContinuousIndex( cIndx, scale ); intensity = imFunc->GetMostRecentIntensity(); double val = ridgeness * intensity; it2.Set( ( PixelType )val ); ++it1; ++it2; } for( unsigned int i=1; i<numScales; i++ ) { scale = std::exp( std::log( scaleMin ) + i * logScaleStep ); std::cout << " Processing scale " << scale << std::endl; it1.GoToBegin(); it2.GoToBegin(); while( !it1.IsAtEnd() ) { for( unsigned int d=0; d<ImageType::ImageDimension; ++d ) { cIndx[d] = it1.GetIndex()[d]; } ridgeness = imFunc->RidgenessAtContinuousIndex( cIndx, scale ); intensity = imFunc->GetMostRecentIntensity(); double val = ridgeness * intensity; if( val > it2.Get() ) { it2.Set( ( PixelType )val ); } ++it1; ++it2; } } it1.GoToBegin(); it2.GoToBegin(); while( !it1.IsAtEnd() ) { it1.Set( it2.Get() ); ++it1; ++it2; } } template< unsigned int VDimension > void ImageMathFilters<VDimension> ::SegmentUsingConnectedThreshold( float threshLow, float threshHigh, float labelValue, float x, float y, float z ) { typedef itk::ConnectedThresholdImageFilter<ImageType, ImageType> FilterType; typename FilterType::Pointer filter = FilterType::New(); typename ImageType::IndexType seed; seed[0] = ( long int )x; seed[1] = ( long int )y; if( VDimension == 3 ) { seed[VDimension-1] = ( long int )z; } filter->SetInput( m_Input ); filter->SetLower( threshLow ); filter->SetUpper( threshHigh ); filter->AddSeed( seed ); filter->SetReplaceValue( labelValue ); filter->Update(); m_Input = filter->GetOutput(); } template< unsigned int VDimension > std::vector< itk::ContinuousIndex< double, VDimension > > ImageMathFilters<VDimension> ::ComputeVoronoiTessellation( unsigned int numberOfCentroids, unsigned int numberOfIterations, unsigned int numberOfSamples ) { typedef itk::tube::CVTImageFilter<ImageType, ImageType> FilterType; typename FilterType::Pointer filter = FilterType::New(); filter->SetInput( m_Input ); filter->SetNumberOfSamples( numberOfSamples ); filter->SetNumberOfCentroids( numberOfCentroids ); filter->SetNumberOfIterations( numberOfIterations ); filter->SetNumberOfSamplesPerBatch( numberOfIterations ); filter->Update(); std::vector< itk::ContinuousIndex< double, VDimension > > centroids; centroids = filter->GetCentroids(); m_VoronoiTessellationAdjacencyMatrix = filter->GetAdjacencyMatrix(); return centroids; } } // End namespace tube #endif // End !defined( __tubeImageMathFilters_hxx )
28.179805
80
0.591671
[ "vector" ]
04c4cf4e6b2c0c22f5b512f11ee3370db3b1005d
10,422
cc
C++
cpp/src/arrow/stl-test.cc
jblondin/arrow
319effd98e6d1d4282751471ebefaf325b0df09f
[ "Apache-2.0" ]
6
2019-08-18T11:04:42.000Z
2021-12-29T13:47:07.000Z
cpp/src/arrow/stl-test.cc
jblondin/arrow
319effd98e6d1d4282751471ebefaf325b0df09f
[ "Apache-2.0" ]
3
2021-07-26T15:45:24.000Z
2022-01-18T10:13:28.000Z
cpp/src/arrow/stl-test.cc
jblondin/arrow
319effd98e6d1d4282751471ebefaf325b0df09f
[ "Apache-2.0" ]
3
2021-03-23T19:45:48.000Z
2021-03-23T21:36:16.000Z
// Licensed to the Apache Software Foundation (ASF) under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use this file except in compliance // with the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, // software distributed under the License is distributed on an // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. #include <cstdint> #include <memory> #include <string> #include <vector> #include <gtest/gtest.h> #include "arrow/stl.h" #include "arrow/table.h" #include "arrow/testing/gtest_util.h" #include "arrow/type.h" using primitive_types_tuple = std::tuple<int8_t, int16_t, int32_t, int64_t, uint8_t, uint16_t, uint32_t, uint64_t, bool, std::string>; namespace arrow { namespace stl { TEST(TestSchemaFromTuple, PrimitiveTypesVector) { Schema expected_schema( {field("column1", int8(), false), field("column2", int16(), false), field("column3", int32(), false), field("column4", int64(), false), field("column5", uint8(), false), field("column6", uint16(), false), field("column7", uint32(), false), field("column8", uint64(), false), field("column9", boolean(), false), field("column10", utf8(), false)}); std::shared_ptr<Schema> schema = SchemaFromTuple<primitive_types_tuple>::MakeSchema( std::vector<std::string>({"column1", "column2", "column3", "column4", "column5", "column6", "column7", "column8", "column9", "column10"})); ASSERT_TRUE(expected_schema.Equals(*schema)); } TEST(TestSchemaFromTuple, PrimitiveTypesTuple) { Schema expected_schema( {field("column1", int8(), false), field("column2", int16(), false), field("column3", int32(), false), field("column4", int64(), false), field("column5", uint8(), false), field("column6", uint16(), false), field("column7", uint32(), false), field("column8", uint64(), false), field("column9", boolean(), false), field("column10", utf8(), false)}); std::shared_ptr<Schema> schema = SchemaFromTuple<primitive_types_tuple>::MakeSchema( std::make_tuple("column1", "column2", "column3", "column4", "column5", "column6", "column7", "column8", "column9", "column10")); ASSERT_TRUE(expected_schema.Equals(*schema)); } TEST(TestSchemaFromTuple, SimpleList) { Schema expected_schema({field("column1", list(utf8()), false)}); std::shared_ptr<Schema> schema = SchemaFromTuple<std::tuple<std::vector<std::string>>>::MakeSchema({"column1"}); ASSERT_TRUE(expected_schema.Equals(*schema)); } TEST(TestSchemaFromTuple, NestedList) { Schema expected_schema({field("column1", list(list(boolean())), false)}); std::shared_ptr<Schema> schema = SchemaFromTuple<std::tuple<std::vector<std::vector<bool>>>>::MakeSchema( {"column1"}); ASSERT_TRUE(expected_schema.Equals(*schema)); } TEST(TestTableFromTupleVector, PrimitiveTypes) { std::vector<std::string> names{"column1", "column2", "column3", "column4", "column5", "column6", "column7", "column8", "column9", "column10"}; std::vector<primitive_types_tuple> rows{ primitive_types_tuple(-1, -2, -3, -4, 1, 2, 3, 4, true, "Tests"), primitive_types_tuple(-10, -20, -30, -40, 10, 20, 30, 40, false, "Other")}; std::shared_ptr<Table> table; ASSERT_OK(TableFromTupleRange(default_memory_pool(), rows, names, &table)); std::shared_ptr<Schema> expected_schema = schema({field("column1", int8(), false), field("column2", int16(), false), field("column3", int32(), false), field("column4", int64(), false), field("column5", uint8(), false), field("column6", uint16(), false), field("column7", uint32(), false), field("column8", uint64(), false), field("column9", boolean(), false), field("column10", utf8(), false)}); // Construct expected arrays std::shared_ptr<Array> int8_array = ArrayFromJSON(int8(), "[-1, -10]"); std::shared_ptr<Array> int16_array = ArrayFromJSON(int16(), "[-2, -20]"); std::shared_ptr<Array> int32_array = ArrayFromJSON(int32(), "[-3, -30]"); std::shared_ptr<Array> int64_array = ArrayFromJSON(int64(), "[-4, -40]"); std::shared_ptr<Array> uint8_array = ArrayFromJSON(uint8(), "[1, 10]"); std::shared_ptr<Array> uint16_array = ArrayFromJSON(uint16(), "[2, 20]"); std::shared_ptr<Array> uint32_array = ArrayFromJSON(uint32(), "[3, 30]"); std::shared_ptr<Array> uint64_array = ArrayFromJSON(uint64(), "[4, 40]"); std::shared_ptr<Array> bool_array = ArrayFromJSON(boolean(), "[true, false]"); std::shared_ptr<Array> string_array = ArrayFromJSON(utf8(), R"(["Tests", "Other"])"); auto expected_table = Table::Make(expected_schema, {int8_array, int16_array, int32_array, int64_array, uint8_array, uint16_array, uint32_array, uint64_array, bool_array, string_array}); ASSERT_TRUE(expected_table->Equals(*table)); } TEST(TestTableFromTupleVector, ListType) { using tuple_type = std::tuple<std::vector<int64_t>>; auto expected_schema = std::shared_ptr<Schema>(new Schema({field("column1", list(int64()), false)})); std::shared_ptr<Array> expected_array = ArrayFromJSON(list(int64()), "[[1, 1, 2, 34], [2, -4]]"); std::shared_ptr<Table> expected_table = Table::Make(expected_schema, {expected_array}); std::vector<tuple_type> rows{tuple_type(std::vector<int64_t>{1, 1, 2, 34}), tuple_type(std::vector<int64_t>{2, -4})}; std::vector<std::string> names{"column1"}; std::shared_ptr<Table> table; ASSERT_OK(TableFromTupleRange(default_memory_pool(), rows, names, &table)); ASSERT_TRUE(expected_table->Equals(*table)); } TEST(TestTupleVectorFromTable, PrimitiveTypes) { compute::FunctionContext ctx; compute::CastOptions cast_options; std::vector<primitive_types_tuple> expected_rows{ primitive_types_tuple(-1, -2, -3, -4, 1, 2, 3, 4, true, "Tests"), primitive_types_tuple(-10, -20, -30, -40, 10, 20, 30, 40, false, "Other")}; std::shared_ptr<Schema> schema = std::shared_ptr<Schema>( new Schema({field("column1", int8(), false), field("column2", int16(), false), field("column3", int32(), false), field("column4", int64(), false), field("column5", uint8(), false), field("column6", uint16(), false), field("column7", uint32(), false), field("column8", uint64(), false), field("column9", boolean(), false), field("column10", utf8(), false)})); // Construct expected arrays std::shared_ptr<Array> int8_array; ArrayFromVector<Int8Type, int8_t>({-1, -10}, &int8_array); std::shared_ptr<Array> int16_array; ArrayFromVector<Int16Type, int16_t>({-2, -20}, &int16_array); std::shared_ptr<Array> int32_array; ArrayFromVector<Int32Type, int32_t>({-3, -30}, &int32_array); std::shared_ptr<Array> int64_array; ArrayFromVector<Int64Type, int64_t>({-4, -40}, &int64_array); std::shared_ptr<Array> uint8_array; ArrayFromVector<UInt8Type, uint8_t>({1, 10}, &uint8_array); std::shared_ptr<Array> uint16_array; ArrayFromVector<UInt16Type, uint16_t>({2, 20}, &uint16_array); std::shared_ptr<Array> uint32_array; ArrayFromVector<UInt32Type, uint32_t>({3, 30}, &uint32_array); std::shared_ptr<Array> uint64_array; ArrayFromVector<UInt64Type, uint64_t>({4, 40}, &uint64_array); std::shared_ptr<Array> bool_array; ArrayFromVector<BooleanType, bool>({true, false}, &bool_array); std::shared_ptr<Array> string_array; ArrayFromVector<StringType, std::string>({"Tests", "Other"}, &string_array); auto table = Table::Make( schema, {int8_array, int16_array, int32_array, int64_array, uint8_array, uint16_array, uint32_array, uint64_array, bool_array, string_array}); std::vector<primitive_types_tuple> rows(2); ASSERT_OK(TupleRangeFromTable(*table, cast_options, &ctx, &rows)); ASSERT_EQ(rows, expected_rows); // The number of rows must match std::vector<primitive_types_tuple> too_few_rows(1); ASSERT_RAISES(Invalid, TupleRangeFromTable(*table, cast_options, &ctx, &too_few_rows)); // The number of columns must match std::shared_ptr<Table> corrupt_table; ASSERT_OK(table->RemoveColumn(0, &corrupt_table)); ASSERT_RAISES(Invalid, TupleRangeFromTable(*corrupt_table, cast_options, &ctx, &rows)); } TEST(TestTupleVectorFromTable, ListType) { using tuple_type = std::tuple<std::vector<int64_t>>; compute::FunctionContext ctx; compute::CastOptions cast_options; auto expected_schema = std::shared_ptr<Schema>(new Schema({field("column1", list(int64()), false)})); std::shared_ptr<Array> expected_array = ArrayFromJSON(list(int64()), "[[1, 1, 2, 34], [2, -4]]"); std::shared_ptr<Table> table = Table::Make(expected_schema, {expected_array}); std::vector<tuple_type> expected_rows{tuple_type(std::vector<int64_t>{1, 1, 2, 34}), tuple_type(std::vector<int64_t>{2, -4})}; std::vector<tuple_type> rows(2); ASSERT_OK(TupleRangeFromTable(*table, cast_options, &ctx, &rows)); ASSERT_EQ(rows, expected_rows); } TEST(TestTupleVectorFromTable, CastingNeeded) { using tuple_type = std::tuple<std::vector<int64_t>>; compute::FunctionContext ctx; compute::CastOptions cast_options; auto expected_schema = std::shared_ptr<Schema>(new Schema({field("column1", list(int16()), false)})); std::shared_ptr<Array> expected_array = ArrayFromJSON(list(int16()), "[[1, 1, 2, 34], [2, -4]]"); std::shared_ptr<Table> table = Table::Make(expected_schema, {expected_array}); std::vector<tuple_type> expected_rows{tuple_type(std::vector<int64_t>{1, 1, 2, 34}), tuple_type(std::vector<int64_t>{2, -4})}; std::vector<tuple_type> rows(2); ASSERT_OK(TupleRangeFromTable(*table, cast_options, &ctx, &rows)); ASSERT_EQ(rows, expected_rows); } } // namespace stl } // namespace arrow
45.710526
90
0.673959
[ "vector" ]
04c502f74ec6317082a7772b871dc64d4a23169d
2,774
cpp
C++
C++/source/sorting/counting_sort.cpp
SKAUL05/Algos
f611f072035ea35604983a89a6f7ff38bde43134
[ "MIT" ]
2
2017-07-06T14:34:32.000Z
2021-03-06T04:53:43.000Z
C++/source/sorting/counting_sort.cpp
SKAUL05/Algos
f611f072035ea35604983a89a6f7ff38bde43134
[ "MIT" ]
null
null
null
C++/source/sorting/counting_sort.cpp
SKAUL05/Algos
f611f072035ea35604983a89a6f7ff38bde43134
[ "MIT" ]
null
null
null
/* Counting sort (stable) ---------------------- An integer sorting algorithm that operates by counting the number of objects that have each distinct key value, and using arithmetic on those counts to determine the positions of each key value in the output sequence. Time complexity --------------- O(N + R), where N is the number of elements and R is the range of input. Space complexity ---------------- O(N), where N is the number of elements. */ #include <iostream> #include <vector> #include "sorting/utils.hpp" using namespace std; void counting_sort(vector<int>& values, const int order, const bool to_show_state) { int min_value = values[0]; int max_value = values[0]; // find minimum and maximum values in input vector for (const int& value : values) { if (value < min_value) min_value = value; else if (value > max_value) max_value = value; } // calculate unique values in input vector const int unique_values = max_value - min_value + 1; // calculate frequencies of each unique value in input vector // freq[0] is number of min_value occurencies and so on vector<int> freq(unique_values, 0); for (const int &value : values) { ++freq[value - min_value]; } // start and end indices, for calculating cumulative frequency int start = 1; int end = freq.size(); // if order is reversed, the indices are reversed too if (order == -1) { // 'order' is -1 for descending, 1 for ascending start = freq.size() - 2; end = -1; } // calculate cumulative frequency: // freq[i] will now be the number of elements in the sorted array that are // less than or equal to value[i] for (int i = start; i != end; i += order) { freq[i] += freq[i - order]; } // place values in sorted order by iterating input vector in reversed order, // to maintain sorting stability vector<int> sorted(values.size()); int value; for (auto iter = values.rbegin(); iter != values.rend(); ++iter) { value = *iter; sorted[freq[value - min_value] - 1] = value; --freq[value - min_value]; if (to_show_state) display_state(sorted); } values.assign(sorted.begin(), sorted.end()); } int main() { size_t size; get_input_size(size); vector<int> values(size); get_input_values(values, size); int order; string order_text; get_order(order, order_text); bool to_show_state; get_whether_to_show_state(to_show_state); counting_sort(values, order, to_show_state); cout << "\nThe values in " << order_text << " order are:\n"; display_state(values); return 0; }
27.465347
84
0.620764
[ "vector" ]
04c86c41b990ad978442369093c0fa765bbeea2d
6,335
cxx
C++
IMU/VTK-6.2.0/Rendering/Core/vtkAbstractMapper.cxx
timkrentz/SunTracker
9a189cc38f45e5fbc4e4c700d7295a871d022795
[ "MIT" ]
4
2016-03-30T14:31:52.000Z
2019-02-02T05:01:32.000Z
IMU/VTK-6.2.0/Rendering/Core/vtkAbstractMapper.cxx
timkrentz/SunTracker
9a189cc38f45e5fbc4e4c700d7295a871d022795
[ "MIT" ]
null
null
null
IMU/VTK-6.2.0/Rendering/Core/vtkAbstractMapper.cxx
timkrentz/SunTracker
9a189cc38f45e5fbc4e4c700d7295a871d022795
[ "MIT" ]
null
null
null
/*========================================================================= Program: Visualization Toolkit Module: vtkAbstractMapper.cxx Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen All rights reserved. See Copyright.txt or http://www.kitware.com/Copyright.htm for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notice for more information. =========================================================================*/ #include "vtkAbstractMapper.h" #include "vtkAbstractArray.h" #include "vtkCellData.h" #include "vtkDataArray.h" #include "vtkDataSet.h" #include "vtkObjectFactory.h" #include "vtkPlaneCollection.h" #include "vtkPlanes.h" #include "vtkPointData.h" #include "vtkTimerLog.h" vtkCxxSetObjectMacro(vtkAbstractMapper,ClippingPlanes,vtkPlaneCollection); // Construct object. vtkAbstractMapper::vtkAbstractMapper() { this->TimeToDraw = 0.0; this->LastWindow = NULL; this->ClippingPlanes = NULL; this->Timer = vtkTimerLog::New(); this->SetNumberOfOutputPorts(0); this->SetNumberOfInputPorts(1); } vtkAbstractMapper::~vtkAbstractMapper() { this->Timer->Delete(); if (this->ClippingPlanes) { this->ClippingPlanes->UnRegister(this); } } // Description: // Override Modifiedtime as we have added Clipping planes unsigned long vtkAbstractMapper::GetMTime() { unsigned long mTime = this->Superclass::GetMTime(); unsigned long clipMTime; if ( this->ClippingPlanes != NULL ) { clipMTime = this->ClippingPlanes->GetMTime(); mTime = ( clipMTime > mTime ? clipMTime : mTime ); } return mTime; } void vtkAbstractMapper::AddClippingPlane(vtkPlane *plane) { if (this->ClippingPlanes == NULL) { this->ClippingPlanes = vtkPlaneCollection::New(); this->ClippingPlanes->Register(this); this->ClippingPlanes->Delete(); } this->ClippingPlanes->AddItem(plane); this->Modified(); } void vtkAbstractMapper::RemoveClippingPlane(vtkPlane *plane) { if (this->ClippingPlanes == NULL) { vtkErrorMacro(<< "Cannot remove clipping plane: mapper has none"); return; } this->ClippingPlanes->RemoveItem(plane); this->Modified(); } void vtkAbstractMapper::RemoveAllClippingPlanes() { if ( this->ClippingPlanes ) { this->ClippingPlanes->RemoveAllItems(); } } void vtkAbstractMapper::SetClippingPlanes(vtkPlanes *planes) { vtkPlane *plane; if (!planes) { return; } int numPlanes = planes->GetNumberOfPlanes(); this->RemoveAllClippingPlanes(); for (int i=0; i<numPlanes && i<6; i++) { plane = vtkPlane::New(); planes->GetPlane(i, plane); this->AddClippingPlane(plane); plane->Delete(); } } vtkDataArray* vtkAbstractMapper::GetScalars(vtkDataSet *input, int scalarMode, int arrayAccessMode, int arrayId, const char *arrayName, int& cellFlag) { vtkAbstractArray* abstractScalars = vtkAbstractMapper::GetAbstractScalars(input, scalarMode, arrayAccessMode, arrayId, arrayName, cellFlag); vtkDataArray* scalars = vtkDataArray::SafeDownCast(abstractScalars); return scalars; } vtkAbstractArray* vtkAbstractMapper::GetAbstractScalars(vtkDataSet *input, int scalarMode, int arrayAccessMode, int arrayId, const char *arrayName, int& cellFlag) { vtkAbstractArray *scalars=NULL; vtkPointData *pd; vtkCellData *cd; vtkFieldData *fd; // make sure we have an input if ( !input ) { return NULL; } // get and scalar data according to scalar mode if ( scalarMode == VTK_SCALAR_MODE_DEFAULT ) { scalars = input->GetPointData()->GetScalars(); cellFlag = 0; if (!scalars) { scalars = input->GetCellData()->GetScalars(); cellFlag = 1; } } else if ( scalarMode == VTK_SCALAR_MODE_USE_POINT_DATA ) { scalars = input->GetPointData()->GetScalars(); cellFlag = 0; } else if ( scalarMode == VTK_SCALAR_MODE_USE_CELL_DATA ) { scalars = input->GetCellData()->GetScalars(); cellFlag = 1; } else if ( scalarMode == VTK_SCALAR_MODE_USE_POINT_FIELD_DATA ) { pd = input->GetPointData(); if (arrayAccessMode == VTK_GET_ARRAY_BY_ID) { scalars = pd->GetAbstractArray(arrayId); } else { scalars = pd->GetAbstractArray(arrayName); } cellFlag = 0; } else if ( scalarMode == VTK_SCALAR_MODE_USE_CELL_FIELD_DATA ) { cd = input->GetCellData(); if (arrayAccessMode == VTK_GET_ARRAY_BY_ID) { scalars = cd->GetAbstractArray(arrayId); } else { scalars = cd->GetAbstractArray(arrayName); } cellFlag = 1; } else if ( scalarMode == VTK_SCALAR_MODE_USE_FIELD_DATA ) { fd = input->GetFieldData(); if (arrayAccessMode == VTK_GET_ARRAY_BY_ID) { scalars = fd->GetAbstractArray(arrayId); } else { scalars = fd->GetAbstractArray(arrayName); } cellFlag = 2; } return scalars; } // Shallow copy of vtkProp. void vtkAbstractMapper::ShallowCopy(vtkAbstractMapper *mapper) { this->SetClippingPlanes( mapper->GetClippingPlanes() ); } void vtkAbstractMapper::PrintSelf(ostream& os, vtkIndent indent) { this->Superclass::PrintSelf(os,indent); os << indent << "TimeToDraw: " << this->TimeToDraw << "\n"; if ( this->ClippingPlanes ) { os << indent << "ClippingPlanes:\n"; this->ClippingPlanes->PrintSelf(os,indent.GetNextIndent()); } else { os << indent << "ClippingPlanes: (none)\n"; } }
26.506276
109
0.58311
[ "object" ]
04cf103366989288759f39fd2d561535d54c6fcf
7,659
cpp
C++
src/Rcpp_s2cell.cpp
odvratnozgodan/s2
e5293d0944e5053e0300d61823914728032c16c9
[ "Apache-2.0" ]
null
null
null
src/Rcpp_s2cell.cpp
odvratnozgodan/s2
e5293d0944e5053e0300d61823914728032c16c9
[ "Apache-2.0" ]
null
null
null
src/Rcpp_s2cell.cpp
odvratnozgodan/s2
e5293d0944e5053e0300d61823914728032c16c9
[ "Apache-2.0" ]
null
null
null
#include "Rcpp_datatypes.h" #include <Rcpp.h> #include <s2/s2.h> #include <s2/s2cap.h> #include <s2/s2cellid.h> #include <s2/s2cell.h> #include <s2/s2polygon.h> #include <s2/s2regioncoverer.h> using namespace Rcpp; // Declare function from Rcpp_s2polygon.cpp void S2PolygonInitFromR(List, S2Polygon&); std::vector<S2CellId> S2CellId_FromS2Point(std::vector<S2Point> x, IntegerVector level){ int n = x.size(); int nlev = level.size(); int lev = level[0]; std::vector<S2CellId> rslt(n); if(nlev == 1 && lev == 30){ // Default case of single level == 30 for(int i=0; i<n; i++){ rslt[i] = S2CellId::FromPoint(x[i]); } } else{ // Generic case for(int i=0; i<n; i++){ if(nlev > 1){ lev = level[i]; } rslt[i] = S2CellId::FromPoint(x[i]); if(lev!=30){ rslt[i] = rslt[i].parent(lev); } } } return rslt; } std::vector<S2CellId> S2CellId_FromS2LatLng(std::vector<S2LatLng> x, IntegerVector level){ int n = x.size(); int nlev = level.size(); int lev = level[0]; std::vector<S2CellId> rslt(n); if(nlev == 1 & lev == 30){ // Default case of single level == 30 for(int i=0; i<n; i++){ rslt[i] = S2CellId::FromLatLng(x[i]); } } else{ // Generic case for(int i=0; i<n; i++){ if(nlev > 1){ lev = level[i]; } rslt[i] = S2CellId::FromLatLng(x[i]); if(lev!=30){ rslt[i] = rslt[i].parent(lev); } } } return rslt; } List S2CellIdWrapForR(std::vector<S2CellId> ids, IntegerVector levels){ int n = ids.size(); CharacterVector tokens(n); for(int i=0; i<n; i++){ tokens[i] = ids[i].ToToken(); } List rslt = List::create(Named("id") = tokens, Named("level") = levels); rslt.attr("class") = "S2CellId"; return rslt; } CharacterVector S2CellIdStringWrapForR(std::vector<S2CellId> ids){ int n = ids.size(); CharacterVector strings(n); for(int i=0; i<n; i++){ strings[i] = ids[i].ToString(); } return strings; } std::vector<S2CellId> R_S2CellIdFromTokens(std::vector<std::string> tokens){ int n = tokens.size(); std::vector<S2CellId> ids(n); for(int i=0; i<n; i++){ ids[i] = S2CellId::FromToken(tokens[i]); } return ids; } //' Make a Vector of S2CellIds From Points on the Sphere //' //' Create a vector of S2CellIds corresponding to the cells at the given level //' containing the given points. The default level (30) corresponds to leaf //' cells (finest level). //' //' @param x Three-column matrix reprensenting the points. //' @param level Integer between 0 and 30 (incl). //' @return An object of class `S2CellId`. //' @export S2CellIdFromPoint //[[Rcpp::export]] List S2CellIdFromPoint(NumericMatrix x, IntegerVector level = 30){ auto points = S2PointVecFromR(x); auto ids = S2CellId_FromS2Point(points, level); return S2CellIdWrapForR(ids, level); } //' Convert S2CellId to a S2Point //' //' Convert S2CellId to a S2Point //' //' @param x Object of class S2CellId. //' @return Three-column matrix reprensenting the points.. //' @export S2CellId_ToPoint //[[Rcpp::export]] NumericMatrix S2CellId_ToPoint(List x){ std::vector<std::string> tokens = x["id"]; auto ids = R_S2CellIdFromTokens(tokens); int n = tokens.size(); std::vector<S2Point> output(n); for(int i=0; i<n; i++){ output[i] = ids[i].ToPoint(); } return S2PointVecToR(output); } //' Make a Vector of S2CellIds From Points on the Sphere //' //' Create a vector of S2CellIds corresponding to the cells at the given level //' containing the given points. The default level (30) corresponds to leaf //' cells (finest level). //' //' @param x Two-column matrix reprensenting the points. //' @param level Integer between 0 and 30 (incl). //' @return An object of class `S2CellId`. //' @export S2CellIdFromLatLng //[[Rcpp::export]] List S2CellIdFromLatLng(NumericMatrix x, IntegerVector level = 30){ auto points = S2LatLngVecFromR(x); auto ids = S2CellId_FromS2LatLng(points, level); return S2CellIdWrapForR(ids, level); } //' Make a vector of S2CellId strings //' //' Make a vector of S2CellId strings //' //' @param x A charecter vector with S2CellIds (in token form). //' @return A character vector with S2CellId strings. //' @export S2CellId_ToString //[[Rcpp::export]] CharacterVector S2CellId_ToString(std::vector<std::string> x){ auto ids = R_S2CellIdFromTokens(x); return S2CellIdStringWrapForR(ids); } std::vector<S2CellId> R_S2CellIdFromPoints(NumericMatrix mat, int level){ auto points = S2PointVecFromR(mat); // int n = points.size(); // std::vector<S2CellId> ids(n); // for(int i=0; i<n; i++){ // S2CellId tmp = S2CellId::FromPoint(points[i]); // ids[i] = tmp.parent(level); // } // return ids; return S2CellId_FromS2Point(points, level); } std::vector<S2CellId> R_S2CellIdFromLatLngs(NumericMatrix mat, int level){ auto points = S2LatLngVecFromR(mat); // int n = points.size(); // std::vector<S2CellId> ids(n); // for(int i=0; i<n; i++){ // S2CellId tmp = S2CellId::FromPoint(points[i]); // ids[i] = tmp.parent(level); // } // return ids; return S2CellId_FromS2LatLng(points, level); } List S2Cell_vertices_from_id(std::vector<S2CellId> cellids){ int n = cellids.size(); List rslt(n); for(int i=0; i<n; i++){ S2Cell cell(cellids[i]); // std::vector<S2Point> ver(4); NumericMatrix vertices_i(4, 3); for(int j=0; j<4; j++){ auto v = cell.GetVertex(j); vertices_i(j, 0) = v.x(); vertices_i(j, 1) = v.y(); vertices_i(j, 2) = v.z(); } rslt[i] = vertices_i; } return rslt; } //[[Rcpp::export]] List S2Cell_vertices_from_token(std::vector<std::string> tokens){ auto cellids = R_S2CellIdFromTokens(tokens); return S2Cell_vertices_from_id(cellids); } //[[Rcpp::export]] List S2Cell_vertices_from_point(NumericMatrix mat, int level){ auto cellids = R_S2CellIdFromPoints(mat, level); return S2Cell_vertices_from_id(cellids); } //[[Rcpp::export]] List S2Cell_vertices_from_latlng(NumericMatrix mat, int level){ auto cellids = R_S2CellIdFromLatLngs(mat, level); return S2Cell_vertices_from_id(cellids); } //[[Rcpp::export]] NumericMatrix S2Cell_grid_centers(int level){ if(level<0 || level>9){ stop("The level must be non-negative and not more than 9 for now..."); } long n = 6*pow(4,level); NumericMatrix rslt(n,3); long i=0; for(S2CellId cellid = S2CellId::Begin(level); cellid != S2CellId::End(level); cellid = cellid.next()){ auto tmp = cellid.ToPoint(); rslt(i,0) = tmp.x(); rslt(i,1) = tmp.y(); rslt(i,2) = tmp.z(); i++; } return rslt; } //[[Rcpp::export]] List S2Covering_internal(List x, std::string type, int max_cells, int min_level, int max_level, bool interior){ // Zero or negative values corresponds to not setting that parameter. S2RegionCoverer coverer; if(max_cells > 0) coverer.set_max_cells(max_cells); if(min_level >= 0) coverer.set_min_level(min_level); if(max_level >= 0) coverer.set_max_level(max_level); vector<S2CellId> covering; if(type == "s2cap"){ S2Cap region = S2CapFromR(x); if(interior){ coverer.GetInteriorCovering(region, &covering); } else{ coverer.GetCovering(region, &covering); } } else if(type == "s2polygon"){ S2Polygon region; S2PolygonInitFromR(x, region); if(interior){ coverer.GetInteriorCovering(region, &covering); } else{ coverer.GetCovering(region, &covering); } } else{ stop("Type must be s2cap or s2polygon."); } int n = covering.size(); IntegerVector level(n); for(int i=0; i<n; i++){ level[i] = covering[i].level(); } return S2CellIdWrapForR(covering, level); }
27.952555
111
0.656744
[ "object", "vector" ]
04d31899b49248b929a3a423775b2ed474e36796
919
cpp
C++
64. Minimum Path Sum/Solution.cpp
Ainevsia/Leetcode-Rust
c4f16d72f3c0d0524478b6bb90fefae9607d88be
[ "BSD-2-Clause" ]
15
2020-02-07T13:04:05.000Z
2022-03-02T14:33:21.000Z
64. Minimum Path Sum/Solution.cpp
Ainevsia/Leetcode-Rust
c4f16d72f3c0d0524478b6bb90fefae9607d88be
[ "BSD-2-Clause" ]
null
null
null
64. Minimum Path Sum/Solution.cpp
Ainevsia/Leetcode-Rust
c4f16d72f3c0d0524478b6bb90fefae9607d88be
[ "BSD-2-Clause" ]
3
2020-04-02T15:36:57.000Z
2021-09-14T14:13:44.000Z
#include <string> #include <vector> #include <iostream> #include <sstream> #include <algorithm> #include <tuple> #include <deque> #include <unordered_map> #include <map> #include <cmath> #include <queue> using namespace std; class Solution { public: int minPathSum(vector<vector<int>>& grid) { if (grid.size() == 0) return 0; if (grid[0].size() == 0) return 0; int m = grid.size(), n = grid[0].size(); // deal with the first line for (int i = 1; i < m; i ++) { grid[0][i] += grid[0][i - 1]; } for (int i = 1; i < m; i ++) { // deal with the first colomn grid[i][0] += grid[i - 1][0]; for (int j = 1; j < n; j ++) { grid[i][j] = min(grid[i][j - 1], grid[i - 1][j]) + grid[i][j]; } } return grid[m - 1][n - 1]; } }; int main() { Solution a; return 0; }
22.414634
78
0.482046
[ "vector" ]
04d33bc05680185ab09d1bed13a3bafb88e16806
12,863
cpp
C++
Homework/GraphingCalculator/GraphingCalculator/src/UIObjects.cpp
benjaminmao123/PCC_CS003A
0339d83ebab7536952644517a99dc46702035b2b
[ "MIT" ]
null
null
null
Homework/GraphingCalculator/GraphingCalculator/src/UIObjects.cpp
benjaminmao123/PCC_CS003A
0339d83ebab7536952644517a99dc46702035b2b
[ "MIT" ]
null
null
null
Homework/GraphingCalculator/GraphingCalculator/src/UIObjects.cpp
benjaminmao123/PCC_CS003A
0339d83ebab7536952644517a99dc46702035b2b
[ "MIT" ]
null
null
null
#include "UIObjects.h" Selectable::Selectable() : normalColor(sf::Color::White), highlightedColor(sf::Color::White), pressedColor(sf::Color::White), selectedColor(sf::Color::White), disabledColor(sf::Color::White), isInteractable(true), isSelected(false), isHighlighted(false) { } Selectable::~Selectable() { } void Selectable::SetNormalColor(const sf::Color& color) { normalColor = color; } void Selectable::SetPressedColor(const sf::Color& color) { pressedColor = color; } void Selectable::SetHighlightedColor(const sf::Color& color) { highlightedColor = color; } void Selectable::SetSelectedColor(const sf::Color& color) { selectedColor = color; } void Selectable::SetDisabledColor(const sf::Color& color) { disabledColor = color; } void Selectable::SetIsInteractable(bool state) { isInteractable = state; } const sf::Color& Selectable::GetNormalColor() const { return normalColor; } const sf::Color& Selectable::GetPressedColor() const { return pressedColor; } const sf::Color& Selectable::GetHighlightedColor() const { return highlightedColor; } const sf::Color& Selectable::GetSelectedColor() const { return selectedColor; } const sf::Color& Selectable::GetDisabledColor() const { return disabledColor; } bool Selectable::GetIsInteractable() const { return isInteractable; } bool Selectable::GetIsSelected() const { return isSelected; } bool Selectable::GetIsHighlighted() const { return isHighlighted; } void Selectable::AddEvent(Event* event) { onClickEvents += event; } void Selectable::RemoveEvent(Event* event) { onClickEvents -= event; } void Selectable::OnClick() { SetIsHighlighted(false); onClickEvents.Invoke(); } EventHandler& Selectable::GetOnClickEvents() { return onClickEvents; } void Selectable::SetIsSelected(bool state) { isSelected = true; } void Selectable::SetIsHighlighted(bool state) { isHighlighted = state; } Text::Text() : hAlign(HAlign::Center), vAlign(VAlign::Middle), rect(0, 0, 100, 100) { } void Text::Update() { AlignText(); } void Text::Render(sf::RenderWindow &window) { window.draw(text); } void Text::Load(const std::string& path) { if (font.loadFromFile(path)) text.setFont(font); } void Text::Load(const sf::Font& font) { text.setFont(font); } void Text::SetFillColor(const sf::Color &color) { text.setFillColor(color); } void Text::SetOutlineColor(const sf::Color& color) { text.setOutlineColor(color); } void Text::SetOutlineThickness(float thickness) { text.setOutlineThickness(thickness); } float Text::GetOutlineThickness() const { return text.getOutlineThickness(); } void Text::SetPosition(float x, float y) { text.setPosition(x, y); rect.left = x; rect.top = y; } void Text::SetPosition(const sf::Vector2f &pos) { text.setPosition(pos); rect.left = pos.x; rect.top = pos.y; } sf::Vector2f Text::GetPosition() const { return sf::Vector2f(rect.left, rect.top); } void Text::SetSize(float width, float height) { rect.width = width; rect.height = height; } void Text::SetSize(const sf::Vector2f &dims) { rect.height = dims.x; rect.width = dims.y; } sf::Vector2f Text::GetSize() const { return sf::Vector2f(rect.width, rect.height); } void Text::SetCharacterSize(unsigned int size) { text.setCharacterSize(size); } unsigned int Text::GetCharacterSize() const { return text.getCharacterSize(); } void Text::SetStyle(sf::Text::Style style) { text.setStyle(style); } void Text::SetString(const std::string &str) { text.setString(str); } std::string Text::GetString() const { return text.getString().toAnsiString(); } void Text::SetHorizontalAlign(HAlign hAlign) { this->hAlign = hAlign; } void Text::SetVerticalAlign(VAlign vAlign) { this->vAlign = vAlign; } void Text::AlignText() { float x, y; text.setPosition(rect.left, rect.top); switch (hAlign) { case HAlign::Left: text.setPosition(text.getPosition()); break; case HAlign::Center: x = (text.getPosition().x + ((rect.width / 2)) - (text.getLocalBounds().width / 2)); text.setPosition(x, text.getPosition().y); break; case HAlign::Right: x = (text.getPosition().x + rect.width) - text.getLocalBounds().width; text.setPosition(x, text.getPosition().y); break; default: break; } switch (vAlign) { case VAlign::Top: text.setPosition(text.getPosition()); break; case VAlign::Middle: y = (text.getPosition().y + (rect.height / 2)) - (text.getCharacterSize() / 1.5f); text.setPosition(text.getPosition().x, y); break; case VAlign::Bottom: y = (text.getPosition().y + rect.height - 4) - text.getLocalBounds().height; text.setPosition(text.getPosition().x, y); break; default: break; } } Button::Button() : frame(sf::Vector2f(100, 100)) { frame.setFillColor(GetNormalColor()); } void Button::Update() { ComputeBounds(); text.SetSize(bounds.width, bounds.height); text.SetPosition(frame.getPosition()); text.Update(); } void Button::Render(sf::RenderWindow &window) { if (GetIsInteractable()) { frame.setFillColor(GetNormalColor()); CheckSelection(window); } else frame.setFillColor(GetDisabledColor()); window.draw(frame); text.Render(window); } void Button::SetOutlineColor(const sf::Color& color) { frame.setOutlineColor(color); } void Button::SetTextFillColor(const sf::Color& color) { text.SetFillColor(color); } void Button::SetTextOutlineColor(const sf::Color& color) { text.SetFillColor(color); } void Button::SetOutlineThickness(float thickness) { frame.setOutlineThickness(thickness); } float Button::GetOutlineThickness() const { return frame.getOutlineThickness(); } void Button::SetTextOutlineThickness(float thickness) { text.SetOutlineThickness(thickness); } float Button::GetTextOutlineThickness() const { return text.GetOutlineThickness(); } void Button::SetSize(const sf::Vector2f &dims) { frame.setSize(dims); bounds.width = dims.x; bounds.height = dims.y; } void Button::SetSize(float x, float y) { frame.setSize(sf::Vector2f(x, y)); bounds.width = x; bounds.height = y; } const sf::Vector2f& Button::GetSize() const { return frame.getSize(); } void Button::SetPosition(const sf::Vector2f &pos) { frame.setPosition(pos); bounds.left = pos.x; bounds.top = pos.y; } void Button::SetPosition(float x, float y) { frame.setPosition(x, y); bounds.left = x; bounds.top = y; } const sf::Vector2f& Button::GetPosition() const { return frame.getPosition(); } void Button::SetTextCharacterSize(unsigned int size) { text.SetCharacterSize(size); } unsigned int Button::GetTextCharacterSize() const { return text.GetCharacterSize(); } void Button::SetTextStyle(sf::Text::Style style) { text.SetStyle(style); } void Button::SetText(const std::string &string) { text.SetString(string); } std::string Button::GetText() const { return text.GetString(); } void Button::SetTextHorizontalAlign(HAlign hAlign) { text.SetHorizontalAlign(hAlign); } void Button::SetTextVerticalAlign(VAlign vAlign) { text.SetVerticalAlign(vAlign); } void Button::CheckSelection(sf::RenderWindow &window) { ComputeBounds(); sf::Vector2f mousePosition = sf::Vector2f( float(input.GetMousePosition(window).x), float(input.GetMousePosition(window).y)); SetIsHighlighted(false); if (bounds.contains(mousePosition)) { frame.setFillColor(GetHighlightedColor()); SetIsHighlighted(true); if (input.GetMouseButton(sf::Mouse::Left)) frame.setFillColor(GetPressedColor()); if (input.GetMouseButton(sf::Mouse::Left)) OnClick(); } } void Button::Load(const std::string &texturePath, const std::string &fontPath) { if (texturePath != "") if (texture.loadFromFile(texturePath)) frame.setTexture(&texture); if (fontPath != "") text.Load(fontPath); } void Button::Load(sf::Texture *texture, const sf::Font &font) { if (texture) frame.setTexture(texture); text.Load(font); } void Button::ComputeBounds() { bounds.left = frame.getPosition().x; bounds.top = frame.getPosition().y; bounds.width = frame.getSize().x; bounds.height = frame.getSize().y; } InputField::InputField() : isSelected(false), currentString("") { field.setSize(sf::Vector2f(100, 100)); field.setFillColor(GetNormalColor()); text.SetString(currentString); } void InputField::Update() { ComputeBounds(); text.SetSize(bounds.width, bounds.height); text.SetPosition(field.getPosition()); text.Update(); } void InputField::Render(sf::RenderWindow &window) { if (GetIsInteractable()) { if (!isSelected) field.setFillColor(GetNormalColor()); CheckSelection(window); } else field.setFillColor(GetDisabledColor()); window.draw(field); text.Render(window); } void InputField::Load(const std::string &texturePath, const std::string &fontPath) { if (texturePath != "") if (texture.loadFromFile(texturePath)) field.setTexture(&texture); if (fontPath != "") text.Load(fontPath); } void InputField::Load(sf::Texture *texture, const sf::Font &font) { if (texture) field.setTexture(texture); text.Load(font); } void InputField::SetFillColor(const sf::Color& color) { field.setFillColor(color); } void InputField::SetOutlineColor(const sf::Color &color) { field.setOutlineColor(color); } void InputField::SetTextFillColor(const sf::Color& color) { text.SetFillColor(color); } void InputField::SetTextOutlineColor(const sf::Color& color) { text.SetOutlineColor(color); } void InputField::SetOutlineThickness(float value) { field.setOutlineThickness(value); } float InputField::GetOutlineThickness() const { return field.getOutlineThickness(); } void InputField::SetTextOutlineThickness(float value) { text.SetOutlineThickness(value); } float InputField::GetTextOutlineThickness() const { return text.GetOutlineThickness(); } void InputField::SetSize(const sf::Vector2f &size) { field.setSize(size); text.SetSize(size); } void InputField::SetSize(float width, float height) { field.setSize(sf::Vector2f(width, height)); text.SetSize(width, height); } const sf::Vector2f& InputField::GetSize() const { return field.getSize(); } void InputField::SetPosition(const sf::Vector2f &pos) { field.setPosition(pos); } void InputField::SetPosition(float x, float y) { field.setPosition(x, y); } const sf::Vector2f &InputField::GetPosition() const { return field.getPosition(); } void InputField::SetTextCharacterSize(unsigned int value) { text.SetCharacterSize(value); } unsigned int InputField::GetTextCharacterSize() const { return text.GetCharacterSize(); } void InputField::SetTextStyle(sf::Text::Style style) { text.SetStyle(style); } void InputField::SetCurrentString(const std::string &string) { currentString = string; text.SetString(currentString); } std::string InputField::GetCurrentString() const { return currentString; } void InputField::SetTextHorizontalAlign(HAlign hAlign) { text.SetHorizontalAlign(hAlign); } void InputField::SetTextVerticalAlign(VAlign vAlign) { text.SetVerticalAlign(vAlign); } void InputField::GetInput(sf::Uint32 unicode) { if (isSelected) { if (unicode == 8 || unicode == 127) { if (currentString.size() > 0) currentString.erase(currentString.size() - 1); } else currentString += unicode; text.SetString(currentString); OnValueChanged(); if (input.GetKey(sf::Keyboard::Enter)) OnEndEdit(); } } void InputField::Clear() { currentString = ""; text.SetString(""); } void InputField::AddOnSelectEvent(Event* event) { onSelectEvents += event; } void InputField::AddDeselectEvent(Event* event) { onDeselectEvents += event; } void InputField::AddOnValueChangedEvent(Event* event) { onValueChangedEvents += event; } void InputField::AddOnEndEditEvent(Event* event) { onEndEditEvents += event; } void InputField::ComputeBounds() { bounds.left = field.getPosition().x; bounds.top = field.getPosition().y; bounds.width = field.getSize().x; bounds.height = field.getSize().y; } void InputField::OnSelect() { onSelectEvents.Invoke(); isSelected = true; field.setFillColor(GetSelectedColor()); } void InputField::OnDeselect() { onDeselectEvents.Invoke(); isSelected = false; field.setFillColor(GetNormalColor()); } void InputField::OnValueChanged() { onValueChangedEvents.Invoke(); } void InputField::OnEndEdit() { onEndEditEvents.Invoke(); OnDeselect(); } void InputField::CheckSelection(sf::RenderWindow &window) { ComputeBounds(); sf::Vector2f mousePosition = sf::Vector2f( (float)input.GetMousePosition(window).x, (float)input.GetMousePosition(window).y); if (bounds.contains(mousePosition)) { if (!isSelected) { field.setFillColor(GetHighlightedColor()); if (input.GetMouseButton(sf::Mouse::Left)) field.setFillColor(GetPressedColor()); if (input.GetMouseButton(sf::Mouse::Left)) { if (!isSelected) OnSelect(); } } } else if (isSelected) { if (input.GetMouseButton(sf::Mouse::Left)) OnDeselect(); } else field.setFillColor(GetNormalColor()); }
17.572404
86
0.720672
[ "render" ]
04d3fe9a303aec88249cb2ab08442079390fee40
7,981
cpp
C++
src/metric.cpp
lxwinspur/telemetry
93064d8fcef2c6fde1f61c0cedacb46b21eab039
[ "Apache-2.0" ]
null
null
null
src/metric.cpp
lxwinspur/telemetry
93064d8fcef2c6fde1f61c0cedacb46b21eab039
[ "Apache-2.0" ]
null
null
null
src/metric.cpp
lxwinspur/telemetry
93064d8fcef2c6fde1f61c0cedacb46b21eab039
[ "Apache-2.0" ]
null
null
null
#include "metric.hpp" #include "details/collection_function.hpp" #include "types/report_types.hpp" #include "utils/labeled_tuple.hpp" #include "utils/transform.hpp" #include <algorithm> class Metric::CollectionData { public: using ReadingItem = details::ReadingItem; virtual ~CollectionData() = default; virtual ReadingItem update(uint64_t timestamp) = 0; virtual ReadingItem update(uint64_t timestamp, double value) = 0; }; class Metric::DataPoint : public Metric::CollectionData { public: ReadingItem update(uint64_t timestamp) override { return ReadingItem{lastTimestamp, lastReading}; } ReadingItem update(uint64_t timestamp, double reading) override { lastTimestamp = timestamp; lastReading = reading; return update(timestamp); } private: uint64_t lastTimestamp = 0u; double lastReading = 0.0; }; class Metric::DataInterval : public Metric::CollectionData { public: DataInterval(std::shared_ptr<details::CollectionFunction> function, CollectionDuration duration) : function(std::move(function)), duration(duration) {} ReadingItem update(uint64_t timestamp) override { if (readings.size() > 0) { auto it = readings.begin(); for (auto kt = std::next(readings.rbegin()); kt != readings.rend(); ++kt) { const auto& [nextItemTimestamp, nextItemReading] = *std::prev(kt); if (timestamp >= nextItemTimestamp && static_cast<uint64_t>(timestamp - nextItemTimestamp) > duration.t.count()) { it = kt.base(); break; } } readings.erase(readings.begin(), it); if (timestamp > duration.t.count()) { readings.front().first = std::max( readings.front().first, timestamp - duration.t.count()); } } return function->calculate(readings, timestamp); } ReadingItem update(uint64_t timestamp, double reading) override { readings.emplace_back(timestamp, reading); return update(timestamp); } private: std::shared_ptr<details::CollectionFunction> function; std::vector<ReadingItem> readings; CollectionDuration duration; }; class Metric::DataStartup : public Metric::CollectionData { public: DataStartup(std::shared_ptr<details::CollectionFunction> function) : function(std::move(function)) {} ReadingItem update(uint64_t timestamp) override { return function->calculateForStartupInterval(readings, timestamp); } ReadingItem update(uint64_t timestamp, double reading) override { readings.emplace_back(timestamp, reading); return function->calculateForStartupInterval(readings, timestamp); } private: std::shared_ptr<details::CollectionFunction> function; std::vector<ReadingItem> readings; }; Metric::Metric(Sensors sensorsIn, OperationType operationTypeIn, std::string idIn, std::string metadataIn, CollectionTimeScope timeScopeIn, CollectionDuration collectionDurationIn, std::unique_ptr<interfaces::Clock> clockIn) : id(idIn), metadata(metadataIn), readings(sensorsIn.size(), MetricValue{std::move(idIn), std::move(metadataIn), 0.0, 0u}), sensors(std::move(sensorsIn)), operationType(operationTypeIn), collectionTimeScope(timeScopeIn), collectionDuration(collectionDurationIn), collectionAlgorithms(makeCollectionData(sensors.size(), operationType, collectionTimeScope, collectionDuration)), clock(std::move(clockIn)) { attemptUnpackJsonMetadata(); } Metric::~Metric() = default; void Metric::initialize() { for (const auto& sensor : sensors) { sensor->registerForUpdates(weak_from_this()); } } std::vector<MetricValue> Metric::getReadings() const { const auto timestamp = clock->timestamp(); auto resultReadings = readings; for (size_t i = 0; i < resultReadings.size(); ++i) { std::tie(resultReadings[i].timestamp, resultReadings[i].value) = collectionAlgorithms[i]->update(timestamp); } return resultReadings; } void Metric::sensorUpdated(interfaces::Sensor& notifier, uint64_t timestamp) { findAssociatedData(notifier).update(timestamp); } void Metric::sensorUpdated(interfaces::Sensor& notifier, uint64_t timestamp, double value) { findAssociatedData(notifier).update(timestamp, value); } Metric::CollectionData& Metric::findAssociatedData(const interfaces::Sensor& notifier) { auto it = std::find_if( sensors.begin(), sensors.end(), [&notifier](const auto& sensor) { return sensor.get() == &notifier; }); auto index = std::distance(sensors.begin(), it); return *collectionAlgorithms.at(index); } LabeledMetricParameters Metric::dumpConfiguration() const { auto sensorPath = utils::transform(sensors, [this](const auto& sensor) { return LabeledSensorParameters(sensor->id().service, sensor->id().path); }); return LabeledMetricParameters(std::move(sensorPath), operationType, id, metadata, collectionTimeScope, collectionDuration); } std::vector<std::unique_ptr<Metric::CollectionData>> Metric::makeCollectionData(size_t size, OperationType op, CollectionTimeScope timeScope, CollectionDuration duration) { using namespace std::string_literals; std::vector<std::unique_ptr<Metric::CollectionData>> result; result.reserve(size); switch (timeScope) { case CollectionTimeScope::interval: std::generate_n( std::back_inserter(result), size, [cf = details::makeCollectionFunction(op), duration] { return std::make_unique<DataInterval>(cf, duration); }); break; case CollectionTimeScope::point: std::generate_n(std::back_inserter(result), size, [] { return std::make_unique<DataPoint>(); }); break; case CollectionTimeScope::startup: std::generate_n(std::back_inserter(result), size, [cf = details::makeCollectionFunction(op)] { return std::make_unique<DataStartup>(cf); }); break; default: throw std::runtime_error("timeScope: "s + utils::enumToString(timeScope) + " is not supported"s); } return result; } void Metric::attemptUnpackJsonMetadata() { using MetricMetadata = utils::LabeledTuple<std::tuple<std::vector<std::string>>, utils::tstring::MetricProperties>; using ReadingMetadata = utils::LabeledTuple<std::tuple<std::string, std::string>, utils::tstring::SensorDbusPath, utils::tstring::SensorRedfishUri>; try { const MetricMetadata parsedMetadata = nlohmann::json::parse(metadata).get<MetricMetadata>(); if (readings.size() == parsedMetadata.at_index<0>().size()) { for (size_t i = 0; i < readings.size(); ++i) { ReadingMetadata readingMetadata{ sensors[i]->id().path, parsedMetadata.at_index<0>()[i]}; readings[i].metadata = readingMetadata.dump(); } } } catch (const nlohmann::json::exception&) {} }
30.934109
80
0.600301
[ "vector", "transform" ]
04d87852b9968536e6a7966e4f942fbe3484f809
22,652
cpp
C++
src/Elba/Core/Components/CS370/ResizeHandler.cpp
nicholasammann/elba
8d7a8ae7c8b55b87ee7dcd02aaea1b175e6dd8ce
[ "MIT" ]
1
2018-10-01T19:34:57.000Z
2018-10-01T19:34:57.000Z
src/Elba/Core/Components/CS370/ResizeHandler.cpp
nicholasammann/elba
8d7a8ae7c8b55b87ee7dcd02aaea1b175e6dd8ce
[ "MIT" ]
9
2018-09-09T16:07:22.000Z
2018-11-06T20:34:30.000Z
src/Elba/Core/Components/CS370/ResizeHandler.cpp
nicholasammann/elba
8d7a8ae7c8b55b87ee7dcd02aaea1b175e6dd8ce
[ "MIT" ]
null
null
null
#include <cmath> #include <random> #include <algorithm> #include "Elba/Core/Object.hpp" #include "Elba/Core/Components/CS370/ResizeHandler.hpp" #include "Elba/Core/Components/Model.hpp" #include "Elba/Core/Components/Transform.hpp" #include "Elba/Graphics/OpenGL/OpenGLMesh.hpp" namespace Elba { ResizeHandler::ResizeHandler(Object* parent) : Component(parent) , mTransform(nullptr) , mModel(nullptr) , mInterpolationMode(InterpolationMode::None) , mMasterWidth(800) , mMasterHeight(600) , mScreenWidth(800) , mScreenHeight(600) , mUseHistogramEqualization(false) , mFourierMethod(FourierMethod::None) , mCurrentImage(CurrentImage::Original) , mGaussianMean(0.0f) , mGaussianVariance(0.0f) , mPa(0.0f) , mPb(0.0f) , mDeviation(0.0f) , mSMax(0.0f) { } void ResizeHandler::Initialize() { mTransform = GetParent()->GetComponent<Transform>(); mModel = GetParent()->GetComponent<Model>(); OpenGLMesh* mesh = static_cast<OpenGLMesh*>(mModel->GetMesh()); auto sbm_it = mesh->GetSubmeshes().begin(); if (sbm_it != mesh->GetSubmeshes().end()) { // Register to be notified when the texture on the submesh changes sbm_it->RegisterForTextureChange(GlobalKey(), [this](const TextureChangeEvent& event) { this->OnTextureChange(event); }); } } void ResizeHandler::Resize(int screenWidth, int screenHeight) { // Store width and height for user changes interpolation mScreenWidth = screenWidth; mScreenHeight = screenHeight; // Resize image to match screen size mTransform->SetWorldScale(glm::vec3(static_cast<float>(screenWidth), 1.0f, static_cast<float>(screenHeight))); // Perform interpolation Interpolate(screenWidth, screenHeight); } void ResizeHandler::SetInterpolationMode(InterpolationMode mode) { mInterpolationMode = mode; // Perform interpolation again with different mode Interpolate(mScreenWidth, mScreenHeight); } ResizeHandler::InterpolationMode ResizeHandler::GetInterpolationMode() const { return mInterpolationMode; } void ResizeHandler::NearestNeighborInterpolation(std::vector<Pixel>& source, int srcWidth, int srcHeight, std::vector<Pixel>& result, int targetWidth, int targetHeight) { int stride = targetWidth * 4; float widthRatio = static_cast<float>(srcWidth) / static_cast<float>(targetWidth); float heightRatio = static_cast<float>(srcHeight) / static_cast<float>(targetHeight); for (int y = 0; y < targetHeight; ++y) { for (int x = 0; x < targetWidth; ++x) { // bilinear interpolation result.emplace_back(NearestNeighborValue(x, y, srcWidth, srcHeight, widthRatio, heightRatio, source)); } } } void ResizeHandler::BilinearInterpolation(std::vector<Pixel>& source, int srcWidth, int srcHeight, std::vector<Pixel>& result, int targetWidth, int targetHeight) { int stride = targetWidth * 4; float widthRatio = static_cast<float>(srcWidth) / static_cast<float>(targetWidth); float heightRatio = static_cast<float>(srcHeight) / static_cast<float>(targetHeight); for (int y = 0; y < targetHeight; ++y) { for (int x = 0; x < targetWidth; ++x) { // bilinear interpolation result.emplace_back(BilinearValue(x, y, srcWidth, srcHeight, widthRatio, heightRatio, source)); } } } void ResizeHandler::SetImage(const std::vector<Pixel>& image, int width, int height) { mMasterWidth = width; mMasterHeight = height; // delete old master image mMasterImage.clear(); // allocate new master image mMasterImage = image; } void ResizeHandler::SetUseHistogramEqualization(bool useHistogram) { mUseHistogramEqualization = useHistogram; Interpolate(mScreenWidth, mScreenHeight); } void ResizeHandler::SetFourierMethod(FourierMethod method) { mFourierMethod = method; Resize(mScreenWidth, mScreenHeight); } void ResizeHandler::SetCurrentImage(CurrentImage image) { mCurrentImage = image; OpenGLMesh* mesh = static_cast<OpenGLMesh*>(mModel->GetMesh()); auto it = mesh->GetSubmeshes().begin(); if (it != mesh->GetSubmeshes().end()) { OpenGLTexture* texture = it->GetTexture(TextureType::Diffuse); std::vector<Pixel> imagePixels; int w = mMasterHeight; int h = mMasterWidth; switch (mCurrentImage) { case CurrentImage::Original: { imagePixels = mOriginalImage; break; } case CurrentImage::Frequency: { imagePixels = mFrequencyImage; break; } case CurrentImage::Transformed: { imagePixels = mTransformedImage; break; } } // do some form of interpolation switch (mInterpolationMode) { case InterpolationMode::NearestNeighbor: { NearestNeighborInterpolation(texture, w, h, imagePixels); break; } case InterpolationMode::Bilinear: { BilinearInterpolation(texture, w, h, imagePixels); break; } } if (mUseHistogramEqualization) { // do histogram equalization HistogramEqualization(imagePixels); } // update the image on the texture texture->SetImage(imagePixels, w, h); // bind the new image data to the gpu texture->RebindTexture(); } } void ResizeHandler::ApplyGaussianNoise() { OpenGLMesh* mesh = static_cast<OpenGLMesh*>(mModel->GetMesh()); auto it = mesh->GetSubmeshes().begin(); if (it != mesh->GetSubmeshes().end()) { OpenGLTexture* texture = it->GetTexture(TextureType::Diffuse); for (int y = 0; y < mNoisyHeight; y++) { for (int x = 0; x < mNoisyWidth; x++) { int noise = static_cast<int>(GaussianNoise(x, y)); int index = IndexAt(x, y, mNoisyWidth); mNoisyImage[index].r = std::clamp(mNoisyImage[index].r + noise, 0, 255); mNoisyImage[index].g = std::clamp(mNoisyImage[index].g + noise, 0, 255); mNoisyImage[index].b = std::clamp(mNoisyImage[index].b + noise, 0, 255); } } // update the image on the texture texture->SetImage(mNoisyImage, mNoisyWidth, mNoisyHeight); // bind the new image data to the gpu texture->RebindTexture(); } } void ResizeHandler::ApplySaltPepperNoise() { OpenGLMesh* mesh = static_cast<OpenGLMesh*>(mModel->GetMesh()); auto it = mesh->GetSubmeshes().begin(); if (it != mesh->GetSubmeshes().end()) { OpenGLTexture* texture = it->GetTexture(TextureType::Diffuse); static std::default_random_engine generator; std::uniform_real_distribution<double> distribution(0.0, 1.0); for (int y = 0; y < mNoisyHeight; y++) { for (int x = 0; x < mNoisyWidth; x++) { int index = IndexAt(x, y, mNoisyWidth); double noise = distribution(generator); if (noise < mPa) { mNoisyImage[index] = Pixel(0, 0, 0, 255); } else if (noise > (1 - mPb)) { mNoisyImage[index] = Pixel(255, 255, 255, 255); } } } // update the image on the texture texture->SetImage(mNoisyImage, mNoisyWidth, mNoisyHeight); // bind the new image data to the gpu texture->RebindTexture(); } } void ResizeHandler::ApplyNoiseReduction() { OpenGLMesh* mesh = static_cast<OpenGLMesh*>(mModel->GetMesh()); auto it = mesh->GetSubmeshes().begin(); if (it != mesh->GetSubmeshes().end()) { OpenGLTexture* texture = it->GetTexture(TextureType::Diffuse); static std::default_random_engine generator; std::uniform_real_distribution<double> distribution(0.0, 1.0); for (int y = 0; y < mNoisyHeight; y++) { for (int x = 0; x < mNoisyWidth; x++) { int a = ColorAt(x - 1, y - 1, mNoisyWidth, mNoisyImage); int b = ColorAt(x, y - 1, mNoisyWidth, mNoisyImage); int c = ColorAt(x + 1, y - 1, mNoisyWidth, mNoisyImage); int d = ColorAt(x - 1, y, mNoisyWidth, mNoisyImage); int e = ColorAt(x, y, mNoisyWidth, mNoisyImage); int f = ColorAt(x + 1, y, mNoisyWidth, mNoisyImage); int g = ColorAt(x - 1, y + 1, mNoisyWidth, mNoisyImage); int h = ColorAt(x, y + 1, mNoisyWidth, mNoisyImage); int i = ColorAt(x + 1, y + 1, mNoisyWidth, mNoisyImage); std::vector<int> kernel = { a , b, c, d, e, f, g, h, i }; std::sort(kernel.begin(), kernel.end()); int median = kernel[4]; mNoisyImage[IndexAt(x, y, mNoisyWidth)] = Pixel(median, median, median, 255); } } // update the image on the texture texture->SetImage(mNoisyImage, mNoisyWidth, mNoisyHeight); // bind the new image data to the gpu texture->RebindTexture(); } } void ResizeHandler::ApplyLocalNoiseReduction() { OpenGLMesh* mesh = static_cast<OpenGLMesh*>(mModel->GetMesh()); auto it = mesh->GetSubmeshes().begin(); if (it != mesh->GetSubmeshes().end()) { OpenGLTexture* texture = it->GetTexture(TextureType::Diffuse); static std::default_random_engine generator; std::uniform_real_distribution<double> distribution(0.0, 1.0); for (int y = 0; y < mNoisyHeight; y++) { for (int x = 0; x < mNoisyWidth; x++) { int a = ColorAt(x - 1, y - 1, mNoisyWidth, mNoisyImage); int b = ColorAt(x, y - 1, mNoisyWidth, mNoisyImage); int c = ColorAt(x + 1, y - 1, mNoisyWidth, mNoisyImage); int d = ColorAt(x - 1, y, mNoisyWidth, mNoisyImage); int e = ColorAt(x, y, mNoisyWidth, mNoisyImage); int f = ColorAt(x + 1, y, mNoisyWidth, mNoisyImage); int g = ColorAt(x - 1, y + 1, mNoisyWidth, mNoisyImage); int h = ColorAt(x, y + 1, mNoisyWidth, mNoisyImage); int i = ColorAt(x + 1, y + 1, mNoisyWidth, mNoisyImage); std::vector<int> kernel = { a , b, c, d, e, f, g, h, i }; float mean = (a + b + c + d + e + f + g + h + i) / 9.0f; float var = Variance(kernel, mean); int col = static_cast<float>(e) - (((mDeviation * mDeviation) / var) * (static_cast<float>(e) - mean)); mNoisyImage[IndexAt(x, y, mNoisyWidth)] = Pixel(col, col, col, 255); } } // update the image on the texture texture->SetImage(mNoisyImage, mNoisyWidth, mNoisyHeight); // bind the new image data to the gpu texture->RebindTexture(); } } void ResizeHandler::ApplyAdaptiveNoiseReduction() { OpenGLMesh* mesh = static_cast<OpenGLMesh*>(mModel->GetMesh()); auto it = mesh->GetSubmeshes().begin(); if (it != mesh->GetSubmeshes().end()) { OpenGLTexture* texture = it->GetTexture(TextureType::Diffuse); static std::default_random_engine generator; std::uniform_real_distribution<double> distribution(0.0, 1.0); for (int y = 0; y < mNoisyHeight; y++) { for (int x = 0; x < mNoisyWidth; x++) { int a1 = 0; int a2 = 0; int n = 3; int min = 0; int median = 0; int max = 0; while (n <= mSMax) { std::vector<int> kernel; FindKernel(x, y, n, mNoisyWidth, mNoisyImage, kernel); std::sort(kernel.begin(), kernel.end()); min = kernel.front(); median = kernel[kernel.size() / 2]; max = kernel.back(); a1 = median - min; a2 = median - max; if (a1 > 0 && a2 < 0) { break; } n += 2; } int col = 0; if (n > mSMax) { col = median; } // stage B else { int zxy = ColorAt(x, y, mNoisyWidth, mNoisyImage); int b1 = zxy - min; int b2 = zxy - max; if (b1 > 0 && b2 < 0) { col = zxy; } else { col = median; } } mNoisyImage[IndexAt(x, y, mNoisyWidth)] = Pixel(col, col, col, 255); } } // update the image on the texture texture->SetImage(mNoisyImage, mNoisyWidth, mNoisyHeight); // bind the new image data to the gpu texture->RebindTexture(); } } int ResizeHandler::ColorAt(int x, int y, int w, const std::vector<Pixel>& image) { // ASSUME GRAYSCALE int index = IndexAt(x, y, w); if (index < 0 || index >= image.size()) { return 0; } return image[index].r; } float ResizeHandler::Variance(const std::vector<int>& arr, float mean) { float sum = 0; for (int val : arr) { float diff = static_cast<float>(val) - mean; sum += diff * diff; } return static_cast<float>(sum) / static_cast<float>(arr.size()); } float ResizeHandler::Mean(const std::vector<int>& arr) { float sum = 0.0f; for (int val : arr) { sum += val; } return sum / arr.size(); } void ResizeHandler::OnTextureChange(const TextureChangeEvent& event) { mMasterWidth = event.newTexture->GetWidth(); mMasterHeight = event.newTexture->GetHeight(); // delete old master image mMasterImage.clear(); // allocate new master image mMasterImage = event.newTexture->GetImage(); } void ResizeHandler::Interpolate(int screenWidth, int screenHeight) { OpenGLMesh* mesh = static_cast<OpenGLMesh*>(mModel->GetMesh()); auto it = mesh->GetSubmeshes().begin(); if (it != mesh->GetSubmeshes().end()) { OpenGLTexture* texture = it->GetTexture(TextureType::Diffuse); std::vector<Pixel> image; int w = screenWidth; int h = screenHeight; // do some form of interpolation switch (mInterpolationMode) { case InterpolationMode::NearestNeighbor: { NearestNeighborInterpolation(texture, screenWidth, screenHeight, image); break; } case InterpolationMode::Bilinear: { BilinearInterpolation(texture, screenWidth, screenHeight, image); break; } case InterpolationMode::None: { // EVERYTHING IS AWFUL NO INTERPOLATION OH MY GOD image = mMasterImage; w = mMasterWidth; h = mMasterHeight; break; } } // DO THE FOURIER THING OMG switch (mFourierMethod) { case FourierMethod::None: { // Do nothing break; } case FourierMethod::DirectMethod: { DirectFourier(image, w, h); break; } case FourierMethod::SeparableMethod: { SeparableFourier(image, w, h); break; } case FourierMethod::FastFourier: { FastFourier(image, w, h); break; } } if (mUseHistogramEqualization) { // do histogram equalization HistogramEqualization(image); } // update the image on the texture texture->SetImage(image, w, h); mNoisyImage = image; mNoisyWidth = w; mNoisyHeight = h; // bind the new image data to the gpu texture->RebindTexture(); } } void ResizeHandler::NearestNeighborInterpolation(OpenGLTexture* texture, int screenWidth, int screenHeight, std::vector<Pixel>& result) { int stride = screenWidth * 4; float widthRatio = static_cast<float>(mMasterWidth) / static_cast<float>(screenWidth); float heightRatio = static_cast<float>(mMasterHeight) / static_cast<float>(screenHeight); for (int y = 0; y < screenHeight; ++y) { for (int x = 0; x < screenWidth; ++x) { // bilinear interpolation result.emplace_back(NearestNeighborValue(x, y, mMasterWidth, mMasterHeight, widthRatio, heightRatio, mMasterImage)); } } } Pixel ResizeHandler::NearestNeighborValue(int x, int y, int width, int height, float widthRatio, float heightRatio, std::vector<Pixel>& src) { float tX = x * widthRatio; float tY = y * heightRatio; float sX = roundf(tX); float sY = roundf(tY); while (sX >= width) { sX -= width; } while (sY >= height) { sY -= height; } return src[static_cast<int>(sY) * width + static_cast<int>(sX)]; } void ResizeHandler::BilinearInterpolation(OpenGLTexture* texture, int screenWidth, int screenHeight, std::vector<Pixel>& result) { int stride = screenWidth * 4; float widthRatio = static_cast<float>(mMasterWidth) / static_cast<float>(screenWidth); float heightRatio = static_cast<float>(mMasterHeight) / static_cast<float>(screenHeight); for (int y = 0; y < screenHeight; ++y) { for (int x = 0; x < screenWidth; ++x) { // bilinear interpolation result.emplace_back(BilinearValue(x, y, mMasterWidth, mMasterHeight, widthRatio, heightRatio, mMasterImage)); } } } Pixel ResizeHandler::BilinearValue(int x, int y, int width, int height, float widthRatio, float heightRatio, std::vector<Pixel>& src) { Pixel result; float tX = x * widthRatio; float tY = y * heightRatio; int x1 = static_cast<int>(floor(tX)); int x2 = static_cast<int>(floor(tX + 1)); if (x2 >= width) { x2 = 0; } int y1 = static_cast<int>(floor(tY)); int y2 = static_cast<int>(floor(tY + 1)); if (y2 >= height) { y2 = 0; } // alpha = (x - x1) / (x2 - x1) // beta = (y - y1) / (y2 - y1) // f(x, y1) = (1 - alpha) * f(x1, y1) + alpha * f(x2, y1) // f(x, y2) = (1 - alpha) * f(x1, y2) + alpha * f(x2, y2) // f(x,y) = (1 - beta) * f(x, y1) + beta * f(x, y2) float alpha = (tX - x1) / (x2 - x1); float beta = (tY - y1) / (y2 - y1); float fxy1 = (1.0f - alpha) * src[y1 * width + x1].r + alpha * src[y1 * width + x2].r; float fxy2 = (1.0f - alpha) * src[y2 * width + x1].r + alpha * src[y2 * width + x2].r; result.r = static_cast<unsigned char>((1.0f - beta) * fxy1 + beta * fxy2); fxy1 = (1.0f - alpha) * src[y1 * width + x1].g + alpha * src[y1 * width + x2].g; fxy2 = (1.0f - alpha) * src[y2 * width + x1].g + alpha * src[y2 * width + x2].g; result.g = static_cast<unsigned char>((1.0f - beta) * fxy1 + beta * fxy2); fxy1 = (1.0f - alpha) * src[y1 * width + x1].b + alpha * src[y1 * width + x2].b; fxy2 = (1.0f - alpha) * src[y2 * width + x1].b + alpha * src[y2 * width + x2].b; result.b = static_cast<unsigned char>((1.0f - beta) * fxy1 + beta * fxy2); result.a = 255; return result; } void ResizeHandler::HistogramEqualization(std::vector<Pixel>& image) { size_t total = image.size(); // first pass to count intensities int redHgram[256] = { 0 }; int blueHgram[256] = { 0 }; int greenHgram[256] = { 0 }; for (Pixel& pixel : image) { ++redHgram[pixel.r]; ++blueHgram[pixel.g]; ++greenHgram[pixel.b]; } // second pass to calculate probabilities float probs[256] = { 0.0f }; for (int i = 0; i < 256; ++i) { //probs[i] = static_cast<float>((redHgram[i] + blueHgram[i] + greenHgram[i])) / (3.0f * total); probs[i] = static_cast<float>(redHgram[i]) / total; } int roundedMapping[256] = { 0 }; float prev = 0.0f; for (int i = 0; i < 256; ++i) { float current = 255.0f * probs[i] + prev; roundedMapping[i] = static_cast<int>(std::round(current)); prev = current; } for (Pixel& pixel : image) { pixel.r = roundedMapping[pixel.r]; pixel.g = roundedMapping[pixel.g]; pixel.b = roundedMapping[pixel.b]; } } void ResizeHandler::DirectFourier(std::vector<Pixel>& image, int w, int h) { mOriginalImage = image; Fourier::SpatialImage spatialImage; CopyToSpatialImage(image, spatialImage, w, h); Fourier::FrequencyImage freqImage; Fourier::SpatialImage transformed; Fourier::Direct(spatialImage, freqImage, transformed); CopyFromFrequencyImage(freqImage, mFrequencyImage, w, h); } void ResizeHandler::SeparableFourier(std::vector<Pixel>& image, int w, int h) { mOriginalImage = image; Fourier::SpatialImage spatialImage; CopyToSpatialImage(image, spatialImage, w, h); Fourier::FrequencyImage freqImage; Fourier::SpatialImage transformed; Fourier::Separable(spatialImage, freqImage, transformed); CopyFromFrequencyImage(freqImage, mFrequencyImage, w, h); } void ResizeHandler::FastFourier(std::vector<Pixel>& image, int w, int h) { mOriginalImage = image; Fourier::SpatialImage spatialImage; CopyToSpatialImage(image, spatialImage, w, h); Fourier::FrequencyImage freqImage; Fourier::SpatialImage transformed; Fourier::Fast(spatialImage, freqImage, transformed); CopyFromFrequencyImage(freqImage, mFrequencyImage, w, h); } void ResizeHandler::CopyToSpatialImage(const std::vector<Pixel>& image, Fourier::SpatialImage& spatial, int w, int h) { spatial.resize(h); int index = 0; for (int y = 0; y < h; ++y) { spatial[y].resize(w); for (int x = 0; x < w; ++x) { spatial[y][x] = static_cast<int>(0.3 * image[index].r + 0.59 * image[index].g + 0.11 * image[index].b); index++; } } } void ResizeHandler::CopyFromFrequencyImage(const Fourier::FrequencyImage& frequency, std::vector<Pixel>& image, int w, int h) { image.resize(w * h); for (int y = 0; y < h; ++y) { for (int x = 0; x < w; ++x) { int shiftedY = (y + h / 2) % h; int shiftedX = (x + w / 2) % w; int index = shiftedY * w + shiftedX; int val = static_cast<int>(sqrt(frequency[y][x].real * frequency[y][x].real + frequency[y][x].imaginary * frequency[y][x].imaginary)); image[index].r = val; image[index].g = val; image[index].b = val; index++; } } } int ResizeHandler::IndexAt(int x, int y, int w) { return y * w + x; } float ResizeHandler::GaussianNoise(int x, int y) { //float expX = ((x - mGaussianMeanX) * (x - mGaussianMeanX)) / (2 * mGaussianVarianceX * mGaussianVarianceX); //float expY = ((y - mGaussianMeanY) * (y - mGaussianMeanY)) / (2 * mGaussianVarianceY * mGaussianVarianceY); static std::default_random_engine generator; std::normal_distribution<double> distribution(mGaussianMean, mGaussianVariance); return static_cast<float>(distribution(generator)); } void Elba::ResizeHandler::FindKernel(int x, int y, int n, int w, const std::vector<Pixel>& image, std::vector<int>& output) { output.clear(); int bound = n / 2; for (int j = -bound; j <= bound; j++) { for (int i = -bound; i <= bound; i++) { output.push_back(ColorAt(x + i, y + j, w, image)); } } } void ResizeHandler::SetGaussianMean(float value) { mGaussianMean = value; } void ResizeHandler::SetGaussianVariance(float value) { mGaussianVariance = value; } void ResizeHandler::SetPa(float value) { mPa = value; } void ResizeHandler::SetPb(float value) { mPb = value; } void ResizeHandler::SetDeviation(float value) { mDeviation = value; } void ResizeHandler::SetSMax(float value) { mSMax = value; } } // End of Elba namespace
26.278422
140
0.62127
[ "mesh", "object", "vector", "model", "transform" ]
3e2098b1f779af438b84d45426bc3e7b0624735c
56,563
cpp
C++
fallen/Editor/Source/PrPiTab.cpp
jordandavidson/MuckyFoot-UrbanChaos
00f7bda3f061bff9ecbb611d430f8f71bd557d14
[ "MIT" ]
188
2017-05-20T03:26:33.000Z
2022-03-10T16:58:39.000Z
fallen/Editor/Source/PrPiTab.cpp
jordandavidson/MuckyFoot-UrbanChaos
00f7bda3f061bff9ecbb611d430f8f71bd557d14
[ "MIT" ]
7
2017-05-28T14:28:13.000Z
2022-01-09T01:47:38.000Z
fallen/Editor/Source/PrPiTab.cpp
inco1/MuckyFoot-UrbanChaos
81aa5cfe18ef7fe2d1b1f9911bd33a47c22d5390
[ "MIT" ]
43
2017-05-20T07:31:32.000Z
2022-03-09T18:39:35.000Z
#include "Editor.hpp" #include "PrPiTab.hpp" #include "engine.h" #include "math.h" #include "FileReq.hpp" #include "c:\fallen\headers\io.h" #include "c:\fallen\headers\memory.h" //#include "collide.hpp" //needed for ele_shift extern void matrix_transformZMY(Matrix31* result, Matrix33* trans, Matrix31* mat2); extern void matrix_transform(struct Matrix31* result, struct Matrix33* trans,struct Matrix31* mat2); extern void matrix_transform_small(struct Matrix31* result, struct Matrix33* trans,struct SMatrix31* mat2); // static counter; //#define ShowWorkWindow(x) {DrawLineC(0+(counter-1)&255,0,WorkWindowWidth-1,WorkWindowHeight-1,0);DrawLineC(0+(counter++)&255,0,WorkWindowWidth-1,WorkWindowHeight-1,255);DrawLineC(0,WorkWindowHeight-1,WorkWindowWidth-1,0,255); ShowWorkWindow(x);} //--------------------------------------------------------------- //debug stuff void cross_work_window(void) { DrawLineC(0,0,WorkWindowWidth-1,WorkWindowHeight-1,WHITE_COL); DrawLineC(0,WorkWindowHeight-1,WorkWindowWidth-1,0,WHITE_COL); } extern void scan_apply_ambient(SLONG face,SLONG x,SLONG y,SLONG z,SLONG extra); //--------------------------------------------------------------- #define CTRL_PRIM_LOAD_BACKGROUND 1 #define CTRL_PRIM_SAVE 2 #define CTRL_PRIM_X_AXIS_FREE 3 #define CTRL_PRIM_Y_AXIS_FREE 4 #define CTRL_PRIM_Z_AXIS_FREE 5 #define CTRL_PRIM_GRID_ON 6 #define CTRL_PRIM_ERASE_MAP 7 #define CTRL_PRIM_V_SLIDE_PRIM 8 #define CTRL_PRIM_MODE_MENU 9 #define CTRL_PRIM_MODE_TEXT 10 #define CTRL_PRIM_REPLACE 11 #define CTRL_PRIM_COLLIDE_NONE 12 #define CTRL_PRIM_COLLIDE_BOX 13 #define CTRL_PRIM_COLLIDE_CYLINDER 14 #define CTRL_PRIM_COLLIDE_SMALLBOX 15 #define CTRL_PRIM_SHADOW_NONE 16 #define CTRL_PRIM_SHADOW_BOXEDGE 17 #define CTRL_PRIM_SHADOW_CYLINDER 18 #define CTRL_PRIM_SHADOW_FOURLEGS 19 #define CTRL_PRIM_SHADOW_FULLBOX 20 #define CTRL_PRIM_FLAG_LAMPOST 21 #define CTRL_PRIM_FLAG_GLARE 22 #define CTRL_PRIM_GRID_MAX 23 #define CTRL_PRIM_GRID_CORNER 24 #define CTRL_PRIM_FLAG_ON_FLOOR 25 #define CTRL_PRIM_FLAG_TREE 26 #define CTRL_PRIM_VIEW_SIDE 27 #define CTRL_PRIM_FLAG_JUST_FLOOR 28 #define CTRL_PRIM_FLAG_INSIDE 29 #define CTRL_PRIM_GROW 30 #define CTRL_PRIM_SHRINK 31 #define CTRL_PRIM_DAMAGABLE 32 #define CTRL_PRIM_LEANS 33 #define CTRL_PRIM_CRUMPLES 34 #define CTRL_PRIM_EXPLODES 35 #define CTRL_PRIM_CENTRE_PIVOT 36 MenuDef2 prim_mode_menu[] = { {"Single Prims"},{"Multi Prims"},{"unused"},{"Anim Prims"},{"Morph Prims"},{"!"} }; ControlDef prim_pick_tab_def[] = { { BUTTON, 0, "Load A BackGround", 10, 473, 0, 0 }, { BUTTON, 0, "Save selected prim", 10, 485, 0, 0 }, { CHECK_BOX, 0, "X Free", 10, 310, 0, 10 }, { CHECK_BOX, 0, "Y Free", 10, 323, 0, 10 }, { CHECK_BOX, 0, "Z Free", 10, 336, 0, 10 }, { CHECK_BOX, 0, "Grid Mode", 10, 362, 0, 10 }, { BUTTON, 0, "Remove Prim", 190, 401, 0, 0 }, { V_SLIDER, 0, "", 272, 40, 0, 257 }, { PULLDOWN_MENU, 0, "Prim mode", 10, 10, 0, 0, prim_mode_menu}, { STATIC_TEXT, 0, "Current mode : ", 10, 24, 0, 0 }, { BUTTON, 0, "Replace Selected Prim" , 10, 460, 0, 0 }, { CHECK_BOX, 0, "Collide none", 100, 310, 0, 10 }, { CHECK_BOX, 0, "Collide box", 100, 323, 0, 10 }, { CHECK_BOX, 0, "Collide cylinder", 100, 336, 0, 10 }, { CHECK_BOX, 0, "Collide small box", 100, 349, 0, 10 }, { CHECK_BOX, 0, "Shadow none", 190, 310, 0, 10 }, { CHECK_BOX, 0, "Shadow box edge", 190, 323, 0, 10 }, { CHECK_BOX, 0, "Shadow cylinder", 190, 336, 0, 10 }, { CHECK_BOX, 0, "Shadow fourlegs", 190, 349, 0, 10 }, { CHECK_BOX, 0, "Shadow full box", 190, 362, 0, 10 }, { CHECK_BOX, 0, "Flag lampost", 100, 362, 0, 10 }, { CHECK_BOX, 0, "Flag GLARE", 100, 375, 0, 10 }, { CHECK_BOX, 0, "RHS", 10, 349, 0, 10 }, { CHECK_BOX, 0, "Corners", 10, 375, 0, 10 }, { CHECK_BOX, 0, "Flag on Roof/floor", 100, 388, 0, 10 }, { CHECK_BOX, 0, "Flag tree", 100, 414, 0, 10 }, { CHECK_BOX, 0, "Side View", 200, 440, 0, 10 }, { CHECK_BOX, 0, "Flag on floor", 100, 401, 0, 10 }, { CHECK_BOX, 0, "Inside", 200, 455, 0, 10 }, { BUTTON, 0, "Grow", 140, 460, 0, 10 }, { BUTTON, 0, "Shrink", 140, 473, 0, 10 }, { CHECK_BOX, 0, "Damagable", 10, 395, 0, 10 }, { CHECK_BOX, 0, "Leans", 10, 408, 0, 10 }, { CHECK_BOX, 0, "Crumples", 10, 421, 0, 10 }, { CHECK_BOX, 0, "Explodes", 10, 434, 0, 10 }, { BUTTON, 0, "Centre Pivot", 140, 486, 0, 10 }, { 0 } }; PrimPickTab *the_primpicktab; void redraw_all_prims(void); UWORD prim_count[256]; UWORD prim_diff=0; //--------------------------------------------------------------- /* static SLONG angle_x=0; void set_user_rotate(SLONG ax,SLONG ay,SLONG az) { angle_x=ax; // Stop the compiler complaining. ay = ay; az = az; } void apply_user_rotates(struct PrimPoint *point) { SLONG rx,rz; rx=point->X*COS(angle_x)-point->Z*SIN(angle_x); rz=point->X*SIN(angle_x)+point->Z*COS(angle_x); point->X=rx>>16; point->Z=rz>>16; } */ SLONG angle_prim_y=0; void rotate_prim_thing(UWORD thing) { // anglex=map_things[thing].AngleY; if(LastKey==KB_H) { LastKey=0; angle_prim_y+=64; angle_prim_y=((angle_prim_y+2048)&2047); } if(LastKey==KB_J) { LastKey=0; angle_prim_y-=64; angle_prim_y=((angle_prim_y+2048)&2047); } map_things[thing].AngleY=angle_prim_y; /* SLONG c0; struct PrimObject *p_obj,*p_obj_o; struct PrimPoint p; SLONG sp,ep,offset_p; p_obj =&prim_objects[map_things[thing].IndexOther]; p_obj_o =&prim_objects[map_things[thing].IndexOrig]; if( (p_obj->EndPoint-p_obj->StartPoint)!=(p_obj_o->EndPoint-p_obj_o->StartPoint) ) return; sp=p_obj->StartPoint; ep=p_obj->EndPoint; offset_p=sp-p_obj_o->StartPoint; if(LastKey==KB_H) { LastKey=0; angle_x+=64; angle_x=((angle_x+2048)&2047); } if(LastKey==KB_J) { LastKey=0; angle_x-=64; angle_x=((angle_x+2048)&2047); } for(c0=sp;c0<ep;c0++) { p=prim_points[c0-offset_p]; apply_user_rotates(&p); prim_points[c0]=p; } map_things[thing].AngleX=angle_x; */ } PrimPickTab::PrimPickTab(EditorModule *parent) { Parent=parent; the_primpicktab=this; PrimRect.SetRect(14,40,257,257); InitControlSet(prim_pick_tab_def); ListPos=0; CurrentPrim=0; UpdatePrimInfo(); AxisMode=3; GridFlag=0; GridMax=0; GridCorner=0; View2Mode=0; PrimTabMode = PRIM_MODE_SINGLE; SetControlState(CTRL_PRIM_X_AXIS_FREE,CTRL_SELECTED); SetControlState(CTRL_PRIM_Y_AXIS_FREE,CTRL_SELECTED); SetControlState(CTRL_PRIM_Z_AXIS_FREE,CTRL_SELECTED); SetControlState(CTRL_PRIM_VIEW_SIDE, CTRL_DESELECTED); ((CVSlider*)GetControlPtr(CTRL_PRIM_V_SLIDE_PRIM))->SetValueRange(0,266/3); ((CVSlider*)GetControlPtr(CTRL_PRIM_V_SLIDE_PRIM))->SetCurrentValue(0); ((CVSlider*)GetControlPtr(CTRL_PRIM_V_SLIDE_PRIM))->SetUpdateFunction(redraw_all_prims); Axis=X_AXIS|Y_AXIS|Z_AXIS; PrimScale=2688; BackScale=40; UpdatePrimInfo(); } PrimPickTab::~PrimPickTab() { UBYTE blah = 1; } //--------------------------------------------------------------- void PrimPickTab::UpdatePrimInfo(void) { // // Checks/unchecks the collide buttons. // SetControlState(CTRL_PRIM_COLLIDE_NONE, CTRL_DESELECTED); SetControlState(CTRL_PRIM_COLLIDE_BOX, CTRL_DESELECTED); SetControlState(CTRL_PRIM_COLLIDE_CYLINDER, CTRL_DESELECTED); SetControlState(CTRL_PRIM_COLLIDE_SMALLBOX, CTRL_DESELECTED); if (CurrentPrim && PrimTabMode == PRIM_MODE_SINGLE) { switch(prim_objects[CurrentPrim].coltype) { case PRIM_COLLIDE_NONE: SetControlState(CTRL_PRIM_COLLIDE_NONE, CTRL_SELECTED); break; case PRIM_COLLIDE_BOX: SetControlState(CTRL_PRIM_COLLIDE_BOX, CTRL_SELECTED); break; case PRIM_COLLIDE_CYLINDER: SetControlState(CTRL_PRIM_COLLIDE_CYLINDER, CTRL_SELECTED); break; case PRIM_COLLIDE_SMALLBOX: SetControlState(CTRL_PRIM_COLLIDE_SMALLBOX, CTRL_SELECTED); break; } } // // Checks/unchecks the shadow buttons. // SetControlState(CTRL_PRIM_SHADOW_NONE, CTRL_DESELECTED); SetControlState(CTRL_PRIM_SHADOW_BOXEDGE, CTRL_DESELECTED); SetControlState(CTRL_PRIM_SHADOW_CYLINDER, CTRL_DESELECTED); SetControlState(CTRL_PRIM_SHADOW_FOURLEGS, CTRL_DESELECTED); SetControlState(CTRL_PRIM_SHADOW_FULLBOX, CTRL_DESELECTED); if (CurrentPrim && PrimTabMode == PRIM_MODE_SINGLE) { switch(prim_objects[CurrentPrim].shadowtype) { case PRIM_SHADOW_NONE: SetControlState(CTRL_PRIM_SHADOW_NONE, CTRL_SELECTED); break; case PRIM_SHADOW_BOXEDGE: SetControlState(CTRL_PRIM_SHADOW_BOXEDGE, CTRL_SELECTED); break; case PRIM_SHADOW_CYLINDER: SetControlState(CTRL_PRIM_SHADOW_CYLINDER, CTRL_SELECTED); break; case PRIM_SHADOW_FOURLEGS: SetControlState(CTRL_PRIM_SHADOW_FOURLEGS, CTRL_SELECTED); break; case PRIM_SHADOW_FULLBOX: SetControlState(CTRL_PRIM_SHADOW_FULLBOX, CTRL_SELECTED); break; } } // // The prim flags. // SetControlState(CTRL_PRIM_FLAG_LAMPOST, CTRL_DESELECTED); SetControlState(CTRL_PRIM_FLAG_GLARE, CTRL_DESELECTED); SetControlState(CTRL_PRIM_FLAG_ON_FLOOR, CTRL_DESELECTED); SetControlState(CTRL_PRIM_FLAG_TREE, CTRL_DESELECTED); SetControlState(CTRL_PRIM_FLAG_JUST_FLOOR, CTRL_DESELECTED); if (CurrentPrim && PrimTabMode == PRIM_MODE_SINGLE) { if (prim_objects[CurrentPrim].flag & PRIM_FLAG_LAMPOST ) {SetControlState(CTRL_PRIM_FLAG_LAMPOST, CTRL_SELECTED);} if (prim_objects[CurrentPrim].flag & PRIM_FLAG_GLARE) {SetControlState(CTRL_PRIM_FLAG_GLARE, CTRL_SELECTED);} if (prim_objects[CurrentPrim].flag & PRIM_FLAG_ON_FLOOR) {SetControlState(CTRL_PRIM_FLAG_ON_FLOOR, CTRL_SELECTED);} if (prim_objects[CurrentPrim].flag & PRIM_FLAG_JUST_FLOOR) {SetControlState(CTRL_PRIM_FLAG_JUST_FLOOR, CTRL_SELECTED);} if (prim_objects[CurrentPrim].flag & PRIM_FLAG_TREE) {SetControlState(CTRL_PRIM_FLAG_TREE, CTRL_SELECTED);} } if (edit_info.Inside ) { SetControlState(CTRL_PRIM_FLAG_INSIDE, CTRL_SELECTED); } else { SetControlState(CTRL_PRIM_FLAG_INSIDE, CTRL_DESELECTED); } // // Checks/unchecks the damageable flags. // SetControlState(CTRL_PRIM_DAMAGABLE, CTRL_DESELECTED); SetControlState(CTRL_PRIM_LEANS, CTRL_DESELECTED); SetControlState(CTRL_PRIM_CRUMPLES, CTRL_DESELECTED); SetControlState(CTRL_PRIM_EXPLODES, CTRL_DESELECTED); if (prim_objects[CurrentPrim].damage & PRIM_DAMAGE_DAMAGABLE) { SetControlState(CTRL_PRIM_DAMAGABLE, CTRL_SELECTED); if (prim_objects[CurrentPrim].damage & PRIM_DAMAGE_LEAN) {SetControlState(CTRL_PRIM_LEANS, CTRL_SELECTED);} if (prim_objects[CurrentPrim].damage & PRIM_DAMAGE_CRUMPLE) {SetControlState(CTRL_PRIM_CRUMPLES, CTRL_SELECTED);} if (prim_objects[CurrentPrim].damage & PRIM_DAMAGE_EXPLODES) {SetControlState(CTRL_PRIM_EXPLODES, CTRL_SELECTED);} } // // This crashes?!... // // ((CStaticText*)GetControlPtr(CTRL_PRIM_MODE_TEXT))->SetString1(prim_mode_menu[PrimTabMode].ItemText); } //--------------------------------------------------------------- void PrimPickTab::DrawTabContent(void) { EdRect content_rect; if(PrimTabMode==PRIM_MODE_SINGLE) ((CVSlider*)GetControlPtr(CTRL_PRIM_V_SLIDE_PRIM))->SetValueRange(0,266/3); else ((CVSlider*)GetControlPtr(CTRL_PRIM_V_SLIDE_PRIM))->SetValueRange(0,next_prim_multi_object+9); content_rect = ContentRect; content_rect.ShrinkRect(1,1); content_rect.FillRect(CONTENT_COL); // ShowAngles(); /* if(ValueButton) ValueButton->DrawValueGadget(); */ DrawPrims(); DrawControlSet(); } //--------------------------------------------------------------- void PrimPickTab::DrawAPrimInRect(ULONG prim,SLONG x,SLONG y,SLONG w,SLONG h) { CBYTE *text; SLONG *flags; //[560]; struct SVector *res; //[560]; //max points per object? SLONG c0; struct PrimObject *p_obj; SLONG sp,ep; SLONG min_x=999999,max_x=-999999,min_y=999999,max_y=-999999; SLONG width,height,scale,scale_y; EdRect rect; SLONG os; flags=(SLONG*)MemAlloc(sizeof(SLONG)*13000); if(flags==0) return; res=(struct SVector*)MemAlloc(sizeof(struct SVector)*13000); if(res==0) { MemFree(flags); return; } os=engine.Scale; engine.Scale=1000; //set clip to content window SetWorkWindowBounds ( ContentLeft()+PrimRect.GetLeft()+x+1, ContentTop()+PrimRect.GetTop()+y+1, w, h ); rect.SetRect(0,0,w,h); if(prim==CurrentPrim) rect.FillRect(LOLITE_COL); // rect.HiliteRect(LOLITE_COL,LOLITE_COL); // SetWorkWindowBounds(ContentLeft()+x,ContentTop()+y,w,h); /* SetWorkWindowBounds(ContentLeft()+1,ContentTop()+1,ContentWidth()-1,ContentHeight()-1); rect.SetRect(x,y,w,h); if(prim==CurrentPrim) rect.FillRect(HILITE_COL); else rect.FillRect(LOLITE_COL); rect.HiliteRect(LOLITE_COL,LOLITE_COL); SetWorkWindowBounds(ContentLeft()+x,ContentTop()+y,w,h); */ set_camera(); // p_rect->FillRect(CONTENT_COL); p_obj =&prim_objects[prim]; sp=p_obj->StartPoint; ep=p_obj->EndPoint; for(c0=sp;c0<ep;c0++) { struct SVector pp; pp.X=prim_points[c0].X; pp.Y=prim_points[c0].Y; pp.Z=prim_points[c0].Z; //transform all points for this Object flags[c0-sp]=rotate_point_gte(&pp,&res[c0-sp]); if(res[c0-sp].X<min_x) min_x=res[c0-sp].X; if(res[c0-sp].X>max_x) max_x=res[c0-sp].X; if(res[c0-sp].Y<min_y) min_y=res[c0-sp].Y; if(res[c0-sp].Y>max_y) max_y=res[c0-sp].Y; } width=max_x-min_x; height=max_y-min_y; if(width==0||height==0) { } else { CBYTE str[100]; scale =(w<<16)/width; scale_y=(h<<16)/height; if(scale_y<scale) scale=scale_y; scale=(scale*200)>>8; engine.Scale=(1000*scale)>>16; draw_a_prim_at(prim,0,0,0,0); render_view(1); text = prim_names[prim]; sprintf(str,"(%d,%d) %s",prim,prim<256?prim_count[prim]:0,text); DrawBoxC(rect.GetLeft()+1,rect.GetTop()+1,QTStringWidth(text),QTStringHeight()+1,0); QuickText(rect.GetLeft()+1,rect.GetTop()+1,str,TEXT_COL); rect.OutlineRect(0); } engine.Scale=os; MemFree(res); MemFree(flags); } void PrimPickTab::DrawABuildingInRect(ULONG prim,SLONG x,SLONG y,SLONG w,SLONG h) { CBYTE *text; SLONG *flags; //[560]; struct SVector *res; //[560]; //max points per object? SLONG c0; struct BuildingObject *p_obj; SLONG sp,ep; SLONG min_x=999999,max_x=-999999,min_y=999999,max_y=-999999; SLONG width,height,scale,scale_y; EdRect rect; SLONG os; flags=(SLONG*)MemAlloc(sizeof(SLONG)*3000); if(flags==0) return; res=(struct SVector*)MemAlloc(sizeof(struct SVector)*3000); if(res==0) { MemFree(flags); return; } os=engine.Scale; engine.Scale=1000; SetWorkWindowBounds ( ContentLeft()+PrimRect.GetLeft()+x+1, ContentTop()+PrimRect.GetTop()+y+1, w, h ); rect.SetRect(0,0,w,h); if(prim==CurrentPrim) rect.FillRect(LOLITE_COL); set_camera(); p_obj =&building_objects[prim]; sp=p_obj->StartPoint; ep=p_obj->EndPoint; LogText(" build in rect prim %d sp %d ep %d \n",prim,sp,ep); for(c0=sp;c0<ep;c0++) { struct SVector pp; pp.X=prim_points[c0].X; pp.Y=prim_points[c0].Y; pp.Z=prim_points[c0].Z; //transform all points for this Object flags[c0-sp]=rotate_point_gte(&pp,&res[c0-sp]); if(res[c0-sp].X<min_x) min_x=res[c0-sp].X; if(res[c0-sp].X>max_x) max_x=res[c0-sp].X; if(res[c0-sp].Y<min_y) min_y=res[c0-sp].Y; if(res[c0-sp].Y>max_y) max_y=res[c0-sp].Y; } width=max_x-min_x; height=max_y-min_y; LogText(" build widh %d height %d \n",width,height); if(width==0||height==0) { } else { scale =(w<<16)/width; scale_y=(h<<16)/height; if(scale_y<scale) scale=scale_y; scale=(scale*200)>>8; engine.Scale=(1000*scale)>>16; draw_a_building_at(prim,0,0,0); render_view(1); // text = prim_objects[prim].ObjectName; // DrawBoxC(rect.GetLeft()+1,rect.GetTop()+1,QTStringWidth(text),QTStringHeight()+1,0); // QuickText(rect.GetLeft()+1,rect.GetTop()+1,text,TEXT_COL); rect.OutlineRect(0); engine.Scale=os; } MemFree(res); MemFree(flags); } //--------------------------------------------------------------- void PrimPickTab::DrawAMultiPrimInRect(ULONG prim,SLONG x,SLONG y,SLONG w,SLONG h) { SLONG c0,c1,c2, num_points, max_x,max_y, min_x,min_y, end_point, scale, scale_y, start_point, temp_scale, temp_x, temp_y, temp_z, width,height, *flags; EdRect bounds_rect, outline_rect; struct KeyFrame *the_frame; struct KeyFrameElement *the_element; struct Matrix31 offset; struct Matrix33 r_matrix; struct PrimObject *the_obj; struct SVector *rotate_vectors, t_vector, t_vector2; // This bit bodged in for now. extern struct KeyFrameChunk *test_chunk; if(!test_chunk->MultiObject) return; the_frame = &test_chunk->KeyFrames[0]; // c1 = 0; flags = (SLONG*)MemAlloc(sizeof(SLONG)*3000); ERROR_MSG(flags,"Unable to allocate memory for DrawKeyFrame"); rotate_vectors = (struct SVector*)MemAlloc(sizeof(struct SVector)*3000); ERROR_MSG(flags,"Unable to allocate memory for DrawKeyFrame"); min_x = min_y = 999999; max_x = max_y = -999999; temp_scale = engine.Scale; temp_x = engine.X; temp_y = engine.Y; temp_z = engine.Z; engine.X = 0; engine.Y = 0; engine.Z = 0; engine.Scale = 5000; engine.ShowDebug= 0; engine.BucketSize= MAX_BUCKETS>>4; SetWorkWindowBounds ( ContentLeft()+PrimRect.GetLeft()+x+1, ContentTop()+PrimRect.GetTop()+y+1, w, h ); bounds_rect.SetRect(0,0,w,h); if(prim==CurrentPrim) bounds_rect.FillRect(LOLITE_COL); /* outline_rect.SetRect( 0,0, bounds_rect.GetWidth(),bounds_rect.GetHeight() ); */ set_camera(); set_camera_to_base(); rotate_obj(0,0,0,&r_matrix); for(c2=0,c0=prim_multi_objects[prim].StartObject;c0<prim_multi_objects[prim].EndObject;c0++) { the_obj = &prim_objects[c0]; start_point = the_obj->StartPoint; end_point = the_obj->EndPoint; num_points = end_point-start_point; the_element = &the_frame->FirstElement[c2++]; offset.M[0] = the_element->OffsetX; offset.M[1] = the_element->OffsetY; offset.M[2] = the_element->OffsetZ; matrix_transformZMY((struct Matrix31*)&t_vector,&r_matrix, &offset); engine.X -= t_vector.X<<8; engine.Y -= t_vector.Y<<8; engine.Z -= t_vector.Z<<8; for(c1=0;c1<num_points;c1++) { matrix_transform_small((struct Matrix31*)&t_vector2,&r_matrix,(struct SMatrix31*)&prim_points[c1]); flags[c1] = rotate_point_gte(&t_vector2,&rotate_vectors[c1]); if(rotate_vectors[c1].X<min_x) min_x = rotate_vectors[c1].X; if(rotate_vectors[c1].X>max_x) max_x = rotate_vectors[c1].X; if(rotate_vectors[c1].Y<min_y) min_y = rotate_vectors[c1].Y; if(rotate_vectors[c1].Y>max_y) max_y = rotate_vectors[c1].Y; } engine.X += t_vector.X<<8; engine.Y += t_vector.Y<<8; engine.Z += t_vector.Z<<8; } width = max_x-min_x; height = max_y-min_y; if(width>0 && height>0) { scale = (bounds_rect.GetWidth()<<16)/width; scale_y = (bounds_rect.GetHeight()<<16)/height; if(scale_y<scale) scale = scale_y; scale = (scale*900)>>8; engine.Scale = (5000*scale)>>16; } for(c2=0,c0=prim_multi_objects[prim].StartObject;c0<prim_multi_objects[prim].EndObject;c0++) { the_element = &the_frame->FirstElement[c2++]; test_draw(c0,0,0,0,0,the_element,the_element,&r_matrix, NULL, NULL, NULL, NULL, NULL); } render_view(1); bounds_rect.OutlineRect(0); engine.X = temp_x; engine.Y = temp_y; engine.Z = temp_z; engine.Scale = temp_scale; engine.ShowDebug= 1; engine.BucketSize= MAX_BUCKETS; MemFree(rotate_vectors); MemFree(flags); } //--------------------------------------------------------------- // for both views SLONG PrimPickTab::HiLightObjects(SLONG x,SLONG y,SLONG w,SLONG h) { SLONG mx,my,mz; SLONG screen_change=0; SLONG wwx,wwy,www,wwh; wwx=WorkWindowRect.Left; wwy=WorkWindowRect.Top; www=WorkWindowRect.Width; wwh=WorkWindowRect.Height; mx=(engine.X>>8)>>ELE_SHIFT; my=(engine.Y>>8)>>ELE_SHIFT; mz=(engine.Z>>8)>>ELE_SHIFT; SetWorkWindowBounds(x,y,w-1,h/2-3); set_camera_plan(); screen_change=hilight_map_things(MAP_THING_TYPE_PRIM); screen_change|=hilight_map_things(MAP_THING_TYPE_ANIM_PRIM); SetWorkWindowBounds(x,y+h/2+4,w-1,h/2-4); if(View2Mode) { set_camera_side(); } else { set_camera_front(); } screen_change|=hilight_map_things(MAP_THING_TYPE_PRIM); screen_change|=hilight_map_things(MAP_THING_TYPE_ANIM_PRIM); SetWorkWindowBounds(wwx,wwy,www,wwh); //RESTORE CLIP RECT return(screen_change); } void PrimPickTab::DrawModuleContent(SLONG x,SLONG y,SLONG w,SLONG h) { SLONG wwx, wwy, www, wwh; EdRect drawrect; RedrawModuleContent=0; // Back up clipping rect. wwx = WorkWindowRect.Left; wwy = WorkWindowRect.Top; www = WorkWindowRect.Width; wwh = WorkWindowRect.Height; /* View1.SetRect(x,y,w-1,h/2-8); View2.SetRect(x,y+h/2+8,w-1,h/2-16); SetWorkWindowBounds ( View1.GetLeft(), View1.GetTop(), View1.GetWidth(), View1.GetHeight() ); View1.FillRect(CONTENT_COL); View1.OutlineRect(0); SetWorkWindowBounds ( View2.GetLeft(), View2.GetTop(), View2.GetWidth(), View2.GetHeight() ); View2.FillRect(CONTENT_COL); View2.OutlineRect(0); */ View1.SetRect(x,y,w-1,h/2-3); View2.SetRect(x,y+h/2+4,w-1,h/2-4); SetWorkWindowBounds(x,y,w-1,h/2-3); drawrect.SetRect(0,0,w-1,h/2-3); drawrect.FillRect(CONTENT_COL_BR); drawrect.HiliteRect(HILITE_COL,HILITE_COL); set_camera_plan(); extern void find_map_clip(SLONG *minx,SLONG *maxx,SLONG *minz,SLONG *maxz); { SLONG minx,maxx,minz,maxz; find_map_clip(&minx,&maxx,&minz,&maxz); edit_info.MinX=minx; edit_info.MinZ=minz; edit_info.MaxX=maxx; edit_info.MaxZ=maxz; edit_info.Clipped|=1; } draw_editor_map(0); render_view(1); switch(PrimTabMode) { case PRIM_MODE_SINGLE: case PRIM_MODE_MULTI: case PRIM_MODE_ANIM_KEY: case PRIM_MODE_ANIM_MORPH: hilight_map_things(MAP_THING_TYPE_PRIM); hilight_map_things(MAP_THING_TYPE_ANIM_PRIM); break; // case PRIM_MODE_BACK: // hilight_map_backgrounds(0); break; } SetWorkWindowBounds(x,y+h/2+4,w-1,h/2-4); drawrect.SetRect(0,0,w-1,h/2-4); // drawrect.FillRect(LOLITE_COL); drawrect.FillRect(CONTENT_COL_BR); drawrect.HiliteRect(HILITE_COL,HILITE_COL); if(View2Mode) { set_camera_side(); } else { set_camera_front(); } draw_editor_map(0); render_view(1); switch(PrimTabMode) { case PRIM_MODE_SINGLE: case PRIM_MODE_MULTI: case PRIM_MODE_ANIM_KEY: case PRIM_MODE_ANIM_MORPH: hilight_map_things(MAP_THING_TYPE_PRIM); hilight_map_things(MAP_THING_TYPE_ANIM_PRIM); break; // case PRIM_MODE_BACK: // hilight_map_backgrounds(0); break; } { CBYTE str[50]; sprintf(str, "Current prim %d", CurrentPrim); QuickTextC(10, 40, str, RED_COL); QuickTextC(11, 41, str, WHITE_COL); } // Restore clipping rect. SetWorkWindowBounds(wwx,wwy,www,wwh); edit_info.Clipped&=~1; } void PrimPickTab::DrawPrims(void) { SLONG ox,oy,oz,x,y,prim=1; SLONG wwx,wwy,www,wwh; SetWorkWindowBounds(ContentLeft()+1,ContentTop()+1,ContentWidth()-1,ContentHeight()-1); PrimRect.FillRect(ACTIVE_COL); PrimRect.HiliteRect(LOLITE_COL,HILITE_COL); { SLONG c0; memset(prim_count,0,512); prim_diff=0; for(c0=0;c0<MAX_MAP_THINGS;c0++) { struct MapThing *t_mthing; t_mthing=&map_things[c0]; switch(t_mthing->Type) { case MAP_THING_TYPE_PRIM: if(t_mthing->IndexOther<256) { prim_count[t_mthing->IndexOther]++; if(prim_count[t_mthing->IndexOther]==1) prim_diff++; } break; } } } { CBYTE str[100]; sprintf(str," %d..%d DIFFERENT PRIMS %d",next_prim_point,MAX_PRIM_POINTS,prim_diff); QuickTextC(1,1,str,0); } wwx=WorkWindowRect.Left; wwy=WorkWindowRect.Top; www=WorkWindowRect.Width; wwh=WorkWindowRect.Height; // SetWorkWindowBounds(PrimRect.GetLeft()+1,PrimRect.GetTop()+1,PrimRect.GetWidth()-1,PrimRect.GetHeight()-1); // PrimRect.FillRect(CONTENT_COL); // PrimRect.HiliteRect(LOLITE_COL,LOLITE_COL); ox=engine.X; oy=engine.Y; oz=engine.Z; engine.X=0; engine.Y=0; engine.Z=0; engine.ShowDebug=0; engine.BucketSize=MAX_BUCKETS>>4; prim = (((CVSlider*)GetControlPtr(CTRL_PRIM_V_SLIDE_PRIM))->GetCurrentValue()*3)+1; if(PrimTabMode==PRIM_MODE_ANIM_KEY) { EdRect frame_rect,rect; struct Matrix33 r_matrix; rotate_obj(0,0,0,&r_matrix); for(y=1;y<255;y+=85) for(x=1;x<255;x+=85) { SetWorkWindowBounds (ContentLeft()+PrimRect.GetLeft()+x+1, ContentTop()+PrimRect.GetTop()+y+1, 85,85); rect.SetRect(0,0,85,85); if(prim==CurrentPrim) rect.FillRect(LOLITE_COL); extern void drawkeyframeboxgamechunk(UWORD multi_object,EdRect *bounds_rect,struct GameKeyFrame *the_frame,struct Matrix33 *r_matrix,SLONG person_id,struct GameKeyFrameChunk *the_chunk); if(anim_chunk[prim].MultiObject[0]) drawkeyframeboxgamechunk(anim_chunk[prim].MultiObject[0],&rect,anim_chunk[prim].AnimList[1],&r_matrix,0,&anim_chunk[prim]); prim++; } } else if(PrimTabMode==PRIM_MODE_SINGLE) { EdRect frame_rect,rect; struct Matrix33 r_matrix; rotate_obj(0,0,0,&r_matrix); for(y=1;y<255;y+=85) for(x=1;x<255;x+=85) { if(prim < next_prim_object) DrawAPrimInRect(prim++,x,y,85,85); } } else { for(y=1;y<255;y+=85) for(x=1;x<255;x+=85) { if(prim < next_prim_multi_object) DrawAMultiPrimInRect(prim++,x,y,85,85); } } engine.ShowDebug=1; engine.BucketSize=MAX_BUCKETS; // draw_a_prim_at(3,0,0,0); engine.X=ox; engine.Y=oy; engine.Z=oz; /* { SetWorkWindowBounds(ContentLeft(),ContentTop(),300,300); CBYTE str[100]; sprintf(str,"CURRENT_PRIM= %d dtv1 %d dtv2 %d x %d y %d z %d",CurrentPrim,DragThingView1,DragThingView2,engine.MousePosX,engine.MousePosY,engine.MousePosZ); DrawBox(20,20,300,10,0); QuickTextC(20+1,20+1,str,255); } */ SetWorkWindowBounds(wwx,wwy,www,wwh); //RESTORE CLIP RECT RedrawTabContent=0; } void PrimPickTab::UpdatePrimPickWindow(void) { if(LockWorkScreen()) { DrawControlSet(); DrawPrims(); UnlockWorkScreen(); } ShowWorkWindow(0); } void redraw_all_prims(void) { the_primpicktab->DrawTabContent(); } //--------------------------------------------------------------- void PrimPickTab::HandleTab(MFPoint *current_point) { SLONG update = 0; ModeTab::HandleTab(current_point); /* if(Keys[KB_PMINUS]) { if(TextureZoom<8) { TextureZoom++; update = 1; } } else if(Keys[KB_PPLUS]) { if(TextureZoom>0) { TextureZoom--; update = 1; } } if(Keys[KB_P4]) { if(TextureX>0) { TextureX--; update = 1; } } else if(Keys[KB_P6]) { if(TextureX<(256-(1<<TextureZoom))) { TextureX++; update = 1; } } if(Keys[KB_P8]) { if(TextureY>0) { TextureY--; update = 1; } } else if(Keys[KB_P2]) { if(TextureY<(256-(1<<TextureZoom))) { TextureY++; update = 1; } } */ if(Keys[KB_U]) { Keys[KB_U]=0; MyUndo.DoUndo(ShiftFlag?1:0); RedrawModuleContent=1; } if(RedrawTabContent||update) { UpdatePrimPickWindow(); } KeyboardInterface(); } inline SLONG is_point_in_box(SLONG x,SLONG y,SLONG left,SLONG top,SLONG w,SLONG h) { if(x>left&&x<left+w&&y>top&&y<top+h) return(1); else return(0); } //--------------------------------------------------------------- SLONG PrimPickTab::KeyboardInterface(void) { if(Keys[KB_TAB]) { Keys[KB_TAB]=0; AxisMode++; if(AxisMode>3) AxisMode=0; switch(AxisMode) { case 0: SetControlState(CTRL_PRIM_X_AXIS_FREE,CTRL_SELECTED); SetControlState(CTRL_PRIM_Y_AXIS_FREE,CTRL_DESELECTED); SetControlState(CTRL_PRIM_Z_AXIS_FREE,CTRL_DESELECTED); Axis=X_AXIS; break; case 1: SetControlState(CTRL_PRIM_X_AXIS_FREE,CTRL_DESELECTED); SetControlState(CTRL_PRIM_Y_AXIS_FREE,CTRL_SELECTED); SetControlState(CTRL_PRIM_Z_AXIS_FREE,CTRL_DESELECTED); Axis=Y_AXIS; break; case 2: SetControlState(CTRL_PRIM_X_AXIS_FREE,CTRL_DESELECTED); SetControlState(CTRL_PRIM_Y_AXIS_FREE,CTRL_DESELECTED); SetControlState(CTRL_PRIM_Z_AXIS_FREE,CTRL_SELECTED); Axis=Z_AXIS; break; case 3: SetControlState(CTRL_PRIM_X_AXIS_FREE,CTRL_SELECTED); SetControlState(CTRL_PRIM_Y_AXIS_FREE,CTRL_SELECTED); SetControlState(CTRL_PRIM_Z_AXIS_FREE,CTRL_SELECTED); Axis=X_AXIS|Y_AXIS|Z_AXIS; break; } SetWorkWindowBounds(ContentLeft()+1,ContentTop()+1,ContentWidth()-1,ContentHeight()-1); DrawControlSet(); ShowWorkWindow(0); } return(0); } void find_things_min_point(SLONG drag,SLONG *px,SLONG *py,SLONG *pz) { SLONG c0; SLONG mx,my,mz; *px=99999; *py=99999; *pz=99999; if(drag) { SLONG sp,ep; sp=prim_objects[drag].StartPoint; ep=prim_objects[drag].EndPoint; for(c0=sp;c0<ep;c0++) { if(prim_points[c0].X<*px) *px=prim_points[c0].X; if(prim_points[c0].Y<*py) *py=prim_points[c0].Y; if(prim_points[c0].Z<*pz) *pz=prim_points[c0].Z; } } } void find_things_max_point(SLONG drag,SLONG *px,SLONG *py,SLONG *pz) { SLONG c0; SLONG mx,my,mz; *px=-99999; *py=-99999; *pz=-99999; if(drag) { SLONG sp,ep; sp=prim_objects[drag].StartPoint; ep=prim_objects[drag].EndPoint; for(c0=sp;c0<ep;c0++) { if(prim_points[c0].X>*px) *px=prim_points[c0].X; if(prim_points[c0].Y>*py) *py=prim_points[c0].Y; if(prim_points[c0].Z>*pz) *pz=prim_points[c0].Z; } } } void find_things_min_point_corner(SLONG drag,SLONG *px,SLONG *py,SLONG *pz) { SLONG c0; SLONG mx,my,mz; SLONG dist,mdist=99999,best=0; *py=99999; if(drag) { SLONG sp,ep; sp=prim_objects[drag].StartPoint; ep=prim_objects[drag].EndPoint; for(c0=sp;c0<ep;c0++) { if(prim_points[c0].Y<*py) *py=prim_points[c0].Y; dist=prim_points[c0].X+prim_points[c0].Z; if(dist<mdist) { mdist=dist; best=c0; } } } if(best) { *px=prim_points[best].X; // *py=prim_points[best].Y; *pz=prim_points[best].Z; } } void find_things_max_point_corner(SLONG drag,SLONG *px,SLONG *py,SLONG *pz) { SLONG c0; SLONG mx,my,mz; SLONG dist,mdist=-99999,best=0; *py=-99999; if(drag) { SLONG sp,ep; sp=prim_objects[drag].StartPoint; ep=prim_objects[drag].EndPoint; for(c0=sp;c0<ep;c0++) { if(prim_points[c0].Y>*py) *py=prim_points[c0].Y; dist=prim_points[c0].X+prim_points[c0].Z; if(dist>mdist) { mdist=dist; best=c0; } } } if(best) { *px=prim_points[best].X; // *py=prim_points[best].Y; *pz=prim_points[best].Z; } } // // button 0 is left // button 1 is right (for creating a new prim identical to the last SLONG PrimPickTab::DragAPrim(UBYTE flags,MFPoint *clicked_point,SLONG button) { static UBYTE col=0; SLONG screen_change=0; MFPoint local_point; SLONG x,y,w,h; SLONG drag; SLONG wwx,wwy,www,wwh; SLONG ox,oy,oz; SLONG px=0,py=0,pz=0; // Stop compiler moaning. flags = flags; wwx=WorkWindowRect.Left; wwy=WorkWindowRect.Top; www=WorkWindowRect.Width; wwh=WorkWindowRect.Height; x=Parent->ContentLeft(); y=Parent->ContentTop(); w=Parent->ContentWidth(); h=Parent->ContentHeight(); col++; SetWorkWindowBounds(x,y,w-1,h/2-3); set_camera_plan(); local_point = *clicked_point; /* switch(PrimTabMode) { case PRIM_MODE_SINGLE: drag=select_map_things(clicked_point,MAP_THING_TYPE_PRIM); break; case PRIM_MODE_MULTI: break; case PRIM_MODE_SINGLE: case PRIM_MODE_ANIM_KEY: case PRIM_MODE_ANIM_MORPH: drag=select_map_things(clicked_point,MAP_THING_TYPE_PRIM); if(drag==0) drag=select_map_things(clicked_point,MAP_THING_TYPE_ANIM_PRIM); break; // case PRIM_MODE_BACK: // drag=select_map_backgrounds(clicked_point,0); break; } */ extern void find_map_clip(SLONG *minx,SLONG *maxx,SLONG *minz,SLONG *maxz); { SLONG minx,maxx,minz,maxz; find_map_clip(&minx,&maxx,&minz,&maxz); edit_info.MinX=minx; edit_info.MinZ=minz; edit_info.MaxX=maxx; edit_info.MaxZ=maxz; edit_info.Clipped|=1; } drag=select_map_things(clicked_point,MAP_THING_TYPE_PRIM); if(drag==0) drag=select_map_things(clicked_point,MAP_THING_TYPE_ANIM_PRIM); if(!drag) { SetWorkWindowBounds(x,y+h/2+4,w-1,h/2-4); if(View2Mode) { set_camera_side(); } else { set_camera_front(); } local_point =*clicked_point; local_point.Y-=h/2; drag=select_map_things(&local_point,MAP_THING_TYPE_PRIM); if(drag==0) drag=select_map_things(&local_point,MAP_THING_TYPE_ANIM_PRIM); /* switch(PrimTabMode) { case PRIM_MODE_SINGLE: case PRIM_MODE_MULTI: case PRIM_MODE_ANIM_KEY: case PRIM_MODE_ANIM_MORPH: drag=select_map_things(&local_point,MAP_THING_TYPE_PRIM); if(drag==0) drag=select_map_things(&local_point,MAP_THING_TYPE_ANIM_PRIM); break; // case PRIM_MODE_BACK: // drag=select_map_backgrounds(&local_point,0); break; } */ } if(drag) { SLONG index; index=map_things[drag].IndexOther; if(GridCorner) { if(GridMax) { find_things_max_point_corner(index,&px,&py,&pz); } else { find_things_min_point_corner(index,&px,&py,&pz); } } else { if(GridMax) { find_things_max_point(index,&px,&py,&pz); } else { find_things_min_point(index,&px,&py,&pz); } } } engine.MousePosX=map_things[drag].X; engine.MousePosY=map_things[drag].Y; engine.MousePosZ=map_things[drag].Z; ox=map_things[drag].X; oy=map_things[drag].Y; oz=map_things[drag].Z; if(drag) //drag in plan view { SLONG offset_x,offset_y,offset_z; SLONG in=1; if(button) { SLONG old_thing; old_thing=drag; // right button so create a new identical prim and drag it drag=place_prim_at(map_things[drag].IndexOther,map_things[drag].X,map_things[drag].Y,map_things[drag].Z); if(drag==0) return(0); map_things[drag].AngleY=map_things[old_thing].AngleY; map_things[drag].X-engine.MousePosX; } SetWorldMouse(0); offset_x=map_things[drag].X-engine.MousePosX; offset_y=map_things[drag].Y-engine.MousePosY; offset_z=map_things[drag].Z-engine.MousePosZ; // set_user_rotate(map_things[drag].AngleX,0,0); angle_prim_y=map_things[drag].AngleY; while(SHELL_ACTIVE && ( (button==0) ? LeftButton : RightButton)) { SLONG nx,ny,nz; in=SetWorldMouse(0); nx=map_things[drag].X; ny=map_things[drag].Y; nz=map_things[drag].Z; if(GridFlag) { SLONG grid_and; grid_and=~(HALF_ELE_SIZE-1); if(Axis&X_AXIS) nx=((engine.MousePosX+offset_x)&grid_and)-px; if(py<0) { if(Axis&Y_AXIS) ny=((engine.MousePosY+offset_y)&grid_and)+((-py)&0x7f); } else { if(Axis&Y_AXIS) ny=((engine.MousePosY+offset_y)&grid_and)-((py)&0x7f); } if(Axis&Z_AXIS) nz=((engine.MousePosZ+offset_z)&grid_and)-(pz); } else { if(Axis&X_AXIS) nx=engine.MousePosX+offset_x; if(Axis&Y_AXIS) ny=engine.MousePosY+offset_y; if(Axis&Z_AXIS) nz=engine.MousePosZ+offset_z; } if(PrimTabMode==PRIM_MODE_BACK) { map_things[drag].X=nx; map_things[drag].Y=ny; map_things[drag].Z=nz; // LogText("Drag To nx %d ny %d nz %d \n",nx,ny,nz); } else move_thing_on_cells(drag,nx,ny,nz); DrawModuleContent(Parent->ContentLeft()+1,Parent->ContentTop()+1,Parent->ContentWidth(),Parent->ContentHeight()); SetWorkWindowBounds(Parent->ContentLeft()+1,Parent->ContentTop()+1,Parent->ContentWidth(),Parent->ContentHeight()); ShowWorkWindow(0); screen_change=1; SetWorkWindowBounds(this->ContentLeft()+1,this->ContentTop()+1,this->ContentWidth(),this->ContentHeight()); // ContentRect.FillRect(CONTENT_COL); DrawBox(0,0,this->ContentWidth(),this->ContentHeight(),CONTENT_COL); set_camera(); draw_editor_map(0); render_view(1); ShowWorkWindow(0); editor_user_interface(0); KeyboardInterface(); if(PrimTabMode!=PRIM_MODE_BACK) rotate_prim_thing(drag); } if(!in) { delete_thing(drag); } MyUndo.MoveObject(0,drag,ox,oy,oz); } SetWorkWindowBounds(this->ContentLeft()+1,this->ContentTop()+1,this->ContentWidth(),this->ContentHeight()); DrawBox(0,0,this->ContentWidth(),this->ContentHeight(),CONTENT_COL); // ContentRect.FillRect(CONTENT_COL); UpdatePrimPickWindow(); SetWorkWindowBounds(wwx,wwy,www,wwh); //RESTORE CLIP RECT edit_info.Clipped&=~1; return(screen_change); } SLONG PrimPickTab::DragEngine(UBYTE flags,MFPoint *clicked_point) { SLONG wwx,wwy,www,wwh; SLONG screen_change=0; SLONG last_world_mouse; wwx=WorkWindowRect.Left; wwy=WorkWindowRect.Top; www=WorkWindowRect.Width; wwh=WorkWindowRect.Height; { SLONG start_x=0,start_y=0,start_z=0,flag=0; SLONG old_x,old_y,old_z; SLONG nx,ny,nz; old_x=nx=engine.X; old_y=ny=engine.Y; old_z=nz=engine.Z; while(SHELL_ACTIVE && MiddleButton) { last_world_mouse=SetWorldMouse(0); if(last_world_mouse) { if(!flag) { flag=1; start_x=engine.MousePosX<<8; start_y=engine.MousePosY<<8; start_z=engine.MousePosZ<<8; } nx=engine.MousePosX<<8; ny=engine.MousePosY<<8; nz=engine.MousePosZ<<8; engine.X = (old_x+(-nx+start_x)); engine.Y = (old_y+(-ny+start_y)); engine.Z = (old_z+(-nz+start_z)); // engine.Z=nz<<8; DrawModuleContent(Parent->ContentLeft()+1,Parent->ContentTop()+1,Parent->ContentWidth(),Parent->ContentHeight()); SetWorkWindowBounds(Parent->ContentLeft()+1,Parent->ContentTop()+1,Parent->ContentWidth(),Parent->ContentHeight()); ShowWorkWindow(0); screen_change=1; engine.X=old_x; engine.Y=old_y; engine.Z=old_z; } } if(flag) { engine.X= (old_x+(-nx+start_x)); engine.Y= (old_y+(-ny+start_y)); engine.Z= (old_z+(-nz+start_z)); } } return(screen_change); } extern SLONG calc_edit_height_at(SLONG x,SLONG z); SLONG PrimPickTab::HandleModuleContentClick(MFPoint *clicked_point,UBYTE flags,SLONG x,SLONG y,SLONG w,SLONG h) { SWORD thing; // Stop compiler moaning. x = x; y = y; w = w; h = h; switch(flags) { case NO_CLICK: break; case LEFT_CLICK: if(CurrentPrim==0) { DragAPrim(flags,clicked_point,0); } else { SetWorldMouse(1); // set_user_rotate(0,0,0); angle_prim_y=0; switch(PrimTabMode) { case PRIM_MODE_SINGLE: if(ShiftFlag|| (prim_objects[CurrentPrim].flag & PRIM_FLAG_ON_FLOOR) ) { SLONG px,py,pz,y; find_things_min_point(CurrentPrim,&px,&py,&pz); extern SLONG find_alt_for_this_pos(SLONG x,SLONG z); y=find_alt_for_this_pos(engine.MousePosX,engine.MousePosZ); //y=calc_edit_height_at(engine.MousePosX,engine.MousePosZ); y-=py; thing=place_prim_at(CurrentPrim,engine.MousePosX,y,engine.MousePosZ); if(ShiftFlag) map_things[thing].Flags|=FLAG_EDIT_PRIM_ON_FLOOR; } else if(ShiftFlag|| (prim_objects[CurrentPrim].flag & PRIM_FLAG_JUST_FLOOR) ) { SLONG px,py,pz,y; find_things_min_point(CurrentPrim,&px,&py,&pz); extern SLONG find_alt_for_this_pos(SLONG x,SLONG z); //y=find_alt_for_this_pos(engine.MousePosX,engine.MousePosZ); y=calc_edit_height_at(engine.MousePosX,engine.MousePosZ); y-=py; thing=place_prim_at(CurrentPrim,engine.MousePosX,y,engine.MousePosZ); // map_things[thing].Flags|=FLAG_EDIT_PRIM_ON_FLOOR; } else { thing=place_prim_at(CurrentPrim,engine.MousePosX,engine.MousePosY,engine.MousePosZ); } break; case PRIM_MODE_ANIM_KEY: SLONG place_anim_prim_at(UWORD prim,SLONG x,SLONG y,SLONG z); if(ShiftFlag) { SLONG px,py,pz,y; /* HERE HERE HERE */ find_things_min_point(CurrentPrim,&px,&py,&pz); extern SLONG find_alt_for_this_pos(SLONG x,SLONG z); y=find_alt_for_this_pos(px,pz); // y=find_alt_for_this_pos(engine.MousePosX,engine.MousePosZ); // y=calc_edit_height_at(engine.MousePosX,engine.MousePosZ); y-=py; thing=place_prim_at(CurrentPrim,engine.MousePosX,y,engine.MousePosZ); } else { thing=place_anim_prim_at(CurrentPrim,engine.MousePosX,engine.MousePosY,engine.MousePosZ); } break; } MyUndo.PlaceObject(0,CurrentPrim,thing,engine.MousePosX,engine.MousePosY,engine.MousePosZ); CurrentPrim=0; UpdatePrimInfo(); return(1); } break; case RIGHT_CLICK: if(CurrentPrim==0) DragAPrim(flags,clicked_point,1); // Right click in content. break; case MIDDLE_CLICK: DragEngine(flags,clicked_point); break; } return(0); } UWORD PrimPickTab::HandleTabClick(UBYTE flags,MFPoint *clicked_point) { UWORD control_id; Control *current_control; MFPoint local_point; // This is a fudge to update the front screen buffer. ShowWorkScreen(0); switch(flags) { case NO_CLICK: break; case LEFT_CLICK: SetWorkWindowBounds(ContentLeft()+1,ContentTop()+1,ContentWidth()-1,ContentHeight()-1); local_point = *clicked_point; GlobalToLocal(&local_point); if(PrimRect.PointInRect(&local_point)) { SLONG max, x, y, prim = (((CVSlider*)GetControlPtr(CTRL_PRIM_V_SLIDE_PRIM))->GetCurrentValue()*3)+1; switch(PrimTabMode) { case PRIM_MODE_SINGLE: max = next_prim_object; //next_prim_object max=266; break; case PRIM_MODE_MULTI: max = next_prim_multi_object; break; case PRIM_MODE_ANIM_KEY: case PRIM_MODE_ANIM_MORPH: max=256; } for(y=1;y<255;y+=85) for(x=1;x<255;x+=85) { if(prim < max) if(is_point_in_box(local_point.X,local_point.Y,PrimRect.GetLeft()+x,PrimRect.GetTop()+y,85,85)) { if(CurrentPrim!=prim) { RedrawTabContent=1; CurrentPrim=prim; UpdatePrimInfo(); extern SLONG HMTAB_current_prim; HMTAB_current_prim = prim; } else { CurrentPrim=0; UpdatePrimInfo(); } UpdatePrimPickWindow(); } prim++; } } else { current_control = GetControlList(); while(current_control) { if(!(current_control->GetFlags()&CONTROL_INACTIVE) && current_control->PointInControl(&local_point)) { // Handle control. control_id = current_control->TrackControl(&local_point); HandleControl(control_id); // Tidy up display. if(LockWorkScreen()) { DrawTab(); UnlockWorkScreen(); } ShowWorkWindow(0); return control_id; } current_control = current_control->GetNextControl(); } } break; case RIGHT_CLICK: SetWorkWindowBounds(ContentLeft()+1,ContentTop()+1,ContentWidth()-1,ContentHeight()-1); local_point = *clicked_point; GlobalToLocal(&local_point); break; } return 0; } //--------------------------------------------------------------- SLONG PrimPickTab::SetWorldMouse(ULONG flag) { MFPoint mouse_point; MFPoint local_point; SLONG wwx,wwy,www,wwh; wwx=WorkWindowRect.Left; wwy=WorkWindowRect.Top; www=WorkWindowRect.Width; wwh=WorkWindowRect.Height; mouse_point.X = MouseX; mouse_point.Y = MouseY; local_point = mouse_point; Parent->GlobalToLocal(&local_point); if(is_point_in_box(local_point.X,local_point.Y,0,0,Parent->ContentWidth()-1,Parent->ContentHeight()/2)) { SetWorkWindowBounds(Parent->ContentLeft()+1,Parent->ContentTop()+1,Parent->ContentWidth()-1,Parent->ContentHeight()/2-3); set_camera_plan(); calc_world_pos_plan(local_point.X,local_point.Y); if(flag) engine.MousePosY=engine.Y>>8; SetWorkWindowBounds(wwx,wwy,www,wwh); //RESTORE CLIP RECT return(1); } else if(is_point_in_box(local_point.X,local_point.Y,0,Parent->ContentHeight()/2,Parent->ContentWidth()-1,Parent->ContentHeight()/2)) { SetWorkWindowBounds(Parent->ContentLeft()+1,Parent->ContentTop()+Parent->ContentHeight()/2+3,Parent->ContentWidth()-1,Parent->ContentHeight()/2-4); if(View2Mode) { set_camera_side(); } else { set_camera_front(); } calc_world_pos_front(local_point.X,local_point.Y-Parent->ContentHeight()/2); if(flag) engine.MousePosZ=engine.Z>>8; SetWorkWindowBounds(wwx,wwy,www,wwh); //RESTORE CLIP RECT return(1); } /* SetWorkWindowBounds(Parent->ContentLeft()+1,Parent->ContentTop()+1,Parent->ContentWidth()-1,Parent->ContentHeight()/2-3); set_camera_plan(); point.X=engine.MousePosX; point.Y=engine.MousePosY; point.Z=engine.MousePosZ; rotate_point_gte(&point,&out); DrawLineC(out.X-10,out.Y,out.X+10,out.Y,1); DrawLineC(out.X,out.Y-10,out.X,out.Y+10,1); SetWorkWindowBounds(Parent->ContentLeft()+1,Parent->ContentTop()+Parent->ContentHeight()/2+3,Parent->ContentWidth()-1,Parent->ContentHeight()/2-4); set_camera_front(); point.X=engine.MousePosX; point.Y=engine.MousePosY; point.Z=engine.MousePosZ; rotate_point_gte(&point,&out); DrawLineC(out.X-10,out.Y,out.X+10,out.Y,1); DrawLineC(out.X,out.Y-10,out.X,out.Y+10,1); ShowWorkWindow(0); */ return(0); } void add_a_background_thing(UWORD prim,SLONG x,SLONG y,SLONG z) { UWORD map_thing; struct MapThing *p_mthing; map_thing=find_empty_map_thing(); if(!map_thing) return; p_mthing=TO_MTHING(map_thing); p_mthing->X=x; p_mthing->Y=y; p_mthing->Z=z; p_mthing->IndexOther=prim; p_mthing->IndexNext=background_prim; background_prim=map_thing; set_things_faces(map_thing); p_mthing->Type=MAP_THING_TYPE_PRIM; scan_function=scan_apply_ambient; scan_map_thing(map_thing); } extern void clear_map2(void); void PrimPickTab::HandleControl(UWORD control_id) { switch(control_id&0xff) { /* case CTRL_PRIM_APPEND_NEW: { FileRequester *fr; CBYTE fname[100]; clear_map2(); // clear_prims(); load_all_prims("allprim.sav"); fr=new FileRequester("objects\\","*.*","Load A Prim","hello"); if(fr->Draw()) { strcpy(fname,fr->Path); strcat(fname,fr->FileName); read_asc(fname,100,1); compress_prims(); record_prim_status(); save_all_prims("allprim.sav"); } delete fr; UpdatePrimPickWindow(); RequestUpdate(); } break; */ case CTRL_PRIM_REPLACE: if(CurrentPrim && PrimTabMode == PRIM_MODE_SINGLE) { FileRequester *fr; CBYTE fname[100]; clear_map2(); // clear_prims(); load_all_individual_prims(); fr=new FileRequester("objects\\","*.*","Load A Prim","hello"); if(fr->Draw()) { SLONG temp; strcpy(fname,fr->Path); strcat(fname,fr->FileName); temp=next_prim_object; next_prim_object=CurrentPrim; read_asc(fname,100,1); next_prim_object=temp; compress_prims(); record_prim_status(); save_prim_object(CurrentPrim); //save_all_individual_prims(); } delete fr; UpdatePrimPickWindow(); RequestUpdate(); } break; case CTRL_PRIM_SAVE: if (CurrentPrim) { // revert_to_prim_status(); save_prim_object(CurrentPrim); //save_all_individual_prims(); } break; case CTRL_PRIM_X_AXIS_FREE: ToggleControlSelectedState(CTRL_PRIM_X_AXIS_FREE); if(Axis&X_AXIS) Axis&=~X_AXIS; else Axis|=X_AXIS; break; case CTRL_PRIM_Y_AXIS_FREE: ToggleControlSelectedState(CTRL_PRIM_Y_AXIS_FREE); if(Axis&Y_AXIS) Axis&=~Y_AXIS; else Axis|=Y_AXIS; break; case CTRL_PRIM_Z_AXIS_FREE: ToggleControlSelectedState(CTRL_PRIM_Z_AXIS_FREE); if(Axis&Z_AXIS) Axis&=~Z_AXIS; else Axis|=Z_AXIS; break; case CTRL_PRIM_GRID_ON: ToggleControlSelectedState(CTRL_PRIM_GRID_ON); GridFlag^=1; break; case CTRL_PRIM_GRID_MAX: ToggleControlSelectedState(CTRL_PRIM_GRID_MAX); GridMax^=1; break; case CTRL_PRIM_GRID_CORNER: ToggleControlSelectedState(CTRL_PRIM_GRID_CORNER); GridCorner^=1; break; case CTRL_PRIM_LOAD_BACKGROUND: /* { FileRequester *fr; CBYTE fname[100]; fr=new FileRequester("data\\","*.asc","Load A Prim","hello"); if(fr->Draw()) { UWORD temp; strcpy(fname,fr->Path); strcat(fname,fr->FileName); read_asc(fname,640,1); temp=copy_prim_to_end(next_prim_object-1,0,0); add_a_background_thing(temp,HALF_ELE_SIZE+(512<<ELE_SHIFT),HALF_ELE_SIZE+(64<<ELE_SHIFT),HALF_ELE_SIZE+(3<<ELE_SHIFT)); // add_a_background_thing(next_prim_object-1,HALF_ELE_SIZE+(512<<ELE_SHIFT),HALF_ELE_SIZE+(64<<ELE_SHIFT),HALF_ELE_SIZE+(3<<ELE_SHIFT)); delete_last_prim(); } UpdatePrimPickWindow(); delete fr; RequestUpdate(); edit_info.amb_dx=-128; edit_info.amb_dy=128; edit_info.amb_dz=-128; edit_info.amb_bright=256; edit_info.amb_offset=0; // edit_info.amb_flag=1; // scan_map(); } */ break; case CTRL_PRIM_ERASE_MAP: if(CurrentPrim && CurrentPrim<256&&prim_count[CurrentPrim]) { SLONG c0; for(c0=0;c0<MAX_MAP_THINGS;c0++) { struct MapThing *t_mthing; t_mthing=&map_things[c0]; switch(t_mthing->Type) { case MAP_THING_TYPE_PRIM: if(t_mthing->IndexOther==CurrentPrim) { delete_thing(c0); prim_count[CurrentPrim]=0; } break; } } } // save_map("data/bak.map",1); // clear_map(); // RequestUpdate(); break; case CTRL_PRIM_MODE_MENU: PrimTabMode = (control_id>>8)-1; switch(PrimTabMode) { case PRIM_MODE_SINGLE: case PRIM_MODE_MULTI: case PRIM_MODE_ANIM_KEY: case PRIM_MODE_ANIM_MORPH: // BackScale=engine.Scale; // engine.Scale=PrimScale; // RequestUpdate(); break; // case PRIM_MODE_BACK: // PrimScale=engine.Scale; // engine.Scale=BackScale; // RequestUpdate(); // break; } UpdatePrimInfo(); break; case CTRL_PRIM_MODE_TEXT: break; /* AngleY++; break; case CTRL_CAM_BUTTON_ZPLUS: AngleZ++; break; case CTRL_CAM_BUTTON_XMINUS: AngleX--; break; case CTRL_CAM_BUTTON_YMINUS: AngleY--; break; case CTRL_CAM_BUTTON_ZMINUS: AngleZ--; break; */ case CTRL_PRIM_COLLIDE_NONE: if (CurrentPrim && PrimTabMode == PRIM_MODE_SINGLE) { prim_objects[CurrentPrim].coltype = PRIM_COLLIDE_NONE; UpdatePrimInfo(); } break; case CTRL_PRIM_COLLIDE_BOX: if (CurrentPrim && PrimTabMode == PRIM_MODE_SINGLE) { prim_objects[CurrentPrim].coltype = PRIM_COLLIDE_BOX; UpdatePrimInfo(); } break; case CTRL_PRIM_COLLIDE_CYLINDER: if (CurrentPrim && PrimTabMode == PRIM_MODE_SINGLE) { prim_objects[CurrentPrim].coltype = PRIM_COLLIDE_CYLINDER; UpdatePrimInfo(); } break; case CTRL_PRIM_COLLIDE_SMALLBOX: if (CurrentPrim && PrimTabMode == PRIM_MODE_SINGLE) { prim_objects[CurrentPrim].coltype = PRIM_COLLIDE_SMALLBOX; UpdatePrimInfo(); } break; case CTRL_PRIM_SHADOW_NONE: if (CurrentPrim && PrimTabMode == PRIM_MODE_SINGLE) {prim_objects[CurrentPrim].shadowtype = PRIM_SHADOW_NONE;} UpdatePrimInfo(); break; case CTRL_PRIM_SHADOW_BOXEDGE: if (CurrentPrim && PrimTabMode == PRIM_MODE_SINGLE) {prim_objects[CurrentPrim].shadowtype = PRIM_SHADOW_BOXEDGE;} UpdatePrimInfo(); break; case CTRL_PRIM_SHADOW_CYLINDER: if (CurrentPrim && PrimTabMode == PRIM_MODE_SINGLE) {prim_objects[CurrentPrim].shadowtype = PRIM_SHADOW_CYLINDER;} UpdatePrimInfo(); break; case CTRL_PRIM_SHADOW_FOURLEGS: if (CurrentPrim && PrimTabMode == PRIM_MODE_SINGLE) {prim_objects[CurrentPrim].shadowtype = PRIM_SHADOW_FOURLEGS;} UpdatePrimInfo(); break; case CTRL_PRIM_SHADOW_FULLBOX: if (CurrentPrim && PrimTabMode == PRIM_MODE_SINGLE) {prim_objects[CurrentPrim].shadowtype = PRIM_SHADOW_FULLBOX;} UpdatePrimInfo(); break; case CTRL_PRIM_FLAG_LAMPOST: if (CurrentPrim && PrimTabMode == PRIM_MODE_SINGLE) {prim_objects[CurrentPrim].flag ^= PRIM_FLAG_LAMPOST; UpdatePrimInfo();} break; case CTRL_PRIM_FLAG_GLARE: if (CurrentPrim && PrimTabMode == PRIM_MODE_SINGLE) {prim_objects[CurrentPrim].flag ^= PRIM_FLAG_GLARE; UpdatePrimInfo();} break; case CTRL_PRIM_FLAG_TREE: if (CurrentPrim && PrimTabMode == PRIM_MODE_SINGLE) {prim_objects[CurrentPrim].flag ^= PRIM_FLAG_TREE; UpdatePrimInfo();} break; case CTRL_PRIM_FLAG_ON_FLOOR: if (CurrentPrim && PrimTabMode == PRIM_MODE_SINGLE) { prim_objects[CurrentPrim].flag ^= PRIM_FLAG_ON_FLOOR; if(prim_objects[CurrentPrim].flag & PRIM_FLAG_ON_FLOOR) { prim_objects[CurrentPrim].flag &=~ PRIM_FLAG_JUST_FLOOR; } UpdatePrimInfo(); } break; case CTRL_PRIM_FLAG_JUST_FLOOR: if (CurrentPrim && PrimTabMode == PRIM_MODE_SINGLE) { prim_objects[CurrentPrim].flag ^= PRIM_FLAG_JUST_FLOOR; if(prim_objects[CurrentPrim].flag & PRIM_FLAG_JUST_FLOOR) { prim_objects[CurrentPrim].flag &=~ PRIM_FLAG_ON_FLOOR; } UpdatePrimInfo(); } break; case CTRL_PRIM_FLAG_INSIDE: { edit_info.Inside^=1; UpdatePrimInfo(); } break; case CTRL_PRIM_VIEW_SIDE: if(View2Mode==0) { View2Mode=1; SetControlState(CTRL_PRIM_VIEW_SIDE, CTRL_SELECTED); } else { View2Mode=0; SetControlState(CTRL_PRIM_VIEW_SIDE, CTRL_DESELECTED); } break; case CTRL_PRIM_GROW: if (CurrentPrim && PrimTabMode == PRIM_MODE_SINGLE) { SLONG i; PrimObject *po; // // Grow the selected prim. // po = &prim_objects[CurrentPrim]; for (i = po->StartPoint; i < po->EndPoint; i++) { prim_points[i].X += prim_points[i].X >> 2; prim_points[i].Y += prim_points[i].Y >> 2; prim_points[i].Z += prim_points[i].Z >> 2; } void update_modules(void); update_modules(); } break; case CTRL_PRIM_SHRINK: if (CurrentPrim && PrimTabMode == PRIM_MODE_SINGLE) { SLONG i; PrimObject *po; // // Shrink the selected prims. // po = &prim_objects[CurrentPrim]; for (i = po->StartPoint; i < po->EndPoint; i++) { prim_points[i].X -= prim_points[i].X >> 2; prim_points[i].Y -= prim_points[i].Y >> 2; prim_points[i].Z -= prim_points[i].Z >> 2; } void update_modules(void); update_modules(); } break; case CTRL_PRIM_DAMAGABLE: if (CurrentPrim && PrimTabMode == PRIM_MODE_SINGLE) { prim_objects[CurrentPrim].damage ^= PRIM_DAMAGE_DAMAGABLE; UpdatePrimInfo(); } break; case CTRL_PRIM_LEANS: if (CurrentPrim && PrimTabMode == PRIM_MODE_SINGLE) { prim_objects[CurrentPrim].damage ^= PRIM_DAMAGE_LEAN; prim_objects[CurrentPrim].damage |= PRIM_DAMAGE_DAMAGABLE; if (prim_objects[CurrentPrim].damage & PRIM_DAMAGE_LEAN) { prim_objects[CurrentPrim].damage &= ~PRIM_DAMAGE_CRUMPLE; } UpdatePrimInfo(); } break; case CTRL_PRIM_CRUMPLES: if (CurrentPrim && PrimTabMode == PRIM_MODE_SINGLE) { prim_objects[CurrentPrim].damage ^= PRIM_DAMAGE_CRUMPLE; prim_objects[CurrentPrim].damage |= PRIM_DAMAGE_DAMAGABLE; if (prim_objects[CurrentPrim].damage & PRIM_DAMAGE_CRUMPLE) { prim_objects[CurrentPrim].damage &= ~PRIM_DAMAGE_LEAN; } UpdatePrimInfo(); } break; case CTRL_PRIM_EXPLODES: if (CurrentPrim && PrimTabMode == PRIM_MODE_SINGLE) { prim_objects[CurrentPrim].damage |= PRIM_DAMAGE_DAMAGABLE; prim_objects[CurrentPrim].damage ^= PRIM_DAMAGE_EXPLODES; UpdatePrimInfo(); } break; case CTRL_PRIM_CENTRE_PIVOT: if (CurrentPrim && PrimTabMode == PRIM_MODE_SINGLE) { SLONG i; SLONG min_x = +INFINITY; SLONG min_y = +INFINITY; SLONG min_z = +INFINITY; SLONG max_x = -INFINITY; SLONG max_y = -INFINITY; SLONG max_z = -INFINITY; SLONG mid_x; SLONG mid_y; SLONG mid_z; PrimObject *po; // // Shrink the selected prims. // po = &prim_objects[CurrentPrim]; for (i = po->StartPoint; i < po->EndPoint; i++) { if (prim_points[i].X < min_x) {min_x = prim_points[i].X;} if (prim_points[i].Y < min_y) {min_y = prim_points[i].Y;} if (prim_points[i].Z < min_z) {min_z = prim_points[i].Z;} if (prim_points[i].X > max_x) {max_x = prim_points[i].X;} if (prim_points[i].Y > max_y) {max_y = prim_points[i].Y;} if (prim_points[i].Z > max_z) {max_z = prim_points[i].Z;} } mid_x = min_x + max_x >> 1; mid_y = min_y + max_y >> 1; mid_z = min_z + max_z >> 1; for (i = po->StartPoint; i < po->EndPoint; i++) { prim_points[i].X -= mid_x; prim_points[i].Y -= mid_y; prim_points[i].Z -= mid_z; } void update_modules(void); update_modules(); } break; } } //---------------------------------------------------------------
23.162572
248
0.676502
[ "object", "transform" ]
3e274517cf24f5496e04dad36fc947ec2f90ac38
2,542
cpp
C++
ponos/tests/blas_tests.cpp
filipecn/Ponos
7b74791fa1c451a2e3f0de6115fd2b3fccc174e1
[ "MIT" ]
1
2021-09-17T18:37:55.000Z
2021-09-17T18:37:55.000Z
ponos/tests/blas_tests.cpp
filipecn/ponos
7b74791fa1c451a2e3f0de6115fd2b3fccc174e1
[ "MIT" ]
9
2017-11-03T01:34:48.000Z
2020-05-09T19:26:51.000Z
ponos/tests/blas_tests.cpp
filipecn/Ponos
7b74791fa1c451a2e3f0de6115fd2b3fccc174e1
[ "MIT" ]
2
2021-09-17T18:38:11.000Z
2021-09-17T18:38:22.000Z
#include <catch2/catch.hpp> #include <ponos/ponos.h> using namespace ponos; TEST_CASE("BLAS_Vector", "[blas][vector]") { SECTION("constructors") { Vector<f32> a; REQUIRE(a.size() == 0); Vector<f32> b(10); REQUIRE(b.size() == 10); Vector<f32> c(10, 3.f); for (int i = 0; i < 10; ++i) REQUIRE(c[i] == Approx(3.f).margin(1e-8)); auto d = c; for (int i = 0; i < 10; ++i) REQUIRE(d[i] == Approx(3.f).margin(1e-8)); } SECTION("operators") { Vector<f32> a(10, 0.f); a += 3.f; for (int i = 0; i < 10; ++i) REQUIRE(a[i] == Approx(3.f).margin(1e-8)); a -= 2.f; for (int i = 0; i < 10; ++i) REQUIRE(a[i] == Approx(1.f).margin(1e-8)); a *= 14.f; for (int i = 0; i < 10; ++i) REQUIRE(a[i] == Approx(14.f).margin(1e-8)); a /= 2.f; for (int i = 0; i < 10; ++i) REQUIRE(a[i] == Approx(7.f).margin(1e-8)); Vector<f32> b(10, 2.f); a *= b; for (int i = 0; i < 10; ++i) REQUIRE(a[i] == Approx(14.f).margin(1e-8)); a /= b; for (int i = 0; i < 10; ++i) REQUIRE(a[i] == Approx(7.f).margin(1e-8)); a += b; for (int i = 0; i < 10; ++i) REQUIRE(a[i] == Approx(9.f).margin(1e-8)); a -= b; for (int i = 0; i < 10; ++i) REQUIRE(a[i] == Approx(7.f).margin(1e-8)); a = a * 2.f; for (int i = 0; i < 10; ++i) REQUIRE(a[i] == Approx(14.f).margin(1e-8)); a = 2.f * a; for (int i = 0; i < 10; ++i) REQUIRE(a[i] == Approx(28.f).margin(1e-8)); a = 8.f / b; for (int i = 0; i < 10; ++i) REQUIRE(a[i] == Approx(4.f).margin(1e-8)); a = a / 2.f; for (int i = 0; i < 10; ++i) REQUIRE(a[i] == Approx(2.f).margin(1e-8)); REQUIRE(a == 2.f); REQUIRE(a == b); a = 3.f; REQUIRE(a == 3.f); } } TEST_CASE("Blas", "[blas]") { SECTION("dot") { Vector<f32> a(10); Vector<f32> b(10); f32 ans = 0.f; for (int i = 0; i < 10; ++i) { a[i] = i * 3; b[i] = -2 * i; ans += (i * 3) * (-2 * i); } REQUIRE(BLAS::dot(a, b) == Approx(ans).margin(1e-8)); } SECTION("axpy") { Vector<f32> ans(10); Vector<f32> r(10); Vector<f32> x(10); Vector<f32> y(10); f32 a = 2.f; for (int i = 0; i < 10; ++i) { x[i] = -7 * i; y[i] = i; r[i] = a * x[i] + y[i]; } BLAS::axpy(a, x, y, ans); REQUIRE(ans == r); } SECTION("infNorm") { Vector<f32> r(10); for (int i = 0; i < 10; ++i) r[i] = i - 7; REQUIRE(BLAS::infNorm(r) == Approx(7.f).margin(1e-8)); } }
25.938776
58
0.448859
[ "vector" ]
3e2ba8e45228af9cedcb5c93672af8ea84300968
1,009
cpp
C++
softboundcets-llvm-clang34/tools/clang/test/SemaCXX/operator-arrow-depth.cpp
jiwon6833/MTE
38a905cbf877de4d6be8ded327ab3c961289e6ca
[ "BSD-3-Clause" ]
36
2015-01-13T19:34:04.000Z
2022-03-07T22:22:15.000Z
softboundcets-llvm-clang34/tools/clang/test/SemaCXX/operator-arrow-depth.cpp
jiwon6833/MTE
38a905cbf877de4d6be8ded327ab3c961289e6ca
[ "BSD-3-Clause" ]
7
2015-10-20T19:05:01.000Z
2021-11-13T14:55:47.000Z
3.4.2/cfe-3.4.2.src/test/SemaCXX/operator-arrow-depth.cpp
androm3da/clang_sles
2ba6d0711546ad681883c42dfb8661b842806695
[ "MIT" ]
18
2015-04-23T20:59:52.000Z
2021-11-18T20:06:39.000Z
// RUN: %clang_cc1 -fsyntax-only -verify %s -DMAX=128 -foperator-arrow-depth 128 // RUN: %clang_cc1 -fsyntax-only -verify %s -DMAX=2 -foperator-arrow-depth 2 // RUN: %clang -fsyntax-only -Xclang -verify %s -DMAX=10 -foperator-arrow-depth=10 template<int N> struct B; template<int N> struct A { B<N> operator->(); // expected-note +{{'operator->' declared here produces an object of type 'B<}} }; template<int N> struct B { A<N-1> operator->(); // expected-note +{{'operator->' declared here produces an object of type 'A<}} #if MAX != 2 // expected-note-re@-2 {{(skipping (120|2) 'operator->'s in backtrace)}} #endif }; struct X { int n; }; template<> struct B<1> { X *operator->(); }; A<MAX/2> good; int n = good->n; B<MAX/2 + 1> bad; int m = bad->n; // expected-error-re {{use of 'operator->' on type 'B<(2|10|128) / 2 \+ 1>' would invoke a sequence of more than (2|10|128) 'operator->' calls}} // expected-note@-1 {{use -foperator-arrow-depth=N to increase 'operator->' limit}}
37.37037
160
0.635282
[ "object" ]
3e2db152bee1548cfc200c74d914190779b02793
4,460
cc
C++
node_modules/node-pty/deps/winpty/misc/buffer-tests/HandleTests/Win7_Conout_Crash.cc
saurabh1294/xterm.js
7f213ceb823ebc82dd6e80698ae07868d772a76f
[ "MIT" ]
null
null
null
node_modules/node-pty/deps/winpty/misc/buffer-tests/HandleTests/Win7_Conout_Crash.cc
saurabh1294/xterm.js
7f213ceb823ebc82dd6e80698ae07868d772a76f
[ "MIT" ]
null
null
null
node_modules/node-pty/deps/winpty/misc/buffer-tests/HandleTests/Win7_Conout_Crash.cc
saurabh1294/xterm.js
7f213ceb823ebc82dd6e80698ae07868d772a76f
[ "MIT" ]
null
null
null
#include <TestCommon.h> // Test for the Windows 7 win7_conout_crash bug. // // See console-handle.md, #win7_conout_crash, for theory. Basically, if a // process does not have a handle for a screen buffer, and it opens and closes // CONOUT$, then the buffer is destroyed, even though another process is still // using it. Closing the *other* handles crashes conhost.exe. // // The bug affects Windows 7 SP1, but does not affect // Windows Server 2008 R2 SP1, the server version of the OS. // REGISTER(Win7_RefCount_Bug, always); static void Win7_RefCount_Bug() { { // Simplest demonstration: // // We will have two screen buffers in this test, O and N. The parent opens // CONOUT$ to access N, but when it closes its handle, N is freed, // restoring O as the active buffer. // Worker p; p.getStdout().setFirstChar('O'); auto c = p.child(); c.newBuffer(false, 'N').activate(); auto conout = p.openConout(); CHECK_EQ(conout.firstChar(), 'N'); conout.close(); // At this point, Win7 is broken. Test for it and hope we don't crash. conout = p.openConout(); if (isWin7() && isWorkstation()) { CHECK_EQ(conout.firstChar(), 'O'); } else { CHECK_EQ(conout.firstChar(), 'N'); } } { // We can still "close" the handle by first importing it to another // process, then detaching that process from its console. Worker p; Worker assistant({ false, DETACHED_PROCESS }); p.getStdout().setFirstChar('O'); auto c = p.child(); c.newBuffer(false, 'N').activate(); // Do the read a few times for good measure. for (int i = 0; i < 5; ++i) { auto conout = p.openConout(true); // Must be inheritable! CHECK_EQ(conout.firstChar(), 'N'); assistant.attach(p); // The attach imports the CONOUT$ handle conout.close(); assistant.detach(); // Exiting would also work. } } { // If the child detaches, the screen buffer is still allocated. This // demonstrates that the CONOUT$ handle *did* increment a refcount on // the buffer. Worker p; p.getStdout().setFirstChar('O'); Worker c = p.child(); c.newBuffer(false, 'N').activate(); auto conout = p.openConout(); c.detach(); // The child must exit/detach *without* closing the handle. CHECK_EQ(conout.firstChar(), 'N'); auto conout2 = p.openConout(); CHECK_EQ(conout2.firstChar(), 'N'); // It is now safe to close the handles. There is no other "console // object" referencing the screen buffer. conout.close(); conout2.close(); } { // If there are multiple console objects, closing any of them frees // the screen buffer. Worker p; auto c1 = p.child(); auto c2 = p.child(); p.getStdout().setFirstChar('O'); p.newBuffer(false, 'N').activate(); auto ch1 = c1.openConout(); auto ch2 = c2.openConout(); CHECK_EQ(ch1.firstChar(), 'N'); CHECK_EQ(ch2.firstChar(), 'N'); ch1.close(); // At this point, Win7 is broken. Test for it and hope we don't crash. auto testHandle = c1.openConout(); if (isWin7() && isWorkstation()) { CHECK_EQ(testHandle.firstChar(), 'O'); } else { CHECK_EQ(testHandle.firstChar(), 'N'); } } if (isTraditionalConio()) { // Two processes can share a console object; in that case, CloseHandle // does not immediately fail. for (int i = 0; i < 2; ++i) { Worker p1; Worker p2 = p1.child(); Worker p3({false, DETACHED_PROCESS}); p1.getStdout().setFirstChar('O'); Worker observer = p1.child(); p1.newBuffer(false, 'N').activate(); auto objref1 = p2.openConout(true); p3.attach(p2); auto objref2 = Handle::invent(objref1.value(), p3); if (i == 0) { objref1.close(); } else { objref2.close(); } CHECK_EQ(observer.openConout().firstChar(), 'N'); } } }
37.79661
84
0.543946
[ "object" ]
3e2dd302671a7ec8a481839288a619b0778a0d15
297,125
hpp
C++
cisco-ios-xr/ydk/models/cisco_ios_xr/fragmented/Cisco_IOS_XR_ipv4_bgp_oper_2.hpp
CiscoDevNet/ydk-cpp
ef7d75970f2ef1154100e0f7b0a2ee823609b481
[ "ECL-2.0", "Apache-2.0" ]
17
2016-12-02T05:45:49.000Z
2022-02-10T19:32:54.000Z
cisco-ios-xr/ydk/models/cisco_ios_xr/fragmented/Cisco_IOS_XR_ipv4_bgp_oper_2.hpp
CiscoDevNet/ydk-cpp
ef7d75970f2ef1154100e0f7b0a2ee823609b481
[ "ECL-2.0", "Apache-2.0" ]
2
2017-03-27T15:22:38.000Z
2019-11-05T08:30:16.000Z
cisco-ios-xr/ydk/models/cisco_ios_xr/fragmented/Cisco_IOS_XR_ipv4_bgp_oper_2.hpp
CiscoDevNet/ydk-cpp
ef7d75970f2ef1154100e0f7b0a2ee823609b481
[ "ECL-2.0", "Apache-2.0" ]
11
2016-12-02T05:45:52.000Z
2019-11-07T08:28:17.000Z
#ifndef _CISCO_IOS_XR_IPV4_BGP_OPER_2_ #define _CISCO_IOS_XR_IPV4_BGP_OPER_2_ #include <memory> #include <vector> #include <string> #include <ydk/types.hpp> #include <ydk/errors.hpp> #include "Cisco_IOS_XR_ipv4_bgp_oper_0.hpp" #include "Cisco_IOS_XR_ipv4_bgp_oper_1.hpp" namespace cisco_ios_xr { namespace Cisco_IOS_XR_ipv4_bgp_oper { class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::InternalVpnClientInfo::InheritanceChain::BgpConfigEntid::NeighborAddress : public ydk::Entity { public: NeighborAddress(); ~NeighborAddress(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf afi; //type: BgpAfi ydk::YLeaf ipv4_address; //type: string ydk::YLeaf ipv4_mcast_address; //type: string ydk::YLeaf ipv4_label_address; //type: string ydk::YLeaf ipv4_tunnel_address; //type: string ydk::YLeaf ipv4_mdt_address; //type: string ydk::YLeaf ipv4vpn_address; //type: string ydk::YLeaf ipv4vpna_mcastddress; //type: string ydk::YLeaf ipv6_address; //type: string ydk::YLeaf ipv6_mcast_address; //type: string ydk::YLeaf ipv6_label_address; //type: string ydk::YLeaf ipv6vpn_address; //type: string ydk::YLeaf ipv6vpn_mcast_address; //type: string ydk::YLeaf rt_constraint_address; //type: string ydk::YLeaf ipv6mvpn_address; //type: string ydk::YLeaf ipv4mvpn_address; //type: string ydk::YLeaf l2vpn_evpn_address; //type: string ydk::YLeaf ls_ls_address; //type: string ydk::YLeaf ipv4_flowspec_address; //type: string ydk::YLeaf ipv6_flowspec_address; //type: string ydk::YLeaf ipv4vpn_flowspec_address; //type: string ydk::YLeaf ipv6vpn_flowspec_address; //type: string class L2vpnVplsAddress; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::InternalVpnClientInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnVplsAddress class L2vpnMspwAddress; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::InternalVpnClientInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnMspwAddress class Ipv4SrPolicyAddress; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::InternalVpnClientInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv4SrPolicyAddress class Ipv6SrPolicyAddress; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::InternalVpnClientInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv6SrPolicyAddress std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::InternalVpnClientInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnVplsAddress> l2vpn_vpls_address; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::InternalVpnClientInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnMspwAddress> l2vpn_mspw_address; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::InternalVpnClientInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv4SrPolicyAddress> ipv4_sr_policy_address; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::InternalVpnClientInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv6SrPolicyAddress> ipv6_sr_policy_address; }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::InternalVpnClientInfo::InheritanceChain::BgpConfigEntid::NeighborAddress class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::InternalVpnClientInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnVplsAddress : public ydk::Entity { public: L2vpnVplsAddress(); ~L2vpnVplsAddress(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf l2vpn_address; //type: string }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::InternalVpnClientInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnVplsAddress class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::InternalVpnClientInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnMspwAddress : public ydk::Entity { public: L2vpnMspwAddress(); ~L2vpnMspwAddress(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf l2vpn_address; //type: string }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::InternalVpnClientInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnMspwAddress class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::InternalVpnClientInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv4SrPolicyAddress : public ydk::Entity { public: Ipv4SrPolicyAddress(); ~Ipv4SrPolicyAddress(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf ipv4_srpolicy_address; //type: string }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::InternalVpnClientInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv4SrPolicyAddress class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::InternalVpnClientInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv6SrPolicyAddress : public ydk::Entity { public: Ipv6SrPolicyAddress(); ~Ipv6SrPolicyAddress(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf ipv6_srpolicy_address; //type: string }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::InternalVpnClientInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv6SrPolicyAddress class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::AddpathSendCapabilityInfo : public ydk::Entity { public: AddpathSendCapabilityInfo(); ~AddpathSendCapabilityInfo(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf is_item_configured; //type: boolean class InheritanceChain; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::AddpathSendCapabilityInfo::InheritanceChain std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::AddpathSendCapabilityInfo::InheritanceChain> inheritance_chain; }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::AddpathSendCapabilityInfo class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::AddpathSendCapabilityInfo::InheritanceChain : public ydk::Entity { public: InheritanceChain(); ~InheritanceChain(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; class BgpConfigEntid; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::AddpathSendCapabilityInfo::InheritanceChain::BgpConfigEntid ydk::YList bgp_config_entid; }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::AddpathSendCapabilityInfo::InheritanceChain class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::AddpathSendCapabilityInfo::InheritanceChain::BgpConfigEntid : public ydk::Entity { public: BgpConfigEntid(); ~BgpConfigEntid(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf address_family_identifier; //type: uint8 ydk::YLeaf configuration_type; //type: BgpEntities ydk::YLeaf group_name; //type: string class NeighborAddress; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::AddpathSendCapabilityInfo::InheritanceChain::BgpConfigEntid::NeighborAddress std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::AddpathSendCapabilityInfo::InheritanceChain::BgpConfigEntid::NeighborAddress> neighbor_address; }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::AddpathSendCapabilityInfo::InheritanceChain::BgpConfigEntid class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::AddpathSendCapabilityInfo::InheritanceChain::BgpConfigEntid::NeighborAddress : public ydk::Entity { public: NeighborAddress(); ~NeighborAddress(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf afi; //type: BgpAfi ydk::YLeaf ipv4_address; //type: string ydk::YLeaf ipv4_mcast_address; //type: string ydk::YLeaf ipv4_label_address; //type: string ydk::YLeaf ipv4_tunnel_address; //type: string ydk::YLeaf ipv4_mdt_address; //type: string ydk::YLeaf ipv4vpn_address; //type: string ydk::YLeaf ipv4vpna_mcastddress; //type: string ydk::YLeaf ipv6_address; //type: string ydk::YLeaf ipv6_mcast_address; //type: string ydk::YLeaf ipv6_label_address; //type: string ydk::YLeaf ipv6vpn_address; //type: string ydk::YLeaf ipv6vpn_mcast_address; //type: string ydk::YLeaf rt_constraint_address; //type: string ydk::YLeaf ipv6mvpn_address; //type: string ydk::YLeaf ipv4mvpn_address; //type: string ydk::YLeaf l2vpn_evpn_address; //type: string ydk::YLeaf ls_ls_address; //type: string ydk::YLeaf ipv4_flowspec_address; //type: string ydk::YLeaf ipv6_flowspec_address; //type: string ydk::YLeaf ipv4vpn_flowspec_address; //type: string ydk::YLeaf ipv6vpn_flowspec_address; //type: string class L2vpnVplsAddress; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::AddpathSendCapabilityInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnVplsAddress class L2vpnMspwAddress; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::AddpathSendCapabilityInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnMspwAddress class Ipv4SrPolicyAddress; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::AddpathSendCapabilityInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv4SrPolicyAddress class Ipv6SrPolicyAddress; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::AddpathSendCapabilityInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv6SrPolicyAddress std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::AddpathSendCapabilityInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnVplsAddress> l2vpn_vpls_address; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::AddpathSendCapabilityInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnMspwAddress> l2vpn_mspw_address; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::AddpathSendCapabilityInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv4SrPolicyAddress> ipv4_sr_policy_address; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::AddpathSendCapabilityInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv6SrPolicyAddress> ipv6_sr_policy_address; }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::AddpathSendCapabilityInfo::InheritanceChain::BgpConfigEntid::NeighborAddress class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::AddpathSendCapabilityInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnVplsAddress : public ydk::Entity { public: L2vpnVplsAddress(); ~L2vpnVplsAddress(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf l2vpn_address; //type: string }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::AddpathSendCapabilityInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnVplsAddress class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::AddpathSendCapabilityInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnMspwAddress : public ydk::Entity { public: L2vpnMspwAddress(); ~L2vpnMspwAddress(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf l2vpn_address; //type: string }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::AddpathSendCapabilityInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnMspwAddress class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::AddpathSendCapabilityInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv4SrPolicyAddress : public ydk::Entity { public: Ipv4SrPolicyAddress(); ~Ipv4SrPolicyAddress(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf ipv4_srpolicy_address; //type: string }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::AddpathSendCapabilityInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv4SrPolicyAddress class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::AddpathSendCapabilityInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv6SrPolicyAddress : public ydk::Entity { public: Ipv6SrPolicyAddress(); ~Ipv6SrPolicyAddress(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf ipv6_srpolicy_address; //type: string }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::AddpathSendCapabilityInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv6SrPolicyAddress class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::AddpathReceiveCapabilityInfo : public ydk::Entity { public: AddpathReceiveCapabilityInfo(); ~AddpathReceiveCapabilityInfo(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf is_item_configured; //type: boolean class InheritanceChain; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::AddpathReceiveCapabilityInfo::InheritanceChain std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::AddpathReceiveCapabilityInfo::InheritanceChain> inheritance_chain; }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::AddpathReceiveCapabilityInfo class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::AddpathReceiveCapabilityInfo::InheritanceChain : public ydk::Entity { public: InheritanceChain(); ~InheritanceChain(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; class BgpConfigEntid; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::AddpathReceiveCapabilityInfo::InheritanceChain::BgpConfigEntid ydk::YList bgp_config_entid; }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::AddpathReceiveCapabilityInfo::InheritanceChain class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::AddpathReceiveCapabilityInfo::InheritanceChain::BgpConfigEntid : public ydk::Entity { public: BgpConfigEntid(); ~BgpConfigEntid(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf address_family_identifier; //type: uint8 ydk::YLeaf configuration_type; //type: BgpEntities ydk::YLeaf group_name; //type: string class NeighborAddress; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::AddpathReceiveCapabilityInfo::InheritanceChain::BgpConfigEntid::NeighborAddress std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::AddpathReceiveCapabilityInfo::InheritanceChain::BgpConfigEntid::NeighborAddress> neighbor_address; }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::AddpathReceiveCapabilityInfo::InheritanceChain::BgpConfigEntid class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::AddpathReceiveCapabilityInfo::InheritanceChain::BgpConfigEntid::NeighborAddress : public ydk::Entity { public: NeighborAddress(); ~NeighborAddress(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf afi; //type: BgpAfi ydk::YLeaf ipv4_address; //type: string ydk::YLeaf ipv4_mcast_address; //type: string ydk::YLeaf ipv4_label_address; //type: string ydk::YLeaf ipv4_tunnel_address; //type: string ydk::YLeaf ipv4_mdt_address; //type: string ydk::YLeaf ipv4vpn_address; //type: string ydk::YLeaf ipv4vpna_mcastddress; //type: string ydk::YLeaf ipv6_address; //type: string ydk::YLeaf ipv6_mcast_address; //type: string ydk::YLeaf ipv6_label_address; //type: string ydk::YLeaf ipv6vpn_address; //type: string ydk::YLeaf ipv6vpn_mcast_address; //type: string ydk::YLeaf rt_constraint_address; //type: string ydk::YLeaf ipv6mvpn_address; //type: string ydk::YLeaf ipv4mvpn_address; //type: string ydk::YLeaf l2vpn_evpn_address; //type: string ydk::YLeaf ls_ls_address; //type: string ydk::YLeaf ipv4_flowspec_address; //type: string ydk::YLeaf ipv6_flowspec_address; //type: string ydk::YLeaf ipv4vpn_flowspec_address; //type: string ydk::YLeaf ipv6vpn_flowspec_address; //type: string class L2vpnVplsAddress; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::AddpathReceiveCapabilityInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnVplsAddress class L2vpnMspwAddress; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::AddpathReceiveCapabilityInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnMspwAddress class Ipv4SrPolicyAddress; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::AddpathReceiveCapabilityInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv4SrPolicyAddress class Ipv6SrPolicyAddress; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::AddpathReceiveCapabilityInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv6SrPolicyAddress std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::AddpathReceiveCapabilityInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnVplsAddress> l2vpn_vpls_address; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::AddpathReceiveCapabilityInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnMspwAddress> l2vpn_mspw_address; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::AddpathReceiveCapabilityInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv4SrPolicyAddress> ipv4_sr_policy_address; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::AddpathReceiveCapabilityInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv6SrPolicyAddress> ipv6_sr_policy_address; }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::AddpathReceiveCapabilityInfo::InheritanceChain::BgpConfigEntid::NeighborAddress class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::AddpathReceiveCapabilityInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnVplsAddress : public ydk::Entity { public: L2vpnVplsAddress(); ~L2vpnVplsAddress(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf l2vpn_address; //type: string }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::AddpathReceiveCapabilityInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnVplsAddress class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::AddpathReceiveCapabilityInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnMspwAddress : public ydk::Entity { public: L2vpnMspwAddress(); ~L2vpnMspwAddress(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf l2vpn_address; //type: string }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::AddpathReceiveCapabilityInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnMspwAddress class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::AddpathReceiveCapabilityInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv4SrPolicyAddress : public ydk::Entity { public: Ipv4SrPolicyAddress(); ~Ipv4SrPolicyAddress(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf ipv4_srpolicy_address; //type: string }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::AddpathReceiveCapabilityInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv4SrPolicyAddress class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::AddpathReceiveCapabilityInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv6SrPolicyAddress : public ydk::Entity { public: Ipv6SrPolicyAddress(); ~Ipv6SrPolicyAddress(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf ipv6_srpolicy_address; //type: string }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::AddpathReceiveCapabilityInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv6SrPolicyAddress class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::EgressPeerEngineeringInfo : public ydk::Entity { public: EgressPeerEngineeringInfo(); ~EgressPeerEngineeringInfo(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf is_item_configured; //type: boolean class InheritanceChain; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::EgressPeerEngineeringInfo::InheritanceChain std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::EgressPeerEngineeringInfo::InheritanceChain> inheritance_chain; }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::EgressPeerEngineeringInfo class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::EgressPeerEngineeringInfo::InheritanceChain : public ydk::Entity { public: InheritanceChain(); ~InheritanceChain(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; class BgpConfigEntid; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::EgressPeerEngineeringInfo::InheritanceChain::BgpConfigEntid ydk::YList bgp_config_entid; }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::EgressPeerEngineeringInfo::InheritanceChain class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::EgressPeerEngineeringInfo::InheritanceChain::BgpConfigEntid : public ydk::Entity { public: BgpConfigEntid(); ~BgpConfigEntid(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf address_family_identifier; //type: uint8 ydk::YLeaf configuration_type; //type: BgpEntities ydk::YLeaf group_name; //type: string class NeighborAddress; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::EgressPeerEngineeringInfo::InheritanceChain::BgpConfigEntid::NeighborAddress std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::EgressPeerEngineeringInfo::InheritanceChain::BgpConfigEntid::NeighborAddress> neighbor_address; }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::EgressPeerEngineeringInfo::InheritanceChain::BgpConfigEntid class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::EgressPeerEngineeringInfo::InheritanceChain::BgpConfigEntid::NeighborAddress : public ydk::Entity { public: NeighborAddress(); ~NeighborAddress(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf afi; //type: BgpAfi ydk::YLeaf ipv4_address; //type: string ydk::YLeaf ipv4_mcast_address; //type: string ydk::YLeaf ipv4_label_address; //type: string ydk::YLeaf ipv4_tunnel_address; //type: string ydk::YLeaf ipv4_mdt_address; //type: string ydk::YLeaf ipv4vpn_address; //type: string ydk::YLeaf ipv4vpna_mcastddress; //type: string ydk::YLeaf ipv6_address; //type: string ydk::YLeaf ipv6_mcast_address; //type: string ydk::YLeaf ipv6_label_address; //type: string ydk::YLeaf ipv6vpn_address; //type: string ydk::YLeaf ipv6vpn_mcast_address; //type: string ydk::YLeaf rt_constraint_address; //type: string ydk::YLeaf ipv6mvpn_address; //type: string ydk::YLeaf ipv4mvpn_address; //type: string ydk::YLeaf l2vpn_evpn_address; //type: string ydk::YLeaf ls_ls_address; //type: string ydk::YLeaf ipv4_flowspec_address; //type: string ydk::YLeaf ipv6_flowspec_address; //type: string ydk::YLeaf ipv4vpn_flowspec_address; //type: string ydk::YLeaf ipv6vpn_flowspec_address; //type: string class L2vpnVplsAddress; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::EgressPeerEngineeringInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnVplsAddress class L2vpnMspwAddress; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::EgressPeerEngineeringInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnMspwAddress class Ipv4SrPolicyAddress; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::EgressPeerEngineeringInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv4SrPolicyAddress class Ipv6SrPolicyAddress; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::EgressPeerEngineeringInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv6SrPolicyAddress std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::EgressPeerEngineeringInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnVplsAddress> l2vpn_vpls_address; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::EgressPeerEngineeringInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnMspwAddress> l2vpn_mspw_address; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::EgressPeerEngineeringInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv4SrPolicyAddress> ipv4_sr_policy_address; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::EgressPeerEngineeringInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv6SrPolicyAddress> ipv6_sr_policy_address; }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::EgressPeerEngineeringInfo::InheritanceChain::BgpConfigEntid::NeighborAddress class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::EgressPeerEngineeringInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnVplsAddress : public ydk::Entity { public: L2vpnVplsAddress(); ~L2vpnVplsAddress(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf l2vpn_address; //type: string }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::EgressPeerEngineeringInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnVplsAddress class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::EgressPeerEngineeringInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnMspwAddress : public ydk::Entity { public: L2vpnMspwAddress(); ~L2vpnMspwAddress(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf l2vpn_address; //type: string }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::EgressPeerEngineeringInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnMspwAddress class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::EgressPeerEngineeringInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv4SrPolicyAddress : public ydk::Entity { public: Ipv4SrPolicyAddress(); ~Ipv4SrPolicyAddress(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf ipv4_srpolicy_address; //type: string }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::EgressPeerEngineeringInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv4SrPolicyAddress class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::EgressPeerEngineeringInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv6SrPolicyAddress : public ydk::Entity { public: Ipv6SrPolicyAddress(); ~Ipv6SrPolicyAddress(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf ipv6_srpolicy_address; //type: string }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::EgressPeerEngineeringInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv6SrPolicyAddress class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::UpdateErrorHandlingNoResetInfo : public ydk::Entity { public: UpdateErrorHandlingNoResetInfo(); ~UpdateErrorHandlingNoResetInfo(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf is_item_configured; //type: boolean class InheritanceChain; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::UpdateErrorHandlingNoResetInfo::InheritanceChain std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::UpdateErrorHandlingNoResetInfo::InheritanceChain> inheritance_chain; }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::UpdateErrorHandlingNoResetInfo class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::UpdateErrorHandlingNoResetInfo::InheritanceChain : public ydk::Entity { public: InheritanceChain(); ~InheritanceChain(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; class BgpConfigEntid; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::UpdateErrorHandlingNoResetInfo::InheritanceChain::BgpConfigEntid ydk::YList bgp_config_entid; }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::UpdateErrorHandlingNoResetInfo::InheritanceChain class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::UpdateErrorHandlingNoResetInfo::InheritanceChain::BgpConfigEntid : public ydk::Entity { public: BgpConfigEntid(); ~BgpConfigEntid(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf address_family_identifier; //type: uint8 ydk::YLeaf configuration_type; //type: BgpEntities ydk::YLeaf group_name; //type: string class NeighborAddress; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::UpdateErrorHandlingNoResetInfo::InheritanceChain::BgpConfigEntid::NeighborAddress std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::UpdateErrorHandlingNoResetInfo::InheritanceChain::BgpConfigEntid::NeighborAddress> neighbor_address; }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::UpdateErrorHandlingNoResetInfo::InheritanceChain::BgpConfigEntid class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::UpdateErrorHandlingNoResetInfo::InheritanceChain::BgpConfigEntid::NeighborAddress : public ydk::Entity { public: NeighborAddress(); ~NeighborAddress(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf afi; //type: BgpAfi ydk::YLeaf ipv4_address; //type: string ydk::YLeaf ipv4_mcast_address; //type: string ydk::YLeaf ipv4_label_address; //type: string ydk::YLeaf ipv4_tunnel_address; //type: string ydk::YLeaf ipv4_mdt_address; //type: string ydk::YLeaf ipv4vpn_address; //type: string ydk::YLeaf ipv4vpna_mcastddress; //type: string ydk::YLeaf ipv6_address; //type: string ydk::YLeaf ipv6_mcast_address; //type: string ydk::YLeaf ipv6_label_address; //type: string ydk::YLeaf ipv6vpn_address; //type: string ydk::YLeaf ipv6vpn_mcast_address; //type: string ydk::YLeaf rt_constraint_address; //type: string ydk::YLeaf ipv6mvpn_address; //type: string ydk::YLeaf ipv4mvpn_address; //type: string ydk::YLeaf l2vpn_evpn_address; //type: string ydk::YLeaf ls_ls_address; //type: string ydk::YLeaf ipv4_flowspec_address; //type: string ydk::YLeaf ipv6_flowspec_address; //type: string ydk::YLeaf ipv4vpn_flowspec_address; //type: string ydk::YLeaf ipv6vpn_flowspec_address; //type: string class L2vpnVplsAddress; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::UpdateErrorHandlingNoResetInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnVplsAddress class L2vpnMspwAddress; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::UpdateErrorHandlingNoResetInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnMspwAddress class Ipv4SrPolicyAddress; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::UpdateErrorHandlingNoResetInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv4SrPolicyAddress class Ipv6SrPolicyAddress; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::UpdateErrorHandlingNoResetInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv6SrPolicyAddress std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::UpdateErrorHandlingNoResetInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnVplsAddress> l2vpn_vpls_address; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::UpdateErrorHandlingNoResetInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnMspwAddress> l2vpn_mspw_address; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::UpdateErrorHandlingNoResetInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv4SrPolicyAddress> ipv4_sr_policy_address; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::UpdateErrorHandlingNoResetInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv6SrPolicyAddress> ipv6_sr_policy_address; }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::UpdateErrorHandlingNoResetInfo::InheritanceChain::BgpConfigEntid::NeighborAddress class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::UpdateErrorHandlingNoResetInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnVplsAddress : public ydk::Entity { public: L2vpnVplsAddress(); ~L2vpnVplsAddress(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf l2vpn_address; //type: string }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::UpdateErrorHandlingNoResetInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnVplsAddress class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::UpdateErrorHandlingNoResetInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnMspwAddress : public ydk::Entity { public: L2vpnMspwAddress(); ~L2vpnMspwAddress(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf l2vpn_address; //type: string }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::UpdateErrorHandlingNoResetInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnMspwAddress class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::UpdateErrorHandlingNoResetInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv4SrPolicyAddress : public ydk::Entity { public: Ipv4SrPolicyAddress(); ~Ipv4SrPolicyAddress(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf ipv4_srpolicy_address; //type: string }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::UpdateErrorHandlingNoResetInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv4SrPolicyAddress class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::UpdateErrorHandlingNoResetInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv6SrPolicyAddress : public ydk::Entity { public: Ipv6SrPolicyAddress(); ~Ipv6SrPolicyAddress(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf ipv6_srpolicy_address; //type: string }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::UpdateErrorHandlingNoResetInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv6SrPolicyAddress class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationDisableInfo : public ydk::Entity { public: PrefixValidationDisableInfo(); ~PrefixValidationDisableInfo(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf is_item_configured; //type: boolean class InheritanceChain; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationDisableInfo::InheritanceChain std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationDisableInfo::InheritanceChain> inheritance_chain; }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationDisableInfo class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationDisableInfo::InheritanceChain : public ydk::Entity { public: InheritanceChain(); ~InheritanceChain(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; class BgpConfigEntid; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationDisableInfo::InheritanceChain::BgpConfigEntid ydk::YList bgp_config_entid; }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationDisableInfo::InheritanceChain class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationDisableInfo::InheritanceChain::BgpConfigEntid : public ydk::Entity { public: BgpConfigEntid(); ~BgpConfigEntid(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf address_family_identifier; //type: uint8 ydk::YLeaf configuration_type; //type: BgpEntities ydk::YLeaf group_name; //type: string class NeighborAddress; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationDisableInfo::InheritanceChain::BgpConfigEntid::NeighborAddress std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationDisableInfo::InheritanceChain::BgpConfigEntid::NeighborAddress> neighbor_address; }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationDisableInfo::InheritanceChain::BgpConfigEntid class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationDisableInfo::InheritanceChain::BgpConfigEntid::NeighborAddress : public ydk::Entity { public: NeighborAddress(); ~NeighborAddress(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf afi; //type: BgpAfi ydk::YLeaf ipv4_address; //type: string ydk::YLeaf ipv4_mcast_address; //type: string ydk::YLeaf ipv4_label_address; //type: string ydk::YLeaf ipv4_tunnel_address; //type: string ydk::YLeaf ipv4_mdt_address; //type: string ydk::YLeaf ipv4vpn_address; //type: string ydk::YLeaf ipv4vpna_mcastddress; //type: string ydk::YLeaf ipv6_address; //type: string ydk::YLeaf ipv6_mcast_address; //type: string ydk::YLeaf ipv6_label_address; //type: string ydk::YLeaf ipv6vpn_address; //type: string ydk::YLeaf ipv6vpn_mcast_address; //type: string ydk::YLeaf rt_constraint_address; //type: string ydk::YLeaf ipv6mvpn_address; //type: string ydk::YLeaf ipv4mvpn_address; //type: string ydk::YLeaf l2vpn_evpn_address; //type: string ydk::YLeaf ls_ls_address; //type: string ydk::YLeaf ipv4_flowspec_address; //type: string ydk::YLeaf ipv6_flowspec_address; //type: string ydk::YLeaf ipv4vpn_flowspec_address; //type: string ydk::YLeaf ipv6vpn_flowspec_address; //type: string class L2vpnVplsAddress; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationDisableInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnVplsAddress class L2vpnMspwAddress; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationDisableInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnMspwAddress class Ipv4SrPolicyAddress; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationDisableInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv4SrPolicyAddress class Ipv6SrPolicyAddress; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationDisableInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv6SrPolicyAddress std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationDisableInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnVplsAddress> l2vpn_vpls_address; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationDisableInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnMspwAddress> l2vpn_mspw_address; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationDisableInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv4SrPolicyAddress> ipv4_sr_policy_address; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationDisableInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv6SrPolicyAddress> ipv6_sr_policy_address; }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationDisableInfo::InheritanceChain::BgpConfigEntid::NeighborAddress class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationDisableInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnVplsAddress : public ydk::Entity { public: L2vpnVplsAddress(); ~L2vpnVplsAddress(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf l2vpn_address; //type: string }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationDisableInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnVplsAddress class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationDisableInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnMspwAddress : public ydk::Entity { public: L2vpnMspwAddress(); ~L2vpnMspwAddress(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf l2vpn_address; //type: string }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationDisableInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnMspwAddress class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationDisableInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv4SrPolicyAddress : public ydk::Entity { public: Ipv4SrPolicyAddress(); ~Ipv4SrPolicyAddress(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf ipv4_srpolicy_address; //type: string }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationDisableInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv4SrPolicyAddress class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationDisableInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv6SrPolicyAddress : public ydk::Entity { public: Ipv6SrPolicyAddress(); ~Ipv6SrPolicyAddress(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf ipv6_srpolicy_address; //type: string }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationDisableInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv6SrPolicyAddress class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationUseValiditInfo : public ydk::Entity { public: PrefixValidationUseValiditInfo(); ~PrefixValidationUseValiditInfo(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf is_item_configured; //type: boolean class InheritanceChain; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationUseValiditInfo::InheritanceChain std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationUseValiditInfo::InheritanceChain> inheritance_chain; }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationUseValiditInfo class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationUseValiditInfo::InheritanceChain : public ydk::Entity { public: InheritanceChain(); ~InheritanceChain(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; class BgpConfigEntid; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationUseValiditInfo::InheritanceChain::BgpConfigEntid ydk::YList bgp_config_entid; }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationUseValiditInfo::InheritanceChain class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationUseValiditInfo::InheritanceChain::BgpConfigEntid : public ydk::Entity { public: BgpConfigEntid(); ~BgpConfigEntid(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf address_family_identifier; //type: uint8 ydk::YLeaf configuration_type; //type: BgpEntities ydk::YLeaf group_name; //type: string class NeighborAddress; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationUseValiditInfo::InheritanceChain::BgpConfigEntid::NeighborAddress std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationUseValiditInfo::InheritanceChain::BgpConfigEntid::NeighborAddress> neighbor_address; }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationUseValiditInfo::InheritanceChain::BgpConfigEntid class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationUseValiditInfo::InheritanceChain::BgpConfigEntid::NeighborAddress : public ydk::Entity { public: NeighborAddress(); ~NeighborAddress(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf afi; //type: BgpAfi ydk::YLeaf ipv4_address; //type: string ydk::YLeaf ipv4_mcast_address; //type: string ydk::YLeaf ipv4_label_address; //type: string ydk::YLeaf ipv4_tunnel_address; //type: string ydk::YLeaf ipv4_mdt_address; //type: string ydk::YLeaf ipv4vpn_address; //type: string ydk::YLeaf ipv4vpna_mcastddress; //type: string ydk::YLeaf ipv6_address; //type: string ydk::YLeaf ipv6_mcast_address; //type: string ydk::YLeaf ipv6_label_address; //type: string ydk::YLeaf ipv6vpn_address; //type: string ydk::YLeaf ipv6vpn_mcast_address; //type: string ydk::YLeaf rt_constraint_address; //type: string ydk::YLeaf ipv6mvpn_address; //type: string ydk::YLeaf ipv4mvpn_address; //type: string ydk::YLeaf l2vpn_evpn_address; //type: string ydk::YLeaf ls_ls_address; //type: string ydk::YLeaf ipv4_flowspec_address; //type: string ydk::YLeaf ipv6_flowspec_address; //type: string ydk::YLeaf ipv4vpn_flowspec_address; //type: string ydk::YLeaf ipv6vpn_flowspec_address; //type: string class L2vpnVplsAddress; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationUseValiditInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnVplsAddress class L2vpnMspwAddress; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationUseValiditInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnMspwAddress class Ipv4SrPolicyAddress; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationUseValiditInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv4SrPolicyAddress class Ipv6SrPolicyAddress; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationUseValiditInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv6SrPolicyAddress std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationUseValiditInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnVplsAddress> l2vpn_vpls_address; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationUseValiditInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnMspwAddress> l2vpn_mspw_address; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationUseValiditInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv4SrPolicyAddress> ipv4_sr_policy_address; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationUseValiditInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv6SrPolicyAddress> ipv6_sr_policy_address; }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationUseValiditInfo::InheritanceChain::BgpConfigEntid::NeighborAddress class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationUseValiditInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnVplsAddress : public ydk::Entity { public: L2vpnVplsAddress(); ~L2vpnVplsAddress(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf l2vpn_address; //type: string }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationUseValiditInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnVplsAddress class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationUseValiditInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnMspwAddress : public ydk::Entity { public: L2vpnMspwAddress(); ~L2vpnMspwAddress(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf l2vpn_address; //type: string }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationUseValiditInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnMspwAddress class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationUseValiditInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv4SrPolicyAddress : public ydk::Entity { public: Ipv4SrPolicyAddress(); ~Ipv4SrPolicyAddress(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf ipv4_srpolicy_address; //type: string }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationUseValiditInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv4SrPolicyAddress class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationUseValiditInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv6SrPolicyAddress : public ydk::Entity { public: Ipv6SrPolicyAddress(); ~Ipv6SrPolicyAddress(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf ipv6_srpolicy_address; //type: string }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationUseValiditInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv6SrPolicyAddress class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationAllowInvalidInfo : public ydk::Entity { public: PrefixValidationAllowInvalidInfo(); ~PrefixValidationAllowInvalidInfo(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf is_item_configured; //type: boolean class InheritanceChain; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationAllowInvalidInfo::InheritanceChain std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationAllowInvalidInfo::InheritanceChain> inheritance_chain; }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationAllowInvalidInfo class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationAllowInvalidInfo::InheritanceChain : public ydk::Entity { public: InheritanceChain(); ~InheritanceChain(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; class BgpConfigEntid; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationAllowInvalidInfo::InheritanceChain::BgpConfigEntid ydk::YList bgp_config_entid; }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationAllowInvalidInfo::InheritanceChain class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationAllowInvalidInfo::InheritanceChain::BgpConfigEntid : public ydk::Entity { public: BgpConfigEntid(); ~BgpConfigEntid(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf address_family_identifier; //type: uint8 ydk::YLeaf configuration_type; //type: BgpEntities ydk::YLeaf group_name; //type: string class NeighborAddress; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationAllowInvalidInfo::InheritanceChain::BgpConfigEntid::NeighborAddress std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationAllowInvalidInfo::InheritanceChain::BgpConfigEntid::NeighborAddress> neighbor_address; }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationAllowInvalidInfo::InheritanceChain::BgpConfigEntid class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationAllowInvalidInfo::InheritanceChain::BgpConfigEntid::NeighborAddress : public ydk::Entity { public: NeighborAddress(); ~NeighborAddress(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf afi; //type: BgpAfi ydk::YLeaf ipv4_address; //type: string ydk::YLeaf ipv4_mcast_address; //type: string ydk::YLeaf ipv4_label_address; //type: string ydk::YLeaf ipv4_tunnel_address; //type: string ydk::YLeaf ipv4_mdt_address; //type: string ydk::YLeaf ipv4vpn_address; //type: string ydk::YLeaf ipv4vpna_mcastddress; //type: string ydk::YLeaf ipv6_address; //type: string ydk::YLeaf ipv6_mcast_address; //type: string ydk::YLeaf ipv6_label_address; //type: string ydk::YLeaf ipv6vpn_address; //type: string ydk::YLeaf ipv6vpn_mcast_address; //type: string ydk::YLeaf rt_constraint_address; //type: string ydk::YLeaf ipv6mvpn_address; //type: string ydk::YLeaf ipv4mvpn_address; //type: string ydk::YLeaf l2vpn_evpn_address; //type: string ydk::YLeaf ls_ls_address; //type: string ydk::YLeaf ipv4_flowspec_address; //type: string ydk::YLeaf ipv6_flowspec_address; //type: string ydk::YLeaf ipv4vpn_flowspec_address; //type: string ydk::YLeaf ipv6vpn_flowspec_address; //type: string class L2vpnVplsAddress; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationAllowInvalidInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnVplsAddress class L2vpnMspwAddress; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationAllowInvalidInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnMspwAddress class Ipv4SrPolicyAddress; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationAllowInvalidInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv4SrPolicyAddress class Ipv6SrPolicyAddress; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationAllowInvalidInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv6SrPolicyAddress std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationAllowInvalidInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnVplsAddress> l2vpn_vpls_address; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationAllowInvalidInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnMspwAddress> l2vpn_mspw_address; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationAllowInvalidInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv4SrPolicyAddress> ipv4_sr_policy_address; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationAllowInvalidInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv6SrPolicyAddress> ipv6_sr_policy_address; }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationAllowInvalidInfo::InheritanceChain::BgpConfigEntid::NeighborAddress class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationAllowInvalidInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnVplsAddress : public ydk::Entity { public: L2vpnVplsAddress(); ~L2vpnVplsAddress(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf l2vpn_address; //type: string }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationAllowInvalidInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnVplsAddress class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationAllowInvalidInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnMspwAddress : public ydk::Entity { public: L2vpnMspwAddress(); ~L2vpnMspwAddress(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf l2vpn_address; //type: string }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationAllowInvalidInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnMspwAddress class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationAllowInvalidInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv4SrPolicyAddress : public ydk::Entity { public: Ipv4SrPolicyAddress(); ~Ipv4SrPolicyAddress(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf ipv4_srpolicy_address; //type: string }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationAllowInvalidInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv4SrPolicyAddress class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationAllowInvalidInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv6SrPolicyAddress : public ydk::Entity { public: Ipv6SrPolicyAddress(); ~Ipv6SrPolicyAddress(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf ipv6_srpolicy_address; //type: string }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationAllowInvalidInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv6SrPolicyAddress class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationSignalIbgpInfo : public ydk::Entity { public: PrefixValidationSignalIbgpInfo(); ~PrefixValidationSignalIbgpInfo(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf is_item_configured; //type: boolean class InheritanceChain; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationSignalIbgpInfo::InheritanceChain std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationSignalIbgpInfo::InheritanceChain> inheritance_chain; }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationSignalIbgpInfo class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationSignalIbgpInfo::InheritanceChain : public ydk::Entity { public: InheritanceChain(); ~InheritanceChain(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; class BgpConfigEntid; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationSignalIbgpInfo::InheritanceChain::BgpConfigEntid ydk::YList bgp_config_entid; }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationSignalIbgpInfo::InheritanceChain class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationSignalIbgpInfo::InheritanceChain::BgpConfigEntid : public ydk::Entity { public: BgpConfigEntid(); ~BgpConfigEntid(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf address_family_identifier; //type: uint8 ydk::YLeaf configuration_type; //type: BgpEntities ydk::YLeaf group_name; //type: string class NeighborAddress; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationSignalIbgpInfo::InheritanceChain::BgpConfigEntid::NeighborAddress std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationSignalIbgpInfo::InheritanceChain::BgpConfigEntid::NeighborAddress> neighbor_address; }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationSignalIbgpInfo::InheritanceChain::BgpConfigEntid class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationSignalIbgpInfo::InheritanceChain::BgpConfigEntid::NeighborAddress : public ydk::Entity { public: NeighborAddress(); ~NeighborAddress(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf afi; //type: BgpAfi ydk::YLeaf ipv4_address; //type: string ydk::YLeaf ipv4_mcast_address; //type: string ydk::YLeaf ipv4_label_address; //type: string ydk::YLeaf ipv4_tunnel_address; //type: string ydk::YLeaf ipv4_mdt_address; //type: string ydk::YLeaf ipv4vpn_address; //type: string ydk::YLeaf ipv4vpna_mcastddress; //type: string ydk::YLeaf ipv6_address; //type: string ydk::YLeaf ipv6_mcast_address; //type: string ydk::YLeaf ipv6_label_address; //type: string ydk::YLeaf ipv6vpn_address; //type: string ydk::YLeaf ipv6vpn_mcast_address; //type: string ydk::YLeaf rt_constraint_address; //type: string ydk::YLeaf ipv6mvpn_address; //type: string ydk::YLeaf ipv4mvpn_address; //type: string ydk::YLeaf l2vpn_evpn_address; //type: string ydk::YLeaf ls_ls_address; //type: string ydk::YLeaf ipv4_flowspec_address; //type: string ydk::YLeaf ipv6_flowspec_address; //type: string ydk::YLeaf ipv4vpn_flowspec_address; //type: string ydk::YLeaf ipv6vpn_flowspec_address; //type: string class L2vpnVplsAddress; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationSignalIbgpInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnVplsAddress class L2vpnMspwAddress; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationSignalIbgpInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnMspwAddress class Ipv4SrPolicyAddress; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationSignalIbgpInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv4SrPolicyAddress class Ipv6SrPolicyAddress; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationSignalIbgpInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv6SrPolicyAddress std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationSignalIbgpInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnVplsAddress> l2vpn_vpls_address; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationSignalIbgpInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnMspwAddress> l2vpn_mspw_address; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationSignalIbgpInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv4SrPolicyAddress> ipv4_sr_policy_address; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationSignalIbgpInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv6SrPolicyAddress> ipv6_sr_policy_address; }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationSignalIbgpInfo::InheritanceChain::BgpConfigEntid::NeighborAddress class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationSignalIbgpInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnVplsAddress : public ydk::Entity { public: L2vpnVplsAddress(); ~L2vpnVplsAddress(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf l2vpn_address; //type: string }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationSignalIbgpInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnVplsAddress class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationSignalIbgpInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnMspwAddress : public ydk::Entity { public: L2vpnMspwAddress(); ~L2vpnMspwAddress(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf l2vpn_address; //type: string }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationSignalIbgpInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnMspwAddress class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationSignalIbgpInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv4SrPolicyAddress : public ydk::Entity { public: Ipv4SrPolicyAddress(); ~Ipv4SrPolicyAddress(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf ipv4_srpolicy_address; //type: string }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationSignalIbgpInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv4SrPolicyAddress class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationSignalIbgpInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv6SrPolicyAddress : public ydk::Entity { public: Ipv6SrPolicyAddress(); ~Ipv6SrPolicyAddress(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf ipv6_srpolicy_address; //type: string }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::PrefixValidationSignalIbgpInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv6SrPolicyAddress class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterExistsInfo : public ydk::Entity { public: NeighborUpdateFilterExistsInfo(); ~NeighborUpdateFilterExistsInfo(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf is_item_configured; //type: boolean class InheritanceChain; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterExistsInfo::InheritanceChain std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterExistsInfo::InheritanceChain> inheritance_chain; }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterExistsInfo class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterExistsInfo::InheritanceChain : public ydk::Entity { public: InheritanceChain(); ~InheritanceChain(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; class BgpConfigEntid; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterExistsInfo::InheritanceChain::BgpConfigEntid ydk::YList bgp_config_entid; }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterExistsInfo::InheritanceChain class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterExistsInfo::InheritanceChain::BgpConfigEntid : public ydk::Entity { public: BgpConfigEntid(); ~BgpConfigEntid(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf address_family_identifier; //type: uint8 ydk::YLeaf configuration_type; //type: BgpEntities ydk::YLeaf group_name; //type: string class NeighborAddress; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterExistsInfo::InheritanceChain::BgpConfigEntid::NeighborAddress std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterExistsInfo::InheritanceChain::BgpConfigEntid::NeighborAddress> neighbor_address; }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterExistsInfo::InheritanceChain::BgpConfigEntid class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterExistsInfo::InheritanceChain::BgpConfigEntid::NeighborAddress : public ydk::Entity { public: NeighborAddress(); ~NeighborAddress(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf afi; //type: BgpAfi ydk::YLeaf ipv4_address; //type: string ydk::YLeaf ipv4_mcast_address; //type: string ydk::YLeaf ipv4_label_address; //type: string ydk::YLeaf ipv4_tunnel_address; //type: string ydk::YLeaf ipv4_mdt_address; //type: string ydk::YLeaf ipv4vpn_address; //type: string ydk::YLeaf ipv4vpna_mcastddress; //type: string ydk::YLeaf ipv6_address; //type: string ydk::YLeaf ipv6_mcast_address; //type: string ydk::YLeaf ipv6_label_address; //type: string ydk::YLeaf ipv6vpn_address; //type: string ydk::YLeaf ipv6vpn_mcast_address; //type: string ydk::YLeaf rt_constraint_address; //type: string ydk::YLeaf ipv6mvpn_address; //type: string ydk::YLeaf ipv4mvpn_address; //type: string ydk::YLeaf l2vpn_evpn_address; //type: string ydk::YLeaf ls_ls_address; //type: string ydk::YLeaf ipv4_flowspec_address; //type: string ydk::YLeaf ipv6_flowspec_address; //type: string ydk::YLeaf ipv4vpn_flowspec_address; //type: string ydk::YLeaf ipv6vpn_flowspec_address; //type: string class L2vpnVplsAddress; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterExistsInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnVplsAddress class L2vpnMspwAddress; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterExistsInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnMspwAddress class Ipv4SrPolicyAddress; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterExistsInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv4SrPolicyAddress class Ipv6SrPolicyAddress; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterExistsInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv6SrPolicyAddress std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterExistsInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnVplsAddress> l2vpn_vpls_address; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterExistsInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnMspwAddress> l2vpn_mspw_address; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterExistsInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv4SrPolicyAddress> ipv4_sr_policy_address; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterExistsInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv6SrPolicyAddress> ipv6_sr_policy_address; }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterExistsInfo::InheritanceChain::BgpConfigEntid::NeighborAddress class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterExistsInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnVplsAddress : public ydk::Entity { public: L2vpnVplsAddress(); ~L2vpnVplsAddress(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf l2vpn_address; //type: string }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterExistsInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnVplsAddress class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterExistsInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnMspwAddress : public ydk::Entity { public: L2vpnMspwAddress(); ~L2vpnMspwAddress(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf l2vpn_address; //type: string }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterExistsInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnMspwAddress class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterExistsInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv4SrPolicyAddress : public ydk::Entity { public: Ipv4SrPolicyAddress(); ~Ipv4SrPolicyAddress(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf ipv4_srpolicy_address; //type: string }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterExistsInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv4SrPolicyAddress class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterExistsInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv6SrPolicyAddress : public ydk::Entity { public: Ipv6SrPolicyAddress(); ~Ipv6SrPolicyAddress(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf ipv6_srpolicy_address; //type: string }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterExistsInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv6SrPolicyAddress class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterMessageBufferCountInfo : public ydk::Entity { public: NeighborUpdateFilterMessageBufferCountInfo(); ~NeighborUpdateFilterMessageBufferCountInfo(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf is_item_configured; //type: boolean class InheritanceChain; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterMessageBufferCountInfo::InheritanceChain std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterMessageBufferCountInfo::InheritanceChain> inheritance_chain; }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterMessageBufferCountInfo class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterMessageBufferCountInfo::InheritanceChain : public ydk::Entity { public: InheritanceChain(); ~InheritanceChain(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; class BgpConfigEntid; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterMessageBufferCountInfo::InheritanceChain::BgpConfigEntid ydk::YList bgp_config_entid; }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterMessageBufferCountInfo::InheritanceChain class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterMessageBufferCountInfo::InheritanceChain::BgpConfigEntid : public ydk::Entity { public: BgpConfigEntid(); ~BgpConfigEntid(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf address_family_identifier; //type: uint8 ydk::YLeaf configuration_type; //type: BgpEntities ydk::YLeaf group_name; //type: string class NeighborAddress; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterMessageBufferCountInfo::InheritanceChain::BgpConfigEntid::NeighborAddress std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterMessageBufferCountInfo::InheritanceChain::BgpConfigEntid::NeighborAddress> neighbor_address; }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterMessageBufferCountInfo::InheritanceChain::BgpConfigEntid class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterMessageBufferCountInfo::InheritanceChain::BgpConfigEntid::NeighborAddress : public ydk::Entity { public: NeighborAddress(); ~NeighborAddress(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf afi; //type: BgpAfi ydk::YLeaf ipv4_address; //type: string ydk::YLeaf ipv4_mcast_address; //type: string ydk::YLeaf ipv4_label_address; //type: string ydk::YLeaf ipv4_tunnel_address; //type: string ydk::YLeaf ipv4_mdt_address; //type: string ydk::YLeaf ipv4vpn_address; //type: string ydk::YLeaf ipv4vpna_mcastddress; //type: string ydk::YLeaf ipv6_address; //type: string ydk::YLeaf ipv6_mcast_address; //type: string ydk::YLeaf ipv6_label_address; //type: string ydk::YLeaf ipv6vpn_address; //type: string ydk::YLeaf ipv6vpn_mcast_address; //type: string ydk::YLeaf rt_constraint_address; //type: string ydk::YLeaf ipv6mvpn_address; //type: string ydk::YLeaf ipv4mvpn_address; //type: string ydk::YLeaf l2vpn_evpn_address; //type: string ydk::YLeaf ls_ls_address; //type: string ydk::YLeaf ipv4_flowspec_address; //type: string ydk::YLeaf ipv6_flowspec_address; //type: string ydk::YLeaf ipv4vpn_flowspec_address; //type: string ydk::YLeaf ipv6vpn_flowspec_address; //type: string class L2vpnVplsAddress; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterMessageBufferCountInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnVplsAddress class L2vpnMspwAddress; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterMessageBufferCountInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnMspwAddress class Ipv4SrPolicyAddress; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterMessageBufferCountInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv4SrPolicyAddress class Ipv6SrPolicyAddress; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterMessageBufferCountInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv6SrPolicyAddress std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterMessageBufferCountInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnVplsAddress> l2vpn_vpls_address; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterMessageBufferCountInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnMspwAddress> l2vpn_mspw_address; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterMessageBufferCountInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv4SrPolicyAddress> ipv4_sr_policy_address; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterMessageBufferCountInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv6SrPolicyAddress> ipv6_sr_policy_address; }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterMessageBufferCountInfo::InheritanceChain::BgpConfigEntid::NeighborAddress class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterMessageBufferCountInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnVplsAddress : public ydk::Entity { public: L2vpnVplsAddress(); ~L2vpnVplsAddress(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf l2vpn_address; //type: string }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterMessageBufferCountInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnVplsAddress class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterMessageBufferCountInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnMspwAddress : public ydk::Entity { public: L2vpnMspwAddress(); ~L2vpnMspwAddress(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf l2vpn_address; //type: string }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterMessageBufferCountInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnMspwAddress class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterMessageBufferCountInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv4SrPolicyAddress : public ydk::Entity { public: Ipv4SrPolicyAddress(); ~Ipv4SrPolicyAddress(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf ipv4_srpolicy_address; //type: string }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterMessageBufferCountInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv4SrPolicyAddress class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterMessageBufferCountInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv6SrPolicyAddress : public ydk::Entity { public: Ipv6SrPolicyAddress(); ~Ipv6SrPolicyAddress(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf ipv6_srpolicy_address; //type: string }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterMessageBufferCountInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv6SrPolicyAddress class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterSyslogDisableInfo : public ydk::Entity { public: NeighborUpdateFilterSyslogDisableInfo(); ~NeighborUpdateFilterSyslogDisableInfo(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf is_item_configured; //type: boolean class InheritanceChain; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterSyslogDisableInfo::InheritanceChain std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterSyslogDisableInfo::InheritanceChain> inheritance_chain; }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterSyslogDisableInfo class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterSyslogDisableInfo::InheritanceChain : public ydk::Entity { public: InheritanceChain(); ~InheritanceChain(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; class BgpConfigEntid; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterSyslogDisableInfo::InheritanceChain::BgpConfigEntid ydk::YList bgp_config_entid; }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterSyslogDisableInfo::InheritanceChain class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterSyslogDisableInfo::InheritanceChain::BgpConfigEntid : public ydk::Entity { public: BgpConfigEntid(); ~BgpConfigEntid(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf address_family_identifier; //type: uint8 ydk::YLeaf configuration_type; //type: BgpEntities ydk::YLeaf group_name; //type: string class NeighborAddress; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterSyslogDisableInfo::InheritanceChain::BgpConfigEntid::NeighborAddress std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterSyslogDisableInfo::InheritanceChain::BgpConfigEntid::NeighborAddress> neighbor_address; }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterSyslogDisableInfo::InheritanceChain::BgpConfigEntid class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterSyslogDisableInfo::InheritanceChain::BgpConfigEntid::NeighborAddress : public ydk::Entity { public: NeighborAddress(); ~NeighborAddress(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf afi; //type: BgpAfi ydk::YLeaf ipv4_address; //type: string ydk::YLeaf ipv4_mcast_address; //type: string ydk::YLeaf ipv4_label_address; //type: string ydk::YLeaf ipv4_tunnel_address; //type: string ydk::YLeaf ipv4_mdt_address; //type: string ydk::YLeaf ipv4vpn_address; //type: string ydk::YLeaf ipv4vpna_mcastddress; //type: string ydk::YLeaf ipv6_address; //type: string ydk::YLeaf ipv6_mcast_address; //type: string ydk::YLeaf ipv6_label_address; //type: string ydk::YLeaf ipv6vpn_address; //type: string ydk::YLeaf ipv6vpn_mcast_address; //type: string ydk::YLeaf rt_constraint_address; //type: string ydk::YLeaf ipv6mvpn_address; //type: string ydk::YLeaf ipv4mvpn_address; //type: string ydk::YLeaf l2vpn_evpn_address; //type: string ydk::YLeaf ls_ls_address; //type: string ydk::YLeaf ipv4_flowspec_address; //type: string ydk::YLeaf ipv6_flowspec_address; //type: string ydk::YLeaf ipv4vpn_flowspec_address; //type: string ydk::YLeaf ipv6vpn_flowspec_address; //type: string class L2vpnVplsAddress; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterSyslogDisableInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnVplsAddress class L2vpnMspwAddress; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterSyslogDisableInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnMspwAddress class Ipv4SrPolicyAddress; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterSyslogDisableInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv4SrPolicyAddress class Ipv6SrPolicyAddress; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterSyslogDisableInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv6SrPolicyAddress std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterSyslogDisableInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnVplsAddress> l2vpn_vpls_address; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterSyslogDisableInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnMspwAddress> l2vpn_mspw_address; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterSyslogDisableInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv4SrPolicyAddress> ipv4_sr_policy_address; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterSyslogDisableInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv6SrPolicyAddress> ipv6_sr_policy_address; }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterSyslogDisableInfo::InheritanceChain::BgpConfigEntid::NeighborAddress class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterSyslogDisableInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnVplsAddress : public ydk::Entity { public: L2vpnVplsAddress(); ~L2vpnVplsAddress(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf l2vpn_address; //type: string }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterSyslogDisableInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnVplsAddress class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterSyslogDisableInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnMspwAddress : public ydk::Entity { public: L2vpnMspwAddress(); ~L2vpnMspwAddress(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf l2vpn_address; //type: string }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterSyslogDisableInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnMspwAddress class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterSyslogDisableInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv4SrPolicyAddress : public ydk::Entity { public: Ipv4SrPolicyAddress(); ~Ipv4SrPolicyAddress(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf ipv4_srpolicy_address; //type: string }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterSyslogDisableInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv4SrPolicyAddress class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterSyslogDisableInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv6SrPolicyAddress : public ydk::Entity { public: Ipv6SrPolicyAddress(); ~Ipv6SrPolicyAddress(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf ipv6_srpolicy_address; //type: string }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterSyslogDisableInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv6SrPolicyAddress class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterAttributeInfo : public ydk::Entity { public: NeighborUpdateFilterAttributeInfo(); ~NeighborUpdateFilterAttributeInfo(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf is_item_configured; //type: boolean class InheritanceChain; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterAttributeInfo::InheritanceChain std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterAttributeInfo::InheritanceChain> inheritance_chain; }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterAttributeInfo class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterAttributeInfo::InheritanceChain : public ydk::Entity { public: InheritanceChain(); ~InheritanceChain(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; class BgpConfigEntid; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterAttributeInfo::InheritanceChain::BgpConfigEntid ydk::YList bgp_config_entid; }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterAttributeInfo::InheritanceChain class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterAttributeInfo::InheritanceChain::BgpConfigEntid : public ydk::Entity { public: BgpConfigEntid(); ~BgpConfigEntid(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf address_family_identifier; //type: uint8 ydk::YLeaf configuration_type; //type: BgpEntities ydk::YLeaf group_name; //type: string class NeighborAddress; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterAttributeInfo::InheritanceChain::BgpConfigEntid::NeighborAddress std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterAttributeInfo::InheritanceChain::BgpConfigEntid::NeighborAddress> neighbor_address; }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterAttributeInfo::InheritanceChain::BgpConfigEntid class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterAttributeInfo::InheritanceChain::BgpConfigEntid::NeighborAddress : public ydk::Entity { public: NeighborAddress(); ~NeighborAddress(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf afi; //type: BgpAfi ydk::YLeaf ipv4_address; //type: string ydk::YLeaf ipv4_mcast_address; //type: string ydk::YLeaf ipv4_label_address; //type: string ydk::YLeaf ipv4_tunnel_address; //type: string ydk::YLeaf ipv4_mdt_address; //type: string ydk::YLeaf ipv4vpn_address; //type: string ydk::YLeaf ipv4vpna_mcastddress; //type: string ydk::YLeaf ipv6_address; //type: string ydk::YLeaf ipv6_mcast_address; //type: string ydk::YLeaf ipv6_label_address; //type: string ydk::YLeaf ipv6vpn_address; //type: string ydk::YLeaf ipv6vpn_mcast_address; //type: string ydk::YLeaf rt_constraint_address; //type: string ydk::YLeaf ipv6mvpn_address; //type: string ydk::YLeaf ipv4mvpn_address; //type: string ydk::YLeaf l2vpn_evpn_address; //type: string ydk::YLeaf ls_ls_address; //type: string ydk::YLeaf ipv4_flowspec_address; //type: string ydk::YLeaf ipv6_flowspec_address; //type: string ydk::YLeaf ipv4vpn_flowspec_address; //type: string ydk::YLeaf ipv6vpn_flowspec_address; //type: string class L2vpnVplsAddress; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterAttributeInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnVplsAddress class L2vpnMspwAddress; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterAttributeInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnMspwAddress class Ipv4SrPolicyAddress; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterAttributeInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv4SrPolicyAddress class Ipv6SrPolicyAddress; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterAttributeInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv6SrPolicyAddress std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterAttributeInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnVplsAddress> l2vpn_vpls_address; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterAttributeInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnMspwAddress> l2vpn_mspw_address; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterAttributeInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv4SrPolicyAddress> ipv4_sr_policy_address; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterAttributeInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv6SrPolicyAddress> ipv6_sr_policy_address; }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterAttributeInfo::InheritanceChain::BgpConfigEntid::NeighborAddress class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterAttributeInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnVplsAddress : public ydk::Entity { public: L2vpnVplsAddress(); ~L2vpnVplsAddress(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf l2vpn_address; //type: string }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterAttributeInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnVplsAddress class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterAttributeInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnMspwAddress : public ydk::Entity { public: L2vpnMspwAddress(); ~L2vpnMspwAddress(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf l2vpn_address; //type: string }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterAttributeInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnMspwAddress class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterAttributeInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv4SrPolicyAddress : public ydk::Entity { public: Ipv4SrPolicyAddress(); ~Ipv4SrPolicyAddress(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf ipv4_srpolicy_address; //type: string }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterAttributeInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv4SrPolicyAddress class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterAttributeInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv6SrPolicyAddress : public ydk::Entity { public: Ipv6SrPolicyAddress(); ~Ipv6SrPolicyAddress(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf ipv6_srpolicy_address; //type: string }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborUpdateFilterAttributeInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv6SrPolicyAddress class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownInfo : public ydk::Entity { public: GracefulShutdownInfo(); ~GracefulShutdownInfo(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf is_item_configured; //type: boolean class InheritanceChain; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownInfo::InheritanceChain std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownInfo::InheritanceChain> inheritance_chain; }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownInfo class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownInfo::InheritanceChain : public ydk::Entity { public: InheritanceChain(); ~InheritanceChain(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; class BgpConfigEntid; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownInfo::InheritanceChain::BgpConfigEntid ydk::YList bgp_config_entid; }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownInfo::InheritanceChain class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownInfo::InheritanceChain::BgpConfigEntid : public ydk::Entity { public: BgpConfigEntid(); ~BgpConfigEntid(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf address_family_identifier; //type: uint8 ydk::YLeaf configuration_type; //type: BgpEntities ydk::YLeaf group_name; //type: string class NeighborAddress; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownInfo::InheritanceChain::BgpConfigEntid::NeighborAddress std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownInfo::InheritanceChain::BgpConfigEntid::NeighborAddress> neighbor_address; }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownInfo::InheritanceChain::BgpConfigEntid class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownInfo::InheritanceChain::BgpConfigEntid::NeighborAddress : public ydk::Entity { public: NeighborAddress(); ~NeighborAddress(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf afi; //type: BgpAfi ydk::YLeaf ipv4_address; //type: string ydk::YLeaf ipv4_mcast_address; //type: string ydk::YLeaf ipv4_label_address; //type: string ydk::YLeaf ipv4_tunnel_address; //type: string ydk::YLeaf ipv4_mdt_address; //type: string ydk::YLeaf ipv4vpn_address; //type: string ydk::YLeaf ipv4vpna_mcastddress; //type: string ydk::YLeaf ipv6_address; //type: string ydk::YLeaf ipv6_mcast_address; //type: string ydk::YLeaf ipv6_label_address; //type: string ydk::YLeaf ipv6vpn_address; //type: string ydk::YLeaf ipv6vpn_mcast_address; //type: string ydk::YLeaf rt_constraint_address; //type: string ydk::YLeaf ipv6mvpn_address; //type: string ydk::YLeaf ipv4mvpn_address; //type: string ydk::YLeaf l2vpn_evpn_address; //type: string ydk::YLeaf ls_ls_address; //type: string ydk::YLeaf ipv4_flowspec_address; //type: string ydk::YLeaf ipv6_flowspec_address; //type: string ydk::YLeaf ipv4vpn_flowspec_address; //type: string ydk::YLeaf ipv6vpn_flowspec_address; //type: string class L2vpnVplsAddress; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnVplsAddress class L2vpnMspwAddress; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnMspwAddress class Ipv4SrPolicyAddress; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv4SrPolicyAddress class Ipv6SrPolicyAddress; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv6SrPolicyAddress std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnVplsAddress> l2vpn_vpls_address; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnMspwAddress> l2vpn_mspw_address; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv4SrPolicyAddress> ipv4_sr_policy_address; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv6SrPolicyAddress> ipv6_sr_policy_address; }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownInfo::InheritanceChain::BgpConfigEntid::NeighborAddress class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnVplsAddress : public ydk::Entity { public: L2vpnVplsAddress(); ~L2vpnVplsAddress(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf l2vpn_address; //type: string }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnVplsAddress class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnMspwAddress : public ydk::Entity { public: L2vpnMspwAddress(); ~L2vpnMspwAddress(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf l2vpn_address; //type: string }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnMspwAddress class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv4SrPolicyAddress : public ydk::Entity { public: Ipv4SrPolicyAddress(); ~Ipv4SrPolicyAddress(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf ipv4_srpolicy_address; //type: string }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv4SrPolicyAddress class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv6SrPolicyAddress : public ydk::Entity { public: Ipv6SrPolicyAddress(); ~Ipv6SrPolicyAddress(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf ipv6_srpolicy_address; //type: string }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv6SrPolicyAddress class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownLocPrefInfo : public ydk::Entity { public: GracefulShutdownLocPrefInfo(); ~GracefulShutdownLocPrefInfo(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf is_item_configured; //type: boolean class InheritanceChain; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownLocPrefInfo::InheritanceChain std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownLocPrefInfo::InheritanceChain> inheritance_chain; }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownLocPrefInfo class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownLocPrefInfo::InheritanceChain : public ydk::Entity { public: InheritanceChain(); ~InheritanceChain(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; class BgpConfigEntid; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownLocPrefInfo::InheritanceChain::BgpConfigEntid ydk::YList bgp_config_entid; }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownLocPrefInfo::InheritanceChain class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownLocPrefInfo::InheritanceChain::BgpConfigEntid : public ydk::Entity { public: BgpConfigEntid(); ~BgpConfigEntid(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf address_family_identifier; //type: uint8 ydk::YLeaf configuration_type; //type: BgpEntities ydk::YLeaf group_name; //type: string class NeighborAddress; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownLocPrefInfo::InheritanceChain::BgpConfigEntid::NeighborAddress std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownLocPrefInfo::InheritanceChain::BgpConfigEntid::NeighborAddress> neighbor_address; }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownLocPrefInfo::InheritanceChain::BgpConfigEntid class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownLocPrefInfo::InheritanceChain::BgpConfigEntid::NeighborAddress : public ydk::Entity { public: NeighborAddress(); ~NeighborAddress(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf afi; //type: BgpAfi ydk::YLeaf ipv4_address; //type: string ydk::YLeaf ipv4_mcast_address; //type: string ydk::YLeaf ipv4_label_address; //type: string ydk::YLeaf ipv4_tunnel_address; //type: string ydk::YLeaf ipv4_mdt_address; //type: string ydk::YLeaf ipv4vpn_address; //type: string ydk::YLeaf ipv4vpna_mcastddress; //type: string ydk::YLeaf ipv6_address; //type: string ydk::YLeaf ipv6_mcast_address; //type: string ydk::YLeaf ipv6_label_address; //type: string ydk::YLeaf ipv6vpn_address; //type: string ydk::YLeaf ipv6vpn_mcast_address; //type: string ydk::YLeaf rt_constraint_address; //type: string ydk::YLeaf ipv6mvpn_address; //type: string ydk::YLeaf ipv4mvpn_address; //type: string ydk::YLeaf l2vpn_evpn_address; //type: string ydk::YLeaf ls_ls_address; //type: string ydk::YLeaf ipv4_flowspec_address; //type: string ydk::YLeaf ipv6_flowspec_address; //type: string ydk::YLeaf ipv4vpn_flowspec_address; //type: string ydk::YLeaf ipv6vpn_flowspec_address; //type: string class L2vpnVplsAddress; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownLocPrefInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnVplsAddress class L2vpnMspwAddress; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownLocPrefInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnMspwAddress class Ipv4SrPolicyAddress; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownLocPrefInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv4SrPolicyAddress class Ipv6SrPolicyAddress; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownLocPrefInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv6SrPolicyAddress std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownLocPrefInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnVplsAddress> l2vpn_vpls_address; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownLocPrefInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnMspwAddress> l2vpn_mspw_address; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownLocPrefInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv4SrPolicyAddress> ipv4_sr_policy_address; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownLocPrefInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv6SrPolicyAddress> ipv6_sr_policy_address; }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownLocPrefInfo::InheritanceChain::BgpConfigEntid::NeighborAddress class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownLocPrefInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnVplsAddress : public ydk::Entity { public: L2vpnVplsAddress(); ~L2vpnVplsAddress(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf l2vpn_address; //type: string }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownLocPrefInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnVplsAddress class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownLocPrefInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnMspwAddress : public ydk::Entity { public: L2vpnMspwAddress(); ~L2vpnMspwAddress(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf l2vpn_address; //type: string }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownLocPrefInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnMspwAddress class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownLocPrefInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv4SrPolicyAddress : public ydk::Entity { public: Ipv4SrPolicyAddress(); ~Ipv4SrPolicyAddress(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf ipv4_srpolicy_address; //type: string }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownLocPrefInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv4SrPolicyAddress class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownLocPrefInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv6SrPolicyAddress : public ydk::Entity { public: Ipv6SrPolicyAddress(); ~Ipv6SrPolicyAddress(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf ipv6_srpolicy_address; //type: string }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownLocPrefInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv6SrPolicyAddress class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownAsPrependsInfo : public ydk::Entity { public: GracefulShutdownAsPrependsInfo(); ~GracefulShutdownAsPrependsInfo(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf is_item_configured; //type: boolean class InheritanceChain; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownAsPrependsInfo::InheritanceChain std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownAsPrependsInfo::InheritanceChain> inheritance_chain; }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownAsPrependsInfo class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownAsPrependsInfo::InheritanceChain : public ydk::Entity { public: InheritanceChain(); ~InheritanceChain(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; class BgpConfigEntid; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownAsPrependsInfo::InheritanceChain::BgpConfigEntid ydk::YList bgp_config_entid; }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownAsPrependsInfo::InheritanceChain class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownAsPrependsInfo::InheritanceChain::BgpConfigEntid : public ydk::Entity { public: BgpConfigEntid(); ~BgpConfigEntid(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf address_family_identifier; //type: uint8 ydk::YLeaf configuration_type; //type: BgpEntities ydk::YLeaf group_name; //type: string class NeighborAddress; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownAsPrependsInfo::InheritanceChain::BgpConfigEntid::NeighborAddress std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownAsPrependsInfo::InheritanceChain::BgpConfigEntid::NeighborAddress> neighbor_address; }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownAsPrependsInfo::InheritanceChain::BgpConfigEntid class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownAsPrependsInfo::InheritanceChain::BgpConfigEntid::NeighborAddress : public ydk::Entity { public: NeighborAddress(); ~NeighborAddress(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf afi; //type: BgpAfi ydk::YLeaf ipv4_address; //type: string ydk::YLeaf ipv4_mcast_address; //type: string ydk::YLeaf ipv4_label_address; //type: string ydk::YLeaf ipv4_tunnel_address; //type: string ydk::YLeaf ipv4_mdt_address; //type: string ydk::YLeaf ipv4vpn_address; //type: string ydk::YLeaf ipv4vpna_mcastddress; //type: string ydk::YLeaf ipv6_address; //type: string ydk::YLeaf ipv6_mcast_address; //type: string ydk::YLeaf ipv6_label_address; //type: string ydk::YLeaf ipv6vpn_address; //type: string ydk::YLeaf ipv6vpn_mcast_address; //type: string ydk::YLeaf rt_constraint_address; //type: string ydk::YLeaf ipv6mvpn_address; //type: string ydk::YLeaf ipv4mvpn_address; //type: string ydk::YLeaf l2vpn_evpn_address; //type: string ydk::YLeaf ls_ls_address; //type: string ydk::YLeaf ipv4_flowspec_address; //type: string ydk::YLeaf ipv6_flowspec_address; //type: string ydk::YLeaf ipv4vpn_flowspec_address; //type: string ydk::YLeaf ipv6vpn_flowspec_address; //type: string class L2vpnVplsAddress; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownAsPrependsInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnVplsAddress class L2vpnMspwAddress; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownAsPrependsInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnMspwAddress class Ipv4SrPolicyAddress; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownAsPrependsInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv4SrPolicyAddress class Ipv6SrPolicyAddress; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownAsPrependsInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv6SrPolicyAddress std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownAsPrependsInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnVplsAddress> l2vpn_vpls_address; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownAsPrependsInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnMspwAddress> l2vpn_mspw_address; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownAsPrependsInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv4SrPolicyAddress> ipv4_sr_policy_address; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownAsPrependsInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv6SrPolicyAddress> ipv6_sr_policy_address; }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownAsPrependsInfo::InheritanceChain::BgpConfigEntid::NeighborAddress class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownAsPrependsInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnVplsAddress : public ydk::Entity { public: L2vpnVplsAddress(); ~L2vpnVplsAddress(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf l2vpn_address; //type: string }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownAsPrependsInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnVplsAddress class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownAsPrependsInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnMspwAddress : public ydk::Entity { public: L2vpnMspwAddress(); ~L2vpnMspwAddress(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf l2vpn_address; //type: string }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownAsPrependsInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnMspwAddress class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownAsPrependsInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv4SrPolicyAddress : public ydk::Entity { public: Ipv4SrPolicyAddress(); ~Ipv4SrPolicyAddress(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf ipv4_srpolicy_address; //type: string }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownAsPrependsInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv4SrPolicyAddress class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownAsPrependsInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv6SrPolicyAddress : public ydk::Entity { public: Ipv6SrPolicyAddress(); ~Ipv6SrPolicyAddress(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf ipv6_srpolicy_address; //type: string }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownAsPrependsInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv6SrPolicyAddress class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownActivateInfo : public ydk::Entity { public: GracefulShutdownActivateInfo(); ~GracefulShutdownActivateInfo(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf is_item_configured; //type: boolean class InheritanceChain; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownActivateInfo::InheritanceChain std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownActivateInfo::InheritanceChain> inheritance_chain; }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownActivateInfo class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownActivateInfo::InheritanceChain : public ydk::Entity { public: InheritanceChain(); ~InheritanceChain(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; class BgpConfigEntid; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownActivateInfo::InheritanceChain::BgpConfigEntid ydk::YList bgp_config_entid; }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownActivateInfo::InheritanceChain class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownActivateInfo::InheritanceChain::BgpConfigEntid : public ydk::Entity { public: BgpConfigEntid(); ~BgpConfigEntid(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf address_family_identifier; //type: uint8 ydk::YLeaf configuration_type; //type: BgpEntities ydk::YLeaf group_name; //type: string class NeighborAddress; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownActivateInfo::InheritanceChain::BgpConfigEntid::NeighborAddress std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownActivateInfo::InheritanceChain::BgpConfigEntid::NeighborAddress> neighbor_address; }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownActivateInfo::InheritanceChain::BgpConfigEntid class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownActivateInfo::InheritanceChain::BgpConfigEntid::NeighborAddress : public ydk::Entity { public: NeighborAddress(); ~NeighborAddress(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf afi; //type: BgpAfi ydk::YLeaf ipv4_address; //type: string ydk::YLeaf ipv4_mcast_address; //type: string ydk::YLeaf ipv4_label_address; //type: string ydk::YLeaf ipv4_tunnel_address; //type: string ydk::YLeaf ipv4_mdt_address; //type: string ydk::YLeaf ipv4vpn_address; //type: string ydk::YLeaf ipv4vpna_mcastddress; //type: string ydk::YLeaf ipv6_address; //type: string ydk::YLeaf ipv6_mcast_address; //type: string ydk::YLeaf ipv6_label_address; //type: string ydk::YLeaf ipv6vpn_address; //type: string ydk::YLeaf ipv6vpn_mcast_address; //type: string ydk::YLeaf rt_constraint_address; //type: string ydk::YLeaf ipv6mvpn_address; //type: string ydk::YLeaf ipv4mvpn_address; //type: string ydk::YLeaf l2vpn_evpn_address; //type: string ydk::YLeaf ls_ls_address; //type: string ydk::YLeaf ipv4_flowspec_address; //type: string ydk::YLeaf ipv6_flowspec_address; //type: string ydk::YLeaf ipv4vpn_flowspec_address; //type: string ydk::YLeaf ipv6vpn_flowspec_address; //type: string class L2vpnVplsAddress; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownActivateInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnVplsAddress class L2vpnMspwAddress; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownActivateInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnMspwAddress class Ipv4SrPolicyAddress; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownActivateInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv4SrPolicyAddress class Ipv6SrPolicyAddress; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownActivateInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv6SrPolicyAddress std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownActivateInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnVplsAddress> l2vpn_vpls_address; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownActivateInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnMspwAddress> l2vpn_mspw_address; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownActivateInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv4SrPolicyAddress> ipv4_sr_policy_address; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownActivateInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv6SrPolicyAddress> ipv6_sr_policy_address; }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownActivateInfo::InheritanceChain::BgpConfigEntid::NeighborAddress class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownActivateInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnVplsAddress : public ydk::Entity { public: L2vpnVplsAddress(); ~L2vpnVplsAddress(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf l2vpn_address; //type: string }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownActivateInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnVplsAddress class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownActivateInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnMspwAddress : public ydk::Entity { public: L2vpnMspwAddress(); ~L2vpnMspwAddress(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf l2vpn_address; //type: string }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownActivateInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnMspwAddress class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownActivateInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv4SrPolicyAddress : public ydk::Entity { public: Ipv4SrPolicyAddress(); ~Ipv4SrPolicyAddress(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf ipv4_srpolicy_address; //type: string }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownActivateInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv4SrPolicyAddress class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownActivateInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv6SrPolicyAddress : public ydk::Entity { public: Ipv6SrPolicyAddress(); ~Ipv6SrPolicyAddress(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf ipv6_srpolicy_address; //type: string }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::GracefulShutdownActivateInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv6SrPolicyAddress class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::CapabilityNegotiationSuppressedInfo : public ydk::Entity { public: CapabilityNegotiationSuppressedInfo(); ~CapabilityNegotiationSuppressedInfo(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf is_item_configured; //type: boolean class InheritanceChain; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::CapabilityNegotiationSuppressedInfo::InheritanceChain std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::CapabilityNegotiationSuppressedInfo::InheritanceChain> inheritance_chain; }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::CapabilityNegotiationSuppressedInfo class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::CapabilityNegotiationSuppressedInfo::InheritanceChain : public ydk::Entity { public: InheritanceChain(); ~InheritanceChain(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; class BgpConfigEntid; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::CapabilityNegotiationSuppressedInfo::InheritanceChain::BgpConfigEntid ydk::YList bgp_config_entid; }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::CapabilityNegotiationSuppressedInfo::InheritanceChain class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::CapabilityNegotiationSuppressedInfo::InheritanceChain::BgpConfigEntid : public ydk::Entity { public: BgpConfigEntid(); ~BgpConfigEntid(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf address_family_identifier; //type: uint8 ydk::YLeaf configuration_type; //type: BgpEntities ydk::YLeaf group_name; //type: string class NeighborAddress; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::CapabilityNegotiationSuppressedInfo::InheritanceChain::BgpConfigEntid::NeighborAddress std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::CapabilityNegotiationSuppressedInfo::InheritanceChain::BgpConfigEntid::NeighborAddress> neighbor_address; }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::CapabilityNegotiationSuppressedInfo::InheritanceChain::BgpConfigEntid class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::CapabilityNegotiationSuppressedInfo::InheritanceChain::BgpConfigEntid::NeighborAddress : public ydk::Entity { public: NeighborAddress(); ~NeighborAddress(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf afi; //type: BgpAfi ydk::YLeaf ipv4_address; //type: string ydk::YLeaf ipv4_mcast_address; //type: string ydk::YLeaf ipv4_label_address; //type: string ydk::YLeaf ipv4_tunnel_address; //type: string ydk::YLeaf ipv4_mdt_address; //type: string ydk::YLeaf ipv4vpn_address; //type: string ydk::YLeaf ipv4vpna_mcastddress; //type: string ydk::YLeaf ipv6_address; //type: string ydk::YLeaf ipv6_mcast_address; //type: string ydk::YLeaf ipv6_label_address; //type: string ydk::YLeaf ipv6vpn_address; //type: string ydk::YLeaf ipv6vpn_mcast_address; //type: string ydk::YLeaf rt_constraint_address; //type: string ydk::YLeaf ipv6mvpn_address; //type: string ydk::YLeaf ipv4mvpn_address; //type: string ydk::YLeaf l2vpn_evpn_address; //type: string ydk::YLeaf ls_ls_address; //type: string ydk::YLeaf ipv4_flowspec_address; //type: string ydk::YLeaf ipv6_flowspec_address; //type: string ydk::YLeaf ipv4vpn_flowspec_address; //type: string ydk::YLeaf ipv6vpn_flowspec_address; //type: string class L2vpnVplsAddress; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::CapabilityNegotiationSuppressedInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnVplsAddress class L2vpnMspwAddress; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::CapabilityNegotiationSuppressedInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnMspwAddress class Ipv4SrPolicyAddress; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::CapabilityNegotiationSuppressedInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv4SrPolicyAddress class Ipv6SrPolicyAddress; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::CapabilityNegotiationSuppressedInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv6SrPolicyAddress std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::CapabilityNegotiationSuppressedInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnVplsAddress> l2vpn_vpls_address; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::CapabilityNegotiationSuppressedInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnMspwAddress> l2vpn_mspw_address; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::CapabilityNegotiationSuppressedInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv4SrPolicyAddress> ipv4_sr_policy_address; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::CapabilityNegotiationSuppressedInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv6SrPolicyAddress> ipv6_sr_policy_address; }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::CapabilityNegotiationSuppressedInfo::InheritanceChain::BgpConfigEntid::NeighborAddress class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::CapabilityNegotiationSuppressedInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnVplsAddress : public ydk::Entity { public: L2vpnVplsAddress(); ~L2vpnVplsAddress(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf l2vpn_address; //type: string }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::CapabilityNegotiationSuppressedInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnVplsAddress class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::CapabilityNegotiationSuppressedInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnMspwAddress : public ydk::Entity { public: L2vpnMspwAddress(); ~L2vpnMspwAddress(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf l2vpn_address; //type: string }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::CapabilityNegotiationSuppressedInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnMspwAddress class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::CapabilityNegotiationSuppressedInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv4SrPolicyAddress : public ydk::Entity { public: Ipv4SrPolicyAddress(); ~Ipv4SrPolicyAddress(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf ipv4_srpolicy_address; //type: string }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::CapabilityNegotiationSuppressedInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv4SrPolicyAddress class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::CapabilityNegotiationSuppressedInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv6SrPolicyAddress : public ydk::Entity { public: Ipv6SrPolicyAddress(); ~Ipv6SrPolicyAddress(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf ipv6_srpolicy_address; //type: string }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::CapabilityNegotiationSuppressedInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv6SrPolicyAddress class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborRemoteAsListInfo : public ydk::Entity { public: NeighborRemoteAsListInfo(); ~NeighborRemoteAsListInfo(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf is_item_configured; //type: boolean class InheritanceChain; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborRemoteAsListInfo::InheritanceChain std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborRemoteAsListInfo::InheritanceChain> inheritance_chain; }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborRemoteAsListInfo class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborRemoteAsListInfo::InheritanceChain : public ydk::Entity { public: InheritanceChain(); ~InheritanceChain(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; class BgpConfigEntid; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborRemoteAsListInfo::InheritanceChain::BgpConfigEntid ydk::YList bgp_config_entid; }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborRemoteAsListInfo::InheritanceChain class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborRemoteAsListInfo::InheritanceChain::BgpConfigEntid : public ydk::Entity { public: BgpConfigEntid(); ~BgpConfigEntid(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf address_family_identifier; //type: uint8 ydk::YLeaf configuration_type; //type: BgpEntities ydk::YLeaf group_name; //type: string class NeighborAddress; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborRemoteAsListInfo::InheritanceChain::BgpConfigEntid::NeighborAddress std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborRemoteAsListInfo::InheritanceChain::BgpConfigEntid::NeighborAddress> neighbor_address; }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborRemoteAsListInfo::InheritanceChain::BgpConfigEntid class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborRemoteAsListInfo::InheritanceChain::BgpConfigEntid::NeighborAddress : public ydk::Entity { public: NeighborAddress(); ~NeighborAddress(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf afi; //type: BgpAfi ydk::YLeaf ipv4_address; //type: string ydk::YLeaf ipv4_mcast_address; //type: string ydk::YLeaf ipv4_label_address; //type: string ydk::YLeaf ipv4_tunnel_address; //type: string ydk::YLeaf ipv4_mdt_address; //type: string ydk::YLeaf ipv4vpn_address; //type: string ydk::YLeaf ipv4vpna_mcastddress; //type: string ydk::YLeaf ipv6_address; //type: string ydk::YLeaf ipv6_mcast_address; //type: string ydk::YLeaf ipv6_label_address; //type: string ydk::YLeaf ipv6vpn_address; //type: string ydk::YLeaf ipv6vpn_mcast_address; //type: string ydk::YLeaf rt_constraint_address; //type: string ydk::YLeaf ipv6mvpn_address; //type: string ydk::YLeaf ipv4mvpn_address; //type: string ydk::YLeaf l2vpn_evpn_address; //type: string ydk::YLeaf ls_ls_address; //type: string ydk::YLeaf ipv4_flowspec_address; //type: string ydk::YLeaf ipv6_flowspec_address; //type: string ydk::YLeaf ipv4vpn_flowspec_address; //type: string ydk::YLeaf ipv6vpn_flowspec_address; //type: string class L2vpnVplsAddress; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborRemoteAsListInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnVplsAddress class L2vpnMspwAddress; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborRemoteAsListInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnMspwAddress class Ipv4SrPolicyAddress; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborRemoteAsListInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv4SrPolicyAddress class Ipv6SrPolicyAddress; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborRemoteAsListInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv6SrPolicyAddress std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborRemoteAsListInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnVplsAddress> l2vpn_vpls_address; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborRemoteAsListInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnMspwAddress> l2vpn_mspw_address; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborRemoteAsListInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv4SrPolicyAddress> ipv4_sr_policy_address; std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborRemoteAsListInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv6SrPolicyAddress> ipv6_sr_policy_address; }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborRemoteAsListInfo::InheritanceChain::BgpConfigEntid::NeighborAddress class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborRemoteAsListInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnVplsAddress : public ydk::Entity { public: L2vpnVplsAddress(); ~L2vpnVplsAddress(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf l2vpn_address; //type: string }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborRemoteAsListInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnVplsAddress class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborRemoteAsListInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnMspwAddress : public ydk::Entity { public: L2vpnMspwAddress(); ~L2vpnMspwAddress(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf l2vpn_address; //type: string }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborRemoteAsListInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::L2vpnMspwAddress class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborRemoteAsListInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv4SrPolicyAddress : public ydk::Entity { public: Ipv4SrPolicyAddress(); ~Ipv4SrPolicyAddress(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf ipv4_srpolicy_address; //type: string }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborRemoteAsListInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv4SrPolicyAddress class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborRemoteAsListInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv6SrPolicyAddress : public ydk::Entity { public: Ipv6SrPolicyAddress(); ~Ipv6SrPolicyAddress(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf ipv6_srpolicy_address; //type: string }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::NeighborRemoteAsListInfo::InheritanceChain::BgpConfigEntid::NeighborAddress::Ipv6SrPolicyAddress class Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::MaxPeersInfo : public ydk::Entity { public: MaxPeersInfo(); ~MaxPeersInfo(); bool has_data() const override; bool has_operation() const override; std::vector<std::pair<std::string, ydk::LeafData> > get_name_leaf_data() const override; std::string get_segment_path() const override; std::shared_ptr<ydk::Entity> get_child_by_name(const std::string & yang_name, const std::string & segment_path) override; void set_value(const std::string & value_path, const std::string & value, const std::string & name_space, const std::string & name_space_prefix) override; void set_filter(const std::string & value_path, ydk::YFilter yfliter) override; std::map<std::string, std::shared_ptr<ydk::Entity>> get_children() const override; bool has_leaf_or_child_of_name(const std::string & name) const override; ydk::YLeaf is_item_configured; //type: boolean class InheritanceChain; //type: Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::MaxPeersInfo::InheritanceChain std::shared_ptr<cisco_ios_xr::Cisco_IOS_XR_ipv4_bgp_oper::Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::MaxPeersInfo::InheritanceChain> inheritance_chain; }; // Bgp::ConfigInstances::ConfigInstance::ConfigInstanceDefaultVrf::EntityConfigurations::EntityConfiguration::AfIndependentConfig::MaxPeersInfo } } #endif /* _CISCO_IOS_XR_IPV4_BGP_OPER_2_ */
75.700637
333
0.768683
[ "vector" ]
3e366249e5a93415a98f19b84d757ea581c3a78e
1,189
cpp
C++
rotateArrayLeft.cpp
DeeptanshuM/Algorithms
48f91e952b71370127db33fa42d642062690f9d9
[ "MIT" ]
null
null
null
rotateArrayLeft.cpp
DeeptanshuM/Algorithms
48f91e952b71370127db33fa42d642062690f9d9
[ "MIT" ]
null
null
null
rotateArrayLeft.cpp
DeeptanshuM/Algorithms
48f91e952b71370127db33fa42d642062690f9d9
[ "MIT" ]
null
null
null
/* input: n k array of n ints to be rotate left k places my solution: simply utilize the modulo property that anynumber mod n guarantess that the result will be between 0 and n - 1, both ends inclusive, iterate throught the given array and make the appropriate assignments */ #include <map> #include <set> #include <list> #include <cmath> #include <ctime> #include <deque> #include <queue> #include <stack> #include <string> #include <bitset> #include <cstdio> #include <limits> #include <vector> #include <climits> #include <cstring> #include <cstdlib> #include <fstream> #include <numeric> #include <sstream> #include <iostream> #include <algorithm> #include <unordered_map> using namespace std; vector<int> array_left_rotation(vector<int> a, int n, int k) { vector<int> to_ret (n); for(int i = 0; i < a.size(); i++){ to_ret[i] = a[(k + i) % n]; } return to_ret; } int main(){ int n; int k; cin >> n >> k; vector<int> a(n); for(int a_i = 0;a_i < n;a_i++){ cin >> a[a_i]; } vector<int> output = array_left_rotation(a, n, k); for(int i = 0; i < n;i++) cout << output[i] << " "; cout << endl; return 0; }
20.152542
81
0.633305
[ "vector" ]
3e3c13549baf47ad2be19f3e37becb2db83d3376
4,861
cpp
C++
src/codegen/lang/if.cpp
17zhangw/peloton
484d76df9344cb5c153a2c361c5d5018912d4cf4
[ "Apache-2.0" ]
3
2018-01-08T01:06:17.000Z
2019-06-17T23:14:36.000Z
src/codegen/lang/if.cpp
17zhangw/peloton
484d76df9344cb5c153a2c361c5d5018912d4cf4
[ "Apache-2.0" ]
1
2017-04-04T17:03:59.000Z
2017-04-04T17:03:59.000Z
src/codegen/lang/if.cpp
17zhangw/peloton
484d76df9344cb5c153a2c361c5d5018912d4cf4
[ "Apache-2.0" ]
2
2017-03-23T18:59:38.000Z
2017-03-25T19:15:08.000Z
//===----------------------------------------------------------------------===// // // Peloton // // if.cpp // // Identification: src/codegen/lang/if.cpp // // Copyright (c) 2015-2018, Carnegie Mellon University Database Group // //===----------------------------------------------------------------------===// #include "codegen/lang/if.h" #include <llvm/Transforms/Utils/BasicBlockUtils.h> #include "codegen/value.h" #include "codegen/type/boolean_type.h" namespace peloton { namespace codegen { namespace lang { If::If(CodeGen &codegen, llvm::Value *cond, std::string name, llvm::BasicBlock *then_bb, llvm::BasicBlock *else_bb) : codegen_(codegen), fn_(codegen_->GetInsertBlock()->getParent()), then_bb_(nullptr), last_bb_in_then_(nullptr), else_bb_(nullptr), last_bb_in_else_(nullptr) { Init(cond, then_bb, else_bb); then_bb_->setName(name); } If::If(CodeGen &codegen, const codegen::Value &cond, std::string name, llvm::BasicBlock *then_bb, llvm::BasicBlock *else_bb) : If(codegen, type::Boolean::Instance().Reify(codegen, cond), std::move(name), then_bb, else_bb) {} void If::Init(llvm::Value *cond, llvm::BasicBlock *then_bb, llvm::BasicBlock *else_bb) { // Set up the "then" block. If one was provided, use it. Otherwise, create a // new one now. then_bb_ = then_bb; else_bb_ = else_bb; if (then_bb_ == nullptr) { then_bb_ = llvm::BasicBlock::Create(codegen_.GetContext(), "then", fn_); } // The merging block where both "if-then" and "else" blocks merge into merge_bb_ = llvm::BasicBlock::Create(codegen_.GetContext(), "ifCont"); // This instruction needs to be saved in case we have an else block branch_ = codegen_->CreateCondBr(cond, then_bb_, (else_bb != nullptr ? else_bb : merge_bb_)); // Move to the "then" block so the user can generate code in the "true" branch codegen_->SetInsertPoint(then_bb_); } void If::ElseBlock() { // Branch to the merging block if the caller hasn't specifically branched // somewhere else BranchIfNotTerminated(merge_bb_); // If no else block was provided by the caller, generate one now if (else_bb_ == nullptr) { // Create a new else block else_bb_ = llvm::BasicBlock::Create(codegen_.GetContext(), "else", fn_); last_bb_in_else_ = else_bb_; // Replace the previous branch instruction that normally went to the merging // block on a false predicate to now branch into the new else block llvm::BranchInst *new_branch = llvm::BranchInst::Create(then_bb_, else_bb_, branch_->getCondition()); ReplaceInstWithInst(branch_, new_branch); last_bb_in_then_ = codegen_->GetInsertBlock(); } // Switch to the else block (either externally provided or created here) codegen_->SetInsertPoint(else_bb_); } void If::EndIf() { // Branch to the merging block if the caller hasn't specifically branched // somewhere else BranchIfNotTerminated(merge_bb_); llvm::BasicBlock *curr_bb = codegen_->GetInsertBlock(); if (else_bb_ == nullptr) { // There was no else block, the current block is the last in the "then" last_bb_in_then_ = curr_bb; } else { // There was an else block, the current block is the last in the "else" last_bb_in_else_ = curr_bb; } // Append the merge block to the end, and set it as the new insertion point fn_->getBasicBlockList().push_back(merge_bb_); codegen_->SetInsertPoint(merge_bb_); } Value If::BuildPHI(const codegen::Value &v1, const codegen::Value &v2) { if (codegen_->GetInsertBlock() != merge_bb_) { // The if hasn't been ended, end it now EndIf(); } PELOTON_ASSERT(v1.GetType() == v2.GetType()); std::vector<std::pair<Value, llvm::BasicBlock *>> vals = { {v1, last_bb_in_then_}, {v2, last_bb_in_else_ != nullptr ? last_bb_in_else_ : branch_->getParent()}}; return Value::BuildPHI(codegen_, vals); } llvm::Value *If::BuildPHI(llvm::Value *v1, llvm::Value *v2) { PELOTON_ASSERT(v1->getType() == v2->getType()); llvm::PHINode *phi = codegen_->CreatePHI(v1->getType(), 2); phi->addIncoming(v1, last_bb_in_then_); phi->addIncoming(v2, last_bb_in_else_ != nullptr ? last_bb_in_else_ : branch_->getParent()); return phi; } void If::BranchIfNotTerminated(llvm::BasicBlock *block) const { // Get the current block we're generating in llvm::BasicBlock *curr_bb = codegen_->GetInsertBlock(); // Get the terminator instruction in the current block, if one exists. const llvm::TerminatorInst *terminator = curr_bb->getTerminator(); // If no terminator exists, branch to the provided block if (terminator == nullptr) { codegen_->CreateBr(block); } } } // namespace lang } // namespace codegen } // namespace peloton
33.993007
80
0.655832
[ "vector" ]
3e3d08641c22d95bb95ef55df62ea68c45063a9c
23,313
cxx
C++
tomviz/modules/ModuleVolume.cxx
sankhesh/tomviz
7116f4eb75b30534a24462f4ddfb1694fe41c308
[ "BSD-3-Clause" ]
284
2015-01-05T08:53:20.000Z
2022-03-31T07:35:16.000Z
tomviz/modules/ModuleVolume.cxx
sankhesh/tomviz
7116f4eb75b30534a24462f4ddfb1694fe41c308
[ "BSD-3-Clause" ]
1,579
2015-03-19T15:56:44.000Z
2022-03-21T11:29:04.000Z
tomviz/modules/ModuleVolume.cxx
sankhesh/tomviz
7116f4eb75b30534a24462f4ddfb1694fe41c308
[ "BSD-3-Clause" ]
74
2015-01-29T16:24:32.000Z
2022-03-07T21:52:29.000Z
/* This source file is part of the Tomviz project, https://tomviz.org/. It is released under the 3-Clause BSD License, see "LICENSE". */ #include "ModuleVolume.h" #include "ModuleVolumeWidget.h" #include "DataSource.h" #include "HistogramManager.h" #include "ScalarsComboBox.h" #include "VolumeManager.h" #include "vtkTransferFunctionBoxItem.h" #include "vtkTriangleBar.h" #include <vtkColorTransferFunction.h> #include <vtkDataArray.h> #include <vtkGPUVolumeRayCastMapper.h> #include <vtkImageClip.h> #include <vtkImageData.h> #include <vtkNew.h> #include <vtkObjectFactory.h> #include <vtkPiecewiseFunction.h> #include <vtkPlane.h> #include <vtkSmartPointer.h> #include <vtkSmartVolumeMapper.h> #include <vtkTrivialProducer.h> #include <vtkVector.h> #include <vtkView.h> #include <vtkVolume.h> #include <vtkVolumeProperty.h> #include <vtkPVRenderView.h> #include <vtkPointData.h> #include <vtkSMViewProxy.h> #include <QCheckBox> #include <QFormLayout> #include <QSignalBlocker> #include <QVBoxLayout> #include <cmath> namespace tomviz { // Subclass vtkSmartVolumeMapper so we can have a little more customization class SmartVolumeMapper : public vtkSmartVolumeMapper { public: SmartVolumeMapper() { SetRequestedRenderModeToGPU(); } static SmartVolumeMapper* New(); void UseJitteringOn() { GetGPUMapper()->UseJitteringOn(); } void UseJitteringOff() { GetGPUMapper()->UseJitteringOff(); } vtkTypeBool GetUseJittering() { return GetGPUMapper()->GetUseJittering(); } void SetUseJittering(vtkTypeBool b) { GetGPUMapper()->SetUseJittering(b); } }; vtkStandardNewMacro(SmartVolumeMapper) ModuleVolume::ModuleVolume(QObject* parentObject) : Module(parentObject) { // NOTE: Due to a bug in vtkMultiVolume, a gradient opacity function must be // set or the shader will fail to compile. m_gradientOpacity->AddPoint(0.0, 1.0); connect(&HistogramManager::instance(), &HistogramManager::histogram2DReady, this, [=](vtkSmartPointer<vtkImageData> image, vtkSmartPointer<vtkImageData> histogram2D) { // Force the transfer function 2D to update. if (image == vtkImageData::SafeDownCast(dataSource()->dataObject())) { auto colorMap = vtkColorTransferFunction::SafeDownCast( this->colorMap()->GetClientSideObject()); auto opacityMap = vtkPiecewiseFunction::SafeDownCast( this->opacityMap()->GetClientSideObject()); vtkTransferFunctionBoxItem::rasterTransferFunction2DBox( histogram2D, *this->transferFunction2DBox(), transferFunction2D(), colorMap, opacityMap); } // Update the volume mapper. this->updateColorMap(); emit this->renderNeeded(); }); } ModuleVolume::~ModuleVolume() { finalize(); } QIcon ModuleVolume::icon() const { return QIcon(":/icons/pqVolumeData.png"); } void ModuleVolume::initializeMapper(DataSource* data) { updateMapperInput(data); m_volumeMapper->SetScalarModeToUsePointFieldData(); m_volumeMapper->SelectScalarArray(scalarsIndex()); m_volume->SetMapper(m_volumeMapper); m_volumeMapper->UseJitteringOn(); m_volumeMapper->SetBlendMode(vtkVolumeMapper::COMPOSITE_BLEND); if (m_view != nullptr) { m_view->Update(); } } bool ModuleVolume::initialize(DataSource* data, vtkSMViewProxy* vtkView) { if (!Module::initialize(data, vtkView)) { return false; } initializeMapper(data); m_volume->SetProperty(m_volumeProperty); const double* displayPosition = data->displayPosition(); m_volume->SetPosition(displayPosition[0], displayPosition[1], displayPosition[2]); m_volumeProperty->SetInterpolationType(VTK_LINEAR_INTERPOLATION); m_volumeProperty->SetAmbient(0.0); m_volumeProperty->SetDiffuse(1.0); m_volumeProperty->SetSpecular(1.0); m_volumeProperty->SetSpecularPower(100.0); resetRgbaMappingRanges(); onRgbaMappingToggled(false); onComponentNamesModified(); updateColorMap(); m_view = vtkPVRenderView::SafeDownCast(vtkView->GetClientSideView()); m_view->AddPropToRenderer(m_volume); m_view->Update(); connect(data, &DataSource::dataChanged, this, &ModuleVolume::onDataChanged); connect(data, &DataSource::activeScalarsChanged, this, &ModuleVolume::onScalarArrayChanged); connect(data, &DataSource::componentNamesModified, this, &ModuleVolume::onComponentNamesModified); // Work around mapper bug on the mac, see the following issue for details: // https://github.com/OpenChemistry/tomviz/issues/1776 // Should be removed when this is fixed. #if defined(Q_OS_MAC) connect(data, &DataSource::dataChanged, this, [this]() { this->initializeMapper(); }); #endif return true; } void ModuleVolume::resetRgbaMappingRanges() { // Combined range computeRange(dataSource()->scalars(), m_rgbaMappingRangeAll.data()); // Individual ranges m_rgbaMappingRanges.clear(); resetComponentNames(); for (const auto& name : m_componentNames) { m_rgbaMappingRanges[name] = computeRange(name); } } void ModuleVolume::resetComponentNames() { m_componentNames = dataSource()->componentNames(); } std::array<double, 2> ModuleVolume::computeRange(const QString& component) const { std::array<double, 2> result; auto index = m_componentNames.indexOf(component); dataSource()->scalars()->GetRange(result.data(), index); return result; } std::array<double, 2>& ModuleVolume::rangeForComponent(const QString& component) { return m_rgbaMappingRanges[component]; } std::vector<std::array<double, 2>> ModuleVolume::activeRgbaRanges() { std::vector<std::array<double, 2>> ret; if (rgbaMappingCombineComponents()) { // We are using one combined range auto scalars = dataSource()->scalars(); for (int i = 0; i < scalars->GetNumberOfComponents(); ++i) { ret.push_back(m_rgbaMappingRangeAll); } } else { for (auto& name : m_componentNames) { ret.push_back(rangeForComponent(name)); } } return ret; } void ModuleVolume::onRgbaMappingToggled(bool b) { m_useRgbaMapping = b; updateMapperInput(); updateVectorMode(); if (useRgbaMapping()) { updateRgbaMappingDataObject(); m_volumeProperty->IndependentComponentsOff(); if (m_view) { m_view->AddPropToRenderer(m_triangleBar); } } else { m_volumeProperty->IndependentComponentsOn(); if (m_view) { m_view->RemovePropFromRenderer(m_triangleBar); } } updatePanel(); emit renderNeeded(); } void ModuleVolume::onDataChanged() { if (useRgbaMapping()) { updateRgbaMappingDataObject(); } updatePanel(); } void ModuleVolume::onComponentNamesModified() { auto oldNames = m_componentNames; resetComponentNames(); auto newNames = m_componentNames; // Rename the map keys for (int i = 0; i < oldNames.size(); ++i) { if (newNames[i] != oldNames[i]) { m_rgbaMappingRanges[newNames[i]] = m_rgbaMappingRanges.take(oldNames[i]); if (m_rgbaMappingComponent == oldNames[i]) { m_rgbaMappingComponent = newNames[i]; } } } // Set labels on the triangle bar if (newNames.size() >= 3) { m_triangleBar->SetLabels(newNames[0].toLatin1().data(), newNames[1].toLatin1().data(), newNames[2].toLatin1().data()); if (m_useRgbaMapping) { emit renderNeeded(); } } // Update the panel updatePanel(); } void ModuleVolume::updateMapperInput(DataSource* data) { if (useRgbaMapping()) { m_volumeMapper->SetInputDataObject(m_rgbaDataObject); } else if (data || (data = dataSource())) { auto* output = data->producer()->GetOutputPort(); m_volumeMapper->SetInputConnection(output); } } void ModuleVolume::computeRange(vtkDataArray* array, double range[2]) { range[0] = DBL_MAX; range[1] = -DBL_MAX; for (int i = 0; i < array->GetNumberOfComponents(); ++i) { auto* tmp = array->GetRange(i); range[0] = std::min(range[0], tmp[0]); range[1] = std::max(range[1], tmp[1]); } } static double computeNorm(double* vals, int num) { double result = 0; for (int i = 0; i < num; ++i) { result += std::pow(vals[i], 2.0); } return std::sqrt(result); } static double rescale(double val, double* oldRange, double* newRange) { return (val - oldRange[0]) * (newRange[1] - newRange[0]) / (oldRange[1] - oldRange[0]) + newRange[0]; } void ModuleVolume::updateVectorMode() { int vectorMode = vtkSmartVolumeMapper::DISABLED; auto* array = dataSource()->scalars(); if (array->GetNumberOfComponents() > 1 && !useRgbaMapping()) { vectorMode = vtkSmartVolumeMapper::MAGNITUDE; } m_volumeMapper->SetVectorMode(vectorMode); } bool ModuleVolume::rgbaMappingAllowed() { auto* array = dataSource()->scalars(); return array->GetNumberOfComponents() == 3; } bool ModuleVolume::useRgbaMapping() { if (!rgbaMappingAllowed()) { m_useRgbaMapping = false; } return m_useRgbaMapping; } void ModuleVolume::updateRgbaMappingDataObject() { auto* imageData = dataSource()->imageData(); auto* input = dataSource()->scalars(); // FIXME: we should probably do a filter instead of an object. m_rgbaDataObject->SetDimensions(imageData->GetDimensions()); m_rgbaDataObject->AllocateScalars(input->GetDataType(), 4); auto* output = m_rgbaDataObject->GetPointData()->GetScalars(); // Rescale from 0 to 1 for the coloring. double newRange[2] = { 0.0, 1.0 }; auto oldRanges = activeRgbaRanges(); for (int i = 0; i < input->GetNumberOfTuples(); ++i) { for (int j = 0; j < 3; ++j) { double oldVal = input->GetComponent(i, j); double newVal = rescale(oldVal, oldRanges[j].data(), newRange); output->SetComponent(i, j, newVal); } auto* vals = input->GetTuple3(i); auto norm = computeNorm(vals, 3); output->SetComponent(i, 3, norm); } } QString ModuleVolume::rgbaMappingComponent() { if (!m_componentNames.contains(m_rgbaMappingComponent)) { // Set it to the first component m_rgbaMappingComponent = m_componentNames[0]; } return m_rgbaMappingComponent; } void ModuleVolume::updateColorMap() { m_volumeProperty->SetScalarOpacity( vtkPiecewiseFunction::SafeDownCast(opacityMap()->GetClientSideObject())); m_volumeProperty->SetColor( vtkColorTransferFunction::SafeDownCast(colorMap()->GetClientSideObject())); int propertyMode = vtkVolumeProperty::TF_1D; const Module::TransferMode mode = getTransferMode(); switch (mode) { case (Module::SCALAR): m_volumeProperty->SetGradientOpacity(m_gradientOpacity); break; case (Module::GRADIENT_1D): m_volumeProperty->SetGradientOpacity(gradientOpacityMap()); break; case (Module::GRADIENT_2D): if (transferFunction2D() && transferFunction2D()->GetExtent()[1] > 0) { propertyMode = vtkVolumeProperty::TF_2D; m_volumeProperty->SetTransferFunction2D(transferFunction2D()); } else { vtkSmartPointer<vtkImageData> image = vtkImageData::SafeDownCast(dataSource()->dataObject()); // See if the histogram is done, if it is then update the transfer // function. if (auto histogram2D = HistogramManager::instance().getHistogram2D(image)) { auto colorMap = vtkColorTransferFunction::SafeDownCast( this->colorMap()->GetClientSideObject()); auto opacityMap = vtkPiecewiseFunction::SafeDownCast( this->opacityMap()->GetClientSideObject()); vtkTransferFunctionBoxItem::rasterTransferFunction2DBox( histogram2D, *this->transferFunction2DBox(), transferFunction2D(), colorMap, opacityMap); propertyMode = vtkVolumeProperty::TF_2D; m_volumeProperty->SetTransferFunction2D(transferFunction2D()); } // If this histogram is not ready, then it finishing will trigger the // functor created in the constructor and the volume mapper will be // updated when the histogram2D is done } break; } m_volumeProperty->SetTransferFunctionMode(propertyMode); // BUG: volume mappers don't update property when LUT is changed and has an // older Mtime. Fix for now by forcing the LUT to update. vtkObject::SafeDownCast(colorMap()->GetClientSideObject())->Modified(); } bool ModuleVolume::finalize() { if (m_view) { m_view->RemovePropFromRenderer(m_volume); m_view->RemovePropFromRenderer(m_triangleBar); } return true; } bool ModuleVolume::setVisibility(bool val) { m_volume->SetVisibility(val ? 1 : 0); m_triangleBar->SetVisibility(val ? 1 : 0); Module::setVisibility(val); return true; } bool ModuleVolume::visibility() const { return m_volume->GetVisibility() != 0; } QJsonObject ModuleVolume::serialize() const { auto json = Module::serialize(); auto props = json["properties"].toObject(); props["transferMode"] = getTransferMode(); props["interpolation"] = m_volumeProperty->GetInterpolationType(); props["blendingMode"] = m_volumeMapper->GetBlendMode(); props["rayJittering"] = m_volumeMapper->GetUseJittering() == 1; QJsonObject lighting; lighting["enabled"] = m_volumeProperty->GetShade() == 1; lighting["ambient"] = m_volumeProperty->GetAmbient(); lighting["diffuse"] = m_volumeProperty->GetDiffuse(); lighting["specular"] = m_volumeProperty->GetSpecular(); lighting["specularPower"] = m_volumeProperty->GetSpecularPower(); props["lighting"] = lighting; props["solidity"] = solidity(); json["properties"] = props; return json; } bool ModuleVolume::deserialize(const QJsonObject& json) { if (!Module::deserialize(json)) { return false; } if (json["properties"].isObject()) { auto props = json["properties"].toObject(); setTransferMode( static_cast<Module::TransferMode>(props["transferMode"].toInt())); onInterpolationChanged(props["interpolation"].toInt()); setBlendingMode(props["blendingMode"].toInt()); setJittering(props["rayJittering"].toBool()); setSolidity(props["solidity"].toDouble()); if (props["lighting"].isObject()) { auto lighting = props["lighting"].toObject(); setLighting(lighting["enabled"].toBool()); onAmbientChanged(lighting["ambient"].toDouble()); onDiffuseChanged(lighting["diffuse"].toDouble()); onSpecularChanged(lighting["specular"].toDouble()); onSpecularPowerChanged(lighting["specularPower"].toDouble()); } updatePanel(); onScalarArrayChanged(); return true; } return false; } void ModuleVolume::addToPanel(QWidget* panel) { if (panel->layout()) { delete panel->layout(); } if (!m_controllers) { m_controllers = new ModuleVolumeWidget; } m_scalarsCombo = new ScalarsComboBox(); m_scalarsCombo->setOptions(dataSource(), this); m_controllers->formLayout()->insertRow(0, "Active Scalars", m_scalarsCombo); QVBoxLayout* layout = new QVBoxLayout; panel->setLayout(layout); // Create, update and connect layout->addWidget(m_controllers); updatePanel(); connect(m_controllers, SIGNAL(jitteringToggled(const bool)), this, SLOT(setJittering(const bool))); connect(m_controllers, SIGNAL(lightingToggled(const bool)), this, SLOT(setLighting(const bool))); connect(m_controllers, SIGNAL(blendingChanged(const int)), this, SLOT(setBlendingMode(const int))); connect(m_controllers, SIGNAL(interpolationChanged(const int)), this, SLOT(onInterpolationChanged(const int))); connect(m_controllers, SIGNAL(ambientChanged(const double)), this, SLOT(onAmbientChanged(const double))); connect(m_controllers, SIGNAL(diffuseChanged(const double)), this, SLOT(onDiffuseChanged(const double))); connect(m_controllers, SIGNAL(specularChanged(const double)), this, SLOT(onSpecularChanged(const double))); connect(m_controllers, SIGNAL(specularPowerChanged(const double)), this, SLOT(onSpecularPowerChanged(const double))); connect(m_controllers, SIGNAL(transferModeChanged(const int)), this, SLOT(onTransferModeChanged(const int))); connect(m_controllers, &ModuleVolumeWidget::useRgbaMappingToggled, this, &ModuleVolume::onRgbaMappingToggled); connect(m_controllers, &ModuleVolumeWidget::rgbaMappingCombineComponentsToggled, this, &ModuleVolume::onRgbaMappingCombineComponentsToggled); connect(m_controllers, &ModuleVolumeWidget::rgbaMappingComponentChanged, this, &ModuleVolume::onRgbaMappingComponentChanged); connect(m_controllers, &ModuleVolumeWidget::rgbaMappingMinChanged, this, &ModuleVolume::onRgbaMappingMinChanged); connect(m_controllers, &ModuleVolumeWidget::rgbaMappingMaxChanged, this, &ModuleVolume::onRgbaMappingMaxChanged); connect(m_scalarsCombo, QOverload<int>::of(&QComboBox::currentIndexChanged), this, [this](int idx) { setActiveScalars(m_scalarsCombo->itemData(idx).toInt()); onScalarArrayChanged(); }); connect(m_controllers, SIGNAL(solidityChanged(const double)), this, SLOT(setSolidity(const double))); connect(m_controllers, &ModuleVolumeWidget::allowMultiVolumeToggled, this, &ModuleVolume::onAllowMultiVolumeToggled); } void ModuleVolume::updatePanel() { // If m_controllers is present update the values, if not they will be updated // when it is created and shown. if (!m_controllers || !m_volumeMapper || !m_volumeProperty || !m_scalarsCombo) { return; } auto blocked = QSignalBlocker(m_controllers); m_controllers->setJittering( static_cast<bool>(m_volumeMapper->GetUseJittering())); m_controllers->setLighting(static_cast<bool>(m_volumeProperty->GetShade())); m_controllers->setBlendingMode(m_volumeMapper->GetBlendMode()); m_controllers->setAmbient(m_volumeProperty->GetAmbient()); m_controllers->setDiffuse(m_volumeProperty->GetDiffuse()); m_controllers->setSpecular(m_volumeProperty->GetSpecular()); m_controllers->setSpecularPower(m_volumeProperty->GetSpecularPower()); m_controllers->setInterpolationType(m_volumeProperty->GetInterpolationType()); m_controllers->setSolidity(solidity()); m_controllers->setAllowMultiVolume( VolumeManager::instance().allowMultiVolume(this->view())); m_controllers->setEnableAllowMultiVolume( VolumeManager::instance().volumeCount(this->view()) >= MULTI_VOLUME_SWITCH); m_controllers->setRgbaMappingAllowed(rgbaMappingAllowed()); m_controllers->setUseRgbaMapping(useRgbaMapping()); if (useRgbaMapping()) { auto allComponents = rgbaMappingCombineComponents(); auto options = m_componentNames; auto component = rgbaMappingComponent(); m_controllers->setRgbaMappingCombineComponents(allComponents); m_controllers->setRgbaMappingComponentOptions(options); m_controllers->setRgbaMappingComponent(component); std::array<double, 2> minmax, sliderRange; if (allComponents) { minmax = m_rgbaMappingRangeAll; computeRange(dataSource()->scalars(), sliderRange.data()); } else { minmax = rangeForComponent(component); sliderRange = computeRange(component); } m_controllers->setRgbaMappingMin(minmax[0]); m_controllers->setRgbaMappingMax(minmax[1]); m_controllers->setRgbaMappingSliderRange(sliderRange.data()); } const auto tfMode = getTransferMode(); m_controllers->setTransferMode(tfMode); m_scalarsCombo->setOptions(dataSource(), this); } void ModuleVolume::onTransferModeChanged(const int mode) { setTransferMode(static_cast<Module::TransferMode>(mode)); updateColorMap(); emit transferModeChanged(mode); emit renderNeeded(); } void ModuleVolume::onRgbaMappingCombineComponentsToggled(const bool b) { m_rgbaMappingCombineComponents = b; updatePanel(); updateRgbaMappingDataObject(); emit renderNeeded(); } void ModuleVolume::onRgbaMappingComponentChanged(const QString& component) { m_rgbaMappingComponent = component; updatePanel(); } void ModuleVolume::onRgbaMappingMinChanged(const double value) { if (m_rgbaMappingCombineComponents) { m_rgbaMappingRangeAll[0] = value; } else { rangeForComponent(rgbaMappingComponent())[0] = value; } updateRgbaMappingDataObject(); emit renderNeeded(); } void ModuleVolume::onRgbaMappingMaxChanged(const double value) { if (m_rgbaMappingCombineComponents) { m_rgbaMappingRangeAll[1] = value; } else { rangeForComponent(rgbaMappingComponent())[1] = value; } updateRgbaMappingDataObject(); emit renderNeeded(); } void ModuleVolume::onAllowMultiVolumeToggled(const bool value) { VolumeManager::instance().allowMultiVolume(value, this->view()); emit renderNeeded(); } vtkDataObject* ModuleVolume::dataToExport() { auto trv = dataSource()->producer(); return trv->GetOutputDataObject(0); } void ModuleVolume::onAmbientChanged(const double value) { m_volumeProperty->SetAmbient(value); emit renderNeeded(); } void ModuleVolume::onDiffuseChanged(const double value) { m_volumeProperty->SetDiffuse(value); emit renderNeeded(); } void ModuleVolume::onSpecularChanged(const double value) { m_volumeProperty->SetSpecular(value); emit renderNeeded(); } void ModuleVolume::onSpecularPowerChanged(const double value) { m_volumeProperty->SetSpecularPower(value); emit renderNeeded(); } void ModuleVolume::onInterpolationChanged(const int type) { m_volumeProperty->SetInterpolationType(type); emit renderNeeded(); } void ModuleVolume::dataSourceMoved(double newX, double newY, double newZ) { vtkVector3d pos(newX, newY, newZ); m_volume->SetPosition(pos.GetData()); } void ModuleVolume::setLighting(const bool val) { m_volumeProperty->SetShade(val ? 1 : 0); emit renderNeeded(); } void ModuleVolume::setBlendingMode(const int mode) { m_volumeMapper->SetBlendMode(mode); emit renderNeeded(); } void ModuleVolume::setJittering(const bool val) { m_volumeMapper->SetUseJittering(val ? 1 : 0); emit renderNeeded(); } void ModuleVolume::onScalarArrayChanged() { // The scalar arrays may have been renamed if (m_scalarsCombo) { m_scalarsCombo->setOptions(dataSource(), this); } m_volumeMapper->SelectScalarArray(scalarsIndex()); auto tp = dataSource()->producer(); if (tp) { tp->GetOutputDataObject(0)->Modified(); } emit renderNeeded(); } double ModuleVolume::solidity() const { return 1 / m_volumeProperty->GetScalarOpacityUnitDistance(); } void ModuleVolume::setSolidity(const double value) { int numComponents = useRgbaMapping() ? 4 : 1; for (int i = 0; i < numComponents; ++i) { m_volumeProperty->SetScalarOpacityUnitDistance(i, 1 / value); } emit renderNeeded(); } int ModuleVolume::scalarsIndex() { int index; if (activeScalars() == Module::defaultScalarsIdx()) { index = dataSource()->activeScalarsIdx(); } else { index = activeScalars(); } return index; } bool ModuleVolume::updateClippingPlane(vtkPlane* plane, bool newFilter) { if (m_volumeMapper->GetNumberOfClippingPlanes()) { m_volumeMapper->RemoveClippingPlane(plane); } if (!newFilter) { m_volumeMapper->AddClippingPlane(plane); } emit renderNeeded(); return true; } vtkVolume* ModuleVolume::getVolume() { return m_volume; } } // end of namespace tomviz
29.850192
80
0.710676
[ "object", "vector" ]
3e3d70621f652ddad42773093a3ff2e4b9800737
3,231
cpp
C++
Leetcode Daily Challenge/October-2021/8. Implement Trie.cpp
Simran2000-jpg/DataStructures-Algorithms
65b62033479d8d3941dc491c44c8ddada5887382
[ "MIT" ]
1
2022-01-23T15:41:37.000Z
2022-01-23T15:41:37.000Z
Leetcode Daily Challenge/October-2021/8. Implement Trie.cpp
Simran2000-jpg/DataStructures-Algorithms
65b62033479d8d3941dc491c44c8ddada5887382
[ "MIT" ]
2
2022-02-25T13:36:46.000Z
2022-02-25T14:06:44.000Z
Leetcode Daily Challenge/October-2021/8. Implement Trie.cpp
Simran2000-jpg/DataStructures-Algorithms
65b62033479d8d3941dc491c44c8ddada5887382
[ "MIT" ]
1
2022-01-23T22:00:48.000Z
2022-01-23T22:00:48.000Z
/* A trie (pronounced as "try") or prefix tree is a tree data structure used to efficiently store and retrieve keys in a dataset of strings. There are various applications of this data structure, such as autocomplete and spellchecker. Implement the Trie class: Trie() Initializes the trie object. void insert(String word) Inserts the string word into the trie. boolean search(String word) Returns true if the string word is in the trie (i.e., was inserted before), and false otherwise. boolean startsWith(String prefix) Returns true if there is a previously inserted string word that has the prefix prefix, and false otherwise. Example 1: Input ["Trie", "insert", "search", "search", "startsWith", "insert", "search"] [[], ["apple"], ["apple"], ["app"], ["app"], ["app"], ["app"]] Output [null, null, true, false, true, null, true] Explanation Trie trie = new Trie(); trie.insert("apple"); trie.search("apple"); // return True trie.search("app"); // return False trie.startsWith("app"); // return True trie.insert("app"); trie.search("app"); // return True Constraints: 1 <= word.length, prefix.length <= 2000 word and prefix consist only of lowercase English letters. At most 3 * 104 calls in total will be made to insert, search, and startsWith. */ class TrieNode { public: TrieNode* children[26]; bool word; TrieNode() { for(int i=0;i<26;i++) children[i] = NULL; word = false; } }; class Trie { public: TrieNode* root; /** Initialize your data structure here. */ Trie() { root = new TrieNode(); } TrieNode* get() { TrieNode*t = new TrieNode(); return t; } /** Inserts a word into the trie. */ void insert(string word) { int n = word.length(); TrieNode* curr = root; for(int i=0;i<n;i++) { if(curr->children[word[i]-'a']==NULL) { curr->children[word[i]-'a'] = get(); } curr = curr->children[word[i]-'a']; } curr->word = true; } /** Returns if the word is in the trie. */ bool search(string word) { int n = word.length(); TrieNode* curr = root; for(int i=0;i<n;i++) { if(curr->children[word[i]-'a']==NULL) return false; curr = curr->children[word[i]-'a']; } return curr->word; } /** Returns if there is any word in the trie that starts with the given prefix. */ bool startsWith(string word) { int n = word.length(); TrieNode* curr = root; for(int i=0;i<n;i++) { if(curr->children[word[i]-'a']==NULL) return false; curr = curr->children[word[i]-'a']; } return true; } }; /** * Your Trie object will be instantiated and called as such: * Trie* obj = new Trie(); * obj->insert(word); * bool param_2 = obj->search(word); * bool param_3 = obj->startsWith(prefix); */
27.615385
232
0.543794
[ "object" ]
3e3ffa501bc26638cfa36908ec2efa62cfa3aecf
3,411
cc
C++
src/storage/blobfs/iterator/node_populator.cc
allansrc/fuchsia
a2c235b33fc4305044d496354a08775f30cdcf37
[ "BSD-2-Clause" ]
5
2022-01-10T20:22:17.000Z
2022-01-21T20:14:17.000Z
src/storage/blobfs/iterator/node_populator.cc
allansrc/fuchsia
a2c235b33fc4305044d496354a08775f30cdcf37
[ "BSD-2-Clause" ]
2
2021-09-19T21:55:09.000Z
2021-12-19T03:34:53.000Z
src/storage/blobfs/iterator/node_populator.cc
allansrc/fuchsia
a2c235b33fc4305044d496354a08775f30cdcf37
[ "BSD-2-Clause" ]
null
null
null
// Copyright 2018 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 "src/storage/blobfs/iterator/node_populator.h" #include <stdint.h> #include <zircon/types.h> #include <vector> #include <safemath/safe_conversions.h> #include "src/storage/blobfs/allocator/base_allocator.h" #include "src/storage/blobfs/format.h" #include "src/storage/blobfs/iterator/extent_iterator.h" namespace blobfs { NodePopulator::NodePopulator(BaseAllocator* allocator, std::vector<ReservedExtent> extents, std::vector<ReservedNode> nodes) : allocator_(allocator), extents_(std::move(extents)), nodes_(std::move(nodes)) { ZX_DEBUG_ASSERT(extents_.size() <= kMaxBlobExtents); ZX_DEBUG_ASSERT(nodes_.size() >= NodeCountForExtents(safemath::checked_cast<ExtentCountType>(extents_.size()))); } uint32_t NodePopulator::NodeCountForExtents(ExtentCountType extent_count) { bool out_of_line_extents = extent_count > kInlineMaxExtents; uint32_t remaining_extents = out_of_line_extents ? extent_count - kInlineMaxExtents : 0; return 1 + ((remaining_extents + kContainerMaxExtents - 1) / kContainerMaxExtents); } zx_status_t NodePopulator::Walk(OnNodeCallback on_node, OnExtentCallback on_extent) { // The first node is not an extent container, and must be treated differently. size_t node_count = 0; uint32_t node_index = nodes_[node_count].index(); auto inode = allocator_->GetNode(node_index); if (inode.is_error()) { return inode.status_value(); } allocator_->MarkInodeAllocated(std::move(nodes_[node_count])); on_node(node_index); ExtentContainer* container = nullptr; uint32_t local_index = 0; ExtentCountType extent_index = 0; for (; extent_index < extents_.size(); extent_index++) { bool next_container = false; if (extent_index == kInlineMaxExtents) { // At capacity for the extents inside the inode; moving to a container. ZX_DEBUG_ASSERT_MSG(nodes_.size() > node_count, "Not enough nodes to hold extents"); inode->header.next_node = nodes_[node_count + 1].index(); next_container = true; } else if (local_index == kContainerMaxExtents) { // At capacity for the extents within a container; moving to another container. ZX_DEBUG_ASSERT_MSG(nodes_.size() > node_count, "Not enough nodes to hold extents"); next_container = true; } if (next_container) { // Acquire the next container node, and connect it to the previous node. ReservedNode& node = nodes_[node_count + 1]; uint32_t next = node.index(); allocator_->MarkContainerNodeAllocated(std::move(node), node_index); container = allocator_->GetNode(next)->AsExtentContainer(); on_node(next); node_index = next; node_count++; local_index = 0; } // Copy the extent into the chosen container. IterationCommand command = on_extent(extents_[extent_index]); if (extent_index < kInlineMaxExtents) { inode->extents[local_index] = extents_[extent_index].extent(); } else { container->extents[local_index] = extents_[extent_index].extent(); container->extent_count++; } inode->extent_count++; if (command == IterationCommand::Stop) { break; } local_index++; } return ZX_OK; } } // namespace blobfs
35.164948
97
0.709763
[ "vector" ]
3e40563f28a7096f86d788a7be296db88c790122
2,427
cpp
C++
src/fluxions_renderer_shader.cpp
microwerx/fluxions-renderer
d461ac437e9c410577eeb609b52b6dd386e03b03
[ "MIT" ]
null
null
null
src/fluxions_renderer_shader.cpp
microwerx/fluxions-renderer
d461ac437e9c410577eeb609b52b6dd386e03b03
[ "MIT" ]
null
null
null
src/fluxions_renderer_shader.cpp
microwerx/fluxions-renderer
d461ac437e9c410577eeb609b52b6dd386e03b03
[ "MIT" ]
null
null
null
#include "fluxions_renderer_pch.hpp" #include <fluxions_renderer_base.hpp> #include <fluxions_renderer_shader.hpp> namespace Fluxions { bool CompileShaderFromFile(RendererShaderPtr& shader, GLenum type, const std::string& filename) { const char* typeName = (type == GL_VERTEX_SHADER) ? "vertex" : (type == GL_FRAGMENT_SHADER) ? "fragment" : (type == GL_GEOMETRY_SHADER) ? "geometry" : "unknown"; FilePathInfo fpi(filename); if (!fpi.isFile()) { HFLOGERROR("file '%s' does not exist", filename.c_str()); return false; } HFLOGDEBUG("loading %s shader `%s'", typeName, fpi.filename().c_str()); if (shader->shader == 0) { HFLOGERROR("%s shader could not be created!", typeName); return false; } shader->compileSource(ReadTextFile(filename)); if (shader->hadError) { HFLOGERROR("shader %d compile error for %s\n%s", shader->shader, fpi.filename().c_str(), shader->infoLog.c_str()); return false; } if (shader->didCompile) { HFLOGDEBUG("shader %d compiled", shader->shader); return true; } return false; } RendererShader::RendererShader() {} RendererShader::~RendererShader() {} void RendererShader::init(const std::string& name, RendererObject* pparent, GLenum shaderType_) { RendererObject::init(name, pparent); create_shader(shaderType_); } void RendererShader::kill() { RendererObject::kill(); delete_shader(); } const char* RendererShader::type() const noexcept { return "RendererShader"; } bool RendererShader::compileSource(const std::string& sourceCode) { source = sourceCode; const GLchar* sourceString = source.c_str(); const GLint length = (int)source.size(); glShaderSource(shader, 1, &sourceString, &length); glCompileShader(shader); GLint ival = 0; glGetShaderiv(shader, GL_COMPILE_STATUS, &ival); didCompile = (ival == GL_TRUE); hadError = (ival != GL_TRUE); glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &ival); infoLog.resize(ival); glGetShaderInfoLog(shader, ival, NULL, (GLchar*)&infoLog[0]); return didCompile; } const char* RendererShader::status() const { return didCompile ? "compiled" : hadError ? "had error" : "not compiled"; } void RendererShader::create_shader(GLenum shaderType_) { shaderType = shaderType_; source = ""; didCompile = false; hadError = false; FxCreateShader(shaderType_, &shader); } void RendererShader::delete_shader() { FxDeleteShader(&shader); } }
28.22093
117
0.701689
[ "geometry" ]
3e40de0efd0197f1c95cc8892d728549edddc89e
4,067
cpp
C++
lib/IRremoteESP8266/src/ir_Lasertag.cpp
Eliauk-Forever/JARVIS
69569e530f0bc66c90bc2ba2a266edb65006bd6f
[ "MulanPSL-1.0" ]
14
2019-07-09T09:38:59.000Z
2022-02-11T13:57:18.000Z
lib/IRremoteESP8266/src/ir_Lasertag.cpp
Eliauk-Forever/JARVIS
69569e530f0bc66c90bc2ba2a266edb65006bd6f
[ "MulanPSL-1.0" ]
null
null
null
lib/IRremoteESP8266/src/ir_Lasertag.cpp
Eliauk-Forever/JARVIS
69569e530f0bc66c90bc2ba2a266edb65006bd6f
[ "MulanPSL-1.0" ]
1
2021-06-26T22:26:58.000Z
2021-06-26T22:26:58.000Z
// Copyright 2017 David Conran /// @file /// @brief Support for Lasertag protocols. /// @see https://github.com/crankyoldgit/IRremoteESP8266/issues/366 // Supports: // Brand: Lasertag, Model: Phaser emitters #include <algorithm> #include "IRrecv.h" #include "IRsend.h" #include "IRutils.h" // Constants const uint16_t kLasertagMinSamples = 13; const uint16_t kLasertagTick = 333; const uint32_t kLasertagMinGap = kDefaultMessageGap; // Just a guess. const uint8_t kLasertagTolerance = 0; // Percentage error margin. const uint16_t kLasertagExcess = 0; // See kMarkExcess. const uint16_t kLasertagDelta = 165; // Use instead of Excess and Tolerance. const int16_t kSpace = 1; const int16_t kMark = 0; #if SEND_LASERTAG /// Send a Lasertag packet/message. /// Status: STABLE / Working. /// @param[in] data The message to be sent. /// @param[in] nbits The number of bits of message to be sent. /// @param[in] repeat The number of times the command is to be repeated. /// @note This protocol is pretty much just raw Manchester encoding. /// @todo Convert this to use `sendManchester()` if we can.` void IRsend::sendLasertag(uint64_t data, uint16_t nbits, uint16_t repeat) { if (nbits > sizeof(data) * 8) return; // We can't send something that big. // Set 36kHz IR carrier frequency & a 1/4 (25%) duty cycle. // NOTE: duty cycle is not confirmed. Just guessing based on RC5/6 protocols. enableIROut(36, 25); for (uint16_t i = 0; i <= repeat; i++) { // Data for (uint64_t mask = 1ULL << (nbits - 1); mask; mask >>= 1) if (data & mask) { // 1 space(kLasertagTick); // 1 is space, then mark. mark(kLasertagTick); } else { // 0 mark(kLasertagTick); // 0 is mark, then space. space(kLasertagTick); } // Footer space(kLasertagMinGap); } } #endif // SEND_LASERTAG #if DECODE_LASERTAG /// Decode the supplied Lasertag message. /// Status: BETA / Appears to be working 90% of the time. /// @param[in,out] results Ptr to the data to decode & where to store the result /// @param[in] offset The starting index to use when attempting to decode the /// raw data. Typically/Defaults to kStartOffset. /// @param[in] nbits The number of data bits to expect. /// @param[in] strict Flag indicating if we should perform strict matching. /// @return True if it can decode it, false if it can't. /// @note This protocol is pretty much just raw Manchester encoding. /// @see http://www.sbprojects.net/knowledge/ir/rc5.php /// @see https://en.wikipedia.org/wiki/RC-5 /// @see https://en.wikipedia.org/wiki/Manchester_code /// @todo Convert to using `matchManchester()` if we can. bool IRrecv::decodeLasertag(decode_results *results, uint16_t offset, const uint16_t nbits, const bool strict) { if (results->rawlen <= kLasertagMinSamples + offset) return false; // Compliance if (strict && nbits != kLasertagBits) return false; uint16_t used = 0; uint64_t data = 0; uint16_t actual_bits = 0; // No Header // Data for (; offset <= results->rawlen; actual_bits++) { int16_t levelA = getRClevel(results, &offset, &used, kLasertagTick, kLasertagTolerance, kLasertagExcess, kLasertagDelta); int16_t levelB = getRClevel(results, &offset, &used, kLasertagTick, kLasertagTolerance, kLasertagExcess, kLasertagDelta); if (levelA == kSpace && levelB == kMark) { data = (data << 1) | 1; // 1 } else { if (levelA == kMark && levelB == kSpace) { data <<= 1; // 0 } else { break; } } } // Footer (None) // Compliance if (actual_bits < nbits) return false; // Less data than we expected. if (strict && actual_bits != kLasertagBits) return false; // Success results->decode_type = LASERTAG; results->value = data; results->address = data & 0xF; // Unit results->command = data >> 4; // Team results->repeat = false; results->bits = actual_bits; return true; } #endif // DECODE_LASERTAG
34.760684
80
0.659208
[ "model" ]
3e4209fce1df0f0b4b577d578263b6a355cc9a3c
4,435
cc
C++
glue-src/greeter-py-object.cc
Quuxplusone/hello-extension
a77f4bb18d0bb22dad2ddcb5eb58b7764ec45b6c
[ "MIT" ]
3
2019-08-07T19:30:46.000Z
2019-08-30T19:55:26.000Z
glue-src/greeter-py-object.cc
Quuxplusone/hello-extension
a77f4bb18d0bb22dad2ddcb5eb58b7764ec45b6c
[ "MIT" ]
null
null
null
glue-src/greeter-py-object.cc
Quuxplusone/hello-extension
a77f4bb18d0bb22dad2ddcb5eb58b7764ec45b6c
[ "MIT" ]
null
null
null
#include <Python.h> #include "core-src/greeter.h" namespace { struct GreeterPyObject { PyObject_HEAD HelloWorld::Greeter *obj_; static int init(PyObject *self_, PyObject *args, PyObject *kwargs) { GreeterPyObject *self = reinterpret_cast<GreeterPyObject *>(self_); const char *who = nullptr; if (!PyArg_ParseTuple(args, "s", &who)) { // `PyArg_ParseTuple` has already taken care of setting up the // appropriate exception to be raised in this case. return -1; } self->obj_ = new HelloWorld::Greeter(who); return 0; } static void dealloc(PyObject *self_) { GreeterPyObject *self = reinterpret_cast<GreeterPyObject *>(self_); delete self->obj_; Py_TYPE(self)->tp_free(self); } static PyObject *get_greeting(PyObject *self_, PyObject *args) { GreeterPyObject *self = reinterpret_cast<GreeterPyObject *>(self_); if (!PyArg_ParseTuple(args, "")) { // `PyArg_ParseTuple` has already taken care of setting up the // appropriate exception to be raised in this case. return nullptr; } std::string result = self->obj_->get_greeting(); return Py_BuildValue("s", result.c_str()); } static PyObject *repr(PyObject *self_) { GreeterPyObject *self = reinterpret_cast<GreeterPyObject *>(self_); PyObject *who = Py_BuildValue("s", self->obj_->get_who().c_str()); PyObject *repr_of_who = PyObject_Repr(who); PyObject *bytes_in_repr_of_who = PyUnicode_AsUTF8String(repr_of_who); const char *s = PyBytes_AsString(bytes_in_repr_of_who); std::string result = "libhelloworld.Greeter(" + std::string(s) + ")"; Py_DECREF(bytes_in_repr_of_who); Py_DECREF(repr_of_who); Py_DECREF(who); return Py_BuildValue("s", result.c_str()); } static PyObject *str(PyObject *self_) { GreeterPyObject *self = reinterpret_cast<GreeterPyObject *>(self_); std::string result = self->obj_->get_greeting(); return Py_BuildValue("s", result.c_str()); } }; } // anonymous namespace PyObject *make_GreeterPyObject_type() { static constexpr PyMethodDef methods[] = { { "get_greeting", GreeterPyObject::get_greeting, METH_VARARGS, "return the greeting" }, { nullptr, nullptr, 0, nullptr }, }; static PyTypeObject type = { PyVarObject_HEAD_INIT(NULL, 0) "libhelloworld.Greeter", // tp_name sizeof(GreeterPyObject), // tp_basicsize 0, // tp_itemsize GreeterPyObject::dealloc, // tp_dealloc nullptr, // tp_print nullptr, // tp_getattr nullptr, // tp_setattr nullptr, // tp_as_async GreeterPyObject::repr, // tp_repr nullptr, // tp_as_number nullptr, // tp_as_sequence nullptr, // tp_as_mapping nullptr, // tp_hash nullptr, // tp_call GreeterPyObject::str, // tp_str nullptr, // tp_getattro nullptr, // tp_setattro nullptr, // tp_as_buffer Py_TPFLAGS_DEFAULT, // tp_flags "An object that can store a greeting and deliver it later", // tp_doc nullptr, // tp_traverse nullptr, // tp_clear nullptr, // tp_richcompare 0, // tp_weaklistoffset nullptr, // tp_iter nullptr, // tp_iternext const_cast<PyMethodDef*>(methods), // tp_methods nullptr, // tp_members nullptr, // tp_getset nullptr, // tp_base nullptr, // tp_dict nullptr, // tp_descr_get nullptr, // tp_descr_set 0, // tp_dictoffset GreeterPyObject::init, // tp_init nullptr, // tp_alloc PyType_GenericNew, // tp_new nullptr, // tp_free nullptr, // tp_is_gc nullptr, // tp_bases nullptr, // tp_mro nullptr, // tp_cache nullptr, // tp_subclasses nullptr, // tp_weaklist nullptr, // tp_del 0, // tp_version_tag nullptr, // tp_finalize }; if (PyType_Ready(&type) != 0) { // `PyType_Ready` has already taken care of setting up the // appropriate exception to be raised in this case. return nullptr; } Py_INCREF(&type); return reinterpret_cast<PyObject *>(&type); }
34.379845
95
0.601353
[ "object" ]
3e428235acb03efef5af4d27f05e28a7d28cbfe0
12,401
cc
C++
content/browser/background_fetch/background_fetch_delegate_proxy.cc
zealoussnow/chromium
fd8a8914ca0183f0add65ae55f04e287543c7d4a
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
14,668
2015-01-01T01:57:10.000Z
2022-03-31T23:33:32.000Z
content/browser/background_fetch/background_fetch_delegate_proxy.cc
zealoussnow/chromium
fd8a8914ca0183f0add65ae55f04e287543c7d4a
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
86
2015-10-21T13:02:42.000Z
2022-03-14T07:50:50.000Z
content/browser/background_fetch/background_fetch_delegate_proxy.cc
zealoussnow/chromium
fd8a8914ca0183f0add65ae55f04e287543c7d4a
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
5,941
2015-01-02T11:32:21.000Z
2022-03-31T16:35:46.000Z
// Copyright 2017 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "content/browser/background_fetch/background_fetch_delegate_proxy.h" #include <utility> #include "base/bind.h" #include "components/download/public/common/download_item.h" #include "components/download/public/common/download_url_parameters.h" #include "content/browser/background_fetch/background_fetch_job_controller.h" #include "content/browser/permissions/permission_controller_impl.h" #include "content/browser/renderer_host/render_frame_host_impl.h" #include "content/browser/storage_partition_impl.h" #include "content/public/browser/background_fetch_description.h" #include "content/public/browser/background_fetch_response.h" #include "content/public/browser/browser_context.h" #include "content/public/browser/browser_task_traits.h" #include "content/public/browser/download_manager.h" #include "content/public/browser/permission_type.h" #include "content/public/browser/web_contents.h" #include "third_party/blink/public/mojom/blob/serialized_blob.mojom.h" #include "third_party/skia/include/core/SkBitmap.h" #include "ui/gfx/geometry/size.h" namespace content { BackgroundFetchDelegateProxy::BackgroundFetchDelegateProxy( base::WeakPtr<StoragePartitionImpl> storage_partition) : storage_partition_(std::move(storage_partition)) { DCHECK_CURRENTLY_ON(BrowserThread::UI); DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); } BackgroundFetchDelegateProxy::~BackgroundFetchDelegateProxy() { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); } void BackgroundFetchDelegateProxy::SetClickEventDispatcher( DispatchClickEventCallback callback) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); click_event_dispatcher_callback_ = std::move(callback); } void BackgroundFetchDelegateProxy::GetIconDisplaySize( BackgroundFetchDelegate::GetIconDisplaySizeCallback callback) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); if (auto* delegate = GetDelegate()) { delegate->GetIconDisplaySize(std::move(callback)); } else { std::move(callback).Run(gfx::Size(0, 0)); } } void BackgroundFetchDelegateProxy::GetPermissionForOrigin( const url::Origin& origin, RenderFrameHostImpl* rfh, GetPermissionForOriginCallback callback) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); BackgroundFetchPermission result = BackgroundFetchPermission::BLOCKED; if (auto* controller = GetPermissionController()) { // Use GetPermissionStatusForFrame() only if the fetch is started from // a top-level document. Permissions need to go through the // DownloadRequestLimiter in that case. // TODO(falken): Consider using GetPermissionStatusForFrame() for any `rfh`. // The code may currently not be doing that just for historical reasons. // Previously a WebContents was plumbed here instead of a // RenderFrameHostImpl, and it was only set for the top-level document, so // there was no way to get the RenderFrameHostImpl for subframes. if (rfh && rfh->GetParent()) rfh = nullptr; blink::mojom::PermissionStatus permission_status = rfh ? controller->GetPermissionStatusForFrame( PermissionType::BACKGROUND_FETCH, rfh, /*requesting_origin=*/origin.GetURL()) : controller->GetPermissionStatus( PermissionType::BACKGROUND_FETCH, /*requesting_origin=*/origin.GetURL(), /*embedding_origin=*/origin.GetURL()); switch (permission_status) { case blink::mojom::PermissionStatus::GRANTED: result = BackgroundFetchPermission::ALLOWED; break; case blink::mojom::PermissionStatus::DENIED: result = BackgroundFetchPermission::BLOCKED; break; case blink::mojom::PermissionStatus::ASK: result = BackgroundFetchPermission::ASK; break; } } std::move(callback).Run(result); } void BackgroundFetchDelegateProxy::CreateDownloadJob( base::WeakPtr<Controller> controller, std::unique_ptr<BackgroundFetchDescription> fetch_description) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); DCHECK(!controller_map_.count(fetch_description->job_unique_id)); controller_map_[fetch_description->job_unique_id] = std::move(controller); auto* delegate = GetDelegate(); if (delegate) { delegate->CreateDownloadJob(weak_ptr_factory_.GetWeakPtr(), std::move(fetch_description)); } } void BackgroundFetchDelegateProxy::StartRequest( const std::string& job_unique_id, const url::Origin& origin, const scoped_refptr<BackgroundFetchRequestInfo>& request) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); DCHECK(controller_map_.count(job_unique_id)); DCHECK(request); DCHECK(!request->download_guid().empty()); auto* delegate = GetDelegate(); if (!delegate) return; const blink::mojom::FetchAPIRequestPtr& fetch_request = request->fetch_request(); const net::NetworkTrafficAnnotationTag traffic_annotation( net::DefineNetworkTrafficAnnotation("background_fetch_context", R"( semantics { sender: "Background Fetch API" description: "The Background Fetch API enables developers to upload or " "download files on behalf of the user. Such fetches will yield " "a user visible notification to inform the user of the " "operation, through which it can be suspended, resumed and/or " "cancelled. The developer retains control of the file once the " "fetch is completed, similar to XMLHttpRequest and other " "mechanisms for fetching resources using JavaScript." trigger: "When the website uses the Background Fetch API to request " "fetching a file and/or a list of files. This is a Web " "Platform API for which no express user permission is required." data: "The request headers and data as set by the website's " "developer." destination: WEBSITE } policy { cookies_allowed: YES cookies_store: "user" setting: "This feature cannot be disabled in settings." policy_exception_justification: "Not implemented." })")); // TODO(peter): The |headers| should be populated with all the properties // set in the |fetch_request| structure. net::HttpRequestHeaders headers; for (const auto& pair : fetch_request->headers) headers.SetHeader(pair.first, pair.second); // Append the Origin header for requests whose CORS flag is set, or whose // request method is not GET or HEAD. See section 3.1 of the standard: // https://fetch.spec.whatwg.org/#origin-header if (fetch_request->mode == network::mojom::RequestMode::kCors || fetch_request->mode == network::mojom::RequestMode::kCorsWithForcedPreflight || (fetch_request->method != "GET" && fetch_request->method != "HEAD")) { headers.SetHeader("Origin", origin.Serialize()); } delegate->DownloadUrl( job_unique_id, request->download_guid(), fetch_request->method, fetch_request->url, fetch_request->credentials_mode, traffic_annotation, headers, /* has_request_body= */ request->request_body_size() > 0u); } void BackgroundFetchDelegateProxy::UpdateUI( const std::string& job_unique_id, const absl::optional<std::string>& title, const absl::optional<SkBitmap>& icon, blink::mojom::BackgroundFetchRegistrationService::UpdateUICallback update_ui_callback) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); DCHECK(!update_ui_callback_map_.count(job_unique_id)); update_ui_callback_map_.emplace(job_unique_id, std::move(update_ui_callback)); if (auto* delegate = GetDelegate()) delegate->UpdateUI(job_unique_id, title, icon); } void BackgroundFetchDelegateProxy::Abort(const std::string& job_unique_id) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); if (auto* delegate = GetDelegate()) delegate->Abort(job_unique_id); } void BackgroundFetchDelegateProxy::MarkJobComplete( const std::string& job_unique_id) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); if (auto* delegate = GetDelegate()) delegate->MarkJobComplete(job_unique_id); controller_map_.erase(job_unique_id); } void BackgroundFetchDelegateProxy::OnJobCancelled( const std::string& job_unique_id, blink::mojom::BackgroundFetchFailureReason reason_to_abort) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); DCHECK( reason_to_abort == blink::mojom::BackgroundFetchFailureReason::CANCELLED_FROM_UI || reason_to_abort == blink::mojom::BackgroundFetchFailureReason::DOWNLOAD_TOTAL_EXCEEDED); auto it = controller_map_.find(job_unique_id); if (it == controller_map_.end()) return; if (const auto& controller = it->second) controller->AbortFromDelegate(reason_to_abort); } void BackgroundFetchDelegateProxy::OnDownloadStarted( const std::string& job_unique_id, const std::string& guid, std::unique_ptr<BackgroundFetchResponse> response) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); auto it = controller_map_.find(job_unique_id); if (it == controller_map_.end()) return; if (const auto& controller = it->second) controller->DidStartRequest(guid, std::move(response)); } void BackgroundFetchDelegateProxy::OnUIActivated( const std::string& job_unique_id) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); DCHECK(click_event_dispatcher_callback_); click_event_dispatcher_callback_.Run(job_unique_id); } void BackgroundFetchDelegateProxy::OnUIUpdated( const std::string& job_unique_id) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); auto it = update_ui_callback_map_.find(job_unique_id); if (it == update_ui_callback_map_.end()) return; DCHECK(it->second); std::move(it->second).Run(blink::mojom::BackgroundFetchError::NONE); update_ui_callback_map_.erase(it); } void BackgroundFetchDelegateProxy::OnDownloadUpdated( const std::string& job_unique_id, const std::string& guid, uint64_t bytes_uploaded, uint64_t bytes_downloaded) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); auto it = controller_map_.find(job_unique_id); if (it == controller_map_.end()) return; if (const auto& controller = it->second) controller->DidUpdateRequest(guid, bytes_uploaded, bytes_downloaded); } void BackgroundFetchDelegateProxy::OnDownloadComplete( const std::string& job_unique_id, const std::string& guid, std::unique_ptr<BackgroundFetchResult> result) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); auto it = controller_map_.find(job_unique_id); if (it == controller_map_.end()) return; if (const auto& controller = it->second) controller->DidCompleteRequest(guid, std::move(result)); } void BackgroundFetchDelegateProxy::GetUploadData( const std::string& job_unique_id, const std::string& download_guid, BackgroundFetchDelegate::GetUploadDataCallback callback) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); auto it = controller_map_.find(job_unique_id); if (it == controller_map_.end()) { std::move(callback).Run(nullptr); return; } if (const auto& controller = it->second) controller->GetUploadData(download_guid, std::move(callback)); else std::move(callback).Run(nullptr); } BrowserContext* BackgroundFetchDelegateProxy::GetBrowserContext() { if (!storage_partition_) return nullptr; return storage_partition_->browser_context(); } BackgroundFetchDelegate* BackgroundFetchDelegateProxy::GetDelegate() { auto* browser_context = GetBrowserContext(); if (!browser_context) return nullptr; return browser_context->GetBackgroundFetchDelegate(); } PermissionControllerImpl* BackgroundFetchDelegateProxy::GetPermissionController() { auto* browser_context = GetBrowserContext(); if (!browser_context) return nullptr; return PermissionControllerImpl::FromBrowserContext(browser_context); } } // namespace content
36.907738
80
0.73228
[ "geometry" ]
3e4332458582327a6162dae084c89fea2f38040a
957
cpp
C++
test/io/peek.cpp
freundlich/fcppt
17df1b1ad08bf2435f6902d5465e3bc3fe5e3022
[ "BSL-1.0" ]
13
2015-02-21T18:35:14.000Z
2019-12-29T14:08:29.000Z
test/io/peek.cpp
cpreh/fcppt
17df1b1ad08bf2435f6902d5465e3bc3fe5e3022
[ "BSL-1.0" ]
5
2016-08-27T07:35:47.000Z
2019-04-21T10:55:34.000Z
test/io/peek.cpp
freundlich/fcppt
17df1b1ad08bf2435f6902d5465e3bc3fe5e3022
[ "BSL-1.0" ]
8
2015-01-10T09:22:37.000Z
2019-12-01T08:31:12.000Z
// Copyright Carl Philipp Reh 2009 - 2021. // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) #include <fcppt/catch/begin.hpp> #include <fcppt/catch/end.hpp> #include <fcppt/io/peek.hpp> #include <fcppt/optional/object.hpp> #include <fcppt/optional/output.hpp> #include <fcppt/config/external_begin.hpp> #include <catch2/catch.hpp> #include <sstream> #include <fcppt/config/external_end.hpp> FCPPT_CATCH_BEGIN TEST_CASE("io::peek", "[io]") { using optional_char = fcppt::optional::object<char>; { // NOLINTNEXTLINE(fuchsia-default-arguments-calls) std::istringstream stream{"x"}; CHECK(fcppt::io::peek(stream) == optional_char{'x'}); } { // NOLINTNEXTLINE(fuchsia-default-arguments-calls) std::istringstream stream{}; CHECK(fcppt::io::peek(stream) == optional_char{}); } } FCPPT_CATCH_END
25.184211
61
0.69906
[ "object" ]
3e437cdb740bfe4e91405f1f9bea04a1290539a1
1,846
cpp
C++
src/gamebase/src/impl/skin/AnimatedObject.cpp
TheMrButcher/opengl_lessons
76ac96c45773a54a85d49c6994770b0c3496303f
[ "MIT" ]
1
2016-10-25T21:15:16.000Z
2016-10-25T21:15:16.000Z
src/gamebase/src/impl/skin/AnimatedObject.cpp
TheMrButcher/gamebase
76ac96c45773a54a85d49c6994770b0c3496303f
[ "MIT" ]
375
2016-06-04T11:27:40.000Z
2019-04-14T17:11:09.000Z
src/gamebase/src/impl/skin/AnimatedObject.cpp
TheMrButcher/gamebase
76ac96c45773a54a85d49c6994770b0c3496303f
[ "MIT" ]
null
null
null
/** * Copyright (c) 2018 Slavnejshev Filipp * This file is licensed under the terms of the MIT license. */ #include <stdafx.h> #include <gamebase/impl/skin/tools/AnimatedObject.h> #include <gamebase/impl/serial/IDeserializer.h> #include <gamebase/impl/serial/ISerializer.h> namespace gamebase { namespace impl { void AnimatedObject::setSelectionState(SelectionState::Enum state) { m_selectionState = state; m_animManager.resetChannel(0); auto it = m_animations.find(state); if (it != m_animations.end()) { m_animManager.addAnimation(it->second, 0); } else { it = m_animations.find(SelectionState::None); if (it != m_animations.end()) m_animManager.addAnimation(it->second, 0); } } void AnimatedObject::loadResources() { m_skinElements.loadResources(); for (auto it = m_animations.begin(); it != m_animations.end(); ++it) it->second->load(m_register); m_animManager.start(); } void AnimatedObject::setBox(const BoundingBox& allowedBox) { m_box->setParentBox(allowedBox); m_skinElements.setBox(m_box->get()); m_geom->setBox(m_box->get()); } void AnimatedObject::serialize(Serializer& s) const { s << "box" << m_box << "geometry" << m_geom << "animations" << m_animations << "elements" << m_skinElements.objects(); } void deserializeAnimatedObjectElements( Deserializer& deserializer, AnimatedObject* obj) { typedef std::map<SelectionState::Enum, std::shared_ptr<IAnimation>> Animations; DESERIALIZE(Animations, animations); DESERIALIZE(std::vector<std::shared_ptr<IObject>>, elements); for (auto it = animations.begin(); it != animations.end(); ++it) obj->setTransitAnimation(it->first, it->second); for (auto it = elements.begin(); it != elements.end(); ++it) obj->addElement(*it); } } }
30.262295
83
0.679307
[ "geometry", "vector" ]
3e4474a728fe05b6767b433e4b4f08f737ec2164
6,952
cpp
C++
libs/maps/src/maps/CPointCloudFilterByDistance.cpp
skair39/mrpt
88238f8ac1abdcf15401e14dc3a9faa5c59ba559
[ "BSD-3-Clause" ]
2
2019-02-20T02:36:05.000Z
2019-02-20T02:46:51.000Z
libs/maps/src/maps/CPointCloudFilterByDistance.cpp
skair39/mrpt
88238f8ac1abdcf15401e14dc3a9faa5c59ba559
[ "BSD-3-Clause" ]
null
null
null
libs/maps/src/maps/CPointCloudFilterByDistance.cpp
skair39/mrpt
88238f8ac1abdcf15401e14dc3a9faa5c59ba559
[ "BSD-3-Clause" ]
null
null
null
/* +------------------------------------------------------------------------+ | Mobile Robot Programming Toolkit (MRPT) | | http://www.mrpt.org/ | | | | Copyright (c) 2005-2019, Individual contributors, see AUTHORS file | | See: http://www.mrpt.org/Authors - All rights reserved. | | Released under BSD License. See details in http://www.mrpt.org/License | +------------------------------------------------------------------------+ */ #include "maps-precomp.h" // Precomp header #include <mrpt/maps/CPointCloudFilterByDistance.h> #include <mrpt/config/CConfigFileBase.h> #include <mrpt/core/aligned_std_vector.h> using namespace mrpt::maps; void CPointCloudFilterByDistance::filter( /** [in,out] The input pointcloud, which will be modified upon return after filtering. */ mrpt::maps::CPointsMap* pc, /** [in] The timestamp of the input pointcloud */ const mrpt::system::TTimeStamp pc_timestamp, /** [in] If nullptr, the PC is assumed to be given in global coordinates. Otherwise, it will be transformed from local coordinates to global using this transformation. */ const mrpt::poses::CPose3D& cur_pc_pose, /** [in,out] additional in/out parameters */ TExtraFilterParams* params) { using namespace mrpt::poses; using namespace mrpt::math; using mrpt::square; MRPT_START; ASSERT_(pc_timestamp != INVALID_TIMESTAMP); ASSERT_(pc != nullptr); auto original_pc = CSimplePointsMap::Create(); (*original_pc) = (*pc); // make deep copy // 1) Filter: // --------------------- const size_t N = pc->size(); std::vector<bool> deletion_mask; deletion_mask.assign(N, false); size_t del_count = 0; // get reference, previous PC: ASSERT_(options.previous_keyframes >= 1); bool can_do_filter = true; std::vector<FrameInfo*> prev_pc; // (options.previous_keyframes, nullptr); { auto it = m_last_frames.rbegin(); for (int i = 0; i < options.previous_keyframes && it != m_last_frames.rend(); ++i, ++it) { prev_pc.push_back(&it->second); } } if (prev_pc.size() < static_cast<size_t>(options.previous_keyframes)) { can_do_filter = false; } else { for (int i = 0; can_do_filter && i < options.previous_keyframes; ++i) { if (mrpt::system::timeDifference( m_last_frames.rbegin()->first, pc_timestamp) > options.too_old_seconds) { can_do_filter = false; // A required keyframe is too old break; } } } if (can_do_filter) { // Reference poses of each PC: // Previous: prev_pc.pose mrpt::aligned_std_vector<CPose3D> rel_poses; for (int k = 0; k < options.previous_keyframes; ++k) { const CPose3D rel_pose = cur_pc_pose - prev_pc[k]->pose; rel_poses.push_back(rel_pose); } // The idea is that we can now find matches between pt{i} in time_{k}, // composed with rel_pose // with the local points in time_{k-1}. std::vector<TPoint3D> pt_km1(options.previous_keyframes); for (size_t i = 0; i < N; i++) { // get i-th point in time=k: TPoint3Df ptf_k; pc->getPointFast(i, ptf_k.x, ptf_k.y, ptf_k.z); const TPoint3D pt_k = TPoint3D(ptf_k); // Point, referred to time=k-1 frame of reference for (int k = 0; k < options.previous_keyframes; ++k) rel_poses[k].composePoint(pt_k, pt_km1[k]); // Look for neighbors in "time=k" std::vector<TPoint3D> neig_k; std::vector<float> neig_sq_dist_k; pc->kdTreeNClosestPoint3D( pt_k, 2 /*num queries*/, neig_k, neig_sq_dist_k); // Look for neighbors in "time=k-i" std::vector<TPoint3D> neig_kmi(options.previous_keyframes); std::vector<float> neig_sq_dist_kmi( options.previous_keyframes, std::numeric_limits<float>::max()); for (int k = 0; k < options.previous_keyframes; ++k) { for (int prev_tim_idx = 0; prev_tim_idx < options.previous_keyframes; prev_tim_idx++) { if (prev_pc[prev_tim_idx]->pc->size() > 0) { prev_pc[prev_tim_idx]->pc->kdTreeClosestPoint3D( pt_km1[prev_tim_idx], neig_kmi[prev_tim_idx], neig_sq_dist_kmi[prev_tim_idx]); } } } // Rule: // we must have at least 1 neighbor in t=k, and 1 neighbor in t=k-i const double max_allowed_dist_sq = square( options.min_dist + options.angle_tolerance * pt_k.norm()); bool ok_total = true; const bool ok_t = neig_k.size() > 1 && neig_sq_dist_k[1] < max_allowed_dist_sq; ok_total = ok_total && ok_t; for (int k = 0; k < options.previous_keyframes; ++k) { const bool ok_tm1 = neig_sq_dist_kmi[k] < max_allowed_dist_sq; ok_total = ok_total && ok_tm1; } // Delete? const bool do_delete = !(ok_total); deletion_mask[i] = do_delete; if (do_delete) del_count++; } // Remove points: if ((params == nullptr || params->do_not_delete == false) && N > 0 && del_count / double(N) < options.max_deletion_ratio // If we are deleting too many // points, it may be that the filter // is plainly wrong ) { pc->applyDeletionMask(deletion_mask); } } // we can do filter if (params != nullptr && params->out_deletion_mask != nullptr) { *params->out_deletion_mask = deletion_mask; } // 2) Add PC to list // --------------------- { FrameInfo fi; fi.pc = original_pc; fi.pose = cur_pc_pose; m_last_frames[pc_timestamp] = fi; } // 3) Remove too-old PCs. // --------------------- for (auto it = m_last_frames.begin(); it != m_last_frames.end();) { if (mrpt::system::timeDifference(it->first, pc_timestamp) > options.too_old_seconds) { it = m_last_frames.erase(it); } else { ++it; } } MRPT_END; } CPointCloudFilterByDistance::TOptions::TOptions() : angle_tolerance(mrpt::DEG2RAD(5)) { } void CPointCloudFilterByDistance::TOptions::loadFromConfigFile( const mrpt::config::CConfigFileBase& c, const std::string& s) { MRPT_LOAD_CONFIG_VAR(min_dist, double, c, s); MRPT_LOAD_CONFIG_VAR_DEGREES(angle_tolerance, c, s); MRPT_LOAD_CONFIG_VAR(too_old_seconds, double, c, s); MRPT_LOAD_CONFIG_VAR(previous_keyframes, int, c, s); MRPT_LOAD_CONFIG_VAR(max_deletion_ratio, double, c, s); } void CPointCloudFilterByDistance::TOptions::saveToConfigFile( mrpt::config::CConfigFileBase& c, const std::string& s) const { MRPT_SAVE_CONFIG_VAR_COMMENT(min_dist, ""); MRPT_SAVE_CONFIG_VAR_DEGREES_COMMENT( "angle_tolerance", angle_tolerance, ""); MRPT_SAVE_CONFIG_VAR_COMMENT(too_old_seconds, ""); MRPT_SAVE_CONFIG_VAR_COMMENT( previous_keyframes, "(Default: 1) How many previous keyframes will be compared with the " "latest pointcloud."); MRPT_SAVE_CONFIG_VAR_COMMENT( max_deletion_ratio, "(Default: 0.4) If the ratio [0,1] of points considered invalid " "(`deletion` ) is larger than this ratio, no point will be deleted " "since it'd be too suspicious and may indicate a failure of this " "filter."); }
29.333333
80
0.648446
[ "vector" ]
3e44eaae3dd72ba3fde6bc137545be0e03c9b15c
1,999
cpp
C++
hello-world/TacoCat/hello.cpp
Pharphunuse/pr-practice
230bce1a167dce33f26bef18ae3eea986bf0d7d4
[ "MIT" ]
6
2021-12-08T00:37:50.000Z
2021-12-24T22:04:39.000Z
hello-world/TacoCat/hello.cpp
Pharphunuse/pr-practice
230bce1a167dce33f26bef18ae3eea986bf0d7d4
[ "MIT" ]
19
2021-12-07T07:11:22.000Z
2022-03-09T01:55:51.000Z
hello-world/TacoCat/hello.cpp
sjtolley9/pr-practice
7406d6fe88f6d8b88385ae53d298d1560e741f59
[ "MIT" ]
9
2021-12-07T07:11:35.000Z
2022-02-10T05:01:09.000Z
#include "RendererConsole.hpp" #include <fstream> #include <iostream> #include <iterator> #include <vector> std::vector<std::vector<char>> ReadFile(int& maxRow); int main() { int maxRow = 0; auto vec = ReadFile(maxRow); std::uint8_t rows = static_cast<std::uint8_t>(rlutil::trows()); if (maxRow > rows) { std::cout << "Please make your terminal taller" << std::endl; return 0; } std::uint8_t columns = static_cast<std::uint8_t>(rlutil::tcols()); if (vec.size() > columns) { std::cout << "Please make your terminal wider" << std::endl; return 0; } auto render = RendererConsole(vec.size(), maxRow, vec); while (!render.Render()) ; return 0; } // Makes our vector of vectors containing the strings from the file std::vector<std::vector<char>> ReadFile(int& maxRow) { std::fstream figlet; figlet.open("figlet.txt", std::ios::in); std::vector<std::vector<char>> vec; int row = 0; if (figlet.is_open()) { auto temp = new std::vector<char>; for (std::istreambuf_iterator<char> i(figlet), e; i != e; i++, row++) { if (*i == '\n') { // we hit the end of the line, add our vector on and make a new one for // the next row vec.push_back(*temp); temp = new std::vector<char>; // check our maxRow every time we hit a new line character if (row > maxRow) { maxRow = row; } row = 0; } else { temp->push_back(*i); } } // standardize all the vectors to have the same length for (int i = 0; i < vec.size(); i++) { while (vec[i].size() != maxRow) { vec[i].push_back(' '); } } } figlet.close(); return vec; }
24.084337
87
0.497249
[ "render", "vector" ]
3e56a90b401ae1feb7ced789d640893616e819f8
26,575
cpp
C++
dev/Code/CryEngine/CryEntitySystem/PhysicsEventListener.cpp
horvay/lumberyardtutor
63b0681a7ed2a98d651b699984de92951721353e
[ "AML" ]
5
2018-08-17T21:05:55.000Z
2021-04-17T10:48:26.000Z
dev/Code/CryEngine/CryEntitySystem/PhysicsEventListener.cpp
JulianoCristian/Lumberyard-3
dc523dd780f3cd1874251181b7cf6848b8db9959
[ "AML" ]
null
null
null
dev/Code/CryEngine/CryEntitySystem/PhysicsEventListener.cpp
JulianoCristian/Lumberyard-3
dc523dd780f3cd1874251181b7cf6848b8db9959
[ "AML" ]
5
2017-12-05T16:36:00.000Z
2021-04-27T06:33:54.000Z
/* * All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or * its licensors. * * For complete copyright and license terms please see the LICENSE at the root of this * distribution (the "License"). All use of this software is governed by the License, * or, if provided, by the license below or the license accompanying this file. Do not * remove or modify any license notices. This file is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * */ // Original file Copyright Crytek GMBH or its affiliates, used under license. #include "stdafx.h" #include "PhysicsEventListener.h" #include "IBreakableManager.h" #include "EntityObject.h" #include "Entity.h" #include "EntitySystem.h" #include "EntityCVars.h" #include "BreakableManager.h" #include <IPhysics.h> #include <IParticles.h> #include <ParticleParams.h> #include "IAISystem.h" #include <ICodeCheckpointMgr.h> std::vector<CPhysicsEventListener::PhysVisAreaUpdate> CPhysicsEventListener::m_physVisAreaUpdateVector; ////////////////////////////////////////////////////////////////////////// CPhysicsEventListener::CPhysicsEventListener(CEntitySystem* pEntitySystem, IPhysicalWorld* pPhysics) { assert(pEntitySystem); assert(pPhysics); m_pEntitySystem = pEntitySystem; m_pPhysics = pPhysics; RegisterPhysicCallbacks(); } ////////////////////////////////////////////////////////////////////////// CPhysicsEventListener::~CPhysicsEventListener() { UnregisterPhysicCallbacks(); m_pPhysics->SetPhysicsEventClient(NULL); } ////////////////////////////////////////////////////////////////////////// IEntity* CPhysicsEventListener::GetEntity(IPhysicalEntity* pPhysEntity) { assert(pPhysEntity); return static_cast<IEntity*>(pPhysEntity->GetForeignData(PHYS_FOREIGN_ID_ENTITY)); } ////////////////////////////////////////////////////////////////////////// IEntity* CPhysicsEventListener::GetEntity(void* pForeignData, int iForeignData) { if (PHYS_FOREIGN_ID_ENTITY == iForeignData) { return static_cast<IEntity*>(pForeignData); } return nullptr; } ////////////////////////////////////////////////////////////////////////// int CPhysicsEventListener::OnPostStep(const EventPhys* pEvent) { EventPhysPostStep* pPostStep = (EventPhysPostStep*)pEvent; IEntity* pEntity = GetEntity(pPostStep->pForeignData, pPostStep->iForeignData); IRenderNode* pRndNode = 0; if (pEntity) { if (IComponentPhysicsPtr pPhysicsComponent = pEntity->GetComponent<IComponentPhysics>()) { pPhysicsComponent->OnPhysicsPostStep(pPostStep); } if (IComponentRenderPtr renderComponent = pEntity->GetComponent<IComponentRender>()) { pRndNode = pEntity->GetComponent<IComponentRender>()->GetRenderNode(); } } else if (pPostStep->iForeignData == PHYS_FOREIGN_ID_ROPE) { IRopeRenderNode* pRenderNode = (IRopeRenderNode*)pPostStep->pForeignData; if (pRenderNode) { pRenderNode->OnPhysicsPostStep(); } pRndNode = pRenderNode; } if (pRndNode) { pe_params_flags pf; int bInvisible = 0, bFaraway = 0; int bEnableOpt = CVar::es_UsePhysVisibilityChecks; float dist = (pRndNode->GetBBox().GetCenter() - GetISystem()->GetViewCamera().GetPosition()).len2(); float maxDist = pPostStep->pEntity->GetType() != PE_SOFT ? CVar::es_MaxPhysDist : CVar::es_MaxPhysDistCloth; bInvisible = bEnableOpt & (isneg(pRndNode->GetDrawFrame() + 10 - gEnv->pRenderer->GetFrameID()) | isneg(sqr(maxDist) - dist)); if (pRndNode->m_nInternalFlags & IRenderNode::WAS_INVISIBLE ^ (-bInvisible & IRenderNode::WAS_INVISIBLE)) { pf.flagsAND = ~pef_invisible; pf.flagsOR = -bInvisible & pef_invisible; pPostStep->pEntity->SetParams(&pf); (pRndNode->m_nInternalFlags &= ~IRenderNode::WAS_INVISIBLE) |= -bInvisible & IRenderNode::WAS_INVISIBLE; } if (gEnv->p3DEngine->GetWaterLevel() != WATER_LEVEL_UNKNOWN) { // Deferred updating ignore ocean flag as the Jobs are busy updating the octree at this point m_physVisAreaUpdateVector.push_back(PhysVisAreaUpdate(pRndNode, pPostStep->pEntity)); } bFaraway = bEnableOpt & isneg(sqr(maxDist) + bInvisible * (sqr(CVar::es_MaxPhysDistInvisible) - sqr(maxDist)) - dist); if (bFaraway && !(pRndNode->m_nInternalFlags & IRenderNode::WAS_FARAWAY)) { pe_params_foreign_data pfd; pPostStep->pEntity->GetParams(&pfd); bFaraway &= -(pfd.iForeignFlags & PFF_UNIMPORTANT) >> 31; } if ((-bFaraway & IRenderNode::WAS_FARAWAY) != (pRndNode->m_nInternalFlags & IRenderNode::WAS_FARAWAY)) { pe_params_timeout pto; pto.timeIdle = 0; pto.maxTimeIdle = bFaraway * CVar::es_FarPhysTimeout; pPostStep->pEntity->SetParams(&pto); (pRndNode->m_nInternalFlags &= ~IRenderNode::WAS_FARAWAY) |= -bFaraway & IRenderNode::WAS_FARAWAY; } } return 1; } int CPhysicsEventListener::OnPostPump(const EventPhys* pEvent) { if (gEnv->p3DEngine->GetWaterLevel() != WATER_LEVEL_UNKNOWN) { for (std::vector<PhysVisAreaUpdate>::iterator it = m_physVisAreaUpdateVector.begin(), end = m_physVisAreaUpdateVector.end(); it != end; ++it) { IRenderNode* pRndNode = it->m_pRndNode; int bInsideVisarea = pRndNode->GetEntityVisArea() != 0; if (pRndNode->m_nInternalFlags & IRenderNode::WAS_IN_VISAREA ^ (-bInsideVisarea & IRenderNode::WAS_IN_VISAREA)) { pe_params_flags pf; pf.flagsAND = ~pef_ignore_ocean; pf.flagsOR = -bInsideVisarea & pef_ignore_ocean; it->m_pEntity->SetParams(&pf); (pRndNode->m_nInternalFlags &= ~IRenderNode::WAS_IN_VISAREA) |= -bInsideVisarea & IRenderNode::WAS_IN_VISAREA; } } m_physVisAreaUpdateVector.clear(); } return 1; } ////////////////////////////////////////////////////////////////////////// int CPhysicsEventListener::OnBBoxOverlap(const EventPhys* pEvent) { EventPhysBBoxOverlap* pOverlap = (EventPhysBBoxOverlap*)pEvent; IEntity* pEntity = GetEntity(pOverlap->pForeignData[0], pOverlap->iForeignData[0]); IEntity* pEntityTrg = GetEntity(pOverlap->pForeignData[1], pOverlap->iForeignData[1]); if (pEntity && pEntityTrg) { IComponentPhysicsPtr pPhysicsSrc = pEntity->GetComponent<IComponentPhysics>(); if (pPhysicsSrc) { pPhysicsSrc->OnContactWithEntity(pEntityTrg); } IComponentPhysicsPtr pPhysicsTrg = pEntityTrg->GetComponent<IComponentPhysics>(); if (pPhysicsTrg) { pPhysicsTrg->OnContactWithEntity(pEntity); } } return 1; } ////////////////////////////////////////////////////////////////////////// int CPhysicsEventListener::OnStateChange(const EventPhys* pEvent) { EventPhysStateChange* pStateChange = (EventPhysStateChange*)pEvent; IEntity* pEntity = GetEntity(pStateChange->pForeignData, pStateChange->iForeignData); if (pEntity) { EEntityUpdatePolicy policy = pEntity->GetUpdatePolicy(); // If its update depends on physics, physics state defines if this entity is to be updated. if (policy == ENTITY_UPDATE_PHYSICS || policy == ENTITY_UPDATE_PHYSICS_VISIBLE) { int nNewSymClass = pStateChange->iSimClass[1]; // int nOldSymClass = pStateChange->iSimClass[0]; if (nNewSymClass == SC_ACTIVE_RIGID) { // Should activate entity if physics is awaken. pEntity->Activate(true); } else if (nNewSymClass == SC_SLEEPING_RIGID) { // Entity must go to sleep. pEntity->Activate(false); //CallStateFunction(ScriptState_OnStopRollSlideContact, "roll"); //CallStateFunction(ScriptState_OnStopRollSlideContact, "slide"); } } int nOldSymClass = pStateChange->iSimClass[0]; if (nOldSymClass == SC_ACTIVE_RIGID) { SEntityEvent event(ENTITY_EVENT_PHYSICS_CHANGE_STATE); event.nParam[0] = 1; pEntity->SendEvent(event); if (pStateChange->timeIdle >= CVar::es_FarPhysTimeout) { pe_status_dynamics sd; if (pStateChange->pEntity->GetStatus(&sd) && sd.submergedFraction > 0) { pEntity->SetFlags(pEntity->GetFlags() | ENTITY_FLAG_SEND_RENDER_EVENT); IComponentPhysicsPtr pPhysicsComponent = pEntity->GetComponent<IComponentPhysics>(); pPhysicsComponent->SetFlags(pPhysicsComponent->GetFlags() | CComponentPhysics::FLAG_PHYS_AWAKE_WHEN_VISIBLE); } } } else if (nOldSymClass == SC_SLEEPING_RIGID) { SEntityEvent event(ENTITY_EVENT_PHYSICS_CHANGE_STATE); event.nParam[0] = 0; pEntity->SendEvent(event); } } return 1; } ////////////////////////////////////////////////////////////////////////// #include <IDeferredCollisionEvent.h> class CDeferredMeshUpdatePrep : public IDeferredPhysicsEvent { public: CDeferredMeshUpdatePrep() { m_status = 0; m_pStatObj = 0; m_id = -1; m_pMesh = 0; } IStatObj* m_pStatObj; int m_id; IGeometry* m_pMesh, * m_pMeshSkel; Matrix34 m_mtxSkelToMesh; volatile int m_status; virtual void Start() {} virtual int Result(EventPhys*) { return 0; } virtual void Sync() {} virtual bool HasFinished() { return m_status > 1; } virtual DeferredEventType GetType() const { return PhysCallBack_OnCollision; } virtual EventPhys* PhysicsEvent() { return 0; } virtual void OnUpdate() { if (m_id) { m_pStatObj->GetIndexedMesh(true); } else { mesh_data* md = (mesh_data*)m_pMeshSkel->GetData(); IStatObj* pDeformedStatObj = m_pStatObj->SkinVertices(md->pVertices, m_mtxSkelToMesh); m_pMesh->SetForeignData(pDeformedStatObj, 0); } m_pStatObj->Release(); if (m_threadTaskInfo.m_pThread) { gEnv->pSystem->GetIThreadTaskManager()->UnregisterTask(this); } m_status = 2; } virtual void Stop() {} virtual SThreadTaskInfo* GetTaskInfo() { return &m_threadTaskInfo; } SThreadTaskInfo m_threadTaskInfo; }; int g_lastReceivedEventId = 1, g_lastExecutedEventId = 1; CDeferredMeshUpdatePrep g_meshPreps[16]; int CPhysicsEventListener::OnPreUpdateMesh(const EventPhys* pEvent) { EventPhysUpdateMesh* pepum = (EventPhysUpdateMesh*)pEvent; IStatObj* pStatObj; if (pepum->iReason == EventPhysUpdateMesh::ReasonDeform || !(pStatObj = (IStatObj*)pepum->pMesh->GetForeignData())) { return 1; } if (pepum->idx < 0) { pepum->idx = pepum->iReason == EventPhysUpdateMesh::ReasonDeform ? 0 : ++g_lastReceivedEventId; } bool bDefer = false; if (g_lastExecutedEventId < pepum->idx - 1) { bDefer = true; } else { int i, j; for (i = sizeof(g_meshPreps) / sizeof(g_meshPreps[0]) - 1, j = -1; i >= 0 && (!g_meshPreps[i].m_status || (pepum->idx ? (g_meshPreps[i].m_id != pepum->idx) : (g_meshPreps[i].m_pMesh != pepum->pMesh))); i--) { j += i + 1 & (g_meshPreps[i].m_status - 1 & j) >> 31; } if (i >= 0) { if (g_meshPreps[i].m_status == 2) { g_meshPreps[i].m_status = 0; } else { bDefer = true; } } else if (pepum->iReason == EventPhysUpdateMesh::ReasonDeform || !pStatObj->GetIndexedMesh(false)) { if (j >= 0) { (g_meshPreps[j].m_pStatObj = pStatObj)->AddRef(); g_meshPreps[j].m_pMesh = pepum->pMesh; g_meshPreps[j].m_pMeshSkel = pepum->pMeshSkel; g_meshPreps[j].m_mtxSkelToMesh = pepum->mtxSkelToMesh; g_meshPreps[j].m_id = pepum->idx; g_meshPreps[j].m_status = 1; gEnv->p3DEngine->GetDeferredPhysicsEventManager()->DispatchDeferredEvent(&g_meshPreps[j]); } bDefer = true; } } if (bDefer) { gEnv->pPhysicalWorld->AddDeferredEvent(EventPhysUpdateMesh::id, pepum); return 0; } if (pepum->idx > 0) { g_lastExecutedEventId = pepum->idx; } return 1; }; int CPhysicsEventListener::OnPreCreatePhysEntityPart(const EventPhys* pEvent) { EventPhysCreateEntityPart* pepcep = (EventPhysCreateEntityPart*)pEvent; if (!pepcep->pMeshNew) { return 1; } if (pepcep->idx < 0) { pepcep->idx = ++g_lastReceivedEventId; } if (g_lastExecutedEventId < pepcep->idx - 1) { gEnv->pPhysicalWorld->AddDeferredEvent(EventPhysCreateEntityPart::id, pepcep); return 0; } g_lastExecutedEventId = pepcep->idx; return 1; } ////////////////////////////////////////////////////////////////////////// int CPhysicsEventListener::OnUpdateMesh(const EventPhys* pEvent) { ((CBreakableManager*)GetIEntitySystem()->GetBreakableManager())->HandlePhysics_UpdateMeshEvent((EventPhysUpdateMesh*)pEvent); return 1; } ////////////////////////////////////////////////////////////////////////// int CPhysicsEventListener::OnCreatePhysEntityPart(const EventPhys* pEvent) { EventPhysCreateEntityPart* pCreateEvent = (EventPhysCreateEntityPart*)pEvent; ////////////////////////////////////////////////////////////////////////// // Let Breakable manager handle creation of the new entity part. ////////////////////////////////////////////////////////////////////////// CBreakableManager* pBreakMgr = (CBreakableManager*)GetIEntitySystem()->GetBreakableManager(); pBreakMgr->HandlePhysicsCreateEntityPartEvent(pCreateEvent); return 1; } ////////////////////////////////////////////////////////////////////////// int CPhysicsEventListener::OnRemovePhysEntityParts(const EventPhys* pEvent) { EventPhysRemoveEntityParts* pRemoveEvent = (EventPhysRemoveEntityParts*)pEvent; CBreakableManager* pBreakMgr = (CBreakableManager*)GetIEntitySystem()->GetBreakableManager(); pBreakMgr->HandlePhysicsRemoveSubPartsEvent(pRemoveEvent); return 1; } ////////////////////////////////////////////////////////////////////////// int CPhysicsEventListener::OnRevealPhysEntityPart(const EventPhys* pEvent) { EventPhysRevealEntityPart* pRevealEvent = (EventPhysRevealEntityPart*)pEvent; CBreakableManager* pBreakMgr = (CBreakableManager*)GetIEntitySystem()->GetBreakableManager(); pBreakMgr->HandlePhysicsRevealSubPartEvent(pRevealEvent); return 1; } ////////////////////////////////////////////////////////////////////////// IEntity* MatchPartId(IEntity* pent, int partid) { IComponentPhysicsPtr pPhysicsComponent = pent->GetComponent<IComponentPhysics>(); if (pPhysicsComponent && (unsigned int)(partid - pPhysicsComponent->GetPartId0()) < 1000u) { return pent; } IEntity* pMatch; for (int i = pent->GetChildCount() - 1; i >= 0; i--) { if (pMatch = MatchPartId(pent->GetChild(i), partid)) { return pMatch; } } return 0; } IEntity* CEntity::UnmapAttachedChild(int& partId) { CEntity* pChild; if (partId >= PARTID_LINKED && (pChild = static_cast<CEntity*>(MatchPartId(this, partId)))) { partId -= pChild->GetComponent<IComponentPhysics>()->GetPartId0(); return pChild; } return this; } int CPhysicsEventListener::OnCollision(const EventPhys* pEvent) { EventPhysCollision* pCollision = (EventPhysCollision*)pEvent; SEntityEvent event; IEntity* pEntitySrc = GetEntity(pCollision->pForeignData[0], pCollision->iForeignData[0]); IEntity* pEntityTrg = GetEntity(pCollision->pForeignData[1], pCollision->iForeignData[1]); IEntity* pChild; if (pEntitySrc && pCollision->partid[0] >= PARTID_LINKED && (pChild = MatchPartId(pEntitySrc, pCollision->partid[0]))) { pEntitySrc = pChild; pCollision->pForeignData[0] = pEntitySrc; pCollision->iForeignData[0] = PHYS_FOREIGN_ID_ENTITY; pCollision->partid[0] -= pEntitySrc->GetComponent<IComponentPhysics>()->GetPartId0(); } if (pEntitySrc) { if (pEntityTrg && pCollision->partid[1] >= PARTID_LINKED && (pChild = MatchPartId(pEntityTrg, pCollision->partid[1]))) { pEntityTrg = pChild; pCollision->pForeignData[1] = pEntityTrg; pCollision->iForeignData[1] = PHYS_FOREIGN_ID_ENTITY; pCollision->partid[1] -= pEntityTrg->GetComponent<IComponentPhysics>()->GetPartId0(); } IComponentPhysicsPtr pPhysicsSrc = pEntitySrc->GetComponent<IComponentPhysics>(); if (pPhysicsSrc) { pPhysicsSrc->OnCollision(pEntityTrg, pCollision->idmat[1], pCollision->pt, pCollision->n, pCollision->vloc[0], pCollision->vloc[1], pCollision->partid[1], pCollision->mass[1]); } if (pEntityTrg) { IComponentPhysicsPtr pPhysicsTrg = pEntityTrg->GetComponent<IComponentPhysics>(); if (pPhysicsTrg) { pPhysicsTrg->OnCollision(pEntitySrc, pCollision->idmat[0], pCollision->pt, -pCollision->n, pCollision->vloc[1], pCollision->vloc[0], pCollision->partid[0], pCollision->mass[0]); } } } event.event = ENTITY_EVENT_COLLISION; event.nParam[0] = (INT_PTR)pEvent; event.nParam[1] = 0; if (pEntitySrc) { pEntitySrc->SendEvent(event); } event.nParam[1] = 1; if (pEntityTrg) { pEntityTrg->SendEvent(event); } return 1; } ////////////////////////////////////////////////////////////////////////// int CPhysicsEventListener::OnJointBreak(const EventPhys* pEvent) { EventPhysJointBroken* pBreakEvent = (EventPhysJointBroken*)pEvent; IEntity* pEntity = 0; IStatObj* pStatObj = 0; IRenderNode* pRenderNode = 0; Matrix34A nodeTM; // Counter for feature test setup CODECHECKPOINT(physics_on_joint_break); bool bShatter = false; switch (pBreakEvent->iForeignData[0]) { case PHYS_FOREIGN_ID_ROPE: { IRopeRenderNode* pRopeRenderNode = (IRopeRenderNode*)pBreakEvent->pForeignData[0]; if (pRopeRenderNode) { EntityId id = (EntityId)pRopeRenderNode->GetEntityOwner(); pEntity = g_pIEntitySystem->GetEntity(id); } } break; case PHYS_FOREIGN_ID_ENTITY: pEntity = static_cast<IEntity*>(pBreakEvent->pForeignData[0]); break; case PHYS_FOREIGN_ID_STATIC: { pRenderNode = ((IRenderNode*)pBreakEvent->pForeignData[0]); pStatObj = pRenderNode->GetEntityStatObj(0, 0, &nodeTM); bShatter = pRenderNode->GetMaterialLayers() & MTL_LAYER_FROZEN; } } //GetEntity(pBreakEvent->pForeignData[0],pBreakEvent->iForeignData[0]); if (pEntity) { SEntityEvent event; event.event = ENTITY_EVENT_PHYS_BREAK; event.nParam[0] = (INT_PTR)pEvent; event.nParam[1] = 0; pEntity->SendEvent(event); pStatObj = pEntity->GetStatObj(ENTITY_SLOT_ACTUAL); IComponentRenderPtr pRenderComponent = pEntity->GetComponent<IComponentRender>(); if (pRenderComponent) { bShatter = pRenderComponent->GetMaterialLayersMask() & MTL_LAYER_FROZEN; } } IStatObj* pStatObjEnt = pStatObj; if (pStatObj) { while (pStatObj->GetCloneSourceObject()) { pStatObj = pStatObj->GetCloneSourceObject(); } } if (pStatObj && pStatObj->GetFlags() & STATIC_OBJECT_COMPOUND) { Matrix34 tm = Matrix34::CreateTranslationMat(pBreakEvent->pt); IStatObj* pObj1 = 0; // IStatObj *pObj2=0; Vec3 axisx = pBreakEvent->n.GetOrthogonal().normalized(); tm.SetRotation33(Matrix33(axisx, pBreakEvent->n ^ axisx, pBreakEvent->n).T()); IStatObj::SSubObject* pSubObject1 = pStatObj->GetSubObject(pBreakEvent->partid[0]); if (pSubObject1) { pObj1 = pSubObject1->pStatObj; } //IStatObj::SSubObject *pSubObject2 = pStatObj->GetSubObject(pBreakEvent->partid[1]); //if (pSubObject2) //pObj2 = pSubObject2->pStatObj; const char* sEffectType = (!bShatter) ? SURFACE_BREAKAGE_TYPE("joint_break") : SURFACE_BREAKAGE_TYPE("joint_shatter"); CBreakableManager* pBreakMgr = (CBreakableManager*)GetIEntitySystem()->GetBreakableManager(); if (pObj1) { pBreakMgr->CreateSurfaceEffect(pObj1, tm, sEffectType); } //if (pObj2) //pBreakMgr->CreateSurfaceEffect( pObj2,tm,sEffectType ); } IStatObj::SSubObject* pSubObj; if (pStatObj && (pSubObj = pStatObj->GetSubObject(pBreakEvent->idJoint)) && pSubObj->nType == STATIC_SUB_OBJECT_DUMMY && !strncmp(pSubObj->name, "$joint", 6)) { const char* ptr; if (ptr = strstr(pSubObj->properties, "effect")) { for (ptr += 6; *ptr && (*ptr == ' ' || *ptr == '='); ptr++) { ; } if (*ptr) { char strEff[256]; const char* const peff = ptr; while (*ptr && *ptr != '\n') { ++ptr; } cry_strcpy(strEff, peff, (size_t)(ptr - peff)); IParticleEffect* pEffect = gEnv->pParticleManager->FindEffect(strEff); pEffect->Spawn(true, IParticleEffect::ParticleLoc(pBreakEvent->pt, pBreakEvent->n)); } } if (ptr = strstr(pSubObj->properties, "breaker")) { if (!(pStatObjEnt->GetFlags() & STATIC_OBJECT_GENERATED)) { pStatObjEnt = pStatObjEnt->Clone(false, false, true); pStatObjEnt->SetFlags(pStatObjEnt->GetFlags() | STATIC_OBJECT_GENERATED); if (pEntity) { pEntity->SetStatObj(pStatObjEnt, ENTITY_SLOT_ACTUAL, false); } else if (pRenderNode) { IBreakableManager::SCreateParams createParams; createParams.pSrcStaticRenderNode = pRenderNode; createParams.fScale = nodeTM.GetColumn(0).len(); createParams.nSlotIndex = 0; createParams.worldTM = nodeTM; createParams.nMatLayers = pRenderNode->GetMaterialLayers(); createParams.nRenderNodeFlags = pRenderNode->GetRndFlags(); createParams.pCustomMtl = pRenderNode->GetMaterial(); createParams.nEntityFlagsAdd = ENTITY_FLAG_MODIFIED_BY_PHYSICS; createParams.pName = pRenderNode->GetName(); ((CBreakableManager*)GetIEntitySystem()->GetBreakableManager())->CreateObjectAsEntity( pStatObjEnt, pBreakEvent->pEntity[0], pBreakEvent->pEntity[0], createParams, true); } } IStatObj::SSubObject* pSubObj1; const char* piecesStr; for (int i = 0; i < 2; i++) { if ((pSubObj = pStatObjEnt->GetSubObject(pBreakEvent->partid[i])) && pSubObj->pStatObj && (piecesStr = strstr(pSubObj->properties, "pieces=")) && (pSubObj1 = pStatObj->FindSubObject(piecesStr + 7)) && pSubObj1->pStatObj) { pSubObj->pStatObj->Release(); (pSubObj->pStatObj = pSubObj1->pStatObj)->AddRef(); } } pStatObjEnt->Invalidate(false); } } return 1; } void CPhysicsEventListener::RegisterPhysicCallbacks() { if (m_pPhysics) { m_pPhysics->AddEventClient(EventPhysStateChange::id, OnStateChange, 1); m_pPhysics->AddEventClient(EventPhysBBoxOverlap::id, OnBBoxOverlap, 1); m_pPhysics->AddEventClient(EventPhysPostStep::id, OnPostStep, 1); m_pPhysics->AddEventClient(EventPhysUpdateMesh::id, OnUpdateMesh, 1); m_pPhysics->AddEventClient(EventPhysUpdateMesh::id, OnUpdateMesh, 0); m_pPhysics->AddEventClient(EventPhysCreateEntityPart::id, OnCreatePhysEntityPart, 1); m_pPhysics->AddEventClient(EventPhysCreateEntityPart::id, OnCreatePhysEntityPart, 0); m_pPhysics->AddEventClient(EventPhysRemoveEntityParts::id, OnRemovePhysEntityParts, 1); m_pPhysics->AddEventClient(EventPhysRevealEntityPart::id, OnRevealPhysEntityPart, 1); m_pPhysics->AddEventClient(EventPhysCollision::id, OnCollision, 1, 1000.0f); m_pPhysics->AddEventClient(EventPhysJointBroken::id, OnJointBreak, 1); m_pPhysics->AddEventClient(EventPhysPostPump::id, OnPostPump, 1); } } void CPhysicsEventListener::UnregisterPhysicCallbacks() { if (m_pPhysics) { m_pPhysics->RemoveEventClient(EventPhysStateChange::id, OnStateChange, 1); m_pPhysics->RemoveEventClient(EventPhysBBoxOverlap::id, OnBBoxOverlap, 1); m_pPhysics->RemoveEventClient(EventPhysPostStep::id, OnPostStep, 1); m_pPhysics->RemoveEventClient(EventPhysUpdateMesh::id, OnUpdateMesh, 1); m_pPhysics->RemoveEventClient(EventPhysUpdateMesh::id, OnUpdateMesh, 0); m_pPhysics->RemoveEventClient(EventPhysCreateEntityPart::id, OnCreatePhysEntityPart, 1); m_pPhysics->RemoveEventClient(EventPhysCreateEntityPart::id, OnCreatePhysEntityPart, 0); m_pPhysics->RemoveEventClient(EventPhysRemoveEntityParts::id, OnRemovePhysEntityParts, 1); m_pPhysics->RemoveEventClient(EventPhysRevealEntityPart::id, OnRevealPhysEntityPart, 1); m_pPhysics->RemoveEventClient(EventPhysCollision::id, OnCollision, 1); m_pPhysics->RemoveEventClient(EventPhysJointBroken::id, OnJointBreak, 1); m_pPhysics->RemoveEventClient(EventPhysPostPump::id, OnPostPump, 1); stl::free_container(m_physVisAreaUpdateVector); } }
37.910128
193
0.608316
[ "vector" ]
3e5e6831bc88451a9344a8bdd5041d5d23b3c9cd
6,273
cc
C++
DQMServices/Core/src/LegacyIOHelper.cc
ckamtsikis/cmssw
ea19fe642bb7537cbf58451dcf73aa5fd1b66250
[ "Apache-2.0" ]
6
2017-09-08T14:12:56.000Z
2022-03-09T23:57:01.000Z
DQMServices/Core/src/LegacyIOHelper.cc
ckamtsikis/cmssw
ea19fe642bb7537cbf58451dcf73aa5fd1b66250
[ "Apache-2.0" ]
545
2017-09-19T17:10:19.000Z
2022-03-07T16:55:27.000Z
DQMServices/Core/src/LegacyIOHelper.cc
ckamtsikis/cmssw
ea19fe642bb7537cbf58451dcf73aa5fd1b66250
[ "Apache-2.0" ]
14
2017-10-04T09:47:21.000Z
2019-10-23T18:04:45.000Z
#include "DQMServices/Core/interface/LegacyIOHelper.h" #include <cstdio> #include <cfloat> #include <vector> #include <string> #include "TString.h" #include "TSystem.h" #include "TFile.h" #include <sys/stat.h> void LegacyIOHelper::save(std::string const &filename, std::string const &path /* = "" */, uint32_t const run /* = 0 */, bool saveall /* = true */, std::string const &fileupdate /* = "RECREATE" */) { // TFile flushes to disk with fsync() on every TDirectory written to // the file. This makes DQM file saving painfully slow, and // ironically makes it _more_ likely the file saving gets // interrupted and corrupts the file. The utility class below // simply ignores the flush synchronisation. class TFileNoSync : public TFile { public: TFileNoSync(char const *file, char const *opt) : TFile{file, opt} {} Int_t SysSync(Int_t) override { return 0; } }; std::cout << "DQMFileSaver::globalEndRun()" << std::endl; char suffix[64]; sprintf(suffix, "R%09d", run); TFileNoSync *file = new TFileNoSync(filename.c_str(), fileupdate.c_str()); // open file // Traverse all MEs std::vector<MonitorElement *> mes; if (saveall) { // this is typically used, at endJob there will only be JOB histos here mes = dbe_->getAllContents(path); } else { // at endRun it might make sense to use this, to not save JOB histos yet. mes = dbe_->getAllContents(path, run, 0); } for (auto me : mes) { // Modify dirname to comply with DQM GUI format. Change: // A/B/C/plot // into: // DQMData/Run X/A/Run summary/B/C/plot std::string dirName = me->getPathname(); uint64_t firstSlashPos = dirName.find('/'); if (firstSlashPos == std::string::npos) { firstSlashPos = dirName.length(); } if (run) { // Rewrite paths to "Run Summary" format when given a run number. // Else, write a simple, flat TDirectory for local usage. dirName = dirName.substr(0, firstSlashPos) + "/Run summary" + dirName.substr(firstSlashPos, dirName.size()); dirName = "DQMData/Run " + std::to_string(run) + "/" + dirName; } std::string objectName = me->getName(); // Create dir if it doesn't exist and cd into it createDirectoryIfNeededAndCd(dirName); // INTs are saved as strings in this format: <objectName>i=value</objectName> // REALs are saved as strings in this format: <objectName>f=value</objectName> // STRINGs are saved as strings in this format: <objectName>s="value"</objectName> if (me->kind() == MonitorElement::Kind::INT) { int value = me->getIntValue(); std::string content = "<" + objectName + ">i=" + std::to_string(value) + "</" + objectName + ">"; TObjString str(content.c_str()); str.Write(); } else if (me->kind() == MonitorElement::Kind::REAL) { double value = me->getFloatValue(); char buf[64]; // use printf here to preserve exactly the classic formatting. std::snprintf(buf, sizeof(buf), "%.*g", DBL_DIG + 2, value); std::string content = "<" + objectName + ">f=" + buf + "</" + objectName + ">"; TObjString str(content.c_str()); str.Write(); } else if (me->kind() == MonitorElement::Kind::STRING) { const std::string &value = me->getStringValue(); std::string content = "<" + objectName + ">s=" + value + "</" + objectName + ">"; TObjString str(content.c_str()); str.Write(); } else { // Write a histogram TH1 *value = me->getTH1(); value->Write(); if (me->getEfficiencyFlag()) { std::string content = "<" + objectName + ">e=1</" + objectName + ">"; TObjString str(content.c_str()); str.Write(); } for (QReport *qr : me->getQReports()) { std::string result; // TODO: 64 is likely too short; memory corruption in the old code? char buf[64]; std::snprintf(buf, sizeof(buf), "qr=st:%d:%.*g:", qr->getStatus(), DBL_DIG + 2, qr->getQTresult()); result = '<' + objectName + '.' + qr->getQRName() + '>'; result += buf; result += qr->getAlgorithm() + ':' + qr->getMessage(); result += "</" + objectName + '.' + qr->getQRName() + '>'; TObjString str(result.c_str()); str.Write(); } } // Go back to the root directory gDirectory->cd("/"); } file->Close(); } // Use this for saving monitoring objects in ROOT files with dir structure; // cds into directory (creates it first if it doesn't exist); // returns a success flag bool LegacyIOHelper::createDirectoryIfNeededAndCd(const std::string &path) { assert(!path.empty()); // Find the first path component. size_t start = 0; size_t end = path.find('/', start); if (end == std::string::npos) end = path.size(); while (true) { // Check if this subdirectory component exists. If yes, make sure // it is actually a subdirectory. Otherwise create or cd into it. std::string part(path, start, end - start); TObject *o = gDirectory->Get(part.c_str()); if (o && !dynamic_cast<TDirectory *>(o)) throw cms::Exception("DQMFileSaver") << "Attempt to create directory '" << path << "' in a file" " fails because the part '" << part << "' already exists and is not" " directory"; else if (!o) gDirectory->mkdir(part.c_str()); if (!gDirectory->cd(part.c_str())) throw cms::Exception("DQMFileSaver") << "Attempt to create directory '" << path << "' in a file" " fails because could not cd into subdirectory '" << part << "'"; // Stop if we reached the end, ignoring any trailing '/'. if (end + 1 >= path.size()) break; // Find the next path component. start = end + 1; end = path.find('/', start); if (end == std::string::npos) end = path.size(); } return true; }
37.562874
114
0.569425
[ "vector" ]
3e608efc01996dd5d67d0de3a82cae1dcbe2c648
5,143
cc
C++
slb/src/model/CreateDomainExtensionRequest.cc
aliyun/aliyun-openapi-cpp-sdk
0cf5861ece17dfb0bb251f13bf3fbdb39c0c6e36
[ "Apache-2.0" ]
89
2018-02-02T03:54:39.000Z
2021-12-13T01:32:55.000Z
slb/src/model/CreateDomainExtensionRequest.cc
aliyun/aliyun-openapi-cpp-sdk
0cf5861ece17dfb0bb251f13bf3fbdb39c0c6e36
[ "Apache-2.0" ]
89
2018-03-14T07:44:54.000Z
2021-11-26T07:43:25.000Z
slb/src/model/CreateDomainExtensionRequest.cc
aliyun/aliyun-openapi-cpp-sdk
0cf5861ece17dfb0bb251f13bf3fbdb39c0c6e36
[ "Apache-2.0" ]
69
2018-01-22T09:45:52.000Z
2022-03-28T07:58:38.000Z
/* * Copyright 2009-2017 Alibaba Cloud All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include <alibabacloud/slb/model/CreateDomainExtensionRequest.h> using AlibabaCloud::Slb::Model::CreateDomainExtensionRequest; CreateDomainExtensionRequest::CreateDomainExtensionRequest() : RpcServiceRequest("slb", "2014-05-15", "CreateDomainExtension") { setMethod(HttpRequest::Method::Post); } CreateDomainExtensionRequest::~CreateDomainExtensionRequest() {} std::string CreateDomainExtensionRequest::getAccess_key_id()const { return access_key_id_; } void CreateDomainExtensionRequest::setAccess_key_id(const std::string& access_key_id) { access_key_id_ = access_key_id; setParameter("Access_key_id", access_key_id); } long CreateDomainExtensionRequest::getResourceOwnerId()const { return resourceOwnerId_; } void CreateDomainExtensionRequest::setResourceOwnerId(long resourceOwnerId) { resourceOwnerId_ = resourceOwnerId; setParameter("ResourceOwnerId", std::to_string(resourceOwnerId)); } std::vector<CreateDomainExtensionRequest::ServerCertificate> CreateDomainExtensionRequest::getServerCertificate()const { return serverCertificate_; } void CreateDomainExtensionRequest::setServerCertificate(const std::vector<ServerCertificate>& serverCertificate) { serverCertificate_ = serverCertificate; for(int dep1 = 0; dep1!= serverCertificate.size(); dep1++) { auto serverCertificateObj = serverCertificate.at(dep1); std::string serverCertificateObjStr = "ServerCertificate." + std::to_string(dep1 + 1); setParameter(serverCertificateObjStr + ".BindingType", serverCertificateObj.bindingType); setParameter(serverCertificateObjStr + ".CertificateId", serverCertificateObj.certificateId); setParameter(serverCertificateObjStr + ".StandardType", serverCertificateObj.standardType); } } std::string CreateDomainExtensionRequest::getRegionId()const { return regionId_; } void CreateDomainExtensionRequest::setRegionId(const std::string& regionId) { regionId_ = regionId; setParameter("RegionId", regionId); } int CreateDomainExtensionRequest::getListenerPort()const { return listenerPort_; } void CreateDomainExtensionRequest::setListenerPort(int listenerPort) { listenerPort_ = listenerPort; setParameter("ListenerPort", std::to_string(listenerPort)); } std::string CreateDomainExtensionRequest::getResourceOwnerAccount()const { return resourceOwnerAccount_; } void CreateDomainExtensionRequest::setResourceOwnerAccount(const std::string& resourceOwnerAccount) { resourceOwnerAccount_ = resourceOwnerAccount; setParameter("ResourceOwnerAccount", resourceOwnerAccount); } std::string CreateDomainExtensionRequest::getOwnerAccount()const { return ownerAccount_; } void CreateDomainExtensionRequest::setOwnerAccount(const std::string& ownerAccount) { ownerAccount_ = ownerAccount; setParameter("OwnerAccount", ownerAccount); } std::vector<std::string> CreateDomainExtensionRequest::getCertificateId()const { return certificateId_; } void CreateDomainExtensionRequest::setCertificateId(const std::vector<std::string>& certificateId) { certificateId_ = certificateId; for(int dep1 = 0; dep1!= certificateId.size(); dep1++) { setParameter("CertificateId."+ std::to_string(dep1), certificateId.at(dep1)); } } long CreateDomainExtensionRequest::getOwnerId()const { return ownerId_; } void CreateDomainExtensionRequest::setOwnerId(long ownerId) { ownerId_ = ownerId; setParameter("OwnerId", std::to_string(ownerId)); } std::string CreateDomainExtensionRequest::getServerCertificateId()const { return serverCertificateId_; } void CreateDomainExtensionRequest::setServerCertificateId(const std::string& serverCertificateId) { serverCertificateId_ = serverCertificateId; setParameter("ServerCertificateId", serverCertificateId); } std::string CreateDomainExtensionRequest::getTags()const { return tags_; } void CreateDomainExtensionRequest::setTags(const std::string& tags) { tags_ = tags; setParameter("Tags", tags); } std::string CreateDomainExtensionRequest::getLoadBalancerId()const { return loadBalancerId_; } void CreateDomainExtensionRequest::setLoadBalancerId(const std::string& loadBalancerId) { loadBalancerId_ = loadBalancerId; setParameter("LoadBalancerId", loadBalancerId); } std::string CreateDomainExtensionRequest::getDomain()const { return domain_; } void CreateDomainExtensionRequest::setDomain(const std::string& domain) { domain_ = domain; setParameter("Domain", domain); }
28.414365
119
0.776784
[ "vector", "model" ]
3e63649ff830215734ea18dd1640c5a8550ef420
1,520
cc
C++
tensorflow/python/saved_model/pywrap_saved_model.cc
EricRemmerswaal/tensorflow
141ff27877579c81a213fa113bd1b474c1749aca
[ "Apache-2.0" ]
190,993
2015-11-09T13:17:30.000Z
2022-03-31T23:05:27.000Z
tensorflow/python/saved_model/pywrap_saved_model.cc
EricRemmerswaal/tensorflow
141ff27877579c81a213fa113bd1b474c1749aca
[ "Apache-2.0" ]
48,461
2015-11-09T14:21:11.000Z
2022-03-31T23:17:33.000Z
tensorflow/python/saved_model/pywrap_saved_model.cc
EricRemmerswaal/tensorflow
141ff27877579c81a213fa113bd1b474c1749aca
[ "Apache-2.0" ]
104,981
2015-11-09T13:40:17.000Z
2022-03-31T19:51:54.000Z
/* Copyright 2021 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License");; you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ==============================================================================*/ // Defines the pywrap_saved_model module. In order to have only one dynamically- // linked shared object, all SavedModel python bindings should be added here. #include "pybind11/pybind11.h" #include "tensorflow/cc/experimental/libexport/save.h" #include "tensorflow/python/lib/core/pybind11_status.h" #include "tensorflow/python/saved_model/pywrap_saved_model_constants.h" #include "tensorflow/python/saved_model/pywrap_saved_model_metrics.h" namespace tensorflow { namespace saved_model { namespace python { PYBIND11_MODULE(pywrap_saved_model, m) { m.doc() = "TensorFlow SavedModel Python bindings"; m.def("Save", [](const char* export_dir) { MaybeRaiseFromStatus(libexport::Save(export_dir)); }); DefineConstantsModule(m); DefineMetricsModule(m); } } // namespace python } // namespace saved_model } // namespace tensorflow
35.348837
80
0.739474
[ "object" ]
3e663113f2d0e834461a7c8050ead0132b996c56
27,499
cc
C++
src/sprepair_avx2.cc
YomikoR/VapourSynth-SPRepair
248127174bb66fac9e7c51aa0b8917d502bf3a93
[ "MIT" ]
3
2021-06-16T06:15:10.000Z
2021-09-17T04:21:21.000Z
src/sprepair_avx2.cc
YomikoR/VapourSynth-SPRepair
248127174bb66fac9e7c51aa0b8917d502bf3a93
[ "MIT" ]
null
null
null
src/sprepair_avx2.cc
YomikoR/VapourSynth-SPRepair
248127174bb66fac9e7c51aa0b8917d502bf3a93
[ "MIT" ]
null
null
null
#include "vapoursynth/VapourSynth4.h" #include "vapoursynth/VSHelper4.h" #include <immintrin.h> #include <algorithm> #include <utility> #include <memory> #include <vector> /* * Ref for the sorting network used: Vinod K Valsalam and Risto Miikkulainen, * Using Symmetry and Evolutionary Search to Minimize Sorting Networks, * Journal of Machine Learning Research 14 (2013) 303-331. */ #if defined(_MSC_VER) #define ALWAYS_INLINE __forceinline #elif defined(__GNUC__) #define ALWAYS_INLINE __attribute__((always_inline)) #else #define ALWAYS_INLINE #endif template <int i, int j> inline void ALWAYS_INLINE swap_u8(__m256i *val) { __m256i tmp = _mm256_min_epu8(val[i], val[j]); val[j] = _mm256_max_epu8(val[i], val[j]); val[i] = tmp; } template <int i, int j> inline void ALWAYS_INLINE swap_u16(__m256i *val) { __m256i tmp = _mm256_min_epu16(val[i], val[j]); val[j] = _mm256_max_epu16(val[i], val[j]); val[i] = tmp; } template <int i, int j> inline void ALWAYS_INLINE swap_f(__m256 *val) { __m256 tmp = _mm256_min_ps(val[i], val[j]); val[j] = _mm256_max_ps(val[i], val[j]); val[i] = tmp; } inline __m256i ALWAYS_INLINE loadu(const uint8_t *src) { return _mm256_loadu_si256(reinterpret_cast<const __m256i *>(src)); } inline __m256i ALWAYS_INLINE loadu(const uint16_t *src) { return _mm256_loadu_si256(reinterpret_cast<const __m256i *>(src)); } inline __m256 ALWAYS_INLINE loadu(const float *src) { return _mm256_loadu_ps(src); } inline void ALWAYS_INLINE storeu(uint8_t *dst, __m256i value) { _mm256_storeu_si256(reinterpret_cast<__m256i *>(dst), value); } inline void ALWAYS_INLINE storeu(uint16_t *dst, __m256i value) { _mm256_storeu_si256(reinterpret_cast<__m256i *>(dst), value); } inline void ALWAYS_INLINE storeu(float *dst, __m256 value) { _mm256_storeu_ps(dst, value); } #define DO_LOADU \ loadu(src0), loadu(src1), loadu(src2), \ loadu(src3), loadu(src4), loadu(src5), \ loadu(src6), loadu(src7), loadu(src8), template <int order> std::pair<__m256i, __m256i> sort9_minmax_u8(const uint8_t *src0, const uint8_t *src1, const uint8_t *src2, const uint8_t *src3, const uint8_t *src4, const uint8_t *src5, const uint8_t *src6, const uint8_t *src7, const uint8_t *src8) { __m256i val[9] = { DO_LOADU }; #define SWAP swap_u8 SWAP<2, 6>(val); SWAP<0, 5>(val); SWAP<1, 4>(val); SWAP<7, 8>(val); SWAP<0, 7>(val); SWAP<1, 2>(val); SWAP<3, 5>(val); SWAP<4, 6>(val); SWAP<5, 8>(val); SWAP<1, 3>(val); SWAP<6, 8>(val); SWAP<0, 1>(val); SWAP<4, 5>(val); SWAP<2, 7>(val); SWAP<3, 7>(val); SWAP<3, 4>(val); SWAP<5, 6>(val); SWAP<1, 2>(val); SWAP<1, 3>(val); SWAP<6, 7>(val); SWAP<4, 5>(val); SWAP<2, 4>(val); SWAP<5, 6>(val); SWAP<2, 3>(val); SWAP<4, 5>(val); #undef SWAP return std::pair<__m256i, __m256i>(val[order], val[8 - order]); } template<int order> std::pair<__m256i, __m256i> sort9_minmax_u16(const uint16_t *src0, const uint16_t *src1, const uint16_t *src2, const uint16_t *src3, const uint16_t *src4, const uint16_t *src5, const uint16_t *src6, const uint16_t *src7, const uint16_t *src8) { __m256i val[9] = { DO_LOADU }; #define SWAP swap_u16 SWAP<2, 6>(val); SWAP<0, 5>(val); SWAP<1, 4>(val); SWAP<7, 8>(val); SWAP<0, 7>(val); SWAP<1, 2>(val); SWAP<3, 5>(val); SWAP<4, 6>(val); SWAP<5, 8>(val); SWAP<1, 3>(val); SWAP<6, 8>(val); SWAP<0, 1>(val); SWAP<4, 5>(val); SWAP<2, 7>(val); SWAP<3, 7>(val); SWAP<3, 4>(val); SWAP<5, 6>(val); SWAP<1, 2>(val); SWAP<1, 3>(val); SWAP<6, 7>(val); SWAP<4, 5>(val); SWAP<2, 4>(val); SWAP<5, 6>(val); SWAP<2, 3>(val); SWAP<4, 5>(val); #undef SWAP return std::pair<__m256i, __m256i>(val[order], val[8 - order]); } template <int order> std::pair<__m256, __m256> sort9_minmax_f(const float *src0, const float *src1, const float *src2, const float *src3, const float *src4, const float *src5, const float *src6, const float *src7, const float *src8) { __m256 val[9] = { DO_LOADU }; #define SWAP swap_f SWAP<2, 6>(val); SWAP<0, 5>(val); SWAP<1, 4>(val); SWAP<7, 8>(val); SWAP<0, 7>(val); SWAP<1, 2>(val); SWAP<3, 5>(val); SWAP<4, 6>(val); SWAP<5, 8>(val); SWAP<1, 3>(val); SWAP<6, 8>(val); SWAP<0, 1>(val); SWAP<4, 5>(val); SWAP<2, 7>(val); SWAP<3, 7>(val); SWAP<3, 4>(val); SWAP<5, 6>(val); SWAP<1, 2>(val); SWAP<1, 3>(val); SWAP<6, 7>(val); SWAP<4, 5>(val); SWAP<2, 4>(val); SWAP<5, 6>(val); SWAP<2, 3>(val); SWAP<4, 5>(val); #undef SWAP return std::pair<__m256, __m256>(val[order], val[8 - order]); } inline __m256i ALWAYS_INLINE set_minmax_u8(__m256i vmin, __m256i vmax, __m256i va) { va = _mm256_min_epu8(va, vmax); va = _mm256_max_epu8(va, vmin); return va; } inline __m256i ALWAYS_INLINE set_minmax_u8(__m256i vmin, __m256i vmax, __m256i va, __m256i v4) { vmin = _mm256_min_epu8(vmin, v4); vmax = _mm256_max_epu8(vmax, v4); va = _mm256_min_epu8(va, vmax); va = _mm256_max_epu8(va, vmin); return va; } inline __m256i ALWAYS_INLINE set_minmax_u16(__m256i vmin, __m256i vmax, __m256i va) { va = _mm256_min_epu16(va, vmax); va = _mm256_max_epu16(va, vmin); return va; } inline __m256i ALWAYS_INLINE set_minmax_u16(__m256i vmin, __m256i vmax, __m256i va, __m256i v4) { vmin = _mm256_min_epu16(vmin, v4); vmax = _mm256_max_epu16(vmax, v4); va = _mm256_min_epu16(va, vmax); va = _mm256_max_epu16(va, vmin); return va; } inline __m256 ALWAYS_INLINE set_minmax_f(__m256 vmin, __m256 vmax, __m256 va) { va = _mm256_min_ps(va, vmax); va = _mm256_max_ps(va, vmin); return va; } inline __m256 ALWAYS_INLINE set_minmax_f(__m256 vmin, __m256 vmax, __m256 va, __m256 v4) { vmin = _mm256_min_ps(vmin, v4); vmax = _mm256_max_ps(vmax, v4); va = _mm256_min_ps(va, vmax); va = _mm256_max_ps(va, vmin); return va; } static void sort9_repair_u8(const uint8_t *src0, const uint8_t *src1, const uint8_t *src2, const uint8_t *src3, const uint8_t *src4, const uint8_t *src5, const uint8_t *src6, const uint8_t *src7, const uint8_t *src8, const uint8_t *srca, uint8_t *dst, int mode) { if (mode == 0) { // pass } else if (mode == 1) { std::pair<__m256i, __m256i> minmax = sort9_minmax_u8<0>(src0, src1, src2, src3, src4, src5, src6, src7, src8); __m256i va = set_minmax_u8(minmax.first, minmax.second, loadu(srca)); storeu(dst, va); } else if (mode == 2) { std::pair<__m256i, __m256i> minmax = sort9_minmax_u8<1>(src0, src1, src2, src3, src4, src5, src6, src7, src8); __m256i va = set_minmax_u8(minmax.first, minmax.second, loadu(srca)); storeu(dst, va); } else if (mode == 3) { std::pair<__m256i, __m256i> minmax = sort9_minmax_u8<2>(src0, src1, src2, src3, src4, src5, src6, src7, src8); __m256i va = set_minmax_u8(minmax.first, minmax.second, loadu(srca)); storeu(dst, va); } else if (mode == 4) { std::pair<__m256i, __m256i> minmax = sort9_minmax_u8<3>(src0, src1, src2, src3, src4, src5, src6, src7, src8); __m256i va = set_minmax_u8(minmax.first, minmax.second, loadu(srca)); storeu(dst, va); } else if (mode == 11) { std::pair<__m256i, __m256i> minmax = sort9_minmax_u8<0>(src0, src1, src2, src3, src4, src5, src6, src7, src8); __m256i va = set_minmax_u8(minmax.first, minmax.second, loadu(srca), loadu(src4)); storeu(dst, va); } else if (mode == 12) { std::pair<__m256i, __m256i> minmax = sort9_minmax_u8<1>(src0, src1, src2, src3, src4, src5, src6, src7, src8); __m256i va = set_minmax_u8(minmax.first, minmax.second, loadu(srca), loadu(src4)); storeu(dst, va); } else if (mode == 13) { std::pair<__m256i, __m256i> minmax = sort9_minmax_u8<2>(src0, src1, src2, src3, src4, src5, src6, src7, src8); __m256i va = set_minmax_u8(minmax.first, minmax.second, loadu(srca), loadu(src4)); storeu(dst, va); } else if (mode == 14) { std::pair<__m256i, __m256i> minmax = sort9_minmax_u8<3>(src0, src1, src2, src3, src4, src5, src6, src7, src8); __m256i va = set_minmax_u8(minmax.first, minmax.second, loadu(srca), loadu(src4)); storeu(dst, va); } } static void sort9_repair_u16(const uint16_t *src0, const uint16_t *src1, const uint16_t *src2, const uint16_t *src3, const uint16_t *src4, const uint16_t *src5, const uint16_t *src6, const uint16_t *src7, const uint16_t *src8, const uint16_t *srca, uint16_t *dst, int mode) { if (mode == 0) { // pass } else if (mode == 1) { std::pair<__m256i, __m256i> minmax = sort9_minmax_u16<0>(src0, src1, src2, src3, src4, src5, src6, src7, src8); __m256i va = set_minmax_u16(minmax.first, minmax.second, loadu(srca)); storeu(dst, va); } else if (mode == 2) { std::pair<__m256i, __m256i> minmax = sort9_minmax_u16<1>(src0, src1, src2, src3, src4, src5, src6, src7, src8); __m256i va = set_minmax_u16(minmax.first, minmax.second, loadu(srca)); storeu(dst, va); } else if (mode == 3) { std::pair<__m256i, __m256i> minmax = sort9_minmax_u16<2>(src0, src1, src2, src3, src4, src5, src6, src7, src8); __m256i va = set_minmax_u16(minmax.first, minmax.second, loadu(srca)); storeu(dst, va); } else if (mode == 4) { std::pair<__m256i, __m256i> minmax = sort9_minmax_u16<3>(src0, src1, src2, src3, src4, src5, src6, src7, src8); __m256i va = set_minmax_u16(minmax.first, minmax.second, loadu(srca)); storeu(dst, va); } else if (mode == 11) { std::pair<__m256i, __m256i> minmax = sort9_minmax_u16<0>(src0, src1, src2, src3, src4, src5, src6, src7, src8); __m256i va = set_minmax_u16(minmax.first, minmax.second, loadu(srca), loadu(src4)); storeu(dst, va); } else if (mode == 12) { std::pair<__m256i, __m256i> minmax = sort9_minmax_u16<1>(src0, src1, src2, src3, src4, src5, src6, src7, src8); __m256i va = set_minmax_u16(minmax.first, minmax.second, loadu(srca), loadu(src4)); storeu(dst, va); } else if (mode == 13) { std::pair<__m256i, __m256i> minmax = sort9_minmax_u16<2>(src0, src1, src2, src3, src4, src5, src6, src7, src8); __m256i va = set_minmax_u16(minmax.first, minmax.second, loadu(srca), loadu(src4)); storeu(dst, va); } else if (mode == 14) { std::pair<__m256i, __m256i> minmax = sort9_minmax_u16<3>(src0, src1, src2, src3, src4, src5, src6, src7, src8); __m256i va = set_minmax_u16(minmax.first, minmax.second, loadu(srca), loadu(src4)); storeu(dst, va); } } static void sort9_repair_f(const float *src0, const float *src1, const float *src2, const float *src3, const float *src4, const float *src5, const float *src6, const float *src7, const float *src8, const float *srca, float *dst, int mode) { if (mode == 0) { // pass } else if (mode == 1) { std::pair<__m256, __m256> minmax = sort9_minmax_f<0>(src0, src1, src2, src3, src4, src5, src6, src7, src8); __m256 va = set_minmax_f(minmax.first, minmax.second, loadu(srca)); storeu(dst, va); } else if (mode == 2) { std::pair<__m256, __m256> minmax = sort9_minmax_f<1>(src0, src1, src2, src3, src4, src5, src6, src7, src8); __m256 va = set_minmax_f(minmax.first, minmax.second, loadu(srca)); storeu(dst, va); } else if (mode == 3) { std::pair<__m256, __m256> minmax = sort9_minmax_f<2>(src0, src1, src2, src3, src4, src5, src6, src7, src8); __m256 va = set_minmax_f(minmax.first, minmax.second, loadu(srca)); storeu(dst, va); } else if (mode == 4) { std::pair<__m256, __m256> minmax = sort9_minmax_f<3>(src0, src1, src2, src3, src4, src5, src6, src7, src8); __m256 va = set_minmax_f(minmax.first, minmax.second, loadu(srca)); storeu(dst, va); } else if (mode == 11) { std::pair<__m256, __m256> minmax = sort9_minmax_f<0>(src0, src1, src2, src3, src4, src5, src6, src7, src8); __m256 va = set_minmax_f(minmax.first, minmax.second, loadu(srca), loadu(src4)); storeu(dst, va); } else if (mode == 12) { std::pair<__m256, __m256> minmax = sort9_minmax_f<1>(src0, src1, src2, src3, src4, src5, src6, src7, src8); __m256 va = set_minmax_f(minmax.first, minmax.second, loadu(srca), loadu(src4)); storeu(dst, va); } else if (mode == 13) { std::pair<__m256, __m256> minmax = sort9_minmax_f<2>(src0, src1, src2, src3, src4, src5, src6, src7, src8); __m256 va = set_minmax_f(minmax.first, minmax.second, loadu(srca), loadu(src4)); storeu(dst, va); } else if (mode == 14) { std::pair<__m256, __m256> minmax = sort9_minmax_f<3>(src0, src1, src2, src3, src4, src5, src6, src7, src8); __m256 va = set_minmax_f(minmax.first, minmax.second, loadu(srca), loadu(src4)); storeu(dst, va); } } struct spRepairData { VSNode *node; VSNode *repairnode; VSNode *bil_nodes[8]; // 1, 2, 3, 4, repairnode=5, 6, 7, 8, 9 VSVideoInfo vi; int mode[3]; }; static const VSFrame *VS_CC spRepairGetFrame(int n, int activationReason, void *instanceData, void **frameData, VSFrameContext *frameCtx, VSCore *core, const VSAPI *vsapi) { spRepairData *d = reinterpret_cast<spRepairData *>(instanceData); if (activationReason == arInitial) { vsapi->requestFrameFilter(n, d->node, frameCtx); vsapi->requestFrameFilter(n, d->repairnode, frameCtx); for (int i = 0; i < 8; ++i) { vsapi->requestFrameFilter(n, d->bil_nodes[i], frameCtx); } } else if (activationReason == arAllFramesReady) { const VSFrame *src_frame = vsapi->getFrameFilter(n, d->node, frameCtx); const VSFrame *rep4_frame = vsapi->getFrameFilter(n, d->repairnode, frameCtx); const VSFrame *rep0_frame = vsapi->getFrameFilter(n, d->bil_nodes[0], frameCtx); const VSFrame *rep1_frame = vsapi->getFrameFilter(n, d->bil_nodes[1], frameCtx); const VSFrame *rep2_frame = vsapi->getFrameFilter(n, d->bil_nodes[2], frameCtx); const VSFrame *rep3_frame = vsapi->getFrameFilter(n, d->bil_nodes[3], frameCtx); const VSFrame *rep5_frame = vsapi->getFrameFilter(n, d->bil_nodes[4], frameCtx); const VSFrame *rep6_frame = vsapi->getFrameFilter(n, d->bil_nodes[5], frameCtx); const VSFrame *rep7_frame = vsapi->getFrameFilter(n, d->bil_nodes[6], frameCtx); const VSFrame *rep8_frame = vsapi->getFrameFilter(n, d->bil_nodes[7], frameCtx); int planes[3] = {0, 1, 2}; const VSFrame *cp_planes[3] = { d->mode[0] > 0 ? nullptr : src_frame, d->mode[1] > 0 ? nullptr : src_frame, d->mode[2] > 0 ? nullptr : src_frame }; VSFrame *dst_frame = vsapi->newVideoFrame2(vsapi->getVideoFrameFormat(src_frame), vsapi->getFrameWidth(src_frame, 0), vsapi->getFrameHeight(src_frame, 0), cp_planes, planes, src_frame, core); if (d->vi.format.sampleType == stInteger && d->vi.format.bytesPerSample == 1) { // uint8_t for (int plane = 0; plane < d->vi.format.numPlanes; ++plane) { const uint8_t *srca = reinterpret_cast<const uint8_t *>(vsapi->getReadPtr(src_frame, plane)); const uint8_t *src0 = reinterpret_cast<const uint8_t *>(vsapi->getReadPtr(rep0_frame, plane)); const uint8_t *src1 = reinterpret_cast<const uint8_t *>(vsapi->getReadPtr(rep1_frame, plane)); const uint8_t *src2 = reinterpret_cast<const uint8_t *>(vsapi->getReadPtr(rep2_frame, plane)); const uint8_t *src3 = reinterpret_cast<const uint8_t *>(vsapi->getReadPtr(rep3_frame, plane)); const uint8_t *src4 = reinterpret_cast<const uint8_t *>(vsapi->getReadPtr(rep4_frame, plane)); const uint8_t *src5 = reinterpret_cast<const uint8_t *>(vsapi->getReadPtr(rep5_frame, plane)); const uint8_t *src6 = reinterpret_cast<const uint8_t *>(vsapi->getReadPtr(rep6_frame, plane)); const uint8_t *src7 = reinterpret_cast<const uint8_t *>(vsapi->getReadPtr(rep7_frame, plane)); const uint8_t *src8 = reinterpret_cast<const uint8_t *>(vsapi->getReadPtr(rep8_frame, plane)); uint8_t * VS_RESTRICT dst = reinterpret_cast<uint8_t *>(vsapi->getWritePtr(dst_frame, plane)); int stride = vsapi->getStride(src_frame, plane) / sizeof(uint8_t); int pheight = vsapi->getFrameHeight(src_frame, plane); int index = 0; for (int h = 0; h < pheight; ++h) { for (int w = 0; w < stride / 32; ++w) { sort9_repair_u8(src0 + index, src1 + index, src2 + index, src3 + index, src4 + index, src5 + index, src6 + index, src7 + index, src8 + index, srca + index, dst + index, d->mode[plane]); index += 32; } } } } else if (d->vi.format.sampleType == stInteger && d->vi.format.bytesPerSample == 2) { // uint16_t for (int plane = 0; plane < d->vi.format.numPlanes; ++plane) { const uint16_t *srca = reinterpret_cast<const uint16_t *>(vsapi->getReadPtr(src_frame, plane)); const uint16_t *src0 = reinterpret_cast<const uint16_t *>(vsapi->getReadPtr(rep0_frame, plane)); const uint16_t *src1 = reinterpret_cast<const uint16_t *>(vsapi->getReadPtr(rep1_frame, plane)); const uint16_t *src2 = reinterpret_cast<const uint16_t *>(vsapi->getReadPtr(rep2_frame, plane)); const uint16_t *src3 = reinterpret_cast<const uint16_t *>(vsapi->getReadPtr(rep3_frame, plane)); const uint16_t *src4 = reinterpret_cast<const uint16_t *>(vsapi->getReadPtr(rep4_frame, plane)); const uint16_t *src5 = reinterpret_cast<const uint16_t *>(vsapi->getReadPtr(rep5_frame, plane)); const uint16_t *src6 = reinterpret_cast<const uint16_t *>(vsapi->getReadPtr(rep6_frame, plane)); const uint16_t *src7 = reinterpret_cast<const uint16_t *>(vsapi->getReadPtr(rep7_frame, plane)); const uint16_t *src8 = reinterpret_cast<const uint16_t *>(vsapi->getReadPtr(rep8_frame, plane)); uint16_t * VS_RESTRICT dst = reinterpret_cast<uint16_t *>(vsapi->getWritePtr(dst_frame, plane)); int stride = vsapi->getStride(src_frame, plane) / sizeof(uint16_t); int pheight = vsapi->getFrameHeight(src_frame, plane); int index = 0; for (int h = 0; h < pheight; ++h) { for (int w = 0; w < stride / 16; ++w) { sort9_repair_u16(src0 + index, src1 + index, src2 + index, src3 + index, src4 + index, src5 + index, src6 + index, src7 + index, src8 + index, srca + index, dst + index, d->mode[plane]); index += 16; } } } } else if (d->vi.format.sampleType == stFloat && d->vi.format.bytesPerSample == 4) { // float for (int plane = 0; plane < d->vi.format.numPlanes; ++plane) { const float *srca = reinterpret_cast<const float *>(vsapi->getReadPtr(src_frame, plane)); const float *src0 = reinterpret_cast<const float *>(vsapi->getReadPtr(rep0_frame, plane)); const float *src1 = reinterpret_cast<const float *>(vsapi->getReadPtr(rep1_frame, plane)); const float *src2 = reinterpret_cast<const float *>(vsapi->getReadPtr(rep2_frame, plane)); const float *src3 = reinterpret_cast<const float *>(vsapi->getReadPtr(rep3_frame, plane)); const float *src4 = reinterpret_cast<const float *>(vsapi->getReadPtr(rep4_frame, plane)); const float *src5 = reinterpret_cast<const float *>(vsapi->getReadPtr(rep5_frame, plane)); const float *src6 = reinterpret_cast<const float *>(vsapi->getReadPtr(rep6_frame, plane)); const float *src7 = reinterpret_cast<const float *>(vsapi->getReadPtr(rep7_frame, plane)); const float *src8 = reinterpret_cast<const float *>(vsapi->getReadPtr(rep8_frame, plane)); float * VS_RESTRICT dst = reinterpret_cast<float *>(vsapi->getWritePtr(dst_frame, plane)); int stride = vsapi->getStride(src_frame, plane) / sizeof(float); int pheight = vsapi->getFrameHeight(src_frame, plane); int index = 0; for (int h = 0; h < pheight; ++h) { for (int w = 0; w < stride / 8; ++w) { sort9_repair_f(src0 + index, src1 + index, src2 + index, src3 + index, src4 + index, src5 + index, src6 + index, src7 + index, src8 + index, srca + index, dst + index, d->mode[plane]); index += 8; } } } } else { vsapi->setFilterError("spRepair: Input format is not supported->", frameCtx); vsapi->freeFrame(dst_frame); dst_frame = nullptr; } vsapi->freeFrame(src_frame); vsapi->freeFrame(rep0_frame); vsapi->freeFrame(rep1_frame); vsapi->freeFrame(rep2_frame); vsapi->freeFrame(rep3_frame); vsapi->freeFrame(rep4_frame); vsapi->freeFrame(rep5_frame); vsapi->freeFrame(rep6_frame); vsapi->freeFrame(rep7_frame); vsapi->freeFrame(rep8_frame); return dst_frame; } return nullptr; } static void VS_CC spRepairFree(void *instanceData, VSCore *core, const VSAPI *vsapi) { spRepairData *d = reinterpret_cast<spRepairData *>(instanceData); vsapi->freeNode(d->node); vsapi->freeNode(d->repairnode); for (int i = 0; i < 8; ++i) { vsapi->freeNode(d->bil_nodes[i]); } delete d; } inline VSNode *invokeBilinear(VSPlugin *resize_plugin, VSNode *clip, double src_left, double src_top, const VSAPI *vsapi) { VSMap *args = vsapi->createMap(); vsapi->mapSetNode(args, "clip", clip, maAppend); vsapi->mapSetFloat(args, "src_left", src_left, maAppend); vsapi->mapSetFloat(args, "src_top", src_top, maAppend); VSMap *res = vsapi->invoke(resize_plugin, "Bilinear", args); vsapi->freeMap(args); VSNode *res_node = vsapi->mapGetNode(res, "clip", 0, nullptr); vsapi->freeMap(res); return res_node; } void VS_CC spRepairCreate(const VSMap *in, VSMap *out, void *userData, VSCore *core, const VSAPI *vsapi) { std::unique_ptr<spRepairData> d(new spRepairData()); d->node = vsapi->mapGetNode(in, "clip", 0, nullptr); const VSVideoInfo *vi = vsapi->getVideoInfo(d->node); d->vi = *vi; d->repairnode = vsapi->mapGetNode(in, "repairclip", 0, nullptr); if (!vsh::isSameVideoFormat(&vi->format, &vsapi->getVideoInfo(d->repairnode)->format)) { vsapi->freeNode(d->node); vsapi->freeNode(d->repairnode); vsapi->mapSetError(out, "spRepair: Input clips must have the same format."); return; } int num_pl = d->vi.format.numPlanes; int m = vsapi->mapNumElements(in, "mode"); if (num_pl < m) { vsapi->freeNode(d->node); vsapi->freeNode(d->repairnode); vsapi->mapSetError(out, "spRepair: Number of modes specified must be equal or fewer than the number of input planes."); return; } bool all_modes_are_zero = true; for (int i = 0; i < 3; ++i) { if (i < m) { d->mode[i] = vsh::int64ToIntS(vsapi->mapGetInt(in, "mode", i, nullptr)); if (d->mode[i] < 0 || d->mode[i] > 24) { vsapi->freeNode(d->node); vsapi->freeNode(d->repairnode); vsapi->mapSetError(out, "spRepair: Invalid mode specified, only 0-24 supported->"); return; } else if ((d->mode[i] >= 5 && d->mode[i] <= 10) || (d->mode[i] >= 15)) { vsapi->freeNode(d->node); vsapi->freeNode(d->repairnode); vsapi->mapSetError(out, "spRepair: This mode is not yet implemented->"); return; } if (d->mode[i] != 0) { all_modes_are_zero = false; } } else { d->mode[i] = d->mode[i - 1]; } } if (all_modes_are_zero) { // Return without processing vsapi->mapSetNode(out, "clip", d->node, maReplace); vsapi->freeNode(d->node); vsapi->freeNode(d->repairnode); return; } int err; double pixel = vsapi->mapGetFloat(in, "pixel", 0, &err); if (err) { pixel = 1.0; } if (pixel < 0.0) { pixel = -pixel; } if (pixel > 20.0) { vsapi->freeNode(d->node); vsapi->freeNode(d->repairnode); vsapi->mapSetError(out, "spRepair: The pixel value is considered to be too large."); return; } // Invoke core.resize.Bilinear to generate ... VSPlugin *resize_plugin = vsapi->getPluginByID("com.vapoursynth.resize", core); // 1, top-left d->bil_nodes[0] = invokeBilinear(resize_plugin, d->repairnode, pixel, pixel, vsapi); // 2, top d->bil_nodes[1] = invokeBilinear(resize_plugin, d->repairnode, 0, pixel, vsapi); // 3, top-right d->bil_nodes[2] = invokeBilinear(resize_plugin, d->repairnode, -pixel, pixel, vsapi); // 4, left d->bil_nodes[3] = invokeBilinear(resize_plugin, d->repairnode, pixel, 0, vsapi); // 6, right d->bil_nodes[4] = invokeBilinear(resize_plugin, d->repairnode, -pixel, 0, vsapi); // 7, bottom-left d->bil_nodes[5] = invokeBilinear(resize_plugin, d->repairnode, pixel, -pixel, vsapi); // 8, bottom d->bil_nodes[6] = invokeBilinear(resize_plugin, d->repairnode, 0, -pixel, vsapi); // 9, bottom-right d->bil_nodes[7] = invokeBilinear(resize_plugin, d->repairnode, -pixel, -pixel, vsapi); std::vector<VSFilterDependency> dep_req = { {d->node, rpStrictSpatial}, {d->repairnode, rpStrictSpatial} }; for (int n = 0; n < 8; ++n) { dep_req.push_back({d->bil_nodes[n], rpStrictSpatial}); } vsapi->createVideoFilter(out, "spRepair", &d->vi, spRepairGetFrame, spRepairFree, fmParallel, dep_req.data(), dep_req.size(), d.get(), core);\ d.release(); } VS_EXTERNAL_API(void) VapourSynthPluginInit2(VSPlugin* plugin, const VSPLUGINAPI* vspapi) { vspapi->configPlugin("yomiko.collection.sprepair", "sprep", "Sub-pixel repair", VS_MAKE_VERSION(1, 0), VAPOURSYNTH_API_VERSION, 0, plugin); vspapi->registerFunction("spRepair", "clip:vnode;" "repairclip:vnode;" "mode:int[];" "pixel:float;", "clip:vnode;", spRepairCreate, nullptr, plugin ); }
37.060647
210
0.606095
[ "vector" ]
3e6b00609bd5f7a0a522b31fd529f94c52556adf
25,796
cpp
C++
RocketStats/RocketStats.cpp
wwboynton/RocketStats
b1e0ed3a2ccd9070a1fed466309d2829af02e88b
[ "MIT" ]
null
null
null
RocketStats/RocketStats.cpp
wwboynton/RocketStats
b1e0ed3a2ccd9070a1fed466309d2829af02e88b
[ "MIT" ]
null
null
null
RocketStats/RocketStats.cpp
wwboynton/RocketStats
b1e0ed3a2ccd9070a1fed466309d2829af02e88b
[ "MIT" ]
null
null
null
/* ================================== * Developped by Lyliya & NuSa * ================================== */ // Include #include "RocketStats.h" #include "bakkesmod/wrappers/GameEvent/GameEventWrapper.h" #include "bakkesmod/wrappers/GameEvent/ServerWrapper.h" #include "bakkesmod/wrappers/ArrayWrapper.h" #include "bakkesmod/wrappers/includes.h" #include "utils/parser.h" #include <chrono> #include <thread> #include <cmath> #include <stdio.h> // File include #include <iostream> #include <fstream> BAKKESMOD_PLUGIN(RocketStats, "RocketStats", "2.2", 0) #pragma region Helpers int HexadecimalToDecimal(std::string hex) { int hexLength = hex.length(); double dec = 0; for (int i = 0; i < hexLength; ++i) { char b = hex[i]; if (b >= 48 && b <= 57) b -= 48; else if (b >= 65 && b <= 70) b -= 55; else if (b >= 97 && b <= 102) { b -= 87; } dec += b * pow(16, ((hexLength - i) - 1)); } return (int)dec; } RGB HexadecimalToRGB(std::string hex) { if (hex[0] != '#' || hex.length() != 7) { RGB tmp; tmp.r = 180; tmp.g = 180; tmp.b = 180; return tmp; } else { if (hex[0] == '#') hex = hex.erase(0, 1); RGB color; color.r = (unsigned char)HexadecimalToDecimal(hex.substr(0, 2)); color.g = (unsigned char)HexadecimalToDecimal(hex.substr(2, 2)); color.b = (unsigned char)HexadecimalToDecimal(hex.substr(4, 2)); return color; } } #pragma endregion std::string RocketStats::GetRank(int tierID) { cvarManager->log("tier:" + std::to_string(tierID)); if (tierID <= rank_nb) { return rank[tierID].name; } else { return "norank"; } } void RocketStats::onLoad() { crown = std::make_shared<ImageWrapper>("./bakkesmod/RocketStats/RocketStats_images/crown.png", true); win = std::make_shared<ImageWrapper>("./bakkesmod/RocketStats/RocketStats_images/win.png", true); loose = std::make_shared<ImageWrapper>("./bakkesmod/RocketStats/RocketStats_images/loose.png", true); for (int i = 0; i < rank_nb; i++) { rank[i].image = std::make_shared<ImageWrapper>("./bakkesmod/RocketStats/RocketStats_images/" + rank[i].name + ".png", true); if (rank[i].image->LoadForCanvas()) { cvarManager->log(rank[i].name + " : image load"); } } cvarManager->registerNotifier("RocketStats_reset_stats", [this](std::vector<std::string> params) { ResetStats(); } , "Reset Stats", PERMISSION_ALL); // Unload cvarManager->registerNotifier("RocketStats_unload", [this](std::vector<std::string> params) { togglePlugin(false); } , "Unload Plugin", PERMISSION_ALL); //Load cvarManager->registerNotifier("RocketStats_load", [this](std::vector<std::string> params) { togglePlugin(true); } , "Load Plugin", PERMISSION_ALL); // Register drawable gameWrapper->RegisterDrawable(std::bind(&RocketStats::Render, this, std::placeholders::_1)); // Hook on Event gameWrapper->HookEvent("Function GameEvent_TA.Countdown.BeginState", bind(&RocketStats::Start, this, std::placeholders::_1)); gameWrapper->HookEvent("Function TAGame.GameEvent_Soccar_TA.EventMatchEnded", bind(&RocketStats::GameEnd, this, std::placeholders::_1)); gameWrapper->HookEvent("Function CarComponent_Boost_TA.Active.BeginState", bind(&RocketStats::OnBoost, this, std::placeholders::_1)); gameWrapper->HookEvent("Function CarComponent_Boost_TA.Active.EndState", bind(&RocketStats::OnBoostEnd, this, std::placeholders::_1)); gameWrapper->HookEvent("Function TAGame.GameEvent_Soccar_TA.Destroyed", bind(&RocketStats::GameDestroyed, this, std::placeholders::_1)); WriteInFile("RocketStats_Win.txt", std::to_string(0)); WriteInFile("RocketStats_Streak.txt", std::to_string(0)); WriteInFile("RocketStats_Loose.txt", std::to_string(0)); WriteInFile("RocketStats_MMRChange.txt", std::to_string(0)); WriteInFile("RocketStats_MMR.txt", std::to_string(0)); WriteInFile("RocketStats_Rank.txt", ""); WriteInFile("RocketStats_GameMode.txt", ""); initRank(); // Load Settings cvarManager->registerCvar("RS_Use_v1", "0", "Use the v1 overlay", true, true, 0, true, 1); cvarManager->registerCvar("RS_disp_ig", "1", "Display information panel", true, true, 0, true, 1); cvarManager->registerCvar("RS_hide_overlay_ig", "0", "Hide overlay while in-game", true, true, 0, true, 1); cvarManager->registerCvar("RS_disp_mmr", "1", "Display the current MMR", true, true, 0, true, 1); cvarManager->registerCvar("RS_disp_wins", "1", "Display the wins on the current game mode", true, true, 0, true, 1); cvarManager->registerCvar("RS_disp_losses", "1", "Display the losses on the current game mode", true, true, 0, true, 1); cvarManager->registerCvar("RS_disp_streak", "1", "Display the streak on the current game mode", true, true, 0, true, 1); cvarManager->registerCvar("RS_disp_rank", "1", "Display the rank on the current game mode", true, true, 0, true, 1); cvarManager->registerCvar("RS_disp_gamemode", "1", "Display the current game mode", true, true, 0, true, 1); cvarManager->registerCvar("RS_x_position", "0.700", "Overlay X position", true, true, 0, true, 1.0f); cvarManager->registerCvar("RS_y_position", "0.575", "Overlay Y position", true, true, 0, true, 1.0f); cvarManager->registerCvar("RS_scale", "1", "Overlay scale", true, true, 0, true, 10); cvarManager->registerCvar("RS_disp_active", "0", "", true, true, 0, true, 1); cvarManager->registerCvar("RocketStats_stop_boost", "1", "Stop Boost animation", true, true, 0, true, 1); cvarManager->registerCvar("RS_session", "0", "Display session stats", true, true, 0, true, 1, true); WriteInFile("RocketStats_images/BoostState.txt", std::to_string(-1)); } void RocketStats::onUnload() { gameWrapper->UnhookEvent("Function GameEvent_TA.Countdown.BeginState"); gameWrapper->UnhookEvent("Function TAGame.GameEvent_Soccar_TA.EventMatchEnded"); gameWrapper->UnhookEvent("Function CarComponent_Boost_TA.Active.BeginState"); gameWrapper->UnhookEvent("Function CarComponent_Boost_TA.Active.EndState"); gameWrapper->UnhookEvent("Function TAGame.GameEvent_Soccar_TA.Destroyed"); gameWrapper->UnregisterDrawables(); } void RocketStats::togglePlugin(bool state) { if (state == isLoad) { return; } else { if (state == false) { // Unload Plugin gameWrapper->UnhookEvent("Function GameEvent_TA.Countdown.BeginState"); gameWrapper->UnhookEvent("Function TAGame.GameEvent_Soccar_TA.EventMatchEnded"); gameWrapper->UnhookEvent("Function CarComponent_Boost_TA.Active.BeginState"); gameWrapper->UnhookEvent("Function CarComponent_Boost_TA.Active.EndState"); gameWrapper->UnhookEvent("Function TAGame.GameEvent_Soccar_TA.Destroyed"); gameWrapper->UnregisterDrawables(); isLoad = state; } else if (state == true) { // Load Plugin gameWrapper->HookEvent("Function GameEvent_TA.Countdown.BeginState", bind(&RocketStats::Start, this, std::placeholders::_1)); gameWrapper->HookEvent("Function TAGame.GameEvent_Soccar_TA.EventMatchEnded", bind(&RocketStats::GameEnd, this, std::placeholders::_1)); gameWrapper->HookEvent("Function CarComponent_Boost_TA.Active.BeginState", bind(&RocketStats::OnBoost, this, std::placeholders::_1)); gameWrapper->HookEvent("Function CarComponent_Boost_TA.Active.EndState", bind(&RocketStats::OnBoostEnd, this, std::placeholders::_1)); gameWrapper->HookEvent("Function TAGame.GameEvent_Soccar_TA.Destroyed", bind(&RocketStats::GameDestroyed, this, std::placeholders::_1)); gameWrapper->RegisterDrawable(std::bind(&RocketStats::Render, this, std::placeholders::_1)); WriteInFile("RocketStats_Win.txt", std::to_string(0)); WriteInFile("RocketStats_Streak.txt", std::to_string(0)); WriteInFile("RocketStats_Loose.txt", std::to_string(0)); WriteInFile("RocketStats_MMRChange.txt", std::to_string(0)); WriteInFile("RocketStats_MMR.txt", std::to_string(0)); WriteInFile("RocketStats_Rank.txt", ""); WriteInFile("RocketStats_GameMode.txt", ""); WriteInFile("RocketStats_images/BoostState.txt", std::to_string(-1)); initRank(); isLoad = state; } } } void RocketStats::Start(std::string eventName) { if (gameWrapper->IsInOnlineGame()) { CarWrapper me = gameWrapper->GetLocalCar(); if (me.IsNull()) { return; } TeamInfoWrapper myTeam = me.GetPRI().GetTeam(); if (myTeam.IsNull()) { return; } PriWrapper mePRI = me.GetPRI(); // Get and Display SteamID mySteamID = mePRI.GetUniqueId(); // Get and Update MMR MMRWrapper mmrw = gameWrapper->GetMMRWrapper(); currentPlaylist = mmrw.GetCurrentPlaylist(); SkillRank playerRank = mmrw.GetPlayerRank(mySteamID, currentPlaylist); currentTier = playerRank.Tier; WriteInFile("RocketStats_GameMode.txt", getPlaylistName(currentPlaylist)); //Session or Gamemode ComputeMMR(0); writeMMRChange(); writeWin(); writeStreak(); writeLosses(); writeMMR(); // Get TeamNum myTeamNum = myTeam.GetTeamNum(); // Set Game Started isGameEnded = false; isGameStarted = true; majRank(currentPlaylist, stats[currentPlaylist].myMMR, playerRank); WriteInFile("RocketStats_images/BoostState.txt", std::to_string(0)); } } void RocketStats::GameEnd(std::string eventName) { if (gameWrapper->IsInOnlineGame() && myTeamNum != -1) { ServerWrapper server = gameWrapper->GetOnlineGame(); TeamWrapper winningTeam = server.GetGameWinner(); if (winningTeam.IsNull()) { return; } int teamnum = winningTeam.GetTeamNum(); // Game as ended isGameEnded = true; MMRWrapper mw = gameWrapper->GetMMRWrapper(); if (myTeamNum == winningTeam.GetTeamNum()) { // On Win, Increase streak and Win Number stats[currentPlaylist].win += 1; session.win += 1; if (stats[currentPlaylist].streak < 0) { session.streak = 1; stats[currentPlaylist].streak = 1; } else { session.streak += 1; stats[currentPlaylist].streak += 1; } //cvarManager->log("You WIN"); writeWin(); } else { // On Loose, Increase Win Number and decrease streak stats[currentPlaylist].losses += 1; session.losses += 1; if (stats[currentPlaylist].streak > 0) { session.streak = -1; stats[currentPlaylist].streak = -1; } else { session.streak -= 1; stats[currentPlaylist].streak -= 1; } //cvarManager->log("You LOOSE"); writeLosses(); } ComputeMMR(3); writeStreak(); // Reset myTeamNum security myTeamNum = -1; WriteInFile("RocketStats_images/BoostState.txt", std::to_string(-1)); } } void RocketStats::GameDestroyed(std::string eventName) { //Check if Game Ended, if not, RAGE QUIT or disconnect if (isGameStarted == true && isGameEnded == false) { session.losses += 1; stats[currentPlaylist].losses += 1; if (stats[currentPlaylist].streak > 0) { session.streak = 0; stats[currentPlaylist].streak = -1; } else { session.streak -= 1; stats[currentPlaylist].streak -= 1; } //cvarManager->log("You LOOSE"); writeStreak(); writeLosses(); ComputeMMR(10); } isGameEnded = true; isGameStarted = false; WriteInFile("RocketStats_images/BoostState.txt", std::to_string(-1)); } void RocketStats::ComputeMMR(int intervalTime) { gameWrapper->SetTimeout([&](GameWrapper* gameWrapper) { MMRWrapper mmrw = gameWrapper->GetMMRWrapper(); float save = mmrw.GetPlayerMMR(mySteamID, currentPlaylist); SkillRank playerRank = mmrw.GetPlayerRank(mySteamID, currentPlaylist); if (save <= 0) { return ComputeMMR(1); } currentTier = playerRank.Tier; if (stats[currentPlaylist].isInit == false) { stats[currentPlaylist].myMMR = save; stats[currentPlaylist].isInit = true; } stats[currentPlaylist].MMRChange = stats[currentPlaylist].MMRChange + (save - stats[currentPlaylist].myMMR); stats[currentPlaylist].myMMR = save; majRank(currentPlaylist, stats[currentPlaylist].myMMR, playerRank); SessionStats(); writeMMR(); writeMMRChange(); }, intervalTime); } void RocketStats::SessionStats() { Stats tmp; auto it = playlistName.begin(); for (; it != playlistName.end(); it++) { tmp.MMRChange += stats[it->first].MMRChange; tmp.win += stats[it->first].win; tmp.losses += stats[it->first].losses; } session.myMMR = stats[currentPlaylist].myMMR; session.MMRChange = tmp.MMRChange; session.win = tmp.win; session.losses = tmp.losses; } void RocketStats::OnBoost(std::string eventName) { //cvarManager->log("BOOOOST"); // Check if boost enabled in options bool IsBoostEnabled = cvarManager->getCvar("RocketStats_stop_boost").getBoolValue(); if (IsBoostEnabled == false) { return; } if (gameWrapper->IsInReplay() || isBoosting) return; CarWrapper cWrap = gameWrapper->GetLocalCar(); if (!cWrap.IsNull()) { BoostWrapper bWrap = cWrap.GetBoostComponent(); if (!bWrap.IsNull() && bWrap.GetbActive() == 1 && isBoosting == false) { //cvarManager->log("Tu boost"); isBoosting = true; WriteInFile("RocketStats_images/BoostState.txt", std::to_string(1)); } //cvarManager->log("BOOOOST ----> " + std::to_string(bWrap.GetbActive())); } return; } void RocketStats::OnBoostEnd(std::string eventName) { // Check if boost enabled in options bool IsBoostEnabled = cvarManager->getCvar("RocketStats_stop_boost").getBoolValue(); if (!IsBoostEnabled) return; if (gameWrapper->IsInReplay() || !isBoosting) return; CarWrapper cWrap = gameWrapper->GetLocalCar(); if (!cWrap.IsNull()) { BoostWrapper bWrap = cWrap.GetBoostComponent(); if (!bWrap.IsNull() && bWrap.GetbActive() == 0 && isBoosting == true) { //cvarManager->log("Tu ne boost plus"); isBoosting = false; WriteInFile("RocketStats_images/BoostState.txt", std::to_string(0)); } //cvarManager->log("BOOOOST ----> " + std::to_string(bWrap.GetbActive())); } return; } // Act as toggle void RocketStats::StopBoost() { //cvarManager->log("hey"); } void RocketStats::ResetStats() { for (auto& kv : stats) { kv.second.myMMR = 100.0f; kv.second.MMRChange = 0; kv.second.win = 0; kv.second.losses = 0; kv.second.streak = 0; kv.second.isInit = 0; } session.myMMR = 100.0f; session.MMRChange = 0; session.win = 0; session.losses = 0; session.streak = 0; session.isInit = 0; WriteInFile("RocketStats_Win.txt", std::to_string(0)); WriteInFile("RocketStats_Streak.txt", std::to_string(0)); WriteInFile("RocketStats_Loose.txt", std::to_string(0)); WriteInFile("RocketStats_MMRChange.txt", std::to_string(0)); WriteInFile("RocketStats_MMR.txt", std::to_string(0)); WriteInFile("RocketStats_Rank.txt", ""); WriteInFile("RocketStats_GameMode.txt", ""); initRank(); } void RocketStats::WriteInFile(std::string _fileName, std::string _value) { std::ofstream myFile; myFile.open("./bakkesmod/RocketStats/" + _fileName, std::ios::out | std::ios::trunc); if (myFile.is_open()) { myFile << _value; myFile.close(); } } std::string RocketStats::getPlaylistName(int playlistID) { if (playlistName.find(playlistID) != playlistName.end()) { return playlistName.at(playlistID); } return "Unknown Game Mode"; } #pragma region Rank/Div void RocketStats::initRank() { lastGameMode = 0; currentGameMode = 0; currentMMR = 0; currentDivision = " nodiv"; currentRank = "norank"; lastRank = "norank"; std::string _value = "<meta http-equiv = \"refresh\" content = \"5\" /><img src = \"current.png\" width = \"1381\" height = \"1381\" />"; WriteInFile("RocketStats_images/rank.html", _value); } void RocketStats::majRank(int _gameMode, float _currentMMR, SkillRank playerRank) { currentGameMode = _gameMode; currentMMR = _currentMMR; lastRank == currentRank; if (currentGameMode >= 10 && currentGameMode <= 13 || currentGameMode >= 27 && currentGameMode <= 30) { if (playerRank.MatchesPlayed < 10 && playerRank.Tier == 0) { currentDivision = " Division " + std::to_string(playerRank.Division + 1); currentRank = "Unranked"; currentDivision = std::to_string(playerRank.MatchesPlayed) + "/10"; } else { currentRank = GetRank(playerRank.Tier); currentDivision = " Div. " + std::to_string(playerRank.Division + 1); } //currentRank = GetRank(playerRank.Tier); //currentDivision = " Div. " + std::to_string(playerRank.Division + 1); if (currentRank != lastRank) { std::string _value = "<meta http-equiv = \"refresh\" content = \"5\" /><img src = \"" + currentRank + ".png" + "\" width = \"1381\" height = \"1381\" />"; WriteInFile("RocketStats_images/rank.html", _value); WriteInFile("RocketStats_Rank.txt", currentRank); } } else { currentRank = "norank"; currentDivision = " nodiv"; std::string _value = "<meta http-equiv = \"refresh\" content = \"5\" /><img src = \"current.png\" width = \"1381\" height = \"1381\" />"; WriteInFile("RocketStats_images/rank.html", _value); WriteInFile("RocketStats_Rank.txt", currentRank); } } #pragma endregion void RocketStats::DisplayRank(CanvasWrapper canvas, Vector2 imagePos, Vector2 textPos_tmp, float scale) { std::string tmpRank = currentRank; if (currentTier >= rank_nb) { currentTier = 0; } auto image = rank[currentTier].image; std::replace(tmpRank.begin(), tmpRank.end(), '_', ' '); canvas.SetColor(255, 255, 255, 255); canvas.SetPosition(imagePos); if (image->IsLoadedForCanvas()) canvas.DrawTexture(image.get(), 0.5f * scale); canvas.SetPosition(textPos_tmp); canvas.DrawString(tmpRank + currentDivision, 2.0f * scale, 2.0f * scale); } void RocketStats::DisplayMMR(CanvasWrapper canvas, Vector2 imagePos, Vector2 textPos_tmp, Stats current, float scale) { std::stringstream ss; ss << std::fixed << std::setprecision(2) << current.myMMR; std::string mmr = ss.str(); std::stringstream ss_change; ss_change << std::fixed << std::setprecision(2) << current.MMRChange; std::string change = ss_change.str(); canvas.SetColor(255, 255, 255, 255); canvas.SetPosition(imagePos); if (crown->IsLoadedForCanvas()) canvas.DrawTexture(crown.get(), 0.5f * scale); canvas.SetPosition(textPos_tmp); canvas.SetColor(255, 255, 255, 255); if (current.MMRChange > 0) { change = "+" + change; } canvas.DrawString(mmr + " (" + change + ")", 2.0f * scale, 2.0f * scale); } void RocketStats::DisplayWins(CanvasWrapper canvas, Vector2 imagePos, Vector2 textPos_tmp, Stats current, float scale) { canvas.SetColor(255, 255, 255, 255); canvas.SetPosition(imagePos); if (win->IsLoadedForCanvas()) canvas.DrawTexture(win.get(), 0.5f * scale); canvas.SetPosition(textPos_tmp); canvas.SetColor(0, 255, 0, 255); canvas.DrawString(std::to_string(current.win), 2.0f * scale, 2.0f * scale); } void RocketStats::DisplayLoose(CanvasWrapper canvas, Vector2 imagePos, Vector2 textPos_tmp, Stats current, float scale) { canvas.SetColor(255, 255, 255, 255); canvas.SetPosition(imagePos); if (loose->IsLoadedForCanvas()) canvas.DrawTexture(loose.get(), 0.5f * scale); canvas.SetPosition(textPos_tmp); canvas.SetColor(255, 0, 0, 255); canvas.DrawString(std::to_string(current.losses), 2.0f * scale, 2.0f * scale); } void RocketStats::DisplayStreak(CanvasWrapper canvas, Vector2 imagePos, Vector2 textPos_tmp, Stats current, float scale) { canvas.SetColor(255, 255, 255, 255); canvas.SetPosition(textPos_tmp); if (current.streak < 0) { canvas.SetColor(255, 0, 0, 255); } else { canvas.SetColor(0, 255, 0, 255); } std::string streak = std::to_string(current.streak); if (current.streak > 0) { streak = "+" + streak; } canvas.DrawString(streak, 2.0f * scale, 2.0f * scale); } void RocketStats::Render(CanvasWrapper canvas) { bool RS_Use_v1 = cvarManager->getCvar("RS_Use_v1").getBoolValue(); bool RS_disp_ig = cvarManager->getCvar("RS_disp_ig").getBoolValue(); bool RS_hide_overlay_ig = cvarManager->getCvar("RS_hide_overlay_ig").getBoolValue(); float RS_x_position = cvarManager->getCvar("RS_x_position").getFloatValue(); float RS_y_position = cvarManager->getCvar("RS_y_position").getFloatValue(); float RS_scale = cvarManager->getCvar("RS_scale").getFloatValue(); cvarManager->getCvar("RS_disp_active").setValue(RS_disp_ig); if (!RS_disp_ig) { return; } if (isGameStarted && !isGameEnded && RS_hide_overlay_ig) { return; } bool RS_session = cvarManager->getCvar("RS_session").getBoolValue(); Stats current = (RS_session == true) ? session : stats[currentPlaylist]; if (!RS_Use_v1) { auto canSize = canvas.GetSize(); Vector2 imagePos = { RS_x_position * canSize.X, RS_y_position * canSize.Y }; Vector2 textPos_tmp = imagePos; textPos_tmp.X += 50 * RS_scale; textPos_tmp.Y += 10 * RS_scale; // Display Rank if (cvarManager->getCvar("RS_disp_rank").getBoolValue()) { DisplayRank(canvas, imagePos, textPos_tmp, RS_scale); imagePos.Y += 50 * RS_scale; textPos_tmp.Y += 50 * RS_scale; } // Display MMR if (cvarManager->getCvar("RS_disp_mmr").getBoolValue()) { DisplayMMR(canvas, imagePos, textPos_tmp, current, RS_scale); imagePos.Y += 50 * RS_scale; textPos_tmp.Y += 50 * RS_scale; } // Display Win if (cvarManager->getCvar("RS_disp_wins").getBoolValue()) { DisplayWins(canvas, imagePos, textPos_tmp, current, RS_scale); imagePos.Y += 50 * RS_scale; textPos_tmp.Y += 50 * RS_scale; } // Display Loose if (cvarManager->getCvar("RS_disp_losses").getBoolValue()) { DisplayLoose(canvas, imagePos, textPos_tmp, current, RS_scale); } if (cvarManager->getCvar("RS_disp_streak").getBoolValue()) { textPos_tmp.X += 75 * RS_scale; textPos_tmp.Y -= 25 * RS_scale; DisplayStreak(canvas, imagePos, textPos_tmp, current, RS_scale); } } else { std::vector<std::string> RS_values = { "RS_disp_gamemode", "RS_disp_rank", "RS_disp_mmr", "RS_disp_wins", "RS_disp_losses", "RS_disp_streak", }; unsigned int size = 0; for (auto& it : RS_values) { bool tmp = cvarManager->getCvar(it).getBoolValue(); if (tmp) size += 1; if (it == "RS_disp_mmr") { size += 1; } } // Draw box here Vector2 drawLoc = { canvas.GetSize().X * RS_x_position, canvas.GetSize().Y * RS_y_position }; Vector2 sizeBox = { 175 * RS_scale, (23 * size) * RS_scale }; canvas.SetPosition(drawLoc); //Set background Color canvas.SetColor(0, 0, 0, 150); canvas.FillBox(sizeBox); // Draw text Vector2 textPos = { (drawLoc.X + 10), (drawLoc.Y + 10) }; for (auto& it : RS_values) { bool tmp = cvarManager->getCvar(it).getBoolValue(); if (tmp) { //Set the position canvas.SetPosition(textPos); //Set Color and Text for the value if (it == "RS_disp_gamemode") { canvas.SetColor(180, 180, 180, 255); canvas.DrawString(getPlaylistName(currentPlaylist), RS_scale, RS_scale); } else if (it == "RS_disp_rank") { std::string tmpRank = currentRank + currentDivision; std::replace(tmpRank.begin(), tmpRank.end(), '_', ' '); canvas.SetColor(180, 180, 180, 255); canvas.DrawString(tmpRank, RS_scale, RS_scale); } else if (it == "RS_disp_mmr") { canvas.SetColor(180, 180, 180, 255); std::stringstream ss; ss << std::fixed << std::setprecision(2) << current.myMMR; std::string mmr = ss.str(); canvas.DrawString("MMR : " + mmr, RS_scale, RS_scale); textPos.Y += (20 * RS_scale); canvas.SetPosition(textPos); std::stringstream ss_change; ss_change << std::fixed << std::setprecision(2) << current.MMRChange; std::string mmrchange = ss_change.str(); if (current.MMRChange >= 0) { canvas.SetColor(30, 224, 24, 255); canvas.DrawString("MMRChange : +" + mmrchange, RS_scale, RS_scale); } else { canvas.SetColor(224, 24, 24, 255); canvas.DrawString("MMRChange : " + mmrchange, RS_scale, RS_scale); } } else if (it == "RS_disp_wins") { canvas.SetColor(30, 224, 24, 255); canvas.DrawString("Win : " + std::to_string(current.win), RS_scale, RS_scale); } else if (it == "RS_disp_losses") { canvas.SetColor(224, 24, 24, 255); canvas.DrawString("Losses : " + std::to_string(current.losses), RS_scale, RS_scale); } else if (it == "RS_disp_streak") { if (current.streak >= 0) { canvas.SetColor(30, 224, 24, 255); canvas.DrawString("Streak : +" + std::to_string(current.streak), RS_scale, RS_scale); } else { canvas.SetColor(224, 24, 24, 255); canvas.DrawString("Streak : " + std::to_string(current.streak), RS_scale, RS_scale); } } // Increase Y position; textPos.Y += (20 * RS_scale); } } } } void RocketStats::writeMMR() { bool RS_session = cvarManager->getCvar("RS_session").getBoolValue(); WriteInFile("RocketStats_MMR.txt", std::to_string((int)stats[currentPlaylist].myMMR)); } void RocketStats::writeMMRChange() { bool RS_session = cvarManager->getCvar("RS_session").getBoolValue(); Stats current = (RS_session == true) ? session : stats[currentPlaylist]; int tmp = ((current.MMRChange < 0) ? -1 : 1) * std::round(fabs(current.MMRChange)); if (tmp >= 0) { WriteInFile("RocketStats_MMRChange.txt", "+" + std::to_string(tmp)); } else { WriteInFile("RocketStats_MMRChange.txt", std::to_string(tmp)); } } void RocketStats::writeStreak() { bool RS_session = cvarManager->getCvar("RS_session").getBoolValue(); Stats current = (RS_session == true) ? session : stats[currentPlaylist]; if (current.streak > 0) { WriteInFile("RocketStats_Streak.txt", "+" + std::to_string(current.streak)); } else { WriteInFile("RocketStats_Streak.txt", std::to_string(current.streak)); } } void RocketStats::writeWin() { bool RS_session = cvarManager->getCvar("RS_session").getBoolValue(); Stats current = (RS_session == true) ? session : stats[currentPlaylist]; WriteInFile("RocketStats_Win.txt", std::to_string(current.win)); } void RocketStats::writeLosses() { bool RS_session = cvarManager->getCvar("RS_session").getBoolValue(); Stats current = (RS_session == true) ? session : stats[currentPlaylist]; WriteInFile("RocketStats_Loose.txt", std::to_string(current.losses)); }
31.154589
157
0.689952
[ "render", "vector" ]
3e6f9a9c51a20d1f9d766f2d61cfa33be1914029
6,070
cpp
C++
include/cinolib/feature_network.cpp
Deiv99/cinolib
fbb6e951703764e5b97f074aede87752c3165d17
[ "MIT" ]
532
2018-05-11T14:28:32.000Z
2022-03-29T12:42:07.000Z
include/cinolib/feature_network.cpp
Deiv99/cinolib
fbb6e951703764e5b97f074aede87752c3165d17
[ "MIT" ]
33
2018-08-01T16:47:01.000Z
2021-09-29T14:36:12.000Z
include/cinolib/feature_network.cpp
Deiv99/cinolib
fbb6e951703764e5b97f074aede87752c3165d17
[ "MIT" ]
64
2018-09-07T13:02:02.000Z
2022-03-13T18:17:29.000Z
/******************************************************************************** * This file is part of CinoLib * * Copyright(C) 2016: Marco Livesu * * * * The MIT License * * * * 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 NON INFRINGEMENT. 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. * * * * Author(s): * * * * Marco Livesu (marco.livesu@gmail.com) * * http://pers.ge.imati.cnr.it/livesu/ * * * * Italian National Research Council (CNR) * * Institute for Applied Mathematics and Information Technologies (IMATI) * * Via de Marini, 6 * * 16149 Genoa, * * Italy * *********************************************************************************/ #include <cinolib/feature_network.h> namespace cinolib { template<class M, class V, class E, class P> CINO_INLINE void feature_network(const AbstractPolygonMesh<M,V,E,P> & m, std::vector<std::vector<uint>> & network, const FeatureNetworkOptions & opt) { std::vector<bool> visited(m.num_edges(),false); // find start points first std::unordered_set<uint> seeds; for(uint vid=0; vid<m.num_verts(); ++vid) { std::vector<uint> incoming_creases; for(uint eid : m.adj_v2e(vid)) { if(m.edge_data(eid).flags[CREASE]) incoming_creases.push_back(eid); } if(!incoming_creases.empty() && incoming_creases.size()!=2) { seeds.insert(vid); } else if(opt.split_lines_at_high_curvature_points && incoming_creases.size()==2) { uint e0 = incoming_creases.front(); uint e1 = incoming_creases.back(); vec3d u = m.vert(vid) - m.vert(m.vert_opposite_to(e0,vid)); vec3d v = m.vert(m.vert_opposite_to(e1,vid)) - m.vert(vid); if(u.angle_deg(v)>opt.ang_thresh_deg) { seeds.insert(vid); } } } //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: // utility to flood a feature curve (stops at feature corners/endpoints or when a loop is closed) auto flood_feature = [&](const uint start, const uint eid) -> std::vector<uint> { std::vector<uint> feat_line; feat_line.push_back(start); assert(eid>=0); visited.at(eid) = true; std::queue<uint> q; q.push(m.vert_opposite_to(eid,start)); while(!q.empty()) { uint vid = q.front(); feat_line.push_back(vid); q.pop(); // stop if you hit a splitpoint along a curve if(CONTAINS(seeds,vid)) break; std::vector<uint> next_pool; for(uint nbr : m.adj_v2v(vid)) { int eid = m.edge_id(vid,nbr); assert(eid>=0); if(m.edge_data(eid).flags[CREASE]) next_pool.push_back(eid); } if(next_pool.size()==2) { for(uint eid : next_pool) { if(visited.at(eid)) continue; visited.at(eid) = true; q.push(m.vert_opposite_to(eid,feat_line.back())); } } } return feat_line; }; //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: for(uint vid : seeds) { for(uint eid : m.adj_v2e(vid)) { if(!visited.at(eid) && m.edge_data(eid).flags[CREASE]) { network.emplace_back(flood_feature(vid,eid)); } } } // closed loops are not caught by the previous cycle for(uint eid=0; eid<m.num_edges(); ++eid) { if(!visited.at(eid) && m.edge_data(eid).flags[CREASE]) { network.emplace_back(flood_feature(m.edge_vert_id(eid,0),eid)); } } } }
43.669065
101
0.436244
[ "vector" ]
3e73a42135e436a3d100258a98cc6efd0b8cf84c
7,754
cpp
C++
src/ipc/client.cpp
dmitritt/lb
936f2a7c7546b7d74cdf6a552012deed87e4ab79
[ "MIT" ]
null
null
null
src/ipc/client.cpp
dmitritt/lb
936f2a7c7546b7d74cdf6a552012deed87e4ab79
[ "MIT" ]
4
2015-11-27T11:03:37.000Z
2015-12-10T15:55:02.000Z
src/ipc/client.cpp
dmitritt/qlb
936f2a7c7546b7d74cdf6a552012deed87e4ab79
[ "MIT" ]
null
null
null
/* * Copyright (c) 2016 Dmitri * * 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. */ #include <algorithm> #include <utility> #include "../backend/backendconnection.hpp" #include "client.hpp" namespace { // 'no available backends const unsigned char NO_AVAILABLE_BACKENDS[] = {0x01,0x02,0x00,0x00,0x1f,0x00,0x00,0x00,0x80,0x6e,0x6f,0x20,0x61,0x76,0x61,0x69,0x6c,0x61,0x62,0x6c,0x65,0x20,0x62,0x61,0x63,0x6b,0x65,0x6e,0x64,0x73,0x00}; } namespace IPC { namespace detail { class SimpleHandshakeResponse : public IPC::HandshakeResponse { public: SimpleHandshakeResponse(Client& client_) : client{client_} {} bool releaseAfterHandshake() override {return true;} void sendHandshakeResponse(char response) override {client.sendHandshakeResponse(response);} void onDisconnect() override {client.onDisconnect();} private: Client& client; }; // shake hand before sending request class BeforeRequestHandshakeResponse : public IPC::HandshakeResponse { public: BeforeRequestHandshakeResponse(Client& client_) : client{client_} {} bool releaseAfterHandshake() override {return false;} void sendHandshakeResponse(char ignored) override {client.doSendRequest();} void onDisconnect() override {client.onDisconnect();} private: Client& client; }; class ResponseImpl : public IPC::Response { public: ResponseImpl(Client& client_) : client{client_} {} Header& getResponseHeader() override {return client.request.getHeader();} message_size_t sendResponseHeader() override { return bytesToRead = client.sendResponseHeader(); } message_size_t sendResponseChunk(buffer chunk) override { client.addResponseChunk(chunk); return std::max<message_size_t>(bytesToRead -= chunk->size(), 0); } void onDisconnect() override {client.onDisconnect();} private: Client& client; message_size_t bytesToRead; }; } // namespace detail Client::Client(ClientContext& clientContext_, tcp::socket&& socket, std::vector<char>&& buffer) : AbstractClient{std::move(socket)}, clientContext{clientContext_}, handshakeRequest{0UL, std::move(buffer)}, simpleHandshakeResponse{new detail::SimpleHandshakeResponse{*this}}, request{clientContext.bufferPool}, beforeRequestHandshakeResponse{new detail::BeforeRequestHandshakeResponse{*this}}, response{new detail::ResponseImpl{*this}}, responseChunks([this](std::pair<IPC::buffer,message_size_t>& p) { sendResponseChunk(p); }){ } Client::~Client() { } void Client::start() { assert(connections.empty()); if (!getAvailableConnection()) { disconnect(); } else { assert(!currentConnection->isConnected()); currentConnection->start(handshakeRequest, *(simpleHandshakeResponse.get())); } } void Client::disconnect() { AbstractClient::disconnect(); } bool Client::getAvailableConnection() { for (auto& c : connections) { if (c->take()) { currentConnection = c; return true; } } auto backend = clientContext.backendManager.getAvailableBackend(); if (!backend) { return false; } for (auto& c : connections) { if (*c == backend) { currentConnection = c; return true; } } currentConnection.reset(new BackendConnection{clientContext.bufferPool, backend, clientContext.backendManager.ioService}); connections.push_back(currentConnection); return true; } void Client::sendHandshakeResponse(char response) { auto self = shared_from_this(); shakehandResponse = response; boost::asio::async_write( socket, boost::asio::buffer(&shakehandResponse, sizeof(shakehandResponse)), [this, self](const boost::system::error_code& ec, std::size_t bytes_transferred) { if (ec) { // TODO log disconnect(); } else { readRequestHeader(); } }); } void Client::readRequestHeader() { auto self = shared_from_this(); boost::asio::async_read( socket, boost::asio::buffer(request.getHeader().get(), request.getHeader().size()), [this, self](const boost::system::error_code& ec, std::size_t bytes_transferred) { if (ec) { // TODO log disconnect(); } else { readRequestBody(); } }); } void Client::readRequestBody() { auto self = shared_from_this(); request.parseBodySize(); request.ensureBodyBufferCapacity(); boost::asio::async_read( socket, boost::asio::buffer(request.getBody(), request.getBodySize()), [this, self](const boost::system::error_code& ec, std::size_t bytes_transferred) { if (ec) { // TODO log disconnect(); } else { sendRequest(); } }); } void Client::sendRequest() { if (!getAvailableConnection()) { sendNoAvailableBackendsError(); } else if (currentConnection->isConnected()) { doSendRequest(); } else { currentConnection->start(handshakeRequest, *(beforeRequestHandshakeResponse.get())); } } void Client::doSendRequest() { currentConnection->executeRequest(request, *(response.get())); } void Client::sendNoAvailableBackendsError() { auto self = shared_from_this(); boost::asio::async_write( socket, boost::asio::buffer(NO_AVAILABLE_BACKENDS, sizeof(NO_AVAILABLE_BACKENDS)), [this, self](const boost::system::error_code& ec, std::size_t bytes_transferred) { if (ec) { // TODO log disconnect(); } else { readRequestHeader(); } }); } message_size_t Client::sendResponseHeader() { message_size_t bytesToSend = request.getHeader().getBodySize(); responseChunks.setBytesToSend(bytesToSend); auto self = shared_from_this(); boost::asio::async_write( socket, boost::asio::buffer(request.getHeader().get(), request.getHeader().size()), [this, self](const boost::system::error_code& ec, std::size_t bytes_transferred) { if (ec) { // TODO log disconnect(); } else { sendNextResponseChunk(); } }); return bytesToSend; } void Client::addResponseChunk(buffer bytes) { responseChunks.put(bytes); } void Client::sendResponseChunk(std::pair<buffer,message_size_t>& p) { if (p.second) { auto b = p.first; auto self = shared_from_this(); boost::asio::async_write( socket, boost::asio::buffer(b->get(), p.second), [this, self, b](const boost::system::error_code& ec, std::size_t bytes_transferred) { if (ec) { // TODO log disconnect(); } else { sendNextResponseChunk(); } }); } } void Client::sendNextResponseChunk() { auto p = responseChunks.get(); sendResponseChunk(p); } void Client::onDisconnect() { // TODO log disconnect(); } } // namespace IPC
28.932836
205
0.686613
[ "vector" ]
3e75d827f73bc1e3bb48c82c8b0fc7b7a8b323b8
18,905
cc
C++
src/szgPartiutil.cc
vodp/spacious
f3d16d5baca138c5f4a2a3afee5cca4ff4009fc7
[ "Apache-2.0" ]
1
2018-05-24T00:46:14.000Z
2018-05-24T00:46:14.000Z
src/szgPartiutil.cc
vodp/spacious
f3d16d5baca138c5f4a2a3afee5cca4ff4009fc7
[ "Apache-2.0" ]
null
null
null
src/szgPartiutil.cc
vodp/spacious
f3d16d5baca138c5f4a2a3afee5cca4ff4009fc7
[ "Apache-2.0" ]
null
null
null
/* * Utility functions for szgPartiview. * Stuart Levy, slevy@ncsa.uiuc.edu * National Center for Supercomputing Applications, * University of Illinois 2001. * This file is part of partiview, released under the * Illinois Open Source License; see the file LICENSE.partiview for details. */ #include <stdio.h> #include <stdlib.h> #ifdef _WIN32 #include "winjunk.h" #endif #ifdef __APPLE__ #include <OpenGL/gl.h> #else #include <GL/gl.h> /* for GLuint */ #endif #include "geometry.h" #include "shmem.h" #include <string.h> #include <stdarg.h> #include <math.h> #include <errno.h> #include <signal.h> #include "specks.h" #include "partiviewc.h" #include "szgPartiview.h" #include <ctype.h> #undef isspace /* hack for irix 6.5 */ #undef isdigit /* Handle pick results */ void specks_picker( void *view, int nhits, int nents, GLuint *hitbuf, void *vview ) { #if 0 struct stuff *st; unsigned int bestz = ~0u; struct stuff *bestst = NULL; struct specklist *bestsl; int bestspeckno; int id, bestid = -1; Point bestpos, wpos, cpos; int centerit = Fl::event_state(FL_SHIFT); for(id = 0; id < MAXSTUFF; id++) { if((st = stuffs[id]) == NULL) continue; if(specks_partial_pick_decode( st, id, nhits, nents, hitbuf, &bestz, &bestsl, &bestspeckno, &bestpos )) { bestst = st; bestid = id; } } if(bestst) { char fmt[1024], wpostr[80]; char attrs[1024]; vtfmpoint( &wpos, &bestpos, view->To2w( bestid ) ); if(memcmp( &wpos, &bestpos, sizeof(wpos) )) { sprintf(wpostr, " (w%g %g %g)", wpos.x[0],wpos.x[1],wpos.x[2]); } else { wpostr[0] = '\0'; } vtfmpoint( &cpos, &wpos, view->Tw2c() ); strcpy(fmt, bestsl->bytesperspeck <= SMALLSPECKSIZE(MAXVAL) ? "[g%d]%sPicked %g %g %g%s%.0s @%g (of %d)%s" : "[g%d]%sPicked %g %g %g%s \"%s\" @%g (of %d)%s"); attrs[0] = '\0'; struct speck *sp = NextSpeck( bestsl->specks, bestsl, bestspeckno); if(bestsl->text == NULL && bestst->vdesc[bestst->curdata][0].name[0] != '\0') { strcpy(attrs, ";"); for(int i = 0; i < MAXVAL && bestst->vdesc[bestst->curdata][i].name[0]; i++) { int pos = strlen(attrs); snprintf(attrs+pos, sizeof(attrs)-pos, " %s %g", bestst->vdesc[bestst->curdata][i].name, sp->val[i]); } } if(bestsl->text != NULL) { snprintf(attrs+strlen(attrs), sizeof(attrs)-strlen(attrs), " \"%s\"", bestsl->text); } msg(fmt, bestid, centerit?"*":"", bestpos.x[0],bestpos.x[1],bestpos.x[2], wpostr, bestsl->text ? bestsl->text : sp->title, vlength( &cpos ), nhits, attrs ); if(centerit) { view->center( &wpos ); if(ppui.censize > 0) view->redraw(); } } else { msg("Picked nothing (%d hits)", nhits); } #endif } void parti_set_alias( struct stuff *st, const char *alias ) { if(st == NULL) return; if(alias == NULL) alias = ""; if(st->alias) free(st->alias); st->alias = strdup(alias); } void parti_allobjs( int argc, char *argv[], int verbose ) { struct stuff *st = ppszg.st; if(parti_parse_args( &st, argc, argv, NULL )) return; PvScene *scene = ppszg.scene; if(scene == 0) return; for(int i = 0; i < scene->nobjs(); i++) { st = scene->objstuff(i); if(st) { const char *onoff = st->useme ? "on" : "off"; if(verbose) { if(st->alias) msg("g%d=%s: (%s)", i, st->alias, onoff); else msg("g%d: (%s)", i, onoff); } specks_parse_args( &st, argc, argv ); } } } void parti_redraw() { // nop -- szg is always redrawing. } void parti_update() { // nop too } void parti_censize( float newsize ) { ppszg.scene->censize( newsize ); } float parti_getcensize() { return ppszg.scene->censize(); } char *parti_bgcolor( const char *rgb ) { static char bgc[16]; Point bgcolor; bgcolor = ppszg.bgcolor; if(rgb) { if(1 == sscanf(rgb, "%f%*c%f%*c%f", &bgcolor.x[0], &bgcolor.x[1], &bgcolor.x[2])) bgcolor.x[1] = bgcolor.x[2] = bgcolor.x[0]; ppszg.bgcolor = bgcolor; } sprintf(bgc, "%.3f %.3f %.3f", bgcolor.x[0],bgcolor.x[1],bgcolor.x[2]); return bgc; } char *parti_stereo( const char *ster ) { return "nevermind"; } void parti_detachview( const char *how ) { // nop. } char *parti_winsize( CONST char *newsize ) { static char cursize[24]; sprintf(cursize, "314x159"); return cursize; } char *parti_clip( const char *nearclip, const char *farclip ) { float n = 0.1, f = 2500; int changed = 0; if(nearclip != NULL && sscanf(nearclip, "%f", &n) > 0) { ppszg.nearclip( n ); changed = 1; } if(farclip != NULL && sscanf(farclip, "%f", &f) > 0) { ppszg.farclip( f ); changed = 1; } if(changed) { ppszg.setClipPlanes( ppszg.nearclip(), ppszg.farclip() ); } static char why[16]; sprintf(why, "clip %.4g %.4g", ppszg.nearclip(), ppszg.farclip()); return why; } int parti_move( const char *onoffobj, struct stuff **newst ) { #if 0 XXX this might be nice to implement -- let navigation change an object's placement rather than moving the camera int objno = -1; if(onoffobj) { if(!strcmp(onoffobj, "off")) ppui.view->movingtarget(0); else if(!strcmp(onoffobj, "on")) ppui.view->movingtarget(1); else if(sscanf(onoffobj, "g%d", &objno) > 0 || sscanf(onoffobj, "%d", &objno) > 0) { ppui.view->movingtarget(1); objno = parti_object( onoffobj, newst, 0 ); } else { msg("move {on|off|g<N>} -- select whether navigation can move sub-objects"); } } return ppui.view->movingtarget() ? ppui.view->target() : -1; #endif return -1; } float parti_pickrange( char *newrange ) { #if 0 XXX determines accuracy needed when picking if(newrange) { if(sscanf(newrange, "%f", &ppui.pickrange)) ppszg.view->picksize( 4*ppui.pickrange, 4*ppui.pickrange ); } return ppui.pickrange; #endif return 0; } static int endswith(char *str, char *suf) { if(str==NULL || suf==NULL) return 0; int len = strlen(str); int suflen = strlen(suf); return suflen <= len && memcmp(suf, str+len-suflen, suflen)==0; } int parti_snapset( char *fname, char *frameno, char *imgsize ) { int len; #if unix static char suf[] = ".%03d.ppm.gz"; #else static char suf[] = ".%03d.ppm"; #endif int needsuf; if(fname) { len = strlen(fname); needsuf = strchr(fname, '%')!=NULL || fname[0] == '|' || endswith(fname, ".tif") || endswith(fname, ".tiff") || endswith(fname, ".sgi") || endswith(fname, ".png") || endswith(fname, ".jpeg") || endswith(fname, ".jpg") || endswith(fname, ".ppm") || endswith(fname, ".gz") ? 0 : sizeof(suf)-1; if(ppszg.snapfmt) Free(ppszg.snapfmt); ppszg.snapfmt = NewN(char, len+needsuf+1); sprintf(ppszg.snapfmt, needsuf ? "%s%s" : "%s", fname, suf); } if(frameno) sscanf(frameno, "%d", &ppszg.snapfno); return ppszg.snapfno; } int parti_snapshot( char *snapinfo ) { char tfcmd[10240], *tftail; int fail; #if !WIN32 /* if unix */ static char defsnap[] = "snap.%03d.sgi"; static char prefix[] = "|convert ppm:- "; static char gzprefix[] = "|gzip >"; #else static char defsnap[] = "snap.%03d.ppm"; static char prefix[] = ""; #endif if(snapinfo) snapinfo[0] = '\0'; if(ppszg.snapfmt == NULL) { ppszg.snapfmt = NewN(char, sizeof(defsnap)+1); strcpy(ppszg.snapfmt, defsnap); } if(ppszg.snapfmt[0] == '|' || endswith(ppszg.snapfmt, ".ppm")) { tfcmd[0] = '\0'; #if unix } else if(endswith(ppszg.snapfmt, ".ppm.gz")) { strcpy(tfcmd, gzprefix); #endif } else { strcpy(tfcmd, prefix); } tftail = tfcmd+strlen(tfcmd); sprintf(tftail, ppszg.snapfmt, ppszg.snapfno); // Ensure window's image is up-to-date // parti_update(); #if 0 XXX might be nice to implement this someday, somehow. Probably would need to be a flag read at the end of PvScene::draw() int y, h = ppui.view->h(), w = ppui.view->w(); char *buf = (char *)malloc(w*h*3); if(!ppui.view->snapshot( 0, 0, w, h, buf )) { free(buf); msg("snapshot: couldn't read from graphics window?"); return -2; } FILE *p; #if unix void (*oldpipe)(int); int popened = tfcmd[0] == '|'; if(popened) { oldpipe = signal(SIGPIPE, SIG_IGN); p = popen(tfcmd+1, "w"); } else #endif p = fopen(tfcmd, "wb"); fprintf(p, "P6\n%d %d\n255\n", w, h); for(y = h; --y >= 0 && fwrite(&buf[w*3*y], w*3, 1, p) > 0; ) ; free(buf); fflush(p); fail = ferror(p); #if unix if(popened) { pclose(p); signal(SIGPIPE, oldpipe); } else #endif fclose(p); /* win32 */ if(y >= 0 || fail) { msg("snapshot: Error writing to %s", tfcmd); return -1; } if(snapinfo) sprintf(snapinfo, "%.1000s [%dx%d]", tftail, w, h); #endif return ppszg.snapfno++; } const char *parti_get_alias( struct stuff *st ) { return st && st->alias ? st->alias : ""; } /* * This is how new objects get created -- via "object g<N>" command. */ int parti_object( const char *objname, struct stuff **newst, int create ) { int i = -1; int gname = 0; char c; PvObject *ob = NULL; bool useme = false; if(newst) *newst = ppszg.st; if(objname == NULL) { return parti_idof( ppszg.st ); } if(!strcmp(objname, "c") || !strcmp(objname, "c0")) { return OBJNO_NONE; } c = '='; if(( /* accept gN or gN=... or N or N=... or [gN] */ ((sscanf(objname, "g%d%c", &i, &c) > 0 || sscanf(objname, "%d%c", &i, &c) > 0) && c == '=') || sscanf(objname, "[g%d]", &i) > 0)) { gname = 1; ob = ppszg.scene->obj( i ); if(ob==0 || ob->objstuff() == 0) { if(create) { ob = ppszg.scene->addobj( objname, i ); useme = true; } } else { // Need to create this one useme = true; } } else { for(i = ppszg.scene->nobjs(); --i >= 0; ) { ob = ppszg.scene->obj(i); struct stuff *st = ob->objstuff(); if(st && st->alias && 0==strcmp(st->alias, objname)) { useme = true; break; } } } if(i == -1 && create && !gname) { ob = ppszg.scene->addobj( objname ); if(!gname) parti_set_alias(ob->objstuff(), objname); useme = true; } if(useme && ob->objstuff() != NULL) { ppszg.st = ob->objstuff(); if(newst) *newst = ppszg.st; return ob->id(); } msg("Don't understand object name \"%s\"", objname); return OBJNO_NONE; } int parti_idof( struct stuff *st ) { for(int i = 0; i < ppszg.scene->nobjs(); i++) { if(ppszg.scene->objstuff(i) == st) return i; } return OBJNO_NONE; } float parti_focal( CONST char *newfocal ) { float focallen; if(newfocal && sscanf(newfocal, "%f", &focallen) > 0) ppszg.focallen( focallen ); return ppszg.focallen(); } int parti_focalpoint( int argc, char **argv, Point *focalpoint, float *minfocallen ) { #if 0 int ison; Point fpt; float mlen; int changed = 0; ison = ppui.view->focalpoint( &fpt, &mlen ); if(argc > 0) { if(isalpha(argv[0][0])) { int nowon = getbool(argv[0], -1); if(nowon < 0) argc = 0; else { ison = nowon; changed = 1; argc--; argv++; } } if(getfloats( &fpt.x[0], 3, 0, argc, argv ) || getfloats( &mlen, 1, 3, argc, argv ) || changed) ppui.view->focalpoint( &fpt, mlen, ison ); } ison = ppui.view->focalpoint( &fpt, &mlen ); if(focalpoint) *focalpoint = fpt; if(minfocallen) *minfocallen = mlen; return ison; #endif return 0; } float parti_fovy( CONST char *newfovy ) { // stub return 42; } void parti_center( CONST Point *cen ) { ppszg.scene->center( cen ); } void parti_seto2w( struct stuff *, int objno, const Matrix *o2w ) { PvObject *ob = ppszg.scene->obj( objno ); if(ob) ob->To2w( o2w ); } void parti_geto2w( struct stuff *, int objno, Matrix *o2w ) { PvObject *ob = ppszg.scene->obj( objno ); if(ob) *o2w = *ob->To2w(); } void parti_parent( struct stuff *st, int parent ) { PvObject *ob = ppszg.scene->obj( parti_idof( st ) ); if(ob) ob->parent( parent ); } void parti_nudge_camera( Point *disp ) { Matrix Tc2w, Tdisp, Tnewc2w; parti_getc2w( &Tc2w ); mtranslation( &Tdisp, disp->x[0], disp->x[1], disp->x[2] ); mmmul( &Tnewc2w, &Tc2w,&Tdisp ); parti_setc2w( &Tnewc2w ); } void subcam_matrices( Subcam *sc, Matrix *Tc2subc, float subclrbt[4] ) { Matrix Ry, Rx, Rz, Rflop, Tfy, Tfyx; mrotation( &Rflop, 90, 'x' ); mrotation( &Ry, -sc->azim, 'y' ); mrotation( &Rx, -sc->elev, 'x' ); mrotation( &Rz, -sc->roll, 'z' ); mmmul( &Tfy, &Rflop, &Ry ); mmmul( &Tfyx, &Tfy, &Rx ); mmmul( Tc2subc, &Tfyx, &Rz ); subclrbt[0] = -tanf( sc->nleft * (M_PI/180) ); subclrbt[1] = tanf( sc->right * (M_PI/180) ); subclrbt[2] = -tanf( sc->ndown * (M_PI/180) ); subclrbt[3] = tanf( sc->up * (M_PI/180) ); } int parti_make_subcam( CONST char *name, int argc, char **params ) { Subcam tsc; int index; int i, any = 0; if(name == NULL || params == NULL) return 0; index = parti_subcam_named( name ); if(index > 0) tsc = ppszg.sc[index-1]; for(i = 0; i < 7 && i < argc; i++) { char junk; int ok = sscanf(params[i], "%f%c", ((float *)&tsc.azim) + i, &junk); if(ok == 1) any++; else if(0!=strcmp(params[i], ".") && 0!=strcmp(params[i], "-")) { msg("subcam %s: what's ``%s''?", name, params[i]); return 0; } } if(tsc.nleft + tsc.right == 0 || tsc.ndown + tsc.up == 0) { msg("subcam %s -- degenerate?", name); return 0; } if(any == 0) return index; if(index == 0) { if(any != 7) { msg("new subcam %s: expected 7 parameters", name); return 0; } index = ppszg.sc.size(); ppszg.sc.reserve( index+1 ); } sprintf(tsc.name, "%.7s", name); ppszg.sc[index] = tsc; return index+1; } int parti_subcam_named( CONST char *name ) { for(int i = 0; i < ppszg.sc.size(); i++) if(0==strncmp(ppszg.sc[i].name, name, 7)) return i+1; return 0; } int parti_select_subcam( int index ) { #if 0 if(index <= 0 || index > ppszg.sc.size()) return ppszg.subcam; ppszg.subcam = index; if(index == 0) { ppszg.view->usesubcam(0); parti_redraw(); return 0; } Subcam *tsc = &ppszg.sc[index-1]; Matrix Tc2subc; float subclrbt[4]; subcam_matrices( tsc, &Tc2subc, subclrbt ); ppui.view->Tc2subc( &Tc2subc ); ppui.view->subc_lrbt( subclrbt ); ppui.view->usesubcam(1); parti_redraw(); return index; #endif return 0; } char *parti_get_subcam( int index, char *paramsp ) { if(paramsp) paramsp[0] = '\0'; if(index <= 0 || index > ppszg.sc.size()) return ""; Subcam *sc = &ppszg.sc[index-1]; if(sc->name[0] == '\0') return ""; if(paramsp) sprintf(paramsp, "%g %g %g %g %g %g %g", sc->azim, sc->elev, sc->roll, sc->nleft, sc->right, sc->ndown, sc->up); return sc->name; } int parti_current_subcam( void ) { return 0; } char *parti_subcam_list() { static char *what = 0; char *tail; static char blank[2] = ""; what[0] = '\0'; int i, len; for(i = 0, len = 1; i < ppszg.sc.size(); i++) len += 1 + strlen(ppszg.sc[i].name); delete what; what = new char [len]; for(i = 0, tail = what; i < ppszg.sc.size(); i++) { if(ppszg.sc[i].name[0] != '\0') { sprintf(tail, " %s", ppszg.sc[i].name); tail += strlen(tail); } } return((tail==what) ? blank : what+1); } void parti_setpath( int nframes, struct wfframe *frames, float fps = 30, float *focallens = 0 ) { struct wfpath *path = &ppszg.path; if(path->frames != NULL) free(path->frames); if(path->focallens != NULL) free(path->focallens); path->frames = NULL; path->fps = (fps <= 0 ? 30.0 : fps); path->nframes = nframes; path->frame0 = 1; path->curframe = path->frame0; if(nframes > 0) { path->frames = NewN( struct wfframe, nframes ); memcpy( path->frames, frames, nframes*sizeof(struct wfframe) ); if(focallens != 0) { path->focallens = NewN( float, nframes ); memcpy(path->focallens, focallens, nframes*sizeof(float) ); } } } int parti_readpath( const char *fname ) { int nframes, room; int first = 1; struct wfframe *fr, *cf; FILE *f; char line[256], *cp; int lno = 0; int got; float *focallens; int nfocallens = 0; if(fname == NULL || (f = fopen(fname, "r")) == NULL) { msg("readpath: %.200s: cannot open: %s", fname, strerror(errno)); return 0; } nframes = 0; room = 2000; fr = NewN( struct wfframe, room ); focallens = NewN( float, room ); while(fgets(line, sizeof(line), f) != NULL) { lno++; for(cp = line; isspace(*cp); cp++) ; if(*cp == '#' || *cp == '\0') continue; if(nframes >= room) { room *= 3; fr = RenewN( fr, struct wfframe, room ); focallens = RenewN( focallens, float, room ); } cf = &fr[nframes]; got = sscanf(cp, "%f%f%f%f%f%f%f%f", &cf->tx,&cf->ty,&cf->tz, &cf->rx,&cf->ry,&cf->rz, &cf->fovy, &focallens[nframes]); if(got < 7) { msg( "readpath: %.200s line %d: expected tx ty tz rx ry rz fovy [focallen], got: %.120s", fname, lno, line); fclose(f); return 0; } if(got == 8) nfocallens++; nframes++; } fclose(f); parti_setpath( nframes, fr, 30, nfocallens==nframes ? focallens : 0 ); Free(fr); Free(focallens); parti_setframe( 1 ); msg("%d frames in %.200s", nframes, fname); return 1; } void wf2c2w( Matrix *Tcam, const struct wfframe *wf ) { Matrix Rx, Ry, Rz, T; mtranslation( &T, wf->tx, wf->ty, wf->tz ); mrotation( &Ry, wf->ry, 'y' ); mrotation( &Rz, wf->rz, 'z' ); mrotation( &Rx, wf->rx, 'x' ); mmmul( Tcam, &Rz, &Rx ); mmmul( Tcam, Tcam, &Ry ); mmmul( Tcam, Tcam, &T ); /* so Tcam = Rz * Rx * Ry * T */ } int parti_frame( CONST char *frameno, CONST struct wfpath **pp ) { if(pp != NULL) *pp = &ppszg.path; if(frameno != NULL) { parti_play( "stop" ); return parti_setframe( atoi(frameno) ); } return (ppszg.path.frames == NULL || ppszg.path.nframes <= 0) ? -1 : ppszg.path.curframe; } int parti_setframe( int fno ) { struct wfpath *path = &ppszg.path; if(path->frames == NULL || path->nframes <= 0) return -1; if(fno < path->frame0) fno = path->frame0; else if(fno >= path->frame0 + path->nframes) fno = path->frame0 + path->nframes - 1; Matrix Tc2w; wf2c2w( &Tc2w, &path->frames[fno - path->frame0] ); parti_setc2w( &Tc2w ); // ... angyfov( path->frames[fno - path->frame0].fovy ); path->curframe = fno; if(path->focallens != NULL) ppszg.focallen( path->focallens[fno - path->frame0] ); return fno - path->frame0; } void parti_center( Point *cen ) { ppszg.scene->center( cen ); } void parti_getcenter( Point *cen ) { *cen = *ppszg.scene->center(); } void parti_set_speed( struct stuff *st, double speed ) { // nop } void parti_set_timebase( struct stuff *st, double timebase ) { char str[32]; ppszg.timebasetime = timebase; sprintf(str, "%.16lg", timebase); parti_set_timestep( st, clock_time( st->clk ) ); } void parti_set_timestep( struct stuff *st, double timestep ) { // nop } void parti_set_fwd( struct stuff *st, int fwd ) { // nop }
23.572319
97
0.588627
[ "geometry", "object" ]
3e79953ab2bc4c5f10df6e02a0780ac877bd9302
12,444
cpp
C++
pse/TGUI-0.7.7/tests/Widgets/ChatBox.cpp
ValtoLibraries/PUtils
f30ebf21416654743ad2a05b14974acd27257da8
[ "MIT" ]
null
null
null
pse/TGUI-0.7.7/tests/Widgets/ChatBox.cpp
ValtoLibraries/PUtils
f30ebf21416654743ad2a05b14974acd27257da8
[ "MIT" ]
null
null
null
pse/TGUI-0.7.7/tests/Widgets/ChatBox.cpp
ValtoLibraries/PUtils
f30ebf21416654743ad2a05b14974acd27257da8
[ "MIT" ]
null
null
null
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // // TGUI - Texus's Graphical User Interface // Copyright (C) 2012-2017 Bruno Van de Velde (vdv_b@tgui.eu) // // This software is provided 'as-is', without any express or implied warranty. // In no event will the authors be held liable for any damages arising from the use of this software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it freely, // subject to the following restrictions: // // 1. The origin of this software must not be misrepresented; // you must not claim that you wrote the original software. // If you use this software in a product, an acknowledgment // in the product documentation would be appreciated but is not required. // // 2. Altered source versions must be plainly marked as such, // and must not be misrepresented as being the original software. // // 3. This notice may not be removed or altered from any source distribution. // ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #include "../Tests.hpp" #include <TGUI/Widgets/Label.hpp> #include <TGUI/Widgets/ChatBox.hpp> TEST_CASE("[ChatBox]") { tgui::ChatBox::Ptr chatBox = std::make_shared<tgui::ChatBox>(); chatBox->setFont("resources/DroidSansArmenian.ttf"); SECTION("WidgetType") { REQUIRE(chatBox->getWidgetType() == "ChatBox"); } SECTION("adding lines") { std::shared_ptr<sf::Font> font1 = tgui::Font{"resources/DroidSansArmenian.ttf"}.getFont(); std::shared_ptr<sf::Font> font2 = tgui::Font{"resources/DroidSansArmenian.ttf"}.getFont(); chatBox->setTextColor(sf::Color::Black); chatBox->setTextSize(24); chatBox->setFont(font1); REQUIRE(chatBox->getLineAmount() == 0); chatBox->addLine("Line 1"); REQUIRE(chatBox->getLineAmount() == 1); chatBox->addLine("Line 2", 16); chatBox->addLine("Line 3", sf::Color::Green); chatBox->addLine("Line 4", sf::Color::Yellow, 18); chatBox->addLine("Line 5", sf::Color::Blue, 20, font2); REQUIRE(chatBox->getLineAmount() == 5); REQUIRE(chatBox->getLine(0) == "Line 1"); REQUIRE(chatBox->getLine(1) == "Line 2"); REQUIRE(chatBox->getLine(2) == "Line 3"); REQUIRE(chatBox->getLine(3) == "Line 4"); REQUIRE(chatBox->getLine(4) == "Line 5"); REQUIRE(chatBox->getLineColor(0) == sf::Color::Black); REQUIRE(chatBox->getLineColor(1) == sf::Color::Black); REQUIRE(chatBox->getLineColor(2) == sf::Color::Green); REQUIRE(chatBox->getLineColor(3) == sf::Color::Yellow); REQUIRE(chatBox->getLineColor(4) == sf::Color::Blue); REQUIRE(chatBox->getLineTextSize(0) == 24); REQUIRE(chatBox->getLineTextSize(1) == 16); REQUIRE(chatBox->getLineTextSize(2) == 24); REQUIRE(chatBox->getLineTextSize(3) == 18); REQUIRE(chatBox->getLineTextSize(4) == 20); REQUIRE(chatBox->getLineFont(0) == font1); REQUIRE(chatBox->getLineFont(1) == font1); REQUIRE(chatBox->getLineFont(2) == font1); REQUIRE(chatBox->getLineFont(3) == font1); REQUIRE(chatBox->getLineFont(4) == font2); } SECTION("removing lines") { REQUIRE(!chatBox->removeLine(0)); chatBox->addLine("Line 1"); chatBox->addLine("Line 2"); chatBox->addLine("Line 3"); REQUIRE(!chatBox->removeLine(5)); REQUIRE(chatBox->getLineAmount() == 3); REQUIRE(chatBox->removeLine(1)); REQUIRE(chatBox->getLineAmount() == 2); REQUIRE(chatBox->getLine(0) == "Line 1"); REQUIRE(chatBox->getLine(1) == "Line 3"); chatBox->removeAllLines(); REQUIRE(chatBox->getLineAmount() == 0); } SECTION("line limit") { REQUIRE(chatBox->getLineLimit() == 0); SECTION("oldest on top") { chatBox->addLine("Line 1"); chatBox->addLine("Line 2"); chatBox->addLine("Line 3"); chatBox->setLineLimit(2); REQUIRE(chatBox->getLineLimit() == 2); REQUIRE(chatBox->getLineAmount() == 2); REQUIRE(chatBox->getLine(0) == "Line 2"); REQUIRE(chatBox->getLine(1) == "Line 3"); chatBox->addLine("Line 4"); REQUIRE(chatBox->getLine(0) == "Line 3"); REQUIRE(chatBox->getLine(1) == "Line 4"); } SECTION("oldest at the bottom") { chatBox->setNewLinesBelowOthers(false); chatBox->addLine("Line 1"); chatBox->addLine("Line 2"); chatBox->addLine("Line 3"); chatBox->setLineLimit(2); REQUIRE(chatBox->getLineLimit() == 2); REQUIRE(chatBox->getLineAmount() == 2); REQUIRE(chatBox->getLine(0) == "Line 3"); REQUIRE(chatBox->getLine(1) == "Line 2"); chatBox->addLine("Line 4"); REQUIRE(chatBox->getLine(0) == "Line 4"); REQUIRE(chatBox->getLine(1) == "Line 3"); } } SECTION("default text size") { chatBox->setTextSize(30); REQUIRE(chatBox->getTextSize() == 30); chatBox->addLine("Text"); REQUIRE(chatBox->getLineTextSize(0) == 30); } SECTION("default text color") { chatBox->setTextColor(sf::Color::Red); REQUIRE(chatBox->getTextColor() == sf::Color::Red); chatBox->addLine("Text"); REQUIRE(chatBox->getLineColor(0) == sf::Color::Red); } SECTION("get unexisting line") { std::shared_ptr<sf::Font> font1 = tgui::Font{"resources/DroidSansArmenian.ttf"}.getFont(); std::shared_ptr<sf::Font> font2 = tgui::Font{"resources/DroidSansArmenian.ttf"}.getFont(); chatBox->setTextColor(sf::Color::Yellow); chatBox->setTextSize(26); chatBox->setFont(font1); chatBox->addLine("Text", sf::Color::Blue, 20, font2); REQUIRE(chatBox->getLine(1) == ""); REQUIRE(chatBox->getLineTextSize(2) == 26); REQUIRE(chatBox->getLineColor(3) == sf::Color::Yellow); REQUIRE(chatBox->getLineFont(4) == font1); } SECTION("lines start from top or bottom") { REQUIRE(!chatBox->getLinesStartFromTop()); chatBox->setLinesStartFromTop(true); REQUIRE(chatBox->getLinesStartFromTop()); chatBox->setLinesStartFromTop(false); REQUIRE(!chatBox->getLinesStartFromTop()); } SECTION("Scrollbar") { tgui::Scrollbar::Ptr scrollbar = std::make_shared<tgui::Theme>()->load("scrollbar"); REQUIRE(chatBox->getScrollbar() != nullptr); REQUIRE(chatBox->getScrollbar() != scrollbar); chatBox->setScrollbar(nullptr); REQUIRE(chatBox->getScrollbar() == nullptr); chatBox->setScrollbar(scrollbar); REQUIRE(chatBox->getScrollbar() != nullptr); REQUIRE(chatBox->getScrollbar() == scrollbar); } SECTION("Renderer") { auto renderer = chatBox->getRenderer(); SECTION("colored") { SECTION("set serialized property") { REQUIRE_NOTHROW(renderer->setProperty("BackgroundColor", "rgb(10, 20, 30)")); REQUIRE_NOTHROW(renderer->setProperty("BorderColor", "rgb(40, 50, 60)")); REQUIRE_NOTHROW(renderer->setProperty("Borders", "(1, 2, 3, 4)")); REQUIRE_NOTHROW(renderer->setProperty("Padding", "(5, 6, 7, 8)")); } SECTION("set object property") { REQUIRE_NOTHROW(renderer->setProperty("BackgroundColor", sf::Color{10, 20, 30})); REQUIRE_NOTHROW(renderer->setProperty("BorderColor", sf::Color{40, 50, 60})); REQUIRE_NOTHROW(renderer->setProperty("Borders", tgui::Borders{1, 2, 3, 4})); REQUIRE_NOTHROW(renderer->setProperty("Padding", tgui::Borders{5, 6, 7, 8})); } SECTION("functions") { renderer->setBackgroundColor({10, 20, 30}); renderer->setBorderColor({40, 50, 60}); renderer->setBorders({1, 2, 3, 4}); renderer->setPadding({5, 6, 7, 8}); SECTION("getPropertyValuePairs") { auto pairs = renderer->getPropertyValuePairs(); REQUIRE(pairs.size() == 4); REQUIRE(pairs["BackgroundColor"].getColor() == sf::Color(10, 20, 30)); REQUIRE(pairs["BorderColor"].getColor() == sf::Color(40, 50, 60)); REQUIRE(pairs["Borders"].getBorders() == tgui::Borders(1, 2, 3, 4)); REQUIRE(pairs["Padding"].getBorders() == tgui::Borders(5, 6, 7, 8)); } } REQUIRE(renderer->getProperty("BackgroundColor").getColor() == sf::Color(10, 20, 30)); REQUIRE(renderer->getProperty("BorderColor").getColor() == sf::Color(40, 50, 60)); REQUIRE(renderer->getProperty("Borders").getBorders() == tgui::Borders(1, 2, 3, 4)); REQUIRE(renderer->getProperty("Padding").getBorders() == tgui::Borders(5, 6, 7, 8)); } SECTION("textured") { tgui::Texture textureBackground("resources/Black.png", {0, 154, 48, 48}, {16, 16, 16, 16}); REQUIRE(!renderer->getProperty("BackgroundImage").getTexture().isLoaded()); SECTION("set serialized property") { REQUIRE_NOTHROW(renderer->setProperty("BackgroundImage", tgui::Serializer::serialize(textureBackground))); } SECTION("set object property") { REQUIRE_NOTHROW(renderer->setProperty("BackgroundImage", textureBackground)); } SECTION("functions") { renderer->setBackgroundTexture(textureBackground); SECTION("getPropertyValuePairs") { auto pairs = renderer->getPropertyValuePairs(); REQUIRE(pairs.size() == 4); REQUIRE(pairs["BackgroundImage"].getTexture().getData() == textureBackground.getData()); } } REQUIRE(renderer->getProperty("BackgroundImage").getTexture().isLoaded()); REQUIRE(renderer->getProperty("BackgroundImage").getTexture().getData() == textureBackground.getData()); } } SECTION("Saving and loading from file") { REQUIRE_NOTHROW(chatBox = std::make_shared<tgui::Theme>()->load("ChatBox")); auto theme = std::make_shared<tgui::Theme>("resources/Black.txt"); REQUIRE_NOTHROW(chatBox = theme->load("ChatBox")); REQUIRE(chatBox->getPrimaryLoadingParameter() == "resources/Black.txt"); REQUIRE(chatBox->getSecondaryLoadingParameter() == "chatbox"); auto parent = std::make_shared<tgui::GuiContainer>(); parent->add(chatBox); chatBox->setOpacity(0.8f); chatBox->setTextColor(sf::Color::White); chatBox->setTextSize(34); chatBox->setLineLimit(5); chatBox->setLinesStartFromTop(true); chatBox->setNewLinesBelowOthers(false); chatBox->addLine("L2"); chatBox->addLine("L4", 32); chatBox->addLine("L3", sf::Color::Magenta); chatBox->addLine("L1", sf::Color::Cyan, 36); REQUIRE_NOTHROW(parent->saveWidgetsToFile("WidgetFileChatBox1.txt")); parent->removeAllWidgets(); REQUIRE_NOTHROW(parent->loadWidgetsFromFile("WidgetFileChatBox1.txt")); REQUIRE_NOTHROW(parent->saveWidgetsToFile("WidgetFileChatBox2.txt")); REQUIRE(compareFiles("WidgetFileChatBox1.txt", "WidgetFileChatBox2.txt")); // Make sure that the lines are still in the correct order REQUIRE(chatBox->getLine(0) == "L1"); REQUIRE(chatBox->getLine(1) == "L3"); REQUIRE(chatBox->getLine(2) == "L4"); REQUIRE(chatBox->getLine(3) == "L2"); SECTION("Copying widget") { tgui::ChatBox temp; temp = *chatBox; parent->removeAllWidgets(); parent->add(tgui::ChatBox::copy(std::make_shared<tgui::ChatBox>(temp))); REQUIRE_NOTHROW(parent->saveWidgetsToFile("WidgetFileChatBox2.txt")); REQUIRE(compareFiles("WidgetFileChatBox1.txt", "WidgetFileChatBox2.txt")); } } }
40.934211
129
0.581405
[ "object" ]
3e7a31f12e7d10ed481482b2b16980e6de53eb64
1,764
cpp
C++
Codeforces/C767-Garland.cpp
Sohieeb/competitive-programming
fe3fca0d4d2a242053d097c7ae71667a135cfc45
[ "MIT" ]
1
2020-01-30T20:08:24.000Z
2020-01-30T20:08:24.000Z
Codeforces/C767-Garland.cpp
Sohieb/competitive-programming
fe3fca0d4d2a242053d097c7ae71667a135cfc45
[ "MIT" ]
null
null
null
Codeforces/C767-Garland.cpp
Sohieb/competitive-programming
fe3fca0d4d2a242053d097c7ae71667a135cfc45
[ "MIT" ]
null
null
null
#include <bits/stdc++.h> using namespace std; using namespace __gnu_cxx; typedef double db; typedef long long ll; typedef pair<db, db> pdd; typedef pair<ll, ll> pll; typedef pair<int, int> pii; typedef unsigned long long ull; #define F first #define S second #define pnl printf("\n") #define sz(x) (int)x.size() #define sf(x) scanf("%d",&x) #define pf(x) printf("%d\n",x) #define all(x) x.begin(),x.end() #define rall(x) x.rbegin(),x.rend() #define rep(i, n) for(int i = 0; i < n; ++i) const db eps = 1e-9; const db pi = acos(-1); const int INF = 0x3f3f3f3f; const ll LL_INF = 0x3f3f3f3f3f3f3f3f; const int mod = 1000 * 1000 * 1000 + 7; int n; int root; int par[1000005]; int arr[1000005]; int bad[1000005]; vector<int> adj[1000005]; int sub1 = -1, sub2 = -1; int dfs(int u = root) { for (int i = 0; i < sz(adj[u]); ++i) arr[u] += dfs(adj[u][i]); return arr[u]; } int dfs1(int u = root) { for (int i = 0; i < sz(adj[u]); ++i) bad[u] += dfs1(adj[u][i]); if (arr[u] == arr[root] / 3 && sub1 == -1 && u != root) sub1 = u, bad[u] = arr[u]; return bad[u]; } void dfs2(int u = root) { if (u == sub1) return; for (int i = 0; i < sz(adj[u]); ++i) dfs2(adj[u][i]); if (arr[u] - bad[u] == arr[root] / 3 && sub2 == -1 && u != root) sub2 = u; return; } int main() { scanf("%d", &n); for (int i = 1; i <= n; ++i) { scanf("%d%d", &par[i], &arr[i]); adj[par[i]].push_back(i); if (par[i] == 0) root = i; } dfs(); if (arr[root] % 3 != 0) return !printf("-1\n"); dfs1(); dfs2(); if (sub1 == -1 || sub2 == -1) return !printf("-1\n"); return !printf("%d %d\n", sub1, sub2); return 0; }
23.210526
86
0.515306
[ "vector" ]
3e7c3c0ab7fcb23aad6722b82c7a585ca1d6b990
1,891
cc
C++
OnlineDB/SiStripESSources/test/stubs/test_PedestalsBuilder.cc
nistefan/cmssw
ea13af97f7f2117a4f590a5e654e06ecd9825a5b
[ "Apache-2.0" ]
3
2018-08-24T19:10:26.000Z
2019-02-19T11:45:32.000Z
OnlineDB/SiStripESSources/test/stubs/test_PedestalsBuilder.cc
nistefan/cmssw
ea13af97f7f2117a4f590a5e654e06ecd9825a5b
[ "Apache-2.0" ]
3
2018-08-23T13:40:24.000Z
2019-12-05T21:16:03.000Z
OnlineDB/SiStripESSources/test/stubs/test_PedestalsBuilder.cc
nistefan/cmssw
ea13af97f7f2117a4f590a5e654e06ecd9825a5b
[ "Apache-2.0" ]
5
2018-08-21T16:37:52.000Z
2020-01-09T13:33:17.000Z
#include "OnlineDB/SiStripESSources/test/stubs/test_PedestalsBuilder.h" #include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "DataFormats/SiStripCommon/interface/SiStripConstants.h" #include "CondFormats/DataRecord/interface/SiStripPedestalsRcd.h" #include "CondFormats/SiStripObjects/interface/SiStripPedestals.h" #include <iostream> #include <sstream> using namespace std; using namespace sistrip; // ----------------------------------------------------------------------------- // void test_PedestalsBuilder::analyze( const edm::Event& event, const edm::EventSetup& setup ) { LogTrace(mlCabling_) << "[test_PedestalsBuilder::" << __func__ << "]" << " Dumping all FED connections..."; edm::ESHandle<SiStripPedestals> peds; setup.get<SiStripPedestalsRcd>().get( peds ); // Retrieve DetIds in Pedestals object vector<uint32_t> det_ids; peds->getDetIds( det_ids ); // Iterate through DetIds vector<uint32_t>::const_iterator det_id = det_ids.begin(); for ( ; det_id != det_ids.end(); det_id++ ) { // Retrieve pedestals for given DetId SiStripPedestals::Range range = peds->getRange( *det_id ); // Check if module has 512 or 768 strips (horrible!) uint16_t nstrips = 2*sistrip::STRIPS_PER_FEDCH; // try { // peds->getPed( 2*sistrip::STRIPS_PER_FEDCH, range ); // } catch ( cms::Exception& e ) { // nstrips = 2*sistrip::STRIPS_PER_FEDCH; // } stringstream ss; ss << "[test_PedestalsBuilder::" << __func__ << "]" << " Found " << nstrips << " pedestals for DetId " << *det_id << " (ped/low/high): "; // Extract peds and low/high thresholds for ( uint16_t istrip = 0; istrip < nstrips; istrip++ ) { ss << peds->getPed( istrip, range ) << ", "; } LogTrace(mlCabling_) << ss.str(); } }
31
94
0.638815
[ "object", "vector" ]
3e7e5fefae8480c5fc7d7c6a79337f15a85a6a8c
2,225
hpp
C++
src/Data/Commands/Sentences/SentenceQueryPagedCmd.hpp
viveret/script-ai
15f8dc561e55812de034bb729e83ff01bec61743
[ "BSD-3-Clause" ]
null
null
null
src/Data/Commands/Sentences/SentenceQueryPagedCmd.hpp
viveret/script-ai
15f8dc561e55812de034bb729e83ff01bec61743
[ "BSD-3-Clause" ]
null
null
null
src/Data/Commands/Sentences/SentenceQueryPagedCmd.hpp
viveret/script-ai
15f8dc561e55812de034bb729e83ff01bec61743
[ "BSD-3-Clause" ]
null
null
null
#ifndef SQL_SentenceQueryPagedCmd_H #define SQL_SentenceQueryPagedCmd_H #include "../../Sql/Command.hpp" #include "../../Sql/Context.hpp" #include "../Model/PagedPosition.hpp" #include "../Model/SentenceModel.hpp" namespace ScriptAI { namespace Sql { class SentenceCountCmd: public SqlCommand<void*, size_t, size_t> { public: SentenceCountCmd(sqlite3* sqlContext): SqlCommand("SELECT COUNT(*) FROM Sentences", sqlContext) { } int bind(void*) override { return SQLITE_OK; } size_t eachRow() override { return sqlite3_column_int(this->compiled, 0); } size_t allRows(const std::vector<size_t>& values) override { return values.at(0); } }; class SentenceQueryPagedCmd: public SqlCommand<paged_position, SentenceModel, std::vector<SentenceModel>> { private: int _start, _count; public: SentenceQueryPagedCmd(sqlite3* sqlContext): SqlCommand("SELECT id, source_id, speaker_name, what_said FROM Sentences ORDER BY id ASC LIMIT @start,@count", sqlContext) { _start = this->paramIndex("@start"); _count = this->paramIndex("@count"); } int bind(paged_position value) override { auto err = sqlite3_bind_int(this->compiled, _start, value.start); if (err) { return err; } err = sqlite3_bind_int(this->compiled, _count, value.count); if (err) { return err; } return SQLITE_OK; } SentenceModel eachRow() override { return SentenceModel { (size_t)sqlite3_column_int(this->compiled, 0), (size_t)sqlite3_column_int(this->compiled, 1), std::string((const char*)sqlite3_column_text(this->compiled, 2)), std::string((const char*)sqlite3_column_text(this->compiled, 3)) }; } std::vector<SentenceModel> allRows(const std::vector<SentenceModel>& values) override { return values; } }; } } #endif
38.362069
180
0.570337
[ "vector", "model" ]
3e827fab582dc78af73d7cb38b84666ea6c97bb8
2,123
hpp
C++
capicxx-someip-runtime/include/CommonAPI/SomeIP/Watch.hpp
MicrochipTech/some-ip
b1ab3161f38c4db498c16b1dd478693b17b994f9
[ "BSD-3-Clause" ]
5
2021-09-03T13:31:46.000Z
2022-03-30T05:02:49.000Z
capicxx-someip-runtime/include/CommonAPI/SomeIP/Watch.hpp
MicrochipTech/some-ip
b1ab3161f38c4db498c16b1dd478693b17b994f9
[ "BSD-3-Clause" ]
null
null
null
capicxx-someip-runtime/include/CommonAPI/SomeIP/Watch.hpp
MicrochipTech/some-ip
b1ab3161f38c4db498c16b1dd478693b17b994f9
[ "BSD-3-Clause" ]
5
2019-06-17T05:27:14.000Z
2021-12-26T01:16:08.000Z
// Copyright (C) 2015-2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. #if !defined (COMMONAPI_INTERNAL_COMPILATION) #error "Only <CommonAPI/CommonAPI.h> can be included directly, this file may disappear or change contents." #endif #ifndef WATCH_HPP_ #define WATCH_HPP_ #include <memory> #include <queue> #include <mutex> #include <functional> #include <vsomeip/application.hpp> #include <CommonAPI/MainLoopContext.hpp> #include <CommonAPI/SomeIP/Types.hpp> #include <CommonAPI/SomeIP/ProxyConnection.hpp> namespace CommonAPI { namespace SomeIP { class Connection; struct QueueEntry; class Watch : public CommonAPI::Watch { public: Watch(const std::shared_ptr<Connection>& _connection); virtual ~Watch(); void dispatch(unsigned int eventFlags); const pollfd& getAssociatedFileDescriptor(); #ifdef _WIN32 const HANDLE& getAssociatedEvent(); #endif const std::vector<CommonAPI::DispatchSource*>& getDependentDispatchSources(); void addDependentDispatchSource(CommonAPI::DispatchSource* _dispatchSource); void removeDependentDispatchSource(CommonAPI::DispatchSource* _dispatchSource); void pushQueue(std::shared_ptr<QueueEntry> _queueEntry); void popQueue(); std::shared_ptr<QueueEntry> frontQueue(); bool emptyQueue(); void processQueueEntry(std::shared_ptr<QueueEntry> _queueEntry); private: #ifdef _WIN32 int pipeFileDescriptors_[2]; #else int eventFd_; #endif pollfd pollFileDescriptor_; std::vector<CommonAPI::DispatchSource*> dependentDispatchSources_; std::queue<std::shared_ptr<QueueEntry>> queue_; std::mutex queueMutex_; std::mutex dependentDispatchSourcesMutex_; std::weak_ptr<Connection> connection_; #ifdef _WIN32 HANDLE wsaEvent_; const int pipeValue_; #else const std::uint64_t eventFdValue_; #endif }; } // namespace IntraP } // namespace CommonAPI #endif /* WATCH_HPP_ */
23.588889
107
0.749411
[ "vector" ]
3e8a4f961a48c7fb4c5adb3425f5630031a79435
3,079
cc
C++
src/models/TriangleEdgeFromEdgeModel.cc
QuantumOfMoose/devsim
22f888119059a86bfc87ba9e7d9ac2cc90dadfb6
[ "Apache-2.0" ]
null
null
null
src/models/TriangleEdgeFromEdgeModel.cc
QuantumOfMoose/devsim
22f888119059a86bfc87ba9e7d9ac2cc90dadfb6
[ "Apache-2.0" ]
null
null
null
src/models/TriangleEdgeFromEdgeModel.cc
QuantumOfMoose/devsim
22f888119059a86bfc87ba9e7d9ac2cc90dadfb6
[ "Apache-2.0" ]
null
null
null
/*** DEVSIM Copyright 2013 Devsim LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ***/ #include "TriangleEdgeFromEdgeModel.hh" #include "TriangleEdgeSubModel.hh" #include "Region.hh" #include "TriangleElementField.hh" #include "dsAssert.hh" #include "Vector.hh" template <typename DoubleType> TriangleEdgeFromEdgeModel<DoubleType>::TriangleEdgeFromEdgeModel(const std::string &edgemodel, RegionPtr rp) : TriangleEdgeModel(edgemodel + "_x", rp, TriangleEdgeModel::DisplayType::SCALAR), edgeModelName(edgemodel), y_ModelName(edgeModelName + "_y") { RegisterCallback(edgemodel); new TriangleEdgeSubModel<DoubleType>(y_ModelName, rp, this->GetSelfPtr(), TriangleEdgeModel::DisplayType::SCALAR); } //// Need to figure out the deleter situation from sub models //// Perhaps a Delete SubModels method?????? template <typename DoubleType> void TriangleEdgeFromEdgeModel<DoubleType>::calcTriangleEdgeScalarValues() const { const Region &reg = GetRegion(); const ConstEdgeModelPtr emp = reg.GetEdgeModel(edgeModelName); dsAssert(emp.get(), "UNEXPECTED"); const ConstTriangleEdgeModelPtr tempy = reg.GetTriangleEdgeModel(y_ModelName); dsAssert(tempy.get(), "UNEXPECTED"); const ConstTriangleList &tl = GetRegion().GetTriangleList(); std::vector<DoubleType> evx(3*tl.size()); std::vector<DoubleType> evy(3*tl.size()); const TriangleElementField<DoubleType> &efield = reg.GetTriangleElementField<DoubleType>(); for (size_t i = 0; i < tl.size(); ++i) { const Triangle &triangle = *tl[i]; const std::vector<Vector<DoubleType> > &v = efield.GetTriangleElementField(triangle, *emp); for (size_t j = 0; j < 3; ++j) { evx[3*i + j] = v[j].Getx(); evy[3*i + j] = v[j].Gety(); } } SetValues(evx); std::const_pointer_cast<TriangleEdgeModel, const TriangleEdgeModel>(tempy)->SetValues(evy); } template <typename DoubleType> void TriangleEdgeFromEdgeModel<DoubleType>::Serialize(std::ostream &of) const { of << "COMMAND element_from_edge_model -device \"" << GetDeviceName() << "\" -region \"" << GetRegionName() << "\" -edge_model \"" << edgeModelName << "\""; } template class TriangleEdgeFromEdgeModel<double>; #ifdef DEVSIM_EXTENDED_PRECISION #include "Float128.hh" template class TriangleEdgeFromEdgeModel<float128>; #endif TriangleEdgeModelPtr CreateTriangleEdgeFromEdgeModel(const std::string &edgemodel, RegionPtr rp) { const bool use_extended = rp->UseExtendedPrecisionModels(); return create_triangle_edge_model<TriangleEdgeFromEdgeModel<double>, TriangleEdgeFromEdgeModel<extended_type>>(use_extended, edgemodel, rp); }
34.211111
158
0.750568
[ "vector" ]
3e8e457f02445539acd952cddcaef82655e087d5
17,982
cpp
C++
Source/ModuleGUI.cpp
JorxSS/SalsaEngine
c4914060a77ebc886d1414617d44fc01a94dc563
[ "MIT" ]
null
null
null
Source/ModuleGUI.cpp
JorxSS/SalsaEngine
c4914060a77ebc886d1414617d44fc01a94dc563
[ "MIT" ]
null
null
null
Source/ModuleGUI.cpp
JorxSS/SalsaEngine
c4914060a77ebc886d1414617d44fc01a94dc563
[ "MIT" ]
1
2019-12-02T19:50:38.000Z
2019-12-02T19:50:38.000Z
#include "ModuleGUI.h" #include "Globals.h" #include "Application.h" #include "ModuleRender.h" #include "ModuleWindow.h" #include "ModuleCamera.h" #include "ModuleModelLoader.h" #include "imgui_impl_opengl3.h" #include "imgui_impl_sdl.h" #include "IconsMaterialDesignIcons.h" #include "IconsFontAwesome5.h" #include <string> #include <fstream> #include <sstream> #include <iostream> #include <map> #include <vector> ModuleGUI::ModuleGUI() { } ModuleGUI::~ModuleGUI() { } bool ModuleGUI::Init() { const char* glsl_version = "#version 130"; SDL_GL_SetAttribute(SDL_GL_CONTEXT_FLAGS, 0); SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE); SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3); SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 0); IMGUI_CHECKVERSION(); ImGui::CreateContext(); ImGuiIO& io = ImGui::GetIO(); (void)io; io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; io.ConfigWindowsMoveFromTitleBarOnly = TRUE; ImGui::JordiStyle(); ImGui_ImplSDL2_InitForOpenGL(App->window->window, App->renderer->context); ImGui_ImplOpenGL3_Init(glsl_version); SDL_GetWindowMaximumSize(App->window->window, &max_w, &max_h); SDL_GetWindowMinimumSize(App->window->window, &min_w, &min_h); io.Fonts->AddFontDefault(); // merge in icons static const ImWchar icons_ranges[] = { ICON_MIN_FA, ICON_MAX_FA, 0 }; ImFontConfig icons_config; icons_config.MergeMode = true; icons_config.PixelSnapH = true; io.Fonts->AddFontFromFileTTF("Fonts/" FONT_ICON_FILE_NAME_FAS, 14.0f, &icons_config, icons_ranges); return true; } update_status ModuleGUI::PreUpdate() { ImGui_ImplOpenGL3_NewFrame(); ImGui_ImplSDL2_NewFrame(App->window->window); ImGui::NewFrame(); return UPDATE_CONTINUE; } update_status ModuleGUI::Update() { MainMenu(); if (showAppWindow) ShowDefWindow(); if(showHelpWindow) ShowHelp(); if (showScene) Scene(); if (showInspector) GameObjecInfo(); if (showAboutWindow) ShowAbout(); ShowConsole(ICON_FA_TERMINAL " Console"); return UPDATE_CONTINUE; } update_status ModuleGUI::PostUpdate() { ImGui::Render(); ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData()); SDL_GL_SwapWindow(App->window->window); return UPDATE_CONTINUE; } bool ModuleGUI::CleanUp() { ImGui_ImplOpenGL3_Shutdown(); ImGui_ImplSDL2_Shutdown(); ImGui::DestroyContext(); return true; } void ModuleGUI::EventManager(SDL_Event event) { ImGui_ImplSDL2_ProcessEvent(&event); } void ModuleGUI::ShowConsole(const char * title, bool * p_opened) { ImGui::SetNextWindowSize(ImVec2(500, 400), ImGuiCond_FirstUseEver); ImGui::Begin(title, p_opened); if (ImGui::Button("Clear")) Clear(); ImGui::Separator(); ImGui::BeginChild("scrolling"); ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0, 1)); if (Filter.IsActive()) { const char* buf_begin = logBuffer.begin(); const char* line = buf_begin; for (int line_no = 0; line != NULL; line_no++) { const char* line_end = (line_no < LineOffsets.Size) ? buf_begin + LineOffsets[line_no] : NULL; if (Filter.PassFilter(line, line_end)) ImGui::TextUnformatted(line, line_end); line = line_end && line_end[1] ? line_end + 1 : NULL; } } else { ImGui::TextUnformatted(logBuffer.begin()); } if (ScrollToBottom) ImGui::SetScrollHere(1.0f); ScrollToBottom = false; ImGui::PopStyleVar(); ImGui::EndChild(); ImGui::End(); } void ModuleGUI::MainMenu() { if (ImGui::BeginMainMenuBar()) { if (ImGui::BeginMenu("File")) { if (ImGui::MenuItem("New Scene")) { } if (ImGui::MenuItem("Open Scene")) { } if (ImGui::MenuItem("Save")) { } if (ImGui::MenuItem("New Project")) { } if (ImGui::MenuItem("Open Project")) { } if (ImGui::MenuItem("Save Project")) { } if (ImGui::MenuItem("Exit")) { SDL_Event quit_event; quit_event.type = SDL_QUIT; SDL_PushEvent(&quit_event); } ImGui::EndMenu(); } if (ImGui::BeginMenu("Game Object")) { if (ImGui::MenuItem("Create Empty")) { } if (ImGui::MenuItem("Effects")) { } if (ImGui::MenuItem("Lights")) { } if (ImGui::MenuItem("Audio")) { } if (ImGui::MenuItem("Video")) { } if (ImGui::MenuItem("UI")) { } if (ImGui::MenuItem("Camera")) { } ImGui::EndMenu(); } if (ImGui::BeginMenu("Component")) { if (ImGui::MenuItem("Mesh")) { } if (ImGui::MenuItem("Effects")) { } if (ImGui::MenuItem("Physics")) { } if (ImGui::MenuItem("Audio")) { } if (ImGui::MenuItem("Video")) { } if (ImGui::MenuItem("UI")) { } ImGui::EndMenu(); } if (ImGui::BeginMenu("Window")) { ImGui::MenuItem(("Application"), (const char*)0, &showAppWindow); ImGui::MenuItem(("Scene"), (const char*)0, &showScene); ImGui::MenuItem(("Inspector"), (const char*)0, &showInspector); ImGui::EndMenu(); } if (ImGui::BeginMenu("About")) { ImGui::MenuItem(("Help"), (const char*)0, &showHelpWindow); ImGui::MenuItem(("About Salsa"), (const char*)0, &showAboutWindow); if (ImGui::MenuItem(ICON_FA_JEDI" Repository")) { ShellExecuteA(NULL, "open", "https://github.com/JorxSS/SalsaEngine", NULL, NULL, SW_SHOWNORMAL); } ImGui::EndMenu(); } } ImGui::EndMainMenuBar(); } void ModuleGUI::Scene() { if (ImGui::Begin(ICON_FA_DICE_D20 " Scene")) { isScene= ImGui::IsWindowFocused(); sceneWidth = ImGui::GetWindowWidth(); sceneHeight = ImGui::GetWindowHeight(); App->renderer->DrawScene(sceneWidth, sceneHeight); ImGui::GetWindowDrawList()->AddImage( (void *)App->renderer->frameTex, ImVec2(ImGui::GetCursorScreenPos()), ImVec2(ImGui::GetCursorScreenPos().x + sceneWidth,ImGui::GetCursorScreenPos().y + sceneHeight), ImVec2(0, 1), ImVec2(1, 0) ); } ImGui::End(); } void ModuleGUI::GameObjecInfo() { if (ImGui::Begin(ICON_FA_INFO_CIRCLE" Inspector")) { isInspector = ImGui::IsWindowHovered(); float width = ImGui::GetWindowWidth(); float height = ImGui::GetWindowHeight(); if (App->model->model) { if (ImGui::CollapsingHeader(ICON_FA_RULER_COMBINED" Transform")) { ImGui::InputFloat3("Position", &App->model->modelPosition[0], 3, ImGuiInputTextFlags_ReadOnly); ImGui::InputFloat3("Rotation", &App->model->modelRotation[0], 3, ImGuiInputTextFlags_ReadOnly); ImGui::InputFloat3("Scale", &App->model->modelScale[0], 3, ImGuiInputTextFlags_ReadOnly); } if (ImGui::CollapsingHeader(ICON_FA_CUBES " Geometry")) { ImGui::InputInt("Mesh", &App->model->nmeshes, 0, 0, ImGuiInputTextFlags_ReadOnly); ImGui::InputInt("Triangles", &App->model->npolys, 0, 0, ImGuiInputTextFlags_ReadOnly); ImGui::InputInt("Vertex", &App->model->nvertex, 0, 0, ImGuiInputTextFlags_ReadOnly); static bool wireframe = false; ImGui::Checkbox("Wireframe", &wireframe); App->renderer->SetWireframe(wireframe); } if (ImGui::CollapsingHeader(ICON_FA_PALETTE" Texture")) { static ImGuiTreeNodeFlags base_flags = ImGuiTreeNodeFlags_OpenOnArrow | ImGuiTreeNodeFlags_OpenOnDoubleClick | ImGuiTreeNodeFlags_SpanAvailWidth; static int selection_mask = (1 << 2); // Dumb representation of what may be user-side selection state. You may carry selection state inside or outside your objects in whatever format you see fit. int node_clicked = -1; // Temporary storage of what node we have clicked to process selection at the end of the loop. May be a pointer to your own node type, etc. for (unsigned int i = 0; i < App->model->textures_loaded.size(); i++) { // Disable the default open on single-click behavior and pass in Selected flag according to our selection state. ImGuiTreeNodeFlags node_flags = base_flags; std::string str = App->model->textures_loaded[i].path; const char *path = str.c_str(); const bool is_selected = (selection_mask & (1 << i)) != 0; if (is_selected) node_flags |= ImGuiTreeNodeFlags_Selected; if (i < App->model->textures_loaded.size()) { bool node_open = ImGui::TreeNodeEx((void*)(intptr_t)i, node_flags, "Texture %d", i); if (ImGui::IsItemClicked()) node_clicked = i; if (node_open) { ImGui::Text("Path:"); ImGui::SameLine(); ImGui::TextColored(ImVec4(1.0f, 1.0f, 0.0f, 1.0f), path); ImGui::Text("Texture %d size:", i); ImGui::SameLine(); ImGui::TextColored(ImVec4(1.0f, 1.0f, 0.0f, 1.0f), "%d x %d", App->model->textureWidth[i], App->model->textureHeight[i]); ImGui::Spacing(); ImGui::Image((void*)(intptr_t)App->model->textures_loaded[i].id, ImVec2(width*0.5, width*0.5), ImVec2(0, 1), ImVec2(1, 0)); ImGui::TreePop(); } } } if (node_clicked != -1) { // Update selection state. Process outside of tree loop to avoid visual inconsistencies during the clicking-frame. if (ImGui::GetIO().KeyCtrl) selection_mask ^= (1 << node_clicked); // CTRL+click to toggle else //if (!(selection_mask & (1 << node_clicked))) // Depending on selection behavior you want, this commented bit preserve selection when clicking on item that is part of the selection selection_mask = (1 << node_clicked); // Click to single-select } } } } ImGui::End(); } void ModuleGUI::ShowHelp() { bool* p_open = NULL; if (ImGui::Begin("Help", p_open)) { ImGui::Text("USER GUIDE:"); ImGui::ShowUserGuide(); } ImGui::End(); } void ModuleGUI::ShowAbout() { bool* p_open = NULL; if (ImGui::Begin("About", p_open)) { ImGui::Text("SALSA ENGINE 0.1"); ImGui::Text("This Engine was created as a project for the Master Degree 'Advanced Programming for AAA Video Games' made in the UPC from Barcelona."); ImGui::Text("Authors: "); ImGui::SameLine(); ImGui::TextColored(ImVec4(0, 1, 1, 1), "Jordi Sauras Salas"); ImGui::Text("Libraries Used: "); static bool selection[7] = { false, false, false, false, false, false, false }; if (ImGui::Selectable("SLD2 2.0.4", selection[0], ImGuiSelectableFlags_AllowDoubleClick)) if (ImGui::IsMouseDoubleClicked(0)) { selection[0] = !selection[0]; ShellExecuteA(NULL, "open", "https://www.libsdl.org/index.php", NULL, NULL, SW_SHOWNORMAL); } if (ImGui::Selectable("GLEW 2.1", selection[1], ImGuiSelectableFlags_AllowDoubleClick)) if (ImGui::IsMouseDoubleClicked(0)) { selection[1] = !selection[1]; ShellExecuteA(NULL, "open", "http://glew.sourceforge.net/", NULL, NULL, SW_SHOWNORMAL); } if (ImGui::Selectable("ImGui", selection[2], ImGuiSelectableFlags_AllowDoubleClick)) if (ImGui::IsMouseDoubleClicked(0)) { selection[2] = !selection[2]; ShellExecuteA(NULL, "open", "https://github.com/ocornut/imgui", NULL, NULL, SW_SHOWNORMAL); } if (ImGui::Selectable("MathGeoLib", selection[2], ImGuiSelectableFlags_AllowDoubleClick)) if (ImGui::IsMouseDoubleClicked(0)) { selection[2] = !selection[2]; ShellExecuteA(NULL, "open", "https://github.com/juj/MathGeoLib", NULL, NULL, SW_SHOWNORMAL); } if (ImGui::Selectable("DevIL", selection[3], ImGuiSelectableFlags_AllowDoubleClick)) if (ImGui::IsMouseDoubleClicked(0)) { selection[3] = !selection[3]; ShellExecuteA(NULL, "open", "http://openil.sourceforge.net/", NULL, NULL, SW_SHOWNORMAL); } if (ImGui::Selectable("Assimp 3.3.1", selection[4], ImGuiSelectableFlags_AllowDoubleClick)) if (ImGui::IsMouseDoubleClicked(0)) { selection[4] = !selection[4]; ShellExecuteA(NULL, "open", "https://github.com/assimp/assimp", NULL, NULL, SW_SHOWNORMAL); } if (ImGui::Selectable("IconsFontCppHeaders", selection[5], ImGuiSelectableFlags_AllowDoubleClick)) if (ImGui::IsMouseDoubleClicked(0)) { selection[5] = !selection[5]; ShellExecuteA(NULL, "open", "https://github.com/juliettef/IconFontCppHeaders", NULL, NULL, SW_SHOWNORMAL); } if (ImGui::Selectable("FontAwesome", selection[6], ImGuiSelectableFlags_AllowDoubleClick)) if (ImGui::IsMouseDoubleClicked(0)) { selection[6] = !selection[6]; ShellExecuteA(NULL, "open", "https://fontawesome.com/", NULL, NULL, SW_SHOWNORMAL); } ImGui::Text("License: "); ImGui::SameLine(); ImGui::TextColored(ImVec4(1, 1, 1, 1),"MIT"); } ImGui::End(); } void ModuleGUI::ShowDefWindow() { static bool fullscreen = false; static bool borderless = false; static bool resizable = true; static bool fsdesktop = false; static bool aspect = false; static float display_brightness = SDL_GetWindowBrightness(App->window->window); static int screen_w = 0; static int screen_h = 0; SDL_GetWindowSize(App->window->window, &screen_w, &screen_h); bool* p_open = NULL; if (ImGui::Begin(ICON_FA_COG " Configuration", p_open)) { ImGui::SetNextWindowPos(ImVec2(650, 20), ImGuiCond_FirstUseEver); ImGui::SetNextWindowSize(ImVec2(550, 680), ImGuiCond_FirstUseEver); ImGui::PushItemWidth(ImGui::GetFontSize() * -12); ImGui::Spacing(); if (ImGui::CollapsingHeader(ICON_FA_TABLET_ALT " Application")) { ImGui::Text("Engine Version: "); ImGui::SameLine(); ImGui::TextColored(ImVec4(1, 1, 0, 1), "0.1"); ImGui::Separator(); ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 100.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate); int fps = ImGui::GetIO().Framerate; //Get frames if (frames.size() > 120) //Max seconds to show { for (size_t i = 1; i < frames.size(); i++) { frames[i - 1] = frames[i]; } frames[frames.size() - 1] = fps; } else { frames.push_back(fps); } char title[25]; sprintf_s(title, 25, "Framerate: %d", fps); ImGui::PlotHistogram("##framerate", &frames[0], frames.size(), 0, title, 0.0f, 100.0f, ImVec2(310, 100)); } if (ImGui::CollapsingHeader(ICON_FA_WINDOW_RESTORE " Window")) { if (ImGui::SliderFloat("Brightness", &display_brightness, 0, 1.00f)) App->window->SetWindowBrightness(display_brightness); if (ImGui::SliderInt("Width", &screen_w, 640, 1024)) App->window->SetWindowSize(screen_w, screen_h); if (ImGui::SliderInt("Height", &screen_h, 480, 720)) App->window->SetWindowSize(screen_w, screen_h); if (ImGui::Checkbox("Fullscreen", &fullscreen)) App->window->SetFullscreen(fullscreen); ImGui::SameLine(); if (ImGui::Checkbox("Resizable", &resizable)) App->window->SetResizable(resizable); if (ImGui::Checkbox("Borderless", &borderless)) App->window->SetBorderless(borderless); ImGui::SameLine(); if (ImGui::Checkbox("Full Desktop", &fsdesktop)) App->window->SetFullDesktop(fsdesktop); } if (ImGui::CollapsingHeader(ICON_FA_MICROCHIP" Hardware")) { SDL_version compiled; SDL_GetVersion(&compiled); ImGui::Text("SDL VERSION: "); ImGui::SameLine(); ImGui::TextColored(ImVec4(1, 1, 0, 1), "%d. %d. %d ", compiled.major, compiled.minor, compiled.patch); ImGui::Text("CPU: "); ImGui::SameLine(); ImGui::TextColored(ImVec4(1, 1, 0, 1), "%d (Cache: %d kb) ", SDL_GetCPUCount(), SDL_GetCPUCacheLineSize()); ImGui::Text("System RAM: "); ImGui::SameLine(); ImGui::TextColored(ImVec4(1, 1, 0, 1), "%d GB", SDL_GetSystemRAM() / 1000); ImGui::Separator(); char* vendor = (char*)glGetString(GL_VENDOR); char* card = (char*)glGetString(GL_RENDERER); char* ver = (char*)glGetString(GL_VERSION); ImGui::Text("GPU: "); ImGui::SameLine(); ImGui::TextColored(ImVec4(1, 1, 0, 1), card); ImGui::Text("Brand: "); ImGui::SameLine(); ImGui::TextColored(ImVec4(1, 1, 0, 1), vendor); ImGui::Text("Version: "); ImGui::SameLine(); ImGui::TextColored(ImVec4(1, 1, 0, 1), ver); GLint dedicatedMB = 0; GLint totalMB = 0; GLint currentMB = 0; //TODO STRING COMPARE IF NVIDIA OR AMD glGetIntegerv(GL_GPU_MEMORY_INFO_DEDICATED_VIDMEM_NVX, &dedicatedMB); glGetIntegerv(GL_GPU_MEMORY_INFO_TOTAL_AVAILABLE_MEMORY_NVX, &totalMB); glGetIntegerv(GL_GPU_MEMORY_INFO_CURRENT_AVAILABLE_VIDMEM_NVX, &currentMB); ImGui::Text("VRAM:"); ImGui::SameLine(); ImGui::TextColored(ImVec4(1.0f, 1.0f, 0.0f, 1.0f), "%.1f MB", (float)dedicatedMB / 1000); ImGui::Text("VRAM Budget:"); ImGui::SameLine(); ImGui::TextColored(ImVec4(1.0f, 1.0f, 0.0f, 1.0f), "%.1f MB", (float)totalMB / 1000); ImGui::Text("VRAM Usage:"); ImGui::SameLine(); ImGui::TextColored(ImVec4(1.0f, 1.0f, 0.0f, 1.0f), "%.1f MB", ((float)totalMB / 1000) - ((float)currentMB / 1000)); ImGui::Text("VRAM Available:"); ImGui::SameLine(); ImGui::TextColored(ImVec4(1.0f, 1.0f, 0.0f, 1.0f), "%.1f MB", (float)currentMB / 1000); } if (ImGui::CollapsingHeader(ICON_FA_CAMERA_RETRO" Camera")) { ImGui::InputFloat3("Front", &App->camera->frustum.front[0], 3, ImGuiInputTextFlags_ReadOnly); ImGui::InputFloat3("Up", &App->camera->frustum.up[0], 3, ImGuiInputTextFlags_ReadOnly); ImGui::InputFloat3("Position", &App->camera->frustum.pos[0], 3, ImGuiInputTextFlags_ReadOnly); ImGui::Separator(); if (ImGui::SliderFloat("FOV", &App->camera->frustum.horizontalFov, 0, 2 * 3.14f)) App->camera->SetFOV(App->camera->frustum.horizontalFov); if (ImGui::SliderFloat("Aspect Ratio", &App->camera->aspectRatio, 0, 10)) { if(!aspectFixed) App->camera->SetAspectRatio(App->camera->aspectRatio); } if (ImGui::SliderFloat("Camera Speed", &App->camera->cameraSpeed, 0, 1)) App->camera->SetSpeed(App->camera->cameraSpeed); if (ImGui::SliderFloat("Rotation Speed", &App->camera->rotationSpeed, 0, 1)) App->camera->SetRotationSpeed(App->camera->rotationSpeed); static int clicked = 0; if (ImGui::Button("Reset Camera")) clicked++; if (clicked & 1) { App->camera->SetRotationSpeed(ROTATION_SPEED); App->camera->SetSpeed(CAMERA_SPEED); clicked = 0; } ImGui::SameLine(); if (ImGui::Checkbox("Default Aspect Ratio", &aspect)) { if (showScene) { if (aspectFixed) aspectFixed = false; else { App->camera->SetAspectRatio(sceneWidth / sceneHeight); aspectFixed = true; } } } } } ImGui::End(); }
31.602812
199
0.673451
[ "mesh", "geometry", "render", "object", "vector", "model", "transform" ]
3e93efe2709de4e14ed8a64a08cc1f35b8f404bd
52,867
cpp
C++
OscSender/xcode/Cinder-OSC/src/cinder/osc/Osc.cpp
eighteight/CinderEigh
d9dfc6a0ad9a9e6c5b82624971127f0335d91639
[ "Apache-2.0" ]
null
null
null
OscSender/xcode/Cinder-OSC/src/cinder/osc/Osc.cpp
eighteight/CinderEigh
d9dfc6a0ad9a9e6c5b82624971127f0335d91639
[ "Apache-2.0" ]
null
null
null
OscSender/xcode/Cinder-OSC/src/cinder/osc/Osc.cpp
eighteight/CinderEigh
d9dfc6a0ad9a9e6c5b82624971127f0335d91639
[ "Apache-2.0" ]
null
null
null
/* Copyright (c) 2015, The Cinder Project, All rights reserved. This code is intended for use with the Cinder C++ library: http://libcinder.org Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 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. */ /* Toshiro Yamada Portions Copyright (c) 2011 Distributed under the BSD-License. https://github.com/toshiroyamada/tnyosc */ #include "Osc.h" #include "cinder/Log.h" using namespace std; using namespace asio; using namespace asio::ip; using namespace std::placeholders; // Following code snippets were taken from // http://www.jbox.dk/sanos/source/include/net/inet.h.html #ifndef htons #define htons(n) (((((uint16_t)(n) & 0xFF)) << 8) | (((uint16_t)(n) & 0xFF00) >> 8)) #endif #ifndef ntohs #define ntohs(n) (((((uint16_t)(n) & 0xFF)) << 8) | (((uint16_t)(n) & 0xFF00) >> 8)) #endif #ifndef htonl #define htonl(n) (((((uint32_t)(n) & 0xFF)) << 24) | ((((uint32_t)(n) & 0xFF00)) << 8) | ((((uint32_t)(n) & 0xFF0000)) >> 8) | ((((uint32_t)(n) & 0xFF000000)) >> 24)) #endif #ifndef ntohl #define ntohl(n) (((((uint32_t)(n) & 0xFF)) << 24) | ((((uint32_t)(n) & 0xFF00)) << 8) | ((((uint32_t)(n) & 0xFF0000)) >> 8) | ((((uint32_t)(n) & 0xFF000000)) >> 24)) #endif // Following ntohll() and htonll() code snippets were taken from // http://www.codeproject.com/KB/cpp/endianness.aspx?msg=1661457 #ifndef ntohll /// Convert 64-bit little-endian integer to a big-endian network format #define ntohll(x) (((int64_t)(ntohl((int32_t)((x << 32) >> 32))) << 32) | (uint32_t)ntohl(((int32_t)(x >> 32)))) #endif #ifndef htonll /// Convert 64-bit big-endian network format to a little-endian integer #define htonll(x) ntohll(x) #endif namespace cinder { namespace osc_new { /// Convert 32-bit float to a big-endian network format inline int32_t htonf( float x ) { return (int32_t) htonl( *(int32_t*) &x ); } /// Convert 64-bit float (double) to a big-endian network format inline int64_t htond( double x ) { return (int64_t) htonll( *(int64_t*) &x ); } /// Convert 32-bit big-endian network format to float inline double ntohf( int32_t x ) { x = ntohl( x ); return *(float*) &x; } /// Convert 64-bit big-endian network format to double inline double ntohd( int64_t x ) { return (double) ntohll( x ); } //////////////////////////////////////////////////////////////////////////////////////// //// MESSAGE Message::Message() : mIsCached( false ) { } Message::Message( const std::string& address ) : mAddress( address ), mIsCached( false ) { } Message::Message( Message &&message ) NOEXCEPT : mAddress( move( message.mAddress ) ), mDataBuffer( move( message.mDataBuffer ) ), mDataViews( move( message.mDataViews ) ), mIsCached( message.mIsCached ), mCache( move( message.mCache ) ), mSenderIpAddress( move( message.mSenderIpAddress ) ) { for( auto & dataView : mDataViews ) { dataView.mOwner = this; } } Message& Message::operator=( Message &&message ) NOEXCEPT { if( this != &message ) { mAddress = move( message.mAddress ); mDataBuffer = move( message.mDataBuffer ); mDataViews = move( message.mDataViews ); mIsCached = message.mIsCached; mCache = move( message.mCache ); mSenderIpAddress = move( message.mSenderIpAddress ); for( auto & dataView : mDataViews ) { dataView.mOwner = this; } } return *this; } Message::Message( const Message &message ) : mAddress( message.mAddress ), mDataBuffer( message.mDataBuffer ), mDataViews( message.mDataViews ), mIsCached( message.mIsCached ), mCache( mIsCached ? new ByteBuffer( *(message.mCache) ) : nullptr ), mSenderIpAddress( message.mSenderIpAddress ) { for( auto & dataView : mDataViews ) { dataView.mOwner = this; } } Message& Message::operator=( const Message &message ) { if( this != &message ) { mAddress = message.mAddress; mDataBuffer = message.mDataBuffer; mDataViews = message.mDataViews; mIsCached = message.mIsCached; mCache.reset( mIsCached ? new ByteBuffer( *(message.mCache) ) : nullptr ); mSenderIpAddress = message.mSenderIpAddress; for( auto & dataView : mDataViews ) { dataView.mOwner = this; } } return *this; } using Argument = Message::Argument; Argument::Argument() : mOwner( nullptr ), mType( ArgType::NULL_T ), mSize( 0 ), mOffset( -1 ) { } Argument::Argument( Message *owner, ArgType type, int32_t offset, uint32_t size, bool needsSwap ) : mOwner( owner ), mType( type ), mOffset( offset ), mSize( size ), mNeedsEndianSwapForTransmit( needsSwap ) { } Argument::Argument( Argument &&arg ) NOEXCEPT : mOwner( arg.mOwner ), mType( arg.mType ), mOffset( arg.mOffset ), mSize( arg.mSize ), mNeedsEndianSwapForTransmit( arg.mNeedsEndianSwapForTransmit ) { } Argument& Argument::operator=( Argument &&arg ) NOEXCEPT { if( this != &arg ) { mOwner = arg.mOwner; mType = arg.mType; mOffset = arg.mOffset; mSize = arg.mSize; mNeedsEndianSwapForTransmit = arg.mNeedsEndianSwapForTransmit; } return *this; } Argument::Argument( const Argument &arg ) : mOwner( arg.mOwner ), mType( arg.mType ), mOffset( arg.mOffset ), mSize( arg.mSize ), mNeedsEndianSwapForTransmit( arg.mNeedsEndianSwapForTransmit ) { } Argument& Argument::operator=( const Argument &arg ) { if( this != &arg ) { mOwner = arg.mOwner; mType = arg.mType; mOffset = arg.mOffset; mSize = arg.mSize; mNeedsEndianSwapForTransmit = arg.mNeedsEndianSwapForTransmit; } return *this; } bool Argument::operator==(const Argument &arg ) const { return mType == arg.mType && mOffset == arg.mOffset && mSize == arg.mSize; } const char* Message::Argument::argTypeToString( ArgType type ) { switch ( type ) { case ArgType::INTEGER_32: return "INTEGER_32"; break; case ArgType::FLOAT: return "FLOAT"; break; case ArgType::DOUBLE: return "DOUBLE"; break; case ArgType::STRING: return "STRING"; break; case ArgType::BLOB: return "BLOB"; break; case ArgType::MIDI: return "MIDI"; break; case ArgType::TIME_TAG: return "TIME_TAG"; break; case ArgType::INTEGER_64: return "INTEGER_64"; break; case ArgType::BOOL_T: return "BOOL_T"; break; case ArgType::BOOL_F: return "BOOL_F"; break; case ArgType::CHAR: return "CHAR"; break; case ArgType::NULL_T: return "NULL_T"; break; case ArgType::IMPULSE: return "IMPULSE"; break; default: return "Unknown ArgType"; break; } } ArgType Argument::translateCharTypeToArgType( char type ) { return static_cast<ArgType>(type); } char Argument::translateArgTypeToCharType( ArgType type ) { return static_cast<char>(type); } void Argument::swapEndianForTransmit( uint8_t *buffer ) const { auto ptr = &buffer[mOffset]; switch ( mType ) { case ArgType::INTEGER_32: case ArgType::CHAR: case ArgType::BLOB: { int32_t a = htonl( *reinterpret_cast<int32_t*>(ptr) ); memcpy( ptr, &a, sizeof( int32_t ) ); } break; case ArgType::INTEGER_64: case ArgType::TIME_TAG: { uint64_t a = htonll( *reinterpret_cast<uint64_t*>(ptr) ); memcpy( ptr, &a, sizeof( uint64_t ) ); } break; case ArgType::FLOAT: { int32_t a = htonf( *reinterpret_cast<float*>(ptr) ); memcpy( ptr, &a, sizeof( float ) ); } break; case ArgType::DOUBLE: { int64_t a = htond( *reinterpret_cast<double*>(ptr) ); memcpy( ptr, &a, sizeof( double ) ); } break; default: break; } } void Argument::outputValueToStream( std::ostream &ostream ) const { ostream << "<" << argTypeToString( mType ) << ">: "; switch ( mType ) { case ArgType::INTEGER_32: ostream << *reinterpret_cast<int32_t*>( &mOwner->mDataBuffer[mOffset] ); break; case ArgType::FLOAT: ostream << *reinterpret_cast<float*>( &mOwner->mDataBuffer[mOffset] ); break; case ArgType::STRING: ostream << reinterpret_cast<const char*>( &mOwner->mDataBuffer[mOffset] ); break; case ArgType::BLOB: ostream << "Size: " << *reinterpret_cast<int32_t*>( &mOwner->mDataBuffer[mOffset] ); break; case ArgType::INTEGER_64: ostream << *reinterpret_cast<int64_t*>( &mOwner->mDataBuffer[mOffset] ); break; case ArgType::TIME_TAG: ostream << *reinterpret_cast<int64_t*>( &mOwner->mDataBuffer[mOffset] ); break; case ArgType::DOUBLE: ostream << *reinterpret_cast<double*>( &mOwner->mDataBuffer[mOffset] ); break; case ArgType::CHAR: { char v = *reinterpret_cast<char*>( &mOwner->mDataBuffer[mOffset] ); ostream << int(v); } break; case ArgType::MIDI: { auto ptr = &mOwner->mDataBuffer[mOffset]; ostream << " Port: " << int( *( ptr + 0 ) ) << " Status: " << int( *( ptr + 1 ) ) << " Data1: " << int( *( ptr + 2 ) ) << " Data2: " << int( *( ptr + 3 ) ) ; } break; case ArgType::BOOL_T: ostream << "True"; break; case ArgType::BOOL_F: ostream << "False"; break; case ArgType::NULL_T: ostream << "Null"; break; case ArgType::IMPULSE: ostream << "IMPULSE"; break; default: ostream << "Unknown"; break; } } void Message::append( int32_t v ) { mIsCached = false; mDataViews.emplace_back( this, ArgType::INTEGER_32, getCurrentOffset(), 4, true ); appendDataBuffer( &v, sizeof(int32_t) ); } void Message::append( float v ) { mIsCached = false; mDataViews.emplace_back( this, ArgType::FLOAT, getCurrentOffset(), 4, true ); appendDataBuffer( &v, sizeof(float) ); } void Message::append( const std::string& v ) { mIsCached = false; auto trailingZeros = getTrailingZeros( v.size() ); auto size = v.size() + trailingZeros; mDataViews.emplace_back( this, ArgType::STRING, getCurrentOffset(), size ); appendDataBuffer( v.data(), v.size(), trailingZeros ); } void Message::append( const char *v ) { mIsCached = false; auto stringLength = strlen( v ); auto trailingZeros = getTrailingZeros( stringLength ); auto size = stringLength + trailingZeros; mDataViews.emplace_back( this, ArgType::STRING, getCurrentOffset(), size ); appendDataBuffer( v, stringLength, trailingZeros ); } void Message::appendBlob( void* blob, uint32_t size ) { mIsCached = false; auto trailingZeros = getTrailingZeros( size ); mDataViews.emplace_back( this, ArgType::BLOB, getCurrentOffset(), size, true ); appendDataBuffer( &size, sizeof(uint32_t) ); appendDataBuffer( blob, size, trailingZeros ); } void Message::append( const ci::Buffer &buffer ) { appendBlob( (void*)buffer.getData(), buffer.getSize() ); } void Message::appendTimeTag( uint64_t v ) { mIsCached = false; mDataViews.emplace_back( this, ArgType::TIME_TAG, getCurrentOffset(), 8, true ); appendDataBuffer( &v, sizeof( uint64_t ) ); } void Message::appendCurrentTime() { appendTimeTag( time::get_current_ntp_time() ); } void Message::append( bool v ) { mIsCached = false; if( v ) mDataViews.emplace_back( this, ArgType::BOOL_T, -1, 0 ); else mDataViews.emplace_back( this, ArgType::BOOL_F, -1, 0 ); } void Message::append( int64_t v ) { mIsCached = false; mDataViews.emplace_back( this, ArgType::INTEGER_64, getCurrentOffset(), 8, true ); appendDataBuffer( &v, sizeof( int64_t ) ); } void Message::append( double v ) { mIsCached = false; mDataViews.emplace_back( this, ArgType::DOUBLE, getCurrentOffset(), 8, true ); appendDataBuffer( &v, sizeof( double ) ); } void Message::append( char v ) { mIsCached = false; mDataViews.emplace_back( this, ArgType::CHAR, getCurrentOffset(), 4, true ); ByteArray<4> b; b.fill( 0 ); b[0] = v; appendDataBuffer( b.data(), b.size() ); } void Message::appendMidi( uint8_t port, uint8_t status, uint8_t data1, uint8_t data2 ) { mIsCached = false; mDataViews.emplace_back( this, ArgType::MIDI, getCurrentOffset(), 4 ); ByteArray<4> b; b[0] = port; b[1] = status; b[2] = data1; b[3] = data2; appendDataBuffer( b.data(), b.size() ); } void Message::createCache() const { // Check for debug to allow for Default Constructing. CI_ASSERT_MSG( mAddress.size() > 0 && mAddress[0] == '/', "All OSC Address Patterns must at least start with '/' (forward slash)" ); size_t addressLen = mAddress.size() + getTrailingZeros( mAddress.size() ); // adding one for ',' character, which was the sourc of a particularly ugly bug auto typesSize = mDataViews.size() + 1; std::vector<char> typesArray( typesSize + getTrailingZeros( typesSize ) , 0 ); typesArray[0] = ','; int i = 1; for( auto & dataView : mDataViews ) typesArray[i++] = Argument::translateArgTypeToCharType( dataView.getType() ); if( ! mCache ) mCache = ByteBufferRef( new ByteBuffer() ); size_t typesArrayLen = typesArray.size(); ByteArray<4> sizeArray; int32_t messageSize = addressLen + typesArrayLen + mDataBuffer.size(); auto endianSize = htonl( messageSize ); memcpy( sizeArray.data(), reinterpret_cast<uint8_t*>( &endianSize ), 4 ); mCache->resize( 4 + messageSize ); std::copy( sizeArray.begin(), sizeArray.end(), mCache->begin() ); std::copy( mAddress.begin(), mAddress.end(), mCache->begin() + 4 ); std::copy( typesArray.begin(), typesArray.end(), mCache->begin() + 4 + addressLen ); std::copy( mDataBuffer.begin(), mDataBuffer.end(), mCache->begin() + 4 + addressLen + typesArrayLen ); // Now that cached (transportable) buffer is created, swap endian for transmit. auto dataPtr = mCache->data() + 4 + addressLen + typesArrayLen; for( auto & dataView : mDataViews ) { if( dataView.needsEndianSwapForTransmit() ) dataView.swapEndianForTransmit( dataPtr ); } mIsCached = true; } ByteBufferRef Message::getSharedBuffer() const { if( ! mIsCached ) createCache(); return mCache; } template<typename T> const Argument& Message::getDataView( uint32_t index ) const { if( index >= mDataViews.size() ) throw ExcIndexOutOfBounds( mAddress, index ); return mDataViews[index]; } void Message::appendDataBuffer( const void *begin, uint32_t size, uint32_t trailingZeros ) { auto ptr = reinterpret_cast<const uint8_t*>( begin ); mDataBuffer.insert( mDataBuffer.end(), ptr, ptr + size ); if( trailingZeros != 0 ) mDataBuffer.resize( mDataBuffer.size() + trailingZeros, 0 ); } const Argument& Message::operator[]( uint32_t index ) const { if( index >= mDataViews.size() ) throw ExcIndexOutOfBounds( mAddress, index ); return mDataViews[index]; } bool Message::operator==( const Message &message ) const { auto sameAddress = message.mAddress == mAddress; if( ! sameAddress ) return false; auto sameDataViewSize = message.mDataViews.size() == mDataViews.size(); if( ! sameDataViewSize ) return false; for( size_t i = 0; i < mDataViews.size(); i++ ) { auto sameDataView = message.mDataViews[i] == mDataViews[i]; if( ! sameDataView ) return false; } auto sameDataBufferSize = mDataBuffer.size() == message.mDataBuffer.size(); if( ! sameDataBufferSize ) return false; auto sameDataBuffer = ! memcmp( mDataBuffer.data(), message.mDataBuffer.data(), mDataBuffer.size() ); if( ! sameDataBuffer ) return false; return true; } bool Message::operator!=( const Message &message ) const { return ! (*this == message); } std::string Message::getTypeTagString() const { std::string ret( mDataViews.size(), 0 ); std::transform( mDataViews.begin(), mDataViews.end(), ret.begin(), []( const Argument &arg ){ return Argument::translateArgTypeToCharType( arg.getType() ); }); return ret; } int32_t Argument::int32() const { if( ! convertible<int32_t>() ) throw ExcNonConvertible( mOwner->getAddress(), ArgType::INTEGER_32, getType() ); return *reinterpret_cast<const int32_t*>(&mOwner->mDataBuffer[getOffset()]);; } int64_t Argument::int64() const { if( ! convertible<int64_t>() ) throw ExcNonConvertible( mOwner->getAddress(), ArgType::INTEGER_64, getType() ); return *reinterpret_cast<const int64_t*>(&mOwner->mDataBuffer[getOffset()]);; } float Argument::flt() const { if( ! convertible<float>() ) throw ExcNonConvertible( mOwner->getAddress(), ArgType::FLOAT, getType() ); return *reinterpret_cast<const float*>(&mOwner->mDataBuffer[getOffset()]);; } double Argument::dbl() const { if( ! convertible<double>() ) throw ExcNonConvertible( mOwner->getAddress(), ArgType::DOUBLE, getType() ); return *reinterpret_cast<const double*>(&mOwner->mDataBuffer[getOffset()]);; } bool Argument::boolean() const { if( ! convertible<bool>() ) throw ExcNonConvertible( mOwner->getAddress(), ArgType::BOOL_T, getType() ); return getType() == ArgType::BOOL_T; } void Argument::midi( uint8_t *port, uint8_t *status, uint8_t *data1, uint8_t *data2 ) const { if( ! convertible<int32_t>() ) throw ExcNonConvertible( mOwner->getAddress(), ArgType::MIDI, getType() ); int32_t midiVal = *reinterpret_cast<const int32_t*>(&mOwner->mDataBuffer[getOffset()]); *port = midiVal; *status = midiVal >> 8; *data1 = midiVal >> 16; *data2 = midiVal >> 24; } ci::Buffer Argument::blob() const { if( ! convertible<ci::Buffer>() ) throw ExcNonConvertible( mOwner->getAddress(), ArgType::BLOB, getType() ); // skip the first 4 bytes, as they are the size const uint8_t* data = reinterpret_cast<const uint8_t*>( &mOwner->mDataBuffer[getOffset()+4] ); ci::Buffer ret( getSize() ); memcpy( ret.getData(), data, getSize() ); return ret; } void Argument::blobData( const void **dataPtr, size_t *size ) const { if( ! convertible<ci::Buffer>() ) throw ExcNonConvertible( mOwner->getAddress(), ArgType::BLOB, getType() ); // skip the first 4 bytes, as they are the size *dataPtr = reinterpret_cast<const void*>( &mOwner->mDataBuffer[getOffset()+4] ); *size = getSize(); } char Argument::character() const { if( ! convertible<int32_t>() ) throw ExcNonConvertible( mOwner->getAddress(), ArgType::CHAR, getType() ); return mOwner->mDataBuffer[getOffset()]; } std::string Argument::string() const { if( ! convertible<std::string>() ) throw ExcNonConvertible( mOwner->getAddress(), ArgType::STRING, getType() ); const char* head = reinterpret_cast<const char*>(&mOwner->mDataBuffer[getOffset()]); return std::string( head ); } void Argument::stringData( const char **dataPtr, uint32_t *size ) const { if( ! convertible<std::string>() ) throw ExcNonConvertible( mOwner->getAddress(), ArgType::STRING, getType() ); *dataPtr = reinterpret_cast<const char*>(&mOwner->mDataBuffer[getOffset()]); *size = mSize; } template<typename T> bool Argument::convertible() const { switch ( mType ) { case ArgType::INTEGER_32: return std::is_same<T, int32_t>::value; case ArgType::FLOAT: return std::is_same<T, float>::value; case ArgType::STRING: return std::is_same<T, std::string>::value; case ArgType::BLOB: return std::is_same<T, ci::Buffer>::value; case ArgType::INTEGER_64: return std::is_same<T, int64_t>::value; case ArgType::TIME_TAG: return std::is_same<T, int64_t>::value; case ArgType::DOUBLE: return std::is_same<T, double>::value; case ArgType::CHAR: return std::is_same<T, int32_t>::value; case ArgType::MIDI: return std::is_same<T, int32_t>::value; case ArgType::BOOL_T: return std::is_same<T, bool>::value; case ArgType::BOOL_F: return std::is_same<T, bool>::value; case ArgType::NULL_T: return false; case ArgType::IMPULSE: return false; default: return false; } } ArgType Message::getArgType( uint32_t index ) const { if( index >= mDataViews.size() ) throw ExcIndexOutOfBounds( mAddress, index ); auto &dataView = mDataViews[index]; return dataView.getType(); } int32_t Message::getArgInt32( uint32_t index ) const { auto &dataView = getDataView<int32_t>( index ); return dataView.int32(); } float Message::getArgFloat( uint32_t index ) const { auto &dataView = getDataView<float>( index ); return dataView.flt(); } std::string Message::getArgString( uint32_t index ) const { auto &dataView = getDataView<std::string>( index ); return dataView.string(); } void Message::getArgStringData( uint32_t index, const char **dataPtr, uint32_t *size ) const { auto &dataView = getDataView<std::string>( index ); dataView.stringData( dataPtr, size ); } int64_t Message::getArgTime( uint32_t index ) const { auto &dataView = getDataView<int64_t>( index ); return dataView.int64(); } int64_t Message::getArgInt64( uint32_t index ) const { auto &dataView = getDataView<int64_t>( index ); return dataView.int64(); } double Message::getArgDouble( uint32_t index ) const { auto &dataView = getDataView<double>( index ); return dataView.dbl(); } bool Message::getArgBool( uint32_t index ) const { auto &dataView = getDataView<bool>( index ); return dataView.boolean(); } char Message::getArgChar( uint32_t index ) const { auto &dataView = getDataView<int32_t>( index ); return dataView.character(); } void Message::getArgMidi( uint32_t index, uint8_t *port, uint8_t *status, uint8_t *data1, uint8_t *data2 ) const { auto &dataView = getDataView<int32_t>( index ); dataView.midi( port, status, data1, data2 ); } ci::Buffer Message::getArgBlob( uint32_t index ) const { auto &dataView = getDataView<ci::Buffer>( index ); return dataView.blob(); } void Message::getArgBlobData( uint32_t index, const void **dataPtr, size_t *size ) const { auto &dataView = getDataView<ci::Buffer>( index ); dataView.blobData( dataPtr, size ); } bool Message::bufferCache( uint8_t *data, size_t size ) { uint8_t *head, *tail; uint32_t i = 0; size_t remain = size; // extract address head = tail = data; while( tail[i] != '\0' && ++i < remain ); if( i == remain ) { CI_LOG_E( "Problem Parsing Message: No address." ); return false; } mAddress.insert( 0, (char*)head, i ); head += i + getTrailingZeros( i ); remain = size - ( head - data ); i = 0; tail = head; if( head[i++] != ',' ) { CI_LOG_E( "Problem Parsing Message: Mesage with address [" << mAddress << "] not properly formatted; no , seperator." ); return false; } // extract types while( tail[i] != '\0' && ++i < remain ); if( i == remain ) { CI_LOG_E( "Problem Parsing Message: Mesage with address [" << mAddress << "] not properly formatted; Types not complete." ); return false; } std::vector<char> types( i - 1 ); std::copy( head + 1, head + i, types.begin() ); head += i + getTrailingZeros( i ); remain = size - ( head - data ); // extract data uint32_t int32; uint64_t int64; mDataViews.resize( types.size() ); int j = 0; for( auto & dataView : mDataViews ) { dataView.mOwner = this; dataView.mType = Argument::translateCharTypeToArgType( types[j] ); switch( types[j] ) { case 'i': case 'f': case 'r': { dataView.mSize = sizeof( uint32_t ); dataView.mOffset = getCurrentOffset(); memcpy( &int32, head, sizeof( uint32_t ) ); int32 = htonl( int32 ); appendDataBuffer( &int32, sizeof( uint32_t ) ); head += sizeof( uint32_t ); remain -= sizeof( uint32_t ); } break; case 'b': { memcpy( &int32, head, 4 ); head += 4; remain -= 4; int32 = htonl( int32 ); if( int32 > remain ) { CI_LOG_E( "Problem Parsing Message: Mesage with address [" << mAddress << "] not properly formatted; Blobs size is too long." ); return false; } auto trailingZeros = getTrailingZeros( int32 ); dataView.mSize = int32; dataView.mOffset = getCurrentOffset(); appendDataBuffer( &dataView.mSize, sizeof( uint32_t ) ); appendDataBuffer( head, int32, trailingZeros ); head += int32 + trailingZeros; remain -= int32 + trailingZeros; } break; case 's': case 'S': { tail = head; i = 0; while( tail[i] != '\0' && ++i < remain ); dataView.mSize = i + getTrailingZeros( i ); dataView.mOffset = getCurrentOffset(); appendDataBuffer( head, i, getTrailingZeros( i ) ); i += getTrailingZeros( i ); head += i; remain -= i; } break; case 'h': case 'd': case 't': { memcpy( &int64, head, sizeof( uint64_t ) ); int64 = htonll( int64 ); dataView.mSize = sizeof( uint64_t ); dataView.mOffset = getCurrentOffset(); appendDataBuffer( &int64, sizeof( uint64_t ) ); head += sizeof( uint64_t ); remain -= sizeof( uint64_t ); } break; case 'c': { dataView.mSize = 4; dataView.mOffset = getCurrentOffset(); memcpy( &int32, head, 4 ); auto character = (int) htonl( int32 ); appendDataBuffer( &character, 4 ); head += sizeof( int ); remain -= sizeof( int ); } break; case 'm': { dataView.mSize = sizeof( int ); dataView.mOffset = getCurrentOffset(); appendDataBuffer( head, sizeof( int ) ); head += sizeof( int ); remain -= sizeof( int ); } break; } j++; } return true; } void Message::setAddress( const std::string& address ) { mIsCached = false; mAddress = address; } size_t Message::getPacketSize() const { if( ! mIsCached ) createCache(); return mCache->size(); } void Message::clear() { mIsCached = false; mAddress.clear(); mDataViews.clear(); mDataBuffer.clear(); mCache.reset(); } std::ostream& operator<<( std::ostream &os, const Message &rhs ) { os << "Address: " << rhs.getAddress() << std::endl; if( ! rhs.getSenderIpAddress().is_unspecified() ) os << "Sender Ip Address: " << rhs.getSenderIpAddress() << std::endl; for( auto &dataView : rhs.mDataViews ) os << "\t" << dataView << std::endl; return os; } std::ostream& operator<<( std::ostream &os, const Argument &rhs ) { rhs.outputValueToStream( os ); return os; } //////////////////////////////////////////////////////////////////////////////////////// //// Bundle Bundle::Bundle() { initializeBuffer(); } void Bundle::setTimetag( uint64_t ntp_time ) { uint64_t a = htonll( ntp_time ); ByteArray<8> b; memcpy( b.data(), reinterpret_cast<uint8_t*>( &a ), 8 ); mDataBuffer->insert( mDataBuffer->begin() + 12, b.begin(), b.end() ); } void Bundle::initializeBuffer() { static const std::string id = "#bundle"; mDataBuffer.reset( new std::vector<uint8_t>( 20 ) ); std::copy( id.begin(), id.end(), mDataBuffer->begin() + 4 ); (*mDataBuffer)[19] = 1; } void Bundle::appendData( const ByteBufferRef& data ) { // Size is already the first 4 bytes of every message. mDataBuffer->insert( mDataBuffer->end(), data->begin(), data->end() ); } ByteBufferRef Bundle::getSharedBuffer() const { int32_t a = htonl( getPacketSize() - 4 ); memcpy( mDataBuffer->data(), reinterpret_cast<uint8_t*>( &a ), 4 ); return mDataBuffer; } //////////////////////////////////////////////////////////////////////////////////////// //// SenderBase std::string SenderBase::extractOscAddress( const ByteBufferRef &transportData ) { std::string oscAddress; auto foundBegin = find( transportData->begin(), transportData->end(), (uint8_t)'/' ); if( foundBegin != transportData->end() ) { auto foundEnd = find( foundBegin, transportData->end(), 0 ); oscAddress = std::string( foundBegin, foundEnd ); } return oscAddress; } void SenderBase::send( const Message &message, OnErrorFn onErrorFn, OnCompleteFn onCompleteFn ) { sendImpl( message.getSharedBuffer(), std::move( onErrorFn ), std::move( onCompleteFn ) ); } void SenderBase::send( const Bundle &bundle, OnErrorFn onErrorFn, OnCompleteFn onCompleteFn ) { sendImpl( bundle.getSharedBuffer(), std::move( onErrorFn ), std::move( onCompleteFn ) ); } //////////////////////////////////////////////////////////////////////////////////////// //// SenderUdp SenderUdp::SenderUdp( uint16_t localPort, const std::string &destinationHost, uint16_t destinationPort, const protocol &protocol, asio::io_service &service ) : mSocket( new udp::socket( service ) ), mLocalEndpoint( protocol, localPort ), mRemoteEndpoint( udp::endpoint( address::from_string( destinationHost ), destinationPort ) ) { } SenderUdp::SenderUdp( uint16_t localPort, const protocol::endpoint &destination, const protocol &protocol, asio::io_service &service ) : mSocket( new udp::socket( service ) ), mLocalEndpoint( protocol, localPort ), mRemoteEndpoint( destination ) { } SenderUdp::SenderUdp( const UdpSocketRef &socket, const protocol::endpoint &destination ) : mSocket( socket ), mLocalEndpoint( socket->local_endpoint() ), mRemoteEndpoint( destination ) { } void SenderUdp::bindImpl() { asio::error_code ec; mSocket->open( mLocalEndpoint.protocol(), ec ); if( ec ) throw osc_new::Exception( ec ); mSocket->bind( mLocalEndpoint, ec ); if( ec ) throw osc_new::Exception( ec ); } void SenderUdp::sendImpl( const ByteBufferRef &data, OnErrorFn onErrorFn, OnCompleteFn onCompleteFn ) { if( ! mSocket->is_open() ) return; // data's first 4 bytes(int) comprise the size of the buffer, which datagram doesn't need. mSocket->async_send_to( asio::buffer( data->data() + 4, data->size() - 4 ), mRemoteEndpoint, // copy data pointer to persist the asynchronous send [&, data, onErrorFn, onCompleteFn]( const asio::error_code& error, size_t bytesTransferred ) { if( error ) { if( onErrorFn ) onErrorFn( error ); else CI_LOG_E( "Udp Send: " << error.message() << " - Code: " << error.value() ); } else if( onCompleteFn ) { onCompleteFn(); } }); } void SenderUdp::closeImpl() { asio::error_code ec; mSocket->close( ec ); if( ec ) throw osc_new::Exception( ec ); } //////////////////////////////////////////////////////////////////////////////////////// //// SenderTcp SenderTcp::SenderTcp( uint16_t localPort, const string &destinationHost, uint16_t destinationPort, const protocol &protocol, io_service &service, PacketFramingRef packetFraming ) : mSocket( new tcp::socket( service ) ), mPacketFraming( packetFraming ), mLocalEndpoint( protocol, localPort ), mRemoteEndpoint( tcp::endpoint( address::from_string( destinationHost ), destinationPort ) ) { } SenderTcp::SenderTcp( uint16_t localPort, const protocol::endpoint &destination, const protocol &protocol, io_service &service, PacketFramingRef packetFraming ) : mSocket( new tcp::socket( service ) ), mPacketFraming( packetFraming ), mLocalEndpoint( protocol, localPort ), mRemoteEndpoint( destination ) { } SenderTcp::SenderTcp( const TcpSocketRef &socket, const protocol::endpoint &destination, PacketFramingRef packetFraming ) : mSocket( socket ), mPacketFraming( packetFraming ), mLocalEndpoint( socket->local_endpoint() ), mRemoteEndpoint( destination ) { } SenderTcp::~SenderTcp() { try { SenderTcp::closeImpl(); } catch( osc_new::Exception ex ) { CI_LOG_EXCEPTION( "Closing TCP Sender", ex ); } } void SenderTcp::bindImpl() { asio::error_code ec; mSocket->open( mLocalEndpoint.protocol(), ec ); if( ec ) throw osc_new::Exception( ec ); mSocket->bind( mLocalEndpoint, ec ); if( ec ) throw osc_new::Exception( ec ); } void SenderTcp::connect( OnConnectFn onConnectFn ) { if( ! mSocket->is_open() ) { CI_LOG_E( "Socket not open." ); return; } mSocket->async_connect( mRemoteEndpoint, [&, onConnectFn]( const asio::error_code &error ){ if( onConnectFn ) onConnectFn( error ); else if( error ) CI_LOG_E( "Asio Error: " << error.message() << " - Code: " << error.value() ); }); } void SenderTcp::shutdown( asio::socket_base::shutdown_type shutdownType ) { if( ! mSocket->is_open() ) return; asio::error_code ec; mSocket->shutdown( shutdownType, ec ); // the other side may have already shutdown the connection. if( ec == asio::error::not_connected ) ec = asio::error_code(); if( ec ) throw osc_new::Exception( ec ); } void SenderTcp::sendImpl( const ByteBufferRef &data, OnErrorFn onErrorFn, OnCompleteFn onCompleteFn ) { if( ! mSocket->is_open() ) return; ByteBufferRef transportData = data; if( mPacketFraming ) transportData = mPacketFraming->encode( transportData ); mSocket->async_send( asio::buffer( *transportData ), // copy data pointer to persist the asynchronous send [&, transportData, onErrorFn, onCompleteFn]( const asio::error_code& error, size_t bytesTransferred ) { if( error ) { if( onErrorFn ) onErrorFn( error ); else CI_LOG_E( "Tcp Send: " << error.message() << " - Code: " << error.value() ); } else if( onCompleteFn ) { onCompleteFn(); } }); } void SenderTcp::closeImpl() { shutdown(); asio::error_code ec; mSocket->close( ec ); if( ec ) throw osc_new::Exception( ec ); } ///////////////////////////////////////////////////////////////////////////////////////// //// ReceiverBase void ReceiverBase::setListener( const std::string &address, ListenerFn listener ) { std::lock_guard<std::mutex> lock( mListenerMutex ); auto foundListener = std::find_if( mListeners.begin(), mListeners.end(), [address]( const std::pair<std::string, ListenerFn> &listener ) { return address == listener.first; }); if( foundListener != mListeners.end() ) foundListener->second = listener; else mListeners.push_back( { address, listener } ); } void ReceiverBase::removeListener( const std::string &address ) { std::lock_guard<std::mutex> lock( mListenerMutex ); auto foundListener = std::find_if( mListeners.begin(), mListeners.end(), [address]( const std::pair<std::string, ListenerFn> &listener ) { return address == listener.first; }); if( foundListener != mListeners.end() ) mListeners.erase( foundListener ); } void ReceiverBase::dispatchMethods( uint8_t *data, uint32_t size, const asio::ip::address &senderIpAddress ) { std::vector<Message> messages; decodeData( data, size, messages ); if( messages.empty() ) return; std::lock_guard<std::mutex> lock( mListenerMutex ); // iterate through all the messages and find matches with registered methods for( auto & message : messages ) { bool dispatchedOnce = false; auto &address = message.getAddress(); message.mSenderIpAddress = senderIpAddress; for( auto & listener : mListeners ) { if( patternMatch( address, listener.first ) ) { listener.second( message ); dispatchedOnce = true; } } if( ! dispatchedOnce ) { if( mDisregardedAddresses.count( address ) == 0 ) { mDisregardedAddresses.insert( address ); CI_LOG_W("Message: " << address << " doesn't have a listener. Disregarding."); } } } } bool ReceiverBase::decodeData( uint8_t *data, uint32_t size, std::vector<Message> &messages, uint64_t timetag ) const { if( ! memcmp( data, "#bundle\0", 8 ) ) { data += 8; size -= 8; uint64_t timestamp; memcpy( &timestamp, data, 8 ); data += 8; size -= 8; while( size != 0 ) { uint32_t seg_size; memcpy( &seg_size, data, 4 ); data += 4; size -= 4; seg_size = ntohl( seg_size ); if( seg_size > size ) { CI_LOG_E( "Problem Parsing Bundle: Segment Size is greater than bundle size." ); return false; } if( !decodeData( data, seg_size, messages, ntohll( timestamp ) ) ) return false; data += seg_size; size -= seg_size; } } else { if( ! decodeMessage( data, size, messages, timetag ) ) return false; } return true; } bool ReceiverBase::decodeMessage( uint8_t *data, uint32_t size, std::vector<Message> &messages, uint64_t timetag ) const { Message message; if( ! message.bufferCache( data, size ) ) return false; messages.push_back( std::move( message ) ); return true; } bool ReceiverBase::patternMatch( const std::string& lhs, const std::string& rhs ) const { bool negate = false; bool mismatched = false; std::string::const_iterator seq_tmp; std::string::const_iterator seq = lhs.begin(); std::string::const_iterator seq_end = lhs.end(); std::string::const_iterator pattern = rhs.begin(); std::string::const_iterator pattern_end = rhs.end(); while( seq != seq_end && pattern != pattern_end ) { switch( *pattern ) { case '?': break; case '*': { // if * is the last pattern, return true if( ++pattern == pattern_end ) return true; while( *seq != *pattern && seq != seq_end ) ++seq; // if seq reaches to the end without matching pattern if( seq == seq_end ) return false; } break; case '[': { negate = false; mismatched = false; if( *( ++pattern ) == '!' ) { negate = true; ++pattern; } if( *( pattern + 1 ) == '-' ) { // range matching char c_start = *pattern; ++pattern; //assert(*pattern == '-'); char c_end = *( ++pattern ); ++pattern; //assert(*pattern == ']'); // swap c_start and c_end if c_start is larger if( c_start > c_end ) { char tmp = c_start; c_end = c_start; c_start = tmp; } mismatched = ( c_start <= *seq && *seq <= c_end ) ? negate : !negate; if( mismatched ) return false; } else { // literal matching while( *pattern != ']' ) { if( *seq == *pattern ) { mismatched = negate; break; } ++pattern; } if( mismatched ) return false; while( *pattern != ']' ) ++pattern; } } break; case '{': { seq_tmp = seq; mismatched = true; while( *( ++pattern ) != '}' ) { // this assumes that there's no sequence like "{,a}" where ',' is // follows immediately after '{', which is illegal. if( *pattern == ',' ) { mismatched = false; break; } else if( *seq != *pattern ) { // fast forward to the next ',' or '}' while( *( ++pattern ) != ',' && *pattern != '}' ); if( *pattern == '}' ) return false; // redo seq matching seq = seq_tmp; mismatched = true; } else { // matched ++seq; mismatched = false; } } if( mismatched ) return false; while( *pattern != '}' ) ++pattern; --seq; } break; default: // non-special character if( *seq != *pattern ) return false; break; } ++seq; ++pattern; } if( seq == seq_end && pattern == pattern_end ) return true; else return false; } ///////////////////////////////////////////////////////////////////////////////////////// //// ReceiverUdp ReceiverUdp::ReceiverUdp( uint16_t port, const asio::ip::udp &protocol, asio::io_service &service ) : mSocket( new udp::socket( service ) ), mLocalEndpoint( protocol, port ), mAmountToReceive( 4096 ) { } ReceiverUdp::ReceiverUdp( const asio::ip::udp::endpoint &localEndpoint, asio::io_service &io ) : mSocket( new udp::socket( io ) ), mLocalEndpoint( localEndpoint ), mAmountToReceive( 4096 ) { } ReceiverUdp::ReceiverUdp( UdpSocketRef socket ) : mSocket( socket ), mLocalEndpoint( socket->local_endpoint() ), mAmountToReceive( 4096 ) { } void ReceiverUdp::bindImpl() { asio::error_code ec; mSocket->open( mLocalEndpoint.protocol(), ec ); if( ec ) throw osc_new::Exception( ec ); mSocket->bind( mLocalEndpoint, ec ); if( ec ) throw osc_new::Exception( ec ); } void ReceiverUdp::setAmountToReceive( uint32_t amountToReceive ) { mAmountToReceive.store( amountToReceive ); } void ReceiverUdp::listen( OnSocketErrorFn onSocketErrorFn ) { if ( ! mSocket->is_open() ) return; uint32_t prepareAmount = mAmountToReceive.load(); auto tempBuffer = mBuffer.prepare( prepareAmount ); auto uniqueEndpoint = std::make_shared<asio::ip::udp::endpoint>(); mSocket->async_receive_from( tempBuffer, *uniqueEndpoint, [&, uniqueEndpoint, onSocketErrorFn]( const asio::error_code &error, size_t bytesTransferred ) { if( error ) { if( onSocketErrorFn ) { if( ! onSocketErrorFn( error, *uniqueEndpoint ) ) return; } else { CI_LOG_E( "Udp Message: " << error.message() << " - Code: " << error.value() << ", Endpoint: " << uniqueEndpoint->address().to_string() ); CI_LOG_W( "Exiting Listen loop." ); return; } } else { mBuffer.commit( bytesTransferred ); auto data = std::unique_ptr<uint8_t[]>( new uint8_t[ bytesTransferred + 1 ] ); data[ bytesTransferred ] = 0; istream stream( &mBuffer ); stream.read( reinterpret_cast<char*>( data.get() ), bytesTransferred ); dispatchMethods( data.get(), bytesTransferred, uniqueEndpoint->address() ); } listen( std::move( onSocketErrorFn ) ); }); } void ReceiverUdp::closeImpl() { asio::error_code ec; mSocket->close( ec ); if( ec ) throw osc_new::Exception( ec ); } ///////////////////////////////////////////////////////////////////////////////////////// //// ReceiverTcp ReceiverTcp::~ReceiverTcp() { ReceiverTcp::closeImpl(); } ReceiverTcp::Connection::Connection( TcpSocketRef socket, ReceiverTcp *receiver, uint64_t identifier ) : mSocket( socket ), mReceiver( receiver ), mIdentifier( identifier ), mIsConnected( true ) { } ReceiverTcp::Connection::~Connection() { mReceiver = nullptr; } asio::error_code ReceiverTcp::Connection::shutdown( asio::socket_base::shutdown_type shutdownType ) { asio::error_code ec; if( ! mSocket->is_open() || ! mIsConnected ) return ec; mSocket->shutdown( asio::socket_base::shutdown_both, ec ); mIsConnected.store( false ); // the other side may have already shutdown the connection. if( ec == asio::error::not_connected ) ec = asio::error_code(); return ec; } using iterator = asio::buffers_iterator<asio::streambuf::const_buffers_type>; std::pair<iterator, bool> ReceiverTcp::Connection::readMatchCondition( iterator begin, iterator end ) { iterator i = begin; ByteArray<4> data; int inc = 0; while ( i != end && inc < 4 ) data[inc++] = *i++; int numBytes = *reinterpret_cast<int*>( data.data() ); // swap for big endian from the other side numBytes = ntohl( numBytes ); if( inc == 4 && numBytes > 0 && numBytes + 4 <= std::distance( begin, end ) ) return { begin + numBytes + 4, true }; else return { begin, false }; } void ReceiverTcp::Connection::read() { if( ! mSocket->is_open() ) return; auto receiver = mReceiver; std::function<std::pair<iterator, bool>( iterator, iterator )> match = &readMatchCondition; if( mReceiver->mPacketFraming ) match = std::bind( &PacketFraming::messageComplete, mReceiver->mPacketFraming, std::placeholders::_1, std::placeholders::_2 ); asio::async_read_until( *mSocket, mBuffer, match, [&, receiver]( const asio::error_code &error, size_t bytesTransferred ) { if( error ) { std::lock_guard<std::mutex> lock( receiver->mConnectionErrorFnMutex ); if( receiver->mConnectionErrorFn ) receiver->mConnectionErrorFn( error, mIdentifier ); else CI_LOG_E( error.message() << ", didn't receive message from " << mSocket->remote_endpoint().address().to_string() ); receiver->closeConnection( mIdentifier ); } else { ByteBufferRef data = ByteBufferRef( new ByteBuffer( bytesTransferred ) ); istream stream( &mBuffer ); stream.read( reinterpret_cast<char*>( data->data() ), bytesTransferred ); uint8_t *dataPtr = nullptr; size_t dataSize = 0; if( mReceiver->mPacketFraming ) { data = mReceiver->mPacketFraming->decode( data ); dataPtr = data->data(); dataSize = data->size(); } else { dataPtr = data->data() + 4; dataSize = data->size() - 4; } receiver->dispatchMethods( dataPtr, dataSize, mSocket->remote_endpoint().address() ); read(); } }); } ReceiverTcp::ReceiverTcp( uint16_t port, const protocol &protocol, asio::io_service &service, PacketFramingRef packetFraming ) : mAcceptor( new tcp::acceptor( service ) ), mPacketFraming( packetFraming ), mLocalEndpoint( protocol, port ), mConnectionIdentifiers( 0 ), mIsShuttingDown( false ) { } ReceiverTcp::ReceiverTcp( const protocol::endpoint &localEndpoint, asio::io_service &service, PacketFramingRef packetFraming ) : mAcceptor( new tcp::acceptor( service ) ), mPacketFraming( packetFraming ), mLocalEndpoint( localEndpoint ), mConnectionIdentifiers( 0 ), mIsShuttingDown( false ) { } ReceiverTcp::ReceiverTcp( AcceptorRef acceptor, PacketFramingRef packetFraming ) : mAcceptor( acceptor ), mLocalEndpoint( mAcceptor->local_endpoint() ), mPacketFraming( packetFraming ), mConnectionIdentifiers( 0 ), mIsShuttingDown( false ) { } ReceiverTcp::ReceiverTcp( TcpSocketRef socket, PacketFramingRef packetFraming ) : mAcceptor( nullptr ), mLocalEndpoint( socket->local_endpoint() ), mPacketFraming( packetFraming ), mConnectionIdentifiers( 0 ), mIsShuttingDown( false ) { auto identifier = mConnectionIdentifiers++; std::lock_guard<std::mutex> lock( mConnectionMutex ); mConnections.emplace_back( new Connection( socket, this, identifier ) ); mConnections.back()->read(); } void ReceiverTcp::bindImpl() { if( ! mAcceptor || mAcceptor->is_open() ) return; asio::error_code ec; mIsShuttingDown.store( false ); mAcceptor->open( mLocalEndpoint.protocol(), ec ); if( ec ) throw osc_new::Exception( ec ); mAcceptor->set_option( socket_base::reuse_address( true ) ); mAcceptor->bind( mLocalEndpoint, ec ); if( ec ) throw osc_new::Exception( ec ); mAcceptor->listen( socket_base::max_connections, ec ); if( ec ) throw osc_new::Exception( ec ); } void ReceiverTcp::accept( OnAcceptErrorFn onAcceptErrorFn, OnAcceptFn onAcceptFn ) { if( ! mAcceptor || ! mAcceptor->is_open() ) return; auto socket = std::make_shared<tcp::socket>( mAcceptor->get_io_service() ); mAcceptor->async_accept( *socket, std::bind( [&, onAcceptErrorFn, onAcceptFn]( TcpSocketRef socket, const asio::error_code &error ) { if( ! error ) { auto identifier = mConnectionIdentifiers++; { bool shouldAdd = true; if( onAcceptFn ) shouldAdd = onAcceptFn( socket, identifier ); if( shouldAdd ) { std::lock_guard<std::mutex> lock( mConnectionMutex ); mConnections.emplace_back( new Connection( socket, this, identifier ) ); mConnections.back()->read(); } } } else { if( onAcceptErrorFn ) { auto endpoint = socket->remote_endpoint(); if( ! onAcceptErrorFn( error, endpoint ) ) return; } else { CI_LOG_E( "Tcp Accept: " << error.message() << " - Code: " << error.value() ); CI_LOG_W( "Exiting Accept loop." ); return; } } accept( onAcceptErrorFn, onAcceptFn ); }, socket, _1 ) ); } void ReceiverTcp::setConnectionErrorFn( ConnectionErrorFn errorFn ) { std::lock_guard<std::mutex> lock( mConnectionErrorFnMutex ); mConnectionErrorFn = errorFn; } void ReceiverTcp::closeAcceptor() { if( ! mAcceptor || mIsShuttingDown.load() ) return; asio::error_code ec; mAcceptor->close( ec ); if( ec ) throw osc_new::Exception( ec ); } void ReceiverTcp::closeImpl() { // if there's an error on a socket while shutting down the receiver, it could // cause a recursive run on the mConnectionMutex by someone listening for // connection error and attempting to close the connection on error through // the closeConnection function. This blocks against that ability. Basically, // if we're shutting down we disregard the closeConnection function. mIsShuttingDown.store( true ); closeAcceptor(); std::lock_guard<std::mutex> lock( mConnectionMutex ); for( auto & connection : mConnections ) connection->shutdown( socket_base::shutdown_both ); mConnections.clear(); } asio::error_code ReceiverTcp::closeConnection( uint64_t connectionIdentifier, asio::socket_base::shutdown_type shutdownType ) { asio::error_code ec; if( mIsShuttingDown ) return ec; std::lock_guard<std::mutex> lock( mConnectionMutex ); auto rem = remove_if( mConnections.begin(), mConnections.end(), [connectionIdentifier]( const UniqueConnection &cached ) { return cached->mIdentifier == connectionIdentifier; } ); if( rem != mConnections.end() ) { ec = (*rem)->shutdown( shutdownType ); mConnections.erase( rem ); } return ec; } ByteBufferRef SLIPPacketFraming::encode( ByteBufferRef bufferToEncode ) { // buffers in this system begin with the size, which will be removed in the case of Packet Framing. auto maxEncodedSize = 2 * (bufferToEncode->size() - 4) + 2; auto encodeBuffer = ByteBufferRef( new ByteBuffer( maxEncodedSize ) ); auto finalEncodedSize = encode( bufferToEncode->data() + 4, bufferToEncode->size() - 4, encodeBuffer->data() ); encodeBuffer->resize( finalEncodedSize ); return encodeBuffer; } ByteBufferRef SLIPPacketFraming::decode( ByteBufferRef bufferToDecode ) { // should not assume double-ENDed variant auto maxDecodedSize = bufferToDecode->size() - 1; auto decodeBuffer = ByteBufferRef( new ByteBuffer( maxDecodedSize ) ); auto finalDecodedSize = decode( bufferToDecode->data(), bufferToDecode->size(), decodeBuffer->data() ); decodeBuffer->resize( finalDecodedSize ); return decodeBuffer; } std::pair<iterator, bool> SLIPPacketFraming::messageComplete( iterator begin, iterator end ) { iterator i = begin; while( i != end ) { if( i != begin && (uint8_t)*i == SLIP_END ) { // Send back 1 past finding SLIP_END, which in this case will either // be iterator end or the next SLIP_END, beginning the next message return { i + 1, true }; } i++; } return { begin, false }; } size_t SLIPPacketFraming::encode( const uint8_t* data, size_t size, uint8_t* encodedData ) { size_t readIDX = 0, writeIDX = 0; // double-ENDed variant, will flush any accumulated line noise encodedData[writeIDX++] = SLIP_END; while (readIDX < size) { uint8_t value = data[readIDX++]; if (value == SLIP_END) { encodedData[writeIDX++] = SLIP_ESC; encodedData[writeIDX++] = SLIP_ESC_END; } else if (value == SLIP_ESC) { encodedData[writeIDX++] = SLIP_ESC; encodedData[writeIDX++] = SLIP_ESC_ESC; } else encodedData[writeIDX++] = value; } encodedData[writeIDX++] = SLIP_END; return writeIDX; } size_t SLIPPacketFraming::decode(const uint8_t* data, size_t size, uint8_t* decodedData) { size_t readIDX = 0, writeIDX = 0; while (readIDX < size) { uint8_t value = data[readIDX++]; if (value == SLIP_END) { // flush or done } else if (value == SLIP_ESC) { value = data[readIDX++]; if (value == SLIP_ESC_END) { decodedData[writeIDX++] = SLIP_END; } else if (value == SLIP_ESC_ESC) { decodedData[writeIDX++] = SLIP_ESC; } else { // protocol violation } } else { decodedData[writeIDX++] = value; } } return writeIDX; } namespace time { uint64_t get_current_ntp_time( milliseconds offsetMillis ) { auto now = std::chrono::system_clock::now() + offsetMillis; auto sec = std::chrono::duration_cast<std::chrono::seconds>( now.time_since_epoch() ).count() + 0x83AA7E80; auto usec = std::chrono::duration_cast<std::chrono::microseconds>( now.time_since_epoch() ).count() + 0x7D91048BCA000; return ( sec << 32 ) + ( usec % 1000000L ); } uint64_t getFutureClockWithOffset( milliseconds offsetFuture, int64_t localOffsetSecs, int64_t localOffsetUSecs ) { uint64_t ntp_time = get_current_ntp_time( offsetFuture ); uint64_t secs = ( ntp_time >> 32 ) + localOffsetSecs; int64_t usecs = ( ntp_time & uint32_t( ~0 ) ) + localOffsetUSecs; if( usecs < 0 ) { secs += usecs / 1000000; usecs += ( usecs / 1000000 ) * 1000000; } else { secs += usecs / 1000000; usecs -= ( usecs / 1000000 ) * 1000000; } return ( secs << 32 ) + usecs; } void getDate( uint64_t ntpTime, uint32_t *year, uint32_t *month, uint32_t *day, uint32_t *hours, uint32_t *minutes, uint32_t *seconds ) { // Convert to unix timestamp. std::time_t sec_since_epoch = ( ntpTime - ( uint64_t( 0x83AA7E80 ) << 32 ) ) >> 32; auto tm = std::localtime( &sec_since_epoch ); if( year ) *year = tm->tm_year + 1900; if( month ) *month = tm->tm_mon + 1; if( day ) *day = tm->tm_mday; if( hours ) *hours = tm->tm_hour; if( minutes ) *minutes = tm->tm_min; if( seconds )*seconds = tm->tm_sec; } std::string getClockString( uint64_t ntpTime, bool includeDate ) { uint32_t year, month, day, hours, minutes, seconds; getDate( ntpTime, &year, &month, &day, &hours, &minutes, &seconds ); char buffer[128]; if( includeDate ) sprintf( buffer, "%d/%d/%d %02d:%02d:%02d", month, day, year, hours, minutes, seconds ); else sprintf( buffer, "%02d:%02d:%02d", hours, minutes, seconds ); return std::string( buffer ); } void calcOffsetFromSystem( uint64_t ntpTime, int64_t *localOffsetSecs, int64_t *localOffsetUSecs ) { uint64_t current_ntp_time = time::get_current_ntp_time(); *localOffsetSecs = ( ntpTime >> 32 ) - ( current_ntp_time >> 32 ); *localOffsetUSecs = ( ntpTime & uint32_t( ~0 ) ) - ( current_ntp_time & uint32_t( ~0 ) ); } } // namespace time } // namespace osc } // namespace cinder
29.784225
178
0.670778
[ "vector", "transform" ]
3e947117f0845ae5b05eacf3bb69852c5fca72ac
56,236
cpp
C++
asteria/rocket/ascii_numget.cpp
usama-makhzoum/asteria
ea4c893a038e0c5bef14d4d9f6723124a0cbb30f
[ "BSD-3-Clause" ]
null
null
null
asteria/rocket/ascii_numget.cpp
usama-makhzoum/asteria
ea4c893a038e0c5bef14d4d9f6723124a0cbb30f
[ "BSD-3-Clause" ]
null
null
null
asteria/rocket/ascii_numget.cpp
usama-makhzoum/asteria
ea4c893a038e0c5bef14d4d9f6723124a0cbb30f
[ "BSD-3-Clause" ]
null
null
null
// This file is part of Asteria. // Copyleft 2018 - 2021, LH_Mouse. All wrongs reserved. #include "ascii_numget.hpp" #include "assert.hpp" #include "throw.hpp" #include <cmath> namespace rocket { namespace { constexpr bool do_match_char_ci(char ch, char cmp) { return static_cast<uint8_t>(ch | 0x20) == static_cast<uint8_t>(cmp); } bool do_get_sign(const char*& rp, const char* eptr) { // Look ahead for at most 1 character. if(eptr - rp < 1) return 0; switch(rp[0]) { case '+': // Skip the plus sign. rp += 1; return 0; case '-': // Skip the minus sign. rp += 1; return 1; default: // Assume the number is non-negative. return 0; } } uint8_t do_get_base(const char*& rp, const char* eptr, uint8_t ibase) { switch(ibase) { case 0: // Look ahead for at most 2 characters. // Assume the number is decimal by default. if(eptr - rp < 2) return 10; if(rp[0] != '0') return 10; // Check for binary and hexadecimal prefixes. if(do_match_char_ci(rp[1], 'b')) { rp += 2; return 2; } if(do_match_char_ci(rp[1], 'x')) { rp += 2; return 16; } // Assume decimal. return 10; case 2: case 10: case 16: // Prefer `ibase` if it is specified explicitly. return ibase; default: sprintf_and_throw<invalid_argument>( "ascii_numget: Invalid radix (`%d` not 2, 10 or 16)", ibase); } } struct mantissa { uint64_t value; // significant figures size_t ntrunc; // number of significant figures truncated bool trailer; // have any non-zero figures been truncated? }; constexpr int8_t s_digits[] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, -1, -1, -1, -1, -1, -1, // 0-9 -1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, // A-O 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, -1, -1, -1, -1, -1, // P-Z -1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, // a-o 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, -1, -1, -1, -1, -1, // p-z -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, }; size_t do_collect_U_generic(mantissa& m, const char*& rp, const char* eptr, uint8_t base, uint64_t limit) { size_t nrd = 0; while(rp != eptr) { // Get a digit. char32_t uch = static_cast<uint8_t>(rp[0]); uint8_t dval = static_cast<uint8_t>(s_digits[uch]); if(dval >= base) break; nrd += 1; rp += 1; // Ignore leading zeroes. if((m.value | dval) == 0) continue; // Truncate this digit if it would cause an overflow. if(m.value > (limit - dval) / base) { m.ntrunc += 1; m.trailer |= dval; continue; } // Append this digit to `value`. m.value *= base; m.value += dval; } return nrd; } size_t do_collect_U(mantissa& m, const char*& rp, const char* eptr, uint8_t base, uint64_t limit) { switch(base) { case 2: return do_collect_U_generic(m, rp, eptr, 2, limit); case 10: return do_collect_U_generic(m, rp, eptr, 10, limit); case 16: return do_collect_U_generic(m, rp, eptr, 16, limit); default: return do_collect_U_generic(m, rp, eptr, base, limit); } } #if 0 /* This program is used to generate the multiplier table for decimal * numbers. Each multiplier for the mantissa is split into two parts. * The base of exponents is 2. * * Compile with: * gcc -std=c99 -W{all,extra,{sign-,}conversion} table.c -lquadmath **/ #include <quadmath.h> #include <stdio.h> void do_print_one(int e) { __float128 value, frac; int exp2; long long mant; // Calculate the multiplier. value = powq(10, e); // Break it down into the fraction and exponent. frac = frexpq(value, &exp2); // Round the fraction towards positive infinity. frac = ldexpq(frac, 63); mant = (long long)ceilq(frac); exp2 = exp2 + 1; // Print the mantissa in fixed-point format. printf("\t{ 0x%.16llX, ", mant); // Print the exponent in binary. printf("%+5d },", exp2); // Print some comments. printf(" // 1.0e%+.3d\n", e); } int main(void) { int e; for(e = -343; e <= +308; ++e) do_print_one(e); return 0; } #endif // 0 // These are generated data. Do not edit by hand! struct decmult_F { uint64_t mant; int exp2; } constexpr s_decmult_F[] = { { 0x5F94EE55D417EF58, -1138 }, // 1.0e-343 { 0x777A29EB491DEB2E, -1135 }, // 1.0e-342 { 0x4AAC5A330DB2B2FD, -1131 }, // 1.0e-341 { 0x5D5770BFD11F5FBC, -1128 }, // 1.0e-340 { 0x74AD4CEFC56737AA, -1125 }, // 1.0e-339 { 0x48EC5015DB6082CB, -1121 }, // 1.0e-338 { 0x5B27641B5238A37D, -1118 }, // 1.0e-337 { 0x71F13D2226C6CC5C, -1115 }, // 1.0e-336 { 0x4736C635583C3FBA, -1111 }, // 1.0e-335 { 0x590477C2AE4B4FA8, -1108 }, // 1.0e-334 { 0x6F4595B359DE2392, -1105 }, // 1.0e-333 { 0x458B7D90182AD63C, -1101 }, // 1.0e-332 { 0x56EE5CF41E358BCA, -1098 }, // 1.0e-331 { 0x6CA9F43125C2EEBD, -1095 }, // 1.0e-330 { 0x43EA389EB799D536, -1091 }, // 1.0e-329 { 0x54E4C6C665804A84, -1088 }, // 1.0e-328 { 0x6A1DF877FEE05D25, -1085 }, // 1.0e-327 { 0x4252BB4AFF4C3A37, -1081 }, // 1.0e-326 { 0x52E76A1DBF1F48C5, -1078 }, // 1.0e-325 { 0x67A144A52EE71AF6, -1075 }, // 1.0e-324 { 0x40C4CAE73D5070DA, -1071 }, // 1.0e-323 { 0x50F5FDA10CA48D10, -1068 }, // 1.0e-322 { 0x65337D094FCDB054, -1065 }, // 1.0e-321 { 0x7E805C4BA3C11C69, -1062 }, // 1.0e-320 { 0x4F1039AF4658B1C2, -1058 }, // 1.0e-319 { 0x62D4481B17EEDE32, -1055 }, // 1.0e-318 { 0x7B895A21DDEA95BE, -1052 }, // 1.0e-317 { 0x4D35D8552AB29D97, -1048 }, // 1.0e-316 { 0x60834E6A755F44FD, -1045 }, // 1.0e-315 { 0x78A4220512B7163C, -1042 }, // 1.0e-314 { 0x4B6695432BB26DE6, -1038 }, // 1.0e-313 { 0x5E403A93F69F095F, -1035 }, // 1.0e-312 { 0x75D04938F446CBB6, -1032 }, // 1.0e-311 { 0x49A22DC398AC3F52, -1028 }, // 1.0e-310 { 0x5C0AB9347ED74F27, -1025 }, // 1.0e-309 { 0x730D67819E8D22F0, -1022 }, // 1.0e-308 { 0x47E860B1031835D6, -1018 }, // 1.0e-307 { 0x59E278DD43DE434C, -1015 }, // 1.0e-306 { 0x705B171494D5D41F, -1012 }, // 1.0e-305 { 0x4638EE6CDD05A493, -1008 }, // 1.0e-304 { 0x57C72A0814470DB8, -1005 }, // 1.0e-303 { 0x6DB8F48A1958D126, -1002 }, // 1.0e-302 { 0x449398D64FD782B8, -998 }, // 1.0e-301 { 0x55B87F0BE3CD6366, -995 }, // 1.0e-300 { 0x6B269ECEDCC0BC3F, -992 }, // 1.0e-299 { 0x42F8234149F875A8, -988 }, // 1.0e-298 { 0x53B62C119C769311, -985 }, // 1.0e-297 { 0x68A3B716039437D6, -982 }, // 1.0e-296 { 0x4166526DC23CA2E6, -978 }, // 1.0e-295 { 0x51BFE70932CBCB9F, -975 }, // 1.0e-294 { 0x662FE0CB7F7EBE87, -972 }, // 1.0e-293 { 0x7FBBD8FE5F5E6E28, -969 }, // 1.0e-292 { 0x4FD5679EFB9B04D9, -965 }, // 1.0e-291 { 0x63CAC186BA81C60F, -962 }, // 1.0e-290 { 0x7CBD71E869223793, -959 }, // 1.0e-289 { 0x4DF6673141B562BC, -955 }, // 1.0e-288 { 0x617400FD9222BB6B, -952 }, // 1.0e-287 { 0x79D1013CF6AB6A46, -949 }, // 1.0e-286 { 0x4C22A0C61A2B226C, -945 }, // 1.0e-285 { 0x5F2B48F7A0B5EB07, -942 }, // 1.0e-284 { 0x76F61B3588E365C8, -939 }, // 1.0e-283 { 0x4A59D101758E1F9D, -935 }, // 1.0e-282 { 0x5CF04541D2F1A784, -932 }, // 1.0e-281 { 0x742C569247AE1165, -929 }, // 1.0e-280 { 0x489BB61B6CCCCAE0, -925 }, // 1.0e-279 { 0x5AC2A3A247FFFD97, -922 }, // 1.0e-278 { 0x71734C8AD9FFFCFD, -919 }, // 1.0e-277 { 0x46E80FD6C83FFE1E, -915 }, // 1.0e-276 { 0x58A213CC7A4FFDA6, -912 }, // 1.0e-275 { 0x6ECA98BF98E3FD0F, -909 }, // 1.0e-274 { 0x453E9F77BF8E7E2A, -905 }, // 1.0e-273 { 0x568E4755AF721DB4, -902 }, // 1.0e-272 { 0x6C31D92B1B4EA521, -899 }, // 1.0e-271 { 0x439F27BAF1112735, -895 }, // 1.0e-270 { 0x5486F1A9AD557102, -892 }, // 1.0e-269 { 0x69A8AE1418AACD42, -889 }, // 1.0e-268 { 0x42096CCC8F6AC049, -885 }, // 1.0e-267 { 0x528BC7FFB345705C, -882 }, // 1.0e-266 { 0x672EB9FFA016CC72, -879 }, // 1.0e-265 { 0x407D343FC40E3FC8, -875 }, // 1.0e-264 { 0x509C814FB511CFBA, -872 }, // 1.0e-263 { 0x64C3A1A3A25643A8, -869 }, // 1.0e-262 { 0x7DF48A0C8AEBD492, -866 }, // 1.0e-261 { 0x4EB8D647D6D364DB, -862 }, // 1.0e-260 { 0x62670BD9CC883E12, -859 }, // 1.0e-259 { 0x7B00CED03FAA4D96, -856 }, // 1.0e-258 { 0x4CE0814227CA707E, -852 }, // 1.0e-257 { 0x6018A192B1BD0C9D, -849 }, // 1.0e-256 { 0x781EC9F75E2C4FC5, -846 }, // 1.0e-255 { 0x4B133E3A9ADBB1DB, -842 }, // 1.0e-254 { 0x5DD80DC941929E52, -839 }, // 1.0e-253 { 0x754E113B91F745E6, -836 }, // 1.0e-252 { 0x4950CAC53B3A8BB0, -832 }, // 1.0e-251 { 0x5BA4FD768A092E9C, -829 }, // 1.0e-250 { 0x728E3CD42C8B7A43, -826 }, // 1.0e-249 { 0x4798E6049BD72C6A, -822 }, // 1.0e-248 { 0x597F1F85C2CCF784, -819 }, // 1.0e-247 { 0x6FDEE76733803565, -816 }, // 1.0e-246 { 0x45EB50A08030215F, -812 }, // 1.0e-245 { 0x576624C8A03C29B7, -809 }, // 1.0e-244 { 0x6D3FADFAC84B3425, -806 }, // 1.0e-243 { 0x4447CCBCBD2F0097, -802 }, // 1.0e-242 { 0x5559BFEBEC7AC0BD, -799 }, // 1.0e-241 { 0x6AB02FE6E79970EC, -796 }, // 1.0e-240 { 0x42AE1DF050BFE694, -792 }, // 1.0e-239 { 0x5359A56C64EFE038, -789 }, // 1.0e-238 { 0x68300EC77E2BD846, -786 }, // 1.0e-237 { 0x411E093CAEDB672C, -782 }, // 1.0e-236 { 0x51658B8BDA9240F7, -779 }, // 1.0e-235 { 0x65BEEE6ED136D135, -776 }, // 1.0e-234 { 0x7F2EAA0A85848582, -773 }, // 1.0e-233 { 0x4F7D2A469372D371, -769 }, // 1.0e-232 { 0x635C74D8384F884E, -766 }, // 1.0e-231 { 0x7C33920E46636A61, -763 }, // 1.0e-230 { 0x4DA03B48EBFE227D, -759 }, // 1.0e-229 { 0x61084A1B26FDAB1C, -756 }, // 1.0e-228 { 0x794A5CA1F0BD15E3, -753 }, // 1.0e-227 { 0x4BCE79E536762DAE, -749 }, // 1.0e-226 { 0x5EC2185E8413B919, -746 }, // 1.0e-225 { 0x76729E762518A75F, -743 }, // 1.0e-224 { 0x4A07A309D72F689C, -739 }, // 1.0e-223 { 0x5C898BCC4CFB42C3, -736 }, // 1.0e-222 { 0x73ABEEBF603A1373, -733 }, // 1.0e-221 { 0x484B75379C244C28, -729 }, // 1.0e-220 { 0x5A5E5285832D5F32, -726 }, // 1.0e-219 { 0x70F5E726E3F8B6FE, -723 }, // 1.0e-218 { 0x4699B0784E7B725F, -719 }, // 1.0e-217 { 0x58401C96621A4EF7, -716 }, // 1.0e-216 { 0x6E5023BBFAA0E2B4, -713 }, // 1.0e-215 { 0x44F216557CA48DB1, -709 }, // 1.0e-214 { 0x562E9BEADBCDB11D, -706 }, // 1.0e-213 { 0x6BBA42E592C11D64, -703 }, // 1.0e-212 { 0x435469CF7BB8B25F, -699 }, // 1.0e-211 { 0x542984435AA6DEF6, -696 }, // 1.0e-210 { 0x6933E554315096B4, -693 }, // 1.0e-209 { 0x41C06F549ED25E31, -689 }, // 1.0e-208 { 0x52308B29C686F5BD, -686 }, // 1.0e-207 { 0x66BCADF43828B32C, -683 }, // 1.0e-206 { 0x4035ECB8A3196FFC, -679 }, // 1.0e-205 { 0x504367E6CBDFCBFA, -676 }, // 1.0e-204 { 0x645441E07ED7BEF9, -673 }, // 1.0e-203 { 0x7D6952589E8DAEB7, -670 }, // 1.0e-202 { 0x4E61D37763188D32, -666 }, // 1.0e-201 { 0x61FA48553BDEB07F, -663 }, // 1.0e-200 { 0x7A78DA6A8AD65C9E, -660 }, // 1.0e-199 { 0x4C8B888296C5F9E3, -656 }, // 1.0e-198 { 0x5FAE6AA33C77785C, -653 }, // 1.0e-197 { 0x779A054C0B955673, -650 }, // 1.0e-196 { 0x4AC0434F873D5608, -646 }, // 1.0e-195 { 0x5D705423690CAB8A, -643 }, // 1.0e-194 { 0x74CC692C434FD66C, -640 }, // 1.0e-193 { 0x48FFC1BBAA11E604, -636 }, // 1.0e-192 { 0x5B3FB22A94965F85, -633 }, // 1.0e-191 { 0x720F9EB539BBF766, -630 }, // 1.0e-190 { 0x4749C33144157AA0, -626 }, // 1.0e-189 { 0x591C33FD951AD947, -623 }, // 1.0e-188 { 0x6F6340FCFA618F99, -620 }, // 1.0e-187 { 0x459E089E1C7CF9C0, -616 }, // 1.0e-186 { 0x57058AC5A39C3830, -613 }, // 1.0e-185 { 0x6CC6ED770C83463C, -610 }, // 1.0e-184 { 0x43FC546A67D20BE5, -606 }, // 1.0e-183 { 0x54FB698501C68EDF, -603 }, // 1.0e-182 { 0x6A3A43E642383296, -600 }, // 1.0e-181 { 0x42646A6FE9631F9E, -596 }, // 1.0e-180 { 0x52FD850BE3BBE785, -593 }, // 1.0e-179 { 0x67BCE64EDCAAE167, -590 }, // 1.0e-178 { 0x40D60FF149EACCE0, -586 }, // 1.0e-177 { 0x510B93ED9C658018, -583 }, // 1.0e-176 { 0x654E78E9037EE01E, -580 }, // 1.0e-175 { 0x7EA21723445E9826, -577 }, // 1.0e-174 { 0x4F254E760ABB1F18, -573 }, // 1.0e-173 { 0x62EEA2138D69E6DE, -570 }, // 1.0e-172 { 0x7BAA4A9870C46095, -567 }, // 1.0e-171 { 0x4D4A6E9F467ABC5D, -563 }, // 1.0e-170 { 0x609D0A4718196B74, -560 }, // 1.0e-169 { 0x78C44CD8DE1FC651, -557 }, // 1.0e-168 { 0x4B7AB0078AD3DBF3, -553 }, // 1.0e-167 { 0x5E595C096D88D2F0, -550 }, // 1.0e-166 { 0x75EFB30BC8EB07AC, -547 }, // 1.0e-165 { 0x49B5CFE75D92E4CB, -543 }, // 1.0e-164 { 0x5C2343E134F79DFE, -540 }, // 1.0e-163 { 0x732C14D98235857E, -537 }, // 1.0e-162 { 0x47FB8D07F161736F, -533 }, // 1.0e-161 { 0x59FA7049EDB9D04A, -530 }, // 1.0e-160 { 0x70790C5C6928445D, -527 }, // 1.0e-159 { 0x464BA7B9C1B92ABA, -523 }, // 1.0e-158 { 0x57DE91A832277568, -520 }, // 1.0e-157 { 0x6DD636123EB152C2, -517 }, // 1.0e-156 { 0x44A5E1CB672ED3BA, -513 }, // 1.0e-155 { 0x55CF5A3E40FA88A8, -510 }, // 1.0e-154 { 0x6B4330CDD1392AD2, -507 }, // 1.0e-153 { 0x4309FE80A2C3BAC3, -503 }, // 1.0e-152 { 0x53CC7E20CB74A974, -500 }, // 1.0e-151 { 0x68BF9DA8FE51D3D1, -497 }, // 1.0e-150 { 0x4177C2899EF32463, -493 }, // 1.0e-149 { 0x51D5B32C06AFED7B, -490 }, // 1.0e-148 { 0x664B1FF7085BE8DA, -487 }, // 1.0e-147 { 0x7FDDE7F4CA72E310, -484 }, // 1.0e-146 { 0x4FEAB0F8FE87CDEA, -480 }, // 1.0e-145 { 0x63E55D373E29C165, -477 }, // 1.0e-144 { 0x7CDEB4850DB431BE, -474 }, // 1.0e-143 { 0x4E0B30D328909F17, -470 }, // 1.0e-142 { 0x618DFD07F2B4C6DD, -467 }, // 1.0e-141 { 0x79F17C49EF61F894, -464 }, // 1.0e-140 { 0x4C36EDAE359D3B5C, -460 }, // 1.0e-139 { 0x5F44A919C3048A33, -457 }, // 1.0e-138 { 0x7715D36033C5ACC0, -454 }, // 1.0e-137 { 0x4A6DA41C205B8BF8, -450 }, // 1.0e-136 { 0x5D090D2328726EF6, -447 }, // 1.0e-135 { 0x744B506BF28F0AB4, -444 }, // 1.0e-134 { 0x48AF1243779966B1, -440 }, // 1.0e-133 { 0x5ADAD6D4557FC05D, -437 }, // 1.0e-132 { 0x71918C896ADFB074, -434 }, // 1.0e-131 { 0x46FAF7D5E2CBCE48, -430 }, // 1.0e-130 { 0x58B9B5CB5B7EC1DA, -427 }, // 1.0e-129 { 0x6EE8233E325E7251, -424 }, // 1.0e-128 { 0x45511606DF7B0773, -420 }, // 1.0e-127 { 0x56A55B889759C94F, -417 }, // 1.0e-126 { 0x6C4EB26ABD303BA3, -414 }, // 1.0e-125 { 0x43B12F82B63E2546, -410 }, // 1.0e-124 { 0x549D7B6363CDAE97, -407 }, // 1.0e-123 { 0x69C4DA3C3CC11A3D, -404 }, // 1.0e-122 { 0x421B0865A5F8B066, -400 }, // 1.0e-121 { 0x52A1CA7F0F76DC80, -397 }, // 1.0e-120 { 0x674A3D1ED35493A0, -394 }, // 1.0e-119 { 0x408E66334414DC44, -390 }, // 1.0e-118 { 0x50B1FFC0151A1355, -387 }, // 1.0e-117 { 0x64DE7FB01A60982A, -384 }, // 1.0e-116 { 0x7E161F9C20F8BE34, -381 }, // 1.0e-115 { 0x4ECDD3C1949B76E1, -377 }, // 1.0e-114 { 0x628148B1F9C25499, -374 }, // 1.0e-113 { 0x7B219ADE7832E9BF, -371 }, // 1.0e-112 { 0x4CF500CB0B1FD218, -367 }, // 1.0e-111 { 0x603240FDCDE7C69D, -364 }, // 1.0e-110 { 0x783ED13D4161B845, -361 }, // 1.0e-109 { 0x4B2742C648DD132B, -357 }, // 1.0e-108 { 0x5DF11377DB1457F6, -354 }, // 1.0e-107 { 0x756D5855D1D96DF3, -351 }, // 1.0e-106 { 0x49645735A327E4B8, -347 }, // 1.0e-105 { 0x5BBD6D030BF1DDE6, -344 }, // 1.0e-104 { 0x72ACC843CEEE555F, -341 }, // 1.0e-103 { 0x47ABFD2A6154F55C, -337 }, // 1.0e-102 { 0x5996FC74F9AA32B3, -334 }, // 1.0e-101 { 0x6FFCBB923814BF5F, -331 }, // 1.0e-100 { 0x45FDF53B630CF79C, -327 }, // 1.0e-099 { 0x577D728A3BD03582, -324 }, // 1.0e-098 { 0x6D5CCF2CCAC442E3, -321 }, // 1.0e-097 { 0x445A017BFEBAA9CE, -317 }, // 1.0e-096 { 0x557081DAFE695441, -314 }, // 1.0e-095 { 0x6ACCA251BE03A952, -311 }, // 1.0e-094 { 0x42BFE57316C249D3, -307 }, // 1.0e-093 { 0x536FDECFDC72DC48, -304 }, // 1.0e-092 { 0x684BD683D38F935A, -301 }, // 1.0e-091 { 0x412F66126439BC18, -297 }, // 1.0e-090 { 0x517B3F96FD482B1E, -294 }, // 1.0e-089 { 0x65DA0F7CBC9A35E6, -291 }, // 1.0e-088 { 0x7F50935BEBC0C35F, -288 }, // 1.0e-087 { 0x4F925C1973587A1C, -284 }, // 1.0e-086 { 0x6376F31FD02E98A2, -281 }, // 1.0e-085 { 0x7C54AFE7C43A3ECB, -278 }, // 1.0e-084 { 0x4DB4EDF0DAA4673F, -274 }, // 1.0e-083 { 0x6122296D114D810E, -271 }, // 1.0e-082 { 0x796AB3C855A0E152, -268 }, // 1.0e-081 { 0x4BE2B05D35848CD3, -264 }, // 1.0e-080 { 0x5EDB5C7482E5B008, -261 }, // 1.0e-079 { 0x76923391A39F1C0A, -258 }, // 1.0e-078 { 0x4A1B603B06437186, -254 }, // 1.0e-077 { 0x5CA23849C7D44DE8, -251 }, // 1.0e-076 { 0x73CAC65C39C96162, -248 }, // 1.0e-075 { 0x485EBBF9A41DDCDD, -244 }, // 1.0e-074 { 0x5A766AF80D255415, -241 }, // 1.0e-073 { 0x711405B6106EA91A, -238 }, // 1.0e-072 { 0x46AC8391CA4529B0, -234 }, // 1.0e-071 { 0x5857A4763CD6741C, -231 }, // 1.0e-070 { 0x6E6D8D93CC0C1123, -228 }, // 1.0e-069 { 0x4504787C5F878AB6, -224 }, // 1.0e-068 { 0x5645969B77696D63, -221 }, // 1.0e-067 { 0x6BD6FC425543C8BC, -218 }, // 1.0e-066 { 0x43665DA9754A5D76, -214 }, // 1.0e-065 { 0x543FF513D29CF4D3, -211 }, // 1.0e-064 { 0x694FF258C7443208, -208 }, // 1.0e-063 { 0x41D1F7777C8A9F45, -204 }, // 1.0e-062 { 0x524675555BAD4716, -201 }, // 1.0e-061 { 0x66D812AAB29898DC, -198 }, // 1.0e-060 { 0x40470BAAAF9F5F89, -194 }, // 1.0e-059 { 0x5058CE955B87376C, -191 }, // 1.0e-058 { 0x646F023AB2690546, -188 }, // 1.0e-057 { 0x7D8AC2C95F034698, -185 }, // 1.0e-056 { 0x4E76B9BDDB620C1F, -181 }, // 1.0e-055 { 0x6214682D523A8F27, -178 }, // 1.0e-054 { 0x7A998238A6C932F0, -175 }, // 1.0e-053 { 0x4C9FF163683DBFD6, -171 }, // 1.0e-052 { 0x5FC7EDBC424D2FCC, -168 }, // 1.0e-051 { 0x77B9E92B52E07BBF, -165 }, // 1.0e-050 { 0x4AD431BB13CC4D57, -161 }, // 1.0e-049 { 0x5D893E29D8BF60AD, -158 }, // 1.0e-048 { 0x74EB8DB44EEF38D8, -155 }, // 1.0e-047 { 0x49133890B1558387, -151 }, // 1.0e-046 { 0x5B5806B4DDAAE469, -148 }, // 1.0e-045 { 0x722E086215159D83, -145 }, // 1.0e-044 { 0x475CC53D4D2D8272, -141 }, // 1.0e-043 { 0x5933F68CA078E30F, -138 }, // 1.0e-042 { 0x6F80F42FC8971BD2, -135 }, // 1.0e-041 { 0x45B0989DDD5E7164, -131 }, // 1.0e-040 { 0x571CBEC554B60DBC, -128 }, // 1.0e-039 { 0x6CE3EE76A9E3912B, -125 }, // 1.0e-038 { 0x440E750A2A2E3ABB, -121 }, // 1.0e-037 { 0x5512124CB4B9C96A, -118 }, // 1.0e-036 { 0x6A5696DFE1E83BC4, -115 }, // 1.0e-035 { 0x42761E4BED31255B, -111 }, // 1.0e-034 { 0x5313A5DEE87D6EB1, -108 }, // 1.0e-033 { 0x67D88F56A29CCA5E, -105 }, // 1.0e-032 { 0x40E7599625A1FE7B, -101 }, // 1.0e-031 { 0x51212FFBAF0A7E19, -98 }, // 1.0e-030 { 0x65697BFA9ACD1DA0, -95 }, // 1.0e-029 { 0x7EC3DAF941806507, -92 }, // 1.0e-028 { 0x4F3A68DBC8F03F25, -88 }, // 1.0e-027 { 0x63090312BB2C4EEE, -85 }, // 1.0e-026 { 0x7BCB43D769F762A9, -82 }, // 1.0e-025 { 0x4D5F0A66A23A9DAA, -78 }, // 1.0e-024 { 0x60B6CD004AC94514, -75 }, // 1.0e-023 { 0x78E480405D7B9659, -72 }, // 1.0e-022 { 0x4B8ED0283A6D3DF8, -68 }, // 1.0e-021 { 0x5E72843249088D76, -65 }, // 1.0e-020 { 0x760F253EDB4AB0D3, -62 }, // 1.0e-019 { 0x49C97747490EAE84, -58 }, // 1.0e-018 { 0x5C3BD5191B525A25, -55 }, // 1.0e-017 { 0x734ACA5F6226F0AE, -52 }, // 1.0e-016 { 0x480EBE7B9D58566D, -48 }, // 1.0e-015 { 0x5A126E1A84AE6C08, -45 }, // 1.0e-014 { 0x709709A125DA070A, -42 }, // 1.0e-013 { 0x465E6604B7A84466, -38 }, // 1.0e-012 { 0x57F5FF85E5925580, -35 }, // 1.0e-011 { 0x6DF37F675EF6EAE0, -32 }, // 1.0e-010 { 0x44B82FA09B5A52CC, -28 }, // 1.0e-009 { 0x55E63B88C230E77F, -25 }, // 1.0e-008 { 0x6B5FCA6AF2BD215F, -22 }, // 1.0e-007 { 0x431BDE82D7B634DB, -18 }, // 1.0e-006 { 0x53E2D6238DA3C212, -15 }, // 1.0e-005 { 0x68DB8BAC710CB296, -12 }, // 1.0e-004 { 0x4189374BC6A7EF9E, -8 }, // 1.0e-003 { 0x51EB851EB851EB86, -5 }, // 1.0e-002 { 0x6666666666666667, -2 }, // 1.0e-001 { 0x4000000000000000, +2 }, // 1.0e+000 { 0x5000000000000000, +5 }, // 1.0e+001 { 0x6400000000000000, +8 }, // 1.0e+002 { 0x7D00000000000000, +11 }, // 1.0e+003 { 0x4E20000000000000, +15 }, // 1.0e+004 { 0x61A8000000000000, +18 }, // 1.0e+005 { 0x7A12000000000000, +21 }, // 1.0e+006 { 0x4C4B400000000000, +25 }, // 1.0e+007 { 0x5F5E100000000000, +28 }, // 1.0e+008 { 0x7735940000000000, +31 }, // 1.0e+009 { 0x4A817C8000000000, +35 }, // 1.0e+010 { 0x5D21DBA000000000, +38 }, // 1.0e+011 { 0x746A528800000000, +41 }, // 1.0e+012 { 0x48C2739500000000, +45 }, // 1.0e+013 { 0x5AF3107A40000000, +48 }, // 1.0e+014 { 0x71AFD498D0000000, +51 }, // 1.0e+015 { 0x470DE4DF82000000, +55 }, // 1.0e+016 { 0x58D15E1762800000, +58 }, // 1.0e+017 { 0x6F05B59D3B200000, +61 }, // 1.0e+018 { 0x4563918244F40000, +65 }, // 1.0e+019 { 0x56BC75E2D6310000, +68 }, // 1.0e+020 { 0x6C6B935B8BBD4000, +71 }, // 1.0e+021 { 0x43C33C1937564800, +75 }, // 1.0e+022 { 0x54B40B1F852BDA00, +78 }, // 1.0e+023 { 0x69E10DE76676D080, +81 }, // 1.0e+024 { 0x422CA8B0A00A4250, +85 }, // 1.0e+025 { 0x52B7D2DCC80CD2E4, +88 }, // 1.0e+026 { 0x6765C793FA10079D, +91 }, // 1.0e+027 { 0x409F9CBC7C4A04C3, +95 }, // 1.0e+028 { 0x50C783EB9B5C85F3, +98 }, // 1.0e+029 { 0x64F964E68233A770, +101 }, // 1.0e+030 { 0x7E37BE2022C0914C, +104 }, // 1.0e+031 { 0x4EE2D6D415B85ACF, +108 }, // 1.0e+032 { 0x629B8C891B267183, +111 }, // 1.0e+033 { 0x7B426FAB61F00DE4, +114 }, // 1.0e+034 { 0x4D0985CB1D3608AF, +118 }, // 1.0e+035 { 0x604BE73DE4838ADA, +121 }, // 1.0e+036 { 0x785EE10D5DA46D91, +124 }, // 1.0e+037 { 0x4B3B4CA85A86C47B, +128 }, // 1.0e+038 { 0x5E0A1FD271287599, +131 }, // 1.0e+039 { 0x758CA7C70D7292FF, +134 }, // 1.0e+040 { 0x4977E8DC68679BE0, +138 }, // 1.0e+041 { 0x5BD5E313828182D7, +141 }, // 1.0e+042 { 0x72CB5BD86321E38D, +144 }, // 1.0e+043 { 0x47BF19673DF52E38, +148 }, // 1.0e+044 { 0x59AEDFC10D7279C6, +151 }, // 1.0e+045 { 0x701A97B150CF1838, +154 }, // 1.0e+046 { 0x46109ECED2816F23, +158 }, // 1.0e+047 { 0x5794C6828721CAEC, +161 }, // 1.0e+048 { 0x6D79F82328EA3DA7, +164 }, // 1.0e+049 { 0x446C3B15F9926688, +168 }, // 1.0e+050 { 0x558749DB77F7002A, +171 }, // 1.0e+051 { 0x6AE91C5255F4C035, +174 }, // 1.0e+052 { 0x42D1B1B375B8F821, +178 }, // 1.0e+053 { 0x53861E2053273629, +181 }, // 1.0e+054 { 0x6867A5A867F103B3, +184 }, // 1.0e+055 { 0x4140C78940F6A250, +188 }, // 1.0e+056 { 0x5190F96B91344AE4, +191 }, // 1.0e+057 { 0x65F537C675815D9D, +194 }, // 1.0e+058 { 0x7F7285B812E1B505, +197 }, // 1.0e+059 { 0x4FA793930BCD1123, +201 }, // 1.0e+060 { 0x63917877CEC0556C, +204 }, // 1.0e+061 { 0x7C75D695C2706AC6, +207 }, // 1.0e+062 { 0x4DC9A61D998642BC, +211 }, // 1.0e+063 { 0x613C0FA4FFE7D36B, +214 }, // 1.0e+064 { 0x798B138E3FE1C846, +217 }, // 1.0e+065 { 0x4BF6EC38E7ED1D2C, +221 }, // 1.0e+066 { 0x5EF4A74721E86477, +224 }, // 1.0e+067 { 0x76B1D118EA627D94, +227 }, // 1.0e+068 { 0x4A2F22AF927D8E7D, +231 }, // 1.0e+069 { 0x5CBAEB5B771CF21C, +234 }, // 1.0e+070 { 0x73E9A63254E42EA3, +237 }, // 1.0e+071 { 0x487207DF750E9D26, +241 }, // 1.0e+072 { 0x5A8E89D75252446F, +244 }, // 1.0e+073 { 0x71322C4D26E6D58B, +247 }, // 1.0e+074 { 0x46BF5BB038504577, +251 }, // 1.0e+075 { 0x586F329C466456D5, +254 }, // 1.0e+076 { 0x6E8AFF4357FD6C8A, +257 }, // 1.0e+077 { 0x4516DF8A16FE63D6, +261 }, // 1.0e+078 { 0x565C976C9CBDFCCC, +264 }, // 1.0e+079 { 0x6BF3BD47C3ED7BFE, +267 }, // 1.0e+080 { 0x4378564CDA746D7F, +271 }, // 1.0e+081 { 0x54566BE0111188DF, +274 }, // 1.0e+082 { 0x696C06D81555EB16, +277 }, // 1.0e+083 { 0x41E384470D55B2EE, +281 }, // 1.0e+084 { 0x525C6558D0AB1FAA, +284 }, // 1.0e+085 { 0x66F37EAF04D5E794, +287 }, // 1.0e+086 { 0x40582F2D6305B0BD, +291 }, // 1.0e+087 { 0x506E3AF8BBC71CEC, +294 }, // 1.0e+088 { 0x6489C9B6EAB8E427, +297 }, // 1.0e+089 { 0x7DAC3C24A5671D30, +300 }, // 1.0e+090 { 0x4E8BA596E760723E, +304 }, // 1.0e+091 { 0x622E8EFCA1388ECE, +307 }, // 1.0e+092 { 0x7ABA32BBC986B281, +310 }, // 1.0e+093 { 0x4CB45FB55DF42F91, +314 }, // 1.0e+094 { 0x5FE177A2B5713B75, +317 }, // 1.0e+095 { 0x77D9D58B62CD8A52, +320 }, // 1.0e+096 { 0x4AE825771DC07673, +324 }, // 1.0e+097 { 0x5DA22ED4E5309410, +327 }, // 1.0e+098 { 0x750ABA8A1E7CB914, +330 }, // 1.0e+099 { 0x4926B496530DF3AD, +334 }, // 1.0e+100 { 0x5B7061BBE7D17098, +337 }, // 1.0e+101 { 0x724C7A2AE1C5CCBE, +340 }, // 1.0e+102 { 0x476FCC5ACD1B9FF7, +344 }, // 1.0e+103 { 0x594BBF71806287F4, +347 }, // 1.0e+104 { 0x6F9EAF4DE07B29F1, +350 }, // 1.0e+105 { 0x45C32D90AC4CFA37, +354 }, // 1.0e+106 { 0x5733F8F4D76038C4, +357 }, // 1.0e+107 { 0x6D00F7320D3846F5, +360 }, // 1.0e+108 { 0x44209A7F48432C5A, +364 }, // 1.0e+109 { 0x5528C11F1A53F770, +367 }, // 1.0e+110 { 0x6A72F166E0E8F54C, +370 }, // 1.0e+111 { 0x4287D6E04C919950, +374 }, // 1.0e+112 { 0x5329CC985FB5FFA3, +377 }, // 1.0e+113 { 0x67F43FBE77A37F8C, +380 }, // 1.0e+114 { 0x40F8A7D70AC62FB8, +384 }, // 1.0e+115 { 0x5136D1CCCD77BBA5, +387 }, // 1.0e+116 { 0x6584864000D5AA8F, +390 }, // 1.0e+117 { 0x7EE5A7D0010B1532, +393 }, // 1.0e+118 { 0x4F4F88E200A6ED40, +397 }, // 1.0e+119 { 0x63236B1A80D0A88F, +400 }, // 1.0e+120 { 0x7BEC45E12104D2B3, +403 }, // 1.0e+121 { 0x4D73ABACB4A303B0, +407 }, // 1.0e+122 { 0x60D09697E1CBC49C, +410 }, // 1.0e+123 { 0x7904BC3DDA3EB5C3, +413 }, // 1.0e+124 { 0x4BA2F5A6A867319A, +417 }, // 1.0e+125 { 0x5E8BB3105280FE00, +420 }, // 1.0e+126 { 0x762E9FD467213D80, +423 }, // 1.0e+127 { 0x49DD23E4C074C670, +427 }, // 1.0e+128 { 0x5C546CDDF091F80C, +430 }, // 1.0e+129 { 0x736988156CB6760F, +433 }, // 1.0e+130 { 0x4821F50D63F209CA, +437 }, // 1.0e+131 { 0x5A2A7250BCEE8C3C, +440 }, // 1.0e+132 { 0x70B50EE4EC2A2F4B, +443 }, // 1.0e+133 { 0x4671294F139A5D8F, +447 }, // 1.0e+134 { 0x580D73A2D880F4F3, +450 }, // 1.0e+135 { 0x6E10D08B8EA1322F, +453 }, // 1.0e+136 { 0x44CA82573924BF5E, +457 }, // 1.0e+137 { 0x55FD22ED076DEF35, +460 }, // 1.0e+138 { 0x6B7C6BA849496B02, +463 }, // 1.0e+139 { 0x432DC3492DCDE2E2, +467 }, // 1.0e+140 { 0x53F9341B79415B9A, +470 }, // 1.0e+141 { 0x68F781225791B280, +473 }, // 1.0e+142 { 0x419AB0B576BB0F90, +477 }, // 1.0e+143 { 0x52015CE2D469D374, +480 }, // 1.0e+144 { 0x6681B41B89844851, +483 }, // 1.0e+145 { 0x4011109135F2AD33, +487 }, // 1.0e+146 { 0x501554B5836F587F, +490 }, // 1.0e+147 { 0x641AA9E2E44B2E9F, +493 }, // 1.0e+148 { 0x7D21545B9D5DFA47, +496 }, // 1.0e+149 { 0x4E34D4B9425ABC6C, +500 }, // 1.0e+150 { 0x61C209E792F16B87, +503 }, // 1.0e+151 { 0x7A328C6177ADC669, +506 }, // 1.0e+152 { 0x4C5F97BCEACC9C02, +510 }, // 1.0e+153 { 0x5F777DAC257FC302, +513 }, // 1.0e+154 { 0x77555D172EDFB3C3, +516 }, // 1.0e+155 { 0x4A955A2E7D4BD05A, +520 }, // 1.0e+156 { 0x5D3AB0BA1C9EC470, +523 }, // 1.0e+157 { 0x74895CE8A3C6758C, +526 }, // 1.0e+158 { 0x48D5DA11665C0978, +530 }, // 1.0e+159 { 0x5B0B5095BFF30BD6, +533 }, // 1.0e+160 { 0x71CE24BB2FEFCECB, +536 }, // 1.0e+161 { 0x4720D6F4FDF5E13F, +540 }, // 1.0e+162 { 0x58E90CB23D73598F, +543 }, // 1.0e+163 { 0x6F234FDECCD02FF2, +546 }, // 1.0e+164 { 0x457611EB40021DF8, +550 }, // 1.0e+165 { 0x56D396661002A575, +553 }, // 1.0e+166 { 0x6C887BFF94034ED3, +556 }, // 1.0e+167 { 0x43D54D7FBC821144, +560 }, // 1.0e+168 { 0x54CAA0DFABA29595, +563 }, // 1.0e+169 { 0x69FD4917968B3AFA, +566 }, // 1.0e+170 { 0x423E4DAEBE1704DC, +570 }, // 1.0e+171 { 0x52CDE11A6D9CC613, +573 }, // 1.0e+172 { 0x678159610903F798, +576 }, // 1.0e+173 { 0x40B0D7DCA5A27ABF, +580 }, // 1.0e+174 { 0x50DD0DD3CF0B196F, +583 }, // 1.0e+175 { 0x65145148C2CDDFCA, +586 }, // 1.0e+176 { 0x7E59659AF38157BD, +589 }, // 1.0e+177 { 0x4EF7DF80D830D6D6, +593 }, // 1.0e+178 { 0x62B5D7610E3D0C8C, +596 }, // 1.0e+179 { 0x7B634D3951CC4FAE, +599 }, // 1.0e+180 { 0x4D1E1043D31FB1CD, +603 }, // 1.0e+181 { 0x60659454C7E79E40, +606 }, // 1.0e+182 { 0x787EF969F9E185D0, +609 }, // 1.0e+183 { 0x4B4F5BE23C2CF3A2, +613 }, // 1.0e+184 { 0x5E2332DACB38308B, +616 }, // 1.0e+185 { 0x75ABFF917E063CAD, +619 }, // 1.0e+186 { 0x498B7FBAEEC3E5ED, +623 }, // 1.0e+187 { 0x5BEE5FA9AA74DF68, +626 }, // 1.0e+188 { 0x72E9F79415121741, +629 }, // 1.0e+189 { 0x47D23ABC8D2B4E89, +633 }, // 1.0e+190 { 0x59C6C96BB076222B, +636 }, // 1.0e+191 { 0x70387BC69C93AAB6, +639 }, // 1.0e+192 { 0x46234D5C21DC4AB2, +643 }, // 1.0e+193 { 0x57AC20B32A535D5E, +646 }, // 1.0e+194 { 0x6D9728DFF4E834B6, +649 }, // 1.0e+195 { 0x447E798BF91120F2, +653 }, // 1.0e+196 { 0x559E17EEF755692E, +656 }, // 1.0e+197 { 0x6B059DEAB52AC379, +659 }, // 1.0e+198 { 0x42E382B2B13ABA2C, +663 }, // 1.0e+199 { 0x539C635F5D8968B7, +666 }, // 1.0e+200 { 0x68837C3734EBC2E4, +669 }, // 1.0e+201 { 0x41522DA2811359CF, +673 }, // 1.0e+202 { 0x51A6B90B21583043, +676 }, // 1.0e+203 { 0x6610674DE9AE3C53, +679 }, // 1.0e+204 { 0x7F9481216419CB68, +682 }, // 1.0e+205 { 0x4FBCD0B4DE901F21, +686 }, // 1.0e+206 { 0x63AC04E2163426E9, +689 }, // 1.0e+207 { 0x7C97061A9BC130A3, +692 }, // 1.0e+208 { 0x4DDE63D0A158BE66, +696 }, // 1.0e+209 { 0x6155FCC4C9AEEE00, +699 }, // 1.0e+210 { 0x79AB7BF5FC1AA980, +702 }, // 1.0e+211 { 0x4C0B2D79BD90A9F0, +706 }, // 1.0e+212 { 0x5F0DF8D82CF4D46C, +709 }, // 1.0e+213 { 0x76D1770E38320987, +712 }, // 1.0e+214 { 0x4A42EA68E31F45F4, +716 }, // 1.0e+215 { 0x5CD3A5031BE71771, +719 }, // 1.0e+216 { 0x74088E43E2E0DD4D, +722 }, // 1.0e+217 { 0x488558EA6DCC8A51, +726 }, // 1.0e+218 { 0x5AA6AF25093FACE5, +729 }, // 1.0e+219 { 0x71505AEE4B8F981E, +732 }, // 1.0e+220 { 0x46D238D4EF39BF13, +736 }, // 1.0e+221 { 0x5886C70A2B082ED7, +739 }, // 1.0e+222 { 0x6EA878CCB5CA3A8D, +742 }, // 1.0e+223 { 0x45294B7FF19E6498, +746 }, // 1.0e+224 { 0x56739E5FEE05FDBE, +749 }, // 1.0e+225 { 0x6C1085F7E9877D2E, +752 }, // 1.0e+226 { 0x438A53BAF1F4AE3D, +756 }, // 1.0e+227 { 0x546CE8A9AE71D9CC, +759 }, // 1.0e+228 { 0x698822D41A0E503F, +762 }, // 1.0e+229 { 0x41F515C49048F227, +766 }, // 1.0e+230 { 0x52725B35B45B2EB1, +769 }, // 1.0e+231 { 0x670EF2032171FA5D, +772 }, // 1.0e+232 { 0x40695741F4E73C7A, +776 }, // 1.0e+233 { 0x5083AD1272210B99, +779 }, // 1.0e+234 { 0x64A498570EA94E7F, +782 }, // 1.0e+235 { 0x7DCDBE6CD253A21F, +785 }, // 1.0e+236 { 0x4EA0970403744553, +789 }, // 1.0e+237 { 0x6248BCC5045156A8, +792 }, // 1.0e+238 { 0x7ADAEBF64565AC52, +795 }, // 1.0e+239 { 0x4CC8D379EB5F8BB3, +799 }, // 1.0e+240 { 0x5FFB085866376EA0, +802 }, // 1.0e+241 { 0x77F9CA6E7FC54A48, +805 }, // 1.0e+242 { 0x4AFC1E850FDB4E6D, +809 }, // 1.0e+243 { 0x5DBB262653D22208, +812 }, // 1.0e+244 { 0x7529EFAFE8C6AA8A, +815 }, // 1.0e+245 { 0x493A35CDF17C2A97, +819 }, // 1.0e+246 { 0x5B88C3416DDB353C, +822 }, // 1.0e+247 { 0x726AF411C952028B, +825 }, // 1.0e+248 { 0x4782D88B1DD34197, +829 }, // 1.0e+249 { 0x59638EADE54811FD, +832 }, // 1.0e+250 { 0x6FBC72595E9A167C, +835 }, // 1.0e+251 { 0x45D5C777DB204E0E, +839 }, // 1.0e+252 { 0x574B3955D1E86191, +842 }, // 1.0e+253 { 0x6D1E07AB466279F5, +845 }, // 1.0e+254 { 0x4432C4CB0BFD8C39, +849 }, // 1.0e+255 { 0x553F75FDCEFCEF47, +852 }, // 1.0e+256 { 0x6A8F537D42BC2B19, +855 }, // 1.0e+257 { 0x4299942E49B59AF0, +859 }, // 1.0e+258 { 0x533FF939DC2301AC, +862 }, // 1.0e+259 { 0x680FF788532BC217, +865 }, // 1.0e+260 { 0x4109FAB533FB594E, +869 }, // 1.0e+261 { 0x514C796280FA2FA2, +872 }, // 1.0e+262 { 0x659F97BB2138BB8A, +875 }, // 1.0e+263 { 0x7F077DA9E986EA6C, +878 }, // 1.0e+264 { 0x4F64AE8A31F45284, +882 }, // 1.0e+265 { 0x633DDA2CBE716725, +885 }, // 1.0e+266 { 0x7C0D50B7EE0DC0EE, +888 }, // 1.0e+267 { 0x4D885272F4C89895, +892 }, // 1.0e+268 { 0x60EA670FB1FABEBA, +895 }, // 1.0e+269 { 0x792500D39E796E68, +898 }, // 1.0e+270 { 0x4BB72084430BE501, +902 }, // 1.0e+271 { 0x5EA4E8A553CEDE42, +905 }, // 1.0e+272 { 0x764E22CEA8C295D2, +908 }, // 1.0e+273 { 0x49F0D5C129799DA3, +912 }, // 1.0e+274 { 0x5C6D0B3173D8050C, +915 }, // 1.0e+275 { 0x73884DFDD0CE064F, +918 }, // 1.0e+276 { 0x483530BEA280C3F2, +922 }, // 1.0e+277 { 0x5A427CEE4B20F4EE, +925 }, // 1.0e+278 { 0x70D31C29DDE93229, +928 }, // 1.0e+279 { 0x4683F19A2AB1BF5A, +932 }, // 1.0e+280 { 0x5824EE00B55E2F30, +935 }, // 1.0e+281 { 0x6E2E2980E2B5BAFC, +938 }, // 1.0e+282 { 0x44DCD9F08DB194DE, +942 }, // 1.0e+283 { 0x5614106CB11DFA15, +945 }, // 1.0e+284 { 0x6B991487DD65789A, +948 }, // 1.0e+285 { 0x433FACD4EA5F6B61, +952 }, // 1.0e+286 { 0x540F980A24F74639, +955 }, // 1.0e+287 { 0x69137E0CAE3517C7, +958 }, // 1.0e+288 { 0x41AC2EC7ECE12EDC, +962 }, // 1.0e+289 { 0x52173A79E8197A93, +965 }, // 1.0e+290 { 0x669D0918621FD938, +968 }, // 1.0e+291 { 0x402225AF3D53E7C3, +972 }, // 1.0e+292 { 0x502AAF1B0CA8E1B4, +975 }, // 1.0e+293 { 0x64355AE1CFD31A21, +978 }, // 1.0e+294 { 0x7D42B19A43C7E0A9, +981 }, // 1.0e+295 { 0x4E49AF006A5CEC6A, +985 }, // 1.0e+296 { 0x61DC1AC084F42784, +988 }, // 1.0e+297 { 0x7A532170A6313165, +991 }, // 1.0e+298 { 0x4C73F4E667DEBEDF, +995 }, // 1.0e+299 { 0x5F90F22001D66E97, +998 }, // 1.0e+300 { 0x77752EA8024C0A3D, +1001 }, // 1.0e+301 { 0x4AA93D29016F8666, +1005 }, // 1.0e+302 { 0x5D538C7341CB67FF, +1008 }, // 1.0e+303 { 0x74A86F90123E41FF, +1011 }, // 1.0e+304 { 0x48E945BA0B66E940, +1015 }, // 1.0e+305 { 0x5B2397288E40A38F, +1018 }, // 1.0e+306 { 0x71EC7CF2B1D0CC73, +1021 }, // 1.0e+307 { 0x4733CE17AF227FC8, +1025 }, // 1.0e+308 }; static_assert(size(s_decmult_F) == 652, ""); template<typename floatT, typename storageT, int E, int M> double do_xldexp_I_generic(uint64_t ubits, int exp2) { static_assert(is_floating_point<floatT>::value, ""); static_assert(is_unsigned<storageT>::value, ""); static_assert(sizeof(floatT) == sizeof(storageT), ""); // Round ULP to even. constexpr uint64_t ulp_mask = UINT64_C(1) << (62 - M); constexpr uint64_t ulp_half = ulp_mask >> 1; ROCKET_ASSERT(ubits <= INT64_MAX); uint64_t bits = ubits; int sh = ROCKET_LZCNT64_NZ(ubits) - 1; bits <<= sh; uint64_t guard = bits & (ulp_mask - 1); bits &= ~(ulp_mask - 1); if((guard != ulp_half) ? (guard > ulp_half) : (bits & ulp_mask)) bits |= ulp_mask - 1; // On x86, conversion from `uint64_t` to `double` is very inefficient. // We make use of only 63 bits, so this can be optimized by casting the word // to `int64_t`, followed by conversion to the desired floating-point type. ROCKET_ASSERT(bits <= INT64_MAX); floatT freg = static_cast<floatT>(static_cast<int64_t>(bits)); // Extract the biased exponent and mantissa without the hidden bit. // This function requires `freg` to be normalized, finite and positive. constexpr int bexp_max = (1 << E) - 1; constexpr storageT mantissa_one = 1; storageT ireg; ::std::memcpy(&ireg, &freg, sizeof(floatT)); int bexp = static_cast<int>(ireg >> M) & bexp_max; ireg &= (mantissa_one << M) - 1; // Adjust the exponent. // This shall not cause overflows. bexp += exp2; bexp -= sh; // Check for overflows and underflows. if(bexp >= bexp_max) { ireg = 0; bexp = bexp_max; // infinity } else if(bexp <= -M) { ireg = 0; bexp = 0; // zero } else if(bexp <= 0) { ireg = mantissa_one << (M - 1 + bexp) | ireg >> (1 - bexp); bexp = 0; // denormal } // Compose the new value. ireg |= static_cast<storageT>(static_cast<unsigned>(bexp)) << M; ::std::memcpy(&freg, &ireg, sizeof(floatT)); return static_cast<double>(freg); } double do_xldexp_I(uint64_t ireg, int exp2, bool single) { return single ? do_xldexp_I_generic<float, uint32_t, 8, 23>(ireg, exp2) : do_xldexp_I_generic<double, uint64_t, 11, 52>(ireg, exp2); } } // namespace ascii_numget& ascii_numget:: parse_B(const char*& bptr, const char* eptr) { this->clear(); const char* rp = bptr; // Check for "0", "1", "false" or "true". bool value; if(rp == eptr) return *this; switch(rp[0]) { case '0': // Accept a "0". value = 0; rp += 1; break; case '1': // Accept a "1". value = 1; rp += 1; break; case 'f': // Check whether the string starts with "false". if(eptr - rp < 5) return *this; // Compare characters in a quadruple which might be optimized better. if(::std::memcmp(rp + 1, "false" + 1, 4) != 0) return *this; // Accept a "false". value = 0; rp += 5; break; case 't': // Check whether the string starts with "false". if(eptr - rp < 4) return *this; // Compare characters in a quadruple which might be optimized better. if(::std::memcmp(rp, "true", 4) != 0) return *this; // Accept a "true". value = 1; rp += 4; break; default: // The character could not be consumed. return *this; } // Set the value. this->m_base = 2; this->m_mant = value; // Report success and advance the read pointer. this->m_succ = true; bptr = rp; return *this; } ascii_numget& ascii_numget:: parse_P(const char*& bptr, const char* eptr) { this->clear(); const char* rp = bptr; // Check for the "0x" prefix, which is required. uint8_t base = do_get_base(rp, eptr, 0); if(base != 16) return *this; // Get the mantissa. mantissa m = { }; if(do_collect_U(m, rp, eptr, base, UINT64_MAX) == 0) return *this; if(m.ntrunc != 0) { // Set an infinity if not all significant figures could be collected. this->m_vcls = 2; // infinity } else { // Set the value. this->m_base = base; this->m_mant = m.value; } // Report success and advance the read pointer. this->m_succ = true; bptr = rp; return *this; } ascii_numget& ascii_numget:: parse_U(const char*& bptr, const char* eptr, uint8_t ibase) { this->clear(); const char* rp = bptr; // Check for the base prefix, which is optional. uint8_t base = do_get_base(rp, eptr, ibase); // Get the mantissa. mantissa m = { }; if(do_collect_U(m, rp, eptr, base, UINT64_MAX) == 0) return *this; if(m.ntrunc != 0) { // Set an infinity if not all significant figures could be collected. this->m_vcls = 2; // infinity } else { // Set the value. this->m_base = base; this->m_mant = m.value; } // Report success and advance the read pointer. this->m_succ = true; bptr = rp; return *this; } ascii_numget& ascii_numget:: parse_I(const char*& bptr, const char* eptr, uint8_t ibase) { this->clear(); const char* rp = bptr; // Check for the sign. bool sign = do_get_sign(rp, eptr); // Check for the base prefix, which is optional. uint8_t base = do_get_base(rp, eptr, ibase); // Get the mantissa. mantissa m = { }; if(do_collect_U(m, rp, eptr, base, UINT64_MAX) == 0) return *this; if(m.ntrunc != 0) { // Set an infinity if not all significant figures could be collected. this->m_vcls = 2; // infinity } else { // Set the value. this->m_base = base; this->m_mant = m.value; } this->m_sign = sign; // Report success and advance the read pointer. this->m_succ = true; bptr = rp; return *this; } ascii_numget& ascii_numget:: parse_F(const char*& bptr, const char* eptr, uint8_t ibase) { this->clear(); const char* rp = bptr; // Check for the sign. bool sign = do_get_sign(rp, eptr); // Check for "infinity". if((eptr - rp >= 8) && (::std::memcmp(rp, "infinity", 8) == 0)) { // Skip the string. rp += 8; // Set an infinity. this->m_vcls = 2; // infinity } else if((eptr - rp >= 3) && (::std::memcmp(rp, "nan", 3) == 0)) { // Skip the string. rp += 3; // Set a QNaN. this->m_vcls = 3; // quiet NaN } else { // Check for the base prefix, which is optional. uint8_t base = do_get_base(rp, eptr, ibase); // Get the mantissa. mantissa m = { }; if(do_collect_U(m, rp, eptr, base, UINT64_MAX) == 0) return *this; // Check for the radix point, which is optional. // If the radix point exists, the fractional part shall follow. size_t nfrac = 0; if((eptr - rp >= 1) && (rp[0] == '.')) { // Skip the radix point. rp += 1; // Get the fractional part, which is required. nfrac = do_collect_U(m, rp, eptr, base, UINT64_MAX); if(nfrac == 0) return *this; } // Initialize the exponent. int64_t expo = static_cast<ptrdiff_t>(m.ntrunc - nfrac); bool erdx = true; bool has_expo = false; // Check for the exponent. switch(base) { case 16: expo *= 4; // log2(16) // Fallthrough case 2: { erdx = false; // A binary exponent is expected. if((eptr - rp >= 1) && do_match_char_ci(rp[0], 'p')) { // Skip the exponent initiator. rp += 1; has_expo = true; } break; } case 10: { erdx = true; // A decimal exponent is expected. if((eptr - rp >= 1) && do_match_char_ci(rp[0], 'e')) { // Skip the exponent initiator. rp += 1; has_expo = true; } break; } } if(has_expo) { // Get the sign of the exponent, which is optional. bool esign = do_get_sign(rp, eptr); // Get the exponent. mantissa em = { }; if(do_collect_U(em, rp, eptr, 10, 999'999'999'999'999) == 0) return *this; // This shall not overflow. if(esign) expo -= static_cast<int64_t>(em.value); else expo += static_cast<int64_t>(em.value); } // Zero out the exponent if the mantissa is zero. if(m.value == 0) expo = 0; // Normalize the exponent. if(expo < -0x0FFF'FFFF) { // 28 bits // Set an infinitesimal if the exponent is too small. this->m_vcls = 1; // infinitesimal } else if(expo > +0x0FFF'FFFF) { // 28 bits // Set an infinity if the exponent is too large. this->m_vcls = 2; // infinity } else { // Set the value. this->m_erdx = erdx; this->m_madd = m.trailer; this->m_base = base; this->m_expo = static_cast<int32_t>(expo); this->m_mant = m.value; } } this->m_sign = sign; // Report success and advance the read pointer. this->m_succ = true; bptr = rp; return *this; } ascii_numget& ascii_numget:: cast_U(uint64_t& value, uint64_t lower, uint64_t upper) noexcept { this->m_stat = 0; switch(this->m_vcls) { case 0: { // finite uint64_t ireg = this->m_mant; if(ireg == 0) { // The value is effectively zero. value = 0; break; } if(this->m_sign) { // Negative values are always out of range. value = 0; // For unsigned integers this always overflows and is always inexact. this->m_ovfl = true; this->m_inxc = true; break; } // Get the base. uint8_t base = 2; if(this->m_erdx) base = this->m_base; // Raise the mantissa accordingly. if(this->m_expo > 0) { for(int32_t i = 0; i != this->m_expo; ++i) { uint64_t next = ireg * base; // TODO: Overflow checks can be performed using intrinsics. if(next / base != ireg) { ireg = UINT64_MAX; this->m_ovfl = true; break; } ireg = next; } } else { for(int32_t i = 0; i != this->m_expo; --i) { uint64_t next = ireg / base; // Set the inexact flag if a non-zero digit was shifted out. if(ireg % base != 0) this->m_inxc = true; // TODO: Overflow checks can be performed using intrinsics. if(next == 0) { ireg = 0; this->m_udfl = true; break; } ireg = next; } } // Set the inexact flag if some significant figures have been lost. if(this->m_madd) this->m_inxc = true; // Set the value. value = ireg; break; } case 1: { // infinitesimal // Truncate the value to zero. value = 0; // If the value is negative we still have to set the overflow flag. if(this->m_sign) this->m_ovfl = true; // For integers this always underflows and is always inexact. this->m_udfl = true; this->m_inxc = true; break; } case 2: { // infinity // Return the maximum value. value = numeric_limits<uint64_t>::max(); // For integers this always overflows and is always inexact. this->m_ovfl = true; this->m_inxc = true; break; } default: { // quiet NaN // Return zero. value = 0; // For integers this is always inexact. this->m_inxc = true; break; } } // Set the overflow flag if the value is out of range. if(value < lower) { value = lower; this->m_ovfl = true; } else if(value > upper) { value = upper; this->m_ovfl = true; } if(this->m_stat != 0) return *this; // Report success if no error occurred. this->m_succ = true; return *this; } ascii_numget& ascii_numget:: cast_I(int64_t& value, int64_t lower, int64_t upper) noexcept { this->m_stat = 0; switch(this->m_vcls) { case 0: { // finite uint64_t ireg = this->m_mant; if(ireg == 0) { // The value is effectively zero. value = 0; break; } // Get the base. uint8_t base = 2; if(this->m_erdx) base = this->m_base; // Raise the mantissa accordingly. if(this->m_expo > 0) { for(int32_t i = 0; i != this->m_expo; ++i) { uint64_t next = ireg * base; // TODO: Overflow checks can be performed using intrinsics. if(next / base != ireg) { ireg = UINT64_MAX; this->m_ovfl = true; break; } ireg = next; } } else { for(int32_t i = 0; i != this->m_expo; --i) { uint64_t next = ireg / base; // Set the inexact flag if a non-zero digit was shifted out. if(ireg % base != 0) this->m_inxc = true; // TODO: Overflow checks can be performed using intrinsics. if(next == 0) { ireg = 0; this->m_udfl = true; break; } ireg = next; } } // Set the inexact flag if some significant figures have been lost. if(this->m_madd) this->m_inxc = true; // Set the value. if(this->m_sign) { // The value is negative. constexpr uint64_t imax = 0x8000'0000'0000'0000; if(ireg > imax) { ireg = imax; this->m_ovfl = true; } value = static_cast<int64_t>(-ireg); } else { // The value is positive. constexpr uint64_t imax = 0x7FFF'FFFF'FFFF'FFFF; if(ireg > imax) { ireg = imax; this->m_ovfl = true; } value = static_cast<int64_t>(+ireg); } break; } case 1: { // infinitesimal // Truncate the value to zero. value = 0; // For integers this always underflows and is always inexact. this->m_udfl = true; this->m_inxc = true; break; } case 2: { // infinity // Return the maximum value. value = numeric_limits<int64_t>::max(); // For integers this always overflows and is always inexact. this->m_ovfl = true; this->m_inxc = true; break; } default: { // quiet NaN // Return zero. value = 0; // For integers this is always inexact. this->m_inxc = true; break; } } // Set the overflow flag if the value is out of range. if(value < lower) { value = lower; this->m_ovfl = true; } else if(value > upper) { value = upper; this->m_ovfl = true; } if(this->m_stat != 0) return *this; // Report success if no error occurred. this->m_succ = true; return *this; } ascii_numget& ascii_numget:: cast_F(double& value, double lower, double upper, bool single) noexcept { this->m_stat = 0; // Store the sign bit into a `double`. double sign = -(this->m_sign); // Try casting the value. switch(this->m_vcls) { case 0: { // finite uint64_t ireg = this->m_mant; if(ireg == 0) { // The value is effectively zero. value = ::std::copysign(0.0, sign); break; } // Get the base. uint8_t base = 2; if(this->m_erdx) base = this->m_base; // Raise the mantissa accordingly. double freg; switch(base) { case 2: { // Convert the mantissa to a floating-point number. The result is exact. if(ireg >> 62) { // Drop two bits from the right. ireg = (ireg >> 2) | (((ireg >> 1) | ireg) & 1) | this->m_madd; freg = do_xldexp_I(ireg, this->m_expo + 2, single); } else { // Shift overflowed digits into the right. ireg = (ireg << 1) | this->m_madd; freg = do_xldexp_I(ireg, this->m_expo - 1, single); } break; } case 10: { // Get the multiplier. uint32_t mpos = static_cast<uint32_t>(this->m_expo + 343); if(mpos >= INT32_MAX) { freg = 0; break; } if(mpos >= size(s_decmult_F)) { freg = HUGE_VAL; break; } const auto& mult = s_decmult_F[mpos]; // Adjust `ireg` such that its MSB is non-zero. int sh = ROCKET_LZCNT64_NZ(ireg); ireg |= this->m_madd; ireg <<= sh; int exp2 = mult.exp2 - sh; // Multiply two 64-bit values and get the high-order half. // TODO: Modern CPUs have intrinsics for this. uint64_t xhi = ireg >> 32; uint64_t xlo = ireg << 32 >> 32; uint64_t yhi = mult.mant >> 32; uint64_t ylo = mult.mant << 32 >> 32; ireg = xhi * yhi; ireg += ((xlo * yhi >> 30) + (xhi * ylo >> 30) + (xlo * ylo >> 62)) >> 2; // Convert the mantissa to a floating-point number. freg = do_xldexp_I(ireg, exp2, single); break; } default: ROCKET_ASSERT_MSG(false, "Non-decimal floating-point parsing not implemented"); } // Examine the value. Note that `ireg` is non-zero. // If the result becomes infinity, it must have overflowed. // If the result becomes zero, it must have underflowed. switch(::std::fpclassify(freg)) { case FP_INFINITE: this->m_ovfl = true; break; case FP_ZERO: this->m_udfl = true; break; } // Set the value. value = ::std::copysign(freg, sign); break; } case 1: { // infinitesimal value = ::std::copysign(0.0, sign); // For floating-point numbers this always underflows. this->m_udfl = true; break; } case 2: { // infinity value = ::std::copysign(numeric_limits<double>::infinity(), sign); break; } default: { // quiet NaN value = ::std::copysign(numeric_limits<double>::quiet_NaN(), sign); break; } } // Set the overflow flag if the value is out of range. // Watch out for NaNs. if(::std::isless(value, lower)) { value = lower; this->m_ovfl = true; } else if(::std::isgreater(value, upper)) { value = upper; this->m_ovfl = true; } if(this->m_stat != 0) return *this; // Report success if no error occurred. this->m_succ = true; return *this; } } // namespace rocket
34.585486
91
0.541201
[ "3d" ]
3e9c8b8a53ab52dd3994e376acd8d49ec6bce17f
9,169
cpp
C++
Plugins/org.mitk.core.services/src/internal/mitkPluginActivator.cpp
samsmu/MITK
c93dce6dc38d8f4c961de4440e4dd113b9841c8c
[ "BSD-3-Clause" ]
5
2015-02-05T10:58:41.000Z
2019-04-17T15:04:07.000Z
Plugins/org.mitk.core.services/src/internal/mitkPluginActivator.cpp
samsmu/MITK
c93dce6dc38d8f4c961de4440e4dd113b9841c8c
[ "BSD-3-Clause" ]
141
2015-03-03T06:52:01.000Z
2020-12-10T07:28:14.000Z
Plugins/org.mitk.core.services/src/internal/mitkPluginActivator.cpp
samsmu/MITK
c93dce6dc38d8f4c961de4440e4dd113b9841c8c
[ "BSD-3-Clause" ]
4
2015-02-19T06:48:13.000Z
2020-06-19T16:20:25.000Z
/*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #include "mitkPluginActivator.h" #include "mitkLog.h" #include <QString> #include <QFileInfo> #include "internal/mitkDataStorageService.h" #include <usModuleRegistry.h> #include <usModule.h> #include <usModuleContext.h> #include <mitkVtkLoggingAdapter.h> #include <mitkItkLoggingAdapter.h> #include <mitkDataNodePickingEventObserver.h> namespace mitk { class InterfaceMapToQObjectAdapter : public QObject { public: InterfaceMapToQObjectAdapter(const us::InterfaceMap& im) : interfaceMap(im) {} // This method is called by the Qt meta object system. It is usually // generated by the moc, but we create it manually to be able to return // a MITK micro service object (derived from itk::LightObject). It basically // works as if the micro service class had used the Q_INTERFACES macro in // its declaration. Now we can successfully do a // qobject_cast<mitk::SomeMicroServiceInterface>(lightObjectToQObjectAdapter) void* qt_metacast(const char *_clname) override { if (!_clname) return 0; if (!strcmp(_clname, "InterfaceMapToQObjectAdapter")) return static_cast<void*>(const_cast<InterfaceMapToQObjectAdapter*>(this)); us::InterfaceMap::const_iterator iter = interfaceMap.find(_clname); if (iter != interfaceMap.end()) return iter->second; return QObject::qt_metacast(_clname); } private: us::InterfaceMap interfaceMap; }; const std::string org_mitk_core_services_Activator::PLUGIN_ID = "org.mitk.core.services"; void org_mitk_core_services_Activator::start(ctkPluginContext* context) { pluginContext = context; //initialize logging mitk::LoggingBackend::Register(); QString logFilenamePrefix = "autoplan"; QFileInfo path = context->getDataFile(logFilenamePrefix); try { // FIXME // using local8bit, because ofstream is not unicode aware // to using utf-8 with ofstream need use lib "nowide.boots" mitk::LoggingBackend::RotateLogFiles(path.absoluteFilePath().toLocal8Bit().constData()); } catch(mitk::Exception& e) { MITK_ERROR << "Problem during logfile initialization: " << e.GetDescription() << " Caution: Logging to harddisc might be disabled!"; } mitk::VtkLoggingAdapter::Initialize(); mitk::ItkLoggingAdapter::Initialize(); //initialize data storage service dataStorageService.reset(new DataStorageService()); context->registerService<mitk::IDataStorageService>(dataStorageService.data()); // Get the MitkCore Module Context mitkContext = us::ModuleRegistry::GetModule(1)->GetModuleContext(); // Process all already registered services std::vector<us::ServiceReferenceU> refs = mitkContext->GetServiceReferences(""); for (std::vector<us::ServiceReferenceU>::const_iterator i = refs.begin(); i != refs.end(); ++i) { this->AddMitkService(*i); } dataNodePickingObserver.reset(new DataNodePickingEventObserver()); us::ServiceProperties pickingObserverServiceProperties; pickingObserverServiceProperties["name"] = std::string("DataNodePicker"); mitkContext->RegisterService(dataNodePickingObserver.get(), pickingObserverServiceProperties); mitkContext->AddServiceListener(this, &org_mitk_core_services_Activator::MitkServiceChanged); } void org_mitk_core_services_Activator::stop(ctkPluginContext* /*context*/) { mitkContext->RemoveServiceListener(this, &org_mitk_core_services_Activator::MitkServiceChanged); foreach(ctkServiceRegistration reg, mapMitkIdToRegistration.values()) { reg.unregister(); } mapMitkIdToRegistration.clear(); qDeleteAll(mapMitkIdToAdapter); mapMitkIdToAdapter.clear(); //clean up logging mitk::LoggingBackend::Unregister(); dataStorageService.reset(); mitkContext = 0; pluginContext = 0; } void org_mitk_core_services_Activator::MitkServiceChanged(const us::ServiceEvent event) { switch (event.GetType()) { case us::ServiceEvent::REGISTERED: { this->AddMitkService(event.GetServiceReference()); break; } case us::ServiceEvent::UNREGISTERING: { long mitkServiceId = us::any_cast<long>(event.GetServiceReference().GetProperty(us::ServiceConstants::SERVICE_ID())); ctkServiceRegistration reg = mapMitkIdToRegistration.take(mitkServiceId); if (reg) { reg.unregister(); } delete mapMitkIdToAdapter.take(mitkServiceId); break; } case us::ServiceEvent::MODIFIED: { long mitkServiceId = us::any_cast<long>(event.GetServiceReference().GetProperty(us::ServiceConstants::SERVICE_ID())); ctkDictionary newProps = CreateServiceProperties(event.GetServiceReference()); mapMitkIdToRegistration[mitkServiceId].setProperties(newProps); break; } default: break; // do nothing } } void org_mitk_core_services_Activator::AddMitkService(const us::ServiceReferenceU& ref) { // Get the MITK micro service object us::InterfaceMap mitkService = mitkContext->GetService(ref); if (mitkService.empty()) return; // Get the interface names against which the service was registered QStringList qclazzes; for(us::InterfaceMap::const_iterator clazz = mitkService.begin(); clazz != mitkService.end(); ++clazz) { qclazzes << QString::fromStdString(clazz->first); } long mitkServiceId = us::any_cast<long>(ref.GetProperty(us::ServiceConstants::SERVICE_ID())); QObject* adapter = new InterfaceMapToQObjectAdapter(mitkService); mapMitkIdToAdapter[mitkServiceId] = adapter; ctkDictionary props = CreateServiceProperties(ref); mapMitkIdToRegistration[mitkServiceId] = pluginContext->registerService(qclazzes, adapter, props); } ctkDictionary org_mitk_core_services_Activator::CreateServiceProperties(const us::ServiceReferenceU& ref) { ctkDictionary props; long mitkServiceId = us::any_cast<long>(ref.GetProperty(us::ServiceConstants::SERVICE_ID())); props.insert("mitk.serviceid", QVariant::fromValue(mitkServiceId)); // Add all other properties from the MITK micro service std::vector<std::string> keys; ref.GetPropertyKeys(keys); for (std::vector<std::string>::const_iterator it = keys.begin(); it != keys.end(); ++it) { QString key = QString::fromStdString(*it); us::Any value = ref.GetProperty(*it); // We cannot add any mitk::Any object, we need to query the type const std::type_info& objType = value.Type(); if (objType == typeid(std::string)) { props.insert(key, QString::fromStdString(us::ref_any_cast<std::string>(value))); } else if (objType == typeid(std::vector<std::string>)) { const std::vector<std::string>& list = us::ref_any_cast<std::vector<std::string> >(value); QStringList qlist; for (std::vector<std::string>::const_iterator str = list.begin(); str != list.end(); ++str) { qlist << QString::fromStdString(*str); } props.insert(key, qlist); } else if (objType == typeid(std::list<std::string>)) { const std::list<std::string>& list = us::ref_any_cast<std::list<std::string> >(value); QStringList qlist; for (std::list<std::string>::const_iterator str = list.begin(); str != list.end(); ++str) { qlist << QString::fromStdString(*str); } props.insert(key, qlist); } else if (objType == typeid(char)) { props.insert(key, QChar(us::ref_any_cast<char>(value))); } else if (objType == typeid(unsigned char)) { props.insert(key, QChar(us::ref_any_cast<unsigned char>(value))); } else if (objType == typeid(bool)) { props.insert(key, us::any_cast<bool>(value)); } else if (objType == typeid(short)) { props.insert(key, us::any_cast<short>(value)); } else if (objType == typeid(unsigned short)) { props.insert(key, us::any_cast<unsigned short>(value)); } else if (objType == typeid(int)) { props.insert(key, us::any_cast<int>(value)); } else if (objType == typeid(unsigned int)) { props.insert(key, us::any_cast<unsigned int>(value)); } else if (objType == typeid(float)) { props.insert(key, us::any_cast<float>(value)); } else if (objType == typeid(double)) { props.insert(key, us::any_cast<double>(value)); } else if (objType == typeid(long long int)) { props.insert(key, us::any_cast<long long int>(value)); } else if (objType == typeid(unsigned long long int)) { props.insert(key, us::any_cast<unsigned long long int>(value)); } } return props; } org_mitk_core_services_Activator::org_mitk_core_services_Activator() : mitkContext(0), pluginContext(0) { } org_mitk_core_services_Activator::~org_mitk_core_services_Activator() { } }
31.081356
138
0.697677
[ "object", "vector" ]
3ea0d74ff8b0111ccdef12e04faf04d95b10c941
731
cpp
C++
leetcode/0494_Target_Sum/result.cpp
theck17/notes
f32f0f4b8f821b1ed38d173ef0913efddd094b91
[ "MIT" ]
null
null
null
leetcode/0494_Target_Sum/result.cpp
theck17/notes
f32f0f4b8f821b1ed38d173ef0913efddd094b91
[ "MIT" ]
null
null
null
leetcode/0494_Target_Sum/result.cpp
theck17/notes
f32f0f4b8f821b1ed38d173ef0913efddd094b91
[ "MIT" ]
null
null
null
/** * Copyright (C) 2021 All rights reserved. * * FileName :result.cpp * Author :C.K * Email :theck17@163.com * DateTime :2021-12-20 18:47:24 * Description : */ class Solution { public: int findTargetSumWays(vector<int>& nums, int S) { int sum = 0; for (auto n : nums) sum += n; if ((sum + S) % 2 == 1 || S > sum || S < -sum) return 0; int newS = (sum + S) / 2; vector<int> dp(newS + 1, 0); dp[0] = 1; for (int i = 0; i < nums.size(); ++i) { for (int j = newS; j >= nums[i]; --j) { dp[j] += dp[j - nums[i]]; } } return dp[newS]; } }; int main(){ return 0; }
22.84375
64
0.430917
[ "vector" ]
3ea6a9a8c556f0d78e176f0549c052b0deb94bee
891
cc
C++
leetcode/101-200/113-path-sum-ii/113.cc
punkieL/proCon
7e994d67e5efdf7ac0b1bee5e0b19b317f07e8af
[ "MIT" ]
1
2015-10-06T16:27:42.000Z
2015-10-06T16:27:42.000Z
leetcode/101-200/113-path-sum-ii/113.cc
punkieL/proCon
7e994d67e5efdf7ac0b1bee5e0b19b317f07e8af
[ "MIT" ]
1
2016-03-02T16:18:11.000Z
2016-03-02T16:18:11.000Z
leetcode/101-200/113-path-sum-ii/113.cc
punkieL/proCon
7e994d67e5efdf7ac0b1bee5e0b19b317f07e8af
[ "MIT" ]
null
null
null
/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {} * }; */ class Solution { public: vector<vector<int>> pathSum(TreeNode* root, int sum) { std::vector<vector<int>> res; dfs(root, 0, sum, vector<int>(), res); return res; } void dfs(TreeNode* head, int count, int sum, vector<int> tmp, vector<vector<int>>& res ){ if(head == NULL){ return; } if(head->right == NULL && head->left == NULL){ tmp.push_back(head->val); if(count + head->val == sum) res.push_back(tmp); tmp.pop_back(); return; } tmp.push_back(head->val); dfs(head->right, count + head->val, sum, tmp, res); dfs(head->left, count + head->val, sum, tmp, res); tmp.pop_back(); } };
26.205882
92
0.546577
[ "vector" ]
3eb10fe37f71b891fa659ad57b506576a0e1ddd7
7,178
cpp
C++
openfpga/src/fpga_bitstream/build_io_mapping_info.cpp
avesus/OpenFPGA
c1dab2168655d41eb59d4923156dabd253ffbd3e
[ "MIT" ]
246
2020-12-03T08:49:29.000Z
2022-03-28T21:19:55.000Z
openfpga/src/fpga_bitstream/build_io_mapping_info.cpp
developeralgo8888/OpenFPGA
067f2eaaad03945896b9a7cc21cd9f361bf1546d
[ "MIT" ]
261
2020-12-03T00:23:54.000Z
2022-03-31T10:00:37.000Z
openfpga/src/fpga_bitstream/build_io_mapping_info.cpp
developeralgo8888/OpenFPGA
067f2eaaad03945896b9a7cc21cd9f361bf1546d
[ "MIT" ]
66
2020-12-12T09:05:53.000Z
2022-03-28T07:51:41.000Z
/******************************************************************** * This file includes functions that build io mapping information *******************************************************************/ #include <chrono> #include <ctime> #include <fstream> /* Headers from vtrutil library */ #include "vtr_assert.h" #include "vtr_log.h" #include "vtr_time.h" /* Headers from archopenfpga library */ #include "openfpga_naming.h" #include "module_manager_utils.h" #include "build_io_mapping_info.h" /* begin namespace openfpga */ namespace openfpga { /******************************************************************** * This function * - builds the net-to-I/O mapping * - identifies each I/O directionality * - return a database containing the above information * * TODO: This function duplicates codes from * function: print_verilog_testbench_connect_fpga_ios() in * source file: verilog_testbench_utils.cpp * Should consider how to merge the codes and share same builder function *******************************************************************/ IoMap build_fpga_io_mapping_info(const ModuleManager& module_manager, const ModuleId& top_module, const AtomContext& atom_ctx, const PlacementContext& place_ctx, const IoLocationMap& io_location_map, const VprNetlistAnnotation& netlist_annotation, const std::string& io_input_port_name_postfix, const std::string& io_output_port_name_postfix, const std::vector<std::string>& output_port_prefix_to_remove) { IoMap io_map; /* Only mappable i/o ports can be considered */ std::vector<ModulePortId> module_io_ports; for (const ModuleManager::e_module_port_type& module_io_port_type : MODULE_IO_PORT_TYPES) { for (const ModulePortId& gpio_port_id : module_manager.module_port_ids_by_type(top_module, module_io_port_type)) { /* Only care mappable I/O */ if (false == module_manager.port_is_mappable_io(top_module, gpio_port_id)) { continue; } module_io_ports.push_back(gpio_port_id); } } /* Type mapping between VPR block and Module port */ std::map<AtomBlockType, ModuleManager::e_module_port_type> atom_block_type_to_module_port_type; atom_block_type_to_module_port_type[AtomBlockType::INPAD] = ModuleManager::MODULE_GPIN_PORT; atom_block_type_to_module_port_type[AtomBlockType::OUTPAD] = ModuleManager::MODULE_GPOUT_PORT; /* Type mapping between VPR block and io mapping direction */ std::map<AtomBlockType, IoMap::e_direction> atom_block_type_to_io_map_direction; atom_block_type_to_io_map_direction[AtomBlockType::INPAD] = IoMap::IO_MAP_DIR_INPUT; atom_block_type_to_io_map_direction[AtomBlockType::OUTPAD] = IoMap::IO_MAP_DIR_OUTPUT; for (const AtomBlockId& atom_blk : atom_ctx.nlist.blocks()) { /* Bypass non-I/O atom blocks ! */ if ( (AtomBlockType::INPAD != atom_ctx.nlist.block_type(atom_blk)) && (AtomBlockType::OUTPAD != atom_ctx.nlist.block_type(atom_blk)) ) { continue; } /* If there is a GPIO port, use it directly * Otherwise, should find a GPIN for INPAD * or should find a GPOUT for OUTPAD */ std::pair<ModulePortId, size_t> mapped_module_io_info = std::make_pair(ModulePortId::INVALID(), -1); for (const ModulePortId& module_io_port_id : module_io_ports) { const BasicPort& module_io_port = module_manager.module_port(top_module, module_io_port_id); /* Find the index of the mapped GPIO in top-level FPGA fabric */ size_t temp_io_index = io_location_map.io_index(place_ctx.block_locs[atom_ctx.lookup.atom_clb(atom_blk)].loc.x, place_ctx.block_locs[atom_ctx.lookup.atom_clb(atom_blk)].loc.y, place_ctx.block_locs[atom_ctx.lookup.atom_clb(atom_blk)].loc.z, module_io_port.get_name()); /* Bypass invalid index (not mapped to this GPIO port) */ if (size_t(-1) == temp_io_index) { continue; } /* If the port is an GPIO port, just use it */ if (ModuleManager::MODULE_GPIO_PORT == module_manager.port_type(top_module, module_io_port_id)) { mapped_module_io_info = std::make_pair(module_io_port_id, temp_io_index); break; } /* If this is an INPAD, we can use an GPIN port (if available) */ if (atom_block_type_to_module_port_type[atom_ctx.nlist.block_type(atom_blk)] == module_manager.port_type(top_module, module_io_port_id)) { mapped_module_io_info = std::make_pair(module_io_port_id, temp_io_index); break; } } /* We must find a valid one */ VTR_ASSERT(true == module_manager.valid_module_port_id(top_module, mapped_module_io_info.first)); VTR_ASSERT(size_t(-1) != mapped_module_io_info.second); /* Ensure that IO index is in range */ BasicPort module_mapped_io_port = module_manager.module_port(top_module, mapped_module_io_info.first); size_t io_index = mapped_module_io_info.second; /* Set the port pin index */ VTR_ASSERT(io_index < module_mapped_io_port.get_width()); module_mapped_io_port.set_width(io_index, io_index); /* The block may be renamed as it contains special characters which violate Verilog syntax */ std::string block_name = atom_ctx.nlist.block_name(atom_blk); if (true == netlist_annotation.is_block_renamed(atom_blk)) { block_name = netlist_annotation.block_name(atom_blk); } /* Create the port for benchmark I/O, due to BLIF benchmark, each I/O always has a size of 1 * In addition, the input and output ports may have different postfix in naming * due to verification context! Here, we give full customization on naming */ BasicPort benchmark_io_port; if (AtomBlockType::INPAD == atom_ctx.nlist.block_type(atom_blk)) { benchmark_io_port.set_name(std::string(block_name + io_input_port_name_postfix)); benchmark_io_port.set_width(1); } else { VTR_ASSERT(AtomBlockType::OUTPAD == atom_ctx.nlist.block_type(atom_blk)); /* VPR may have added a prefix to the output ports, remove them here */ std::string output_block_name = block_name; for (const std::string& prefix_to_remove : output_port_prefix_to_remove) { if (!prefix_to_remove.empty()) { if (0 == output_block_name.find(prefix_to_remove)) { output_block_name.erase(0, prefix_to_remove.length()); break; } } } benchmark_io_port.set_name(std::string(output_block_name + io_output_port_name_postfix)); benchmark_io_port.set_width(1); } io_map.create_io_mapping(module_mapped_io_port, benchmark_io_port, atom_block_type_to_io_map_direction[atom_ctx.nlist.block_type(atom_blk)]); } return io_map; } } /* end namespace openfpga */
45.719745
144
0.655614
[ "vector" ]
3eb58595a7331e54bbd50e603431df314c2b44d0
18,373
cc
C++
src/ray/core_worker/core_worker_test.cc
alex-petrenko/ray
dfc94ce7bcd5d9d008822efdeec17c3f6bb9c606
[ "Apache-2.0" ]
null
null
null
src/ray/core_worker/core_worker_test.cc
alex-petrenko/ray
dfc94ce7bcd5d9d008822efdeec17c3f6bb9c606
[ "Apache-2.0" ]
null
null
null
src/ray/core_worker/core_worker_test.cc
alex-petrenko/ray
dfc94ce7bcd5d9d008822efdeec17c3f6bb9c606
[ "Apache-2.0" ]
null
null
null
#include <thread> #include "gmock/gmock.h" #include "gtest/gtest.h" #include "ray/common/buffer.h" #include "ray/core_worker/context.h" #include "ray/core_worker/core_worker.h" #include "ray/raylet/raylet_client.h" #include <boost/asio.hpp> #include <boost/asio/error.hpp> #include <boost/bind.hpp> #include "ray/thirdparty/hiredis/async.h" #include "ray/thirdparty/hiredis/hiredis.h" namespace ray { std::string store_executable; std::string raylet_executable; std::string mock_worker_executable; ray::ObjectID RandomObjectID() { return ObjectID::FromRandom(); } static void flushall_redis(void) { redisContext *context = redisConnect("127.0.0.1", 6379); freeReplyObject(redisCommand(context, "FLUSHALL")); freeReplyObject(redisCommand(context, "SET NumRedisShards 1")); freeReplyObject(redisCommand(context, "LPUSH RedisShards 127.0.0.1:6380")); redisFree(context); } class CoreWorkerTest : public ::testing::Test { public: CoreWorkerTest(int num_nodes) { // flush redis first. flushall_redis(); RAY_CHECK(num_nodes >= 0); if (num_nodes > 0) { raylet_socket_names_.resize(num_nodes); raylet_store_socket_names_.resize(num_nodes); } // start plasma store. for (auto &store_socket : raylet_store_socket_names_) { store_socket = StartStore(); } // start raylet on each node. Assign each node with different resources so that // a task can be scheduled to the desired node. for (int i = 0; i < num_nodes; i++) { raylet_socket_names_[i] = StartRaylet(raylet_store_socket_names_[i], "127.0.0.1", "127.0.0.1", "\"CPU,4.0,resource" + std::to_string(i) + ",10\""); } } ~CoreWorkerTest() { for (const auto &raylet_socket : raylet_socket_names_) { StopRaylet(raylet_socket); } for (const auto &store_socket : raylet_store_socket_names_) { StopStore(store_socket); } } std::string StartStore() { std::string store_socket_name = "/tmp/store" + RandomObjectID().Hex(); std::string store_pid = store_socket_name + ".pid"; std::string plasma_command = store_executable + " -m 10000000 -s " + store_socket_name + " 1> /dev/null 2> /dev/null & echo $! > " + store_pid; RAY_LOG(DEBUG) << plasma_command; RAY_CHECK(system(plasma_command.c_str()) == 0); usleep(200 * 1000); return store_socket_name; } void StopStore(std::string store_socket_name) { std::string store_pid = store_socket_name + ".pid"; std::string kill_9 = "kill -9 `cat " + store_pid + "`"; RAY_LOG(DEBUG) << kill_9; ASSERT_TRUE(system(kill_9.c_str()) == 0); ASSERT_TRUE(system(("rm -rf " + store_socket_name).c_str()) == 0); ASSERT_TRUE(system(("rm -rf " + store_socket_name + ".pid").c_str()) == 0); } std::string StartRaylet(std::string store_socket_name, std::string node_ip_address, std::string redis_address, std::string resource) { std::string raylet_socket_name = "/tmp/raylet" + RandomObjectID().Hex(); std::string ray_start_cmd = raylet_executable; ray_start_cmd.append(" --raylet_socket_name=" + raylet_socket_name) .append(" --store_socket_name=" + store_socket_name) .append(" --object_manager_port=0 --node_manager_port=0") .append(" --node_ip_address=" + node_ip_address) .append(" --redis_address=" + redis_address) .append(" --redis_port=6379") .append(" --num_initial_workers=1") .append(" --maximum_startup_concurrency=10") .append(" --static_resource_list=" + resource) .append(" --python_worker_command=\"" + mock_worker_executable + " " + store_socket_name + " " + raylet_socket_name + "\"") .append(" & echo $! > " + raylet_socket_name + ".pid"); RAY_LOG(DEBUG) << "Ray Start command: " << ray_start_cmd; RAY_CHECK(system(ray_start_cmd.c_str()) == 0); usleep(200 * 1000); return raylet_socket_name; } void StopRaylet(std::string raylet_socket_name) { std::string raylet_pid = raylet_socket_name + ".pid"; std::string kill_9 = "kill -9 `cat " + raylet_pid + "`"; RAY_LOG(DEBUG) << kill_9; ASSERT_TRUE(system(kill_9.c_str()) == 0); ASSERT_TRUE(system(("rm -rf " + raylet_socket_name).c_str()) == 0); ASSERT_TRUE(system(("rm -rf " + raylet_socket_name + ".pid").c_str()) == 0); } void SetUp() {} void TearDown() {} void TestNormalTask(const std::unordered_map<std::string, double> &resources) { CoreWorker driver(WorkerType::DRIVER, Language::PYTHON, raylet_store_socket_names_[0], raylet_socket_names_[0], JobID::FromRandom()); // Test pass by value. { uint8_t array1[] = {1, 2, 3, 4, 5, 6, 7, 8}; auto buffer1 = std::make_shared<LocalMemoryBuffer>(array1, sizeof(array1)); RayFunction func{Language::PYTHON, {}}; std::vector<TaskArg> args; args.emplace_back(TaskArg::PassByValue(buffer1)); TaskOptions options; std::vector<ObjectID> return_ids; RAY_CHECK_OK(driver.Tasks().SubmitTask(func, args, options, &return_ids)); ASSERT_EQ(return_ids.size(), 1); std::vector<std::shared_ptr<ray::RayObject>> results; RAY_CHECK_OK(driver.Objects().Get(return_ids, -1, &results)); ASSERT_EQ(results.size(), 1); ASSERT_EQ(results[0]->GetData()->Size(), buffer1->Size()); ASSERT_EQ(memcmp(results[0]->GetData()->Data(), buffer1->Data(), buffer1->Size()), 0); } // Test pass by reference. { uint8_t array1[] = {10, 11, 12, 13, 14, 15}; auto buffer1 = std::make_shared<LocalMemoryBuffer>(array1, sizeof(array1)); ObjectID object_id; RAY_CHECK_OK(driver.Objects().Put(RayObject(buffer1, nullptr), &object_id)); std::vector<TaskArg> args; args.emplace_back(TaskArg::PassByReference(object_id)); RayFunction func{Language::PYTHON, {}}; TaskOptions options; std::vector<ObjectID> return_ids; RAY_CHECK_OK(driver.Tasks().SubmitTask(func, args, options, &return_ids)); ASSERT_EQ(return_ids.size(), 1); std::vector<std::shared_ptr<ray::RayObject>> results; RAY_CHECK_OK(driver.Objects().Get(return_ids, -1, &results)); ASSERT_EQ(results.size(), 1); ASSERT_EQ(results[0]->GetData()->Size(), buffer1->Size()); ASSERT_EQ(memcmp(results[0]->GetData()->Data(), buffer1->Data(), buffer1->Size()), 0); } } void TestActorTask(const std::unordered_map<std::string, double> &resources) { CoreWorker driver(WorkerType::DRIVER, Language::PYTHON, raylet_store_socket_names_[0], raylet_socket_names_[0], JobID::FromRandom()); std::unique_ptr<ActorHandle> actor_handle; // Test creating actor. { uint8_t array[] = {1, 2, 3}; auto buffer = std::make_shared<LocalMemoryBuffer>(array, sizeof(array)); RayFunction func{Language::PYTHON, {}}; std::vector<TaskArg> args; args.emplace_back(TaskArg::PassByValue(buffer)); ActorCreationOptions actor_options{0, resources}; // Create an actor. RAY_CHECK_OK(driver.Tasks().CreateActor(func, args, actor_options, &actor_handle)); } // Test submitting a task for that actor. { uint8_t array1[] = {1, 2, 3, 4, 5, 6, 7, 8}; uint8_t array2[] = {10, 11, 12, 13, 14, 15}; auto buffer1 = std::make_shared<LocalMemoryBuffer>(array1, sizeof(array1)); auto buffer2 = std::make_shared<LocalMemoryBuffer>(array2, sizeof(array2)); ObjectID object_id; RAY_CHECK_OK(driver.Objects().Put(RayObject(buffer1, nullptr), &object_id)); // Create arguments with PassByRef and PassByValue. std::vector<TaskArg> args; args.emplace_back(TaskArg::PassByReference(object_id)); args.emplace_back(TaskArg::PassByValue(buffer2)); TaskOptions options{1, resources}; std::vector<ObjectID> return_ids; RayFunction func{Language::PYTHON, {}}; RAY_CHECK_OK(driver.Tasks().SubmitActorTask(*actor_handle, func, args, options, &return_ids)); RAY_CHECK(return_ids.size() == 1); std::vector<std::shared_ptr<ray::RayObject>> results; RAY_CHECK_OK(driver.Objects().Get(return_ids, -1, &results)); ASSERT_EQ(results.size(), 1); ASSERT_EQ(results[0]->GetData()->Size(), buffer1->Size() + buffer2->Size()); ASSERT_EQ(memcmp(results[0]->GetData()->Data(), buffer1->Data(), buffer1->Size()), 0); ASSERT_EQ(memcmp(results[0]->GetData()->Data() + buffer1->Size(), buffer2->Data(), buffer2->Size()), 0); } } protected: std::vector<std::string> raylet_socket_names_; std::vector<std::string> raylet_store_socket_names_; }; class ZeroNodeTest : public CoreWorkerTest { public: ZeroNodeTest() : CoreWorkerTest(0) {} }; class SingleNodeTest : public CoreWorkerTest { public: SingleNodeTest() : CoreWorkerTest(1) {} }; class TwoNodeTest : public CoreWorkerTest { public: TwoNodeTest() : CoreWorkerTest(2) {} }; TEST_F(ZeroNodeTest, TestTaskArg) { // Test by-reference argument. ObjectID id = ObjectID::FromRandom(); TaskArg by_ref = TaskArg::PassByReference(id); ASSERT_TRUE(by_ref.IsPassedByReference()); ASSERT_EQ(by_ref.GetReference(), id); // Test by-value argument. std::shared_ptr<LocalMemoryBuffer> buffer = std::make_shared<LocalMemoryBuffer>(static_cast<uint8_t *>(0), 0); TaskArg by_value = TaskArg::PassByValue(buffer); ASSERT_FALSE(by_value.IsPassedByReference()); auto data = by_value.GetValue(); ASSERT_TRUE(data != nullptr); ASSERT_EQ(*data, *buffer); } TEST_F(ZeroNodeTest, TestWorkerContext) { auto job_id = JobID::FromRandom(); WorkerContext context(WorkerType::WORKER, job_id); ASSERT_TRUE(context.GetCurrentTaskID().IsNil()); ASSERT_EQ(context.GetNextTaskIndex(), 1); ASSERT_EQ(context.GetNextTaskIndex(), 2); ASSERT_EQ(context.GetNextPutIndex(), 1); ASSERT_EQ(context.GetNextPutIndex(), 2); auto thread_func = [&context]() { // Verify that task_index, put_index are thread-local. ASSERT_TRUE(!context.GetCurrentTaskID().IsNil()); ASSERT_EQ(context.GetNextTaskIndex(), 1); ASSERT_EQ(context.GetNextPutIndex(), 1); }; std::thread async_thread(thread_func); async_thread.join(); // Verify that these fields are thread-local. ASSERT_EQ(context.GetNextTaskIndex(), 3); ASSERT_EQ(context.GetNextPutIndex(), 3); } TEST_F(ZeroNodeTest, TestActorHandle) { ActorHandle handle1(ActorID::FromRandom(), ActorHandleID::FromRandom(), Language::JAVA, {"org.ray.exampleClass", "exampleMethod", "exampleSignature"}); auto forkedHandle1 = handle1.Fork(); ASSERT_EQ(1, handle1.NumForks()); ASSERT_EQ(handle1.ActorID(), forkedHandle1.ActorID()); ASSERT_NE(handle1.ActorHandleID(), forkedHandle1.ActorHandleID()); ASSERT_EQ(handle1.ActorLanguage(), forkedHandle1.ActorLanguage()); ASSERT_EQ(handle1.ActorCreationTaskFunctionDescriptor(), forkedHandle1.ActorCreationTaskFunctionDescriptor()); ASSERT_EQ(handle1.ActorCursor(), forkedHandle1.ActorCursor()); ASSERT_EQ(0, forkedHandle1.TaskCounter()); ASSERT_EQ(0, forkedHandle1.NumForks()); auto forkedHandle2 = handle1.Fork(); ASSERT_EQ(2, handle1.NumForks()); ASSERT_EQ(0, forkedHandle2.TaskCounter()); ASSERT_EQ(0, forkedHandle2.NumForks()); std::string buffer; handle1.Serialize(&buffer); auto handle2 = ActorHandle::Deserialize(buffer); ASSERT_EQ(handle1.ActorID(), handle2.ActorID()); ASSERT_EQ(handle1.ActorHandleID(), handle2.ActorHandleID()); ASSERT_EQ(handle1.ActorLanguage(), handle2.ActorLanguage()); ASSERT_EQ(handle1.ActorCreationTaskFunctionDescriptor(), handle2.ActorCreationTaskFunctionDescriptor()); ASSERT_EQ(handle1.ActorCursor(), handle2.ActorCursor()); ASSERT_EQ(handle1.TaskCounter(), handle2.TaskCounter()); ASSERT_EQ(handle1.NumForks(), handle2.NumForks()); } TEST_F(SingleNodeTest, TestObjectInterface) { CoreWorker core_worker(WorkerType::DRIVER, Language::PYTHON, raylet_store_socket_names_[0], raylet_socket_names_[0], JobID::FromRandom()); uint8_t array1[] = {1, 2, 3, 4, 5, 6, 7, 8}; uint8_t array2[] = {10, 11, 12, 13, 14, 15}; std::vector<RayObject> buffers; buffers.emplace_back(std::make_shared<LocalMemoryBuffer>(array1, sizeof(array1)), std::make_shared<LocalMemoryBuffer>(array1, sizeof(array1) / 2)); buffers.emplace_back(std::make_shared<LocalMemoryBuffer>(array2, sizeof(array2)), std::make_shared<LocalMemoryBuffer>(array2, sizeof(array2) / 2)); std::vector<ObjectID> ids(buffers.size()); for (size_t i = 0; i < ids.size(); i++) { RAY_CHECK_OK(core_worker.Objects().Put(buffers[i], &ids[i])); } // Test Get(). std::vector<std::shared_ptr<RayObject>> results; RAY_CHECK_OK(core_worker.Objects().Get(ids, -1, &results)); ASSERT_EQ(results.size(), 2); for (size_t i = 0; i < ids.size(); i++) { ASSERT_EQ(results[i]->GetData()->Size(), buffers[i].GetData()->Size()); ASSERT_EQ(memcmp(results[i]->GetData()->Data(), buffers[i].GetData()->Data(), buffers[i].GetData()->Size()), 0); ASSERT_EQ(results[i]->GetMetadata()->Size(), buffers[i].GetMetadata()->Size()); ASSERT_EQ(memcmp(results[i]->GetMetadata()->Data(), buffers[i].GetMetadata()->Data(), buffers[i].GetMetadata()->Size()), 0); } // Test Wait(). ObjectID non_existent_id = ObjectID::FromRandom(); std::vector<ObjectID> all_ids(ids); all_ids.push_back(non_existent_id); std::vector<bool> wait_results; RAY_CHECK_OK(core_worker.Objects().Wait(all_ids, 2, -1, &wait_results)); ASSERT_EQ(wait_results.size(), 3); ASSERT_EQ(wait_results, std::vector<bool>({true, true, false})); RAY_CHECK_OK(core_worker.Objects().Wait(all_ids, 3, 100, &wait_results)); ASSERT_EQ(wait_results.size(), 3); ASSERT_EQ(wait_results, std::vector<bool>({true, true, false})); // Test Delete(). // clear the reference held by PlasmaBuffer. results.clear(); RAY_CHECK_OK(core_worker.Objects().Delete(ids, true, false)); // Note that Delete() calls RayletClient::FreeObjects and would not // wait for objects being deleted, so wait a while for plasma store // to process the command. usleep(200 * 1000); RAY_CHECK_OK(core_worker.Objects().Get(ids, 0, &results)); ASSERT_EQ(results.size(), 2); ASSERT_TRUE(!results[0]); ASSERT_TRUE(!results[1]); } TEST_F(TwoNodeTest, TestObjectInterfaceCrossNodes) { CoreWorker worker1(WorkerType::DRIVER, Language::PYTHON, raylet_store_socket_names_[0], raylet_socket_names_[0], JobID::FromRandom()); CoreWorker worker2(WorkerType::DRIVER, Language::PYTHON, raylet_store_socket_names_[1], raylet_socket_names_[1], JobID::FromRandom()); uint8_t array1[] = {1, 2, 3, 4, 5, 6, 7, 8}; uint8_t array2[] = {10, 11, 12, 13, 14, 15}; std::vector<LocalMemoryBuffer> buffers; buffers.emplace_back(array1, sizeof(array1)); buffers.emplace_back(array2, sizeof(array2)); std::vector<ObjectID> ids(buffers.size()); for (size_t i = 0; i < ids.size(); i++) { RAY_CHECK_OK(worker1.Objects().Put( RayObject(std::make_shared<LocalMemoryBuffer>(buffers[i]), nullptr), &ids[i])); } // Test Get() from remote node. std::vector<std::shared_ptr<RayObject>> results; RAY_CHECK_OK(worker2.Objects().Get(ids, -1, &results)); ASSERT_EQ(results.size(), 2); for (size_t i = 0; i < ids.size(); i++) { ASSERT_EQ(results[i]->GetData()->Size(), buffers[i].Size()); ASSERT_EQ(memcmp(results[i]->GetData()->Data(), buffers[i].Data(), buffers[i].Size()), 0); } // Test Wait() from remote node. ObjectID non_existent_id = ObjectID::FromRandom(); std::vector<ObjectID> all_ids(ids); all_ids.push_back(non_existent_id); std::vector<bool> wait_results; RAY_CHECK_OK(worker2.Objects().Wait(all_ids, 2, -1, &wait_results)); ASSERT_EQ(wait_results.size(), 3); ASSERT_EQ(wait_results, std::vector<bool>({true, true, false})); RAY_CHECK_OK(worker2.Objects().Wait(all_ids, 3, 100, &wait_results)); ASSERT_EQ(wait_results.size(), 3); ASSERT_EQ(wait_results, std::vector<bool>({true, true, false})); // Test Delete() from all machines. // clear the reference held by PlasmaBuffer. results.clear(); RAY_CHECK_OK(worker2.Objects().Delete(ids, false, false)); // Note that Delete() calls RayletClient::FreeObjects and would not // wait for objects being deleted, so wait a while for plasma store // to process the command. usleep(1000 * 1000); // Verify objects are deleted from both machines. RAY_CHECK_OK(worker2.Objects().Get(ids, 0, &results)); ASSERT_EQ(results.size(), 2); ASSERT_TRUE(!results[0]); ASSERT_TRUE(!results[1]); RAY_CHECK_OK(worker1.Objects().Get(ids, 0, &results)); ASSERT_EQ(results.size(), 2); ASSERT_TRUE(!results[0]); ASSERT_TRUE(!results[1]); } TEST_F(SingleNodeTest, TestNormalTaskLocal) { std::unordered_map<std::string, double> resources; TestNormalTask(resources); } TEST_F(TwoNodeTest, TestNormalTaskCrossNodes) { std::unordered_map<std::string, double> resources; resources.emplace("resource1", 1); TestNormalTask(resources); } TEST_F(SingleNodeTest, TestActorTaskLocal) { std::unordered_map<std::string, double> resources; TestActorTask(resources); } TEST_F(TwoNodeTest, TestActorTaskCrossNodes) { std::unordered_map<std::string, double> resources; resources.emplace("resource1", 1); TestActorTask(resources); } TEST_F(SingleNodeTest, TestCoreWorkerConstructorFailure) { try { CoreWorker core_worker(WorkerType::DRIVER, Language::PYTHON, "", raylet_socket_names_[0], JobID::FromRandom()); } catch (const std::exception &e) { std::cout << "Caught exception when constructing core worker: " << e.what(); } } } // namespace ray int main(int argc, char **argv) { ::testing::InitGoogleTest(&argc, argv); RAY_CHECK(argc == 4); ray::store_executable = std::string(argv[1]); ray::raylet_executable = std::string(argv[2]); ray::mock_worker_executable = std::string(argv[3]); return RUN_ALL_TESTS(); }
36.310277
90
0.668807
[ "vector" ]
3eba2ad007b06a57909e5e35507ca65ffe5e6265
4,967
cc
C++
CondTools/SiPixel/plugins/SiPixelCalibConfigurationReadDb.cc
malbouis/cmssw
16173a30d3f0c9ecc5419c474bb4d272c58b65c8
[ "Apache-2.0" ]
852
2015-01-11T21:03:51.000Z
2022-03-25T21:14:00.000Z
CondTools/SiPixel/plugins/SiPixelCalibConfigurationReadDb.cc
gartung/cmssw
3072dde3ce94dcd1791d778988198a44cde02162
[ "Apache-2.0" ]
30,371
2015-01-02T00:14:40.000Z
2022-03-31T23:26:05.000Z
CondTools/SiPixel/plugins/SiPixelCalibConfigurationReadDb.cc
gartung/cmssw
3072dde3ce94dcd1791d778988198a44cde02162
[ "Apache-2.0" ]
3,240
2015-01-02T05:53:18.000Z
2022-03-31T17:24:21.000Z
// -*- C++ -*- // // Package: SiPixelCalibConfigurationReadDb // Class: SiPixelCalibConfigurationReadDb // /**\class SiPixelCalibConfigurationReadDb SiPixelCalibConfigurationReadDb.cc CalibTracker/SiPixelTools/plugins/SiPixelCalibConfigurationReadDb.cc Description: <one line class summary> Implementation: <Notes on implementation> */ // // Original Author: Freya Blekman // Created: Thu Sep 20 12:13:20 CEST 2007 // $Id: SiPixelCalibConfigurationReadDb.cc,v 1.2 2009/02/10 09:27:50 fblekman Exp $ // // // system include files #include <memory> // user include files #include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "CondFormats/SiPixelObjects/interface/SiPixelCalibConfiguration.h" #include "FWCore/Framework/interface/ESHandle.h" #include "CondFormats/DataRecord/interface/SiPixelCalibConfigurationRcd.h" #include <iostream> // // class decleration // class SiPixelCalibConfigurationReadDb : public edm::one::EDAnalyzer<> { public: explicit SiPixelCalibConfigurationReadDb(const edm::ParameterSet&); ~SiPixelCalibConfigurationReadDb() override; private: const edm::ESGetToken<SiPixelCalibConfiguration, SiPixelCalibConfigurationRcd> calibConfigToken; void analyze(const edm::Event&, const edm::EventSetup&) override; // ----------member data --------------------------- bool verbose_; }; // // constants, enums and typedefs // // // static data member definitions // // // constructors and destructor // SiPixelCalibConfigurationReadDb::SiPixelCalibConfigurationReadDb(const edm::ParameterSet& iConfig) : calibConfigToken(esConsumes()), verbose_(iConfig.getParameter<bool>("verbosity")) { //now do what ever initialization is needed } SiPixelCalibConfigurationReadDb::~SiPixelCalibConfigurationReadDb() = default; // // member functions // // ------------ method called to for each event ------------ void SiPixelCalibConfigurationReadDb::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { using namespace edm; LogInfo("") << " examining SiPixelCalibConfiguration database object..." << std::endl; const SiPixelCalibConfiguration* calib = &iSetup.getData(calibConfigToken); edm::LogPrint("SiPixelCalibConfigurationReadDb") << "calibration type: " << calib->getCalibrationMode() << std::endl; edm::LogPrint("SiPixelCalibConfigurationReadDb") << "number of triggers: " << calib->getNTriggers() << std::endl; std::vector<short> vcalvalues = calib->getVCalValues(); edm::LogPrint("SiPixelCalibConfigurationReadDb") << "number of VCAL: " << vcalvalues.size() << std::endl; int ngoodcols = 0; int ngoodrows = 0; for (uint32_t i = 0; i < vcalvalues.size(); ++i) { if (verbose_) { edm::LogPrint("SiPixelCalibConfigurationReadDb") << "Vcal values " << i << "," << i + 1 << " : " << vcalvalues[i] << ","; } ++i; if (verbose_) { if (i < vcalvalues.size()) edm::LogPrint("SiPixelCalibConfigurationReadDb") << vcalvalues[i]; edm::LogPrint("SiPixelCalibConfigurationReadDb") << std::endl; } } if (verbose_) edm::LogPrint("SiPixelCalibConfigurationReadDb") << "column patterns:" << std::endl; for (uint32_t i = 0; i < calib->getColumnPattern().size(); ++i) { if (calib->getColumnPattern()[i] != -1) { if (verbose_) edm::LogPrint("SiPixelCalibConfigurationReadDb") << calib->getColumnPattern()[i]; ngoodcols++; } if (verbose_) { if (i != 0) edm::LogPrint("SiPixelCalibConfigurationReadDb") << " "; if (calib->getColumnPattern()[i] == -1) edm::LogPrint("SiPixelCalibConfigurationReadDb") << "- "; } } if (verbose_) { edm::LogPrint("SiPixelCalibConfigurationReadDb") << std::endl; edm::LogPrint("SiPixelCalibConfigurationReadDb") << "row patterns:" << std::endl; } for (uint32_t i = 0; i < calib->getRowPattern().size(); ++i) { if (calib->getRowPattern()[i] != -1) { if (verbose_) edm::LogPrint("SiPixelCalibConfigurationReadDb") << calib->getRowPattern()[i]; ngoodrows++; } if (verbose_) { if (i != 0) edm::LogPrint("SiPixelCalibConfigurationReadDb") << " "; if (calib->getRowPattern()[i] == -1) edm::LogPrint("SiPixelCalibConfigurationReadDb") << "- "; } } if (verbose_) { edm::LogPrint("SiPixelCalibConfigurationReadDb") << std::endl; edm::LogPrint("SiPixelCalibConfigurationReadDb") << "number of row patterns: " << ngoodrows << std::endl; edm::LogPrint("SiPixelCalibConfigurationReadDb") << "number of column patterns: " << ngoodcols << std::endl; } edm::LogPrint("SiPixelCalibConfigurationReadDb") << "this payload is designed to run on " << vcalvalues.size() * ngoodcols * ngoodrows * calib->getNTriggers() << " events." << std::endl; } //define this as a plug-in DEFINE_FWK_MODULE(SiPixelCalibConfigurationReadDb);
35.22695
145
0.682303
[ "object", "vector" ]
3ebdf8de6e72bf5d9c73f1d37dfbfe6711928153
4,235
hpp
C++
src/tools/SurfaceIntersection.hpp
JanWehrmann/slam-maps
c03117e9d66ec312723ad700baabc0af04f36d70
[ "BSD-2-Clause" ]
15
2016-05-20T05:21:45.000Z
2021-07-21T02:34:18.000Z
src/tools/SurfaceIntersection.hpp
JanWehrmann/slam-maps
c03117e9d66ec312723ad700baabc0af04f36d70
[ "BSD-2-Clause" ]
19
2016-06-22T18:43:36.000Z
2021-09-28T15:20:31.000Z
src/tools/SurfaceIntersection.hpp
JanWehrmann/slam-maps
c03117e9d66ec312723ad700baabc0af04f36d70
[ "BSD-2-Clause" ]
12
2017-03-10T10:19:46.000Z
2021-06-04T05:50:10.000Z
// // Copyright (c) 2015-2017, Deutsches Forschungszentrum für Künstliche Intelligenz GmbH. // Copyright (c) 2015-2017, University of Bremen // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are met: // // * Redistributions of source code must retain the above copyright notice, this // list of conditions and the following disclaimer. // // * Redistributions in binary form must reproduce the above copyright notice, // this list of conditions and the following disclaimer in the documentation // and/or other materials provided with the distribution. // // 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. // #pragma once #include <stdlib.h> #include <Eigen/Core> #include <Eigen/Geometry> #include <Eigen/StdVector> namespace maps { namespace tools { class SurfaceIntersection { public: /** * Computes the intersection points between a plane and an axis aligned box. * Note: This method doesn't check if the plane intersects with the box. * Note: The intersection points are appended to the vector, i.e., the caller must make sure it is empty. */ template<class Scalar, int MatrixOptions, class Allocator> static void computeIntersections(const Eigen::Hyperplane<Scalar, 3>& plane, const Eigen::AlignedBox<Scalar, 3>& box, std::vector< Eigen::Matrix<Scalar, 3, 1, MatrixOptions>, Allocator >& intersections) { typedef Eigen::Matrix<Scalar, 3, 1, MatrixOptions> Vec; Vec normal = plane.normal(); Vec box_center = box.center(); Vec extents = box.max() - box_center; const Scalar dist = -plane.signedDistance(box_center); // find the max coefficient of the normal: int i=0, j=1, k=2; if(std::abs(normal[i]) < std::abs(normal[j])) std::swap(i,j); if(std::abs(normal[i]) < std::abs(normal[k])) std::swap(i,k); const Scalar dotj = extents[j] * normal[j]; const Scalar dotk = extents[k] * normal[k]; Vec prev_p; enum { NONE, LOW, BOX, HIGH } prev_pos = NONE, pos; // calculate intersections in direction i: for(int n=0; n<5; ++n) { Vec p(0,0,0); Scalar dotp = Scalar(0.0); if((n+1)&2) dotp += dotj, p[j] = extents[j]; else dotp -= dotj, p[j] = -extents[j]; if(n&2) dotp += dotk, p[k] = extents[k]; else dotp -= dotk, p[k] = -extents[k]; p[i] = (dist - dotp) / normal[i]; if( p[i] < -extents[i]) pos = LOW; else if( p[i] > extents[i]) pos = HIGH; else pos = BOX; if( (prev_pos == LOW || prev_pos == HIGH) && pos != prev_pos ) { // clipping in const Scalar h = prev_pos == LOW ? -extents[i] : extents[i]; const Scalar s = (h - prev_p[i]) / (p[i] - prev_p[i]); intersections.push_back(box_center + prev_p + (p - prev_p) * s); } if( pos == BOX ) { if( n==4 ) break; // n==4 is only for clipping in intersections.push_back(box_center + p); } else if( pos != prev_pos && prev_pos != NONE ) { // clipping out const Scalar h = pos == LOW ? -extents[i] : extents[i]; const Scalar s = (h - prev_p[i]) / (p[i] - prev_p[i]); intersections.push_back(box_center + prev_p + (p - prev_p) * s); } prev_pos = pos; prev_p = p; } } }; }}
36.826087
116
0.629988
[ "geometry", "vector" ]
3ebe4fb848adbc32b4f248342948447fa5bf046b
2,775
hpp
C++
src/ProcessingUnits/SoundChannel/NoiseChannel.hpp
Gegel85/GBEmulator
9899223d63d08bf77848c89a14f69221722adcc7
[ "MIT" ]
null
null
null
src/ProcessingUnits/SoundChannel/NoiseChannel.hpp
Gegel85/GBEmulator
9899223d63d08bf77848c89a14f69221722adcc7
[ "MIT" ]
6
2019-11-27T18:14:52.000Z
2021-07-27T14:42:21.000Z
src/ProcessingUnits/SoundChannel/NoiseChannel.hpp
Gegel85/GBEmulator
9899223d63d08bf77848c89a14f69221722adcc7
[ "MIT" ]
null
null
null
/* ** EPITECH PROJECT, 2020 ** GBEmulator ** File description: ** NoiseChannel.hpp */ #ifndef GBEMULATOR_NOISECHANNEL_HPP #define GBEMULATOR_NOISECHANNEL_HPP #include "SoundChannel.hpp" /*! * @brief Fréquence de base utilisé pour confectionné le noise. * Il est par la suite divisé pour obtenir la fréquence réel du son joué. */ #define DIV_FREQUENCY 4194304 namespace GBEmulator::SoundChannel { //! @brief Class représentant le "Channel 3" class NoiseChannel : public SoundChannel { private: //! @brief Les 4 formes d'ondes qui peuvent être jouées std::vector<std::vector<unsigned char>> _waves; //! @brief Le ratio de division du bruit. unsigned char _dividingRatio = 0; //! @brief Whether the noise wave needs to be updated. bool _wroteInNoiseFrequency = false; //! @brief La fréquence de l'horloge. unsigned char _shiftClockFrequency = 0; //! @brief Compteur d'étape. bool _polynomialCounterStep = false; //! @brief L'état du LFSR. unsigned short _lfsr = 0; //! @brief Période dans l'onde. double _bitPeriod = 0; //! @brief Met à jour le LFSR. void _updateLFSR(unsigned char stepNumber, std::vector<unsigned char> &lfsrBit); void _update(unsigned cycles) override; /*! * @brief Ratio de division de la fréquence. * Fréquence utilisé pour confectionné la fréquence du son joué dans le channel noise. */ static constexpr double dividingRatio[8] = { 4. / DIV_FREQUENCY, 8. / DIV_FREQUENCY, 16. / DIV_FREQUENCY, 24. / DIV_FREQUENCY, 32. / DIV_FREQUENCY, 40. / DIV_FREQUENCY, 48. / DIV_FREQUENCY, 56. / DIV_FREQUENCY }; public: /*! * @brief Permet de créer la wave du noise. * @param stepNumber Mode 7 ou 15 bits * @return la nouvelle wave pour le noise */ std::vector<unsigned char> getNoiseWave(unsigned char stepNumber); //! @brief Constructeur. //! @param soundInterface L'interface utilisé pour jouer le son. NoiseChannel(ISound &soundInterface); /*! * @brief Permet de changer la longueur du son joué dans le channel noise. * @param length Longueur du son (6 bits) */ void setSoundLength(unsigned char length); /*! * @brief Permet de changer les attributs de modification de fréquence du son joué. * @param value Byte contenant les valeurs pour le nouveau son joué. */ void setPolynomialCounters(unsigned char value); /*! * @brief Permet de récupérer la longueur du son du channel noise. * @return Longueur du son (6 bits) */ unsigned char getSoundLength() const; /*! * @brief Permet de récupérer le byte contenant les attributs de modificaitons de fréquence du son joué. * @return Le byte contenant les attributs */ unsigned char getPolynomialCounters() const; }; } #endif //GBEMULATOR_NOISECHANNEL_HPP
29.210526
106
0.709189
[ "vector" ]
3ec1b26f07cbda941843ec98c9c1c00bc5839fd9
4,511
cpp
C++
results/Github/JodiTheTigger_meow_fft/accelerated_fftw.cpp
FourierACceleratorCompiler/FACC
601c77789114b623af8760756949d879e8398896
[ "Apache-2.0" ]
null
null
null
results/Github/JodiTheTigger_meow_fft/accelerated_fftw.cpp
FourierACceleratorCompiler/FACC
601c77789114b623af8760756949d879e8398896
[ "Apache-2.0" ]
3
2022-02-15T16:30:06.000Z
2022-03-05T18:21:30.000Z
results/Github/JodiTheTigger_meow_fft/accelerated_fftw.cpp
j-c-w/DSPAcceleratorSupport
0d3a686f57361d40ccc5f203e59fd019d861c53e
[ "Apache-2.0" ]
null
null
null
#include "../../../benchmarks/Github/code/JodiTheTigger_meow_fft/context_code.c" #include "../../benchmarks/Accelerators/FFTW/interface.hpp" #include "complex" #include<vector> #include<nlohmann/json.hpp> #include<fstream> #include<iomanip> #include<clib/synthesizer.h> #include<time.h> #include<iostream> char *output_file; char *pre_accel_dump_file; // optional dump file. using json = nlohmann::json; const char* __asan_default_options() { return "detect_leaks=0"; } clock_t AcceleratorStart; clock_t AcceleratorTotalNanos = 0; void StartAcceleratorTimer() { AcceleratorStart = clock(); } void StopAcceleratorTimer() { AcceleratorTotalNanos += (clock()) - AcceleratorStart; } void write_output(Meow_FFT_Workset * data, Meow_FFT_Complex * in, Meow_FFT_Complex * out) { json output_json; std::vector<json> output_temp_405; for (unsigned int i406 = 0; i406 < data->N; i406++) { Meow_FFT_Complex output_temp_407 = out[i406]; json output_temp_408; output_temp_408["r"] = output_temp_407.r; output_temp_408["j"] = output_temp_407.j; output_temp_405.push_back(output_temp_408); } output_json["out"] = output_temp_405; std::ofstream out_str(output_file); out_str << std::setw(4) << output_json << std::endl; } void meow_fft_accel_internal(Meow_FFT_Workset * data,Meow_FFT_Complex * in,Meow_FFT_Complex * out) { short dir;; dir = -1;; int interface_len;; interface_len = data->N;; _complex_float_ api_out[interface_len];; _complex_float_ api_in[interface_len];; for (int i132 = 0; i132 < interface_len; i132++) { api_in[i132].re = in[i132].r; }; for (int i133 = 0; i133 < interface_len; i133++) { api_in[i133].im = in[i133].j; }; if ((PRIM_EQUAL(dir, -1)) && (PRIM_EQUAL(interface_len, 2) || PRIM_EQUAL(interface_len, 4) || PRIM_EQUAL(interface_len, 8) || PRIM_EQUAL(interface_len, 16) || PRIM_EQUAL(interface_len, 32) || ((PRIM_EQUAL(interface_len, 524288)) || ((PRIM_EQUAL(interface_len, 262144)) || ((PRIM_EQUAL(interface_len, 131072)) || ((PRIM_EQUAL(interface_len, 65536)) || ((PRIM_EQUAL(interface_len, 32768)) || ((PRIM_EQUAL(interface_len, 16384)) || ((PRIM_EQUAL(interface_len, 8192)) || ((PRIM_EQUAL(interface_len, 4096)) || ((PRIM_EQUAL(interface_len, 2048)) || ((PRIM_EQUAL(interface_len, 1024)) || ((PRIM_EQUAL(interface_len, 512)) || ((PRIM_EQUAL(interface_len, 256)) || ((PRIM_EQUAL(interface_len, 128)) || ((PRIM_EQUAL(interface_len, 64)) || ((PRIM_EQUAL(interface_len, 32)) || ((PRIM_EQUAL(interface_len, 16)) || ((PRIM_EQUAL(interface_len, 8)) || ((PRIM_EQUAL(interface_len, 4)) || ((PRIM_EQUAL(interface_len, 2)) || (PRIM_EQUAL(interface_len, 1))))))))))))))))))))))) { StartAcceleratorTimer();; fftwf_example_api(api_in, api_out, interface_len, dir);; StopAcceleratorTimer();; for (int i134 = 0; i134 < data->N; i134++) { out[i134].r = api_out[i134].re; }; for (int i135 = 0; i135 < data->N; i135++) { out[i135].j = api_out[i135].im; } } else { meow_fft(data, in, out); } } void meow_fft_accel(Meow_FFT_Workset * data, Meow_FFT_Complex * in, Meow_FFT_Complex * out) { meow_fft_accel_internal((Meow_FFT_Workset *) data, (Meow_FFT_Complex *) in, (Meow_FFT_Complex *) out); } int main(int argc, char **argv) { char *inpname = argv[1]; output_file = argv[2]; std::ifstream ifs(inpname); json input_json = json::parse(ifs); std::vector<Meow_FFT_Complex> in_vec; int n = 0; for (auto& elem : input_json["in"]) { float in_innerr = elem["r"]; float in_innerj = elem["j"]; Meow_FFT_Complex in_inner = { in_innerr, in_innerj}; in_vec.push_back(in_inner); n += 1; } /// This is the in-context part. That is, is a 'typical use' pattern // that we used for the value profiling. It doesn't technicaly // need to be here, and a good compiler could eliminate it since // virtually everything within is now dead-in. However, // I can't be bothered to write a proper input generator // that actually generates valid values for all these things, // so we'll just do this. size_t workset_bytes = meow_fft_generate_workset(n, NULL); Meow_FFT_Workset* data = (Meow_FFT_Workset *) malloc(workset_bytes); meow_fft_generate_workset(n, data); // end in-context part. Meow_FFT_Complex *in = &in_vec[0]; Meow_FFT_Complex out[data->N]; clock_t begin = clock(); for (int i = 0; i < TIMES; i ++) { meow_fft_accel(data, in, out); } clock_t end = clock(); std::cout << "Time: " << (double) (end - begin) / CLOCKS_PER_SEC << std::endl; std::cout << "AccTime: " << (double) AcceleratorTotalNanos / CLOCKS_PER_SEC << std::endl; write_output(data, in, out); }
37.591667
958
0.709599
[ "vector" ]
3ec6147dc7d4707f16e3ae16a33e7c7a4dc5710b
2,752
cpp
C++
tests/cyclic_weight_relations.cpp
rburing/kontsevich_graph_series-
20d443646d7047f5d273c2a44436ef7e5e9b63ca
[ "MIT" ]
4
2017-10-04T20:07:55.000Z
2019-09-16T17:54:51.000Z
tests/cyclic_weight_relations.cpp
rburing/kontsevich_graph_series-cpp
20d443646d7047f5d273c2a44436ef7e5e9b63ca
[ "MIT" ]
null
null
null
tests/cyclic_weight_relations.cpp
rburing/kontsevich_graph_series-cpp
20d443646d7047f5d273c2a44436ef7e5e9b63ca
[ "MIT" ]
null
null
null
#include "../kontsevich_graph_series.hpp" #include <ginac/ginac.h> #include <iostream> #include <vector> #include <fstream> using namespace std; using namespace GiNaC; int main(int argc, char* argv[]) { if (argc != 2) { cout << "Usage: " << argv[0] << " <star-product-filename>\n"; return 1; } // Reading in star product: string star_product_filename(argv[1]); ifstream star_product_file(star_product_filename); parser coefficient_reader; KontsevichGraphSeries<ex> star_product = KontsevichGraphSeries<ex>::from_istream(star_product_file, [&coefficient_reader](std::string s) -> ex { return coefficient_reader(s); }); size_t order = star_product.precision(); // Computing cyclic linear weight relations: lst weight_relations; for (auto& term : star_product[order]) { KontsevichGraph graph = term.second; // coefficient = multiplicity * weight / n! => weight = n! * coefficient / multiplicity ex linear_combination = (graph.internal() % 2 ? 1 : -1) * star_product[order][graph] / graph.multiplicity(); // iterate over subsets of set of edges: 2^(2n) elements vector<size_t> selector(2*graph.internal(), 2); CartesianProduct edge_selector(selector); for (auto edge_selection = edge_selector.begin(); edge_selection != edge_selector.end(); ++edge_selection) { std::vector<KontsevichGraph::VertexPair> targets = graph.targets(); // skip those where an edge is already connected to the first ground vertex bool skip = false; for (size_t choice = 0; choice != 2*graph.internal(); ++choice) if ((*edge_selection)[choice] && ((choice % 2 == 0 && targets[choice/2].first == 0) || (choice % 2 == 1 && targets[choice/2].second == 0))) skip = true; if (skip) continue; // replace edges by edges to the first ground vertex: for (size_t choice = 0; choice != 2*graph.internal(); ++choice) { if ((*edge_selection)[choice]) // replace edge { if (choice % 2 == 0) targets[choice/2].first = 0; else targets[choice/2].second = 0; } } KontsevichGraph modified_graph(graph.internal(), graph.external(), targets, graph.sign()); // build linear relation linear_combination -= (modified_graph.in_degree(0) % 2 ? 1 : -1) * star_product[order][modified_graph] / modified_graph.multiplicity(); } if (linear_combination != 0) cout << linear_combination.expand() << "==0\n"; } }
41.69697
182
0.58939
[ "vector" ]
3ed097e9e4c401fd2ed272627126f4f1471d7963
10,528
cpp
C++
Commands/CDirectiveData.cpp
fengjixuchui/armips
781edcc0c41cc1b1dd81be8bc3d7e389b4ce1ab5
[ "MIT" ]
2
2016-09-30T22:19:33.000Z
2017-02-12T13:22:45.000Z
Commands/CDirectiveData.cpp
fengjixuchui/armips
781edcc0c41cc1b1dd81be8bc3d7e389b4ce1ab5
[ "MIT" ]
2
2016-09-30T22:03:19.000Z
2017-02-03T16:44:08.000Z
Commands/CDirectiveData.cpp
fengjixuchui/armips
781edcc0c41cc1b1dd81be8bc3d7e389b4ce1ab5
[ "MIT" ]
null
null
null
#include "Commands/CDirectiveData.h" #include "Archs/Architecture.h" #include "Core/Common.h" #include "Core/FileManager.h" #include "Core/Misc.h" #include "Core/SymbolData.h" #include "Util/FileSystem.h" #include "Util/Util.h" // // TableCommand // TableCommand::TableCommand(const std::wstring& fileName, TextFile::Encoding encoding) { auto fullName = getFullPathName(fileName); if (!fs::exists(fullName)) { Logger::printError(Logger::Error,L"Table file \"%s\" does not exist",fileName); return; } if (!table.load(fullName,encoding)) { Logger::printError(Logger::Error,L"Invalid table file \"%s\"",fileName); return; } } bool TableCommand::Validate(const ValidateState &state) { Global.Table = table; return false; } // // CDirectiveData // CDirectiveData::CDirectiveData() { mode = EncodingMode::Invalid; writeTermination = false; endianness = Architecture::current().getEndianness(); } CDirectiveData::~CDirectiveData() { } void CDirectiveData::setNormal(std::vector<Expression>& entries, size_t unitSize) { switch (unitSize) { case 1: this->mode = EncodingMode::U8; break; case 2: this->mode = EncodingMode::U16; break; case 4: this->mode = EncodingMode::U32; break; case 8: this->mode = EncodingMode::U64; break; default: Logger::printError(Logger::Error,L"Invalid data unit size %d",unitSize); return; } this->entries = entries; this->writeTermination = false; normalData.reserve(entries.size()); } void CDirectiveData::setFloat(std::vector<Expression>& entries) { this->mode = EncodingMode::Float; this->entries = entries; this->writeTermination = false; } void CDirectiveData::setDouble(std::vector<Expression>& entries) { this->mode = EncodingMode::Double; this->entries = entries; this->writeTermination = false; } void CDirectiveData::setAscii(std::vector<Expression>& entries, bool terminate) { this->mode = EncodingMode::Ascii; this->entries = entries; this->writeTermination = terminate; } void CDirectiveData::setSjis(std::vector<Expression>& entries, bool terminate) { this->mode = EncodingMode::Sjis; this->entries = entries; this->writeTermination = terminate; } void CDirectiveData::setCustom(std::vector<Expression>& entries, bool terminate) { this->mode = EncodingMode::Custom; this->entries = entries; this->writeTermination = terminate; } size_t CDirectiveData::getUnitSize() const { switch (mode) { case EncodingMode::U8: case EncodingMode::Ascii: case EncodingMode::Sjis: case EncodingMode::Custom: return 1; case EncodingMode::U16: return 2; case EncodingMode::U32: case EncodingMode::Float: return 4; case EncodingMode::U64: case EncodingMode::Double: return 8; case EncodingMode::Invalid: break; } return 0; } size_t CDirectiveData::getDataSize() const { switch (mode) { case EncodingMode::Sjis: case EncodingMode::Custom: return customData.size(); case EncodingMode::U8: case EncodingMode::Ascii: case EncodingMode::U16: case EncodingMode::U32: case EncodingMode::U64: case EncodingMode::Float: case EncodingMode::Double: return normalData.size()*getUnitSize(); case EncodingMode::Invalid: break; } return 0; } void CDirectiveData::encodeCustom(EncodingTable& table) { customData.clear(); for (size_t i = 0; i < entries.size(); i++) { ExpressionValue value = entries[i].evaluate(); if (!value.isValid()) { Logger::queueError(Logger::Error,L"Invalid expression"); continue; } if (value.isInt()) { customData.appendByte((byte)value.intValue); } else if (value.isString()) { ByteArray encoded = table.encodeString(value.strValue,false); if (encoded.size() == 0 && value.strValue.size() > 0) { Logger::queueError(Logger::Error,L"Failed to encode \"%s\"",value.strValue); } customData.append(encoded); } else { Logger::queueError(Logger::Error,L"Invalid expression type"); } } if (writeTermination) { ByteArray encoded = table.encodeTermination(); customData.append(encoded); } } void CDirectiveData::encodeSjis() { static EncodingTable sjisTable; if (!sjisTable.isLoaded()) { unsigned char hexBuffer[2]; sjisTable.setTerminationEntry((unsigned char*)"\0",1); for (unsigned short SJISValue = 0x0001; SJISValue < 0x0100; SJISValue++) { wchar_t unicodeValue = sjisToUnicode(SJISValue); if (unicodeValue != 0xFFFF) { hexBuffer[0] = SJISValue & 0xFF; sjisTable.addEntry(hexBuffer, 1, unicodeValue); } } for (unsigned short SJISValue = 0x8100; SJISValue < 0xEF00; SJISValue++) { wchar_t unicodeValue = sjisToUnicode(SJISValue); if (unicodeValue != 0xFFFF) { hexBuffer[0] = (SJISValue >> 8) & 0xFF; hexBuffer[1] = SJISValue & 0xFF; sjisTable.addEntry(hexBuffer, 2, unicodeValue); } } } encodeCustom(sjisTable); } void CDirectiveData::encodeFloat() { normalData.clear(); for (size_t i = 0; i < entries.size(); i++) { ExpressionValue value = entries[i].evaluate(); if (!value.isValid()) { Logger::queueError(Logger::Error,L"Invalid expression"); continue; } if (value.isInt() && mode == EncodingMode::Float) { int32_t num = getFloatBits((float)value.intValue); normalData.push_back(num); } else if (value.isInt() && mode == EncodingMode::Double) { int64_t num = getDoubleBits((double)value.intValue); normalData.push_back(num); } else if (value.isFloat() && mode == EncodingMode::Float) { int32_t num = getFloatBits((float)value.floatValue); normalData.push_back(num); } else if (value.isFloat() && mode == EncodingMode::Double) { int64_t num = getDoubleBits((double)value.floatValue); normalData.push_back(num); } else { Logger::queueError(Logger::Error,L"Invalid expression type"); } } } void CDirectiveData::encodeNormal() { normalData.clear(); for (size_t i = 0; i < entries.size(); i++) { ExpressionValue value = entries[i].evaluate(); if (!value.isValid()) { Logger::queueError(Logger::Error,L"Invalid expression"); continue; } if (value.isString()) { bool hadNonAscii = false; for (size_t l = 0; l < value.strValue.size(); l++) { int64_t num = value.strValue[l]; normalData.push_back(num); if (num >= 0x80 && !hadNonAscii) { Logger::printError(Logger::Warning,L"Non-ASCII character in data directive. Use .string instead"); hadNonAscii = true; } } } else if (value.isInt()) { int64_t num = value.intValue; normalData.push_back(num); } else if (value.isFloat() && mode == EncodingMode::U32) { int32_t num = getFloatBits((float)value.floatValue); normalData.push_back(num); } else if(value.isFloat() && mode == EncodingMode::U64) { int64_t num = getDoubleBits((double)value.floatValue); normalData.push_back(num); } else { Logger::queueError(Logger::Error,L"Invalid expression type"); } } if (writeTermination) { normalData.push_back(0); } } bool CDirectiveData::Validate(const ValidateState &state) { position = g_fileManager->getVirtualAddress(); size_t oldSize = getDataSize(); switch (mode) { case EncodingMode::U8: case EncodingMode::U16: case EncodingMode::U32: case EncodingMode::U64: case EncodingMode::Ascii: encodeNormal(); break; case EncodingMode::Float: case EncodingMode::Double: encodeFloat(); break; case EncodingMode::Sjis: encodeSjis(); break; case EncodingMode::Custom: encodeCustom(Global.Table); break; default: Logger::queueError(Logger::Error,L"Invalid encoding type"); break; } g_fileManager->advanceMemory(getDataSize()); return oldSize != getDataSize(); } void CDirectiveData::Encode() const { switch (mode) { case EncodingMode::Sjis: case EncodingMode::Custom: g_fileManager->write(customData.data(),customData.size()); break; case EncodingMode::U8: case EncodingMode::Ascii: for (auto value: normalData) { g_fileManager->writeU8((uint8_t)value); } break; case EncodingMode::U16: for (auto value: normalData) { g_fileManager->writeU16((uint16_t)value); } break; case EncodingMode::U32: case EncodingMode::Float: for (auto value: normalData) { g_fileManager->writeU32((uint32_t)value); } break; case EncodingMode::U64: case EncodingMode::Double: for (auto value: normalData) { g_fileManager->writeU64((uint64_t)value); } break; case EncodingMode::Invalid: // TODO: Assert? break; } } void CDirectiveData::writeTempData(TempData& tempData) const { size_t size = (getUnitSize()*2+3)*getDataSize()+20; wchar_t* str = new wchar_t[size]; wchar_t* start = str; switch (mode) { case EncodingMode::Sjis: case EncodingMode::Custom: str += swprintf(str,20,L".byte "); for (size_t i = 0; i < customData.size(); i++) { str += swprintf(str,20,L"0x%02X,",(uint8_t)customData[i]); } break; case EncodingMode::U8: case EncodingMode::Ascii: str += swprintf(str,20,L".byte "); for (size_t i = 0; i < normalData.size(); i++) { str += swprintf(str,20,L"0x%02X,",(uint8_t)normalData[i]); } break; case EncodingMode::U16: str += swprintf(str,20,L".halfword "); for (size_t i = 0; i < normalData.size(); i++) { str += swprintf(str,20,L"0x%04X,",(uint16_t)normalData[i]); } break; case EncodingMode::U32: case EncodingMode::Float: str += swprintf(str,20,L".word "); for (size_t i = 0; i < normalData.size(); i++) { str += swprintf(str,20,L"0x%08X,",(uint32_t)normalData[i]); } break; case EncodingMode::U64: case EncodingMode::Double: str += swprintf(str,20,L".doubleword "); for (size_t i = 0; i < normalData.size(); i++) { str += swprintf(str,20,L"0x%16llX,",(uint64_t)normalData[i]); } break; case EncodingMode::Invalid: // TODO: Assert? break; } *(str-1) = 0; tempData.writeLine(position,start); delete[] start; } void CDirectiveData::writeSymData(SymbolData& symData) const { switch (mode) { case EncodingMode::Ascii: symData.addData(position,getDataSize(),SymbolData::DataAscii); break; case EncodingMode::U8: case EncodingMode::Sjis: case EncodingMode::Custom: symData.addData(position,getDataSize(),SymbolData::Data8); break; case EncodingMode::U16: symData.addData(position,getDataSize(),SymbolData::Data16); break; case EncodingMode::U32: case EncodingMode::Float: symData.addData(position,getDataSize(),SymbolData::Data32); break; case EncodingMode::U64: case EncodingMode::Double: symData.addData(position,getDataSize(),SymbolData::Data64); break; case EncodingMode::Invalid: // TODO: Assert? break; } }
22.117647
103
0.68902
[ "vector" ]
a793e3e5b0c584413fef6dc263cde41b3fd892dd
1,419
hxx
C++
Legolas/Matrix/tst/TransposeMatrixMatrixTest/junk/AMatrixDefinition.hxx
LaurentPlagne/Legolas
fdf533528baf7ab5fcb1db15d95d2387b3e3723c
[ "MIT" ]
null
null
null
Legolas/Matrix/tst/TransposeMatrixMatrixTest/junk/AMatrixDefinition.hxx
LaurentPlagne/Legolas
fdf533528baf7ab5fcb1db15d95d2387b3e3723c
[ "MIT" ]
null
null
null
Legolas/Matrix/tst/TransposeMatrixMatrixTest/junk/AMatrixDefinition.hxx
LaurentPlagne/Legolas
fdf533528baf7ab5fcb1db15d95d2387b3e3723c
[ "MIT" ]
1
2021-02-11T14:43:25.000Z
2021-02-11T14:43:25.000Z
/** * project DESCARTES * * @file AMatrixDefinition.hxx * * @author Laurent PLAGNE * @date june 2004 - january 2005 * * @par Modifications * - author date object * * (c) Copyright EDF R&D - CEA 2001-2005 */ #ifndef __LEGOLAS_AMATRIXDEFINITION_HXX__ #define __LEGOLAS_AMATRIXDEFINITION_HXX__ #include "Legolas/Matrix/MatrixStructures/MatrixStructureTags.hxx" #include "Legolas/Matrix/RealElement/RealDataDriver.hxx" #include "Legolas/Matrix/Helper/VoidObject.hxx" #include "Legolas/Matrix/Helper/DefaultPrecision.hxx" template <class REAL_TYPE> class AMatrixDefinition : public Legolas::DefaultPrecision<REAL_TYPE>{ public: // Types that must be defined to model the MATRIX_DEFINITION concept typedef Legolas::Dense MatrixStructure; typedef REAL_TYPE RealType; typedef int Data; typedef REAL_TYPE GetElement; // 5 static functions to be defined to model the TRIDIAG_MATRIX_DEFINITION concept static inline int nrows ( const Data & data ) { return data; } static inline int ncols ( const Data & data ) { return data; } static inline GetElement zero(const Data & data) { return 0.0; } static inline GetElement getElement( int i , int j, const Data & data) { return 0.0; } }; #endif
23.65
84
0.646934
[ "object", "model" ]
a799d2a9d7529ccd844c407247e315449b859f75
390
cpp
C++
LEDServer/C++/LED.cpp
nordicway/Calamarity
8cac2afb3ac20144ddcc468cdaf4bcdd2dd000a2
[ "MIT" ]
null
null
null
LEDServer/C++/LED.cpp
nordicway/Calamarity
8cac2afb3ac20144ddcc468cdaf4bcdd2dd000a2
[ "MIT" ]
null
null
null
LEDServer/C++/LED.cpp
nordicway/Calamarity
8cac2afb3ac20144ddcc468cdaf4bcdd2dd000a2
[ "MIT" ]
null
null
null
#include "stdafx.h" #include "LED.h" #include <vector> LED::LED(void) { this->setSize(1); this->intensity=0; } LED::~LED(void) { } void LED::setIntensity(unsigned char i) { this->intensity=i; } unsigned char LED::getIntensity() { return this->intensity; } short LED::getSize() { return this->size; } void LED::setSize(short n) { this->size=n; }
12.1875
42
0.6
[ "vector" ]
a79bcf5385b90cc868bb928e09fa12e32862daee
3,837
cc
C++
core/src/ceof/ceof_iterator.cc
sdelafond/centreon-broker
21178d98ed8a061ca71317d23c2026dbc4edaca2
[ "Apache-2.0" ]
null
null
null
core/src/ceof/ceof_iterator.cc
sdelafond/centreon-broker
21178d98ed8a061ca71317d23c2026dbc4edaca2
[ "Apache-2.0" ]
null
null
null
core/src/ceof/ceof_iterator.cc
sdelafond/centreon-broker
21178d98ed8a061ca71317d23c2026dbc4edaca2
[ "Apache-2.0" ]
null
null
null
/* ** Copyright 2009-2013 Centreon ** ** 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. ** ** For more information : contact@centreon.com */ #include "com/centreon/broker/ceof/ceof_parser.hh" using namespace com::centreon::broker::ceof; /** * Default constructor. */ ceof_iterator::ceof_iterator() { } /** * Constructor. * * @param[in] tokens A vector of tokens. * @param[in] token_number The number of tokens. */ ceof_iterator::ceof_iterator( std::vector<ceof_token>::const_iterator const& begin, std::vector<ceof_token>::const_iterator const& end) : _token_it(begin), _token_end(end) { } /** * Copy constructor. * * @param[in] other The object to copy. */ ceof_iterator::ceof_iterator(ceof_iterator const& other) { _token_it = other._token_it; _token_end = other._token_end; } /** * Assignment operator. * * @param[in] other The object to copy. * * @return A reference to this object. */ ceof_iterator& ceof_iterator::operator=(ceof_iterator const& other) { if (this != &other) { _token_it = other._token_it; _token_end = other._token_end; } return (*this); } /** * Destructor. */ ceof_iterator::~ceof_iterator() throw() { } /** * Comparison operator. * * @param[in] other The object to compare with. * * @return True if both objects are equal. */ bool ceof_iterator::operator==(ceof_iterator const& other) const throw() { return (_token_it == other._token_it && _token_end == other._token_end); } /** * Comparison unequality. * * @param[in] other The object to compare with. * * @return True if the object are not equal. */ bool ceof_iterator::operator!=(ceof_iterator const& other) const throw() { return (!operator ==(other)); } /** * @brief Go forward one token. * * Skip children tokens. * * @return Reference to this object. */ ceof_iterator& ceof_iterator::operator++() throw() { int parent_token = _token_it->get_parent_token(); for (++_token_it; (_token_it != _token_end) && (_token_it->get_parent_token() != parent_token); ++_token_it) ; return (*this); } /** * Get the type of the current token. * * @return The type of the current token. */ ceof_token::token_type ceof_iterator::get_type() const throw() { return (_token_it->get_type()); } /** * Get the value of the current token. * * @return The value of the current token. */ std::string const& ceof_iterator::get_value() const throw() { return (_token_it->get_value()); } /** * Does this iterator has children? * * @return True if this iterator has children. */ bool ceof_iterator::has_children() const throw() { int token_number = _token_it->get_token_number(); std::vector<ceof_token>::const_iterator it = _token_it; ++it; return ((it != _token_end) && (it->get_parent_token() == token_number)); } /** * Enter the children. * * @return An iterator to the children. */ ceof_iterator ceof_iterator::enter_children() const throw() { return (has_children() ? ceof_iterator(_token_it + 1, _token_end) : ceof_iterator()); } /** * Is this an end iterator? * * @return True if this an end iterator. */ bool ceof_iterator::end() const throw() { return (_token_it == _token_end); }
23.396341
75
0.660933
[ "object", "vector" ]
a79cc918fbb6126f658b071b236c9826fe766922
5,788
cpp
C++
cpp/spline.cpp
parmes/solfec-2.0
3329d3e1e4d58fefaf976c04bab19284aef45bc2
[ "MIT" ]
1
2020-06-21T23:52:25.000Z
2020-06-21T23:52:25.000Z
cpp/spline.cpp
parmes/solfec-2.0
3329d3e1e4d58fefaf976c04bab19284aef45bc2
[ "MIT" ]
1
2020-05-01T14:44:01.000Z
2020-05-01T23:50:36.000Z
cpp/spline.cpp
parmes/solfec-2.0
3329d3e1e4d58fefaf976c04bab19284aef45bc2
[ "MIT" ]
2
2020-06-21T23:59:21.000Z
2021-12-09T09:49:50.000Z
/* The MIT License (MIT) Copyright (c) 2019 EDF Energy 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. */ /* Contributors: Tomasz Koziara */ #include <stdlib.h> #include <string.h> #include <float.h> #include <mpi.h> #include "real.h" #include "err.h" #include "solfec.hpp" static size_t findmarker (std::vector<std::array<REAL,2>>::iterator begin, std::vector<std::array<REAL,2>>::iterator end, REAL xval) { std::vector<std::array<REAL,2>>::iterator low = begin, high = end-1, mid; while (low <= high) { mid = low + (high-low) / 2; if (xval >= (*mid)[0] && xval < (*(mid+1))[0]) { return (mid - begin); } else if (xval < (*mid)[0]) { high = mid - 1; } else { low = mid + 1; } } return 0; } static size_t findoffset (std::vector<REAL>::iterator begin, std::vector<REAL>::iterator end, REAL xval) { std::vector<REAL>::iterator low = begin, high = end-1, mid = low + (high-low) / 2; while (low < mid && mid < high) { if (xval < (*mid)) { high = mid; } else if (xval >= (*mid)) { low = mid; } mid = low + (high-low) / 2; } return mid - begin; } static REAL linterp (std::vector<std::array<REAL,2>>::iterator point, REAL xval) { REAL dt = xval - point[0][0]; return point[0][1] + (point[1][1]-point[0][1]) * (dt / (point[1][0] - point[0][0])); } /* read spline from file */ void spline_from_file (const char *path, int cache, struct spline *spline) { char buf [4096]; REAL x0, x, y; size_t size; off_t off0; FILE *fp; ASSERT ((fp = fopen (path, "r")), "opening SPLINE file [%s] has failed", path); spline->cache = cache; if (cache) spline->path.assign(path); size = 0; x = -REAL_MAX; while ((off0 = ftello(fp)) >= 0 && fgets(buf, sizeof(buf), fp) != NULL) /* read line */ { if (buf[0] == '#') continue; /* skip comments */ if (cache == 0 || spline->points.size() <= cache) { x0 = x; #if REALSIZE==4 if (sscanf (buf, "%f%f", &x, &y) == EOF) break; #else if (sscanf (buf, "%lf%lf", &x, &y) == EOF) break; #endif ASSERT (x > x0, "spline argument must be increasing"); std::array<REAL,2> temp = {x, y}; spline->points.push_back (temp); size ++; } else { x0 = x; #if REALSIZE==4 if (sscanf (buf, "%f%f", &x, &y) == EOF) break; #else if (sscanf (buf, "%lf%lf", &x, &y) == EOF) break; #endif ASSERT (x > x0, "spline argument must be increasing"); size ++; } if (spline->points.size() == 1 || size == cache) /* mark cache sized offests in file */ { spline->offset.push_back(off0); spline->xval.push_back(x); if (size == cache) size = 0; } } fclose (fp); ASSERT (spline->points.size() > 0, "spline definition is empty"); if (cache) { if (spline->xval.back() < x) /* finished before cache limit */ { spline->offset.push_back(off0); spline->xval.push_back(x); } } } /* calculate splane value */ REAL spline_value (struct spline *spline, REAL xval) { REAL lo, hi; /* if the spline is partially cached - when out of bounds - reload cache */ if ((xval < spline->points[0][0] || xval > spline->points.back()[0]) && spline->path.length() > 0) { char buf [4096]; int off = findoffset (spline->xval.begin(), spline->xval.end(), xval); FILE *fp = fopen (spline->path.c_str(), "r"); ASSERT (fp, "opening file [%s] for a partially cached SPLINE has failed", spline->path); fseeko (fp, spline->offset[off], SEEK_SET); spline->points.resize(0); while (spline->points.size() <= spline->cache && fgets(buf, sizeof(buf), fp) != NULL) /* read line */ { if (buf[0] == '#') continue; /* skip comments */ REAL x, y; #if REALSIZE==4 if (sscanf (buf, "%f%f", &x, &y) == EOF) break; #else if (sscanf (buf, "%lf%lf", &x, &y) == EOF) break; #endif std::array<REAL,2> temp = {x, y}; spline->points.push_back (temp); } fclose (fp); } if (xval < spline->points[0][0]) return spline->points[0][1]; else if (xval > spline->points.back()[0]) return spline->points.back()[1]; lo = spline->points[spline->marker > 0 ? spline->marker - 1 : spline->marker][0]; hi = spline->points[spline->marker < spline->points.size() - 1 ? spline->marker + 1 : spline->marker][0]; if (xval < lo || xval > hi) { spline->marker = findmarker (spline->points.begin(), spline->points.end(), xval); } else if (xval >= lo && spline->marker && xval < spline->points[spline->marker][0]) spline->marker --; else if (xval >= spline->points[spline->marker+1][0] && xval < hi && spline->marker < spline->points.size() - 1) spline->marker ++; return linterp (spline->points.begin()+spline->marker, xval); }
27.301887
132
0.60539
[ "vector" ]
a79e4a0068301eb831f3493e50bdd61fb84e43d4
121,492
cc
C++
engine/game/shapeBase.cc
ClayHanson/B4v21-Public-Repo
c812aa7bf2ecb267e02969c85f0c9c2a29be0d28
[ "MIT" ]
1
2020-08-18T19:45:34.000Z
2020-08-18T19:45:34.000Z
engine/game/shapeBase.cc
ClayHanson/B4v21-Launcher-Public-Repo
c812aa7bf2ecb267e02969c85f0c9c2a29be0d28
[ "MIT" ]
null
null
null
engine/game/shapeBase.cc
ClayHanson/B4v21-Launcher-Public-Repo
c812aa7bf2ecb267e02969c85f0c9c2a29be0d28
[ "MIT" ]
null
null
null
//----------------------------------------------------------------------------- // Torque Game Engine // Copyright (C) GarageGames.com, Inc. //----------------------------------------------------------------------------- #include "dgl/dgl.h" #include "platform/platform.h" #include "core/dnet.h" #include "audio/audioDataBlock.h" #include "game/gameConnection.h" #include "game/moveManager.h" #include "console/consoleTypes.h" #include "core/bitStream.h" #include "ts/tsPartInstance.h" #include "ts/tsShapeInstance.h" #include "sceneGraph/sceneGraph.h" #include "sceneGraph/sceneState.h" #include "game/shadow.h" #include "game/fx/explosion.h" #include "game/shapeBase.h" #include "terrain/waterBlock.h" #include "game/debris.h" #include "terrain/sky.h" #include "game/physicalZone.h" #include "sceneGraph/detailManager.h" #include "math/mathUtils.h" #include "math/mMatrix.h" #include "math/mRandom.h" #include "platform/profiler.h" IMPLEMENT_CO_DATABLOCK_V1(ShapeBaseData); //---------------------------------------------------------------------------- // Timeout for non-looping sounds on a channel static SimTime sAudioTimeout = 500; bool ShapeBase::gRenderEnvMaps = true; F32 ShapeBase::sWhiteoutDec = 0.007; F32 ShapeBase::sDamageFlashDec = 0.007; U32 ShapeBase::sLastRenderFrame = 0; static const char *sDamageStateName[] = { // Index by enum ShapeBase::DamageState "Enabled", "Disabled", "Destroyed" }; //---------------------------------------------------------------------------- ShapeBaseData::ShapeBaseData() { shadowEnable = false; shadowCanMove = false; shadowCanAnimate = false; shapeName = ""; cloakTexName = ""; mass = 1; drag = 0; density = 1; maxEnergy = 0; maxDamage = 1.0; disabledLevel = 1.0; destroyedLevel = 1.0; repairRate = 0.0033; eyeNode = -1; shadowNode = -1; cameraNode = -1; damageSequence = -1; hulkSequence = -1; cameraMaxDist = 0; cameraMinDist = 0.2; cameraDefaultFov = 90.f; cameraMinFov = 5.f; cameraMaxFov = 120.f; emap = false; aiAvoidThis = false; isInvincible = false; renderWhenDestroyed = true; debris = NULL; debrisID = 0; debrisShapeName = NULL; explosion = NULL; explosionID = 0; underwaterExplosion = NULL; underwaterExplosionID = 0; firstPersonOnly = false; useEyePoint = false; observeThroughObject = false; computeCRC = false; // no shadows by default genericShadowLevel = 2.0f; noShadowLevel = 2.0f; inheritEnergyFromMount = false; for(U32 j = 0; j < NumHudRenderImages; j++) { hudImageNameFriendly[j] = 0; hudImageNameEnemy[j] = 0; hudRenderCenter[j] = false; hudRenderModulated[j] = false; hudRenderAlways[j] = false; hudRenderDistance[j] = false; hudRenderName[j] = false; } } static ShapeBaseData gShapeBaseDataProto; ShapeBaseData::~ShapeBaseData() { } bool ShapeBaseData::preload(bool server, char errorBuffer[256]) { if (!Parent::preload(server, errorBuffer)) return false; bool shapeError = false; // Resolve objects transmitted from server if (!server) { if( !explosion && explosionID != 0 ) { if( Sim::findObject( explosionID, explosion ) == false) { Con::errorf( ConsoleLogEntry::General, "ShapeBaseData::preload: Invalid packet, bad datablockId(explosion): 0x%x", explosionID ); } AssertFatal(!(explosion && ((explosionID < DataBlockObjectIdFirst) || (explosionID > DataBlockObjectIdLast))), "ShapeBaseData::preload: invalid explosion data"); } if( !underwaterExplosion && underwaterExplosionID != 0 ) { if( Sim::findObject( underwaterExplosionID, underwaterExplosion ) == false) { Con::errorf( ConsoleLogEntry::General, "ShapeBaseData::preload: Invalid packet, bad datablockId(underwaterExplosion): 0x%x", underwaterExplosionID ); } AssertFatal(!(underwaterExplosion && ((underwaterExplosionID < DataBlockObjectIdFirst) || (underwaterExplosionID > DataBlockObjectIdLast))), "ShapeBaseData::preload: invalid underwaterExplosion data"); } if( !debris && debrisID != 0 ) { Sim::findObject( debrisID, debris ); AssertFatal(!(debris && ((debrisID < DataBlockObjectIdFirst) || (debrisID > DataBlockObjectIdLast))), "ShapeBaseData::preload: invalid debris data"); } if( debrisShapeName && debrisShapeName[0] != '\0' && !bool(debrisShape) ) { debrisShape = ResourceManager->load(debrisShapeName); if( bool(debrisShape) == false ) { dSprintf(errorBuffer, 256, "ShapeBaseData::load: Couldn't load shape \"%s\"", debrisShapeName); return false; } else { if(!server && !debrisShape->preloadMaterialList() && NetConnection::filesWereDownloaded()) shapeError = true; TSShapeInstance* pDummy = new TSShapeInstance(debrisShape, !server); delete pDummy; } } } // if (shapeName && shapeName[0]) { S32 i; // Resolve shapename shape = ResourceManager->load(shapeName, computeCRC); if (!bool(shape)) { dSprintf(errorBuffer, 256, "ShapeBaseData: Couldn't load shape \"%s\"",shapeName); return false; } if(!server && !shape->preloadMaterialList() && NetConnection::filesWereDownloaded()) shapeError = true; if(computeCRC) { Con::printf("Validation required for shape: %s", shapeName); if(server) mCRC = shape.getCRC(); else if(mCRC != shape.getCRC()) { dSprintf(errorBuffer, 256, "Shape \"%s\" does not match version on server.",shapeName); return false; } } // Resolve details and camera node indexes. for (i = 0; i < shape->details.size(); i++) { char* name = (char*)shape->names[shape->details[i].nameIndex]; if (dStrstr((const char *)dStrlwr(name), "collision-")) { collisionDetails.push_back(i); collisionBounds.increment(); shape->computeBounds(collisionDetails.last(), collisionBounds.last()); shape->getAccelerator(collisionDetails.last()); if (!shape->bounds.isContained(collisionBounds.last())) { Con::warnf("Warning: shape %s collision detail %d (Collision-%d) bounds exceed that of shape.", shapeName, collisionDetails.size() - 1, collisionDetails.last()); collisionBounds.last() = shape->bounds; } else if (collisionBounds.last().isValidBox() == false) { Con::errorf("Error: shape %s-collision detail %d (Collision-%d) bounds box invalid!", shapeName, collisionDetails.size() - 1, collisionDetails.last()); collisionBounds.last() = shape->bounds; } // The way LOS works is that it will check to see if there is a LOS detail that matches // the the collision detail + 1 + MaxCollisionShapes (this variable name should change in // the future). If it can't find a matching LOS it will simply use the collision instead. // We check for any "unmatched" LOS's further down LOSDetails.increment(); char buff[128]; dSprintf(buff, sizeof(buff), "LOS-%d", i + 1 + MaxCollisionShapes); U32 los = shape->findDetail(buff); if (los == -1) LOSDetails.last() = i; else LOSDetails.last() = los; } } // Snag any "unmatched" LOS details for (i = 0; i < shape->details.size(); i++) { char* name = (char*)shape->names[shape->details[i].nameIndex]; if (dStrstr((const char *)dStrlwr(name), "los-")) { // See if we already have this LOS bool found = false; for (U32 j = 0; j < LOSDetails.size(); j++) { if (LOSDetails[j] == i) { found = true; break; } } if (!found) LOSDetails.push_back(i); } } debrisDetail = shape->findDetail("Debris-17"); eyeNode = shape->findNode("eye"); cameraNode = shape->findNode("cam"); if (cameraNode == -1) cameraNode = eyeNode; // Resolve mount point node indexes for (i = 0; i < NumMountPoints; i++) { char fullName[256]; dSprintf(fullName,sizeof(fullName),"mount%d",i); mountPointNode[i] = shape->findNode(fullName); } // find the AIRepairNode - hardcoded to be the last node in the array... mountPointNode[AIRepairNode] = shape->findNode("AIRepairNode"); // hulkSequence = shape->findSequence("Visibility"); damageSequence = shape->findSequence("Damage"); // F32 w = shape->bounds.len_y() / 2; if (cameraMaxDist < w) cameraMaxDist = w; } if(!server) { // grab all the hud images for(U32 i = 0; i < NumHudRenderImages; i++) { if(hudImageNameFriendly[i] && hudImageNameFriendly[i][0]) hudImageFriendly[i] = TextureHandle(hudImageNameFriendly[i], BitmapTexture); if(hudImageNameEnemy[i] && hudImageNameEnemy[i][0]) hudImageEnemy[i] = TextureHandle(hudImageNameEnemy[i], BitmapTexture); } } return !shapeError; } void ShapeBaseData::initPersistFields() { Parent::initPersistFields(); addGroup("Shadows"); addField("shadowEnable", TypeBool, Offset(shadowEnable, ShapeBaseData)); addField("shadowCanMove", TypeBool, Offset(shadowCanMove, ShapeBaseData)); addField("shadowCanAnimate", TypeBool, Offset(shadowCanAnimate, ShapeBaseData)); endGroup("Shadows"); addGroup("Render"); addField("shapeFile", TypeFilename, Offset(shapeName, ShapeBaseData)); addField("cloakTexture", TypeFilename, Offset(cloakTexName, ShapeBaseData)); addField("emap", TypeBool, Offset(emap, ShapeBaseData)); endGroup("Render"); addGroup("Destruction", "Parameters related to the destruction effects of this object."); addField("explosion", TypeExplosionDataPtr, Offset(explosion, ShapeBaseData)); addField("underwaterExplosion", TypeExplosionDataPtr, Offset(underwaterExplosion, ShapeBaseData)); addField("debris", TypeDebrisDataPtr, Offset(debris, ShapeBaseData)); addField("renderWhenDestroyed", TypeBool, Offset(renderWhenDestroyed, ShapeBaseData)); addField("debrisShapeName", TypeFilename, Offset(debrisShapeName, ShapeBaseData)); endGroup("Destruction"); addGroup("Physics"); addField("mass", TypeF32, Offset(mass, ShapeBaseData)); addField("drag", TypeF32, Offset(drag, ShapeBaseData)); addField("density", TypeF32, Offset(density, ShapeBaseData)); endGroup("Physics"); addGroup("Damage/Energy"); addField("maxEnergy", TypeF32, Offset(maxEnergy, ShapeBaseData)); addField("maxDamage", TypeF32, Offset(maxDamage, ShapeBaseData)); addField("disabledLevel", TypeF32, Offset(disabledLevel, ShapeBaseData)); addField("destroyedLevel", TypeF32, Offset(destroyedLevel, ShapeBaseData)); addField("repairRate", TypeF32, Offset(repairRate, ShapeBaseData)); addField("inheritEnergyFromMount", TypeBool, Offset(inheritEnergyFromMount, ShapeBaseData)); addField("isInvincible", TypeBool, Offset(isInvincible, ShapeBaseData)); endGroup("Damage/Energy"); addGroup("Camera"); addField("cameraMaxDist", TypeF32, Offset(cameraMaxDist, ShapeBaseData)); addField("cameraMinDist", TypeF32, Offset(cameraMinDist, ShapeBaseData)); addField("cameraDefaultFov", TypeF32, Offset(cameraDefaultFov, ShapeBaseData)); addField("cameraMinFov", TypeF32, Offset(cameraMinFov, ShapeBaseData)); addField("cameraMaxFov", TypeF32, Offset(cameraMaxFov, ShapeBaseData)); addField("firstPersonOnly", TypeBool, Offset(firstPersonOnly, ShapeBaseData)); addField("useEyePoint", TypeBool, Offset(useEyePoint, ShapeBaseData)); addField("observeThroughObject", TypeBool, Offset(observeThroughObject, ShapeBaseData)); endGroup("Camera"); // This hud code is going to get ripped out soon... addGroup("HUD", "@deprecated Likely to be removed soon."); addField("hudImageName", TypeFilename, Offset(hudImageNameFriendly, ShapeBaseData), NumHudRenderImages); addField("hudImageNameFriendly", TypeFilename, Offset(hudImageNameFriendly, ShapeBaseData), NumHudRenderImages); addField("hudImageNameEnemy", TypeFilename, Offset(hudImageNameEnemy, ShapeBaseData), NumHudRenderImages); addField("hudRenderCenter", TypeBool, Offset(hudRenderCenter, ShapeBaseData), NumHudRenderImages); addField("hudRenderModulated", TypeBool, Offset(hudRenderModulated, ShapeBaseData), NumHudRenderImages); addField("hudRenderAlways", TypeBool, Offset(hudRenderAlways, ShapeBaseData), NumHudRenderImages); addField("hudRenderDistance", TypeBool, Offset(hudRenderDistance, ShapeBaseData), NumHudRenderImages); addField("hudRenderName", TypeBool, Offset(hudRenderName, ShapeBaseData), NumHudRenderImages); endGroup("HUD"); addGroup("Misc"); addField("aiAvoidThis", TypeBool, Offset(aiAvoidThis, ShapeBaseData)); addField("computeCRC", TypeBool, Offset(computeCRC, ShapeBaseData)); endGroup("Misc"); } ConsoleMethod( ShapeBaseData, checkDeployPos, bool, 3, 3, "(Transform xform)") { if (bool(object->shape) == false) return false; Point3F pos(0, 0, 0); AngAxisF aa(Point3F(0, 0, 1), 0); dSscanf(argv[2],"%g %g %g %g %g %g %g", &pos.x,&pos.y,&pos.z,&aa.axis.x,&aa.axis.y,&aa.axis.z,&aa.angle); MatrixF mat; aa.setMatrix(&mat); mat.setColumn(3,pos); Box3F objBox = object->shape->bounds; Point3F boxCenter = (objBox.min + objBox.max) * 0.5; objBox.min = boxCenter + (objBox.min - boxCenter) * 0.9; objBox.max = boxCenter + (objBox.max - boxCenter) * 0.9; Box3F wBox = objBox; mat.mul(wBox); EarlyOutPolyList polyList; polyList.mNormal.set(0,0,0); polyList.mPlaneList.clear(); polyList.mPlaneList.setSize(6); polyList.mPlaneList[0].set(objBox.min,VectorF(-1,0,0)); polyList.mPlaneList[1].set(objBox.max,VectorF(0,1,0)); polyList.mPlaneList[2].set(objBox.max,VectorF(1,0,0)); polyList.mPlaneList[3].set(objBox.min,VectorF(0,-1,0)); polyList.mPlaneList[4].set(objBox.min,VectorF(0,0,-1)); polyList.mPlaneList[5].set(objBox.max,VectorF(0,0,1)); for (U32 i = 0; i < 6; i++) { PlaneF temp; mTransformPlane(mat, Point3F(1, 1, 1), polyList.mPlaneList[i], &temp); polyList.mPlaneList[i] = temp; } if (gServerContainer.buildPolyList(wBox, InteriorObjectType | StaticShapeObjectType, &polyList)) return false; return true; } ConsoleMethod(ShapeBaseData, getDeployTransform, const char *, 4, 4, "(Point3F pos, Point3F normal)") { Point3F normal; Point3F position; dSscanf(argv[2], "%g %g %g", &position.x, &position.y, &position.z); dSscanf(argv[3], "%g %g %g", &normal.x, &normal.y, &normal.z); normal.normalize(); VectorF xAxis; if( mFabs(normal.z) > mFabs(normal.x) && mFabs(normal.z) > mFabs(normal.y)) mCross( VectorF( 0, 1, 0 ), normal, &xAxis ); else mCross( VectorF( 0, 0, 1 ), normal, &xAxis ); VectorF yAxis; mCross( normal, xAxis, &yAxis ); MatrixF testMat(true); testMat.setColumn( 0, xAxis ); testMat.setColumn( 1, yAxis ); testMat.setColumn( 2, normal ); testMat.setPosition( position ); char *returnBuffer = Con::getReturnBuffer(256); Point3F pos; testMat.getColumn(3,&pos); AngAxisF aa(testMat); dSprintf(returnBuffer,256,"%g %g %g %g %g %g %g", pos.x,pos.y,pos.z,aa.axis.x,aa.axis.y,aa.axis.z,aa.angle); return returnBuffer; } void ShapeBaseData::packData(BitStream* stream) { Parent::packData(stream); if(stream->writeFlag(computeCRC)) stream->write(mCRC); stream->writeFlag(shadowEnable); stream->writeFlag(shadowCanMove); stream->writeFlag(shadowCanAnimate); stream->writeString(shapeName); stream->writeString(cloakTexName); if(stream->writeFlag(mass != gShapeBaseDataProto.mass)) stream->write(mass); if(stream->writeFlag(drag != gShapeBaseDataProto.drag)) stream->write(drag); if(stream->writeFlag(density != gShapeBaseDataProto.density)) stream->write(density); if(stream->writeFlag(maxEnergy != gShapeBaseDataProto.maxEnergy)) stream->write(maxEnergy); if(stream->writeFlag(cameraMaxDist != gShapeBaseDataProto.cameraMaxDist)) stream->write(cameraMaxDist); if(stream->writeFlag(cameraMinDist != gShapeBaseDataProto.cameraMinDist)) stream->write(cameraMinDist); cameraDefaultFov = mClampF(cameraDefaultFov, cameraMinFov, cameraMaxFov); if(stream->writeFlag(cameraDefaultFov != gShapeBaseDataProto.cameraDefaultFov)) stream->write(cameraDefaultFov); if(stream->writeFlag(cameraMinFov != gShapeBaseDataProto.cameraMinFov)) stream->write(cameraMinFov); if(stream->writeFlag(cameraMaxFov != gShapeBaseDataProto.cameraMaxFov)) stream->write(cameraMaxFov); stream->writeString( debrisShapeName ); stream->writeFlag(observeThroughObject); if( stream->writeFlag( debris != NULL ) ) { stream->writeRangedU32(packed? SimObjectId(debris): debris->getId(),DataBlockObjectIdFirst,DataBlockObjectIdLast); } stream->writeFlag(emap); stream->writeFlag(isInvincible); stream->writeFlag(renderWhenDestroyed); if( stream->writeFlag( explosion != NULL ) ) { stream->writeRangedU32( explosion->getId(), DataBlockObjectIdFirst, DataBlockObjectIdLast ); } if( stream->writeFlag( underwaterExplosion != NULL ) ) { stream->writeRangedU32( underwaterExplosion->getId(), DataBlockObjectIdFirst, DataBlockObjectIdLast ); } stream->writeFlag(inheritEnergyFromMount); stream->writeFlag(firstPersonOnly); stream->writeFlag(useEyePoint); } void ShapeBaseData::unpackData(BitStream* stream) { Parent::unpackData(stream); computeCRC = stream->readFlag(); if(computeCRC) stream->read(&mCRC); shadowEnable = stream->readFlag(); shadowCanMove = stream->readFlag(); shadowCanAnimate = stream->readFlag(); shapeName = stream->readSTString(); cloakTexName = stream->readSTString(); if(stream->readFlag()) stream->read(&mass); else mass = gShapeBaseDataProto.mass; if(stream->readFlag()) stream->read(&drag); else drag = gShapeBaseDataProto.drag; if(stream->readFlag()) stream->read(&density); else density = gShapeBaseDataProto.density; if(stream->readFlag()) stream->read(&maxEnergy); else maxEnergy = gShapeBaseDataProto.maxEnergy; if(stream->readFlag()) stream->read(&cameraMaxDist); else cameraMaxDist = gShapeBaseDataProto.cameraMaxDist; if(stream->readFlag()) stream->read(&cameraMinDist); else cameraMinDist = gShapeBaseDataProto.cameraMinDist; if(stream->readFlag()) stream->read(&cameraDefaultFov); else cameraDefaultFov = gShapeBaseDataProto.cameraDefaultFov; if(stream->readFlag()) stream->read(&cameraMinFov); else cameraMinFov = gShapeBaseDataProto.cameraMinFov; if(stream->readFlag()) stream->read(&cameraMaxFov); else cameraMaxFov = gShapeBaseDataProto.cameraMaxFov; debrisShapeName = stream->readSTString(); observeThroughObject = stream->readFlag(); if( stream->readFlag() ) { debrisID = stream->readRangedU32( DataBlockObjectIdFirst, DataBlockObjectIdLast ); } emap = stream->readFlag(); isInvincible = stream->readFlag(); renderWhenDestroyed = stream->readFlag(); if( stream->readFlag() ) { explosionID = stream->readRangedU32( DataBlockObjectIdFirst, DataBlockObjectIdLast ); } if( stream->readFlag() ) { underwaterExplosionID = stream->readRangedU32( DataBlockObjectIdFirst, DataBlockObjectIdLast ); } inheritEnergyFromMount = stream->readFlag(); firstPersonOnly = stream->readFlag(); useEyePoint = stream->readFlag(); } //---------------------------------------------------------------------------- //---------------------------------------------------------------------------- Chunker<ShapeBase::CollisionTimeout> sTimeoutChunker; ShapeBase::CollisionTimeout* ShapeBase::sFreeTimeoutList = 0; //---------------------------------------------------------------------------- IMPLEMENT_CO_NETOBJECT_V1(ShapeBase); ShapeBase::ShapeBase() { mTypeMask |= ShapeBaseObjectType; mDrag = 0; mBuoyancy = 0; mWaterCoverage = 0; mLiquidType = 0; mLiquidHeight = 0.0f; //mControllingClient = 0; mControllingObject = 0; mGravityMod = 1.0; mAppliedForce.set(0, 0, 0); mTimeoutList = 0; mDataBlock = NULL; mShapeInstance = 0; mEnergy = 0; mRechargeRate = 0; mDamage = 0; mRepairRate = 0; mRepairReserve = 0; mDamageState = Enabled; mDamageThread = 0; mHulkThread = 0; mLastRenderFrame = 0; mLastRenderDistance = 0; mCloaked = false; mCloakLevel = 0.0; mMount.object = 0; mMount.link = 0; mMount.list = 0; mHidden = false; for (int a = 0; a < MaxSoundThreads; a++) { mSoundThread[a].play = false; mSoundThread[a].profile = 0; mSoundThread[a].sound = 0; } S32 i; for (i = 0; i < MaxScriptThreads; i++) { mScriptThread[i].sequence = -1; mScriptThread[i].thread = 0; mScriptThread[i].sound = 0; mScriptThread[i].state = Thread::Stop; mScriptThread[i].atEnd = false; mScriptThread[i].forward = true; } for (i = 0; i < MaxTriggerKeys; i++) mTrigger[i] = false; mDamageFlash = 0.0; mWhiteOut = 0.0; mInvincibleEffect = 0.0f; mInvincibleDelta = 0.0f; mInvincibleCount = 0.0f; mInvincibleSpeed = 0.0f; mInvincibleTime = 0.0f; mInvincibleFade = 0.1; mInvincibleOn = false; mIsControlled = false; mConvexList = new Convex; mCameraFov = 90.f; mShieldNormal.set(0, 0, 1); mFadeOut = true; mFading = false; mFadeVal = 1.0; mFadeTime = 1.0; mFadeElapsedTime = 0.0; mFadeDelay = 0.0; mFlipFadeVal = false; mLightTime = 0; damageDir.set(0, 0, 1); } ShapeBase::~ShapeBase() { delete mConvexList; mConvexList = NULL; AssertFatal(mMount.link == 0,"ShapeBase::~ShapeBase: An object is still mounted"); if( mShapeInstance && (mShapeInstance->getDebrisRefCount() == 0) ) { delete mShapeInstance; } CollisionTimeout* ptr = mTimeoutList; while (ptr) { CollisionTimeout* cur = ptr; ptr = ptr->next; cur->next = sFreeTimeoutList; sFreeTimeoutList = cur; } } //---------------------------------------------------------------------------- bool ShapeBase::onAdd() { if(!Parent::onAdd()) return false; // Resolve sounds that arrived in the initial update S32 i; for (i = 0; i < MaxSoundThreads; i++) updateAudioState(mSoundThread[i]); for (i = 0; i < MaxScriptThreads; i++) { Thread& st = mScriptThread[i]; if(st.thread) updateThread(st); } if (isClientObject()) { if(mDataBlock->cloakTexName != StringTable->insert("")) mCloakTexture = TextureHandle(mDataBlock->cloakTexName, MeshTexture, false); //one of the mounted images must have a light source... for (S32 i = 0; i < MaxMountedImages; i++) { ShapeBaseImageData* imageData = getMountedImage(i); if (imageData != NULL && imageData->lightType != ShapeBaseImageData::NoLight) { Sim::getLightSet()->addObject(this); break; } } } return true; } void ShapeBase::onRemove() { mConvexList->nukeList(); unmount(); Parent::onRemove(); // Stop any running sounds on the client if (isGhost()) for (S32 i = 0; i < MaxSoundThreads; i++) stopAudio(i); } void ShapeBase::onSceneRemove() { mConvexList->nukeList(); Parent::onSceneRemove(); } bool ShapeBase::onNewDataBlock(GameBaseData* dptr) { if (Parent::onNewDataBlock(dptr) == false) return false; mDataBlock = dynamic_cast<ShapeBaseData*>(dptr); if (!mDataBlock) return false; setMaskBits(DamageMask); mDamageThread = 0; mHulkThread = 0; // Even if loadShape succeeds, there may not actually be // a shape assigned to this object. if (bool(mDataBlock->shape)) { delete mShapeInstance; mShapeInstance = new TSShapeInstance(mDataBlock->shape, isClientObject()); if (isClientObject()) mShapeInstance->cloneMaterialList(); mObjBox = mDataBlock->shape->bounds; resetWorldBox(); // Initialize the threads for (U32 i = 0; i < MaxScriptThreads; i++) { Thread& st = mScriptThread[i]; if (st.sequence != -1) { // TG: Need to see about supressing non-cyclic sounds // if the sequences were actived before the object was // ghosted. // TG: Cyclic animations need to have a random pos if // they were started before the object was ghosted. // If there was something running on the old shape, the thread // needs to be reset. Otherwise we assume that it's been // initialized either by the constructor or from the server. bool reset = st.thread != 0; st.thread = 0; setThreadSequence(i,st.sequence,reset); } } if (mDataBlock->damageSequence != -1) { mDamageThread = mShapeInstance->addThread(); mShapeInstance->setSequence(mDamageThread, mDataBlock->damageSequence,0); } if (mDataBlock->hulkSequence != -1) { mHulkThread = mShapeInstance->addThread(); mShapeInstance->setSequence(mHulkThread, mDataBlock->hulkSequence,0); } } if (isGhost() && mSkinNameHandle.isValidString() && mShapeInstance) { mShapeInstance->reSkin(mSkinNameHandle); mSkinHash = _StringTable::hashString(mSkinNameHandle.getString()); } // mEnergy = 0; mDamage = 0; mDamageState = Enabled; mRepairReserve = 0; updateMass(); updateDamageLevel(); updateDamageState(); mDrag = mDataBlock->drag; mCameraFov = mDataBlock->cameraDefaultFov; return true; } void ShapeBase::onDeleteNotify(SimObject* obj) { if (obj == getProcessAfter()) clearProcessAfter(); Parent::onDeleteNotify(obj); if (obj == mMount.object) unmount(); } void ShapeBase::onImpact(SceneObject* obj, VectorF vec) { if (!isGhost()) { char buff1[256]; char buff2[32]; dSprintf(buff1,sizeof(buff1),"%g %g %g",vec.x, vec.y, vec.z); dSprintf(buff2,sizeof(buff2),"%g",vec.len()); Con::executef(mDataBlock,5,"onImpact",scriptThis(), obj->getIdString(), buff1, buff2); } } void ShapeBase::onImpact(VectorF vec) { if (!isGhost()) { char buff1[256]; char buff2[32]; dSprintf(buff1,sizeof(buff1),"%g %g %g",vec.x, vec.y, vec.z); dSprintf(buff2,sizeof(buff2),"%g",vec.len()); Con::executef(mDataBlock,5,"onImpact",scriptThis(), "0", buff1, buff2); } } //---------------------------------------------------------------------------- void ShapeBase::processTick(const Move* move) { // Energy management if (mDamageState == Enabled && mDataBlock->inheritEnergyFromMount == false) { F32 store = mEnergy; mEnergy += mRechargeRate; if (mEnergy > mDataBlock->maxEnergy) mEnergy = mDataBlock->maxEnergy; else if (mEnergy < 0) mEnergy = 0; // Virtual setEnergyLevel is used here by some derived classes to // decide whether they really want to set the energy mask bit. if (mEnergy != store) setEnergyLevel(mEnergy); } // Repair management if (mDataBlock->isInvincible == false) { F32 store = mDamage; mDamage -= mRepairRate; mDamage = mClampF(mDamage, 0.f, mDataBlock->maxDamage); if (mRepairReserve > mDamage) mRepairReserve = mDamage; if (mRepairReserve > 0.0) { F32 rate = getMin(mDataBlock->repairRate, mRepairReserve); mDamage -= rate; mRepairReserve -= rate; } if (store != mDamage) { updateDamageLevel(); if (isServerObject()) { char delta[100]; dSprintf(delta,sizeof(delta),"%g",mDamage - store); setMaskBits(DamageMask); Con::executef(mDataBlock,3,"onDamage",scriptThis(),delta); } } } if (isServerObject()) { // Server only... advanceThreads(TickSec); updateServerAudio(); // update wet state setImageWetState(0, mWaterCoverage > 0.4); // more than 40 percent covered if(mFading) { F32 dt = TickMs / 1000.0; F32 newFadeET = mFadeElapsedTime + dt; if(mFadeElapsedTime < mFadeDelay && newFadeET >= mFadeDelay) setMaskBits(CloakMask); mFadeElapsedTime = newFadeET; if(mFadeElapsedTime > mFadeTime + mFadeDelay) { mFadeVal = F32(!mFadeOut); mFading = false; } } } // Advance images for (int i = 0; i < MaxMountedImages; i++) { if (mMountedImageList[i].dataBlock != NULL) updateImageState(i, TickSec); } // Call script on trigger state changes if (move && mDataBlock && isServerObject()) { for (S32 i = 0; i < MaxTriggerKeys; i++) { if (move->trigger[i] != mTrigger[i]) { mTrigger[i] = move->trigger[i]; char buf1[20],buf2[20]; dSprintf(buf1,sizeof(buf1),"%d",i); dSprintf(buf2,sizeof(buf2),"%d",(move->trigger[i]?1:0)); Con::executef(mDataBlock,4,"onTrigger",scriptThis(),buf1,buf2); } } } // Update the damage flash and the whiteout // if (mDamageFlash > 0.0) { mDamageFlash -= sDamageFlashDec; if (mDamageFlash <= 0.0) mDamageFlash = 0.0; } if (mWhiteOut > 0.0) { mWhiteOut -= sWhiteoutDec; if (mWhiteOut <= 0.0) mWhiteOut = 0.0; } } void ShapeBase::advanceTime(F32 dt) { // On the client, the shape threads and images are // advanced at framerate. advanceThreads(dt); updateAudioPos(); for (int i = 0; i < MaxMountedImages; i++) if (mMountedImageList[i].dataBlock) updateImageAnimation(i,dt); // Cloaking takes 0.5 seconds if (mCloaked && mCloakLevel != 1.0) { mCloakLevel += dt * 2; if (mCloakLevel >= 1.0) mCloakLevel = 1.0; } else if (!mCloaked && mCloakLevel != 0.0) { mCloakLevel -= dt * 2; if (mCloakLevel <= 0.0) mCloakLevel = 0.0; } if(mInvincibleOn) updateInvincibleEffect(dt); if(mFading) { mFadeElapsedTime += dt; if(mFadeElapsedTime > mFadeTime) { mFadeVal = F32(!mFadeOut); mFading = false; } else { mFadeVal = mFadeElapsedTime / mFadeTime; if(mFadeOut) mFadeVal = 1 - mFadeVal; } } } //---------------------------------------------------------------------------- //void ShapeBase::setControllingClient(GameConnection* client) //{ // mControllingClient = client; // // // piggybacks on the cloak update // setMaskBits(CloakMask); //} void ShapeBase::setControllingObject(ShapeBase* obj) { if (obj) { setProcessTick(false); // Even though we don't processTick, we still need to // process after the controller in case anyone is mounted // on this object. processAfter(obj); } else { setProcessTick(true); clearProcessAfter(); // Catch the case of the controlling object actually // mounted on this object. if (mControllingObject->mMount.object == this) mControllingObject->processAfter(this); } mControllingObject = obj; } ShapeBase* ShapeBase::getControlObject() { return 0; } void ShapeBase::setControlObject(ShapeBase*) { } bool ShapeBase::isFirstPerson() { // Always first person as far as the server is concerned. if (!isGhost()) return true; if (GameConnection* con = getControllingClient()) return con->getControlObject() == this && con->isFirstPerson(); return false; } // Camera: (in degrees) ------------------------------------------------------ F32 ShapeBase::getCameraFov() { return(mCameraFov); } F32 ShapeBase::getDefaultCameraFov() { return(mDataBlock->cameraDefaultFov); } bool ShapeBase::isValidCameraFov(F32 fov) { return((fov >= mDataBlock->cameraMinFov) && (fov <= mDataBlock->cameraMaxFov)); } void ShapeBase::setCameraFov(F32 fov) { mCameraFov = mClampF(fov, mDataBlock->cameraMinFov, mDataBlock->cameraMaxFov); } //---------------------------------------------------------------------------- static void scopeCallback(SceneObject* obj, void *conPtr) { NetConnection * ptr = reinterpret_cast<NetConnection*>(conPtr); if (obj->isScopeable()) ptr->objectInScope(obj); } void ShapeBase::onCameraScopeQuery(NetConnection *cr, CameraScopeQuery * query) { // update the camera query query->camera = this; // bool grabEye = true; if(GameConnection * con = dynamic_cast<GameConnection*>(cr)) { // get the fov from the connection (in deg) F32 fov; if (con->getControlCameraFov(&fov)) { query->fov = mDegToRad(fov/2); query->sinFov = mSin(query->fov); query->cosFov = mCos(query->fov); } } // failed to query the camera info? // if(grabEye) LH - always use eye as good enough, avoid camera animate { MatrixF eyeTransform; getEyeTransform(&eyeTransform); eyeTransform.getColumn(3, &query->pos); eyeTransform.getColumn(1, &query->orientation); } // grab the visible distance from the sky Sky * sky = gServerSceneGraph->getCurrentSky(); if(sky) query->visibleDistance = sky->getVisibleDistance(); else query->visibleDistance = 1000.f; // First, we are certainly in scope, and whatever we're riding is too... cr->objectInScope(this); if (isMounted()) cr->objectInScope(mMount.object); if (mSceneManager == NULL) { // Scope everything... gServerContainer.findObjects(0xFFFFFFFF,scopeCallback,cr); return; } // update the scenemanager mSceneManager->scopeScene(query->pos, query->visibleDistance, cr); // let the (game)connection do some scoping of its own (commandermap...) cr->doneScopingScene(); } //---------------------------------------------------------------------------- F32 ShapeBase::getEnergyLevel() { if (mDataBlock->inheritEnergyFromMount == false) return mEnergy; else if (isMounted()) { return getObjectMount()->getEnergyLevel(); } else { return 0.0f; } } F32 ShapeBase::getEnergyValue() { if (mDataBlock->inheritEnergyFromMount == false) { F32 maxEnergy = mDataBlock->maxEnergy; if ( maxEnergy > 0.f ) return (mEnergy / mDataBlock->maxEnergy); } else if (isMounted()) { F32 maxEnergy = getObjectMount()->mDataBlock->maxEnergy; if ( maxEnergy > 0.f ) return (getObjectMount()->getEnergyLevel() / maxEnergy); } return 0.0f; } void ShapeBase::setEnergyLevel(F32 energy) { if (mDataBlock->inheritEnergyFromMount == false) { if (mDamageState == Enabled) { mEnergy = (energy > mDataBlock->maxEnergy)? mDataBlock->maxEnergy: (energy < 0)? 0: energy; } } else { // Pass the set onto whatever we're mounted to... if (isMounted()) getObjectMount()->setEnergyLevel(energy); } } void ShapeBase::setDamageLevel(F32 damage) { if (!mDataBlock->isInvincible) { F32 store = mDamage; mDamage = mClampF(damage, 0.f, mDataBlock->maxDamage); if (store != mDamage) { updateDamageLevel(); if (isServerObject()) { setMaskBits(DamageMask); char delta[100]; dSprintf(delta,sizeof(delta),"%g",mDamage - store); Con::executef(mDataBlock,3,"onDamage",scriptThis(),delta); } } } } //---------------------------------------------------------------------------- static F32 sWaterDensity = 1; static F32 sWaterViscosity = 15; static F32 sWaterCoverage = 0; static U32 sWaterType = 0; static F32 sWaterHeight = 0.0f; static void waterFind(SceneObject* obj, void* key) { ShapeBase* shape = reinterpret_cast<ShapeBase*>(key); WaterBlock* wb = dynamic_cast<WaterBlock*>(obj); AssertFatal(wb != NULL, "Error, not a water block!"); if (wb == NULL) { sWaterCoverage = 0; return; } if (wb->isPointSubmergedSimple(shape->getPosition())) { const Box3F& wbox = obj->getWorldBox(); const Box3F& sbox = shape->getWorldBox(); sWaterType = wb->getLiquidType(); if (wbox.max.z < sbox.max.z) sWaterCoverage = (wbox.max.z - sbox.min.z) / (sbox.max.z - sbox.min.z); else sWaterCoverage = 1; sWaterViscosity = wb->getViscosity(); sWaterDensity = wb->getDensity(); sWaterHeight = wb->getSurfaceHeight(); } } void physicalZoneFind(SceneObject* obj, void *key) { ShapeBase* shape = reinterpret_cast<ShapeBase*>(key); PhysicalZone* pz = dynamic_cast<PhysicalZone*>(obj); AssertFatal(pz != NULL, "Error, not a physical zone!"); if (pz == NULL || pz->testObject(shape) == false) { return; } if (pz->isActive()) { shape->mGravityMod *= pz->getGravityMod(); shape->mAppliedForce += pz->getForce(); } } void findRouter(SceneObject* obj, void *key) { if (obj->getTypeMask() & WaterObjectType) waterFind(obj, key); else if (obj->getTypeMask() & PhysicalZoneObjectType) physicalZoneFind(obj, key); else { AssertFatal(false, "Error, must be either water or physical zone here!"); } } void ShapeBase::updateContainer() { // Update container drag and buoyancy properties mDrag = mDataBlock->drag; mBuoyancy = 0; sWaterCoverage = 0; mGravityMod = 1.0; mAppliedForce.set(0, 0, 0); mContainer->findObjects(getWorldBox(), WaterObjectType|PhysicalZoneObjectType,findRouter,this); sWaterCoverage = mClampF(sWaterCoverage,0,1); mWaterCoverage = sWaterCoverage; mLiquidType = sWaterType; mLiquidHeight = sWaterHeight; if (mWaterCoverage >= 0.1f) { mDrag = mDataBlock->drag * sWaterViscosity * sWaterCoverage; mBuoyancy = (sWaterDensity / mDataBlock->density) * sWaterCoverage; } } //---------------------------------------------------------------------------- void ShapeBase::applyRepair(F32 amount) { // Repair increases the repair reserve if (amount > 0 && ((mRepairReserve += amount) > mDamage)) mRepairReserve = mDamage; } void ShapeBase::applyDamage(F32 amount) { if (amount > 0) setDamageLevel(mDamage + amount); } F32 ShapeBase::getDamageValue() { // Return a 0-1 damage value. return mDamage / mDataBlock->maxDamage; } void ShapeBase::updateDamageLevel() { if (mDamageThread) { // mDamage is already 0-1 on the client if (mDamage >= mDataBlock->destroyedLevel) { if (getDamageState() == Destroyed) mShapeInstance->setPos(mDamageThread, 0); else mShapeInstance->setPos(mDamageThread, 1); } else { mShapeInstance->setPos(mDamageThread, mDamage / mDataBlock->destroyedLevel); } } } //---------------------------------------------------------------------------- void ShapeBase::setDamageState(DamageState state) { if (mDamageState == state) return; const char* script = 0; const char* lastState = 0; if (!isGhost()) { if (state != getDamageState()) setMaskBits(DamageMask); lastState = getDamageStateName(); switch (state) { case Destroyed: { if (mDamageState == Enabled) setDamageState(Disabled); script = "onDestroyed"; break; } case Disabled: if (mDamageState == Enabled) script = "onDisabled"; break; case Enabled: script = "onEnabled"; break; } } mDamageState = state; if (mDamageState != Enabled) { mRepairReserve = 0; mEnergy = 0; } if (script) { // Like to call the scripts after the state has been intialize. // This should only end up being called on the server. Con::executef(mDataBlock,3,script,scriptThis(),lastState); } updateDamageState(); updateDamageLevel(); } bool ShapeBase::setDamageState(const char* state) { for (S32 i = 0; i < NumDamageStates; i++) if (!dStricmp(state,sDamageStateName[i])) { setDamageState(DamageState(i)); return true; } return false; } const char* ShapeBase::getDamageStateName() { return sDamageStateName[mDamageState]; } void ShapeBase::updateDamageState() { if (mHulkThread) { F32 pos = (mDamageState == Destroyed)? 1: 0; if (mShapeInstance->getPos(mHulkThread) != pos) { mShapeInstance->setPos(mHulkThread,pos); if (isClientObject()) mShapeInstance->animate(); } } } //---------------------------------------------------------------------------- void ShapeBase::blowUp() { Point3F center; mObjBox.getCenter(&center); center += getPosition(); MatrixF trans = getTransform(); trans.setPosition( center ); // explode Explosion* pExplosion = NULL; if( pointInWater( (Point3F &)center ) && mDataBlock->underwaterExplosion ) { pExplosion = new Explosion; pExplosion->onNewDataBlock(mDataBlock->underwaterExplosion); } else { if (mDataBlock->explosion) { pExplosion = new Explosion; pExplosion->onNewDataBlock(mDataBlock->explosion); } } if( pExplosion ) { pExplosion->setTransform(trans); pExplosion->setInitialState(center, damageDir); if (pExplosion->registerObject() == false) { Con::errorf(ConsoleLogEntry::General, "ShapeBase(%s)::explode: couldn't register explosion", mDataBlock->getName() ); delete pExplosion; pExplosion = NULL; } } TSShapeInstance *debShape = NULL; if( mDataBlock->debrisShape.isNull() ) { return; } else { debShape = new TSShapeInstance( mDataBlock->debrisShape, true); } Vector< TSPartInstance * > partList; TSPartInstance::breakShape( debShape, 0, partList, NULL, NULL, 0 ); if( !mDataBlock->debris ) { mDataBlock->debris = new DebrisData; } // cycle through partlist and create debris pieces for( U32 i=0; i<partList.size(); i++ ) { //Point3F axis( 0.0, 0.0, 1.0 ); Point3F randomDir = MathUtils::randomDir( damageDir, 0, 50 ); Debris *debris = new Debris; debris->setPartInstance( partList[i] ); debris->init( center, randomDir ); debris->onNewDataBlock( mDataBlock->debris ); debris->setTransform( trans ); if( !debris->registerObject() ) { Con::warnf( ConsoleLogEntry::General, "Could not register debris for class: %s", mDataBlock->getName() ); delete debris; debris = NULL; } else { debShape->incDebrisRefCount(); } } damageDir.set(0, 0, 1); } //---------------------------------------------------------------------------- void ShapeBase::mountObject(ShapeBase* obj,U32 node) { // if (obj->mMount.object == this) // return; if (obj->mMount.object) obj->unmount(); // Since the object is mounting to us, nothing should be colliding with it for a while obj->mConvexList->nukeList(); obj->mMount.object = this; obj->mMount.node = (node >= 0 && node < ShapeBaseData::NumMountPoints)? node: 0; obj->mMount.link = mMount.list; mMount.list = obj; if (obj != getControllingObject()) obj->processAfter(this); obj->deleteNotify(this); obj->setMaskBits(MountedMask); obj->onMount(this,node); } void ShapeBase::unmountObject(ShapeBase* obj) { if (obj->mMount.object == this) { // Find and unlink the object for(ShapeBase **ptr = & mMount.list; (*ptr); ptr = &((*ptr)->mMount.link) ) { if(*ptr == obj) { *ptr = obj->mMount.link; break; } } if (obj != getControllingObject()) obj->clearProcessAfter(); obj->clearNotify(this); obj->mMount.object = 0; obj->mMount.link = 0; obj->setMaskBits(MountedMask); obj->onUnmount(this,obj->mMount.node); } } void ShapeBase::unmount() { if (mMount.object) mMount.object->unmountObject(this); } void ShapeBase::onMount(ShapeBase* obj,S32 node) { if (!isGhost()) { char buff1[32]; dSprintf(buff1,sizeof(buff1),"%d",node); Con::executef(mDataBlock,4,"onMount",scriptThis(),obj->scriptThis(),buff1); } } void ShapeBase::onUnmount(ShapeBase* obj,S32 node) { if (!isGhost()) { char buff1[32]; dSprintf(buff1,sizeof(buff1),"%d",node); Con::executef(mDataBlock,4,"onUnmount",scriptThis(),obj->scriptThis(),buff1); } } S32 ShapeBase::getMountedObjectCount() { S32 count = 0; for (ShapeBase* itr = mMount.list; itr; itr = itr->mMount.link) count++; return count; } ShapeBase* ShapeBase::getMountedObject(S32 idx) { if (idx >= 0) { S32 count = 0; for (ShapeBase* itr = mMount.list; itr; itr = itr->mMount.link) if (count++ == idx) return itr; } return 0; } S32 ShapeBase::getMountedObjectNode(S32 idx) { if (idx >= 0) { S32 count = 0; for (ShapeBase* itr = mMount.list; itr; itr = itr->mMount.link) if (count++ == idx) return itr->mMount.node; } return -1; } ShapeBase* ShapeBase::getMountNodeObject(S32 node) { for (ShapeBase* itr = mMount.list; itr; itr = itr->mMount.link) if (itr->mMount.node == node) return itr; return 0; } Point3F ShapeBase::getAIRepairPoint() { if (mDataBlock->mountPointNode[ShapeBaseData::AIRepairNode] < 0) return Point3F(0, 0, 0); MatrixF xf(true); getMountTransform(ShapeBaseData::AIRepairNode,&xf); Point3F pos(0, 0, 0); xf.getColumn(3,&pos); return pos; } //---------------------------------------------------------------------------- void ShapeBase::getEyeTransform(MatrixF* mat) { // Returns eye to world space transform S32 eyeNode = mDataBlock->eyeNode; if (eyeNode != -1) mat->mul(getTransform(), mShapeInstance->mNodeTransforms[eyeNode]); else *mat = getTransform(); } void ShapeBase::getRenderEyeTransform(MatrixF* mat) { // Returns eye to world space transform S32 eyeNode = mDataBlock->eyeNode; if (eyeNode != -1) mat->mul(getRenderTransform(), mShapeInstance->mNodeTransforms[eyeNode]); else *mat = getRenderTransform(); } void ShapeBase::getCameraTransform(F32* pos,MatrixF* mat) { // Returns camera to world space transform // Handles first person / third person camera position if (isServerObject() && mShapeInstance) mShapeInstance->animateNodeSubtrees(true); if (*pos != 0) { F32 min,max; Point3F offset; MatrixF eye,rot; getCameraParameters(&min,&max,&offset,&rot); getRenderEyeTransform(&eye); mat->mul(eye,rot); // Use the eye transform to orient the camera VectorF vp,vec; vp.x = vp.z = 0; vp.y = -(max - min) * *pos; eye.mulV(vp,&vec); // Use the camera node's pos. Point3F osp,sp; if (mDataBlock->cameraNode != -1) { mShapeInstance->mNodeTransforms[mDataBlock->cameraNode].getColumn(3,&osp); // Scale the camera position before applying the transform const Point3F& scale = getScale(); osp.convolve( scale ); getRenderTransform().mulP(osp,&sp); } else getRenderTransform().getColumn(3,&sp); // Make sure we don't extend the camera into anything solid Point3F ep = sp + vec + offset; disableCollision(); if (isMounted()) getObjectMount()->disableCollision(); RayInfo collision; if (mContainer->castRay(sp, ep, (0xFFFFFFFF & ~(WaterObjectType | GameBaseObjectType | DefaultObjectType)), &collision) == true) { F32 veclen = vec.len(); F32 adj = (-mDot(vec, collision.normal) / veclen) * 0.1; F32 newPos = getMax(0.0f, collision.t - adj); if (newPos == 0.0f) eye.getColumn(3,&ep); else ep = sp + offset + (vec * newPos); } mat->setColumn(3,ep); if (isMounted()) getObjectMount()->enableCollision(); enableCollision(); } else { getRenderEyeTransform(mat); } } // void ShapeBase::getCameraTransform(F32* pos,MatrixF* mat) // { // // Returns camera to world space transform // // Handles first person / third person camera position // if (isServerObject() && mShapeInstance) // mShapeInstance->animateNodeSubtrees(true); // if (*pos != 0) { // F32 min,max; // Point3F offset; // MatrixF eye,rot; // getCameraParameters(&min,&max,&offset,&rot); // getRenderEyeTransform(&eye); // mat->mul(eye,rot); // // Use the eye transform to orient the camera // VectorF vp,vec; // vp.x = vp.z = 0; // vp.y = -(max - min) * *pos; // eye.mulV(vp,&vec); // // Use the camera node's pos. // Point3F osp,sp; // if (mDataBlock->cameraNode != -1) { // mShapeInstance->mNodeTransforms[mDataBlock->cameraNode].getColumn(3,&osp); // getRenderTransform().mulP(osp,&sp); // } // else // getRenderTransform().getColumn(3,&sp); // // Make sure we don't extend the camera into anything solid // Point3F ep = sp + vec; // ep += offset; // disableCollision(); // if (isMounted()) // getObjectMount()->disableCollision(); // RayInfo collision; // if (mContainer->castRay(sp,ep,(0xFFFFFFFF & ~(WaterObjectType|ForceFieldObjectType|GameBaseObjectType|DefaultObjectType)),&collision)) { // *pos = collision.t *= 0.9; // if (*pos == 0) // eye.getColumn(3,&ep); // else // ep = sp + vec * *pos; // } // mat->setColumn(3,ep); // if (isMounted()) // getObjectMount()->enableCollision(); // enableCollision(); // } // else // { // getRenderEyeTransform(mat); // } // } // void ShapeBase::getRenderCameraTransform(F32* pos,MatrixF* mat) // { // // Returns camera to world space transform // // Handles first person / third person camera position // if (isServerObject() && mShapeInstance) // mShapeInstance->animateNodeSubtrees(true); // if (*pos != 0) { // F32 min,max; // Point3F offset; // MatrixF eye,rot; // getCameraParameters(&min,&max,&offset,&rot); // getRenderEyeTransform(&eye); // mat->mul(eye,rot); // // Use the eye transform to orient the camera // VectorF vp,vec; // vp.x = vp.z = 0; // vp.y = -(max - min) * *pos; // eye.mulV(vp,&vec); // // Use the camera node's pos. // Point3F osp,sp; // if (mDataBlock->cameraNode != -1) { // mShapeInstance->mNodeTransforms[mDataBlock->cameraNode].getColumn(3,&osp); // getRenderTransform().mulP(osp,&sp); // } // else // getRenderTransform().getColumn(3,&sp); // // Make sure we don't extend the camera into anything solid // Point3F ep = sp + vec; // ep += offset; // disableCollision(); // if (isMounted()) // getObjectMount()->disableCollision(); // RayInfo collision; // if (mContainer->castRay(sp,ep,(0xFFFFFFFF & ~(WaterObjectType|ForceFieldObjectType|GameBaseObjectType|DefaultObjectType)),&collision)) { // *pos = collision.t *= 0.9; // if (*pos == 0) // eye.getColumn(3,&ep); // else // ep = sp + vec * *pos; // } // mat->setColumn(3,ep); // if (isMounted()) // getObjectMount()->enableCollision(); // enableCollision(); // } // else // { // getRenderEyeTransform(mat); // } // } void ShapeBase::getCameraParameters(F32 *min,F32* max,Point3F* off,MatrixF* rot) { *min = mDataBlock->cameraMinDist; *max = mDataBlock->cameraMaxDist; off->set(0,0,0); rot->identity(); } //---------------------------------------------------------------------------- F32 ShapeBase::getDamageFlash() const { return mDamageFlash; } void ShapeBase::setDamageFlash(const F32 flash) { mDamageFlash = flash; if (mDamageFlash < 0.0) mDamageFlash = 0; else if (mDamageFlash > 1.0) mDamageFlash = 1.0; } //---------------------------------------------------------------------------- F32 ShapeBase::getWhiteOut() const { return mWhiteOut; } void ShapeBase::setWhiteOut(const F32 flash) { mWhiteOut = flash; if (mWhiteOut < 0.0) mWhiteOut = 0; else if (mWhiteOut > 1.5) mWhiteOut = 1.5; } //---------------------------------------------------------------------------- bool ShapeBase::onlyFirstPerson() const { return mDataBlock->firstPersonOnly; } bool ShapeBase::useObjsEyePoint() const { return mDataBlock->useEyePoint; } //---------------------------------------------------------------------------- F32 ShapeBase::getInvincibleEffect() const { return mInvincibleEffect; } void ShapeBase::setupInvincibleEffect(F32 time, F32 speed) { if(isClientObject()) { mInvincibleCount = mInvincibleTime = time; mInvincibleSpeed = mInvincibleDelta = speed; mInvincibleEffect = 0.0f; mInvincibleOn = true; mInvincibleFade = 1.0f; } else { mInvincibleTime = time; mInvincibleSpeed = speed; setMaskBits(InvincibleMask); } } void ShapeBase::updateInvincibleEffect(F32 dt) { if(mInvincibleCount > 0.0f ) { if(mInvincibleEffect >= ((0.3 * mInvincibleFade) + 0.05f) && mInvincibleDelta > 0.0f) mInvincibleDelta = -mInvincibleSpeed; else if(mInvincibleEffect <= 0.05f && mInvincibleDelta < 0.0f) { mInvincibleDelta = mInvincibleSpeed; mInvincibleFade = mInvincibleCount / mInvincibleTime; } mInvincibleEffect += mInvincibleDelta; mInvincibleCount -= dt; } else { mInvincibleEffect = 0.0f; mInvincibleOn = false; } } //---------------------------------------------------------------------------- void ShapeBase::setVelocity(const VectorF&) { } void ShapeBase::applyImpulse(const Point3F&,const VectorF&) { } //---------------------------------------------------------------------------- void ShapeBase::playAudio(U32 slot,AudioProfile* profile) { AssertFatal(slot < MaxSoundThreads,"ShapeBase::playSound: Incorrect argument"); Sound& st = mSoundThread[slot]; if (profile && (!st.play || st.profile != profile)) { setMaskBits(SoundMaskN << slot); st.play = true; st.profile = profile; updateAudioState(st); } } void ShapeBase::stopAudio(U32 slot) { AssertFatal(slot < MaxSoundThreads,"ShapeBase::stopSound: Incorrect argument"); Sound& st = mSoundThread[slot]; if (st.play) { st.play = false; setMaskBits(SoundMaskN << slot); updateAudioState(st); } } void ShapeBase::updateServerAudio() { // Timeout non-looping sounds for (int i = 0; i < MaxSoundThreads; i++) { Sound& st = mSoundThread[i]; if (st.play && st.timeout && st.timeout < Sim::getCurrentTime()) { clearMaskBits(SoundMaskN << i); st.play = false; } } } void ShapeBase::updateAudioState(Sound& st) { if (st.sound) { alxStop(st.sound); st.sound = 0; } if (st.play && st.profile) { if (isGhost()) { if (Sim::findObject(SimObjectId(st.profile), st.profile)) st.sound = alxPlay(st.profile, &getTransform()); else st.play = false; } else { // Non-looping sounds timeout on the server st.timeout = st.profile->mDescriptionObject->mDescription.mIsLooping? 0: Sim::getCurrentTime() + sAudioTimeout; } } else st.play = false; } void ShapeBase::updateAudioPos() { for (int i = 0; i < MaxSoundThreads; i++) if (AUDIOHANDLE sh = mSoundThread[i].sound) alxSourceMatrixF(sh, &getTransform()); } //---------------------------------------------------------------------------- bool ShapeBase::setThreadSequence(U32 slot,S32 seq,bool reset) { Thread& st = mScriptThread[slot]; if (st.thread && st.sequence == seq && st.state == Thread::Play && !reset) return true; if (seq < MaxSequenceIndex) { setMaskBits(ThreadMaskN << slot); st.sequence = seq; if (reset) { st.state = Thread::Play; st.atEnd = false; st.forward = true; } if (mShapeInstance) { if (!st.thread) st.thread = mShapeInstance->addThread(); mShapeInstance->setSequence(st.thread,seq,0); stopThreadSound(st); updateThread(st); } return true; } return false; } void ShapeBase::updateThread(Thread& st) { switch (st.state) { case Thread::Stop: mShapeInstance->setTimeScale(st.thread,1); mShapeInstance->setPos(st.thread,0); // Drop through to pause state case Thread::Pause: mShapeInstance->setTimeScale(st.thread,0); stopThreadSound(st); break; case Thread::Play: if (st.atEnd) { mShapeInstance->setTimeScale(st.thread,1); mShapeInstance->setPos(st.thread,st.forward? 1: 0); mShapeInstance->setTimeScale(st.thread,0); stopThreadSound(st); } else { mShapeInstance->setTimeScale(st.thread,st.forward? 1: -1); if (!st.sound) startSequenceSound(st); } break; } } bool ShapeBase::stopThread(U32 slot) { Thread& st = mScriptThread[slot]; if (st.sequence != -1 && st.state != Thread::Stop) { setMaskBits(ThreadMaskN << slot); st.state = Thread::Stop; updateThread(st); return true; } return false; } bool ShapeBase::pauseThread(U32 slot) { Thread& st = mScriptThread[slot]; if (st.sequence != -1 && st.state != Thread::Pause) { setMaskBits(ThreadMaskN << slot); st.state = Thread::Pause; updateThread(st); return true; } return false; } bool ShapeBase::playThread(U32 slot) { Thread& st = mScriptThread[slot]; if (st.sequence != -1 && st.state != Thread::Play) { setMaskBits(ThreadMaskN << slot); st.state = Thread::Play; updateThread(st); return true; } return false; } bool ShapeBase::setThreadDir(U32 slot,bool forward) { Thread& st = mScriptThread[slot]; if (st.sequence != -1) { if (st.forward != forward) { setMaskBits(ThreadMaskN << slot); st.forward = forward; st.atEnd = false; updateThread(st); } return true; } return false; } void ShapeBase::stopThreadSound(Thread& thread) { if (thread.sound) { } } void ShapeBase::startSequenceSound(Thread& thread) { if (!isGhost() || !thread.thread) return; stopThreadSound(thread); } void ShapeBase::advanceThreads(F32 dt) { for (U32 i = 0; i < MaxScriptThreads; i++) { Thread& st = mScriptThread[i]; if (st.thread) { if (!mShapeInstance->getShape()->sequences[st.sequence].isCyclic() && !st.atEnd && (st.forward? mShapeInstance->getPos(st.thread) >= 1.0: mShapeInstance->getPos(st.thread) <= 0)) { st.atEnd = true; updateThread(st); if (!isGhost()) { char slot[16]; dSprintf(slot,sizeof(slot),"%d",i); Con::executef(mDataBlock,3,"onEndSequence",scriptThis(),slot); } } mShapeInstance->advanceTime(dt,st.thread); } } } //---------------------------------------------------------------------------- TSShape const* ShapeBase::getShape() { return mShapeInstance? mShapeInstance->getShape(): 0; } void ShapeBase::calcClassRenderData() { // This is truly lame, but I didn't want to duplicate the whole preprender logic // in the player as well as the renderImage logic. DMM } bool ShapeBase::prepRenderImage(SceneState* state, const U32 stateKey, const U32 startZone, const bool modifyBaseState) { AssertFatal(modifyBaseState == false, "Error, should never be called with this parameter set"); AssertFatal(startZone == 0xFFFFFFFF, "Error, startZone should indicate -1"); if (isLastState(state, stateKey)) return false; setLastState(state, stateKey); if( ( getDamageState() == Destroyed ) && ( !mDataBlock->renderWhenDestroyed ) ) return false; // Select detail levels on mounted items // but... always draw the control object's mounted images // in high detail (I can't believe I'm commenting this hack :) F32 saveError = TSShapeInstance::smScreenError; GameConnection *con = GameConnection::getConnectionToServer(); bool fogExemption = false; ShapeBase *co = NULL; if(con && ( (co = con->getControlObject()) != NULL) ) { if(co == this || co->getObjectMount() == this) { TSShapeInstance::smScreenError = 0.001; fogExemption = true; } } if (state->isObjectRendered(this)) { mLastRenderFrame = sLastRenderFrame; // get shape detail and fog information...we might not even need to be drawn Point3F cameraOffset; getRenderTransform().getColumn(3,&cameraOffset); cameraOffset -= state->getCameraPosition(); F32 dist = cameraOffset.len(); if (dist < 0.01) dist = 0.01; F32 fogAmount = state->getHazeAndFog(dist,cameraOffset.z); F32 invScale = (1.0f/getMax(getMax(mObjScale.x,mObjScale.y),mObjScale.z)); if (mShapeInstance) DetailManager::selectPotentialDetails(mShapeInstance,dist,invScale); if (mShapeInstance) mShapeInstance->animate(); if ((fogAmount>0.99f && fogExemption == false) || (mShapeInstance && mShapeInstance->getCurrentDetail()<0) || (!mShapeInstance && !gShowBoundingBox)) { // no, don't draw anything return false; } for (U32 i = 0; i < MaxMountedImages; i++) { MountedImage& image = mMountedImageList[i]; if (image.dataBlock && image.shapeInstance) { DetailManager::selectPotentialDetails(image.shapeInstance,dist,invScale); if (mCloakLevel == 0.0f && image.shapeInstance->hasSolid() && mFadeVal == 1.0f) { ShapeImageRenderImage* rimage = new ShapeImageRenderImage; rimage->obj = this; rimage->mSBase = this; rimage->mIndex = i; rimage->isTranslucent = false; rimage->textureSortKey = (U32)(dsize_t)(image.dataBlock); state->insertRenderImage(rimage); } if ((mCloakLevel != 0.0f || mFadeVal != 1.0f || mShapeInstance->hasTranslucency()) || (mMount.object == NULL)) { ShapeImageRenderImage* rimage = new ShapeImageRenderImage; rimage->obj = this; rimage->mSBase = this; rimage->mIndex = i; rimage->isTranslucent = true; rimage->sortType = SceneRenderImage::Point; rimage->textureSortKey = (U32)(dsize_t)(image.dataBlock); state->setImageRefPoint(this, rimage); state->insertRenderImage(rimage); } } } TSShapeInstance::smScreenError = saveError; if (mCloakLevel == 0.0f && mShapeInstance->hasSolid() && mFadeVal == 1.0f) { SceneRenderImage* image = new SceneRenderImage; image->obj = this; image->isTranslucent = false; image->textureSortKey = mSkinHash ^ (U32)(dsize_t)(mDataBlock); state->insertRenderImage(image); } if ((mCloakLevel != 0.0f || mFadeVal != 1.0f || mShapeInstance->hasTranslucency()) || (mMount.object == NULL)) { SceneRenderImage* image = new SceneRenderImage; image->obj = this; image->isTranslucent = true; image->sortType = SceneRenderImage::Point; image->textureSortKey = mSkinHash ^ (U32)(dsize_t)(mDataBlock); state->setImageRefPoint(this, image); state->insertRenderImage(image); } calcClassRenderData(); } return false; } void ShapeBase::renderObject(SceneState* state, SceneRenderImage* image) { PROFILE_START(ShapeBaseRenderObject); AssertFatal(dglIsInCanonicalState(), "Error, GL not in canonical state on entry"); RectI viewport; dglGetViewport(&viewport); gClientSceneGraph->getLightManager()->sgSetupLights(this); glMatrixMode(GL_PROJECTION); glPushMatrix(); state->setupObjectProjection(this); // This is something of a hack, but since the 3space objects don't have a // clear conception of texels/meter like the interiors do, we're sorta // stuck. I can't even claim this is anything more scientific than eyeball // work. DMM F32 axis = (getObjBox().len_x() + getObjBox().len_y() + getObjBox().len_z()) / 3.0; F32 dist = (getRenderWorldBox().getClosestPoint(state->getCameraPosition()) - state->getCameraPosition()).len(); if (dist != 0) { F32 projected = dglProjectRadius(dist, axis) / 25; if (projected < (1.0 / 16.0)) { TextureManager::setSmallTexturesActive(true); } } // render shield effect if (mCloakLevel == 0.0f && mFadeVal == 1.0f) { if (image->isTranslucent == true) { TSShapeInstance::smNoRenderNonTranslucent = true; TSShapeInstance::smNoRenderTranslucent = false; } else { TSShapeInstance::smNoRenderNonTranslucent = false; TSShapeInstance::smNoRenderTranslucent = true; } } else { TSShapeInstance::smNoRenderNonTranslucent = false; TSShapeInstance::smNoRenderTranslucent = false; } TSMesh::setOverrideFade( mFadeVal ); ShapeImageRenderImage* shiri = dynamic_cast<ShapeImageRenderImage*>(image); if (shiri != NULL) { renderMountedImage(state, shiri); } else { renderImage(state, image); } TSMesh::setOverrideFade( 1.0 ); TSShapeInstance::smNoRenderNonTranslucent = false; TSShapeInstance::smNoRenderTranslucent = false; glMatrixMode(GL_PROJECTION); glPopMatrix(); glMatrixMode(GL_MODELVIEW); dglSetViewport(viewport); gClientSceneGraph->getLightManager()->sgResetLights(); // Debugging Bounding Box if (!mShapeInstance || gShowBoundingBox) { glDisable(GL_DEPTH_TEST); Point3F box; glPushMatrix(); dglMultMatrix(&getRenderTransform()); box = (mObjBox.min + mObjBox.max) * 0.5; glTranslatef(box.x,box.y,box.z); box = (mObjBox.max - mObjBox.min) * 0.5; glScalef(box.x,box.y,box.z); glColor3f(1, 0, 1); wireCube(Point3F(1,1,1),Point3F(0,0,0)); glPopMatrix(); glPushMatrix(); box = (mWorldBox.min + mWorldBox.max) * 0.5; glTranslatef(box.x,box.y,box.z); box = (mWorldBox.max - mWorldBox.min) * 0.5; glScalef(box.x,box.y,box.z); glColor3f(0, 1, 1); wireCube(Point3F(1,1,1),Point3F(0,0,0)); glPopMatrix(); for (U32 i = 0; i < MaxMountedImages; i++) { MountedImage& image = mMountedImageList[i]; if (image.dataBlock && image.shapeInstance) { MatrixF mat; glPushMatrix(); getRenderImageTransform(i,&mat); dglMultMatrix(&mat); glColor3f(1, 0, 1); wireCube(Point3F(0.05,0.05,0.05),Point3F(0,0,0)); glPopMatrix(); glPushMatrix(); getRenderMountTransform(i,&mat); dglMultMatrix(&mat); glColor3f(1, 0, 1); wireCube(Point3F(0.05,0.05,0.05),Point3F(0,0,0)); glPopMatrix(); glPushMatrix(); getRenderMuzzleTransform(i,&mat); dglMultMatrix(&mat); glColor3f(1, 0, 1); wireCube(Point3F(0.05,0.05,0.05),Point3F(0,0,0)); glPopMatrix(); } } glEnable(GL_DEPTH_TEST); } dglSetCanonicalState(); TextureManager::setSmallTexturesActive(false); AssertFatal(dglIsInCanonicalState(), "Error, GL not in canonical state on exit"); PROFILE_END(); } void ShapeBase::renderShadow(F32 dist, F32 fogAmount) { if(!mDataBlock->shadowEnable) return; shadows.sgRender(this, mShapeInstance, dist, fogAmount, mDataBlock->genericShadowLevel, mDataBlock->noShadowLevel, mDataBlock->shadowNode, mDataBlock->shadowCanMove, mDataBlock->shadowCanAnimate); } void ShapeBase::renderMountedImage(SceneState* state, ShapeImageRenderImage* rimage) { AssertFatal(rimage->mSBase == this, "Error, wrong image"); Point3F cameraOffset; getRenderTransform().getColumn(3,&cameraOffset); cameraOffset -= state->getCameraPosition(); F32 dist = cameraOffset.len(); F32 fogAmount = state->getHazeAndFog(dist,cameraOffset.z); // Mounted items PROFILE_START(ShapeBaseRenderMounted); MountedImage& image = mMountedImageList[rimage->mIndex]; if (image.dataBlock && image.shapeInstance && DetailManager::selectCurrentDetail(image.shapeInstance)) { MatrixF mat; getRenderImageTransform(rimage->mIndex, &mat); glPushMatrix(); dglMultMatrix(&mat); if (image.dataBlock->cloakable && mCloakLevel != 0.0) image.shapeInstance->setAlphaAlways(0.15 + (1 - mCloakLevel) * 0.85); else image.shapeInstance->setAlphaAlways(1.0); if (mCloakLevel == 0.0 && (image.dataBlock->emap && gRenderEnvMaps) && state->getEnvironmentMap().getGLName() != 0) { image.shapeInstance->setEnvironmentMap(state->getEnvironmentMap()); image.shapeInstance->setEnvironmentMapOn(true, 1.0); } else { image.shapeInstance->setEnvironmentMapOn(false, 1.0); } image.shapeInstance->setupFog(fogAmount,state->getFogColor()); image.shapeInstance->animate(); image.shapeInstance->render(); // easiest just to shut it off here. If we're cloaked on the next frame, // we don't want envmaps... image.shapeInstance->setEnvironmentMapOn(false, 1.0); glPopMatrix(); } PROFILE_END(); } void ShapeBase::renderImage(SceneState* state, SceneRenderImage* image) { glMatrixMode(GL_MODELVIEW); // Base shape F32 fogAmount = 0.0f; F32 dist = 0.0f; PROFILE_START(ShapeBaseRenderPrimary); if (mShapeInstance && DetailManager::selectCurrentDetail(mShapeInstance)) { glPushMatrix(); dglMultMatrix(&getRenderTransform()); glScalef(mObjScale.x,mObjScale.y,mObjScale.z); if (mCloakLevel != 0.0) { glMatrixMode(GL_TEXTURE); glPushMatrix(); static U32 shiftX = 0; static U32 shiftY = 0; shiftX = (shiftX + 1) % 128; shiftY = (shiftY + 1) % 127; glTranslatef(F32(shiftX) / 127.0, F32(shiftY)/126.0, 0); glMatrixMode(GL_MODELVIEW); mShapeInstance->setAlphaAlways(0.125 + (1 - mCloakLevel) * 0.875); mShapeInstance->setOverrideTexture(mCloakTexture); } else { mShapeInstance->setAlphaAlways(1.0); } if (mCloakLevel == 0.0 && (mDataBlock->emap && gRenderEnvMaps) && state->getEnvironmentMap().getGLName() != 0) { mShapeInstance->setEnvironmentMap(state->getEnvironmentMap()); mShapeInstance->setEnvironmentMapOn(true, 1.0); } else { mShapeInstance->setEnvironmentMapOn(false, 1.0); } Point3F cameraOffset; getRenderTransform().getColumn(3,&cameraOffset); cameraOffset -= state->getCameraPosition(); dist = cameraOffset.len(); fogAmount = state->getHazeAndFog(dist,cameraOffset.z); mShapeInstance->setupFog(fogAmount,state->getFogColor()); mShapeInstance->animate(); mShapeInstance->render(); mShapeInstance->setEnvironmentMapOn(false, 1.0); if (mCloakLevel != 0.0) { glMatrixMode(GL_TEXTURE); glPopMatrix(); mShapeInstance->clearOverrideTexture(); } glMatrixMode(GL_MODELVIEW); glPopMatrix(); } PROFILE_END(); PROFILE_START(ShapeBaseRenderShadow); // Shadow... if (mShapeInstance && mCloakLevel == 0.0 && mMount.object == NULL && image->isTranslucent == true) { // we are shadow enabled... renderShadow(dist,fogAmount); } PROFILE_END(); } //---------------------------------------------------------------------------- static ColorF cubeColors[8] = { ColorF(0, 0, 0), ColorF(1, 0, 0), ColorF(0, 1, 0), ColorF(0, 0, 1), ColorF(1, 1, 0), ColorF(1, 0, 1), ColorF(0, 1, 1), ColorF(1, 1, 1) }; static Point3F cubePoints[8] = { Point3F(-1, -1, -1), Point3F(-1, -1, 1), Point3F(-1, 1, -1), Point3F(-1, 1, 1), Point3F( 1, -1, -1), Point3F( 1, -1, 1), Point3F( 1, 1, -1), Point3F( 1, 1, 1) }; static U32 cubeFaces[6][4] = { { 0, 2, 6, 4 }, { 0, 2, 3, 1 }, { 0, 1, 5, 4 }, { 3, 2, 6, 7 }, { 7, 6, 4, 5 }, { 3, 7, 5, 1 } }; void ShapeBase::wireCube(const Point3F& size, const Point3F& pos) { glDisable(GL_CULL_FACE); for(int i = 0; i < 6; i++) { glBegin(GL_LINE_LOOP); for(int vert = 0; vert < 4; vert++) { int idx = cubeFaces[i][vert]; glVertex3f(cubePoints[idx].x * size.x + pos.x, cubePoints[idx].y * size.y + pos.y, cubePoints[idx].z * size.z + pos.z); } glEnd(); } } //---------------------------------------------------------------------------- bool ShapeBase::castRay(const Point3F &start, const Point3F &end, RayInfo* info) { if (mShapeInstance) { RayInfo shortest; shortest.t = 1e8; info->object = NULL; for (U32 i = 0; i < mDataBlock->LOSDetails.size(); i++) { mShapeInstance->animate(mDataBlock->LOSDetails[i]); if (mShapeInstance->castRay(start, end, info, mDataBlock->LOSDetails[i])) { info->object = this; if (info->t < shortest.t) shortest = *info; } } if (info->object == this) { // Copy out the shortest time... *info = shortest; return true; } } return false; } //---------------------------------------------------------------------------- bool ShapeBase::buildPolyList(AbstractPolyList* polyList, const Box3F &, const SphereF &) { if (mShapeInstance) { bool ret = false; polyList->setTransform(&mObjToWorld, mObjScale); polyList->setObject(this); for (U32 i = 0; i < mDataBlock->collisionDetails.size(); i++) { mShapeInstance->buildPolyList(polyList,mDataBlock->collisionDetails[i]); ret = true; } return ret; } return false; } void ShapeBase::buildConvex(const Box3F& box, Convex* convex) { if (mShapeInstance == NULL) return; // These should really come out of a pool mConvexList->collectGarbage(); Box3F realBox = box; mWorldToObj.mul(realBox); realBox.min.convolveInverse(mObjScale); realBox.max.convolveInverse(mObjScale); if (realBox.isOverlapped(getObjBox()) == false) return; for (U32 i = 0; i < mDataBlock->collisionDetails.size(); i++) { Box3F newbox = mDataBlock->collisionBounds[i]; newbox.min.convolve(mObjScale); newbox.max.convolve(mObjScale); mObjToWorld.mul(newbox); if (box.isOverlapped(newbox) == false) continue; // See if this hull exists in the working set already... Convex* cc = 0; CollisionWorkingList& wl = convex->getWorkingList(); for (CollisionWorkingList* itr = wl.wLink.mNext; itr != &wl; itr = itr->wLink.mNext) { if (itr->mConvex->getType() == ShapeBaseConvexType && (static_cast<ShapeBaseConvex*>(itr->mConvex)->pShapeBase == this && static_cast<ShapeBaseConvex*>(itr->mConvex)->hullId == i)) { cc = itr->mConvex; break; } } if (cc) continue; // Create a new convex. ShapeBaseConvex* cp = new ShapeBaseConvex; mConvexList->registerObject(cp); convex->addToWorkingList(cp); cp->mObject = this; cp->pShapeBase = this; cp->hullId = i; cp->box = mDataBlock->collisionBounds[i]; cp->transform = 0; cp->findNodeTransform(); } } //---------------------------------------------------------------------------- void ShapeBase::queueCollision(ShapeBase* obj, const VectorF& vec) { // Add object to list of collisions. SimTime time = Sim::getCurrentTime(); S32 num = obj->getId(); CollisionTimeout** adr = &mTimeoutList; CollisionTimeout* ptr = mTimeoutList; while (ptr) { if (ptr->objectNumber == num) { if (ptr->expireTime < time) { ptr->expireTime = time + CollisionTimeoutValue; ptr->object = obj; ptr->vector = vec; } return; } // Recover expired entries if (ptr->expireTime < time) { CollisionTimeout* cur = ptr; *adr = ptr->next; ptr = ptr->next; cur->next = sFreeTimeoutList; sFreeTimeoutList = cur; } else { adr = &ptr->next; ptr = ptr->next; } } // New entry for the object if (sFreeTimeoutList != NULL) { ptr = sFreeTimeoutList; sFreeTimeoutList = ptr->next; ptr->next = NULL; } else { ptr = sTimeoutChunker.alloc(); } ptr->object = obj; ptr->objectNumber = obj->getId(); ptr->vector = vec; ptr->expireTime = time + CollisionTimeoutValue; ptr->next = mTimeoutList; mTimeoutList = ptr; } void ShapeBase::setNodeColor(const char* name, ColorI color) { if (mShapeInstance->setNodeColor(name, color)) setMaskBits(NodeColorMask); } void ShapeBase::setNodeVisible(const char* name, bool val) { if (mShapeInstance->setNodeVisible(name, val)) setMaskBits(NodeVisibleMask); } void ShapeBase::notifyCollision() { // Notify all the objects that were just stamped during the queueing // process. SimTime expireTime = Sim::getCurrentTime() + CollisionTimeoutValue; for (CollisionTimeout* ptr = mTimeoutList; ptr; ptr = ptr->next) { if (ptr->expireTime == expireTime && ptr->object) { SimObjectPtr<ShapeBase> safePtr(ptr->object); SimObjectPtr<ShapeBase> safeThis(this); onCollision(ptr->object,ptr->vector); ptr->object = 0; if(!bool(safeThis)) return; if(bool(safePtr)) safePtr->onCollision(this,ptr->vector); if(!bool(safeThis)) return; } } } void ShapeBase::onCollision(ShapeBase* object,VectorF vec) { if (!isGhost()) { char buff1[256]; char buff2[32]; dSprintf(buff1,sizeof(buff1),"%g %g %g",vec.x, vec.y, vec.z); dSprintf(buff2,sizeof(buff2),"%g",vec.len()); Con::executef(mDataBlock,5,"onCollision",scriptThis(),object->scriptThis(), buff1, buff2); } } //-------------------------------------------------------------------------- bool ShapeBase::pointInWater( Point3F &point ) { SimpleQueryList sql; if (isServerObject()) gServerSceneGraph->getWaterObjectList(sql); else gClientSceneGraph->getWaterObjectList(sql); for (U32 i = 0; i < sql.mList.size(); i++) { WaterBlock* pBlock = dynamic_cast<WaterBlock*>(sql.mList[i]); if (pBlock && pBlock->isPointSubmergedSimple( point )) return true; } return false; } //---------------------------------------------------------------------------- void ShapeBase::writePacketData(GameConnection *connection, BitStream *stream) { Parent::writePacketData(connection, stream); stream->write(getEnergyLevel()); stream->write(mRechargeRate); } void ShapeBase::readPacketData(GameConnection *connection, BitStream *stream) { Parent::readPacketData(connection, stream); F32 energy; stream->read(&energy); setEnergyLevel(energy); stream->read(&mRechargeRate); } U32 ShapeBase::getPacketDataChecksum(GameConnection *connection) { // just write the packet data into a buffer // then we can CRC the buffer. This should always let us // know when there is a checksum problem. static U8 buffer[1500] = { 0, }; BitStream stream(buffer, sizeof(buffer)); writePacketData(connection, &stream); U32 byteCount = stream.getPosition(); U32 ret = calculateCRC(buffer, byteCount, 0xFFFFFFFF); dMemset(buffer, 0, byteCount); return ret; } F32 ShapeBase::getUpdatePriority(CameraScopeQuery *camInfo, U32 updateMask, S32 updateSkips) { // If it's the scope object, must be high priority if (camInfo->camera == this) { // Most priorities are between 0 and 1, so this // should be something larger. return 10.0f; } if (camInfo->camera && (camInfo->camera->getType() & ShapeBaseObjectType)) { // see if the camera is mounted to this... // if it is, this should have a high priority if(((ShapeBase *) camInfo->camera)->getObjectMount() == this) return 10.0f; } return Parent::getUpdatePriority(camInfo, updateMask, updateSkips); } U32 ShapeBase::packUpdate(NetConnection *con, U32 mask, BitStream *stream) { U32 retMask = Parent::packUpdate(con, mask, stream); if (mask & InitialUpdateMask) { // mask off sounds that aren't playing S32 i; for (i = 0; i < MaxSoundThreads; i++) if (!mSoundThread[i].play) mask &= ~(SoundMaskN << i); // mask off threads that aren't running for (i = 0; i < MaxScriptThreads; i++) if (mScriptThread[i].sequence == -1) mask &= ~(ThreadMaskN << i); // mask off images that aren't updated for(i = 0; i < MaxMountedImages; i++) if(!mMountedImageList[i].dataBlock) mask &= ~(ImageMaskN << i); } if(!stream->writeFlag(mask & (NodeVisibleMask | NameMask | DamageMask | SoundMask | ThreadMask | ImageMask | CloakMask | MountedMask | InvincibleMask | ShieldMask | SkinMask))) return retMask; if (stream->writeFlag(mask & DamageMask)) { stream->writeFloat(mClampF(mDamage / mDataBlock->maxDamage, 0.f, 1.f), DamageLevelBits); stream->writeInt(mDamageState,NumDamageStateBits); stream->writeNormalVector( damageDir, 8 ); } if (stream->writeFlag(mask & ThreadMask)) { for (int i = 0; i < MaxScriptThreads; i++) { Thread& st = mScriptThread[i]; if (stream->writeFlag(st.sequence != -1 && (mask & (ThreadMaskN << i)))) { stream->writeInt(st.sequence,ThreadSequenceBits); stream->writeInt(st.state,2); stream->writeFlag(st.forward); stream->writeFlag(st.atEnd); } } } if (stream->writeFlag(mask & SoundMask)) { for (int i = 0; i < MaxSoundThreads; i++) { Sound& st = mSoundThread[i]; if (stream->writeFlag(mask & (SoundMaskN << i))) if (stream->writeFlag(st.play)) stream->writeRangedU32(st.profile->getId(),DataBlockObjectIdFirst, DataBlockObjectIdLast); } } if (stream->writeFlag(mask & ImageMask)) { for (int i = 0; i < MaxMountedImages; i++) if (stream->writeFlag(mask & (ImageMaskN << i))) { MountedImage& image = mMountedImageList[i]; if (stream->writeFlag(image.dataBlock)) stream->writeInt(image.dataBlock->getId() - DataBlockObjectIdFirst, DataBlockObjectIdBitSize); con->packStringHandleU(stream, image.skinNameHandle); stream->writeFlag(image.wet); stream->writeFlag(image.ammo); stream->writeFlag(image.loaded); stream->writeFlag(image.target); stream->writeFlag(image.triggerDown); stream->writeInt(image.fireCount,3); if (mask & InitialUpdateMask) stream->writeFlag(isImageFiring(i)); } } // Node visibility if (stream->writeFlag(mask & NodeVisibleMask)) { for (int i = 0; i < mDataBlock->shape->objects.size(); i++) stream->writeFlag(mShapeInstance->nodeVisibility.test(i)); } // Node coloring if (stream->writeFlag(mask & NodeColorMask)) { for (int i = 0; i < mDataBlock->shape->objects.size(); i++) { ColorI color(mShapeInstance->nodeColors[i]); stream->writeInt(color.red, 8); stream->writeInt(color.green, 8); stream->writeInt(color.blue, 8); stream->writeInt(color.alpha, 8); } } // Group some of the uncommon stuff together. if (stream->writeFlag(mask & (NameMask | ShieldMask | CloakMask | InvincibleMask | SkinMask))) { if (stream->writeFlag(mask & CloakMask)) { // cloaking stream->writeFlag( mCloaked ); // piggyback control update stream->writeFlag(bool(getControllingClient())); // fading if(stream->writeFlag(mFading && mFadeElapsedTime >= mFadeDelay)) { stream->writeFlag(mFadeOut); stream->write(mFadeTime); } else stream->writeFlag(mFadeVal == 1.0f); } if (stream->writeFlag(mask & NameMask)) { con->packStringHandleU(stream, mShapeNameHandle); } if (stream->writeFlag(mask & ShieldMask)) { stream->writeNormalVector(mShieldNormal, ShieldNormalBits); stream->writeFloat( getEnergyValue(), EnergyLevelBits ); } if (stream->writeFlag(mask & InvincibleMask)) { stream->write(mInvincibleTime); stream->write(mInvincibleSpeed); } if (stream->writeFlag(mask & SkinMask)) { con->packStringHandleU(stream, mSkinNameHandle); } } if (mask & MountedMask) { if (mMount.object) { S32 gIndex = con->getGhostIndex(mMount.object); if (stream->writeFlag(gIndex != -1)) { stream->writeFlag(true); stream->writeInt(gIndex,NetConnection::GhostIdBitSize); stream->writeInt(mMount.node,ShapeBaseData::NumMountPointBits); } else // Will have to try again later retMask |= MountedMask; } else // Unmount if this isn't the initial packet if (stream->writeFlag(!(mask & InitialUpdateMask))) stream->writeFlag(false); } else stream->writeFlag(false); return retMask; } void ShapeBase::unpackUpdate(NetConnection *con, BitStream *stream) { Parent::unpackUpdate(con, stream); mLastRenderFrame = sLastRenderFrame; // make sure we get a process after the event... if(!stream->readFlag()) return; if (stream->readFlag()) { mDamage = mClampF(stream->readFloat(DamageLevelBits) * mDataBlock->maxDamage, 0.f, mDataBlock->maxDamage); DamageState prevState = mDamageState; mDamageState = DamageState(stream->readInt(NumDamageStateBits)); stream->readNormalVector( &damageDir, 8 ); if (prevState != Destroyed && mDamageState == Destroyed && isProperlyAdded()) blowUp(); updateDamageLevel(); updateDamageState(); } if (stream->readFlag()) { for (S32 i = 0; i < MaxScriptThreads; i++) { if (stream->readFlag()) { Thread& st = mScriptThread[i]; U32 seq = stream->readInt(ThreadSequenceBits); st.state = stream->readInt(2); st.forward = stream->readFlag(); st.atEnd = stream->readFlag(); //if (st.sequence != seq) setThreadSequence(i,seq,true); //else //updateThread(st); } } } if (stream->readFlag()) { for (S32 i = 0; i < MaxSoundThreads; i++) { if (stream->readFlag()) { Sound& st = mSoundThread[i]; if ((st.play = stream->readFlag()) == true) { st.profile = (AudioProfile*) stream->readRangedU32(DataBlockObjectIdFirst, DataBlockObjectIdLast); } if (isProperlyAdded()) updateAudioState(st); } } } if (stream->readFlag()) { for (int i = 0; i < MaxMountedImages; i++) { if (stream->readFlag()) { MountedImage& image = mMountedImageList[i]; ShapeBaseImageData* imageData = 0; if (stream->readFlag()) { SimObjectId id = stream->readInt(DataBlockObjectIdBitSize) + DataBlockObjectIdFirst; if (!Sim::findObject(id,imageData)) { con->setLastError("Invalid packet (mounted images)."); return; } } StringHandle skinDesiredNameHandle = con->unpackStringHandleU(stream); image.wet = stream->readFlag(); image.ammo = stream->readFlag(); image.loaded = stream->readFlag(); image.target = stream->readFlag(); image.triggerDown = stream->readFlag(); int count = stream->readInt(3); if ((image.dataBlock != imageData) || (image.skinNameHandle != skinDesiredNameHandle)) { setImage(i, imageData, skinDesiredNameHandle, image.loaded, image.ammo, image.triggerDown); } if (isProperlyAdded()) { // Normal processing if (count != image.fireCount) { image.fireCount = count; setImageState(i,getImageFireState(i),true); if( imageData && imageData->lightType == ShapeBaseImageData::WeaponFireLight ) { mLightTime = Sim::getCurrentTime(); } } updateImageState(i,0); } else { bool firing = stream->readFlag(); if(imageData) { // Initial state image.fireCount = count; if (firing) setImageState(i,getImageFireState(i),true); } } } } } // Node visbility update if (stream->readFlag()) { for (int i = 0; i < mDataBlock->shape->objects.size(); i++) { bool newValue = stream->readFlag(); bool ourValue = mShapeInstance->nodeVisibility.test(i); if (newValue == ourValue) continue; if (newValue) mShapeInstance->nodeVisibility.set(i); else mShapeInstance->nodeVisibility.clear(i); } } // Node color update if (stream->readFlag()) { for (int i = 0; i < mDataBlock->shape->objects.size(); i++) { mShapeInstance->nodeColors[i].red = (unsigned char)stream->readInt(8); mShapeInstance->nodeColors[i].green = (unsigned char)stream->readInt(8); mShapeInstance->nodeColors[i].blue = (unsigned char)stream->readInt(8); mShapeInstance->nodeColors[i].alpha = (unsigned char)stream->readInt(8); } mShapeInstance->updateNodeColors(); } if (stream->readFlag()) { if(stream->readFlag()) // Cloaked and control { setCloakedState(stream->readFlag()); mIsControlled = stream->readFlag(); if (( mFading = stream->readFlag()) == true) { mFadeOut = stream->readFlag(); if(mFadeOut) mFadeVal = 1.0f; else mFadeVal = 0; stream->read(&mFadeTime); mFadeDelay = 0; mFadeElapsedTime = 0; } else mFadeVal = F32(stream->readFlag()); } if (stream->readFlag()) { // NameMask mShapeNameHandle = con->unpackStringHandleU(stream); } if(stream->readFlag()) // ShieldMask { // Cloaking, Shield, and invul masking Point3F shieldNormal; stream->readNormalVector(&shieldNormal, ShieldNormalBits); F32 energyPercent = stream->readFloat(EnergyLevelBits); } if (stream->readFlag()) { // InvincibleMask F32 time, speed; stream->read(&time); stream->read(&speed); setupInvincibleEffect(time, speed); } if (stream->readFlag()) { // SkinMask StringHandle skinDesiredNameHandle = con->unpackStringHandleU(stream);; if (mSkinNameHandle != skinDesiredNameHandle) { mSkinNameHandle = skinDesiredNameHandle; if (mShapeInstance) { mShapeInstance->reSkin(mSkinNameHandle); if (mSkinNameHandle.isValidString()) { mSkinHash = _StringTable::hashString(mSkinNameHandle.getString()); } } } } } if (stream->readFlag()) { if (stream->readFlag()) { S32 gIndex = stream->readInt(NetConnection::GhostIdBitSize); ShapeBase* obj = dynamic_cast<ShapeBase*>(con->resolveGhost(gIndex)); S32 node = stream->readInt(ShapeBaseData::NumMountPointBits); if(!obj) { con->setLastError("Invalid packet from server."); return; } obj->mountObject(this,node); } else unmount(); } } //-------------------------------------------------------------------------- void ShapeBase::forceUncloak(const char * reason) { AssertFatal(isServerObject(), "ShapeBase::forceUncloak: server only call"); if(!mCloaked) return; Con::executef(mDataBlock, 3, "onForceUncloak", scriptThis(), reason ? reason : ""); } void ShapeBase::setCloakedState(bool cloaked) { if (cloaked == mCloaked) return; if (isServerObject()) setMaskBits(CloakMask); // Have to do this for the client, if we are ghosted over in the initial // packet as cloaked, we set the state immediately to the extreme if (isProperlyAdded() == false) { mCloaked = cloaked; if (mCloaked) mCloakLevel = 1.0; else mCloakLevel = 0.0; } else { mCloaked = cloaked; } } //-------------------------------------------------------------------------- void ShapeBase::setHidden(bool hidden) { if (hidden != mHidden) { // need to set a mask bit to make the ghost manager delete copies of this object // hacky, but oh well. setMaskBits(CloakMask); if (mHidden) addToScene(); else removeFromScene(); mHidden = hidden; } } //-------------------------------------------------------------------------- void ShapeBaseConvex::findNodeTransform() { S32 dl = pShapeBase->mDataBlock->collisionDetails[hullId]; TSShapeInstance* si = pShapeBase->getShapeInstance(); TSShape* shape = si->getShape(); const TSShape::Detail* detail = &shape->details[dl]; const S32 subs = detail->subShapeNum; const S32 start = shape->subShapeFirstObject[subs]; const S32 end = start + shape->subShapeNumObjects[subs]; // Find the first object that contains a mesh for this // detail level. There should only be one mesh per // collision detail level. for (S32 i = start; i < end; i++) { const TSShape::Object* obj = &shape->objects[i]; if (obj->numMeshes && detail->objectDetailNum < obj->numMeshes) { nodeTransform = &si->mNodeTransforms[obj->nodeIndex]; return; } } return; } const MatrixF& ShapeBaseConvex::getTransform() const { // If the transform isn't specified, it's assumed to be the // origin of the shape. const MatrixF& omat = (transform != 0)? *transform: mObject->getTransform(); // Multiply on the mesh shape offset // tg: Returning this static here is not really a good idea, but // all this Convex code needs to be re-organized. if (nodeTransform) { static MatrixF mat; mat.mul(omat,*nodeTransform); return mat; } return omat; } Box3F ShapeBaseConvex::getBoundingBox() const { const MatrixF& omat = (transform != 0)? *transform: mObject->getTransform(); return getBoundingBox(omat, mObject->getScale()); } Box3F ShapeBaseConvex::getBoundingBox(const MatrixF& mat, const Point3F& scale) const { Box3F newBox = box; newBox.min.convolve(scale); newBox.max.convolve(scale); mat.mul(newBox); return newBox; } Point3F ShapeBaseConvex::support(const VectorF& v) const { TSShape::ConvexHullAccelerator* pAccel = pShapeBase->mShapeInstance->getShape()->getAccelerator(pShapeBase->mDataBlock->collisionDetails[hullId]); AssertFatal(pAccel != NULL, "Error, no accel!"); F32 currMaxDP = mDot(pAccel->vertexList[0], v); U32 index = 0; for (U32 i = 1; i < pAccel->numVerts; i++) { F32 dp = mDot(pAccel->vertexList[i], v); if (dp > currMaxDP) { currMaxDP = dp; index = i; } } return pAccel->vertexList[index]; } void ShapeBaseConvex::getFeatures(const MatrixF& mat, const VectorF& n, ConvexFeature* cf) { cf->material = 0; cf->object = mObject; TSShape::ConvexHullAccelerator* pAccel = pShapeBase->mShapeInstance->getShape()->getAccelerator(pShapeBase->mDataBlock->collisionDetails[hullId]); AssertFatal(pAccel != NULL, "Error, no accel!"); F32 currMaxDP = mDot(pAccel->vertexList[0], n); U32 index = 0; U32 i; for (i = 1; i < pAccel->numVerts; i++) { F32 dp = mDot(pAccel->vertexList[i], n); if (dp > currMaxDP) { currMaxDP = dp; index = i; } } const U8* emitString = pAccel->emitStrings[index]; U32 currPos = 0; U32 numVerts = emitString[currPos++]; for (i = 0; i < numVerts; i++) { cf->mVertexList.increment(); U32 index = emitString[currPos++]; mat.mulP(pAccel->vertexList[index], &cf->mVertexList.last()); } U32 numEdges = emitString[currPos++]; for (i = 0; i < numEdges; i++) { U32 ev0 = emitString[currPos++]; U32 ev1 = emitString[currPos++]; cf->mEdgeList.increment(); cf->mEdgeList.last().vertex[0] = ev0; cf->mEdgeList.last().vertex[1] = ev1; } U32 numFaces = emitString[currPos++]; for (i = 0; i < numFaces; i++) { cf->mFaceList.increment(); U32 plane = emitString[currPos++]; mat.mulV(pAccel->normalList[plane], &cf->mFaceList.last().normal); for (U32 j = 0; j < 3; j++) cf->mFaceList.last().vertex[j] = emitString[currPos++]; } } void ShapeBaseConvex::getPolyList(AbstractPolyList* list) { list->setTransform(&pShapeBase->getTransform(), pShapeBase->getScale()); list->setObject(pShapeBase); pShapeBase->mShapeInstance->animate(pShapeBase->mDataBlock->collisionDetails[hullId]); pShapeBase->mShapeInstance->buildPolyList(list,pShapeBase->mDataBlock->collisionDetails[hullId]); } //-------------------------------------------------------------------------- bool ShapeBase::isInvincible() { if( mDataBlock ) { return mDataBlock->isInvincible; } return false; } void ShapeBase::startFade( F32 fadeTime, F32 fadeDelay, bool fadeOut ) { setMaskBits(CloakMask); mFadeElapsedTime = 0; mFading = true; if(fadeDelay < 0) fadeDelay = 0; if(fadeTime < 0) fadeTime = 0; mFadeTime = fadeTime; mFadeDelay = fadeDelay; mFadeOut = fadeOut; mFadeVal = F32(mFadeOut); } //-------------------------------------------------------------------------- void ShapeBase::setShapeName(const char* name) { if (!isGhost()) { if (name[0] != '\0') { // Use tags for better network performance // Should be a tag, but we'll convert to one if it isn't. if (name[0] == StringTagPrefixByte) mShapeNameHandle = StringHandle(U32(dAtoi(name + 1))); else mShapeNameHandle = StringHandle(name); } else { mShapeNameHandle = StringHandle(); } setMaskBits(NameMask); } } void ShapeBase::setSkinName(const char* name) { if (!isGhost()) { if (name[0] != '\0') { // Use tags for better network performance // Should be a tag, but we'll convert to one if it isn't. if (name[0] == StringTagPrefixByte) { mSkinNameHandle = StringHandle(U32(dAtoi(name + 1))); } else { mSkinNameHandle = StringHandle(name); } } else { mSkinNameHandle = StringHandle(); } setMaskBits(SkinMask); } } //-------------------------------------------------------------------------- //---------------------------------------------------------------------------- ConsoleMethod( ShapeBase, setHidden, void, 3, 3, "(bool show)") { object->setHidden(dAtob(argv[2])); } ConsoleMethod( ShapeBase, isHidden, bool, 2, 2, "") { return object->isHidden(); } //---------------------------------------------------------------------------- ConsoleMethod( ShapeBase, playAudio, bool, 4, 4, "(int slot, AudioProfile ap)") { U32 slot = dAtoi(argv[2]); if (slot >= 0 && slot < ShapeBase::MaxSoundThreads) { AudioProfile* profile; if (Sim::findObject(argv[3],profile)) { object->playAudio(slot,profile); return true; } } return false; } ConsoleMethod( ShapeBase, stopAudio, bool, 3, 3, "(int slot)") { U32 slot = dAtoi(argv[2]); if (slot >= 0 && slot < ShapeBase::MaxSoundThreads) { object->stopAudio(slot); return true; } return false; } //---------------------------------------------------------------------------- ConsoleMethod( ShapeBase, playThread, bool, 3, 4, "(int slot, string sequenceName)") { U32 slot = dAtoi(argv[2]); if (slot >= 0 && slot < ShapeBase::MaxScriptThreads) { if (argc == 4) { if (object->getShape()) { S32 seq = object->getShape()->findSequence(argv[3]); if (seq != -1 && object->setThreadSequence(slot,seq)) return true; } } else if (object->playThread(slot)) return true; } return false; } ConsoleMethod( ShapeBase, setThreadDir, bool, 4, 4, "(int slot, bool isForward)") { int slot = dAtoi(argv[2]); if (slot >= 0 && slot < ShapeBase::MaxScriptThreads) { if (object->setThreadDir(slot,dAtob(argv[3]))) return true; } return false; } ConsoleMethod( ShapeBase, stopThread, bool, 3, 3, "(int slot)") { int slot = dAtoi(argv[2]); if (slot >= 0 && slot < ShapeBase::MaxScriptThreads) { if (object->stopThread(slot)) return true; } return false; } ConsoleMethod( ShapeBase, pauseThread, bool, 3, 3, "(int slot)") { int slot = dAtoi(argv[2]); if (slot >= 0 && slot < ShapeBase::MaxScriptThreads) { if (object->pauseThread(slot)) return true; } return false; } //---------------------------------------------------------------------------- ConsoleMethod( ShapeBase, mountObject, bool, 4, 4, "( ShapeBase object, int slot )" "Mount ourselves on an object in the specified slot.") { ShapeBase *target; if (Sim::findObject(argv[2],target)) { S32 node = -1; dSscanf(argv[3],"%d",&node); if (node >= 0 && node < ShapeBaseData::NumMountPoints) object->mountObject(target,node); return true; } return false; } ConsoleMethod( ShapeBase, unmountObject, bool, 3, 3, "(ShapeBase obj)" "Unmount an object from ourselves.") { ShapeBase *target; if (Sim::findObject(argv[2],target)) { object->unmountObject(target); return true; } return false; } ConsoleMethod( ShapeBase, unmount, void, 2, 2, "Unmount from the currently mounted object if any.") { object->unmount(); } ConsoleMethod( ShapeBase, isMounted, bool, 2, 2, "Are we mounted?") { return object->isMounted(); } ConsoleMethod( ShapeBase, getObjectMount, S32, 2, 2, "Returns the ShapeBase we're mounted on.") { return object->isMounted()? object->getObjectMount()->getId(): 0; } ConsoleMethod( ShapeBase, getMountedObjectCount, S32, 2, 2, "") { return object->getMountedObjectCount(); } ConsoleMethod( ShapeBase, getMountedObject, S32, 3, 3, "(int slot)") { ShapeBase* mobj = object->getMountedObject(dAtoi(argv[2])); return mobj? mobj->getId(): 0; } ConsoleMethod( ShapeBase, getMountedObjectNode, S32, 3, 3, "(int node)") { return object->getMountedObjectNode(dAtoi(argv[2])); } ConsoleMethod( ShapeBase, getMountNodeObject, S32, 3, 3, "(int node)") { ShapeBase* mobj = object->getMountNodeObject(dAtoi(argv[2])); return mobj? mobj->getId(): 0; } //---------------------------------------------------------------------------- ConsoleMethod( ShapeBase, mountImage, bool, 4, 6, "(ShapeBaseImageData image, int slot, bool loaded=true, string skinTag=NULL)") { ShapeBaseImageData* imageData; if (Sim::findObject(argv[2],imageData)) { U32 slot = dAtoi(argv[3]); bool loaded = (argc == 5)? dAtob(argv[4]): true; StringHandle team; if(argc == 6) { if(argv[5][0] == StringTagPrefixByte) team = StringHandle(U32(dAtoi(argv[5]+1))); } if (slot >= 0 && slot < ShapeBase::MaxMountedImages) object->mountImage(imageData,slot,loaded,team); } return false; } ConsoleMethod( ShapeBase, unmountImage, bool, 3, 3, "(int slot)") { int slot = dAtoi(argv[2]); if (slot >= 0 && slot < ShapeBase::MaxMountedImages) return object->unmountImage(slot); return false; } ConsoleMethod( ShapeBase, getMountedImage, S32, 3, 3, "(int slot)") { int slot = dAtoi(argv[2]); if (slot >= 0 && slot < ShapeBase::MaxMountedImages) if (ShapeBaseImageData* data = object->getMountedImage(slot)) return data->getId(); return 0; } ConsoleMethod( ShapeBase, getPendingImage, S32, 3, 3, "(int slot)") { int slot = dAtoi(argv[2]); if (slot >= 0 && slot < ShapeBase::MaxMountedImages) if (ShapeBaseImageData* data = object->getPendingImage(slot)) return data->getId(); return 0; } ConsoleMethod( ShapeBase, isImageFiring, bool, 3, 3, "(int slot)") { int slot = dAtoi(argv[2]); if (slot >= 0 && slot < ShapeBase::MaxMountedImages) return object->isImageFiring(slot); return false; } ConsoleMethod( ShapeBase, isImageMounted, bool, 3, 3, "(ShapeBaseImageData db)") { ShapeBaseImageData* imageData; if (Sim::findObject(argv[2],imageData)) return object->isImageMounted(imageData); return false; } ConsoleMethod( ShapeBase, getMountSlot, S32, 3, 3, "(ShapeBaseImageData db)") { ShapeBaseImageData* imageData; if (Sim::findObject(argv[2],imageData)) return object->getMountSlot(imageData); return -1; } ConsoleMethod( ShapeBase, getImageSkinTag, S32, 3, 3, "(int slot)") { int slot = dAtoi(argv[2]); if (slot >= 0 && slot < ShapeBase::MaxMountedImages) return object->getImageSkinTag(slot).getIndex(); return -1; } ConsoleMethod( ShapeBase, getImageState, const char*, 3, 3, "(int slot)") { int slot = dAtoi(argv[2]); if (slot >= 0 && slot < ShapeBase::MaxMountedImages) return object->getImageState(slot); return "Error"; } ConsoleMethod( ShapeBase, getImageTrigger, bool, 3, 3, "(int slot)") { int slot = dAtoi(argv[2]); if (slot >= 0 && slot < ShapeBase::MaxMountedImages) return object->getImageTriggerState(slot); return false; } ConsoleMethod( ShapeBase, setImageTrigger, bool, 4, 4, "(int slot, bool isTriggered)") { int slot = dAtoi(argv[2]); if (slot >= 0 && slot < ShapeBase::MaxMountedImages) { object->setImageTriggerState(slot,dAtob(argv[3])); return object->getImageTriggerState(slot); } return false; } ConsoleMethod( ShapeBase, getImageAmmo, bool, 3, 3, "(int slot)") { int slot = dAtoi(argv[2]); if (slot >= 0 && slot < ShapeBase::MaxMountedImages) return object->getImageAmmoState(slot); return false; } ConsoleMethod( ShapeBase, setImageAmmo, bool, 4, 4, "(int slot, bool hasAmmo)") { int slot = dAtoi(argv[2]); if (slot >= 0 && slot < ShapeBase::MaxMountedImages) { bool ammo = dAtob(argv[3]); object->setImageAmmoState(slot,dAtob(argv[3])); return ammo; } return false; } ConsoleMethod( ShapeBase, getImageLoaded, bool, 3, 3, "(int slot)") { int slot = dAtoi(argv[2]); if (slot >= 0 && slot < ShapeBase::MaxMountedImages) return object->getImageLoadedState(slot); return false; } ConsoleMethod( ShapeBase, setImageLoaded, bool, 4, 4, "(int slot, bool loaded)") { int slot = dAtoi(argv[2]); if (slot >= 0 && slot < ShapeBase::MaxMountedImages) { bool loaded = dAtob(argv[3]); object->setImageLoadedState(slot, dAtob(argv[3])); return loaded; } return false; } ConsoleMethod( ShapeBase, getMuzzleVector, const char*, 3, 3, "(int slot)") { int slot = dAtoi(argv[2]); if (slot >= 0 && slot < ShapeBase::MaxMountedImages) { VectorF v; object->getMuzzleVector(slot,&v); char* buff = Con::getReturnBuffer(100); dSprintf(buff,100,"%g %g %g",v.x,v.y,v.z); return buff; } return "0 1 0"; } ConsoleMethod( ShapeBase, getMuzzlePoint, const char*, 3, 3, "(int slot)") { int slot = dAtoi(argv[2]); if (slot >= 0 && slot < ShapeBase::MaxMountedImages) { Point3F p; object->getMuzzlePoint(slot,&p); char* buff = Con::getReturnBuffer(100); dSprintf(buff,100,"%g %g %g",p.x,p.y,p.z); return buff; } return "0 0 0"; } ConsoleMethod( ShapeBase, getSlotTransform, const char*, 3, 3, "(int slot)") { int slot = dAtoi(argv[2]); MatrixF xf(true); if (slot >= 0 && slot < ShapeBase::MaxMountedImages) object->getMountTransform(slot,&xf); Point3F pos; xf.getColumn(3,&pos); AngAxisF aa(xf); char* buff = Con::getReturnBuffer(200); dSprintf(buff,200,"%g %g %g %g %g %g %g", pos.x,pos.y,pos.z,aa.axis.x,aa.axis.y,aa.axis.z,aa.angle); return buff; } ConsoleMethod( ShapeBase, getAIRepairPoint, const char*, 2, 2, "Get the position at which the AI should stand to repair things.") { Point3F pos = object->getAIRepairPoint(); char* buff = Con::getReturnBuffer(200); dSprintf(buff,200,"%g %g %g", pos.x,pos.y,pos.z); return buff; } ConsoleMethod( ShapeBase, getVelocity, const char *, 2, 2, "") { const VectorF& vel = object->getVelocity(); char* buff = Con::getReturnBuffer(100); dSprintf(buff,100,"%g %g %g",vel.x,vel.y,vel.z); return buff; } ConsoleMethod( ShapeBase, setVelocity, bool, 3, 3, "(Vector3F vel)") { VectorF vel(0,0,0); dSscanf(argv[2],"%g %g %g",&vel.x,&vel.y,&vel.z); object->setVelocity(vel); return true; } ConsoleMethod( ShapeBase, applyImpulse, bool, 4, 4, "(Point3F Pos, VectorF vel)") { Point3F pos(0,0,0); VectorF vel(0,0,0); dSscanf(argv[2],"%g %g %g",&pos.x,&pos.y,&pos.z); dSscanf(argv[3],"%g %g %g",&vel.x,&vel.y,&vel.z); object->applyImpulse(pos,vel); return true; } ConsoleMethod( ShapeBase, getEyeVector, const char*, 2, 2, "") { MatrixF mat; object->getEyeTransform(&mat); VectorF v2; mat.getColumn(1,&v2); char* buff = Con::getReturnBuffer(100); dSprintf(buff, 100,"%g %g %g",v2.x,v2.y,v2.z); return buff; } ConsoleMethod( ShapeBase, getEyePoint, const char*, 2, 2, "") { MatrixF mat; object->getEyeTransform(&mat); Point3F ep; mat.getColumn(3,&ep); char* buff = Con::getReturnBuffer(100); dSprintf(buff, 100,"%g %g %g",ep.x,ep.y,ep.z); return buff; } ConsoleMethod( ShapeBase, getEyeTransform, const char*, 2, 2, "") { MatrixF mat; object->getEyeTransform(&mat); Point3F pos; mat.getColumn(3,&pos); AngAxisF aa(mat); char* buff = Con::getReturnBuffer(100); dSprintf(buff,100,"%g %g %g %g %g %g %g", pos.x,pos.y,pos.z,aa.axis.x,aa.axis.y,aa.axis.z,aa.angle); return buff; } ConsoleMethod( ShapeBase, setEnergyLevel, void, 3, 3, "(float level)") { object->setEnergyLevel(dAtof(argv[2])); } ConsoleMethod( ShapeBase, getEnergyLevel, F32, 2, 2, "") { return object->getEnergyLevel(); } ConsoleMethod( ShapeBase, getEnergyPercent, F32, 2, 2, "") { return object->getEnergyValue(); } ConsoleMethod( ShapeBase, setDamageLevel, void, 3, 3, "(float level)") { object->setDamageLevel(dAtof(argv[2])); } ConsoleMethod( ShapeBase, getDamageLevel, F32, 2, 2, "") { return object->getDamageLevel(); } ConsoleMethod( ShapeBase, getDamagePercent, F32, 2, 2, "") { return object->getDamageValue(); } ConsoleMethod( ShapeBase, setDamageState, bool, 3, 3, "(string state)") { return object->setDamageState(argv[2]); } ConsoleMethod( ShapeBase, getDamageState, const char*, 2, 2, "") { return object->getDamageStateName(); } ConsoleMethod( ShapeBase, isDestroyed, bool, 2, 2, "") { return object->isDestroyed(); } ConsoleMethod( ShapeBase, isDisabled, bool, 2, 2, "True if the state is not Enabled.") { return object->getDamageState() != ShapeBase::Enabled; } ConsoleMethod( ShapeBase, isEnabled, bool, 2, 2, "") { return object->getDamageState() == ShapeBase::Enabled; } ConsoleMethod( ShapeBase, applyDamage, void, 3, 3, "(float amt)") { object->applyDamage(dAtof(argv[2])); } ConsoleMethod( ShapeBase, applyRepair, void, 3, 3, "(float amt)") { object->applyRepair(dAtof(argv[2])); } ConsoleMethod( ShapeBase, setRepairRate, void, 3, 3, "(float amt)") { F32 rate = dAtof(argv[2]); if(rate < 0) rate = 0; object->setRepairRate(rate); } ConsoleMethod( ShapeBase, getRepairRate, F32, 2, 2, "") { return object->getRepairRate(); } ConsoleMethod( ShapeBase, setRechargeRate, void, 3, 3, "(float rate)") { object->setRechargeRate(dAtof(argv[2])); } ConsoleMethod( ShapeBase, getRechargeRate, F32, 2, 2, "") { return object->getRechargeRate(); } ConsoleMethod( ShapeBase, getControllingClient, S32, 2, 2, "Returns a GameConnection.") { if (GameConnection* con = object->getControllingClient()) return con->getId(); return 0; } ConsoleMethod( ShapeBase, getControllingObject, S32, 2, 2, "") { if (ShapeBase* con = object->getControllingObject()) return con->getId(); return 0; } // return true if can cloak, otherwise the reason why object cannot cloak ConsoleMethod( ShapeBase, canCloak, bool, 2, 2, "") { return true; } ConsoleMethod( ShapeBase, setCloaked, void, 3, 3, "(bool isCloaked)") { bool cloaked = dAtob(argv[2]); if (object->isServerObject()) object->setCloakedState(cloaked); } ConsoleMethod( ShapeBase, isCloaked, bool, 2, 2, "") { return object->getCloakedState(); } ConsoleMethod( ShapeBase, setDamageFlash, void, 3, 3, "(float lvl)") { F32 flash = dAtof(argv[2]); if (object->isServerObject()) object->setDamageFlash(flash); } ConsoleMethod( ShapeBase, getDamageFlash, F32, 2, 2, "") { return object->getDamageFlash(); } ConsoleMethod( ShapeBase, setWhiteOut, void, 3, 3, "(float flashLevel)") { F32 flash = dAtof(argv[2]); if (object->isServerObject()) object->setWhiteOut(flash); } ConsoleMethod( ShapeBase, getWhiteOut, F32, 2, 2, "") { return object->getWhiteOut(); } ConsoleMethod( ShapeBase, getCameraFov, F32, 2, 2, "") { if (object->isServerObject()) return object->getCameraFov(); return 0.0; } ConsoleMethod( ShapeBase, setCameraFov, void, 3, 3, "(float fov)") { if (object->isServerObject()) object->setCameraFov(dAtof(argv[2])); } ConsoleMethod( ShapeBase, setInvincibleMode, void, 4, 4, "(float time, float speed)") { object->setupInvincibleEffect(dAtof(argv[2]), dAtof(argv[3])); } ConsoleFunction(setShadowDetailLevel, void , 2, 2, "setShadowDetailLevel(val 0...1);") { argc; F32 val = dAtof(argv[1]); if (val < 0.0f) val = 0.0f; else if (val > 1.0f) val = 1.0f; if (mFabs(Shadow::getGlobalShadowDetailLevel()-val)<0.001f) return; // shadow details determined in two places: // 1. setGlobalShadowDetailLevel // 2. static shape header has some #defines that determine // at what level of shadow detail each type of // object uses a generic shadow or no shadow at all Shadow::setGlobalShadowDetailLevel(val); Con::setFloatVariable("$pref::Shadows", val); } ConsoleMethod( ShapeBase, startFade, void, 5, 5, "( int fadeTimeMS, int fadeDelayMS, bool fadeOut )") { U32 fadeTime; U32 fadeDelay; bool fadeOut; dSscanf(argv[2], "%d", &fadeTime ); dSscanf(argv[3], "%d", &fadeDelay ); fadeOut = dAtob(argv[4]); object->startFade( fadeTime / 1000.0, fadeDelay / 1000.0, fadeOut ); } ConsoleMethod( ShapeBase, setDamageVector, void, 3, 3, "(Vector3F origin)") { VectorF normal; dSscanf(argv[2], "%g %g %g", &normal.x, &normal.y, &normal.z); normal.normalize(); object->setDamageDir(VectorF(normal.x, normal.y, normal.z)); } ConsoleMethod( ShapeBase, setShapeName, void, 3, 3, "(string tag)") { object->setShapeName(argv[2]); } ConsoleMethod( ShapeBase, setSkinName, void, 3, 3, "(string tag)") { object->setSkinName(argv[2]); } ConsoleMethod( ShapeBase, getShapeName, const char*, 2, 2, "") { return object->getShapeName(); } ConsoleMethod( ShapeBase, getSkinName, const char*, 2, 2, "") { return object->getSkinName(); } ConsoleMethod(ShapeBase, setNodeVisible, void, 4, 4, "( string name, bool visible )") { const char* index = argv[2]; bool visible = dAtoi(argv[3]); object->setNodeVisible(index, visible); } ConsoleMethod(ShapeBase, hideNode, void, 3, 3, "( string name ) - Backwards compatibility") { object->setNodeVisible(argv[2], 0); } ConsoleMethod(ShapeBase, unHideNode, void, 3, 3, "( string name ) - Backwards compatibility") { object->setNodeVisible(argv[2], 1); } ConsoleMethod( ShapeBase, isNodeVisible, bool, 3, 3, "( string name )") { return object->getShapeInstance()->isNodeVisible(argv[2]); } ConsoleMethod(ShapeBase, setNodeColor, void, 4, 4, "( string name, color )") { float r = 0.0; float g = 0.0; float b = 0.0; float a = 0.0; dSscanf(argv[3], "%f %f %f %f", &r, &g, &b, &a); object->setNodeColor(argv[2], ColorI(unsigned char(r * 255.0), unsigned char(g * 255.0), unsigned char(b * 255.0), unsigned char(a * 255.0))); } ConsoleMethod(ShapeBase, getNodeColor, const char*, 3, 3, "( string name )") { if (!object->getShapeInstance()) return StringTable->insert("0 0 0 0"); ColorI col = object->getShapeInstance()->getNodeColor(argv[2]); char* ret = Con::getReturnBuffer(128); dSprintf(ret, 128, "%.2f %.2f %.2f %.2f", (F32)col.red / 255.f, (F32)col.green / 255.f, (F32)col.blue / 255.f, (F32)col.alpha / 255.f); return ret; } ConsoleMethod(ShapeBase, setMeshVert, void, 7, 7, "( mesh_index, vertex_index, x, y, z )") { // Arguments S32 mesh_index = dAtoi(argv[2]); S32 vert_index = dAtoi(argv[3]); S32 vert_xposi = dAtoi(argv[4]); S32 vert_yposi = dAtoi(argv[5]); S32 vert_zposi = dAtoi(argv[6]); // Shapes TSShapeInstance* inst = object->getShapeInstance(); TSShape* shape = NULL; if (!inst) return; shape = inst->getShape(); if (mesh_index >= shape->meshes.size()) { Con::errorf("%s() - mesh_index out of range; index = %d, size = %d", mesh_index, shape->meshes.size()); return; } if (vert_index >= shape->meshes[mesh_index]->verts.size()) { Con::errorf("%s() - vert_index out of range; index = %d, size = %d", vert_index, shape->meshes[mesh_index]->verts.size()); return; } shape->meshes[mesh_index]->verts[vert_index].x = vert_xposi; shape->meshes[mesh_index]->verts[vert_index].y = vert_yposi; shape->meshes[mesh_index]->verts[vert_index].z = vert_zposi; } //---------------------------------------------------------------------------- void ShapeBase::consoleInit() { Con::addVariable("SB::DFDec", TypeF32, &sDamageFlashDec); Con::addVariable("SB::WODec", TypeF32, &sWhiteoutDec); Con::addVariable("pref::environmentMaps", TypeBool, &gRenderEnvMaps); }
28.947343
176
0.598805
[ "mesh", "render", "object", "shape", "vector", "transform", "solid" ]
a79f57e24c8344231ef0bbe5b7f96016161ac25d
9,786
cpp
C++
rmf_traffic_editor/gui/layer.cpp
samcts2309/rmf_traffic_editor
7e307bef8223f0d94b786fdc83bb6b74b802d985
[ "Apache-2.0" ]
24
2021-03-30T13:48:27.000Z
2022-02-22T02:44:11.000Z
rmf_traffic_editor/gui/layer.cpp
samcts2309/rmf_traffic_editor
7e307bef8223f0d94b786fdc83bb6b74b802d985
[ "Apache-2.0" ]
77
2021-03-29T05:11:02.000Z
2022-03-15T07:15:38.000Z
rmf_traffic_editor/gui/layer.cpp
samcts2309/rmf_traffic_editor
7e307bef8223f0d94b786fdc83bb6b74b802d985
[ "Apache-2.0" ]
26
2021-03-30T03:33:42.000Z
2022-02-21T05:07:58.000Z
/* * Copyright (C) 2019-2021 Open Source Robotics Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ #include <cmath> #include <QImageReader> #include <QGraphicsPixmapItem> #include <QGraphicsScene> #include <QTableWidget> #include "layer.h" using std::string; using std::vector; Layer::Layer() { } Layer::~Layer() { } bool Layer::from_yaml(const std::string& _name, const YAML::Node& y) { if (!y.IsMap()) throw std::runtime_error("Layer::from_yaml() expected a map"); name = _name; filename = y["filename"].as<string>(); if (y["meters_per_pixel"]) { // legacy transform format, need to re-compute transform // because the origin has changed from the lower-left to the // upper-left of the layer image, to be consistent with the // handling of the base floorplan image transform.setScale(y["meters_per_pixel"].as<double>()); double image_height = 0; QImageReader image_reader(QString::fromStdString(filename)); image_reader.setAutoTransform(true); // we'll load this image here just for the purpose of getting its height QImage img = image_reader.read(); if (!img.isNull()) image_height = img.size().height() * transform.scale(); QPointF offset; if (y["rotation"]) // legacy key { const double yaw = y["rotation"].as<double>(); transform.setYaw(yaw); offset.setX(-image_height * sin(yaw)); offset.setY(-image_height * cos(yaw)); } if (y["translation_x"] && y["translation_y"]) // legacy keys transform.setTranslation( QPointF( offset.x() - y["translation_x"].as<double>(), offset.y() + y["translation_y"].as<double>())); } if (y["visible"]) visible = y["visible"].as<bool>(); if (y["transform"] && y["transform"].IsMap()) transform.from_yaml(y["transform"]); if (y["color"] && y["color"].IsSequence() && y["color"].size() == 4) color = QColor::fromRgbF( y["color"][0].as<double>(), y["color"][1].as<double>(), y["color"][2].as<double>(), y["color"][3].as<double>()); else color = QColor::fromRgbF(0, 0, 1, 0.5); if (y["features"] && y["features"].IsSequence()) { const YAML::Node& fy = y["features"]; for (YAML::const_iterator it = fy.begin(); it != fy.end(); ++it) { Feature f; f.from_yaml(*it); features.push_back(f); } } return load_image(); } bool Layer::load_image() { QImageReader image_reader(QString::fromStdString(filename)); image_reader.setAutoTransform(true); image = image_reader.read(); if (image.isNull()) { qWarning("unable to read %s: %s", qUtf8Printable(QString::fromStdString(filename)), qUtf8Printable(image_reader.errorString())); return false; } image = image.convertToFormat(QImage::Format_Grayscale8); colorize_image(); printf("successfully opened %s\n", filename.c_str()); return true; } YAML::Node Layer::to_yaml() const { YAML::Node y; y["filename"] = filename; y["visible"] = visible; y["color"].push_back(std::round(color.redF() * 1000.0) / 1000.0); y["color"].SetStyle(YAML::EmitterStyle::Flow); y["color"].push_back(std::round(color.greenF() * 1000.0) / 1000.0); y["color"].push_back(std::round(color.blueF() * 1000.0) / 1000.0); y["color"].push_back(std::round(color.alphaF() * 1000.0) / 1000.0); for (const auto& feature : features) y["features"].push_back(feature.to_yaml()); y["transform"] = transform.to_yaml(); return y; } void Layer::draw( QGraphicsScene* scene, const double level_meters_per_pixel, const CoordinateSystem& coordinate_system) { if (!visible) return; QGraphicsPixmapItem* item = scene->addPixmap(pixmap); // Store for later use in getting coordinates back out scene_item = item; item->setPos( transform.translation().x() / level_meters_per_pixel, transform.translation().y() / level_meters_per_pixel); item->setScale(transform.scale() / level_meters_per_pixel); item->setRotation(-1.0 * transform.yaw() * 180.0 / M_PI); if (!coordinate_system.is_y_flipped()) item->setTransform(item->transform().scale(1, -1)); double origin_radius = 0.5 / level_meters_per_pixel; QPen origin_pen(color, origin_radius / 4.0, Qt::SolidLine, Qt::RoundCap); //origin_pen.setWidthF(origin_radius / 4); // for purposes of the origin mark, let's say the origin is the center // of the first pixel of the image const QPointF origin( transform.translation().x() / level_meters_per_pixel + 0.5 * transform.scale() / level_meters_per_pixel * cos(transform.yaw() - M_PI / 4), transform.translation().y() / level_meters_per_pixel - 0.5 * transform.scale() / level_meters_per_pixel * sin(transform.yaw() - M_PI / 4)); scene->addEllipse( origin.x() - origin_radius, origin.y() - origin_radius, 2 * origin_radius, 2 * origin_radius, origin_pen); QPointF x_arrow( origin.x() + 2.0 * origin_radius * cos(transform.yaw()), origin.y() - 2.0 * origin_radius * sin(transform.yaw())); scene->addLine(QLineF(origin, x_arrow), origin_pen); for (Feature& feature : features) feature.draw(scene, color, transform, level_meters_per_pixel); } QColor Layer::default_color(const int layer_idx) { switch (layer_idx) { case 0: default: return QColor::fromRgbF(1, 0, 0, 1.0); case 1: return QColor::fromRgbF(0, 1, 0, 1.0); case 2: return QColor::fromRgbF(0, 0, 1, 1.0); case 3: return QColor::fromRgbF(1, 1, 0, 1.0); case 4: return QColor::fromRgbF(0, 1, 1, 1.0); case 5: return QColor::fromRgbF(1, 0, 1, 1.0); } } void Layer::remove_feature(QUuid feature_id) { int index_to_remove = -1; for (std::size_t i = 0; i < features.size(); i++) { if (feature_id == features[i].id()) index_to_remove = i; } if (index_to_remove < 0) return; features.erase(features.begin() + index_to_remove); } QUuid Layer::add_feature( const double x, const double y, const double level_meters_per_pixel) { printf("Layer::add_feature(%s, %.3f, %.3f, %.3f)\n", name.c_str(), x, y, level_meters_per_pixel); // convert clicks in the working area to meters const double mpp = level_meters_per_pixel; QPointF layer_pixel = transform.backwards(QPointF(x * mpp, y * mpp)); printf(" transformed: (%.3f, %.3f)\n", layer_pixel.x(), layer_pixel.y()); features.push_back(Feature(layer_pixel)); return features.rbegin()->id(); } const Feature* Layer::find_feature( const double x, const double y, const double level_meters_per_pixel) const { const double mpp = level_meters_per_pixel; QPointF layer_pixel = transform.backwards(QPointF(x * mpp, y * mpp)); double min_dist = 1e9; const Feature* min_feature = nullptr; for (std::size_t i = 0; i < features.size(); i++) { const Feature& f = features[i]; const double dx = layer_pixel.x() - f.x(); const double dy = layer_pixel.y() - f.y(); const double dist = sqrt(dx * dx + dy * dy); if (dist < min_dist) { min_dist = dist; min_feature = &features[i]; } } printf("min_dist = %.3f layer scale = %.3f\n", min_dist, transform.scale()); if (min_dist * transform.scale() < Feature::radius_meters) return min_feature; return nullptr; } QPointF Layer::transform_global_to_layer(const QPointF& global_point) { return transform.backwards(global_point); } QPointF Layer::transform_layer_to_global(const QPointF& layer_point) { return transform.forwards(layer_point); } void Layer::clear_selection() { for (auto& feature : features) feature.setSelected(false); } void Layer::colorize_image() { color.setAlphaF(0.5); colorized_image = QImage(image.size(), QImage::Format_ARGB32); for (int row_idx = 0; row_idx < image.height(); row_idx++) { const uint8_t* const in_row = (uint8_t*)image.scanLine(row_idx); QRgb* out_row = (QRgb*)colorized_image.scanLine(row_idx); for (int col_idx = 0; col_idx < image.width(); col_idx++) { const uint8_t in = in_row[col_idx]; if (in < 100 || row_idx == 0 || row_idx == image.height() - 1) out_row[col_idx] = color.rgba(); else if (in > 200) out_row[col_idx] = qRgba(0, 0, 0, 0); else out_row[col_idx] = qRgba(in, in, in, 50); } // draw bold first/last columns the requested color on the image, // so it's easier to see what's going on with its transform out_row[0] = color.rgba(); out_row[image.width()-1] = color.rgba(); } pixmap = QPixmap::fromImage(colorized_image); } void Layer::populate_property_editor(QTableWidget* property_editor) const { property_editor->blockSignals(true); property_editor->setRowCount(transform_strings.size()); for (std::size_t i = 0; i < transform_strings.size(); i++) { QTableWidgetItem* label_item = new QTableWidgetItem( QString::fromStdString(transform_strings[i].first)); label_item->setFlags(Qt::NoItemFlags); QTableWidgetItem* value_item = new QTableWidgetItem( QString::fromStdString(transform_strings[i].second)); value_item->setFlags(Qt::NoItemFlags); property_editor->setItem(i, 0, label_item); property_editor->setItem(i, 1, value_item); } property_editor->blockSignals(false); }
28.283237
80
0.661557
[ "vector", "transform" ]
a79ff3000f2a1f78a3806fe690220d73b517adfa
16,810
cpp
C++
MathLibTest/Source/RungeKuttaWrapper_TEST.cpp
bgin/MissileSimulation
90adcbf1c049daafb939f3fe9f9dfe792f26d5df
[ "MIT" ]
23
2016-08-28T23:20:12.000Z
2021-12-15T14:43:58.000Z
MathLibTest/Source/RungeKuttaWrapper_TEST.cpp
bgin/MissileSimulation
90adcbf1c049daafb939f3fe9f9dfe792f26d5df
[ "MIT" ]
1
2018-06-02T21:29:51.000Z
2018-06-05T05:59:31.000Z
MathLibTest/Source/RungeKuttaWrapper_TEST.cpp
bgin/MissileSimulation
90adcbf1c049daafb939f3fe9f9dfe792f26d5df
[ "MIT" ]
1
2019-07-04T22:38:22.000Z
2019-07-04T22:38:22.000Z
#include "RungeKuttaWraper_TEST.h" #include "../MathLib/MathConstants.h" #define SQRT(x) std::sqrt(x); #define ABS(x) std::fabs(x); /* @brief Evaluate derivatives of PDE y'' = y. */ void test::RKWTest::DerivY(double* T, double* Y, double* YP) { YP[0] = Y[1]; YP[1] = -Y[0]; } /* @brief Measure timing performance. */ void test::RKWTest::perf(unsigned long long* start, unsigned long long* end, int size, const char* funame) { _ASSERT((size > 0) && (funame != nullptr)); unsigned long long avr_start{ 0ULL }; unsigned long long avr_end{ 0ULL }; int nIters = size; nIters = nIters + 1; std::printf("Timing performance of %s routine, using RDTSC intrinsic.\n", funame); std::printf("Dumping stats... \n"); std::printf("Timing Iterations=%d\n", size); std::printf("Iter# | TSC_START | Delta/Iter | TSC_STOP\n"); for (int i{ 1 }; i < nIters; ++i) std::printf("%d, %ull, %ull, %ull\n", i, start[i], end[i], (end[i] - start[i])); std::printf(" Done!!\n"); std::printf("Computing average number of TSC Cycles... \n"); for (int i{ 1 }; i < nIters; ++i) { avr_start += start[i]; avr_end += end[i]; } double avr_cycles{ static_cast<double>((avr_end - avr_start) / size) }; std::printf("Average of TSC_CYCLES=%.15f, nanoseconds=%.15f\n", avr_cycles, avr_cycles * 0.4166666666666666); std::printf("Done!!\n"); } void test::RKWTest::perf(std::vector<unsigned long long> &start, std::vector<unsigned long long> &stop, std::string const& fname) { _ASSERTE(start.size() == stop.size()); unsigned long long avr_start{ 0ULL }; unsigned long long avr_stop{ 0ULL }; std::vector<unsigned long long>::iterator iter1, iter2; iter1 = start.begin(); iter2 = stop.begin(); std::printf("Timing performance of %s routine, using RDTSC intrinsic.\n", fname.c_str()); std::printf("Dumping stats\n"); std::printf("Iterations=%d\n", start.size()); std::printf(" TSC_START | Delta/Iter | TSC_STOP \n"); while( (iter1 != start.end()) && (iter2 != stop.end())) { std::printf("%ull, %ull, %ull\n", *iter1.operator->(), *iter2.operator->(), (*iter2.operator->() - *iter1.operator->())); avr_stop += *iter2.operator->() - *iter1.operator->(); ++iter1; ++iter2; } std::printf("%ull\n", avr_stop); //std::printf("Average of TSC_CYCLES/Iter=%ull, nanoseconds=%.15f\n", avr_stop / start.size(), static_cast<double>(avr_stop / start.size()); std::printf("Done!!\n"); } /* @brief Prepare Runge-Kutta method of calculation. */ void test::RKWTest::Test1_RungeKutta() { unsigned long long TSC_CYCLES_START[8] = { 0ULL }; unsigned long long TSC_CYCLES_STOP[8] = { 0ULL }; int NEQ{ 2 }; int LENWRK{ 32 * NEQ }; int METHOD{ 2 }; double ZERO{ 0.0 }; double ONE{ 1.0 }; double TWO{ 2.0 }; double FOUR{ 4.0 }; double HNEXT{ ZERO }; double HSTART{ ZERO }; double PI{ mathlib::MathConstants::PI_DBL() }; double T{ ZERO }; double TEND, TINC, TLAST, TOL, TSTART, TWANT; double WASTE{ 0.0 }; int NOUT{ 8 }; int STPCST{ 0 }; int STPSOK{ 0 }; int TOTF{ 0 }; int UFLAG{ 0 }; int ERRASS{ 0 }, MESAGE{ 1 }; std::printf("Integrating Diff_EQ of type: Y'' = Y with METHOD=%d\n", METHOD); double THRES[2] = { 0.0 }; double WORK[32 * 2] = { 0.0 }; double Y[2] = { 0.0 }; double YMAX[2] = { 0.0 }; double YP[2] = { 0.0 }; double YSTART[2] = { 0.0 }; unsigned char TASK[] = "U"; //void(*F)(double *, double *, double *) = &test::RKWTest::DerivY; TSTART = ZERO; YSTART[0] = ZERO; YSTART[1] = ONE; TLAST = TWO * PI; TEND = TLAST + PI; std::printf(" t: | y: | true y: \n"); std::printf("%.9f, %.9f, %.9f\n", TSTART, YSTART[0], ::sin(TSTART)); std::printf(" %.9f, %.9f\n", YSTART[1], ::cos(TSTART)); std::printf("Setting ERROR and Control Parameters..."); TOL = 5.0e-5; THRES[0] = THRES[1] = 0.0000000001; //std::printf("THRES[1]=%.15f,THRES[2]=%.15f\n", THRES[1], THRES[2]); std::printf("Done\n"); std::printf("Calling SETUP routine... "); SETUP(&NEQ, &TSTART, &YSTART[0], &TEND, &TOL, &THRES[0], &METHOD, &TASK[0], &ERRASS, &HSTART, &WORK[0], &LENWRK, &MESAGE); std::printf("Done\n"); TINC = (TLAST - TSTART) / NOUT; std::printf("Integrating at STEPS:%u\n", NOUT); for (int i = 1; i < NOUT + 1; ++i) { TWANT = TLAST + (i - NOUT) * TINC; //mathlib::RungeKuttaSolver::rk_ut(F, TWANT, T, Y, YP, YMAX, WORK, UFLAG); TSC_CYCLES_START[i] = __rdtsc(); UT([](double* T, double* Y, double* YP)->void{YP[0] = Y[1]; YP[1] = -Y[0]; }, &TWANT, &T, &Y[0], &YP[0], &YMAX[0], WORK, &UFLAG); TSC_CYCLES_STOP[i] = __rdtsc(); if (UFLAG > 2) goto label60; std::printf("%.9f, %.9f, %.9f\n", TWANT, Y[0], ::sin(TWANT)); std::printf(" %.9f, %.9f\n", Y[1], ::cos(TWANT)); } std::printf("Maximum magnitude: YMAX[%d]=%.15f,YMAX[%d]=%.15f\n", 0, YMAX[0], 1, YMAX[1]); STAT(&TOTF, &STPCST, &WASTE, &STPSOK, &HNEXT); std::printf("Total calls of Derivative:%d\n", TOTF); std::printf("Number of Derivative calls per step:%d\n", STPCST); std::printf("The fraction od failed steps:%.15f\n", WASTE); std::printf("Number of useful steps:%d\n", STPSOK); std::printf("Integrator next step size:%.15f\n", HNEXT); perf(TSC_CYCLES_START, TSC_CYCLES_STOP, NOUT, "RK_UT"); return; label60: std::printf("Unexpected Soft or Hard Failure of value=%d\n", UFLAG); return; } void test::RKWTest::Test2_RungeKutta() { std::printf("Allocation and initialization of variables... "); //std::vector<unsigned long long> start; //std::vector<unsigned long long> stop; //const double EPS{ 0.0000001 }; int NEQ{ 4 }; int METHOD{ 3 }; int LENWRK{ 32 * NEQ }; double ECC{ 0.9 }; double ZERO{ 0.0 }; double ONE{ 1.0 }; double ERROR, HNEXT, HSTART = 0.0, TEND, TNOW, TOL, TSTART, WASTE = 0.0, WEIGHT; int CFLAG{ 0 }; int CFLAG3; int STPCST{ 0 }, int STPSOK{ 0 }, int TOTF{ 0 }; int ERRASS{ 0 }; int MESAGE{ 1 }; double THRES[4] = { 0.0 }; double TRUY[4]; double WORK[32 * 4] = { 0.0 }; double YMAX[4] = { 0.0 }; double YNOW[4] = { 0.0 }; double YPNOW[4] = { 0.0 }; double YSTART[4] = { 0.0 }; unsigned char TASK[] = "C"; std::printf("done\n"); std::printf("Preparing to Integrate Diff_EQ of type x'' -x/r^3, y'' = -y/r^3\n"); std::printf("Setting initial conditions... "); TSTART = ZERO; YSTART[0] = ONE - ECC; YSTART[1] = ZERO; YSTART[2] = ZERO; YSTART[3] = SQRT((ONE + ECC) / (ONE - ECC)); TEND = 20.0; TRUY[0] = -1.29526625098758; TRUY[1] = 0.400393896379232; TRUY[2] = -0.67753909247075; TRUY[3] = -0.127083815427869; for (int i{ 0 }; i < NEQ; ++i) YMAX[i] = ABS(YSTART[i]); std::printf("done\n"); std::printf("Setting error and control parameters... "); TOL = 0.0000000001; for (int i{ 0 }; i < NEQ; ++i) THRES[i] = 1.0e-13; std::printf("done\n"); std::printf("Calling SETUP routine... "); SETUP(&NEQ, &TSTART, &YSTART[0], &TEND, &TOL, &THRES[0], &METHOD, &TASK[0], &ERRASS, &HSTART, &WORK[0], &LENWRK, &MESAGE); std::printf("done\n"); CFLAG3 = 0; std::printf("Integration process started...."); unsigned int nIters{ 0 }; unsigned long long start{ __rdtsc() }; do { ++nIters; CT([](double* T, double* Y, double* YP)->void{ double R{ std::sqrt(((Y[0] * Y[0]) + (Y[1] * Y[1]))) }; YP[0] = Y[2]; YP[1] = Y[3]; YP[2] = -Y[0] / (R * R * R); YP[3] = -Y[1] / (R * R * R); }, &TNOW, &YNOW[0], &YPNOW[0], &WORK[0], &CFLAG); for (int i{ 0 }; i < NEQ; ++i) YMAX[i] = std::fmax(YMAX[i], std::fabs(YNOW[i])); if (CFLAG <= 3) { //std::printf("TNOW=%.15f,YNOW[%d]=%.15f,YNOW[%d]=%.15f,YNOW[%d]=%.15f,YNOW[%d]=%.15f\n", TNOW, 0, YNOW[0], 1, YNOW[1], 2, YNOW[2], 3, YNOW[3]); if (CFLAG == 3) CFLAG3 += 1; //if ((std::fabs(YNOW[0] - TRUY[0]) <= EPS) || (std::fabs(YNOW[1] - TRUY[1]) <= EPS) || //(std::fabs(YNOW[2] - TRUY[3]) <= EPS) || (std::fabs(YNOW[3] - TRUY[3]) <= EPS)) //break; } } while ((TNOW < TEND) && (CFLAG3 < 3)); unsigned long long stop{ __rdtsc() }; std::printf("Done!!\n"); std::printf("Differential Equation Solution:\n"); std::printf(" Y | True Y \n"); for (int i{ 0 }; i < NEQ; ++i) std::printf("%.15f, %.15f\n", YNOW[i], TRUY[i]); std::printf("Main computation loop executed in:%llu TSC_Cycles/Iter\n", (stop - start) / nIters); std::printf("Solution maximum magnitude:\n"); for (int i{ 0 }; i < NEQ; ++i) std::printf("YMAX[%d]=%.15f\n", i, YMAX[i]); std::printf("Calling STAT subroutine\n"); STAT(&TOTF, &STPCST, &WASTE, &STPSOK, &HNEXT); std::printf("Integration reached %.15f\n", TNOW); std::printf("Total calls of Derivative:%d\n", TOTF); std::printf("Number of Derivative calls per step:%d\n", STPCST); std::printf("The fraction od failed steps:%.15f\n", WASTE); std::printf("Number of useful steps:%d\n", STPSOK); std::printf("Integrator next step size:%.15f\n", HNEXT); std::printf("Absolute Error analysis started\n"); if ((std::fabs(TNOW) - std::fabs(TEND)) <= TOL) { ERROR = ZERO; for (int i{ 0 }; i < NEQ; ++i) { WEIGHT = std::fmax(std::fabs(YNOW[i]), THRES[i]); ERROR = std::fmax(ERROR, std::fabs(TRUY[i] - YNOW[i]) / WEIGHT); } std::printf("At t = 20, the error is:%.15f\n", ERROR); std::printf("Tolerance=%.15f\n", TOL); } //perf(start, stop, std::string("CT")); std::printf("Done!!\n"); } void test::RKWTest::Test3_RungeKutta() { std::printf("Allocation and initialization of variables... "); int NEQ{ 2 }; int METHOD{ 2 }; int NWANT{ NEQ }; int NINT{ 6 * NEQ }; int LENWRK{ 14 * NEQ }; int MAXPER{ 100 }; double ZERO{ 0.0 }; double ONE{ 1.0 }; double FOUR{ 4.0 }; double HNEXT, TEND, TNOW, TOUT, TSTART, TOL, WASTE; double HSTART{ ZERO }; double PI{ mathlib::MathConstants::PI_DBL() }; double TWOPI{ mathlib::MathConstants::TWO_PI_DBL() }; test::BPARAM bparam; bparam.B = 9.8; double B{ 9.8 }; int CFLAG, KOUNTR, STPCST, STPSOK, TOTF; int ERRASS{ 0 }; int MESAGE{ 0 }; double THRES[2] = { 0.0 }; double WORK[28] = { 0.0 }; double WRKINT[12] = { 0.0 }; double YNOW[2] = { 0.0 }; double YOUT[2] = { 0.0 }; double YPNOW[2] = { 0.0 }; double YPOUT[1] = { 0.0 }; double YSTART[2] = { 0.0 }; unsigned char TASK[] = "C"; unsigned char REQUEST[] = "S"; std::printf("Done!!\n"); std::printf("Preparing to integrate Diff_EQ of form y1'=y2, y2'=-0.1*y2-y1^3+B*cos(t)\n"); std::printf("Setting initial conditions... "); TSTART = ZERO; YSTART[0] = 3.3; YSTART[1] = -3.3; TEND = TSTART + MAXPER * TWOPI + TWOPI; std::printf("Done!!\n"); std::printf("Setting error control parameters... "); TOL = 1.0e-5; THRES[0] = 1.0e-10; THRES[1] = 1.0e-10; std::printf("Done!!\n"); std::printf("Calling SETUP Subroutine... "); SETUP(&NEQ, &TSTART, &YSTART[0], &TEND, &TOL, &THRES[0], &METHOD, &TASK[0], &ERRASS, &HSTART, &WORK[0], &LENWRK, &MESAGE); std::printf("Done!!\n"); KOUNTR = 1; TOUT = TSTART + TWOPI; int nIters{ 0 }; unsigned long long start{ __rdtsc() }; label40: ++nIters; CT([](double* T, double* Y, double* YP)->void{ double K{ 0.1 }; YP[0] = Y[1]; YP[1] = -K*Y[1] - (Y[0] * Y[0] * Y[0]) + 9.8 * ::cos(*T); }, &TNOW, &YNOW[0], &YPNOW[0], &WORK[0], &CFLAG); unsigned long long end{ __rdtsc() }; label80: if (TNOW < TOUT) goto label40; else { INTRP(&TOUT, &REQUEST[0], &NWANT, &YOUT[0], &YPOUT[0], [](double* T, double* Y, double* YP)->void{ double K{ 0.1 }; YP[0] = Y[1]; YP[1] = -K*Y[1] - (Y[0] * Y[0] * Y[0]) + 9.8 * ::cos(*T); }, &WORK[0], &WRKINT[0], &NINT); if (KOUNTR < MAXPER) { KOUNTR += 1; TOUT += TWOPI; goto label80; } goto label180; } if (CFLAG == 3) goto label40; else if (CFLAG == 4) { std::printf("The problem appears to be stiff, exiting\n"); goto Failure; } else if (CFLAG == 5) { std::printf("The accuracy request is too stringent, exiting\n"); goto Failure; } else if (CFLAG == 6) { std::printf("Global error estimation broke down, exiting\n"); goto Failure; } label180: //Call STAT. std::printf("Solution of Diff_EQ... "); std::printf("YOUT[%d]=%.15f\n", 0, YOUT[0]); std::printf(" YOUT[%d]=%.15f\n", 1, YOUT[1]); if (((end - start) > 0) && (nIters > 0)) std::printf("Cost of single call to CT:%lluTSC_CYCLES\n", (end - start) / nIters); std::printf("Calling STAT Subroutine, getting statistics\n"); STAT(&TOTF, &STPCST, &WASTE, &STPSOK, &HNEXT); std::printf("The integration reached:%.15f\n", TNOW); std::printf("The cost of integration in calls to Derivative:%d\n", TOTF); std::printf("The number of calls to Derivative per step:%d\n", STPCST); std::printf("The fraction of failed steps:%.15f\n", WASTE); std::printf("The number of accepted steps:%d\n", STPSOK); return; Failure : std::printf("Catastrophic error cannot continue, exiting\n"); return; } void test::RKWTest::Test4_RungeKutta() { std::printf("Allocation and initialization of variables... "); int NEQ{ 2 }; int METHOD{ 3 }; int LENWRK{ 21 * NEQ }; int MAXPER{ 100 }; double ZERO{ 0.0 }; double ONE{ 1.0 }; double FOUR{ 4.0 }; double ERRMAX, HNEXT, HSTART, TEND, TERRMAX, TNOW, TOL, TSTART, WASTE; int CFLAG, KOUNTR, STPCST, STPSOK, TOTF; int ERRASS{ 1 }; int MESAGE{ 0 }; double RMSERR[2] = { 0.0 }; double THRES[2] = { 0.0 }; double WORK[42] = { 0.0 }; double YNOW[2] = { 0.0 }; double YPNOW[2] = { 0.0 }; double YSTART[2] = { 0.0 }; double PI{ mathlib::MathConstants::PI_DBL() }; double TWOPI{ mathlib::MathConstants::TWO_PI_DBL() }; unsigned char TASK[] = "C"; std::printf("Done!!\n"); std::printf("Setting initial conditions... "); TSTART = ZERO; YSTART[0] = 3.3; YSTART[1] = -3.3; TEND = TSTART + TWOPI; std::printf("Done!!\n"); std::printf("Setting error conditions... "); TOL = 1.0E-7; THRES[0] = THRES[1] = 1.0E-10; std::printf("Done!!\n"); HSTART = ZERO; std::printf("Calling SETUP Subroutine... "); SETUP(&NEQ, &TSTART, &YSTART[0], &TEND, &TOL, &THRES[0], &METHOD, &TASK[0], &ERRASS, &HSTART, &WORK[0], &LENWRK, &MESAGE); std::printf("Done!!\n"); KOUNTR = 1; int nIters{ 0 }; unsigned long long start{ __rdtsc() }; label40: ++nIters; CT([](double* T, double* Y, double* YP)->void{ double K{ 0.1 }; YP[0] = Y[1]; YP[1] = -K*Y[1] - (Y[0] * Y[0] * Y[0]) + 11.0*::cos(*T); }, &TNOW, &YNOW[0], &YPNOW[0], &WORK[0], &CFLAG); unsigned long long stop{ __rdtsc() }; if ((CFLAG == 1) || (CFLAG == 2)) if (TNOW < TEND) goto label40; else { std::printf("YNOW[%d]=%.15f, YNOW[%d]=%.15f\n", 0, YNOW[0], 1, YNOW[1]); if (KOUNTR < MAXPER) { KOUNTR += 1; TEND += TWOPI; RESET(&TEND); goto label40; } else goto label160; } if (CFLAG == 3) goto label40; else if (CFLAG == 4) { std::printf("The problem appears to be stiff, exiting\n"); goto Failure; } else if (CFLAG == 5) { std::printf("The accuracy request is too stringent, exiting\n"); goto Failure; } else if (CFLAG == 6) { std::printf("Global estimation error broke down\n"); goto label160; } label160: std::printf("Calling GLBERR for an error assesment\n"); if (ERRASS) { GLBERR(&RMSERR[0], &ERRMAX, &TERRMAX, &WORK[0]); std::printf("Tolerance:%.15f\n", TOL); std::printf("Worst global error was:%.15f,(It occured at:%.15f)\n", ERRMAX, TERRMAX); std::printf("RMS errors in individual components:\n"); std::printf("RMSERR[%d]=%.15f,RMSERR[%d]=%.15f\n", 0, RMSERR[0], 1, RMSERR[1]); } std::printf("Calling STAT Subroutine... "); STAT(&TOTF, &STPCST, &WASTE, &STPSOK, &HNEXT); std::printf("Done!!\n"); std::printf("Getting run-time stats\n"); std::printf("The integration reached:%.15f\n", TNOW); std::printf("Cost of integration in terms of Derivative calls:%d\n", TOTF); std::printf("Number of Derivative calls per step:%d\n", STPCST); std::printf("Fraction of failed steps:%.15f\n", WASTE); std::printf("Number of accepted steps:%d\n", STPSOK); std::printf("Next integration step:%.15f\n", HNEXT); if (((stop - start) > 0) && (nIters > 0)) std::printf("Cost of single call to CT is:%lluTSC_CYCLES\n", (stop - start) / nIters); return; Failure : std::printf("Failure!! cannot continue... exiting\n"); return; } void test::RKWTest::Run_Tests() { std::printf("Test #1 of Runge-Kutta ODE Solver has started\n"); Test1_RungeKutta(); std::printf("Test #1 of Runge-Kutta ODE Solver has ended\n\n"); std::printf("Test #2 of Runge-Kutta ODE Solver has started\n"); Test2_RungeKutta(); std::printf("Test #2 of Runge-Kutta ODE Solver has ended\n\n"); std::printf("Test #3 of Runge-Kutta ODE Solver has started\n"); Test3_RungeKutta(); std::printf("Test #3 of Runge-Kutta ODE Solver has ended\n\n"); std::printf("Test #4 of Runge-Kutta ODE Solver has started\n"); Test4_RungeKutta(); std::printf("Test #4 of Runge-Kutta ODE Solver has ended\n\n"); }
34.236253
148
0.595062
[ "vector" ]
a7a8b40ae665558ece98b33fe114b570df52d82b
1,294
hpp
C++
test/src/renderer.hpp
crockeo/clibgame
e2cedf43be69b1c665d544083e48899ab3025258
[ "MIT" ]
1
2016-11-22T09:44:27.000Z
2016-11-22T09:44:27.000Z
test/src/renderer.hpp
crockeo/clibgame
e2cedf43be69b1c665d544083e48899ab3025258
[ "MIT" ]
null
null
null
test/src/renderer.hpp
crockeo/clibgame
e2cedf43be69b1c665d544083e48899ab3025258
[ "MIT" ]
null
null
null
#ifndef _RENDERER_HPP_ #define _RENDERER_HPP_ ////////////// // Includes // #include <clibgame.hpp> ////////// // Code // // The standard order for which a rectangle ought to be rendered in OpenGL. const static std::vector<GLuint> STANDARD_ORDER { 0, 1, 2, 2, 3, 0 }; // Generating a vector of coordinates from a position and size. std::vector<GLfloat> generateCoords(const clibgame::Texable&, float, float, float, float); // A struct that represents a render. struct Render { std::vector<GLfloat> coordinates; std::vector<GLuint> order; clibgame::Texable* texable; clibgame::Shader* shader; }; // A central renderer for the test game. class Renderer : public clibgame::Renderer { private: std::vector<Render> renders; GLuint vao, vbo, ebo; // Performing a single render. void singleRender(Render) const; public: // Creating an empty renderer. Renderer(); // Destructing this renderer. ~Renderer(); // Adding a render to the next render. void addRender(Render); // Initializing this render. virtual void init(GLFWwindow*, clibgame::Res&) override; // Rendering bunches of stuff. virtual void render() const override; // Clearing out the last render. virtual void clear() override; }; #endif
21.932203
90
0.672334
[ "render", "vector" ]
a7b0201f9ccecef5f1ba245cd627e605fe0eb3bb
1,973
cpp
C++
query_optimizer/expressions/Exists.cpp
SongZhao/quickstep-with-BW
a4e194e170c485b9e116e2cd75dd3ecc4df92cb1
[ "Apache-2.0" ]
1
2021-08-22T19:16:59.000Z
2021-08-22T19:16:59.000Z
query_optimizer/expressions/Exists.cpp
udippant/incubator-quickstep
8169306c2923d68235ba3c0c8df4c53f5eee9a68
[ "Apache-2.0" ]
null
null
null
query_optimizer/expressions/Exists.cpp
udippant/incubator-quickstep
8169306c2923d68235ba3c0c8df4c53f5eee9a68
[ "Apache-2.0" ]
1
2021-11-30T13:50:59.000Z
2021-11-30T13:50:59.000Z
/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. **/ #include "query_optimizer/expressions/Exists.hpp" #include <vector> #include <string> #include "query_optimizer/OptimizerTree.hpp" #include "query_optimizer/expressions/ExprId.hpp" #include "glog/logging.h" namespace quickstep { class CatalogAttribute; class Predicate; namespace optimizer { namespace expressions { ::quickstep::Predicate* Exists::concretize( const std::unordered_map<ExprId, const CatalogAttribute*> &substitution_map) const { LOG(FATAL) << "Exists predicate should not be concretized"; return nullptr; } void Exists::getFieldStringItems( std::vector<std::string> *inline_field_names, std::vector<std::string> *inline_field_values, std::vector<std::string> *non_container_child_field_names, std::vector<OptimizerTreeBaseNodePtr> *non_container_child_fields, std::vector<std::string> *container_child_field_names, std::vector<std::vector<OptimizerTreeBaseNodePtr>> *container_child_fields) const { non_container_child_field_names->push_back("exists_subquery"); non_container_child_fields->push_back(exists_subquery_); } } // namespace expressions } // namespace optimizer } // namespace quickstep
34.017241
88
0.766346
[ "vector" ]
a7b1ba4803d49065844762c59e30532d36e7b722
27,558
cpp
C++
src/filesystem.cpp
wedataintelligence/sdk
b7064239ca82a53485a8913788be67e07d412971
[ "BSD-2-Clause" ]
null
null
null
src/filesystem.cpp
wedataintelligence/sdk
b7064239ca82a53485a8913788be67e07d412971
[ "BSD-2-Clause" ]
null
null
null
src/filesystem.cpp
wedataintelligence/sdk
b7064239ca82a53485a8913788be67e07d412971
[ "BSD-2-Clause" ]
null
null
null
/** * @file filesystem.cpp * @brief Generic host filesystem access interfaces * * (c) 2013-2014 by Mega Limited, Auckland, New Zealand * * This file is part of the MEGA SDK - Client Access Engine. * * Applications using the MEGA API must present a valid application key * and comply with the the rules set forth in the Terms of Service. * * The MEGA SDK 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. * * @copyright Simplified (2-clause) BSD License. * * You should have received a copy of the license along with this * program. */ #include "mega/filesystem.h" #include "mega/node.h" #include "mega/megaclient.h" #include "mega/logging.h" #include "mega/mega_utf8proc.h" namespace mega { namespace detail { template<typename CharT> bool isEscape(UnicodeCodepointIterator<CharT> it); template<typename CharT> int decodeEscape(UnicodeCodepointIterator<CharT>& it) { assert(isEscape(it)); // Skip the leading %. (void)it.get(); return hexval(it.get()) << 4 | hexval(it.get()); } int identity(const int c) { return c; } template<typename CharT> bool isControlEscape(UnicodeCodepointIterator<CharT> it) { if (isEscape(it)) { const int32_t c = decodeEscape(it); return c < 0x20 || c == 0x7f; } return false; } template<typename CharT> bool isEscape(UnicodeCodepointIterator<CharT> it) { return it.get() == '%' && islchex(it.get()) && islchex(it.get()); } template<typename CharT, typename CharU, typename UnaryOperation> int compareUtf(UnicodeCodepointIterator<CharT> first1, bool unescaping1, UnicodeCodepointIterator<CharU> first2, bool unescaping2, UnaryOperation transform) { while (!(first1.end() || first2.end())) { int c1; int c2; if (unescaping1 && isEscape(first1)) { c1 = decodeEscape(first1); } else { c1 = first1.get(); } if (unescaping2 && isEscape(first2)) { c2 = decodeEscape(first2); } else { c2 = first2.get(); } c1 = transform(c1); c2 = transform(c2); if (c1 != c2) { return c1 - c2; } } if (first1.end() && first2.end()) { return 0; } if (first1.end()) { return -1; } return 1; } } // detail int compareUtf(const string& s1, bool unescaping1, const string& s2, bool unescaping2, bool caseInsensitive) { return detail::compareUtf( unicodeCodepointIterator(s1), unescaping1, unicodeCodepointIterator(s2), unescaping2, caseInsensitive ? Utils::toUpper: detail::identity); } int compareUtf(const string& s1, bool unescaping1, const LocalPath& s2, bool unescaping2, bool caseInsensitive) { return detail::compareUtf( unicodeCodepointIterator(s1), unescaping1, unicodeCodepointIterator(s2.localpath), unescaping2, caseInsensitive ? Utils::toUpper: detail::identity); } int compareUtf(const LocalPath& s1, bool unescaping1, const string& s2, bool unescaping2, bool caseInsensitive) { return detail::compareUtf( unicodeCodepointIterator(s1.localpath), unescaping1, unicodeCodepointIterator(s2), unescaping2, caseInsensitive ? Utils::toUpper: detail::identity); } int compareUtf(const LocalPath& s1, bool unescaping1, const LocalPath& s2, bool unescaping2, bool caseInsensitive) { return detail::compareUtf( unicodeCodepointIterator(s1.localpath), unescaping1, unicodeCodepointIterator(s2.localpath), unescaping2, caseInsensitive ? Utils::toUpper: detail::identity); } bool isCaseInsensitive(const FileSystemType type) { if (type == FS_EXFAT || type == FS_FAT32 || type == FS_NTFS || type == FS_UNKNOWN) { return true; } #ifdef WIN32 return true; #else return false; #endif } FileSystemAccess::FileSystemAccess() : waiter(NULL) , skip_errorreport(false) , transient_error(false) , notifyerr(false) , notifyfailed(false) , target_exists(false) , client(NULL) { } void FileSystemAccess::captimestamp(m_time_t* t) { // FIXME: remove upper bound before the year 2100 and upgrade server-side timestamps to BIGINT if (*t > (uint32_t)-1) *t = (uint32_t)-1; else if (*t < 0) *t = 0; } const char *FileSystemAccess::fstypetostring(FileSystemType type) const { switch (type) { case FS_NTFS: return "NTFS"; case FS_EXFAT: return "EXFAT"; case FS_FAT32: return "FAT32"; case FS_EXT: return "EXT"; case FS_HFS: return "HFS"; case FS_APFS: return "APFS"; case FS_FUSE: return "FUSE"; case FS_SDCARDFS: return "SDCARDFS"; case FS_F2FS: return "F2FS"; case FS_XFS: return "XFS"; case FS_UNKNOWN: // fall through return "UNKNOWN FS"; } return "UNKNOWN FS"; } FileSystemType FileSystemAccess::getlocalfstype(const LocalPath& path) const { // Not enough information to determine path. if (path.empty()) { return FS_UNKNOWN; } FileSystemType type; // Try and get the type from the path we were given. if (getlocalfstype(path, type)) { // Path exists. return type; } // Try and get the type based on our parent's path. LocalPath parentPath(path); // Remove trailing separator, if any. parentPath.trimNonDriveTrailingSeparator(); // Did the path consist solely of that separator? if (parentPath.empty()) { return FS_UNKNOWN; } // Where does our name begin? auto index = parentPath.getLeafnameByteIndex(*this); // We have a parent. if (index) { // Remove the current leaf name. parentPath.truncate(index); // Try and get our parent's filesystem type. if (getlocalfstype(parentPath, type)) { return type; } } return FS_UNKNOWN; } bool FileSystemAccess::isControlChar(unsigned char c) const { return (c <= '\x1F' || c == '\x7F'); } // Group different filesystems types in families, according to its restricted charsets bool FileSystemAccess::islocalfscompatible(unsigned char c, bool, FileSystemType) const { return c >= ' ' && !strchr("\\/:?\"<>|*", c); } // replace characters that are not allowed in local fs names with a %xx escape sequence void FileSystemAccess::escapefsincompatible(string* name, FileSystemType fileSystemType) const { if (!name->compare("..")) { name->replace(0, 2, "%2e%2e"); return; } if (!name->compare(".")) { name->replace(0, 1, "%2e"); return; } char buf[4]; size_t utf8seqsize = 0; size_t i = 0; unsigned char c = '0'; while (i < name->size()) { c = static_cast<unsigned char>((*name)[i]); utf8seqsize = Utils::utf8SequenceSize(c); assert (utf8seqsize); if (utf8seqsize == 1 && !islocalfscompatible(c, true, fileSystemType)) { const char incompatibleChar = name->at(i); sprintf(buf, "%%%02x", c); name->replace(i, 1, buf); LOG_debug << "Escape incompatible character for filesystem type " << fstypetostring(fileSystemType) << ", replace '" << incompatibleChar << "' by '" << buf << "'\n"; } i += utf8seqsize; } } void FileSystemAccess::unescapefsincompatible(string *name, FileSystemType fileSystemType) const { if (!name->compare("%2e%2e")) { name->replace(0, 6, ".."); return; } if (!name->compare("%2e")) { name->replace(0, 3, "."); return; } for (int i = int(name->size()) - 2; i-- > 0; ) { // conditions for unescaping: %xx must be well-formed if ((*name)[i] == '%' && islchex((*name)[i + 1]) && islchex((*name)[i + 2])) { char c = static_cast<char>((hexval((*name)[i + 1]) << 4) + hexval((*name)[i + 2])); if (!islocalfscompatible(static_cast<unsigned char>(c), false, fileSystemType)) { std::string incompatibleChar = name->substr(i, 3); name->replace(i, 3, &c, 1); LOG_debug << "Unescape incompatible character for filesystem type " << fstypetostring(fileSystemType) << ", replace '" << incompatibleChar << "' by '" << name->substr(i, 1) << "'\n"; } } } } const char *FileSystemAccess::getPathSeparator() { #if defined (__linux__) || defined (__ANDROID__) || defined (__APPLE__) || defined (USE_IOS) return "/"; #elif defined(_WIN32) || defined(WINDOWS_PHONE) return "\\"; #else // Default case LOG_warn << "No path separator found"; return "\\/"; #endif } void FileSystemAccess::normalize(string* filename) const { if (!filename) return; const char* cfilename = filename->c_str(); size_t fnsize = filename->size(); string result; for (size_t i = 0; i < fnsize; ) { // allow NUL bytes between valid UTF-8 sequences if (!cfilename[i]) { result.append("", 1); i++; continue; } const char* substring = cfilename + i; char* normalized = (char*)utf8proc_NFC((uint8_t*)substring); if (!normalized) { filename->clear(); return; } result.append(normalized); free(normalized); i += strlen(substring); } *filename = std::move(result); } std::unique_ptr<LocalPath> FileSystemAccess::fsShortname(LocalPath& localname) { LocalPath s; if (getsname(localname, s)) { return ::mega::make_unique<LocalPath>(std::move(s)); } return nullptr; } // default DirNotify: no notification available DirNotify::DirNotify(const LocalPath& clocalbasepath, const LocalPath& cignore) { localbasepath = clocalbasepath; ignore = cignore; mFailed = 1; mFailReason = "Not initialized"; mErrorCount = 0; sync = NULL; } void DirNotify::setFailed(int errCode, const string& reason) { std::lock_guard<std::mutex> g(mMutex); mFailed = errCode; mFailReason = reason; } int DirNotify::getFailed(string& reason) { if (mFailed) { reason = mFailReason; } return mFailed; } // notify base LocalNode + relative path/filename void DirNotify::notify(notifyqueue q, LocalNode* l, LocalPath&& path, bool immediate) { // We may be executing on a thread here so we can't access the LocalNode data structures. Queue everything, and // filter when the notifications are processed. Also, queueing it here is faster than logging the decision anyway. Notification n; n.timestamp = immediate ? 0 : Waiter::ds; n.localnode = l; n.path = std::move(path); notifyq[q].pushBack(std::move(n)); #ifdef ENABLE_SYNC if (q == DirNotify::DIREVENTS || q == DirNotify::EXTRA) { sync->client->syncactivity = true; } #endif } // default: no fingerprint fsfp_t DirNotify::fsfingerprint() const { return 0; } bool DirNotify::fsstableids() const { return true; } DirNotify* FileSystemAccess::newdirnotify(LocalPath& localpath, LocalPath& ignore, Waiter*) { return new DirNotify(localpath, ignore); } FileAccess::FileAccess(Waiter *waiter) { this->waiter = waiter; this->isAsyncOpened = false; this->numAsyncReads = 0; } FileAccess::~FileAccess() { // All AsyncIOContext objects must be deleted before assert(!numAsyncReads && !isAsyncOpened); } // open file for reading bool FileAccess::fopen(const LocalPath& name) { updatelocalname(name, true); return sysstat(&mtime, &size); } bool FileAccess::isfile(const LocalPath& path) { return fopen(path) && type == FILENODE; } bool FileAccess::isfolder(const LocalPath& path) { return fopen(path) && type == FOLDERNODE; } // check if size and mtime are unchanged, then open for reading bool FileAccess::openf() { if (nonblocking_localname.empty()) { // file was not opened in nonblocking mode return true; } m_time_t curr_mtime; m_off_t curr_size; if (!sysstat(&curr_mtime, &curr_size)) { LOG_warn << "Error opening sync file handle (sysstat) " << curr_mtime << " - " << mtime << curr_size << " - " << size; return false; } if (curr_mtime != mtime || curr_size != size) { mtime = curr_mtime; size = curr_size; retry = false; return false; } return sysopen(); } void FileAccess::closef() { if (!nonblocking_localname.empty()) { sysclose(); } } void FileAccess::asyncopfinished(void *param) { Waiter *waiter = (Waiter *)param; if (waiter) { waiter->notify(); } } AsyncIOContext *FileAccess::asyncfopen(const LocalPath& f) { updatelocalname(f, true); LOG_verbose << "Async open start"; AsyncIOContext *context = newasynccontext(); context->op = AsyncIOContext::OPEN; context->access = AsyncIOContext::ACCESS_READ; context->openPath = f; context->waiter = waiter; context->userCallback = asyncopfinished; context->userData = waiter; context->posOfBuffer = size; context->fa = this; context->failed = !sysstat(&mtime, &size); context->retry = this->retry; context->finished = true; context->userCallback(context->userData); return context; } bool FileAccess::asyncopenf() { numAsyncReads++; if (nonblocking_localname.empty()) { return true; } if (isAsyncOpened) { return true; } m_time_t curr_mtime = 0; m_off_t curr_size = 0; if (!sysstat(&curr_mtime, &curr_size)) { LOG_warn << "Error opening async file handle (sysstat) " << curr_mtime << " - " << mtime << curr_size << " - " << size; return false; } if (curr_mtime != mtime || curr_size != size) { mtime = curr_mtime; size = curr_size; retry = false; return false; } LOG_debug << "Opening async file handle for reading"; bool result = sysopen(true); if (result) { isAsyncOpened = true; } else { LOG_warn << "Error opening async file handle (sysopen)"; } return result; } void FileAccess::asyncclosef() { numAsyncReads--; if (isAsyncOpened && !numAsyncReads) { LOG_debug << "Closing async file handle"; isAsyncOpened = false; sysclose(); } } AsyncIOContext *FileAccess::asyncfopen(const LocalPath& f, bool read, bool write, m_off_t pos) { LOG_verbose << "Async open start"; AsyncIOContext *context = newasynccontext(); context->op = AsyncIOContext::OPEN; context->access = AsyncIOContext::ACCESS_NONE | (read ? AsyncIOContext::ACCESS_READ : 0) | (write ? AsyncIOContext::ACCESS_WRITE : 0); context->openPath = f; context->waiter = waiter; context->userCallback = asyncopfinished; context->userData = waiter; context->posOfBuffer = pos; context->fa = this; asyncsysopen(context); return context; } void FileAccess::asyncsysopen(AsyncIOContext *context) { context->failed = true; context->retry = false; context->finished = true; if (context->userCallback) { context->userCallback(context->userData); } } AsyncIOContext *FileAccess::asyncfread(string *dst, unsigned len, unsigned pad, m_off_t pos) { LOG_verbose << "Async read start"; dst->resize(len + pad); AsyncIOContext *context = newasynccontext(); context->op = AsyncIOContext::READ; context->posOfBuffer = pos; context->pad = pad; context->dataBuffer = (byte*)dst->data(); context->dataBufferLen = len; context->waiter = waiter; context->userCallback = asyncopfinished; context->userData = waiter; context->fa = this; if (!asyncopenf()) { LOG_err << "Error in asyncopenf"; context->failed = true; context->retry = this->retry; context->finished = true; context->userCallback(context->userData); return context; } asyncsysread(context); return context; } void FileAccess::asyncsysread(AsyncIOContext *context) { context->failed = true; context->retry = false; context->finished = true; if (context->userCallback) { context->userCallback(context->userData); } } AsyncIOContext *FileAccess::asyncfwrite(const byte* data, unsigned len, m_off_t pos) { LOG_verbose << "Async write start"; AsyncIOContext *context = newasynccontext(); context->op = AsyncIOContext::WRITE; context->posOfBuffer = pos; context->dataBufferLen = len; context->dataBuffer = const_cast<byte*>(data); context->waiter = waiter; context->userCallback = asyncopfinished; context->userData = waiter; context->fa = this; asyncsyswrite(context); return context; } void FileAccess::asyncsyswrite(AsyncIOContext *context) { context->failed = true; context->retry = false; context->finished = true; if (context->userCallback) { context->userCallback(context->userData); } } AsyncIOContext *FileAccess::newasynccontext() { return new AsyncIOContext(); } bool FileAccess::fread(string* dst, unsigned len, unsigned pad, m_off_t pos) { if (!openf()) { return false; } bool r; dst->resize(len + pad); if ((r = sysread((byte*)dst->data(), len, pos))) { memset((char*)dst->data() + len, 0, pad); } closef(); return r; } bool FileAccess::frawread(byte* dst, unsigned len, m_off_t pos, bool caller_opened) { if (!caller_opened && !openf()) { return false; } bool r = sysread(dst, len, pos); if (!caller_opened) { closef(); } return r; } AsyncIOContext::~AsyncIOContext() { finish(); // AsyncIOContext objects must be deleted before the FileAccess object if (op == AsyncIOContext::READ) { fa->asyncclosef(); } } void AsyncIOContext::finish() { if (!finished) { while (!finished) { waiter->init(NEVER); waiter->wait(); } // We could have been consumed and external event waiter->notify(); } } FileInputStream::FileInputStream(FileAccess *fileAccess) { this->fileAccess = fileAccess; this->offset = 0; } m_off_t FileInputStream::size() { return fileAccess->size; } bool FileInputStream::read(byte *buffer, unsigned size) { if (!buffer) { if ((offset + size) <= fileAccess->size) { offset += size; return true; } LOG_warn << "Invalid seek on FileInputStream"; return false; } if (fileAccess->frawread(buffer, size, offset, true)) { offset += size; return true; } LOG_warn << "Invalid read on FileInputStream"; return false; } bool LocalPath::empty() const { return localpath.empty(); } void LocalPath::clear() { localpath.clear(); } void LocalPath::erase(size_t pos, size_t count) { localpath.erase(pos, count); } void LocalPath::truncate(size_t bytePos) { localpath.resize(bytePos); } LocalPath LocalPath::leafName() const { auto p = localpath.find_last_of(localPathSeparator); p = p == string::npos ? 0 : p + 1; LocalPath result; result.localpath = localpath.substr(p, localpath.size() - p); return result; } void LocalPath::append(const LocalPath& additionalPath) { localpath.append(additionalPath.localpath); } std::string LocalPath::platformEncoded() const { #ifdef WIN32 // this function is typically used where we need to pass a file path to the client app, which expects utf16 in a std::string buffer // some other backwards compatible cases need this format also, eg. serialization std::string outstr; outstr.resize(localpath.size() * sizeof(wchar_t)); memcpy(const_cast<char*>(outstr.data()), localpath.data(), localpath.size() * sizeof(wchar_t)); return outstr; #else // for non-windows, it's just the same utf8 string we use anyway return localpath; #endif } void LocalPath::appendWithSeparator(const LocalPath& additionalPath, bool separatorAlways) { if (separatorAlways || localpath.size()) { // still have to be careful about appending a \ to F:\ for example, on windows, which produces an invalid path if (!endsInSeparator()) { localpath.append(1, localPathSeparator); } } localpath.append(additionalPath.localpath); } void LocalPath::prependWithSeparator(const LocalPath& additionalPath) { // no additional separator if there is already one after if (!localpath.empty() && localpath[0] != localPathSeparator) { // no additional separator if there is already one before if (!additionalPath.endsInSeparator()) { localpath.insert(0, 1, localPathSeparator); } } localpath.insert(0, additionalPath.localpath); } void LocalPath::trimNonDriveTrailingSeparator() { if (endsInSeparator()) { // ok so the last character is a directory separator. But don't remove it for eg. F:\ on windows #ifdef WIN32 if (localpath.size() > 1 && localpath[localpath.size() - 2] == L':') { return; } #endif localpath.resize(localpath.size() - 1); } } bool LocalPath::findNextSeparator(size_t& separatorBytePos) const { separatorBytePos = localpath.find(localPathSeparator, separatorBytePos); return separatorBytePos != string::npos; } bool LocalPath::findPrevSeparator(size_t& separatorBytePos, const FileSystemAccess& fsaccess) const { separatorBytePos = localpath.rfind(LocalPath::localPathSeparator, separatorBytePos); return separatorBytePos != string::npos; } bool LocalPath::endsInSeparator() const { return !localpath.empty() && localpath.back() == localPathSeparator; } bool LocalPath::beginsWithSeparator() const { return !localpath.empty() && localpath.front() == localPathSeparator; } size_t LocalPath::getLeafnameByteIndex(const FileSystemAccess& fsaccess) const { size_t p = localpath.size(); while (p && (p -= 1)) { if (localpath[p] == LocalPath::localPathSeparator) { p += 1; break; } } return p; } bool LocalPath::backEqual(size_t bytePos, const LocalPath& compareTo) const { auto n = compareTo.localpath.size(); return bytePos + n == localpath.size() && !localpath.compare(bytePos, n, compareTo.localpath); } LocalPath LocalPath::subpathFrom(size_t bytePos) const { LocalPath result; result.localpath = localpath.substr(bytePos); return result; } void LocalPath::ensureWinExtendedPathLenPrefix() { #if defined(_WIN32) && !defined(WINDOWS_PHONE) if (!PathIsRelativeW(localpath.c_str()) && ((localpath.size() < 2) || memcmp(localpath.data(), L"\\\\", 4))) { localpath.insert(0, L"\\\\?\\", 4); } #endif } LocalPath LocalPath::subpathTo(size_t bytePos) const { LocalPath p; p.localpath = localpath.substr(0, bytePos); return p; } LocalPath LocalPath::insertFilenameCounter(unsigned counter, const FileSystemAccess& fsaccess) { size_t dotindex = localpath.find_last_of('.'); size_t sepindex = localpath.find_last_of(LocalPath::localPathSeparator); LocalPath result, extension; if (dotindex == string::npos || (sepindex != string::npos && sepindex > dotindex)) { result.localpath = localpath; } else { result.localpath = localpath.substr(0, dotindex); extension.localpath = localpath.substr(dotindex); } ostringstream oss; oss << " (" << counter << ")"; result.localpath += LocalPath::fromPath(oss.str(), fsaccess).localpath + extension.localpath; return result; } string LocalPath::toPath(const FileSystemAccess& fsaccess) const { string path; fsaccess.local2path(&localpath, &path); return path; } string LocalPath::toName(const FileSystemAccess& fsaccess, FileSystemType fsType) const { std::string path = toPath(fsaccess); fsaccess.unescapefsincompatible(&path, fsType); return path; } LocalPath LocalPath::fromPath(const string& path, const FileSystemAccess& fsaccess) { LocalPath p; fsaccess.path2local(&path, &p.localpath); return p; } LocalPath LocalPath::fromName(string path, const FileSystemAccess& fsaccess, FileSystemType fsType) { fsaccess.escapefsincompatible(&path, fsType); return fromPath(path, fsaccess); } LocalPath LocalPath::fromPlatformEncoded(string path) { #if defined(_WIN32) assert(!(path.size() % 2)); LocalPath p; p.localpath.resize(path.size() / sizeof(wchar_t)); memcpy(const_cast<wchar_t*>(p.localpath.data()), path.data(), p.localpath.size() * sizeof(wchar_t)); return p; #else LocalPath p; p.localpath = std::move(path); return p; #endif } #if defined(_WIN32) LocalPath LocalPath::fromPlatformEncoded(wstring&& wpath) { LocalPath p; p.localpath = std::move(wpath); return p; } #endif LocalPath LocalPath::tmpNameLocal(const FileSystemAccess& fsaccess) { LocalPath lp; fsaccess.tmpnamelocal(lp); return lp; } bool LocalPath::isContainingPathOf(const LocalPath& path, size_t* subpathIndex) const { if (path.localpath.size() >= localpath.size() && !path.localpath.compare(0, localpath.size(), localpath.data(), localpath.size())) { if (path.localpath.size() == localpath.size()) { if (subpathIndex) *subpathIndex = localpath.size(); return true; } else if (path.localpath[localpath.size()] == localPathSeparator) { if (subpathIndex) *subpathIndex = localpath.size() + 1; return true; } else if (!localpath.empty() && path.localpath[localpath.size() - 1] == localPathSeparator) { if (subpathIndex) *subpathIndex = localpath.size(); return true; } } return false; } bool LocalPath::nextPathComponent(size_t& subpathIndex, LocalPath& component) const { while (subpathIndex < localpath.size() && localpath[subpathIndex] == localPathSeparator) { ++subpathIndex; } size_t start = subpathIndex; if (start >= localpath.size()) { return false; } else if (findNextSeparator(subpathIndex)) { component.localpath = localpath.substr(start, subpathIndex - start); return true; } else { component.localpath = localpath.substr(start, localpath.size() - start); subpathIndex = localpath.size(); return true; } } ScopedLengthRestore::ScopedLengthRestore(LocalPath& p) : path(p) , length(path.localpath.size()) { } ScopedLengthRestore::~ScopedLengthRestore() { path.localpath.resize(length); }; } // namespace
24.131349
135
0.621888
[ "object", "transform" ]
a7b2412623b03ab89f9af19cd0c2a448442aef1d
2,348
cpp
C++
yotta_modules/mbed-drivers/test/cpp/main.cpp
lbk003/mbed-cortexm
a4fcb5de906a49a7fa737d6a89fcf5590aa68d31
[ "Apache-2.0" ]
null
null
null
yotta_modules/mbed-drivers/test/cpp/main.cpp
lbk003/mbed-cortexm
a4fcb5de906a49a7fa737d6a89fcf5590aa68d31
[ "Apache-2.0" ]
null
null
null
yotta_modules/mbed-drivers/test/cpp/main.cpp
lbk003/mbed-cortexm
a4fcb5de906a49a7fa737d6a89fcf5590aa68d31
[ "Apache-2.0" ]
null
null
null
/* mbed Microcontroller Library * Copyright (c) 2013-2014 ARM Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "mbed-drivers/test_env.h" #define PATTERN_CHECK_VALUE 0xF0F0ADAD class Test { private: const char* name; const unsigned pattern; public: Test(const char* _name) : name(_name), pattern(PATTERN_CHECK_VALUE) { print("init"); } void print(const char *message) { printf("%s::%s\n", name, message); } bool check_init(void) { bool result = (pattern == PATTERN_CHECK_VALUE); print(result ? "check_init: OK" : "check_init: ERROR"); return result; } void stack_test(void) { print("stack_test"); Test t("Stack"); t.hello(); } void hello(void) { print("hello"); } ~Test() { print("destroy"); } }; /* Check C++ startup initialisation */ Test s("Static"); /* EXPECTED OUTPUT: ******************* Static::init Static::stack_test Stack::init Stack::hello Stack::destroy Static::check_init: OK Heap::init Heap::hello Heap::destroy *******************/ void runTest (void) { MBED_HOSTTEST_TIMEOUT(10); MBED_HOSTTEST_SELECT(default_auto); MBED_HOSTTEST_DESCRIPTION(C++); MBED_HOSTTEST_START("MBED_12"); bool result = true; for (;;) { // Global stack object simple test s.stack_test(); if (s.check_init() == false) { result = false; break; } // Heap test object simple test Test *m = new Test("Heap"); m->hello(); if (m->check_init() == false) { result = false; } delete m; break; } MBED_HOSTTEST_RESULT(result); } void app_start(int, char*[]) { minar::Scheduler::postCallback(&runTest); }
21.740741
75
0.603918
[ "object" ]
a7b3002d35441a7396c9926eeabeae93d220a593
14,840
cpp
C++
android-29/android/telephony/SmsManager.cpp
YJBeetle/QtAndroidAPI
1468b5dc6eafaf7709f0b00ba1a6ec2b70684266
[ "Apache-2.0" ]
12
2020-03-26T02:38:56.000Z
2022-03-14T08:17:26.000Z
android-29/android/telephony/SmsManager.cpp
YJBeetle/QtAndroidAPI
1468b5dc6eafaf7709f0b00ba1a6ec2b70684266
[ "Apache-2.0" ]
1
2021-01-27T06:07:45.000Z
2021-11-13T19:19:43.000Z
android-29/android/telephony/SmsManager.cpp
YJBeetle/QtAndroidAPI
1468b5dc6eafaf7709f0b00ba1a6ec2b70684266
[ "Apache-2.0" ]
3
2021-02-02T12:34:55.000Z
2022-03-08T07:45:57.000Z
#include "../../JByteArray.hpp" #include "../app/PendingIntent.hpp" #include "../content/Context.hpp" #include "../net/Uri.hpp" #include "../os/Bundle.hpp" #include "./SmsManager_FinancialSmsCallback.hpp" #include "../../JString.hpp" #include "../../java/util/ArrayList.hpp" #include "./SmsManager.hpp" namespace android::telephony { // Fields JString SmsManager::EXTRA_MMS_DATA() { return getStaticObjectField( "android.telephony.SmsManager", "EXTRA_MMS_DATA", "Ljava/lang/String;" ); } JString SmsManager::EXTRA_MMS_HTTP_STATUS() { return getStaticObjectField( "android.telephony.SmsManager", "EXTRA_MMS_HTTP_STATUS", "Ljava/lang/String;" ); } JString SmsManager::MMS_CONFIG_ALIAS_ENABLED() { return getStaticObjectField( "android.telephony.SmsManager", "MMS_CONFIG_ALIAS_ENABLED", "Ljava/lang/String;" ); } JString SmsManager::MMS_CONFIG_ALIAS_MAX_CHARS() { return getStaticObjectField( "android.telephony.SmsManager", "MMS_CONFIG_ALIAS_MAX_CHARS", "Ljava/lang/String;" ); } JString SmsManager::MMS_CONFIG_ALIAS_MIN_CHARS() { return getStaticObjectField( "android.telephony.SmsManager", "MMS_CONFIG_ALIAS_MIN_CHARS", "Ljava/lang/String;" ); } JString SmsManager::MMS_CONFIG_ALLOW_ATTACH_AUDIO() { return getStaticObjectField( "android.telephony.SmsManager", "MMS_CONFIG_ALLOW_ATTACH_AUDIO", "Ljava/lang/String;" ); } JString SmsManager::MMS_CONFIG_APPEND_TRANSACTION_ID() { return getStaticObjectField( "android.telephony.SmsManager", "MMS_CONFIG_APPEND_TRANSACTION_ID", "Ljava/lang/String;" ); } JString SmsManager::MMS_CONFIG_EMAIL_GATEWAY_NUMBER() { return getStaticObjectField( "android.telephony.SmsManager", "MMS_CONFIG_EMAIL_GATEWAY_NUMBER", "Ljava/lang/String;" ); } JString SmsManager::MMS_CONFIG_GROUP_MMS_ENABLED() { return getStaticObjectField( "android.telephony.SmsManager", "MMS_CONFIG_GROUP_MMS_ENABLED", "Ljava/lang/String;" ); } JString SmsManager::MMS_CONFIG_HTTP_PARAMS() { return getStaticObjectField( "android.telephony.SmsManager", "MMS_CONFIG_HTTP_PARAMS", "Ljava/lang/String;" ); } JString SmsManager::MMS_CONFIG_HTTP_SOCKET_TIMEOUT() { return getStaticObjectField( "android.telephony.SmsManager", "MMS_CONFIG_HTTP_SOCKET_TIMEOUT", "Ljava/lang/String;" ); } JString SmsManager::MMS_CONFIG_MAX_IMAGE_HEIGHT() { return getStaticObjectField( "android.telephony.SmsManager", "MMS_CONFIG_MAX_IMAGE_HEIGHT", "Ljava/lang/String;" ); } JString SmsManager::MMS_CONFIG_MAX_IMAGE_WIDTH() { return getStaticObjectField( "android.telephony.SmsManager", "MMS_CONFIG_MAX_IMAGE_WIDTH", "Ljava/lang/String;" ); } JString SmsManager::MMS_CONFIG_MAX_MESSAGE_SIZE() { return getStaticObjectField( "android.telephony.SmsManager", "MMS_CONFIG_MAX_MESSAGE_SIZE", "Ljava/lang/String;" ); } JString SmsManager::MMS_CONFIG_MESSAGE_TEXT_MAX_SIZE() { return getStaticObjectField( "android.telephony.SmsManager", "MMS_CONFIG_MESSAGE_TEXT_MAX_SIZE", "Ljava/lang/String;" ); } JString SmsManager::MMS_CONFIG_MMS_DELIVERY_REPORT_ENABLED() { return getStaticObjectField( "android.telephony.SmsManager", "MMS_CONFIG_MMS_DELIVERY_REPORT_ENABLED", "Ljava/lang/String;" ); } JString SmsManager::MMS_CONFIG_MMS_ENABLED() { return getStaticObjectField( "android.telephony.SmsManager", "MMS_CONFIG_MMS_ENABLED", "Ljava/lang/String;" ); } JString SmsManager::MMS_CONFIG_MMS_READ_REPORT_ENABLED() { return getStaticObjectField( "android.telephony.SmsManager", "MMS_CONFIG_MMS_READ_REPORT_ENABLED", "Ljava/lang/String;" ); } JString SmsManager::MMS_CONFIG_MULTIPART_SMS_ENABLED() { return getStaticObjectField( "android.telephony.SmsManager", "MMS_CONFIG_MULTIPART_SMS_ENABLED", "Ljava/lang/String;" ); } JString SmsManager::MMS_CONFIG_NAI_SUFFIX() { return getStaticObjectField( "android.telephony.SmsManager", "MMS_CONFIG_NAI_SUFFIX", "Ljava/lang/String;" ); } JString SmsManager::MMS_CONFIG_NOTIFY_WAP_MMSC_ENABLED() { return getStaticObjectField( "android.telephony.SmsManager", "MMS_CONFIG_NOTIFY_WAP_MMSC_ENABLED", "Ljava/lang/String;" ); } JString SmsManager::MMS_CONFIG_RECIPIENT_LIMIT() { return getStaticObjectField( "android.telephony.SmsManager", "MMS_CONFIG_RECIPIENT_LIMIT", "Ljava/lang/String;" ); } JString SmsManager::MMS_CONFIG_SEND_MULTIPART_SMS_AS_SEPARATE_MESSAGES() { return getStaticObjectField( "android.telephony.SmsManager", "MMS_CONFIG_SEND_MULTIPART_SMS_AS_SEPARATE_MESSAGES", "Ljava/lang/String;" ); } JString SmsManager::MMS_CONFIG_SHOW_CELL_BROADCAST_APP_LINKS() { return getStaticObjectField( "android.telephony.SmsManager", "MMS_CONFIG_SHOW_CELL_BROADCAST_APP_LINKS", "Ljava/lang/String;" ); } JString SmsManager::MMS_CONFIG_SMS_DELIVERY_REPORT_ENABLED() { return getStaticObjectField( "android.telephony.SmsManager", "MMS_CONFIG_SMS_DELIVERY_REPORT_ENABLED", "Ljava/lang/String;" ); } JString SmsManager::MMS_CONFIG_SMS_TO_MMS_TEXT_LENGTH_THRESHOLD() { return getStaticObjectField( "android.telephony.SmsManager", "MMS_CONFIG_SMS_TO_MMS_TEXT_LENGTH_THRESHOLD", "Ljava/lang/String;" ); } JString SmsManager::MMS_CONFIG_SMS_TO_MMS_TEXT_THRESHOLD() { return getStaticObjectField( "android.telephony.SmsManager", "MMS_CONFIG_SMS_TO_MMS_TEXT_THRESHOLD", "Ljava/lang/String;" ); } JString SmsManager::MMS_CONFIG_SUBJECT_MAX_LENGTH() { return getStaticObjectField( "android.telephony.SmsManager", "MMS_CONFIG_SUBJECT_MAX_LENGTH", "Ljava/lang/String;" ); } JString SmsManager::MMS_CONFIG_SUPPORT_HTTP_CHARSET_HEADER() { return getStaticObjectField( "android.telephony.SmsManager", "MMS_CONFIG_SUPPORT_HTTP_CHARSET_HEADER", "Ljava/lang/String;" ); } JString SmsManager::MMS_CONFIG_SUPPORT_MMS_CONTENT_DISPOSITION() { return getStaticObjectField( "android.telephony.SmsManager", "MMS_CONFIG_SUPPORT_MMS_CONTENT_DISPOSITION", "Ljava/lang/String;" ); } JString SmsManager::MMS_CONFIG_UA_PROF_TAG_NAME() { return getStaticObjectField( "android.telephony.SmsManager", "MMS_CONFIG_UA_PROF_TAG_NAME", "Ljava/lang/String;" ); } JString SmsManager::MMS_CONFIG_UA_PROF_URL() { return getStaticObjectField( "android.telephony.SmsManager", "MMS_CONFIG_UA_PROF_URL", "Ljava/lang/String;" ); } JString SmsManager::MMS_CONFIG_USER_AGENT() { return getStaticObjectField( "android.telephony.SmsManager", "MMS_CONFIG_USER_AGENT", "Ljava/lang/String;" ); } jint SmsManager::MMS_ERROR_CONFIGURATION_ERROR() { return getStaticField<jint>( "android.telephony.SmsManager", "MMS_ERROR_CONFIGURATION_ERROR" ); } jint SmsManager::MMS_ERROR_HTTP_FAILURE() { return getStaticField<jint>( "android.telephony.SmsManager", "MMS_ERROR_HTTP_FAILURE" ); } jint SmsManager::MMS_ERROR_INVALID_APN() { return getStaticField<jint>( "android.telephony.SmsManager", "MMS_ERROR_INVALID_APN" ); } jint SmsManager::MMS_ERROR_IO_ERROR() { return getStaticField<jint>( "android.telephony.SmsManager", "MMS_ERROR_IO_ERROR" ); } jint SmsManager::MMS_ERROR_NO_DATA_NETWORK() { return getStaticField<jint>( "android.telephony.SmsManager", "MMS_ERROR_NO_DATA_NETWORK" ); } jint SmsManager::MMS_ERROR_RETRY() { return getStaticField<jint>( "android.telephony.SmsManager", "MMS_ERROR_RETRY" ); } jint SmsManager::MMS_ERROR_UNABLE_CONNECT_MMS() { return getStaticField<jint>( "android.telephony.SmsManager", "MMS_ERROR_UNABLE_CONNECT_MMS" ); } jint SmsManager::MMS_ERROR_UNSPECIFIED() { return getStaticField<jint>( "android.telephony.SmsManager", "MMS_ERROR_UNSPECIFIED" ); } jint SmsManager::RESULT_ERROR_GENERIC_FAILURE() { return getStaticField<jint>( "android.telephony.SmsManager", "RESULT_ERROR_GENERIC_FAILURE" ); } jint SmsManager::RESULT_ERROR_LIMIT_EXCEEDED() { return getStaticField<jint>( "android.telephony.SmsManager", "RESULT_ERROR_LIMIT_EXCEEDED" ); } jint SmsManager::RESULT_ERROR_NO_SERVICE() { return getStaticField<jint>( "android.telephony.SmsManager", "RESULT_ERROR_NO_SERVICE" ); } jint SmsManager::RESULT_ERROR_NULL_PDU() { return getStaticField<jint>( "android.telephony.SmsManager", "RESULT_ERROR_NULL_PDU" ); } jint SmsManager::RESULT_ERROR_RADIO_OFF() { return getStaticField<jint>( "android.telephony.SmsManager", "RESULT_ERROR_RADIO_OFF" ); } jint SmsManager::RESULT_ERROR_SHORT_CODE_NEVER_ALLOWED() { return getStaticField<jint>( "android.telephony.SmsManager", "RESULT_ERROR_SHORT_CODE_NEVER_ALLOWED" ); } jint SmsManager::RESULT_ERROR_SHORT_CODE_NOT_ALLOWED() { return getStaticField<jint>( "android.telephony.SmsManager", "RESULT_ERROR_SHORT_CODE_NOT_ALLOWED" ); } jint SmsManager::STATUS_ON_ICC_FREE() { return getStaticField<jint>( "android.telephony.SmsManager", "STATUS_ON_ICC_FREE" ); } jint SmsManager::STATUS_ON_ICC_READ() { return getStaticField<jint>( "android.telephony.SmsManager", "STATUS_ON_ICC_READ" ); } jint SmsManager::STATUS_ON_ICC_SENT() { return getStaticField<jint>( "android.telephony.SmsManager", "STATUS_ON_ICC_SENT" ); } jint SmsManager::STATUS_ON_ICC_UNREAD() { return getStaticField<jint>( "android.telephony.SmsManager", "STATUS_ON_ICC_UNREAD" ); } jint SmsManager::STATUS_ON_ICC_UNSENT() { return getStaticField<jint>( "android.telephony.SmsManager", "STATUS_ON_ICC_UNSENT" ); } // QJniObject forward SmsManager::SmsManager(QJniObject obj) : JObject(obj) {} // Constructors // Methods android::telephony::SmsManager SmsManager::getDefault() { return callStaticObjectMethod( "android.telephony.SmsManager", "getDefault", "()Landroid/telephony/SmsManager;" ); } jint SmsManager::getDefaultSmsSubscriptionId() { return callStaticMethod<jint>( "android.telephony.SmsManager", "getDefaultSmsSubscriptionId", "()I" ); } android::telephony::SmsManager SmsManager::getSmsManagerForSubscriptionId(jint arg0) { return callStaticObjectMethod( "android.telephony.SmsManager", "getSmsManagerForSubscriptionId", "(I)Landroid/telephony/SmsManager;", arg0 ); } JString SmsManager::createAppSpecificSmsToken(android::app::PendingIntent arg0) const { return callObjectMethod( "createAppSpecificSmsToken", "(Landroid/app/PendingIntent;)Ljava/lang/String;", arg0.object() ); } JString SmsManager::createAppSpecificSmsTokenWithPackageInfo(JString arg0, android::app::PendingIntent arg1) const { return callObjectMethod( "createAppSpecificSmsTokenWithPackageInfo", "(Ljava/lang/String;Landroid/app/PendingIntent;)Ljava/lang/String;", arg0.object<jstring>(), arg1.object() ); } java::util::ArrayList SmsManager::divideMessage(JString arg0) const { return callObjectMethod( "divideMessage", "(Ljava/lang/String;)Ljava/util/ArrayList;", arg0.object<jstring>() ); } void SmsManager::downloadMultimediaMessage(android::content::Context arg0, JString arg1, android::net::Uri arg2, android::os::Bundle arg3, android::app::PendingIntent arg4) const { callMethod<void>( "downloadMultimediaMessage", "(Landroid/content/Context;Ljava/lang/String;Landroid/net/Uri;Landroid/os/Bundle;Landroid/app/PendingIntent;)V", arg0.object(), arg1.object<jstring>(), arg2.object(), arg3.object(), arg4.object() ); } android::os::Bundle SmsManager::getCarrierConfigValues() const { return callObjectMethod( "getCarrierConfigValues", "()Landroid/os/Bundle;" ); } void SmsManager::getSmsMessagesForFinancialApp(android::os::Bundle arg0, JObject arg1, android::telephony::SmsManager_FinancialSmsCallback arg2) const { callMethod<void>( "getSmsMessagesForFinancialApp", "(Landroid/os/Bundle;Ljava/util/concurrent/Executor;Landroid/telephony/SmsManager$FinancialSmsCallback;)V", arg0.object(), arg1.object(), arg2.object() ); } jint SmsManager::getSubscriptionId() const { return callMethod<jint>( "getSubscriptionId", "()I" ); } void SmsManager::injectSmsPdu(JByteArray arg0, JString arg1, android::app::PendingIntent arg2) const { callMethod<void>( "injectSmsPdu", "([BLjava/lang/String;Landroid/app/PendingIntent;)V", arg0.object<jbyteArray>(), arg1.object<jstring>(), arg2.object() ); } void SmsManager::sendDataMessage(JString arg0, JString arg1, jshort arg2, JByteArray arg3, android::app::PendingIntent arg4, android::app::PendingIntent arg5) const { callMethod<void>( "sendDataMessage", "(Ljava/lang/String;Ljava/lang/String;S[BLandroid/app/PendingIntent;Landroid/app/PendingIntent;)V", arg0.object<jstring>(), arg1.object<jstring>(), arg2, arg3.object<jbyteArray>(), arg4.object(), arg5.object() ); } void SmsManager::sendMultimediaMessage(android::content::Context arg0, android::net::Uri arg1, JString arg2, android::os::Bundle arg3, android::app::PendingIntent arg4) const { callMethod<void>( "sendMultimediaMessage", "(Landroid/content/Context;Landroid/net/Uri;Ljava/lang/String;Landroid/os/Bundle;Landroid/app/PendingIntent;)V", arg0.object(), arg1.object(), arg2.object<jstring>(), arg3.object(), arg4.object() ); } void SmsManager::sendMultipartTextMessage(JString arg0, JString arg1, java::util::ArrayList arg2, java::util::ArrayList arg3, java::util::ArrayList arg4) const { callMethod<void>( "sendMultipartTextMessage", "(Ljava/lang/String;Ljava/lang/String;Ljava/util/ArrayList;Ljava/util/ArrayList;Ljava/util/ArrayList;)V", arg0.object<jstring>(), arg1.object<jstring>(), arg2.object(), arg3.object(), arg4.object() ); } void SmsManager::sendTextMessage(JString arg0, JString arg1, JString arg2, android::app::PendingIntent arg3, android::app::PendingIntent arg4) const { callMethod<void>( "sendTextMessage", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Landroid/app/PendingIntent;Landroid/app/PendingIntent;)V", arg0.object<jstring>(), arg1.object<jstring>(), arg2.object<jstring>(), arg3.object(), arg4.object() ); } void SmsManager::sendTextMessageWithoutPersisting(JString arg0, JString arg1, JString arg2, android::app::PendingIntent arg3, android::app::PendingIntent arg4) const { callMethod<void>( "sendTextMessageWithoutPersisting", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Landroid/app/PendingIntent;Landroid/app/PendingIntent;)V", arg0.object<jstring>(), arg1.object<jstring>(), arg2.object<jstring>(), arg3.object(), arg4.object() ); } } // namespace android::telephony
25.410959
179
0.736995
[ "object" ]
a7b3866c6f770232a1f6b39ac9e66a21b766180f
2,161
cpp
C++
detection/include/open_ptrack/kfebt/trackers/tvdp.cpp
yongheng1991/multiple_object_tracking_in_RGB-D_camera_network
88143b437df2198a50ef7b223db58ed35b0bcfa4
[ "BSD-3-Clause" ]
1
2021-05-14T08:48:43.000Z
2021-05-14T08:48:43.000Z
detection/include/open_ptrack/kfebt/trackers/tvdp.cpp
yongheng1991/multiple_object_tracking_in_RGB-D_camera_network
88143b437df2198a50ef7b223db58ed35b0bcfa4
[ "BSD-3-Clause" ]
null
null
null
detection/include/open_ptrack/kfebt/trackers/tvdp.cpp
yongheng1991/multiple_object_tracking_in_RGB-D_camera_network
88143b437df2198a50ef7b223db58ed35b0bcfa4
[ "BSD-3-Clause" ]
null
null
null
#include "tvdp.h" tVDP::tVDP(float dist_adj, float conf_adj) { this->dist_adj = dist_adj; this->conf_adj = conf_adj; } void tVDP::init(cv::Mat &image, cv::Rect region){ cbt.init(image, region, false); ratio = (float)region.height/(float)region.width; updateModel = false; state.clear(); state.push_back(region.x); state.push_back(region.y); state.push_back(region.width); } void tVDP::correctState(std::vector<float> st){ this->state = st; cbt.lastPosition.height = round(st[2]*ratio); cbt.lastPosition.width = round(st[2]); cbt.lastPosition.x = round(st[0] - st[2]/2.0); cbt.lastPosition.y = round(st[1] - (st[2]*ratio/2.0)); } void tVDP::track(){ float scale; double confidence = cbt.track(currentFrame, scale); float newWidth = state[2]*scale; this->stateUncertainty.clear(); float penalityCBT = pow(dist_adj*fabs(state[0] - currentPredictRect[0])/((double)cbt.lastPosition.width),2) + pow(dist_adj*fabs(state[1] - currentPredictRect[1])/((double)cbt.lastPosition.height), 2);// + //pow(DIST_ADJ*fabs(state[2] - currentPredictRect[2])/((double)cbt.lastPosition.width),2); float uncertainty; if(confidence != 0){ uncertainty = 1e-4*exp(-3.5*(conf_adj*confidence - penalityCBT)); state.clear(); state.push_back(round((float)cbt.lastPosition.x + (float)cbt.lastPosition.width/2.0)); state.push_back(round((float)cbt.lastPosition.y + (float)cbt.lastPosition.height/2.0)); state.push_back(newWidth); }else{ uncertainty = 1; } stateUncertainty.push_back(uncertainty*7); stateUncertainty.push_back(uncertainty*7); stateUncertainty.push_back(uncertainty); } void tVDP::update(){ cbt.update(currentFrame); } void tVDP::newFrame(cv::Mat &image, std::vector<float> predictRect){ currentFrame = image; currentPredictRect = predictRect; } cv::Rect tVDP::getRect(){ cv::Rect rect; rect.x = round(cbt.lastPosition.x); rect.y = round(cbt.lastPosition.y); rect.width = round(cbt.lastPosition.width); rect.height = round(cbt.lastPosition.height); return rect; }
31.318841
114
0.665433
[ "vector" ]
a7b4446916a63d2d372de60561654c54376b15a5
886
hpp
C++
include/server/http/reply.hpp
EricWang1hitsz/osrm-backend
ff1af413d6c78f8e454584fe978d5468d984d74a
[ "BSD-2-Clause" ]
4,526
2015-01-01T15:31:00.000Z
2022-03-31T17:33:49.000Z
include/server/http/reply.hpp
wsx9527/osrm-backend
1e70b645e480946dad313b67f6a7d331baecfe3c
[ "BSD-2-Clause" ]
4,497
2015-01-01T15:29:12.000Z
2022-03-31T19:19:35.000Z
include/server/http/reply.hpp
wsx9527/osrm-backend
1e70b645e480946dad313b67f6a7d331baecfe3c
[ "BSD-2-Clause" ]
3,023
2015-01-01T18:40:53.000Z
2022-03-30T13:30:46.000Z
#ifndef REPLY_HPP #define REPLY_HPP #include "server/http/header.hpp" #include <boost/asio.hpp> #include <vector> namespace osrm { namespace server { namespace http { class reply { public: enum status_type { ok = 200, bad_request = 400, internal_server_error = 500 } status; std::vector<header> headers; std::vector<boost::asio::const_buffer> to_buffers(); std::vector<boost::asio::const_buffer> headers_to_buffers(); std::vector<char> content; static reply stock_reply(const status_type status); void set_size(const std::size_t size); void set_uncompressed_size(); reply(); private: std::string status_to_string(reply::status_type status); boost::asio::const_buffer status_to_buffer(reply::status_type status); }; } // namespace http } // namespace server } // namespace osrm #endif // REPLY_HPP
19.26087
74
0.689616
[ "vector" ]
a7b520814e2b63662ba69d98743a27d2b8b25de5
7,394
cpp
C++
code/MikoEngine/Renderer/Resource/Scene/Item/Volume/VolumeSceneItem.cpp
warzes/MikoEngine
1199f59a71ab3dfcbea5d02238639db55eded0d4
[ "MIT" ]
5
2020-08-04T17:57:01.000Z
2021-02-07T12:19:02.000Z
code/MikoEngine/Renderer/Resource/Scene/Item/Volume/VolumeSceneItem.cpp
warzes/MikoEngine
1199f59a71ab3dfcbea5d02238639db55eded0d4
[ "MIT" ]
null
null
null
code/MikoEngine/Renderer/Resource/Scene/Item/Volume/VolumeSceneItem.cpp
warzes/MikoEngine
1199f59a71ab3dfcbea5d02238639db55eded0d4
[ "MIT" ]
null
null
null
#include "stdafx.h" #include "Renderer/Resource/Scene/Item/Volume/VolumeSceneItem.h" #include "Renderer/Resource/Scene/SceneResource.h" #include "Renderer/Resource/Scene/SceneNode.h" #include "Renderer/IRenderer.h" #include "Renderer/Resource/Mesh/MeshResourceManager.h" //[-------------------------------------------------------] //[ Anonymous detail namespace ] //[-------------------------------------------------------] namespace { namespace detail { //[-------------------------------------------------------] //[ Global variables ] //[-------------------------------------------------------] static Rhi::IVertexArrayPtr VolumeVertexArrayPtr; // Vertex array object (VAO), can be a null pointer, shared between all volume instances //[-------------------------------------------------------] //[ Global functions ] //[-------------------------------------------------------] [[nodiscard]] Rhi::IVertexArray* createVolumeVertexArray(const Renderer::IRenderer& renderer) { // Vertex input layout static constexpr Rhi::VertexAttribute vertexAttributesLayout[] = { { // Attribute 0 // Data destination Rhi::VertexAttributeFormat::FLOAT_3, // vertexAttributeFormat (Rhi::VertexAttributeFormat) "Position", // name[32] (char) "POSITION", // semanticName[32] (char) 0, // semanticIndex (uint32_t) // Data source 0, // inputSlot (uint32_t) 0, // alignedByteOffset (uint32_t) sizeof(float) * 3, // strideInBytes (uint32_t) 0 // instancesPerElement (uint32_t) }, { // Attribute 1, see "17/11/2012 Surviving without gl_DrawID" - https://www.g-truc.net/post-0518.html // Data destination Rhi::VertexAttributeFormat::UINT_1, // vertexAttributeFormat (Rhi::VertexAttributeFormat) "drawId", // name[32] (char) "DRAWID", // semanticName[32] (char) 0, // semanticIndex (uint32_t) // Data source 1, // inputSlot (uint32_t) 0, // alignedByteOffset (uint32_t) sizeof(uint32_t), // strideInBytes (uint32_t) 1 // instancesPerElement (uint32_t) } }; const Rhi::VertexAttributes vertexAttributes(static_cast<uint32_t>(GLM_COUNTOF(vertexAttributesLayout)), vertexAttributesLayout); // Our cube is constructed like this /* 3+------+2 y /| /| | / | / | | / 0+---/--+1 *---x 7+------+6 / / | / | / z |/ |/ 4+------+5 */ // Create the vertex buffer object (VBO) // -> Object space vertex positions static constexpr float VERTEX_POSITION[] = { -0.5f, -0.5f, -0.5f, // 0 0.5f, -0.5f, -0.5f, // 1 0.5f, 0.5f, -0.5f, // 2 -0.5f, 0.5f, -0.5f, // 3 -0.5f, -0.5f, 0.5f, // 4 0.5f, -0.5f, 0.5f, // 5 0.5f, 0.5f, 0.5f, // 6 -0.5f, 0.5f, 0.5f, // 7 }; Rhi::IBufferManager& bufferManager = renderer.getBufferManager(); Rhi::IVertexBufferPtr vertexBuffer(bufferManager.createVertexBuffer(sizeof(VERTEX_POSITION), VERTEX_POSITION, 0, Rhi::BufferUsage::STATIC_DRAW RHI_RESOURCE_DEBUG_NAME("Volume"))); // Create the index buffer object (IBO) static constexpr uint16_t INDICES[] = { // Back Triangle 2, 3, 0, // 0 0, 1, 2, // 1 // Front 7, 6, 5, // 0 5, 4, 7, // 1 // Left 3, 7, 4, // 0 4, 0, 3, // 1 // Right 6, 2, 1, // 0 1, 5, 6, // 1 // Top 3, 2, 6, // 0 6, 7, 3, // 1 // Bottom 0, 4, 5, // 0 5, 1, 0 // 1 }; Rhi::IIndexBufferPtr indexBuffer(bufferManager.createIndexBuffer(sizeof(INDICES), INDICES, 0, Rhi::BufferUsage::STATIC_DRAW, Rhi::IndexBufferFormat::UNSIGNED_SHORT RHI_RESOURCE_DEBUG_NAME("Volume"))); // Create vertex array object (VAO) const Rhi::VertexArrayVertexBuffer vertexArrayVertexBuffers[] = { vertexBuffer, renderer.getMeshResourceManager().getDrawIdVertexBufferPtr() }; return bufferManager.createVertexArray(vertexAttributes, static_cast<uint32_t>(GLM_COUNTOF(vertexArrayVertexBuffers)), vertexArrayVertexBuffers, indexBuffer RHI_RESOURCE_DEBUG_NAME("Volume")); } //[-------------------------------------------------------] //[ Anonymous detail namespace ] //[-------------------------------------------------------] } // detail } //[-------------------------------------------------------] //[ Namespace ] //[-------------------------------------------------------] namespace Renderer { //[-------------------------------------------------------] //[ Public virtual Renderer::ISceneItem methods ] //[-------------------------------------------------------] const RenderableManager* VolumeSceneItem::getRenderableManager() const { // Sanity check SE_ASSERT(mRenderableManager.getTransform().scale.x == mRenderableManager.getTransform().scale.y && mRenderableManager.getTransform().scale.y == mRenderableManager.getTransform().scale.z, "Only uniform scale is supported to keep things simple") // Call the base implementation return MaterialSceneItem::getRenderableManager(); } //[-------------------------------------------------------] //[ Protected virtual Renderer::MaterialSceneItem methods ] //[-------------------------------------------------------] void VolumeSceneItem::onMaterialResourceCreated() { // Setup renderable manager #if SE_DEBUG const char* debugName = "Volume"; mRenderableManager.setDebugName(debugName); #endif mRenderableManager.getRenderables().emplace_back(mRenderableManager, ::detail::VolumeVertexArrayPtr, getSceneResource().getRenderer().getMaterialResourceManager(), getMaterialResourceId(), GetInvalid<SkeletonResourceId>(), true, 0, 36, 1 RHI_RESOURCE_DEBUG_NAME(debugName)); mRenderableManager.updateCachedRenderablesData(); } //[-------------------------------------------------------] //[ Private methods ] //[-------------------------------------------------------] VolumeSceneItem::VolumeSceneItem(SceneResource& sceneResource) : MaterialSceneItem(sceneResource) { // Add reference to vertex array object (VAO) shared between all volume instances if (nullptr == ::detail::VolumeVertexArrayPtr) { ::detail::VolumeVertexArrayPtr = ::detail::createVolumeVertexArray(getSceneResource().getRenderer()); SE_ASSERT(nullptr != ::detail::VolumeVertexArrayPtr, "Invalid volume vertex array") } ::detail::VolumeVertexArrayPtr->AddReference(); } VolumeSceneItem::~VolumeSceneItem() { if (IsValid(getMaterialResourceId())) { // Clear the renderable manager right now so we have no more references to the shared vertex array mRenderableManager.getRenderables().clear(); } // Release reference to vertex array object (VAO) shared between all volume instances if (nullptr != ::detail::VolumeVertexArrayPtr && 1 == ::detail::VolumeVertexArrayPtr->ReleaseReference()) // +1 for reference to global shared pointer { ::detail::VolumeVertexArrayPtr = nullptr; } } //[-------------------------------------------------------] //[ Namespace ] //[-------------------------------------------------------] } // Renderer
38.113402
276
0.545713
[ "mesh", "object" ]
a7b9a73a70566ef23be34bc3ce4a09842543eee1
1,616
cpp
C++
02.cpp
malkiewiczm/adventofcode2019
e67f6224fc2c55edc7bba97caf4aee922d5200c7
[ "MIT" ]
null
null
null
02.cpp
malkiewiczm/adventofcode2019
e67f6224fc2c55edc7bba97caf4aee922d5200c7
[ "MIT" ]
null
null
null
02.cpp
malkiewiczm/adventofcode2019
e67f6224fc2c55edc7bba97caf4aee922d5200c7
[ "MIT" ]
null
null
null
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <vector> #include <iostream> #include <string> #include <utility> #include <algorithm> #define PARTONE #define TRACE (std::cout << "[line " << __LINE__ << "] ") #define trace(what)(TRACE << #what " = " << (what) << std::endl) #define lintf(fmt, ...)(printf("[line %d] " fmt, __LINE__, __VA_ARGS__)) #define FOR(i, to) for (int i = 0; i < to; ++i) static std::vector<int> ops; static inline void run_program() { for (unsigned PC = 0; ; PC += 4) { const int opcode = ops[PC]; if (opcode == 99) return; const int A = ops[ops[PC + 1]]; const int B = ops[ops[PC + 2]]; int &dst = ops[ops[PC + 3]]; switch (opcode) { case 1: dst = A + B; break; case 2: dst = A * B; break; default: TRACE << "BAD OPCODE " << opcode << std::endl; abort(); } } } static inline void go(FILE *f) { int v; if (fscanf(f, "%d", &v) != 1) return; ops.push_back(v); while (fscanf(f, ",%d", &v) == 1) { ops.push_back(v); } } int main(int argc, char **argv) { const char *fname = "in.txt"; if (argc >= 2) fname = argv[1]; FILE *f = fopen(fname, "r"); if (f == nullptr) { trace("file cannot be opened"); exit(1); } go(f); fclose(f); #ifndef PARTONE std::vector<int> orig(ops); for (int noun = 0; noun < 100; ++noun) { for (int verb = 0; verb < 100; ++verb) { ops = orig; ops[1] = noun; ops[2] = verb; run_program(); if (ops[0] == 19690720) { trace(noun); trace(verb); trace(100 * noun + verb); } } } #else ops[1] = 12; ops[2] = 2; run_program(); trace(ops[0]); #endif }
18.363636
72
0.556312
[ "vector" ]
a7bd0d6b9608a2ee927113ad523ee82569acf5cf
80,131
cpp
C++
textord/colfind.cpp
priyanshu-bajpai/OCR--Tesseract
753753fb263e401015e4b4481587a97c7a47aacc
[ "Apache-2.0" ]
19
2015-03-12T23:18:08.000Z
2019-11-05T11:57:36.000Z
tess-two/external/tesseract-3.01/textord/colfind.cpp
markusarwan/tess-two
0cddf3aad30b9e826d7e0286525a39e3c1b918c3
[ "Apache-2.0" ]
3
2016-03-18T19:22:05.000Z
2021-09-23T03:21:54.000Z
tess-two/external/tesseract-3.01/textord/colfind.cpp
markusarwan/tess-two
0cddf3aad30b9e826d7e0286525a39e3c1b918c3
[ "Apache-2.0" ]
23
2015-06-27T04:08:11.000Z
2022-03-18T14:16:24.000Z
/////////////////////////////////////////////////////////////////////// // File: colfind.cpp // Description: Class to hold BLOBNBOXs in a grid for fast access // to neighbours. // Author: Ray Smith // Created: Wed Jun 06 17:22:01 PDT 2007 // // (C) Copyright 2007, Google Inc. // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // /////////////////////////////////////////////////////////////////////// #ifdef _MSC_VER #pragma warning(disable:4244) // Conversion warnings #endif #include "colfind.h" #include "colpartition.h" #include "colpartitionset.h" #include "linefind.h" #include "strokewidth.h" #include "blobbox.h" #include "scrollview.h" #include "tablefind.h" #include "params.h" #include "workingpartset.h" // Include automatically generated configuration file if running autoconf. #ifdef HAVE_CONFIG_H #include "config_auto.h" #endif namespace tesseract { // Minimum width (in pixels) to be considered when making columns. // TODO(rays) convert to inches, dependent on resolution. const int kMinColumnWidth = 100; // When assigning columns, the max number of misfit grid rows/ColPartitionSets // that can be ignored. const int kMaxIncompatibleColumnCount = 2; // Min fraction of ColPartition height to be overlapping for margin purposes. const double kMarginOverlapFraction = 0.25; // Max fraction of mean_column_gap_ for the gap between two partitions within a // column to allow them to merge. const double kHorizontalGapMergeFraction = 0.5; // Min fraction of grid size to not be considered likely noise. const double kMinNonNoiseFraction = 0.5; // Minimum gutter width as a fraction of gridsize const double kMinGutterWidthGrid = 0.5; // Search radius to use for finding large neighbours of smaller blobs. const int kSmallBlobSearchRadius = 2; BOOL_VAR(textord_tabfind_show_initial_partitions, false, "Show partition bounds"); INT_VAR(textord_tabfind_show_partitions, 0, "Show partition bounds, waiting if >1"); BOOL_VAR(textord_tabfind_show_columns, false, "Show column bounds"); BOOL_VAR(textord_tabfind_show_blocks, false, "Show final block bounds"); BOOL_VAR(textord_tabfind_find_tables, false, "run table detection"); ScrollView* ColumnFinder::blocks_win_ = NULL; // Gridsize is an estimate of the text size in the image. A suitable value // is in TO_BLOCK::line_size after find_components has been used to make // the blobs. // bleft and tright are the bounds of the image (or rectangle) being processed. // vlines is a (possibly empty) list of TabVector and vertical_x and y are // the sum logical vertical vector produced by LineFinder::FindVerticalLines. ColumnFinder::ColumnFinder(int gridsize, const ICOORD& bleft, const ICOORD& tright, int resolution, TabVector_LIST* vlines, TabVector_LIST* hlines, int vertical_x, int vertical_y) : TabFind(gridsize, bleft, tright, vlines, vertical_x, vertical_y, resolution), min_gutter_width_(static_cast<int>(kMinGutterWidthGrid * gridsize)), mean_column_gap_(tright.x() - bleft.x()), reskew_(1.0f, 0.0f), rotation_(1.0f, 0.0f), rerotate_(1.0f, 0.0f), best_columns_(NULL), stroke_width_(NULL) { TabVector_IT h_it(&horizontal_lines_); h_it.add_list_after(hlines); } ColumnFinder::~ColumnFinder() { column_sets_.delete_data_pointers(); if (best_columns_ != NULL) { delete [] best_columns_; } if (stroke_width_ != NULL) delete stroke_width_; // The ColPartitions are destroyed automatically, but any boxes in // the noise_parts_ list are owned and need to be deleted explicitly. ColPartition_IT part_it(&noise_parts_); for (part_it.mark_cycle_pt(); !part_it.cycled_list(); part_it.forward()) { ColPartition* part = part_it.data(); part->DeleteBoxes(); } // Likewise any boxes in the good_parts_ list need to be deleted. // These are just the image parts. Text parts have already given their // boxes on to the TO_BLOCK, and have empty lists. part_it.set_to_list(&good_parts_); for (part_it.mark_cycle_pt(); !part_it.cycled_list(); part_it.forward()) { ColPartition* part = part_it.data(); part->DeleteBoxes(); } // Also, any blobs on the image_bblobs_ list need to have their cblobs // deleted. This only happens if there has been an early return from // FindColumns, as in a normal return, the blobs go into the grid and // end up in noise_parts_, good_parts_ or the output blocks. BLOBNBOX_IT bb_it(&image_bblobs_); for (bb_it.mark_cycle_pt(); !bb_it.cycled_list(); bb_it.forward()) { BLOBNBOX* bblob = bb_it.data(); delete bblob->cblob(); } } // Tests for vertical alignment of text (returning true if so), and generates a // list of blobs for orientation and script detection. bool ColumnFinder::IsVerticallyAlignedText(TO_BLOCK* block, BLOBNBOX_CLIST* osd_blobs) { // Test page-wide writing direction. if (stroke_width_ != NULL) delete stroke_width_; stroke_width_ = new StrokeWidth(gridsize(), bleft(), tright()); min_gutter_width_ = static_cast<int>(kMinGutterWidthGrid * gridsize()); // TODO(rays) experiment with making broken CJK fixing dependent on the // language, and keeping the merged blobs on output instead of exploding at // ColPartition::MakeBlock. bool result = stroke_width_->TestVerticalTextDirection(true, block, this, osd_blobs); return result; } // Rotates the blobs and the TabVectors so that the gross writing direction // (text lines) are horizontal and lines are read down the page. // Applied rotation stored in rotation_. // A second rotation is calculated for application during recognition to // make the rotated blobs upright for recognition. // Subsequent rotation stored in text_rotation_. // // Arguments: // vertical_text_lines true if the text lines are vertical. // recognition_rotation [0..3] is the number of anti-clockwise 90 degree // rotations from osd required for the text to be upright and readable. void ColumnFinder::CorrectOrientation(TO_BLOCK* block, bool vertical_text_lines, int recognition_rotation) { const FCOORD anticlockwise90(0.0f, 1.0f); const FCOORD clockwise90(0.0f, -1.0f); const FCOORD rotation180(-1.0f, 0.0f); const FCOORD norotation(1.0f, 0.0f); text_rotation_ = norotation; // Rotate the page to make the text upright, as implied by // recognition_rotation. rotation_ = norotation; if (recognition_rotation == 1) { rotation_ = anticlockwise90; } else if (recognition_rotation == 2) { rotation_ = rotation180; } else if (recognition_rotation == 3) { rotation_ = clockwise90; } // We infer text writing direction to be vertical if there are several // vertical text lines detected, and horizontal if not. But if the page // orientation was determined to be 90 or 270 degrees, the true writing // direction is the opposite of what we inferred. if (recognition_rotation & 1) { vertical_text_lines = !vertical_text_lines; } // If we still believe the writing direction is vertical, we use the // convention of rotating the page ccw 90 degrees to make the text lines // horizontal, and mark the blobs for rotation cw 90 degrees for // classification so that the text order is correct after recognition. if (vertical_text_lines) { rotation_.rotate(anticlockwise90); text_rotation_.rotate(clockwise90); } // Set rerotate_ to the inverse of rotation_. rerotate_ = FCOORD(rotation_.x(), -rotation_.y()); if (rotation_.x() != 1.0f || rotation_.y() != 0.0f) { // Rotate all the blobs and tab vectors. RotateBlobList(rotation_, &block->large_blobs); RotateBlobList(rotation_, &block->blobs); RotateBlobList(rotation_, &block->small_blobs); RotateBlobList(rotation_, &block->noise_blobs); TabFind::ResetForVerticalText(rotation_, rerotate_, &horizontal_lines_, &min_gutter_width_); // Re-mark all the blobs with the correct orientation. stroke_width_->CorrectForRotation(rotation_, block); } if (textord_debug_tabfind) { tprintf("Vertical=%d, orientation=%d, final rotation=(%f, %f)+(%f,%f)\n", vertical_text_lines, recognition_rotation, rotation_.x(), rotation_.y(), text_rotation_.x(), text_rotation_.y()); } } // Finds the text and image blocks, returning them in the blocks and to_blocks // lists. (Each TO_BLOCK points to the basic BLOCK and adds more information.) // If boxa and pixa are not NULL, they are assumed to be the output of // ImageFinder::FindImages, and are used to generate image blocks. // The input boxa and pixa are destroyed. // Imageheight should be the pixel height of the original image. // The input block is the result of a call to find_components, and contains // the blobs found in the image. These blobs will be removed and placed // in the output blocks, while unused ones will be deleted. // If single_column is true, the input is treated as single column, but // it is still divided into blocks of equal line spacing/text size. // Returns -1 if the user requested retry with more debug info. int ColumnFinder::FindBlocks(bool single_column, int imageheight, TO_BLOCK* block, Boxa* boxa, Pixa* pixa, BLOCK_LIST* blocks, TO_BLOCK_LIST* to_blocks) { stroke_width_->FindLeaderPartitions(block, this); delete stroke_width_; stroke_width_ = NULL; if (boxa != NULL) { // Convert the boxa/pixa to fake blobs aligned on the grid. ExtractImageBlobs(imageheight, boxa, pixa); boxaDestroy(&boxa); pixaDestroy(&pixa); } // Decide which large blobs should be included in the grid as potential // characters. // A subsidiary grid used to decide which large blobs to use. // NOTE: This seemingly anomalous use of StrokeWidth is the old API, and // will go away entirely with the upcoming change to ImageFinder. StrokeWidth* stroke_width = new StrokeWidth(gridsize(), bleft(), tright()); stroke_width->InsertBlobsOld(block, this); stroke_width->MoveGoodLargeBlobs(resolution_, block); delete stroke_width; if (single_column) { // No tab stops needed. Just the grid that FindTabVectors makes. DontFindTabVectors(&image_bblobs_, block, &deskew_, &reskew_); } else { // Find the tab stops. FindTabVectors(&horizontal_lines_, &image_bblobs_, block, min_gutter_width_, &deskew_, &reskew_); } // Find the columns. if (MakeColumnPartitions() == 0) return 0; // This is an empty page. // Make the initial column candidates from the part_sets_. MakeColumnCandidates(single_column); if (textord_debug_tabfind) PrintColumnCandidates("Column candidates"); // Improve the column candidates against themselves. ImproveColumnCandidates(&column_sets_, &column_sets_); if (textord_debug_tabfind) PrintColumnCandidates("Improved columns"); // Improve the column candidates using the part_sets_. ImproveColumnCandidates(&part_sets_, &column_sets_); if (textord_debug_tabfind) PrintColumnCandidates("Final Columns"); // Divide the page into sections of uniform column layout. AssignColumns(); if (textord_tabfind_show_columns) { DisplayColumnBounds(&part_sets_); } ComputeMeanColumnGap(); // Refill the grid using rectangular spreading, and get the benefit // of the completed tab vectors marking the rule edges of each blob. Clear(); InsertBlobList(false, false, false, &image_bblobs_, true, this); InsertBlobList(true, true, false, &block->blobs, true, this); // Insert all the remaining small and noise blobs into the grid and also // make an unknown partition for each. Ownership is taken by the grid. InsertSmallBlobsAsUnknowns(true, &block->small_blobs); InsertSmallBlobsAsUnknowns(true, &block->noise_blobs); // Ownership of the ColPartitions moves from part_sets_ to part_grid_ here, // and ownership of the BLOBNBOXes moves to the ColPartitions. // (They were previously owned by the block or the image_bblobs list, // but they both gave up ownership to the grid at the InsertBlobList above.) MovePartitionsToGrid(); // Split and merge the partitions by looking at local neighbours. GridSplitPartitions(); // Resolve unknown partitions by adding to an existing partition, fixing // the type, or declaring them noise. part_grid_.GridFindMargins(best_columns_); part_grid_.ListFindMargins(best_columns_, &unknown_parts_); GridInsertUnknowns(); GridMergePartitions(); // Add horizontal line separators as partitions. GridInsertHLinePartitions(); GridInsertVLinePartitions(); // Recompute margins based on a local neighbourhood search. part_grid_.GridFindMargins(best_columns_); SetPartitionTypes(); if (textord_tabfind_show_initial_partitions) { ScrollView* part_win = MakeWindow(100, 300, "InitialPartitions"); part_grid_.DisplayBoxes(part_win); DisplayTabVectors(part_win); } if (textord_tabfind_find_tables) { TableFinder table_finder; table_finder.Init(gridsize(), bleft(), tright()); table_finder.set_resolution(resolution_); table_finder.set_left_to_right_language(!block->block->right_to_left()); // Copy cleaned partitions from part_grid_ to clean_part_grid_ and // insert dot-like noise into period_grid_ table_finder.InsertCleanPartitions(&part_grid_, block); // Get Table Regions table_finder.LocateTables(&part_grid_, best_columns_, WidthCB(), reskew_); } // Build the partitions into chains that belong in the same block and // refine into one-to-one links, then smooth the types within each chain. part_grid_.FindPartitionPartners(); part_grid_.FindFigureCaptions(); part_grid_.RefinePartitionPartners(true); SmoothPartnerRuns(); if (textord_tabfind_show_partitions) { ScrollView* window = MakeWindow(400, 300, "Partitions"); if (textord_debug_images) window->Image(AlignedBlob::textord_debug_pix().string(), image_origin().x(), image_origin().y()); part_grid_.DisplayBoxes(window); if (!textord_debug_printable) DisplayTabVectors(window); if (window != NULL && textord_tabfind_show_partitions > 1) { delete window->AwaitEvent(SVET_DESTROY); } } part_grid_.AssertNoDuplicates(); // Ownership of the ColPartitions moves from part_grid_ to good_parts_ and // noise_parts_ here. In text blocks, ownership of the BLOBNBOXes moves // from the ColPartitions to the output TO_BLOCK. In non-text, the // BLOBNBOXes stay with the ColPartitions and get deleted in the destructor. TransformToBlocks(blocks, to_blocks); if (textord_debug_tabfind) { tprintf("Found %d blocks, %d to_blocks\n", blocks->length(), to_blocks->length()); } // Copy the right_to_left flag from the source block to the created blocks. // TODO(rays) fix block ordering if the input block is right_to_left. BLOCK_IT blk_it(blocks); for (blk_it.mark_cycle_pt(); !blk_it.cycled_list(); blk_it.forward()) { BLOCK* new_block = blk_it.data(); new_block->set_right_to_left(block->block->right_to_left()); } DisplayBlocks(blocks); // MoveSmallBlobs(&block->small_blobs, to_blocks); // MoveSmallBlobs(&block->noise_blobs, to_blocks); // MoveSmallBlobs(&period_blobs_, to_blocks); RotateAndReskewBlocks(to_blocks); int result = 0; if (blocks_win_ != NULL) { bool waiting = false; do { waiting = false; SVEvent* event = blocks_win_->AwaitEvent(SVET_ANY); if (event->type == SVET_INPUT && event->parameter != NULL) { if (*event->parameter == 'd') result = -1; else blocks->clear(); } else if (event->type == SVET_DESTROY) { blocks_win_ = NULL; } else { waiting = true; } delete event; } while (waiting); } return result; } // Get the rotation required to deskew, and its inverse rotation. void ColumnFinder::GetDeskewVectors(FCOORD* deskew, FCOORD* reskew) { *reskew = reskew_; *deskew = reskew_; deskew->set_y(-deskew->y()); } //////////////// PRIVATE CODE ///////////////////////// // Displays the blob and block bounding boxes in a window called Blocks. void ColumnFinder::DisplayBlocks(BLOCK_LIST* blocks) { #ifndef GRAPHICS_DISABLED if (textord_tabfind_show_blocks) { if (blocks_win_ == NULL) blocks_win_ = MakeWindow(700, 300, "Blocks"); else blocks_win_->Clear(); if (textord_debug_images) blocks_win_->Image(AlignedBlob::textord_debug_pix().string(), image_origin().x(), image_origin().y()); else DisplayBoxes(blocks_win_); BLOCK_IT block_it(blocks); int serial = 1; for (block_it.mark_cycle_pt(); !block_it.cycled_list(); block_it.forward()) { BLOCK* block = block_it.data(); block->plot(blocks_win_, serial++, textord_debug_printable ? ScrollView::BLUE : ScrollView::GREEN); } blocks_win_->Update(); } #endif } // Displays the column edges at each grid y coordinate defined by // best_columns_. void ColumnFinder::DisplayColumnBounds(PartSetVector* sets) { #ifndef GRAPHICS_DISABLED ScrollView* col_win = MakeWindow(50, 300, "Columns"); if (textord_debug_images) col_win->Image(AlignedBlob::textord_debug_pix().string(), image_origin().x(), image_origin().y()); else DisplayBoxes(col_win); col_win->Pen(textord_debug_printable ? ScrollView::BLUE : ScrollView::GREEN); for (int i = 0; i < gridheight_; ++i) { ColPartitionSet* columns = best_columns_[i]; if (columns != NULL) columns->DisplayColumnEdges(i * gridsize_, (i + 1) * gridsize_, col_win); } #endif } // Converts the arrays of Box/Pix to a list of C_OUTLINE, and then to blobs. // The output is a list of C_BLOBs for the images, but the C_OUTLINEs // contain no data. void ColumnFinder::ExtractImageBlobs(int image_height, Boxa* boxa, Pixa* pixa) { BLOBNBOX_IT bb_it(&image_bblobs_); // Iterate the connected components in the image regions mask. int nboxes = boxaGetCount(boxa); for (int i = 0; i < nboxes; ++i) { l_int32 x, y, width, height; boxaGetBoxGeometry(boxa, i, &x, &y, &width, &height); Pix* pix = pixaGetPix(pixa, i, L_CLONE); // Special case set in FindImages: // The image is a rectangle if its width doesn't match the box width. bool rectangle = width != pixGetWidth(pix); // For each grid cell in the pix, find the bounding box of the black // pixels within the cell. int grid_xmin, grid_ymin, grid_xmax, grid_ymax; GridCoords(x, image_height - (y + height), &grid_xmin, &grid_ymin); GridCoords(x + width - 1, image_height - 1 - y, &grid_xmax, &grid_ymax); for (int grid_y = grid_ymin; grid_y <= grid_ymax; ++grid_y) { for (int grid_x = grid_xmin; grid_x <= grid_xmax; ++grid_x) { // Compute bounds of grid cell in sub-image. int x_start = grid_x * gridsize_ + bleft_.x() - x; int y_end = image_height - (grid_y * gridsize_ + bleft_.y()) - y; int x_end = x_start + gridsize_; int y_start = y_end - gridsize_; ImageFinder::BoundsWithinRect(pix, &x_start, &y_start, &x_end, &y_end); // If the box is not degenerate, make a blob. if (x_end > x_start && y_end > y_start) { C_OUTLINE_LIST outlines; C_OUTLINE_IT ol_it = &outlines; // Make a C_OUTLINE from the bounds. This is a bit of a hack, // as there is no outline, just a bounding box, but with some very // small changes to coutln.cpp, it works nicely. ICOORD top_left(x_start + x, image_height - (y_start + y)); ICOORD bot_right(x_end + x, image_height - (y_end + y)); CRACKEDGE startpt; startpt.pos = top_left; C_OUTLINE* outline = new C_OUTLINE(&startpt, top_left, bot_right, 0); ol_it.add_after_then_move(outline); C_BLOB* blob = new C_BLOB(&outlines); // Although a BLOBNBOX doesn't normally think it owns the blob, // these will all end up in a ColPartition, which deletes the // C_BLOBs of all its BLOBNBOXes in its destructor to match the // fact that the rest get moved to a block later. BLOBNBOX* bblob = new BLOBNBOX(blob); bblob->set_region_type(rectangle ? BRT_RECTIMAGE : BRT_POLYIMAGE); bb_it.add_after_then_move(bblob); } } } pixDestroy(&pix); } } ////// Functions involved in making the initial ColPartitions. ///// // Creates the initial ColPartitions, and puts them in a ColPartitionSet // for each grid y coordinate, storing the ColPartitionSets in part_sets_. // After creating the ColPartitonSets, attempts to merge them where they // overlap and unique the BLOBNBOXes within. // The return value is the number of ColPartitionSets made. int ColumnFinder::MakeColumnPartitions() { part_sets_.reserve(gridheight_); for (int grid_y = 0; grid_y < gridheight_; ++grid_y) { ColPartitionSet* line_set = PartitionsAtGridY(grid_y); part_sets_.push_back(line_set); } // Now merge neighbouring partitions that overlap significantly. int part_set_count = 0; for (int i = 0; i < gridheight_; ++i) { ColPartitionSet* line_set = part_sets_.get(i); if (line_set == NULL) continue; bool merged_any = false; for (int j = i + 1; j < gridheight_; ++j) { ColPartitionSet* line_set2 = part_sets_.get(j); if (line_set2 == NULL) continue; if (line_set->MergeOverlaps(line_set2, WidthCB())) { merged_any = true; if (line_set2->Empty()) { delete line_set2; part_sets_.set(NULL, j); } if (line_set->Empty()) { delete line_set; part_sets_.set(NULL, i); merged_any = false; break; } } else { break; } } if (merged_any) --i; // Try this one again. else ++part_set_count; } return part_set_count; } // Partition the BLOBNBOXES horizontally at the given grid y, creating a // ColPartitionSet which is returned. NULL is returned if there are no // BLOBNBOXES at the given grid y. ColPartitionSet* ColumnFinder::PartitionsAtGridY(int grid_y) { ColPartition_LIST partitions; ColPartition_IT part_it(&partitions); // Setup a search of all the grid cells at the given y. GridSearch<BLOBNBOX, BLOBNBOX_CLIST, BLOBNBOX_C_IT> rectsearch(this); int y = grid_y * gridsize_ + bleft_.y(); ICOORD botleft(bleft_.x(), y); ICOORD topright(tright_.x(), y + gridsize_ - 1); TBOX line_box(botleft, topright); rectsearch.StartRectSearch(line_box); BLOBNBOX* bbox = rectsearch.NextRectSearch(); // Each iteration round this while loop finds a set of boxes between // tabvectors (or a change of aligned_text type) and places them in // a ColPartition. int page_edge = line_box.right() + kColumnWidthFactor; int prev_margin = line_box.left() - kColumnWidthFactor; // Runs of unknown blobs (not certainly text or image) go in a special // unk_part, following the same rules as known blobs, but need a // separate set of variables to hold the margin/edge information. ColPartition_IT unk_part_it(&unknown_parts_); ColPartition* unk_partition = NULL; TabVector* unk_right_line = NULL; int unk_right_margin = page_edge; int unk_prev_margin = prev_margin; bool unk_edge_is_left = false; while (bbox != NULL) { TBOX box = bbox->bounding_box(); if (WithinTestRegion(2, box.left(), box.bottom())) tprintf("Starting partition on grid y=%d with box (%d,%d)->(%d,%d)\n", grid_y, box.left(), box.bottom(), box.right(), box.top()); if (box.left() < prev_margin + 1 && textord_debug_bugs) { tprintf("Starting box too far left at %d vs %d:", box.left(), prev_margin + 1); part_it.data()->Print(); } int right_margin = page_edge; BlobRegionType start_type = bbox->region_type(); if (start_type == BRT_NOISE) { // Ignore blobs that have been overruled by image blobs. // TODO(rays) Possible place to fix inverse text. bbox = rectsearch.NextRectSearch(); continue; } if (start_type == BRT_UNKNOWN) { // Keep unknown blobs in a special partition. ProcessUnknownBlob(page_edge, bbox, &unk_partition, &unk_part_it, &unk_right_line, &unk_right_margin, &unk_prev_margin, &unk_edge_is_left); bbox = rectsearch.NextRectSearch(); continue; } if (unk_partition != NULL) unk_prev_margin = CompletePartition(false, page_edge, unk_right_line, &unk_right_margin, &unk_partition, &unk_part_it); TabVector* right_line = NULL; bool edge_is_left = false; ColPartition* partition = StartPartition(start_type, prev_margin + 1, bbox, &right_line, &right_margin, &edge_is_left); // Search for the right edge of this partition. while ((bbox = rectsearch.NextRectSearch()) != NULL) { TBOX box = bbox->bounding_box(); int left = box.left(); int right = box.right(); int edge = edge_is_left ? left : right; BlobRegionType next_type = bbox->region_type(); if (next_type == BRT_NOISE) continue; if (next_type == BRT_UNKNOWN) { // Keep unknown blobs in a special partition. ProcessUnknownBlob(page_edge, bbox, &unk_partition, &unk_part_it, &unk_right_line, &unk_right_margin, &unk_prev_margin, &unk_edge_is_left); continue; // Deal with them later. } if (unk_partition != NULL) unk_prev_margin = CompletePartition(false, page_edge, unk_right_line, &unk_right_margin, &unk_partition, &unk_part_it); if (ColPartition::TypesMatch(next_type, start_type) && edge < right_margin) { // Still within the region and it is still the same type. partition->AddBox(bbox); } else { // This is the first blob in the next set. It gives us the absolute // max right coord of the block. (The right margin.) right_margin = left - 1; if (WithinTestRegion(2, box.left(), box.bottom())) tprintf("Box (%d,%d)->(%d,%d) ended partition at %d\n", box.left(), box.bottom(), box.right(), box.top(), right_margin); break; } } prev_margin = CompletePartition(bbox == NULL, page_edge, right_line, &right_margin, &partition, &part_it); } if (unk_partition != NULL) CompletePartition(true, page_edge, unk_right_line, &unk_right_margin, &unk_partition, &unk_part_it); return partitions.empty() ? NULL : new ColPartitionSet(&partitions); } // Insert the blobs in the given list into the main grid and for // each one also make it a separate unknown partition. // If filter is true, use only the blobs that are above a threshold in // size or a non-isolated. void ColumnFinder::InsertSmallBlobsAsUnknowns(bool filter, BLOBNBOX_LIST* blobs) { double noise_blob_size = gridsize() * kMinNonNoiseFraction; ColPartition_IT unk_part_it(&unknown_parts_); BLOBNBOX_IT blob_it(blobs); for (blob_it.mark_cycle_pt(); !blob_it.cycled_list(); blob_it.forward()) { BLOBNBOX* blob = blob_it.data(); TBOX box = blob->bounding_box(); bool good_blob = !filter || blob->flow() == BTFT_LEADER || box.width() > noise_blob_size || box.height() > noise_blob_size; if (!good_blob) { // Search the vicinity for a bigger blob. GridSearch<BLOBNBOX, BLOBNBOX_CLIST, BLOBNBOX_C_IT> radsearch(this); radsearch.StartRadSearch((box.left() + box.right()) / 2, (box.bottom() + box.top()) / 2, kSmallBlobSearchRadius); BLOBNBOX* neighbour; while ((neighbour = radsearch.NextRadSearch()) != NULL) { TBOX nbox = neighbour->bounding_box(); // Neighbours must be bigger than the noise size limit to prevent // the seed effect of starting with one noise object near a real // object, and it then allowing all its neighbours to be accepted. if (nbox.height() > noise_blob_size || nbox.width() > noise_blob_size) break; } if (neighbour != NULL) good_blob = true; } if (good_blob) { blob_it.extract(); InsertBlob(true, true, false, blob, this); if (WithinTestRegion(2, box.left(), box.bottom())) tprintf("Starting small partition with box (%d,%d)->(%d,%d)\n", box.left(), box.bottom(), box.right(), box.top()); int unk_right_margin = tright().x(); TabVector* unk_right_line = NULL; bool unk_edge_is_left = false; BlobRegionType start_type = blob->region_type(); if (!BLOBNBOX::IsLineType(start_type)) start_type = BRT_TEXT; ColPartition* unk_partition = StartPartition(start_type, bleft().x(), blob, &unk_right_line, &unk_right_margin, &unk_edge_is_left); CompletePartition(false, tright().x(), unk_right_line, &unk_right_margin, &unk_partition, &unk_part_it); } } } // Helper function for PartitionsAtGridY, with a long argument list. // This bbox is of unknown type, so it is added to an unk_partition. // If the edge is past the unk_right_margin then unk_partition has to be // completed and a new one made. See CompletePartition and StartPartition // for the other args. void ColumnFinder::ProcessUnknownBlob(int page_edge, BLOBNBOX* bbox, ColPartition** unk_partition, ColPartition_IT* unk_part_it, TabVector** unk_right_line, int* unk_right_margin, int* unk_prev_margin, bool* unk_edge_is_left) { if (*unk_partition != NULL) { const TBOX& box = bbox->bounding_box(); int edge = *unk_edge_is_left ? box.left() : box.right(); if (edge >= *unk_right_margin) *unk_prev_margin = CompletePartition(false, page_edge, *unk_right_line, unk_right_margin, unk_partition, unk_part_it); } if (*unk_partition == NULL) { *unk_partition = StartPartition(BRT_TEXT, *unk_prev_margin + 1, bbox, unk_right_line, unk_right_margin, unk_edge_is_left); } else { (*unk_partition)->AddBox(bbox); } } // Creates and returns a new ColPartition of the given start_type // and adds the given bbox to it. // Also finds the left and right tabvectors that bound the textline, setting // the members of the returned ColPartition appropriately: // If the left tabvector is less constraining than the input left_margin // (assumed to be the right edge of the previous partition), then the // tabvector is ignored and the left_margin used instead. // If the right tabvector is more constraining than the input *right_margin, // (probably the right edge of the page), then the *right_margin is adjusted // to use the tabvector. // *edge_is_left is set to true if the right tabvector is good and used as the // margin, so we can include blobs that overhang the tabvector in this // partition. ColPartition* ColumnFinder::StartPartition(BlobRegionType start_type, int left_margin, BLOBNBOX* bbox, TabVector** right_line, int* right_margin, bool* edge_is_left) { ColPartition* partition = new ColPartition(start_type, vertical_skew_); partition->AddBox(bbox); // Find the tabs that bound it. TBOX box = bbox->bounding_box(); int mid_y = (box.bottom() + box.top()) / 2; TabVector* left_line = LeftTabForBox(box, true, false); // If the overlapping line is not a left tab, try for non-overlapping. if (left_line != NULL && !left_line->IsLeftTab()) left_line = LeftTabForBox(box, false, false); if (left_line != NULL) { int left_x = left_line->XAtY(mid_y); left_x += left_line->IsLeftTab() ? -kColumnWidthFactor : 1; // If the left line is not a genuine left or is less constraining // than the previous blob, then don't store it in the partition. if (left_x < left_margin || !left_line->IsLeftTab()) left_line = NULL; if (left_x > left_margin) left_margin = left_x; if (WithinTestRegion(2, box.left(), box.bottom())) tprintf("Left x =%d, left margin = %d\n", left_x, left_margin); } partition->set_left_margin(left_margin); *right_line = RightTabForBox(box, true, false); // If the overlapping line is not a right tab, try for non-overlapping. if (*right_line != NULL && !(*right_line)->IsRightTab()) *right_line = RightTabForBox(box, false, false); *edge_is_left = false; if (*right_line != NULL) { int right_x = (*right_line)->XAtY(box.bottom()); if (right_x < *right_margin) { *right_margin = right_x; if ((*right_line)->IsRightTab()) *edge_is_left = true; } if (WithinTestRegion(3, box.left(), box.bottom())) tprintf("Right x =%d, right_max = %d\n", right_x, *right_margin); } partition->set_right_margin(*right_margin); partition->ComputeLimits(); partition->SetLeftTab(left_line); partition->SetRightTab(*right_line); return partition; } // Completes the given partition, and adds it to the given iterator. // The right_margin on input is the left edge of the next blob if there is // one. The right tab vector plus a margin is used as the right margin if // it is more constraining than the next blob, but if there are no more // blobs, we want the right margin to make it to the page edge. // The return value is the next left margin, being the right edge of the // bounding box of blobs. int ColumnFinder::CompletePartition(bool no_more_blobs, int page_edge, TabVector* right_line, int* right_margin, ColPartition** partition, ColPartition_IT* part_it) { ASSERT_HOST(partition !=NULL && *partition != NULL); // If we have a right line, it is possible that its edge is more // constraining than the next blob. if (right_line != NULL && right_line->IsRightTab()) { int mid_y = (*partition)->MidY(); int right_x = right_line->XAtY(mid_y) + kColumnWidthFactor; if (right_x < *right_margin) *right_margin = right_x; else if (no_more_blobs) *right_margin = MAX(right_x, page_edge); else if (right_line->XAtY(mid_y) > *right_margin) right_line = NULL; } else { right_line = NULL; } // Now we can complete the partition and add it to the list. (*partition)->set_right_margin(*right_margin); (*partition)->ComputeLimits(); (*partition)->SetRightTab(right_line); (*partition)->SetColumnGoodness(WidthCB()); part_it->add_after_then_move(*partition); // Setup ready to start the next one. *right_margin = page_edge; int next_left_margin = (*partition)->bounding_box().right(); *partition = NULL; return next_left_margin; } // Makes an ordered list of candidates to partition the width of the page // into columns using the part_sets_. // See AddToColumnSetsIfUnique for the ordering. // If single_column, then it just makes a single page-wide fake column. void ColumnFinder::MakeColumnCandidates(bool single_column) { if (!single_column) { // Try using only the good parts first. bool good_only = true; do { for (int i = 0; i < gridheight_; ++i) { ColPartitionSet* line_set = part_sets_.get(i); if (line_set != NULL && line_set->LegalColumnCandidate()) { ColPartitionSet* column_candidate = line_set->Copy(good_only); if (column_candidate != NULL) column_candidate->AddToColumnSetsIfUnique(&column_sets_, WidthCB()); } } good_only = !good_only; } while (column_sets_.empty() && !good_only); } if (column_sets_.empty()) { // The page contains only image or is single column. // Make a fake page-wide column. ColPartition* fake_part = new ColPartition(BRT_TEXT, vertical_skew_); fake_part->set_left_margin(bleft_.x()); fake_part->set_right_margin(tright_.x()); fake_part->ComputeLimits(); fake_part->SetColumnGoodness(WidthCB()); ColPartitionSet* column_candidate = new ColPartitionSet(fake_part); column_candidate->AddToColumnSetsIfUnique(&column_sets_, WidthCB()); } } // Attempt to improve the column_candidates by expanding the columns // and adding new partitions from the partition sets in src_sets. // Src_sets may be equal to column_candidates, in which case it will // use them as a source to improve themselves. void ColumnFinder::ImproveColumnCandidates(PartSetVector* src_sets, PartSetVector* column_sets) { PartSetVector temp_cols; temp_cols.move(column_sets); if (src_sets == column_sets) src_sets = &temp_cols; int set_size = temp_cols.size(); // Try using only the good parts first. bool good_only = true; do { for (int i = 0; i < set_size; ++i) { ColPartitionSet* column_candidate = temp_cols.get(i); ASSERT_HOST(column_candidate != NULL); ColPartitionSet* improved = column_candidate->Copy(good_only); if (improved != NULL) { improved->ImproveColumnCandidate(WidthCB(), src_sets); improved->AddToColumnSetsIfUnique(column_sets, WidthCB()); } } good_only = !good_only; } while (column_sets->empty() && !good_only); if (column_sets->empty()) column_sets->move(&temp_cols); else temp_cols.delete_data_pointers(); } // Prints debug information on the column candidates. void ColumnFinder::PrintColumnCandidates(const char* title) { int set_size = column_sets_.size(); tprintf("Found %d %s:\n", set_size, title); if (textord_debug_tabfind >= 3) { for (int i = 0; i < set_size; ++i) { ColPartitionSet* column_set = column_sets_.get(i); column_set->Print(); } } } // Finds the optimal set of columns that cover the entire image with as // few changes in column partition as possible. // NOTE: this could be thought of as an optimization problem, but a simple // greedy algorithm is used instead. The algorithm repeatedly finds the modal // compatible column in an unassigned region and uses that with the extra // tweak of extending the modal region over small breaks in compatibility. // Where modal regions overlap, the boundary is chosen so as to minimize // the cost in terms of ColPartitions not fitting an approved column. void ColumnFinder::AssignColumns() { int set_count = part_sets_.size(); ASSERT_HOST(set_count == gridheight()); // Allocate and init the best_columns_. best_columns_ = new ColPartitionSet*[set_count]; for (int y = 0; y < set_count; ++y) best_columns_[y] = NULL; int column_count = column_sets_.size(); // column_set_costs[part_sets_ index][column_sets_ index] is // < MAX_INT32 if the partition set is compatible with the column set, // in which case its value is the cost for that set used in deciding // which competing set to assign. // any_columns_possible[part_sets_ index] is true if any of // possible_column_sets[part_sets_ index][*] is < MAX_INT32. // assigned_costs[part_sets_ index] is set to the column_set_costs // of the assigned column_sets_ index or MAX_INT32 if none is set. // On return the best_columns_ member is set. bool* any_columns_possible = new bool[set_count]; int* assigned_costs = new int[set_count]; int** column_set_costs = new int*[set_count]; // Set possible column_sets to indicate whether each set is compatible // with each column. for (int part_i = 0; part_i < set_count; ++part_i) { ColPartitionSet* line_set = part_sets_.get(part_i); bool debug = line_set != NULL && WithinTestRegion(2, line_set->bounding_box().left(), line_set->bounding_box().bottom()); column_set_costs[part_i] = new int[column_count]; any_columns_possible[part_i] = false; assigned_costs[part_i] = MAX_INT32; for (int col_i = 0; col_i < column_count; ++col_i) { if (line_set != NULL && column_sets_.get(col_i)->CompatibleColumns(debug, line_set, WidthCB())) { column_set_costs[part_i][col_i] = column_sets_.get(col_i)->UnmatchedWidth(line_set); any_columns_possible[part_i] = true; } else { column_set_costs[part_i][col_i] = MAX_INT32; if (debug) tprintf("Set id %d did not match at y=%d, lineset =%p\n", col_i, part_i, line_set); } } } // Assign a column set to each vertical grid position. // While there is an unassigned range, find its mode. int start, end; while (BiggestUnassignedRange(any_columns_possible, &start, &end)) { if (textord_debug_tabfind >= 2) tprintf("Biggest unassigned range = %d- %d\n", start, end); // Find the modal column_set_id in the range. int column_set_id = RangeModalColumnSet(column_set_costs, assigned_costs, start, end); if (textord_debug_tabfind >= 2) { tprintf("Range modal column id = %d\n", column_set_id); column_sets_.get(column_set_id)->Print(); } // Now find the longest run of the column_set_id in the range. ShrinkRangeToLongestRun(column_set_costs, assigned_costs, any_columns_possible, column_set_id, &start, &end); if (textord_debug_tabfind >= 2) tprintf("Shrunk range = %d- %d\n", start, end); // Extend the start and end past the longest run, while there are // only small gaps in compatibility that can be overcome by larger // regions of compatibility beyond. ExtendRangePastSmallGaps(column_set_costs, assigned_costs, any_columns_possible, column_set_id, -1, -1, &start); --end; ExtendRangePastSmallGaps(column_set_costs, assigned_costs, any_columns_possible, column_set_id, 1, set_count, &end); ++end; if (textord_debug_tabfind) tprintf("Column id %d applies to range = %d - %d\n", column_set_id, start, end); // Assign the column to the range, which now may overlap with other ranges. AssignColumnToRange(column_set_id, start, end, column_set_costs, assigned_costs); } // If anything remains unassigned, the whole lot is unassigned, so // arbitrarily assign id 0. if (best_columns_[0] == NULL) { AssignColumnToRange(0, 0, gridheight_, column_set_costs, assigned_costs); } // Free memory. for (int i = 0; i < set_count; ++i) { delete [] column_set_costs[i]; } delete [] assigned_costs; delete [] any_columns_possible; delete [] column_set_costs; } // Finds the biggest range in part_sets_ that has no assigned column, but // column assignment is possible. bool ColumnFinder::BiggestUnassignedRange(const bool* any_columns_possible, int* best_start, int* best_end) { int set_count = part_sets_.size(); int best_range_size = 0; *best_start = set_count; *best_end = set_count; int end = set_count; for (int start = 0; start < gridheight_; start = end) { // Find the first unassigned index in start. while (start < set_count) { if (best_columns_[start] == NULL && any_columns_possible[start]) break; ++start; } // Find the first past the end and count the good ones in between. int range_size = 1; // Number of non-null, but unassigned line sets. end = start + 1; while (end < set_count) { if (best_columns_[end] != NULL) break; if (any_columns_possible[end]) ++range_size; ++end; } if (start < set_count && range_size > best_range_size) { best_range_size = range_size; *best_start = start; *best_end = end; } } return *best_start < *best_end; } // Finds the modal compatible column_set_ index within the given range. int ColumnFinder::RangeModalColumnSet(int** column_set_costs, const int* assigned_costs, int start, int end) { int column_count = column_sets_.size(); STATS column_stats(0, column_count); for (int part_i = start; part_i < end; ++part_i) { for (int col_j = 0; col_j < column_count; ++col_j) { if (column_set_costs[part_i][col_j] < assigned_costs[part_i]) column_stats.add(col_j, 1); } } ASSERT_HOST(column_stats.get_total() > 0); return column_stats.mode(); } // Given that there are many column_set_id compatible columns in the range, // shrinks the range to the longest contiguous run of compatibility, allowing // gaps where no columns are possible, but not where competing columns are // possible. void ColumnFinder::ShrinkRangeToLongestRun(int** column_set_costs, const int* assigned_costs, const bool* any_columns_possible, int column_set_id, int* best_start, int* best_end) { // orig_start and orig_end are the maximum range we will look at. int orig_start = *best_start; int orig_end = *best_end; int best_range_size = 0; *best_start = orig_end; *best_end = orig_end; int end = orig_end; for (int start = orig_start; start < orig_end; start = end) { // Find the first possible while (start < orig_end) { if (column_set_costs[start][column_set_id] < assigned_costs[start] || !any_columns_possible[start]) break; ++start; } // Find the first past the end. end = start + 1; while (end < orig_end) { if (column_set_costs[end][column_set_id] >= assigned_costs[start] && any_columns_possible[end]) break; ++end; } if (start < orig_end && end - start > best_range_size) { best_range_size = end - start; *best_start = start; *best_end = end; } } } // Moves start in the direction of step, upto, but not including end while // the only incompatible regions are no more than kMaxIncompatibleColumnCount // in size, and the compatible regions beyond are bigger. void ColumnFinder::ExtendRangePastSmallGaps(int** column_set_costs, const int* assigned_costs, const bool* any_columns_possible, int column_set_id, int step, int end, int* start) { if (textord_debug_tabfind > 2) tprintf("Starting expansion at %d, step=%d, limit=%d\n", *start, step, end); if (*start == end) return; // Cannot be expanded. int barrier_size = 0; int good_size = 0; do { // Find the size of the incompatible barrier. barrier_size = 0; int i; for (i = *start + step; i != end; i += step) { if (column_set_costs[i][column_set_id] < assigned_costs[i]) break; // We are back on. // Locations where none are possible don't count. if (any_columns_possible[i]) ++barrier_size; } if (textord_debug_tabfind > 2) tprintf("At %d, Barrier size=%d\n", i, barrier_size); if (barrier_size > kMaxIncompatibleColumnCount) return; // Barrier too big. if (i == end) { // We can't go any further, but the barrier was small, so go to the end. *start = i - step; return; } // Now find the size of the good region on the other side. good_size = 1; for (i += step; i != end; i += step) { if (column_set_costs[i][column_set_id] < assigned_costs[i]) ++good_size; else if (any_columns_possible[i]) break; } if (textord_debug_tabfind > 2) tprintf("At %d, good size = %d\n", i, good_size); // If we had enough good ones we can extend the start and keep looking. if (good_size >= barrier_size) *start = i - step; } while (good_size >= barrier_size); } // Assigns the given column_set_id to the given range. void ColumnFinder::AssignColumnToRange(int column_set_id, int start, int end, int** column_set_costs, int* assigned_costs) { ColPartitionSet* column_set = column_sets_.get(column_set_id); for (int i = start; i < end; ++i) { assigned_costs[i] = column_set_costs[i][column_set_id]; best_columns_[i] = column_set; } } // Computes the mean_column_gap_. void ColumnFinder::ComputeMeanColumnGap() { int total_gap = 0; int total_width = 0; int gap_samples = 0; int width_samples = 0; for (int i = 0; i < gridheight_; ++i) { ASSERT_HOST(best_columns_[i] != NULL); best_columns_[i]->AccumulateColumnWidthsAndGaps(&total_width, &width_samples, &total_gap, &gap_samples); } mean_column_gap_ = gap_samples > 0 ? total_gap / gap_samples : total_width / width_samples; } //////// Functions that manipulate ColPartitions in the part_grid_ ///// //////// to split, merge, find margins, and find types. ////////////// // Removes the ColPartitions from part_sets_, the ColPartitionSets that // contain them, and puts them in the part_grid_ after ensuring that no // BLOBNBOX is owned by more than one of them. void ColumnFinder::MovePartitionsToGrid() { // Remove the parts from the part_sets_ and put them in the parts list. part_grid_.Init(gridsize(), bleft(), tright()); ColPartition_LIST parts; for (int i = 0; i < gridheight_; ++i) { ColPartitionSet* line_set = part_sets_.get(i); if (line_set != NULL) { line_set->ReturnParts(&parts); delete line_set; part_sets_.set(NULL, i); } } // Make each part claim ownership of its own boxes uniquely. ColPartition_IT it(&parts); for (it.mark_cycle_pt(); !it.cycled_list(); it.forward()) { ColPartition* part = it.data(); part->ClaimBoxes(WidthCB()); } // Unknowns must be uniqued too. it.set_to_list(&unknown_parts_); for (it.mark_cycle_pt(); !it.cycled_list(); it.forward()) { ColPartition* part = it.data(); part->ClaimBoxes(WidthCB()); } // Put non-empty parts into the grid and delete empty ones. for (it.set_to_list(&parts); !it.empty(); it.forward()) { ColPartition* part = it.extract(); if (part->IsEmpty()) delete part; else part_grid_.InsertBBox(true, true, part); } } // Splits partitions that cross columns where they have nothing in the gap. void ColumnFinder::GridSplitPartitions() { // Iterate the ColPartitions in the grid. GridSearch<ColPartition, ColPartition_CLIST, ColPartition_C_IT> gsearch(&part_grid_); gsearch.StartFullSearch(); ColPartition* dont_repeat = NULL; ColPartition* part; while ((part = gsearch.NextFullSearch()) != NULL) { if (part->blob_type() < BRT_UNKNOWN || part == dont_repeat) continue; // Only applies to text partitions. ColPartitionSet* column_set = best_columns_[gsearch.GridY()]; int first_col = -1; int last_col = -1; // Find which columns the partition spans. part->ColumnRange(resolution_, column_set, &first_col, &last_col); if (first_col > 0) --first_col; // Convert output column indices to physical column indices. first_col /= 2; last_col /= 2; // We will only consider cases where a partition spans two columns, // since a heading that spans more columns than that is most likely // genuine. if (last_col != first_col + 1) continue; if (textord_debug_tabfind) { tprintf("Considering partition for GridSplit:"); part->Print(); } // Set up a rectangle search x-bounded by the column gap and y by the part. int y = part->MidY(); TBOX margin_box = part->bounding_box(); ColPartition* column = column_set->GetColumnByIndex(first_col); if (column == NULL) continue; margin_box.set_left(column->RightAtY(y) + 2); column = column_set->GetColumnByIndex(last_col); if (column == NULL) continue; margin_box.set_right(column->LeftAtY(y) - 2); // TODO(rays) Decide whether to keep rectangular filling or not in the // main grid and therefore whether we need a fancier search here. // Now run the rect search on the main blob grid. GridSearch<BLOBNBOX, BLOBNBOX_CLIST, BLOBNBOX_C_IT> rectsearch(this); if (textord_debug_tabfind) { tprintf("Searching box (%d,%d)->(%d,%d)\n", margin_box.left(), margin_box.bottom(), margin_box.right(), margin_box.top()); part->Print(); } rectsearch.StartRectSearch(margin_box); BLOBNBOX* bbox; while ((bbox = rectsearch.NextRectSearch()) != NULL) { if (bbox->bounding_box().overlap(margin_box)) break; } if (bbox == NULL) { // There seems to be nothing in the hole, so split the partition. gsearch.RemoveBBox(); int x_middle = (margin_box.left() + margin_box.right()) / 2; if (textord_debug_tabfind) { tprintf("Splitting part at %d:", x_middle); part->Print(); } ColPartition* split_part = part->SplitAt(x_middle); if (split_part != NULL) { if (textord_debug_tabfind) { tprintf("Split result:"); part->Print(); split_part->Print(); } part_grid_.InsertBBox(true, true, split_part); } else { // Split had no effect if (textord_debug_tabfind) tprintf("Split had no effect\n"); dont_repeat = part; } part_grid_.InsertBBox(true, true, part); gsearch.RepositionIterator(); } else if (textord_debug_tabfind) { tprintf("Part cannot be split: blob (%d,%d)->(%d,%d) in column gap\n", bbox->bounding_box().left(), bbox->bounding_box().bottom(), bbox->bounding_box().right(), bbox->bounding_box().top()); } } } // Merges partitions where there is vertical overlap, within a single column, // and the horizontal gap is small enough. void ColumnFinder::GridMergePartitions() { // Iterate the ColPartitions in the grid. GridSearch<ColPartition, ColPartition_CLIST, ColPartition_C_IT> gsearch(&part_grid_); gsearch.StartFullSearch(); ColPartition* part; while ((part = gsearch.NextFullSearch()) != NULL) { // Set up a rectangle search x-bounded by the column and y by the part. ColPartitionSet* columns = best_columns_[gsearch.GridY()]; TBOX box = part->bounding_box(); int y = part->MidY(); ColPartition* left_column = columns->ColumnContaining(box.left(), y); ColPartition* right_column = columns->ColumnContaining(box.right(), y); if (left_column == NULL || right_column != left_column) continue; box.set_left(left_column->LeftAtY(y)); box.set_right(right_column->RightAtY(y)); // Now run the rect search. bool modified_box = false; GridSearch<ColPartition, ColPartition_CLIST, ColPartition_C_IT> rsearch(&part_grid_); rsearch.StartRectSearch(box); ColPartition* neighbour; while ((neighbour = rsearch.NextRectSearch()) != NULL) { if (neighbour == part) continue; const TBOX& neighbour_box = neighbour->bounding_box(); if (neighbour_box.right() < box.left() || neighbour_box.left() > box.right()) continue; // Not within the same column. if (part->VOverlaps(*neighbour) && part->TypesMatch(*neighbour)) { // There is vertical overlap and the gross types match, but only // merge if the horizontal gap is small enough, as one of the // partitions may be a figure caption within a column. // If there is only one column, then the mean_column_gap_ is large // enough to allow almost any merge, by being the mean column width. const TBOX& part_box = part->bounding_box(); int h_gap = MAX(part_box.left(), neighbour_box.left()) - MIN(part_box.right(), neighbour_box.right()); if (h_gap < mean_column_gap_ * kHorizontalGapMergeFraction || part_box.width() < mean_column_gap_ || neighbour_box.width() < mean_column_gap_) { if (textord_debug_tabfind) { tprintf("Running grid-based merge between:\n"); part->Print(); neighbour->Print(); } rsearch.RemoveBBox(); gsearch.RepositionIterator(); part->Absorb(neighbour, WidthCB()); modified_box = true; } } } if (modified_box) { // We modified the box of part, so re-insert it into the grid. // This does no harm in the current cell, as it already exists there, // but it needs to exist in all the cells covered by its bounding box, // or it will never be found by a full search. // Because the box has changed, it has to be removed first, otherwise // add_sorted may fail to keep a single copy of the pointer. gsearch.RemoveBBox(); part_grid_.InsertBBox(true, true, part); gsearch.RepositionIterator(); } } } // Helper function to compute the total pairwise area overlap of a list of // Colpartitions. If box_this matches an element in the list, the test_box // is used in place of its box. static int TotalPairwiseOverlap(const ColPartition* box_this, const TBOX& test_box, ColPartition_CLIST* parts) { if (parts->singleton()) return 0; int total_area = 0; for (ColPartition_C_IT it(parts); !it.at_last(); it.forward()) { ColPartition* part = it.data(); TBOX part_box = part == box_this ? test_box : part->bounding_box(); ColPartition_C_IT it2(it); for (it2.forward(); !it2.at_first(); it2.forward()) { ColPartition* part2 = it2.data(); TBOX part_box2 = part2 == box_this ? test_box : part2->bounding_box(); total_area += part_box.intersection(part_box2).area(); } } return total_area; } // Helper function to compute the total area of a list of Colpartitions. // If box_this matches an element in the list, the test_box // is used in place of its box. static int TotalArea(const ColPartition* box_this, const TBOX& test_box, ColPartition_CLIST* parts) { int total_area = 0; ColPartition_C_IT it(parts); for (it.mark_cycle_pt(); !it.cycled_list(); it.forward()) { ColPartition* part = it.data(); TBOX part_box = part == box_this ? test_box : part->bounding_box(); total_area += part_box.area(); } return total_area; } // Resolves unknown partitions from the unknown_parts_ list by merging them // with a close neighbour, inserting them into the grid with a known type, // or declaring them to be noise. void ColumnFinder::GridInsertUnknowns() { ColPartition_IT noise_it(&noise_parts_); for (ColPartition_IT it(&unknown_parts_); !it.empty(); it.forward()) { ColPartition* part = it.extract(); if (part->IsEmpty()) { // Claiming ownership left this one empty. delete part; continue; } const TBOX& part_box = part->bounding_box(); int left_limit = LeftEdgeForBox(part_box, false, false); int right_limit = RightEdgeForBox(part_box, false, false); TBOX search_box = part_box; int y = part->MidY(); int grid_x, grid_y; GridCoords(part_box.left(), y, &grid_x, &grid_y); // Set up a rectangle search x-bounded by the column and y by the part. ColPartitionSet* columns = best_columns_[grid_y]; int first_col = -1; int last_col = -1; // Find which columns the partition spans. part->ColumnRange(resolution_, columns, &first_col, &last_col); // Convert output column indices to physical column indices. // Twiddle with first and last_col to get the desired effect with // in-between columns: // As returned by ColumnRange, the indices are even for in-betweens and // odd for real columns (being 2n+1 the real column index). // Subtract 1 from first col, so we can use left edge of first_col/2 if it // is even, and the right edge of first_col/2 if it is odd. // With last_col unchanged, we can use the right edge of last_col/2 if it // is odd and the left edge of last_col/2 if it is even. // with first_col, we have to special-case to pretend that the first // in-between is actually the first column, and with last_col, we have to // pretend that the last in-between is actually the last column. if (first_col > 0) --first_col; ColPartition* first_column = columns->GetColumnByIndex(first_col / 2); ColPartition* last_column = columns->GetColumnByIndex(last_col / 2); if (last_column == NULL && last_col > first_col + 1) last_column = columns->GetColumnByIndex(last_col / 2 - 1); // Do not accept the case of both being in the first or last in-between. if (last_col > 0 && first_column != NULL && last_column != NULL) { search_box.set_left((first_col & 1) ? first_column->RightAtY(y) : first_column->LeftAtY(y)); search_box.set_right((last_col & 1) ? last_column->RightAtY(y) : last_column->LeftAtY(y)); // Expand the search vertically. int height = search_box.height(); search_box.set_top(search_box.top() + height); search_box.set_bottom(search_box.bottom() - height); // Keep valid neighbours in a list. ColPartition_CLIST neighbours; // Now run the rect search. GridSearch<ColPartition, ColPartition_CLIST, ColPartition_C_IT> rsearch(&part_grid_); rsearch.StartRectSearch(search_box); ColPartition* neighbour; while ((neighbour = rsearch.NextRectSearch()) != NULL) { const TBOX& n_box = neighbour->bounding_box(); if (n_box.left() > right_limit || n_box.right() < left_limit) continue; // Other side of a tab vector. if (neighbour->blob_type() == BRT_RECTIMAGE) { continue; // Rectangle images aren't allowed to acquire anything. } // We can't merge with a partition where it would go beyond the margin // of the partition. if ((part_box.left() < neighbour->left_margin() || part_box.right() > neighbour->right_margin()) && !n_box.contains(part_box)) { continue; // This would create an overlap with another partition. } // Candidates must be within a reasonable vertical distance. int v_dist = -part->VOverlap(*neighbour); if (v_dist >= MAX(part_box.height(), n_box.height()) / 2) continue; // Unique elements as they arrive. neighbours.add_sorted(SortByBoxLeft<ColPartition>, true, neighbour); } // The best neighbour to merge with is the one that causes least // total pairwise overlap among all the candidates. // If more than one offers the same total overlap, choose the one // with the least total area. ColPartition* best_neighbour = NULL; ColPartition_C_IT n_it(&neighbours); if (neighbours.singleton()) { best_neighbour = n_it.data(); } else if (!neighbours.empty()) { int best_overlap = MAX_INT32; int best_area = 0; for (n_it.mark_cycle_pt(); !n_it.cycled_list(); n_it.forward()) { neighbour = n_it.data(); TBOX merged_box = neighbour->bounding_box(); merged_box += part_box; int overlap = TotalPairwiseOverlap(neighbour, merged_box, &neighbours); if (best_neighbour == NULL || overlap < best_overlap) { best_neighbour = neighbour; best_overlap = overlap; best_area = TotalArea(neighbour, merged_box, &neighbours); } else if (overlap == best_overlap) { int area = TotalArea(neighbour, merged_box, &neighbours); if (area < best_area) { best_area = area; best_neighbour = neighbour; } } } } if (best_neighbour != NULL) { // It was close enough to an existing partition to merge it. if (textord_debug_tabfind) { tprintf("Merging unknown partition:\n"); part->Print(); best_neighbour->Print(); } // Because the box is about to be resized, it must be removed and // then re-inserted to prevent duplicates in the grid lists. part_grid_.RemoveBBox(best_neighbour); best_neighbour->Absorb(part, WidthCB()); // We modified the box of best_neighbour, so re-insert it into the grid. part_grid_.InsertBBox(true, true, best_neighbour); } else { // It was inside a column, so just add it to the grid. if (textord_debug_tabfind) tprintf("Inserting unknown partition:\n"); part_grid_.InsertBBox(true, true, part); } } else { if (textord_debug_tabfind) { tprintf("Unknown partition at (%d,%d)->(%d,%d) not in any column\n", part_box.left(), part_box.bottom(), part_box.right(), part_box.top()); tprintf("first_col = %d->%p, last_col=%d->%p\n", first_col, first_column, last_col, last_column); } noise_it.add_to_end(part); } } } // Add horizontal line separators as partitions. void ColumnFinder::GridInsertHLinePartitions() { TabVector_IT hline_it(&horizontal_lines_); for (hline_it.mark_cycle_pt(); !hline_it.cycled_list(); hline_it.forward()) { TabVector* hline = hline_it.data(); int top = MAX(hline->startpt().y(), hline->endpt().y()); int bottom = MIN(hline->startpt().y(), hline->endpt().y()); top += hline->mean_width(); if (top == bottom) { if (bottom > 0) --bottom; else ++top; } ColPartition* part = ColPartition::MakeLinePartition( BRT_HLINE, vertical_skew_, hline->startpt().x(), bottom, hline->endpt().x(), top); part->set_type(PT_HORZ_LINE); bool any_image = false; ColPartitionGridSearch part_search(&part_grid_); part_search.SetUniqueMode(true); part_search.StartRectSearch(part->bounding_box()); ColPartition* covered; while ((covered = part_search.NextRectSearch()) != NULL) { if (covered->IsImageType()) { any_image = true; break; } } if (!any_image) part_grid_.InsertBBox(true, true, part); else delete part; } } // Add horizontal line separators as partitions. void ColumnFinder::GridInsertVLinePartitions() { TabVector_IT vline_it(dead_vectors()); for (vline_it.mark_cycle_pt(); !vline_it.cycled_list(); vline_it.forward()) { TabVector* vline = vline_it.data(); if (!vline->IsSeparator()) continue; int left = MIN(vline->startpt().x(), vline->endpt().x()); int right = MAX(vline->startpt().x(), vline->endpt().x()); right += vline->mean_width(); if (left == right) { if (left > 0) --left; else ++right; } ColPartition* part = ColPartition::MakeLinePartition( BRT_VLINE, vertical_skew_, left, vline->startpt().y(), right, vline->endpt().y()); part->set_type(PT_VERT_LINE); bool any_image = false; ColPartitionGridSearch part_search(&part_grid_); part_search.SetUniqueMode(true); part_search.StartRectSearch(part->bounding_box()); ColPartition* covered; while ((covered = part_search.NextRectSearch()) != NULL) { if (covered->IsImageType()) { any_image = true; break; } } if (!any_image) part_grid_.InsertBBox(true, true, part); else delete part; } } // For every ColPartition in the grid, sets its type based on position // in the columns. void ColumnFinder::SetPartitionTypes() { GridSearch<ColPartition, ColPartition_CLIST, ColPartition_C_IT> gsearch(&part_grid_); gsearch.StartFullSearch(); ColPartition* part; while ((part = gsearch.NextFullSearch()) != NULL) { part->SetPartitionType(resolution_, best_columns_[gsearch.GridY()]); } } // Only images remain with multiple types in a run of partners. // Sets the type of all in the group to the maximum of the group. void ColumnFinder::SmoothPartnerRuns() { // Iterate the ColPartitions in the grid. GridSearch<ColPartition, ColPartition_CLIST, ColPartition_C_IT> gsearch(&part_grid_); gsearch.StartFullSearch(); ColPartition* part; while ((part = gsearch.NextFullSearch()) != NULL) { ColPartition* partner = part->SingletonPartner(true); if (partner != NULL) { ASSERT_HOST(partner->SingletonPartner(false) == part); } else if (part->SingletonPartner(false) != NULL) { ColPartitionSet* column_set = best_columns_[gsearch.GridY()]; int column_count = column_set->ColumnCount(); part->SmoothPartnerRun(column_count * 2 + 1); } } } // Helper functions for TransformToBlocks. // Add the part to the temp list in the correct order. void ColumnFinder::AddToTempPartList(ColPartition* part, ColPartition_CLIST* temp_list) { int mid_y = part->MidY(); ColPartition_C_IT it(temp_list); for (it.mark_cycle_pt(); !it.cycled_list(); it.forward()) { ColPartition* test_part = it.data(); if (part->type() == PT_NOISE || test_part->type() == PT_NOISE) continue; // Noise stays in sequence. if (test_part == part->SingletonPartner(false)) break; // Insert before its lower partner. int neighbour_bottom = test_part->median_bottom(); int neighbour_top = test_part->median_top(); int neighbour_y = (neighbour_bottom + neighbour_top) / 2; if (neighbour_y < mid_y) break; // part is above test_part so insert it. if (!part->HOverlaps(*test_part) && !part->HCompatible(*test_part)) continue; // Incompatibles stay in order } if (it.cycled_list()) { it.add_to_end(part); } else { it.add_before_stay_put(part); } } // Add everything from the temp list to the work_set assuming correct order. void ColumnFinder::EmptyTempPartList(ColPartition_CLIST* temp_list, WorkingPartSet_LIST* work_set) { ColPartition_C_IT it(temp_list); while (!it.empty()) { it.extract()->AddToWorkingSet(bleft_, tright_, resolution_, &good_parts_, work_set); it.forward(); } } // Transform the grid of partitions to the output blocks. void ColumnFinder::TransformToBlocks(BLOCK_LIST* blocks, TO_BLOCK_LIST* to_blocks) { WorkingPartSet_LIST work_set; ColPartitionSet* column_set = NULL; ColPartition_IT noise_it(&noise_parts_); // The temp_part_list holds a list of parts at the same grid y coord // so they can be added in the correct order. This prevents thin objects // like horizontal lines going before the text lines above them. ColPartition_CLIST temp_part_list; // Iterate the ColPartitions in the grid. It starts at the top GridSearch<ColPartition, ColPartition_CLIST, ColPartition_C_IT> gsearch(&part_grid_); gsearch.StartFullSearch(); int prev_grid_y = -1; ColPartition* part; while ((part = gsearch.NextFullSearch()) != NULL) { int grid_y = gsearch.GridY(); if (grid_y != prev_grid_y) { EmptyTempPartList(&temp_part_list, &work_set); prev_grid_y = grid_y; } if (best_columns_[grid_y] != column_set) { column_set = best_columns_[grid_y]; // Every line should have a non-null best column. ASSERT_HOST(column_set != NULL); column_set->ChangeWorkColumns(bleft_, tright_, resolution_, &good_parts_, &work_set); if (textord_debug_tabfind) tprintf("Changed column groups at grid index %d\n", gsearch.GridY()); } if (part->type() == PT_NOISE) { noise_it.add_to_end(part); } else { AddToTempPartList(part, &temp_part_list); } } EmptyTempPartList(&temp_part_list, &work_set); // Now finish all working sets and transfer ColPartitionSets to block_sets. WorkingPartSet_IT work_it(&work_set); while (!work_it.empty()) { WorkingPartSet* working_set = work_it.extract(); working_set->ExtractCompletedBlocks(bleft_, tright_, resolution_, &good_parts_, blocks, to_blocks); delete working_set; work_it.forward(); } } // Undo the deskew that was done in FindTabVectors, as recognition is done // without correcting blobs or blob outlines for skew. // Reskew the completed blocks to put them back to the original rotated coords // that were created by CorrectOrientation. // Blocks that were identified as vertical text (relative to the rotated // coordinates) are further rotated so the text lines are horizontal. // blob polygonal outlines are rotated to match the position of the blocks // that they are in, and their bounding boxes are recalculated to be accurate. // Record appropriate inverse transformations and required // classifier transformation in the blocks. void ColumnFinder::RotateAndReskewBlocks(TO_BLOCK_LIST* blocks) { int text_blocks = 0; int image_blocks = 0; int other_blocks = 0; TO_BLOCK_IT it(blocks); int block_index = 1; for (it.mark_cycle_pt(); !it.cycled_list(); it.forward()) { TO_BLOCK* to_block = it.data(); BLOCK* block = to_block->block; if (block->poly_block()->IsText()) ++text_blocks; else if (PTIsImageType(block->poly_block()->isA())) ++image_blocks; else ++other_blocks; BLOBNBOX_IT blob_it(&to_block->blobs); // The text_rotation_ tells us the gross page text rotation that needs // to be applied for classification // TODO(rays) find block-level classify rotation by orientation detection. // In the mean time, assume that "up" for text printed in the minority // direction (PT_VERTICAL_TEXT) is perpendicular to the line of reading. // Accomplish this by zero-ing out the text rotation. This covers the // common cases of image credits in documents written in Latin scripts // and page headings for predominantly vertically written CJK books. FCOORD classify_rotation(text_rotation_); FCOORD block_rotation(1.0f, 0.0f); if (block->poly_block()->isA() == PT_VERTICAL_TEXT) { // Vertical text needs to be 90 degrees rotated relative to the rest. // If the rest has a 90 degree rotation already, use the inverse, making // the vertical text the original way up. Otherwise use 90 degrees // clockwise. if (rerotate_.x() == 0.0f) block_rotation = rerotate_; else block_rotation = FCOORD(0.0f, -1.0f); block->rotate(block_rotation); classify_rotation = FCOORD(1.0f, 0.0f); } block_rotation.rotate(rotation_); // block_rotation is now what we have done to the blocks. Now do the same // thing to the blobs, but save the inverse rotation in the block. FCOORD blob_rotation(block_rotation); block_rotation.set_y(-block_rotation.y()); block->set_re_rotation(block_rotation); block->set_classify_rotation(classify_rotation); if (textord_debug_tabfind) { tprintf("Blk %d, type %d rerotation(%.2f, %.2f), char(%.2f,%.2f), box:", block_index, block->poly_block()->isA(), block->re_rotation().x(), block->re_rotation().y(), classify_rotation.x(), classify_rotation.y()); } block->set_index(block_index++); // Blocks are created on the deskewed blob outlines in TransformToBlocks() // so we need to reskew them back to page coordinates. block->rotate(reskew_); // Save the skew angle in the block for baseline computations. block->set_skew(reskew_); // Rotate all the blobs if needed and recompute the bounding boxes. // Compute the block median blob width and height as we go. STATS widths(0, block->bounding_box().width()); STATS heights(0, block->bounding_box().height()); for (blob_it.mark_cycle_pt(); !blob_it.cycled_list(); blob_it.forward()) { BLOBNBOX* blob = blob_it.data(); if (blob_rotation.x() != 1.0f || blob_rotation.y() != 0.0f) { blob->cblob()->rotate(blob_rotation); } blob->compute_bounding_box(); widths.add(blob->bounding_box().width(), 1); heights.add(blob->bounding_box().height(), 1); } block->set_median_size(static_cast<int>(widths.median() + 0.5), static_cast<int>(heights.median() + 0.5)); if (textord_debug_tabfind > 1) tprintf("Block median size = (%d, %d)\n", block->median_size().x(), block->median_size().y()); } } // TransformToBlocks leaves all the small and noise blobs untouched in the // source TO_BLOCK. MoveSmallBlobs moves them into the main blobs list of // the block from the to_blocks list that contains them. // TODO(rays) This is inefficient with a large number of blocks. A more // efficient implementation is possible using a BBGrid. void ColumnFinder::MoveSmallBlobs(BLOBNBOX_LIST* bblobs, TO_BLOCK_LIST* to_blocks) { for (BLOBNBOX_IT bb_it(bblobs); !bb_it.empty(); bb_it.forward()) { BLOBNBOX* bblob = bb_it.extract(); const TBOX& bbox = bblob->bounding_box(); // Find the centre of the blob. ICOORD centre = bbox.botleft(); centre += bbox.topright(); centre /= 2; // Find the TO_BLOCK that contains the centre and put the blob in // its main blobs list. TO_BLOCK_IT to_it(to_blocks); for (to_it.mark_cycle_pt(); !to_it.cycled_list(); to_it.forward()) { TO_BLOCK* to_block = to_it.data(); BLOCK* block = to_block->block; if (block->contains(centre)) { BLOBNBOX_IT blob_it(&to_block->blobs); blob_it.add_to_end(bblob); bblob = NULL; break; } } if (bblob != NULL) { delete bblob->cblob(); delete bblob; } } } } // namespace tesseract.
42.307814
80
0.65172
[ "object", "vector", "transform" ]
a7be506a33baa38ea6ff7a94e8836171c6fd7453
2,423
cpp
C++
DSP/extensions/EffectsLib/sources/TTDegrade.cpp
avilleret/JamomaCore
b09cfb684527980f30845f664e1f922005c24e60
[ "BSD-3-Clause" ]
null
null
null
DSP/extensions/EffectsLib/sources/TTDegrade.cpp
avilleret/JamomaCore
b09cfb684527980f30845f664e1f922005c24e60
[ "BSD-3-Clause" ]
null
null
null
DSP/extensions/EffectsLib/sources/TTDegrade.cpp
avilleret/JamomaCore
b09cfb684527980f30845f664e1f922005c24e60
[ "BSD-3-Clause" ]
null
null
null
/* * TTBlue Degrade Object * Copyright © 2008, Timothy Place * * License: This code is licensed under the terms of the "New BSD License" * http://creativecommons.org/licenses/BSD/ */ #include "TTDegrade.h" #define thisTTClass TTDegrade #define thisTTClassName "degrade" #define thisTTClassTags "dspEffectsLib, audio, processor, distortion" #define BIG_INT 0x00800000 #define ONE_OVER_BIG_INT 1.1920928955E-7 TT_AUDIO_CONSTRUCTOR { TTUInt16 initialMaxNumChannels = arguments; // register attributes addAttributeWithSetter(Bitdepth, kTypeUInt8); addAttribute(SrRatio, kTypeFloat64); // register for notifications from the parent class so we can allocate memory as required addUpdates(MaxNumChannels); // Set Defaults... setAttributeValue(kTTSym_maxNumChannels, initialMaxNumChannels); setAttributeValue(TT("bitdepth"), 24); setAttributeValue(TT("srRatio"), 1.0); setProcessMethod(processAudio); } TTDegrade::~TTDegrade() {;} TTErr TTDegrade::updateMaxNumChannels(const TTValue& oldMaxNumChannels, TTValue&) { mAccumulator.resize(mMaxNumChannels); mAccumulator.assign(mMaxNumChannels, 0.0); mOutput.resize(mMaxNumChannels); mOutput.assign(mMaxNumChannels, 0.0); return kTTErrNone; } TTErr TTDegrade::setBitdepth(const TTValue& newValue) { mBitdepth = TTClip<TTInt32>(newValue, 1, 24); mBitShift = 24 - mBitdepth; return kTTErrNone; } TTErr TTDegrade::processAudio(TTAudioSignalArrayPtr inputs, TTAudioSignalArrayPtr outputs) { TTAudioSignal& in = inputs->getSignal(0); TTAudioSignal& out = outputs->getSignal(0); TTUInt16 vs; TTSampleValue *inSample, *outSample; TTUInt16 numchannels = TTAudioSignal::getMinChannelCount(in, out); TTUInt16 channel; long l; for (channel=0; channel<numchannels; channel++) { inSample = in.mSampleVectors[channel]; outSample = out.mSampleVectors[channel]; vs = in.getVectorSizeAsInt(); while (vs--) { // SampeRate Reduction mAccumulator[channel] += mSrRatio; if (mAccumulator[channel] >= 1.0) { mOutput[channel] = *inSample++; mAccumulator[channel] -= 1.0; } // BitDepth Reduction l = (long)(mOutput[channel] * BIG_INT); // change float to long int l >>= mBitShift; // shift away the least-significant bits l <<= mBitShift; // shift back to the correct registers *outSample++ = (float) l * ONE_OVER_BIG_INT; // back to float } } return kTTErrNone; }
25.239583
90
0.728849
[ "object" ]
a7c0e61034a30d9bbe42ffaed9611ba19eb5ee34
12,663
cpp
C++
CMSIS/DSP/Testing/Source/Tests/TransformQ31.cpp
lamarrr/CMSIS_5
0a1b937f6f6b5f810616eb203aa309a6b3ff32a0
[ "Apache-2.0" ]
null
null
null
CMSIS/DSP/Testing/Source/Tests/TransformQ31.cpp
lamarrr/CMSIS_5
0a1b937f6f6b5f810616eb203aa309a6b3ff32a0
[ "Apache-2.0" ]
null
null
null
CMSIS/DSP/Testing/Source/Tests/TransformQ31.cpp
lamarrr/CMSIS_5
0a1b937f6f6b5f810616eb203aa309a6b3ff32a0
[ "Apache-2.0" ]
1
2019-12-18T22:37:11.000Z
2019-12-18T22:37:11.000Z
#include "TransformQ31.h" #include <stdio.h> #include "Error.h" #include "arm_math.h" #include "arm_const_structs.h" #include "Test.h" #define SNR_THRESHOLD 90 void TransformQ31::test_cfft_q31() { const q31_t *inp = input.ptr(); q31_t *outfftp = outputfft.ptr(); memcpy(outfftp,inp,sizeof(q31_t)*input.nbSamples()); arm_cfft_q31( this->instCfftQ31, outfftp, this->ifft, 1); ASSERT_SNR(outputfft,ref,(float32_t)SNR_THRESHOLD); ASSERT_EMPTY_TAIL(outputfft); } void TransformQ31::test_cifft_q31() { const q31_t *inp = input.ptr(); q31_t *outfftp = outputfft.ptr(); q31_t *refp = ref.ptr(); memcpy(outfftp,inp,sizeof(q31_t)*input.nbSamples()); arm_cfft_q31( this->instCfftQ31, outfftp, this->ifft, 1); for(int i=0; i < outputfft.nbSamples();i++) { refp[i] >>= this->scaling; } ASSERT_SNR(outputfft,ref,(float32_t)SNR_THRESHOLD); ASSERT_EMPTY_TAIL(outputfft); } void TransformQ31::setUp(Testing::testID_t id,std::vector<Testing::param_t>& paramsArgs,Client::PatternMgr *mgr) { switch(id) { case TransformQ31::TEST_CFFT_Q31_1: input.reload(TransformQ31::INPUTS_CFFT_NOISY_16_Q31_ID,mgr); ref.reload( TransformQ31::REF_CFFT_NOISY_16_Q31_ID,mgr); instCfftQ31 = &arm_cfft_sR_q31_len16; this->ifft=0; break; case TransformQ31::TEST_CIFFT_Q31_19: input.reload(TransformQ31::INPUTS_CIFFT_NOISY_16_Q31_ID,mgr); ref.reload( TransformQ31::INPUTS_CFFT_NOISY_16_Q31_ID,mgr); instCfftQ31 = &arm_cfft_sR_q31_len16; this->ifft=1; this->scaling = 4; break; case TransformQ31::TEST_CFFT_Q31_2: input.reload(TransformQ31::INPUTS_CFFT_NOISY_32_Q31_ID,mgr); ref.reload( TransformQ31::REF_CFFT_NOISY_32_Q31_ID,mgr); instCfftQ31 = &arm_cfft_sR_q31_len32; this->ifft=0; break; case TransformQ31::TEST_CIFFT_Q31_20: input.reload(TransformQ31::INPUTS_CIFFT_NOISY_32_Q31_ID,mgr); ref.reload( TransformQ31::INPUTS_CFFT_NOISY_32_Q31_ID,mgr); instCfftQ31 = &arm_cfft_sR_q31_len32; this->ifft=1; this->scaling = 5; break; case TransformQ31::TEST_CFFT_Q31_3: input.reload(TransformQ31::INPUTS_CFFT_NOISY_64_Q31_ID,mgr); ref.reload( TransformQ31::REF_CFFT_NOISY_64_Q31_ID,mgr); instCfftQ31 = &arm_cfft_sR_q31_len64; this->ifft=0; break; case TransformQ31::TEST_CIFFT_Q31_21: input.reload(TransformQ31::INPUTS_CIFFT_NOISY_64_Q31_ID,mgr); ref.reload( TransformQ31::INPUTS_CFFT_NOISY_64_Q31_ID,mgr); instCfftQ31 = &arm_cfft_sR_q31_len64; this->ifft=1; this->scaling=6; break; case TransformQ31::TEST_CFFT_Q31_4: input.reload(TransformQ31::INPUTS_CFFT_NOISY_128_Q31_ID,mgr); ref.reload( TransformQ31::REF_CFFT_NOISY_128_Q31_ID,mgr); instCfftQ31 = &arm_cfft_sR_q31_len128; this->ifft=0; break; case TransformQ31::TEST_CIFFT_Q31_22: input.reload(TransformQ31::INPUTS_CIFFT_NOISY_128_Q31_ID,mgr); ref.reload( TransformQ31::INPUTS_CFFT_NOISY_128_Q31_ID,mgr); instCfftQ31 = &arm_cfft_sR_q31_len128; this->ifft=1; this->scaling=7; break; case TransformQ31::TEST_CFFT_Q31_5: input.reload(TransformQ31::INPUTS_CFFT_NOISY_256_Q31_ID,mgr); ref.reload( TransformQ31::REF_CFFT_NOISY_256_Q31_ID,mgr); instCfftQ31 = &arm_cfft_sR_q31_len256; this->ifft=0; break; case TransformQ31::TEST_CIFFT_Q31_23: input.reload(TransformQ31::INPUTS_CIFFT_NOISY_256_Q31_ID,mgr); ref.reload( TransformQ31::INPUTS_CFFT_NOISY_256_Q31_ID,mgr); instCfftQ31 = &arm_cfft_sR_q31_len256; this->ifft=1; this->scaling=8; break; case TransformQ31::TEST_CFFT_Q31_6: input.reload(TransformQ31::INPUTS_CFFT_NOISY_512_Q31_ID,mgr); ref.reload( TransformQ31::REF_CFFT_NOISY_512_Q31_ID,mgr); instCfftQ31 = &arm_cfft_sR_q31_len512; this->ifft=0; break; case TransformQ31::TEST_CIFFT_Q31_24: input.reload(TransformQ31::INPUTS_CIFFT_NOISY_512_Q31_ID,mgr); ref.reload( TransformQ31::INPUTS_CFFT_NOISY_512_Q31_ID,mgr); instCfftQ31 = &arm_cfft_sR_q31_len512; this->ifft=1; this->scaling=9; break; case TransformQ31::TEST_CFFT_Q31_7: input.reload(TransformQ31::INPUTS_CFFT_NOISY_1024_Q31_ID,mgr); ref.reload( TransformQ31::REF_CFFT_NOISY_1024_Q31_ID,mgr); instCfftQ31 = &arm_cfft_sR_q31_len1024; this->ifft=0; break; case TransformQ31::TEST_CIFFT_Q31_25: input.reload(TransformQ31::INPUTS_CIFFT_NOISY_1024_Q31_ID,mgr); ref.reload( TransformQ31::INPUTS_CFFT_NOISY_1024_Q31_ID,mgr); instCfftQ31 = &arm_cfft_sR_q31_len1024; this->ifft=1; this->scaling=10; break; case TransformQ31::TEST_CFFT_Q31_8: input.reload(TransformQ31::INPUTS_CFFT_NOISY_2048_Q31_ID,mgr); ref.reload( TransformQ31::REF_CFFT_NOISY_2048_Q31_ID,mgr); instCfftQ31 = &arm_cfft_sR_q31_len2048; this->ifft=0; break; case TransformQ31::TEST_CIFFT_Q31_26: input.reload(TransformQ31::INPUTS_CIFFT_NOISY_2048_Q31_ID,mgr); ref.reload( TransformQ31::INPUTS_CFFT_NOISY_2048_Q31_ID,mgr); instCfftQ31 = &arm_cfft_sR_q31_len2048; this->ifft=1; this->scaling=11; break; case TransformQ31::TEST_CFFT_Q31_9: input.reload(TransformQ31::INPUTS_CFFT_NOISY_4096_Q31_ID,mgr); ref.reload( TransformQ31::REF_CFFT_NOISY_4096_Q31_ID,mgr); instCfftQ31 = &arm_cfft_sR_q31_len4096; this->ifft=0; break; case TransformQ31::TEST_CIFFT_Q31_27: input.reload(TransformQ31::INPUTS_CIFFT_NOISY_4096_Q31_ID,mgr); ref.reload( TransformQ31::INPUTS_CFFT_NOISY_4096_Q31_ID,mgr); instCfftQ31 = &arm_cfft_sR_q31_len4096; this->ifft=1; this->scaling=12; break; /* STEP FUNCTIONS */ case TransformQ31::TEST_CFFT_Q31_10: input.reload(TransformQ31::INPUTS_CFFT_STEP_16_Q31_ID,mgr); ref.reload( TransformQ31::REF_CFFT_STEP_16_Q31_ID,mgr); instCfftQ31 = &arm_cfft_sR_q31_len16; this->ifft=0; break; case TransformQ31::TEST_CIFFT_Q31_28: input.reload(TransformQ31::INPUTS_CIFFT_STEP_16_Q31_ID,mgr); ref.reload( TransformQ31::INPUTS_CFFT_STEP_16_Q31_ID,mgr); instCfftQ31 = &arm_cfft_sR_q31_len16; this->ifft=1; this->scaling=4; break; case TransformQ31::TEST_CFFT_Q31_11: input.reload(TransformQ31::INPUTS_CFFT_STEP_32_Q31_ID,mgr); ref.reload( TransformQ31::REF_CFFT_STEP_32_Q31_ID,mgr); instCfftQ31 = &arm_cfft_sR_q31_len32; this->ifft=0; break; case TransformQ31::TEST_CIFFT_Q31_29: input.reload(TransformQ31::INPUTS_CIFFT_STEP_32_Q31_ID,mgr); ref.reload( TransformQ31::INPUTS_CFFT_STEP_32_Q31_ID,mgr); instCfftQ31 = &arm_cfft_sR_q31_len32; this->ifft=1; this->scaling=5; break; case TransformQ31::TEST_CFFT_Q31_12: input.reload(TransformQ31::INPUTS_CFFT_STEP_64_Q31_ID,mgr); ref.reload( TransformQ31::REF_CFFT_STEP_64_Q31_ID,mgr); instCfftQ31 = &arm_cfft_sR_q31_len64; this->ifft=0; break; case TransformQ31::TEST_CIFFT_Q31_30: input.reload(TransformQ31::INPUTS_CIFFT_STEP_64_Q31_ID,mgr); ref.reload( TransformQ31::INPUTS_CFFT_STEP_64_Q31_ID,mgr); instCfftQ31 = &arm_cfft_sR_q31_len64; this->ifft=1; this->scaling=6; break; case TransformQ31::TEST_CFFT_Q31_13: input.reload(TransformQ31::INPUTS_CFFT_STEP_128_Q31_ID,mgr); ref.reload( TransformQ31::REF_CFFT_STEP_128_Q31_ID,mgr); instCfftQ31 = &arm_cfft_sR_q31_len128; this->ifft=0; break; case TransformQ31::TEST_CIFFT_Q31_31: input.reload(TransformQ31::INPUTS_CIFFT_STEP_128_Q31_ID,mgr); ref.reload( TransformQ31::INPUTS_CFFT_STEP_128_Q31_ID,mgr); instCfftQ31 = &arm_cfft_sR_q31_len128; this->ifft=1; this->scaling=7; break; case TransformQ31::TEST_CFFT_Q31_14: input.reload(TransformQ31::INPUTS_CFFT_STEP_256_Q31_ID,mgr); ref.reload( TransformQ31::REF_CFFT_STEP_256_Q31_ID,mgr); instCfftQ31 = &arm_cfft_sR_q31_len256; this->ifft=0; break; case TransformQ31::TEST_CIFFT_Q31_32: input.reload(TransformQ31::INPUTS_CIFFT_STEP_256_Q31_ID,mgr); ref.reload( TransformQ31::INPUTS_CFFT_STEP_256_Q31_ID,mgr); instCfftQ31 = &arm_cfft_sR_q31_len256; this->ifft=1; this->scaling=8; break; case TransformQ31::TEST_CFFT_Q31_15: input.reload(TransformQ31::INPUTS_CFFT_STEP_512_Q31_ID,mgr); ref.reload( TransformQ31::REF_CFFT_STEP_512_Q31_ID,mgr); instCfftQ31 = &arm_cfft_sR_q31_len512; this->ifft=0; break; case TransformQ31::TEST_CIFFT_Q31_33: input.reload(TransformQ31::INPUTS_CIFFT_STEP_512_Q31_ID,mgr); ref.reload( TransformQ31::INPUTS_CFFT_STEP_512_Q31_ID,mgr); instCfftQ31 = &arm_cfft_sR_q31_len512; this->ifft=1; this->scaling=9; break; case TransformQ31::TEST_CFFT_Q31_16: input.reload(TransformQ31::INPUTS_CFFT_STEP_1024_Q31_ID,mgr); ref.reload( TransformQ31::REF_CFFT_STEP_1024_Q31_ID,mgr); instCfftQ31 = &arm_cfft_sR_q31_len1024; this->ifft=0; break; case TransformQ31::TEST_CIFFT_Q31_34: input.reload(TransformQ31::INPUTS_CIFFT_STEP_1024_Q31_ID,mgr); ref.reload( TransformQ31::INPUTS_CFFT_STEP_1024_Q31_ID,mgr); instCfftQ31 = &arm_cfft_sR_q31_len1024; this->ifft=1; this->scaling=10; break; case TransformQ31::TEST_CFFT_Q31_17: input.reload(TransformQ31::INPUTS_CFFT_STEP_2048_Q31_ID,mgr); ref.reload( TransformQ31::REF_CFFT_STEP_2048_Q31_ID,mgr); instCfftQ31 = &arm_cfft_sR_q31_len2048; this->ifft=0; break; case TransformQ31::TEST_CIFFT_Q31_35: input.reload(TransformQ31::INPUTS_CIFFT_STEP_2048_Q31_ID,mgr); ref.reload( TransformQ31::INPUTS_CFFT_STEP_2048_Q31_ID,mgr); instCfftQ31 = &arm_cfft_sR_q31_len2048; this->ifft=1; this->scaling=11; break; case TransformQ31::TEST_CFFT_Q31_18: input.reload(TransformQ31::INPUTS_CFFT_STEP_4096_Q31_ID,mgr); ref.reload( TransformQ31::REF_CFFT_STEP_4096_Q31_ID,mgr); instCfftQ31 = &arm_cfft_sR_q31_len4096; this->ifft=0; break; case TransformQ31::TEST_CIFFT_Q31_36: input.reload(TransformQ31::INPUTS_CIFFT_STEP_4096_Q31_ID,mgr); ref.reload( TransformQ31::INPUTS_CFFT_STEP_4096_Q31_ID,mgr); instCfftQ31 = &arm_cfft_sR_q31_len4096; this->ifft=1; this->scaling=12; break; } outputfft.create(ref.nbSamples(),TransformQ31::OUTPUT_CFFT_Q31_ID,mgr); } void TransformQ31::tearDown(Testing::testID_t id,Client::PatternMgr *mgr) { outputfft.dump(mgr); }
25.530242
116
0.608229
[ "vector" ]
a7c12c6fd15da171f7685888b536c2a4805882c2
47,362
cpp
C++
MenuEngine.cpp
kortescode/Bomberman-Game
3ec59eefc25955a3057180e6771c50bbd9b4460e
[ "Apache-2.0" ]
null
null
null
MenuEngine.cpp
kortescode/Bomberman-Game
3ec59eefc25955a3057180e6771c50bbd9b4460e
[ "Apache-2.0" ]
null
null
null
MenuEngine.cpp
kortescode/Bomberman-Game
3ec59eefc25955a3057180e6771c50bbd9b4460e
[ "Apache-2.0" ]
null
null
null
#include <iostream> #include <string.h> #include <map> #include <sstream> #include "MenuEngine.hh" #include "WindowEngine.hh" #include "Common.hh" #include "Modes.hh" #include "Player.hh" MenuEngine::MenuEngine(void) : fontSize_(18), fontColor_(White), currentMenu_(Modes::Main), scoreName1_("A A A"), scoreName2_("A A A"), mapName_("A A A A A"), savesIterator_(0), mapsIterator_(0) { /* Main Menu */ this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Main, MenuEngine::Button("-- MENU --", 40, 70, 0, false, &MenuEngine::goToMenu, 0))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Main, MenuEngine::Button("Adventure Game", 40, 160, 100, true, &MenuEngine::goToMenu, Modes::Adventure))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Main, MenuEngine::Button("Free Game", 40, 200, 150, true, &MenuEngine::goToMenu, Modes::Free))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Main, MenuEngine::Button("Map Editor", 40, 240, 150, true, &MenuEngine::goToMenu, Modes::Editor))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Main, MenuEngine::Button("Scores", 40, 280, 100, true, &MenuEngine::goToMenu, Modes::Scores))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Main, MenuEngine::Button("Preferences", 40, 320, 130, true, &MenuEngine::goToMenu, Modes::Preferences))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Main, MenuEngine::Button("Quit", 40, 360, 60, true, &MenuEngine::quit, 0))); /* Scores Menu */ this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Scores, MenuEngine::Button("-- SCORES --", 40, 70, 0, false, &MenuEngine::goToMenu, 0))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Scores, MenuEngine::Button("Adventure Game", 40, 140, 0, false, &MenuEngine::goToMenu, 0))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Scores, MenuEngine::Button("1st", 70, 180, 0, false, &MenuEngine::goToMenu, 0))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Scores, MenuEngine::Button("2sd", 70, 210, 0, false, &MenuEngine::goToMenu, 0))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Scores, MenuEngine::Button("3rd", 70, 240, 0, false, &MenuEngine::goToMenu, 0))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Scores, MenuEngine::Button("Free Game", 40, 280, 0, false, &MenuEngine::goToMenu, 0))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Scores, MenuEngine::Button("1st", 70, 320, 0, false, &MenuEngine::goToMenu, 0))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Scores, MenuEngine::Button("2sd", 70, 350, 0, false, &MenuEngine::goToMenu, 0))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Scores, MenuEngine::Button("3rd", 70, 380, 0, false, &MenuEngine::goToMenu, 0))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Scores, MenuEngine::Button("Return", 40, 420, 100, true, &MenuEngine::goToMenu, Modes::Main))); /* Adventure Menu */ this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Adventure, MenuEngine::Button("-- ADVENTURE GAME --", 40, 70, 0, false, &MenuEngine::goToMenu, 0))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Adventure, MenuEngine::Button("New game", 40, 140, 130, true, &MenuEngine::launchGame, 4))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Adventure, MenuEngine::Button("Load game", 40, 180, 150, true, &MenuEngine::goToMenu, Modes::LoadSaves))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Adventure, MenuEngine::Button("Return", 40, 220, 100, true, &MenuEngine::goToMenu, Modes::Main))); /* LoadSaves Menu */ this->menusContent_.insert(MenuEngine::t_menuelem(Modes::LoadSaves, MenuEngine::Button("-- LOAD GAME --", 40, 70, 0, false, &MenuEngine::goToMenu, 0))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::LoadSaves, MenuEngine::Button("Date", 70, 140, 0, false, &MenuEngine::goToMenu, 0))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::LoadSaves, MenuEngine::Button("Stage", 300, 140, 0, false, &MenuEngine::goToMenu, 0))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::LoadSaves, MenuEngine::Button("Score", 380, 140, 0, false, &MenuEngine::goToMenu, 0))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::LoadSaves, MenuEngine::Button("[<]", 30, 270, 20, true, &MenuEngine::changeSavesIterator, -8))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::LoadSaves, MenuEngine::Button("[>]", 570, 270, 20, true, &MenuEngine::changeSavesIterator, 8))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::LoadSaves, MenuEngine::Button(" ", 480, 180, 70, true, &MenuEngine::loadGame, 0))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::LoadSaves, MenuEngine::Button(" ", 480, 210, 70, true, &MenuEngine::loadGame, 1))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::LoadSaves, MenuEngine::Button(" ", 480, 240, 70, true, &MenuEngine::loadGame, 2))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::LoadSaves, MenuEngine::Button(" ", 480, 270, 70, true, &MenuEngine::loadGame, 3))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::LoadSaves, MenuEngine::Button(" ", 480, 300, 70, true, &MenuEngine::loadGame, 4))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::LoadSaves, MenuEngine::Button(" ", 480, 330, 70, true, &MenuEngine::loadGame, 5))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::LoadSaves, MenuEngine::Button(" ", 480, 360, 70, true, &MenuEngine::loadGame, 6))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::LoadSaves, MenuEngine::Button(" ", 480, 390, 70, true, &MenuEngine::loadGame, 7))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::LoadSaves, MenuEngine::Button("Return", 40, 430, 100, true, &MenuEngine::goToMenu, Modes::Adventure))); /* LoadMaps Menu */ this->menusContent_.insert(MenuEngine::t_menuelem(Modes::LoadMaps, MenuEngine::Button("-- LOAD MAP --", 40, 70, 0, false, &MenuEngine::goToMenu, 0))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::LoadMaps, MenuEngine::Button("Gamers", 40, 140, 0, false, &MenuEngine::goToMenu, 0))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::LoadMaps, MenuEngine::Button("[-]", 200, 140, 20, true, &MenuEngine::creasePlayers, 2))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::LoadMaps, MenuEngine::Button("[+]", 270, 140, 20, true, &MenuEngine::creasePlayers, 1))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::LoadMaps, MenuEngine::Button("Enemies", 40, 170, 0, false, &MenuEngine::goToMenu, 0))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::LoadMaps, MenuEngine::Button("[-]", 200, 170, 20, true, &MenuEngine::creaseEnemies, 2))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::LoadMaps, MenuEngine::Button("[+]", 270, 170, 20, true, &MenuEngine::creaseEnemies, 1))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::LoadMaps, MenuEngine::Button("Map", 40, 200, 0, false, &MenuEngine::goToMenu, 0))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::LoadMaps, MenuEngine::Button("Name", 70, 230, 0, false, &MenuEngine::goToMenu, 0))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::LoadMaps, MenuEngine::Button("Width", 200, 230, 0, false, &MenuEngine::goToMenu, 0))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::LoadMaps, MenuEngine::Button("Height", 280, 230, 0, false, &MenuEngine::goToMenu, 0))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::LoadMaps, MenuEngine::Button("[<]", 30, 345, 20, true, &MenuEngine::changeMapsIterator, -6))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::LoadMaps, MenuEngine::Button("[>]", 470, 345, 20, true, &MenuEngine::changeMapsIterator, 6))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::LoadMaps, MenuEngine::Button(" ", 380, 270, 70, true, &MenuEngine::loadMap, 0))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::LoadMaps, MenuEngine::Button(" ", 380, 300, 70, true, &MenuEngine::loadMap, 1))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::LoadMaps, MenuEngine::Button(" ", 380, 330, 70, true, &MenuEngine::loadMap, 2))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::LoadMaps, MenuEngine::Button(" ", 380, 360, 70, true, &MenuEngine::loadMap, 3))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::LoadMaps, MenuEngine::Button(" ", 380, 390, 70, true, &MenuEngine::loadMap, 4))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::LoadMaps, MenuEngine::Button(" ", 380, 420, 70, true, &MenuEngine::loadMap, 5))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::LoadMaps, MenuEngine::Button("Return", 40, 460, 100, true, &MenuEngine::goToMenu, Modes::Free))); /* Free Menu */ this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Free, MenuEngine::Button("-- FREE GAME --", 40, 70, 0, false, &MenuEngine::goToMenu, 0))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Free, MenuEngine::Button("Default game", 40, 140, 100, true, &MenuEngine::launchGame, 1))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Free, MenuEngine::Button("Configurable game", 40, 180, 150, true, &MenuEngine::goToMenu, Modes::Config))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Free, MenuEngine::Button("Random game", 40, 220, 120, true, &MenuEngine::launchGame, 2))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Free, MenuEngine::Button("Load map", 40, 260, 100, true, &MenuEngine::goToMenu, Modes::LoadMaps))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Free, MenuEngine::Button("Return", 40, 300, 100, true, &MenuEngine::goToMenu, Modes::Main))); /* Editor Menu */ this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Editor, MenuEngine::Button("-- MAP EDITOR --", 40, 70, 0, false, &MenuEngine::goToMenu, 0))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Editor, MenuEngine::Button("Map width", 40, 140, 0, false, &MenuEngine::goToMenu, 0))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Editor, MenuEngine::Button("[-]", 200, 140, 20, true, &MenuEngine::creaseMapWidth, 2))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Editor, MenuEngine::Button("[+]", 270, 140, 20, true, &MenuEngine::creaseMapWidth, 1))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Editor, MenuEngine::Button("Map height", 40, 180, 0, false, &MenuEngine::goToMenu, 0))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Editor, MenuEngine::Button("[-]", 200, 180, 20, true, &MenuEngine::creaseMapHeight, 2))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Editor, MenuEngine::Button("[+]", 270, 180, 20, true, &MenuEngine::creaseMapHeight, 1))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Editor, MenuEngine::Button("Launch editor", 40, 220, 100, true, &MenuEngine::launchGame, 5))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Editor, MenuEngine::Button("Return", 40, 260, 100, true, &MenuEngine::goToMenu, Modes::Main))); /* Config Menu */ this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Config, MenuEngine::Button("-- CONFIGURABLE GAME --", 40, 70, 0, false, &MenuEngine::goToMenu, 0))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Config, MenuEngine::Button("Map width", 40, 140, 0, false, &MenuEngine::goToMenu, 0))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Config, MenuEngine::Button("[-]", 200, 140, 20, true, &MenuEngine::creaseMapWidth, 2))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Config, MenuEngine::Button("[+]", 270, 140, 20, true, &MenuEngine::creaseMapWidth, 1))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Config, MenuEngine::Button("Map height", 40, 170, 0, false, &MenuEngine::goToMenu, 0))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Config, MenuEngine::Button("[-]", 200, 170, 20, true, &MenuEngine::creaseMapHeight, 2))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Config, MenuEngine::Button("[+]", 270, 170, 20, true, &MenuEngine::creaseMapHeight, 1))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Config, MenuEngine::Button("Gamers", 40, 210, 0, false, &MenuEngine::goToMenu, 0))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Config, MenuEngine::Button("[-]", 200, 210, 20, true, &MenuEngine::creasePlayers, 2))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Config, MenuEngine::Button("[+]", 270, 210, 20, true, &MenuEngine::creasePlayers, 1))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Config, MenuEngine::Button("Enemies", 40, 240, 0, false, &MenuEngine::goToMenu, 0))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Config, MenuEngine::Button("[-]", 200, 240, 20, true, &MenuEngine::creaseEnemies, 2))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Config, MenuEngine::Button("[+]", 270, 240, 20, true, &MenuEngine::creaseEnemies, 1))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Config, MenuEngine::Button("Box percent", 40, 280, 0, false, &MenuEngine::goToMenu, 0))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Config, MenuEngine::Button("[-]", 200, 280, 20, true, &MenuEngine::creaseBoxPercent, 2))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Config, MenuEngine::Button("[+]", 270, 280, 20, true, &MenuEngine::creaseBoxPercent, 1))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Config, MenuEngine::Button("Launch game", 40, 320, 100, true, &MenuEngine::launchGame, 3))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Config, MenuEngine::Button("Return", 40, 360, 100, true, &MenuEngine::goToMenu, Modes::Free))); /* Preferences Menu */ this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Preferences, MenuEngine::Button("-- PREFERENCES --", 40, 70, 0, false, &MenuEngine::goToMenu, 0))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Preferences, MenuEngine::Button("Game", 40, 140, 0, false, &MenuEngine::goToMenu, 0))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Preferences, MenuEngine::Button("Video mode", 60, 170, 0, false, &MenuEngine::goToMenu, 0))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Preferences, MenuEngine::Button("2D", 180, 170, 0, false, &MenuEngine::goToMenu, 0))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Preferences, MenuEngine::Button("[ ]", 210, 170, 20, true, &MenuEngine::changeDimensionMode, 2))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Preferences, MenuEngine::Button("3D", 250, 170, 0, false, &MenuEngine::goToMenu, 0))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Preferences, MenuEngine::Button("[ ]", 280, 170, 20, true, &MenuEngine::changeDimensionMode, 3))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Preferences, MenuEngine::Button("Music", 60, 200, 0, false, &MenuEngine::goToMenu, 0))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Preferences, MenuEngine::Button("On", 180, 200, 0, false, &MenuEngine::goToMenu, 0))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Preferences, MenuEngine::Button("[ ]", 210, 200, 20, true, &MenuEngine::changeMusic, 1))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Preferences, MenuEngine::Button("Off", 250, 200, 0, false, &MenuEngine::goToMenu, 0))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Preferences, MenuEngine::Button("[ ]", 280, 200, 20, true, &MenuEngine::changeMusic, 0))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Preferences, MenuEngine::Button("Volume", 320, 200, 0, false, &MenuEngine::goToMenu, 0))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Preferences, MenuEngine::Button("[-]", 390, 200, 20, true, &MenuEngine::creaseMusicVolume, 2))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Preferences, MenuEngine::Button("[+]", 450, 200, 20, true, &MenuEngine::creaseMusicVolume, 1))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Preferences, MenuEngine::Button("Sound", 60, 230, 0, false, &MenuEngine::goToMenu, 0))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Preferences, MenuEngine::Button("On", 180, 230, 0, false, &MenuEngine::goToMenu, 0))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Preferences, MenuEngine::Button("[ ]", 210, 230, 20, true, &MenuEngine::changeSound, 1))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Preferences, MenuEngine::Button("Off", 250, 230, 0, false, &MenuEngine::goToMenu, 0))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Preferences, MenuEngine::Button("[ ]", 280, 230, 20, true, &MenuEngine::changeSound, 0))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Preferences, MenuEngine::Button("Volume", 320, 230, 0, false, &MenuEngine::goToMenu, 0))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Preferences, MenuEngine::Button("[-]", 390, 230, 20, true, &MenuEngine::creaseSoundVolume, 2))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Preferences, MenuEngine::Button("[+]", 450, 230, 20, true, &MenuEngine::creaseSoundVolume, 1))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Preferences, MenuEngine::Button("Control", 40, 270, 0, false, &MenuEngine::goToMenu, 0))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Preferences, MenuEngine::Button("General", 60, 300, 0, false, &MenuEngine::goToMenu, 0))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Preferences, MenuEngine::Button("Pause", 180, 300, 0, false, &MenuEngine::goToMenu, 0))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Preferences, MenuEngine::Button("[ ]", 250, 300, 100, true, &MenuEngine::changePause, 0))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Preferences, MenuEngine::Button("Camera", 60, 330, 0, false, &MenuEngine::goToMenu, 0))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Preferences, MenuEngine::Button("Up", 180, 330, 0, false, &MenuEngine::goToMenu, 0))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Preferences, MenuEngine::Button("[ ]", 250, 330, 100, true, &MenuEngine::changeUpCamera, 0))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Preferences, MenuEngine::Button("Down", 360, 330, 0, false, &MenuEngine::goToMenu, 0))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Preferences, MenuEngine::Button("[ ]", 430, 330, 100, true, &MenuEngine::changeDownCamera, 0))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Preferences, MenuEngine::Button("Gamer 1", 60, 360, 0, false, &MenuEngine::goToMenu, 0))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Preferences, MenuEngine::Button("Up", 180, 360, 0, false, &MenuEngine::goToMenu, 0))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Preferences, MenuEngine::Button("[ ]", 250, 360, 100, true, &MenuEngine::changeUpGamer, 1))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Preferences, MenuEngine::Button("Left", 360, 360, 0, false, &MenuEngine::goToMenu, 0))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Preferences, MenuEngine::Button("[ ]", 430, 360, 100, true, &MenuEngine::changeLeftGamer, 1))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Preferences, MenuEngine::Button("Bomb", 540, 360, 0, false, &MenuEngine::goToMenu, 0))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Preferences, MenuEngine::Button("[ ]", 610, 360, 100, true, &MenuEngine::changeBombGamer, 1))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Preferences, MenuEngine::Button("Down", 180, 390, 0, false, &MenuEngine::goToMenu, 0))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Preferences, MenuEngine::Button("[ ]", 250, 390, 100, true, &MenuEngine::changeDownGamer, 1))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Preferences, MenuEngine::Button("Right", 360, 390, 0, false, &MenuEngine::goToMenu, 0))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Preferences, MenuEngine::Button("[ ]", 430, 390, 100, true, &MenuEngine::changeRightGamer, 1))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Preferences, MenuEngine::Button("Ctrl", 540, 390, 0, false, &MenuEngine::goToMenu, 0))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Preferences, MenuEngine::Button("[ ]", 610, 390, 100, true, &MenuEngine::changeCtrlGamer, 1))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Preferences, MenuEngine::Button("Gamer 2", 60, 420, 0, false, &MenuEngine::goToMenu, 0))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Preferences, MenuEngine::Button("Up", 180, 420, 0, false, &MenuEngine::goToMenu, 0))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Preferences, MenuEngine::Button("[ ]", 250, 420, 100, true, &MenuEngine::changeUpGamer, 2))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Preferences, MenuEngine::Button("Left", 360, 420, 0, false, &MenuEngine::goToMenu, 0))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Preferences, MenuEngine::Button("[ ]", 430, 420, 100, true, &MenuEngine::changeLeftGamer, 2))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Preferences, MenuEngine::Button("Bomb", 540, 420, 0, false, &MenuEngine::goToMenu, 0))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Preferences, MenuEngine::Button("[ ]", 610, 420, 100, true, &MenuEngine::changeBombGamer, 2))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Preferences, MenuEngine::Button("Down", 180, 450, 0, false, &MenuEngine::goToMenu, 0))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Preferences, MenuEngine::Button("[ ]", 250, 450, 100, true, &MenuEngine::changeDownGamer, 2))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Preferences, MenuEngine::Button("Right", 360, 450, 0, false, &MenuEngine::goToMenu, 0))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Preferences, MenuEngine::Button("[ ]", 430, 450, 100, true, &MenuEngine::changeRightGamer, 2))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Preferences, MenuEngine::Button("Ctrl", 540, 450, 0, false, &MenuEngine::goToMenu, 0))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Preferences, MenuEngine::Button("[ ]", 610, 450, 100, true, &MenuEngine::changeCtrlGamer, 2))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Preferences, MenuEngine::Button("Return", 40, 480, 70, true, &MenuEngine::goToMenu, Modes::Main))); /* PauseAdventure Menu */ this->menusContent_.insert(MenuEngine::t_menuelem(Modes::PauseAdventure, MenuEngine::Button("-- PAUSE --", 40, 70, 0, false, &MenuEngine::goToMenu, 0))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::PauseAdventure, MenuEngine::Button("Save game", 40, 140, 100, true, &MenuEngine::saveGame, 0))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::PauseAdventure, MenuEngine::Button("Resume game", 40, 180, 150, true, &MenuEngine::launchGame, 0))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::PauseAdventure, MenuEngine::Button("Quit game", 40, 220, 120, true, &MenuEngine::goToMenu, Modes::Main))); /* PauseEditor Menu */ this->menusContent_.insert(MenuEngine::t_menuelem(Modes::PauseEditor, MenuEngine::Button("-- PAUSE --", 40, 70, 0, false, &MenuEngine::goToMenu, 0))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::PauseEditor, MenuEngine::Button("Save map", 40, 140, 85, true, &MenuEngine::saveMap, 0))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::PauseEditor, MenuEngine::Button("as", 140, 140, 0, false, &MenuEngine::goToMenu, 0))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::PauseEditor, MenuEngine::Button(" ", 180, 140, 15, true, &MenuEngine::creaseMapName, 0))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::PauseEditor, MenuEngine::Button(" ", 197, 140, 15, true, &MenuEngine::creaseMapName, 2))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::PauseEditor, MenuEngine::Button(" ", 214, 140, 15, true, &MenuEngine::creaseMapName, 4))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::PauseEditor, MenuEngine::Button(" ", 231, 140, 15, true, &MenuEngine::creaseMapName, 6))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::PauseEditor, MenuEngine::Button(" ", 248, 140, 15, true, &MenuEngine::creaseMapName, 8))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::PauseEditor, MenuEngine::Button("Resume editor", 40, 180, 150, true, &MenuEngine::launchGame, 0))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::PauseEditor, MenuEngine::Button("Quit editor", 40, 220, 120, true, &MenuEngine::goToMenu, Modes::Main))); /* PauseFree Menu */ this->menusContent_.insert(MenuEngine::t_menuelem(Modes::PauseFree, MenuEngine::Button("-- PAUSE --", 40, 70, 0, false, &MenuEngine::goToMenu, 0))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::PauseFree, MenuEngine::Button("Resume game", 40, 140, 150, true, &MenuEngine::launchGame, 0))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::PauseFree, MenuEngine::Button("Quit game", 40, 180, 120, true, &MenuEngine::goToMenu, Modes::Main))); /* Win Menu */ this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Win, MenuEngine::Button("-- GAME OVER --", 40, 70, 0, false, &MenuEngine::goToMenu, 0))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Win, MenuEngine::Button("Score", 70, 180, 0, false, &MenuEngine::goToMenu, 0))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Win, MenuEngine::Button("Name", 70, 220, 0, false, &MenuEngine::goToMenu, 0))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Win, MenuEngine::Button(" ", 150, 220, 15, true, &MenuEngine::creaseScoreName, 0))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Win, MenuEngine::Button(" ", 167, 220, 15, true, &MenuEngine::creaseScoreName, 2))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Win, MenuEngine::Button(" ", 183, 220, 15, true, &MenuEngine::creaseScoreName, 4))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Win, MenuEngine::Button(" ", 150, 340, 15, true, &MenuEngine::creaseScoreName, 5))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Win, MenuEngine::Button(" ", 167, 340, 15, true, &MenuEngine::creaseScoreName, 7))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Win, MenuEngine::Button(" ", 183, 340, 15, true, &MenuEngine::creaseScoreName, 9))); this->menusContent_.insert(MenuEngine::t_menuelem(Modes::Win, MenuEngine::Button("Save", 40, 380, 80, true, &MenuEngine::saveScore, 0))); } MenuEngine::~MenuEngine(void) { this->menusContent_.clear(); } MenuEngine::Button::Button(const std::string& text, const int x, const int y, const int width, const bool interactive, Modes::Mode (MenuEngine::*fct)(int), int arg) : text_(text), x_(x), y_(y), width_(width), interactive_(interactive), fct_(fct), arg_(arg) { } MenuEngine::Button::Button(const MenuEngine::Button& other) : text_(other.text_), x_(other.x_), y_(other.y_), width_(other.width_), interactive_(other.interactive_), fct_(other.fct_), arg_(other.arg_) { } MenuEngine::Button::~Button(void) { } /************************** ***** Menu navigation ***** **************************/ void MenuEngine::switchPause(void) { if (this->ModeGame == Modes::NextStage) this->currentMenu_ = Modes::Stage; else if (this->ModeGame == Modes::EditorGame) this->currentMenu_ = Modes::PauseEditor; else { if ((this->player1->getStatus() == Model::NONE && this->getPlayers() == 1) || (this->player1->getStatus() == Model::NONE && this->player2->getStatus() == Model::NONE && this->getPlayers() == 2)) this->currentMenu_ = (this->ModeGame == Modes::FreeGame) ? Modes::PauseFree : Modes::PauseAdventure; else this->currentMenu_ = Modes::Win; } } Modes::Mode MenuEngine::goToMenu(int menu) { if (menu == Modes::Config || menu == Modes::LoadMaps || menu == Modes::Editor) this->setDefaultConfig(); if (menu != 0) this->currentMenu_ = static_cast<Modes::ModeMenu>(menu); return (Modes::Menu); } Modes::Mode MenuEngine::launchGame(int game) { if (game == 1) { this->setDefaultConfig(); this->ModeGame = Modes::FreeGame; } else if (game == 2) { this->setRandomConfig(); this->ModeGame = Modes::FreeGame; } else if (game == 3) this->ModeGame = Modes::FreeGame; else if (game == 4) { this->setTotalScore(0); this->initStage(); this->setAdventureConfig(); this->ModeGame = Modes::AdventureGame; } else if (game == 5) { this->setEditorConfig(); this->ModeGame = Modes::EditorGame; } if (game != 0) this->setConfig(); this->currentMenu_ = Modes::SwitchPause; return (Modes::Game); } Modes::Mode MenuEngine::loadGame(int nbr) { const std::multimap<time_t, const XmlEngine::Save>& saves = this->xml.getSaves(); std::multimap<time_t, const XmlEngine::Save>::const_reverse_iterator it = saves.rbegin(); for (int count = 0; count < this->savesIterator_ + nbr && it != saves.rend(); count++) ++it; if (it != saves.rend()) { this->setStage(it->second.stage); this->setAdventureConfig(); this->ModeGame = Modes::AdventureGame; this->setConfig(); this->setTotalScore(it->second.score); this->currentMenu_ = Modes::SwitchPause; return (Modes::Game); } return (Modes::Menu); } Modes::Mode MenuEngine::loadMap(int nbr) { const std::multimap<const std::string, const XmlEngine::Map>& maps = this->xml.getMaps(); std::multimap<const std::string, const XmlEngine::Map>::const_iterator it = maps.begin(); for (int count = 0; count < this->mapsIterator_ + nbr && it != maps.end(); count++) ++it; if (it != maps.end()) { this->setLoadMapConfig(it->second.width, it->second.height); this->ModeGame = Modes::FreeGame; this->setConfig(); // a revoir car gamer peuvent apparaitre sur box (normal car set box d'en-dessous est apres this->setConfig()) for (unsigned int i = 0; i < it->second.boxes.size(); i++) { Map::Box *box = new Map::Box(this, this->texture_Box); Case currentCase = this->map.getCase(it->second.boxes[i].x, it->second.boxes[i].z); box->setX(currentCase.getXmin()); box->setZ(currentCase.getYmin()); box->initialize(); this->listBoxes.push_back(box); this->map.addBox(it->second.boxes[i].x, it->second.boxes[i].z); } this->currentMenu_ = Modes::SwitchPause; return (Modes::Game); } return (Modes::Menu); } Modes::Mode MenuEngine::quit(int) { return (Modes::Quit); } /*************************** ***** Var modification ***** ***************************/ Modes::Mode MenuEngine::creaseMusicVolume(int mode) { int volume = this->getMusicVolume(); volume += (mode == 1) ? 1 : -1; if ((mode == 1 && volume <= AudioEngine::MaxVolume) || (mode == 2 && volume >= AudioEngine::MinVolume)) this->setMusicVolume(volume); return (Modes::Menu); } Modes::Mode MenuEngine::creaseSoundVolume(int mode) { int volume = this->getSoundVolume(); volume += (mode == 1) ? 1 : -1; if ((mode == 1 && volume <= AudioEngine::MaxVolume) || (mode == 2 && volume >= AudioEngine::MinVolume)) this->setSoundVolume(volume); return (Modes::Menu); } Modes::Mode MenuEngine::creaseMapWidth(int mode) { int width = this->getMapWidth(); width += (mode == 1) ? 1 : -1; if (mode == 1 || (mode == 2 && width >= ConfigEngine::MinMapWidth)) this->setMapWidth(width); return (Modes::Menu); } Modes::Mode MenuEngine::creaseMapHeight(int mode) { int height = this->getMapHeight(); height += (mode == 1) ? 1 : -1; if (mode == 1 || (mode == 2 && height >= ConfigEngine::MinMapHeight)) this->setMapHeight(height); return (Modes::Menu); } Modes::Mode MenuEngine::creasePlayers(int mode) { int players = this->getPlayers(); players += (mode == 1) ? 1 : -1; if ((mode == 1 && players <= ConfigEngine::MaxPlayers) || (mode == 2 && players >= ConfigEngine::MinPlayers)) this->setPlayers(players); return (Modes::Menu); } Modes::Mode MenuEngine::creaseEnemies(int mode) { int enemies = this->getEnemies(); enemies += (mode == 1) ? 1 : -1; if (mode == 1 || (mode == 2 && enemies >= ConfigEngine::MinEnemies)) this->setEnemies(enemies); return (Modes::Menu); } Modes::Mode MenuEngine::creaseBoxPercent(int mode) { int boxPercent = this->getBoxPercent(); boxPercent += (mode == 1) ? 1 : -1; if ((mode == 1 && boxPercent <= ConfigEngine::MaxBoxPercent) || (mode == 2 && boxPercent >= ConfigEngine::MinBoxPercent)) this->setBoxPercent(boxPercent); return (Modes::Menu); } Modes::Mode MenuEngine::creaseScoreName(int i) { static int tmp = -1; int pos = (i < 5) ? i : i - 5; std::string& name = (i < 5) ? this->scoreName1_ : this->scoreName2_; if (tmp == i) { if (++name[pos] > 'Z') name[pos] = '0'; else if (name[pos] < 'A' && name[pos] > '9') name[pos] = 'A'; tmp = -1; } else tmp = i; return (Modes::Menu); } Modes::Mode MenuEngine::creaseMapName(int pos) { static int tmp = -1; if (tmp == pos) { if (++this->mapName_[pos] > 'Z') this->mapName_[pos] = '0'; else if (this->mapName_[pos] < 'A' && this->mapName_[pos] > '9') this->mapName_[pos] = 'A'; tmp = -1; } else tmp = pos; return (Modes::Menu); } Modes::Mode MenuEngine::changeDimensionMode(int dim) { if (dim == 2) this->setGameMode(WindowEngine::TWOD); else if (dim == 3) this->setGameMode(WindowEngine::TREED); return (Modes::Menu); } Modes::Mode MenuEngine::changeMusic(int status) { this->setMusicStatus(static_cast<bool>(status)); return (Modes::Menu); } Modes::Mode MenuEngine::changeSound(int status) { this->setSoundStatus(static_cast<bool>(status)); return (Modes::Menu); } Modes::Mode MenuEngine::changeUpGamer(int gamer) { if (gamer == 1) this->changeEvent(InputEngine::UpGamer1); else if (gamer == 2) this->changeEvent(InputEngine::UpGamer2); return (Modes::Menu); } Modes::Mode MenuEngine::changeDownGamer(int gamer) { if (gamer == 1) this->changeEvent(InputEngine::DownGamer1); else if (gamer == 2) this->changeEvent(InputEngine::DownGamer2); return (Modes::Menu); } Modes::Mode MenuEngine::changeLeftGamer(int gamer) { if (gamer == 1) this->changeEvent(InputEngine::LeftGamer1); else if (gamer == 2) this->changeEvent(InputEngine::LeftGamer2); return (Modes::Menu); } Modes::Mode MenuEngine::changeRightGamer(int gamer) { if (gamer == 1) this->changeEvent(InputEngine::RightGamer1); else if (gamer == 2) this->changeEvent(InputEngine::RightGamer2); return (Modes::Menu); } Modes::Mode MenuEngine::changeBombGamer(int gamer) { if (gamer == 1) this->changeEvent(InputEngine::BombGamer1); else if (gamer == 2) this->changeEvent(InputEngine::BombGamer2); return (Modes::Menu); } Modes::Mode MenuEngine::changeCtrlGamer(int gamer) { if (gamer == 1) this->changeEvent(InputEngine::CtrlGamer1); else if (gamer == 2) this->changeEvent(InputEngine::CtrlGamer2); return (Modes::Menu); } Modes::Mode MenuEngine::changeUpCamera(int) { this->changeEvent(InputEngine::UpCamera); return (Modes::Menu); } Modes::Mode MenuEngine::changeDownCamera(int) { this->changeEvent(InputEngine::DownCamera); return (Modes::Menu); } Modes::Mode MenuEngine::changeSavesIterator(int diff) { if (diff < 0 && (this->savesIterator_ + diff) >= 0) this->savesIterator_ += diff; else if (diff > 0) { const std::multimap<time_t, const XmlEngine::Save>& saves = this->xml.getSaves(); if ((this->savesIterator_ + diff) < static_cast<int>(saves.size())) this->savesIterator_ += diff; } return (Modes::Menu); } Modes::Mode MenuEngine::changeMapsIterator(int diff) { if (diff < 0 && (this->mapsIterator_ + diff) >= 0) this->savesIterator_ += diff; else if (diff > 0) { const std::multimap<const std::string, const XmlEngine::Map>& maps = this->xml.getMaps(); if ((this->mapsIterator_ + diff) < static_cast<int>(maps.size())) this->mapsIterator_ += diff; } return (Modes::Menu); } Modes::Mode MenuEngine::changePause(int) { this->changeEvent(InputEngine::Pause); return (Modes::Menu); } Modes::Mode MenuEngine::saveScore(int) { if (this->ModeGame == Modes::AdventureGame) this->xml.saveScore(this->scoreName1_, this->getTotalScore()); else { this->xml.saveScore(this->scoreName1_, this->player1->getScore()); if (this->getPlayers() == 2) this->xml.saveScore(this->scoreName2_, this->player2->getScore()); } this->currentMenu_ = Modes::Main; return (Modes::Menu); } Modes::Mode MenuEngine::saveGame(int) { this->xml.saveGame(); this->currentMenu_ = Modes::Main; return (Modes::Menu); } Modes::Mode MenuEngine::saveMap(int) { this->xml.saveMap(this->mapName_); this->currentMenu_ = Modes::Main; return (Modes::Menu); } /***************** ***** Update ***** *****************/ Modes::Mode MenuEngine::updateStage(void) { if (this->isClicked(0, this->getWidthAdapt(800), 0, this->getHeightAdapt(600))) { this->ModeGame = Modes::AdventureGame; this->currentMenu_ = Modes::SwitchPause; return (Modes::Game); } return (Modes::Menu); } Modes::Mode MenuEngine::updateMenu(void) { if (this->currentMenu_ == Modes::SwitchPause) this->switchPause(); else if (this->currentMenu_ == Modes::Stage) return (this->updateStage()); else { MenuEngine::t_menumap::iterator it = this->menusContent_.begin(); for (; it != this->menusContent_.end(); ++it) if (this->currentMenu_ == it->first && it->second.interactive_ && this->isClicked(this->getWidthAdapt(it->second.x_), this->getWidthAdapt(it->second.x_ + it->second.width_), this->getHeightAdapt(it->second.y_), this->getHeightAdapt(it->second.y_ + this->fontSize_))) return ((this->*it->second.fct_)(it->second.arg_)); } return (Modes::Menu); } /*************** ***** Draw ***** ***************/ void MenuEngine::drawConfig(void) const { this->displayText(Common::stringOfNbr<int>(this->getMapWidth()), White, this->fontSize_, 235, 140); this->displayText(Common::stringOfNbr<int>(this->getMapHeight()), White, this->fontSize_, 235, 170); this->displayText(Common::stringOfNbr<int>(this->getPlayers()), White, this->fontSize_, 235, 210); this->displayText(Common::stringOfNbr<int>(this->getEnemies()), White, this->fontSize_, 235, 240); this->displayText(Common::stringOfNbr<int>(this->getBoxPercent()), White, this->fontSize_, 235, 280); } void MenuEngine::drawLoadSaves(void) const { const std::multimap<time_t, const XmlEngine::Save>& saves = this->xml.getSaves(); std::multimap<time_t, const XmlEngine::Save>::const_reverse_iterator it = saves.rbegin(); for (int y = 180, nbr = 0, count = 0; it != saves.rend() && count < 8; ++it, nbr++) if (nbr >= this->savesIterator_) { this->displayText(ctime(&it->first), White, this->fontSize_, 70, y); this->displayText(Common::stringOfNbr<int>(it->second.stage), White, this->fontSize_, 300, y); this->displayText(Common::stringOfNbr<int>(it->second.score), White, this->fontSize_, 380, y); this->displayText("[Launch]", White, this->fontSize_, 480, y); y += 30; ++count; } } void MenuEngine::drawLoadMaps(void) const { const std::multimap<const std::string, const XmlEngine::Map>& maps = this->xml.getMaps(); std::multimap<const std::string, const XmlEngine::Map>::const_iterator it = maps.begin(); this->displayText(Common::stringOfNbr<int>(this->getPlayers()), White, this->fontSize_, 235, 140); this->displayText(Common::stringOfNbr<int>(this->getEnemies()), White, this->fontSize_, 235, 170); for (int y = 270, nbr = 0, count = 0; it != maps.end() && count < 6; ++it, nbr++) if (nbr >= this->mapsIterator_) { this->displayText(it->first, White, this->fontSize_, 70, y); this->displayText(Common::stringOfNbr<int>(it->second.width), White, this->fontSize_, 200, y); this->displayText(Common::stringOfNbr<int>(it->second.height), White, this->fontSize_, 280, y); this->displayText("[Launch]", White, this->fontSize_, 380, y); y += 30; ++count; } } void MenuEngine::drawScores(void) { const std::multimap<int, const std::string>& scores1 = this->xml.getScores(Modes::AdventureGame); const std::multimap<int, const std::string>& scores2 = this->xml.getScores(Modes::FreeGame); std::multimap<int, const std::string>::const_reverse_iterator it1 = scores1.rbegin(); std::multimap<int, const std::string>::const_reverse_iterator it2 = scores2.rbegin(); for (int y = 180; y < 270 && it1 != scores1.rend(); ++it1, y += 30) { this->displayText(it1->second, White, this->fontSize_, 120, y); this->displayText(Common::stringOfNbr<int>(it1->first), White, this->fontSize_, 180, y); } for (int y = 320; y < 410 && it2 != scores2.rend(); ++it2, y += 30) { this->displayText(it2->second, White, this->fontSize_, 120, y); this->displayText(Common::stringOfNbr<int>(it2->first), White, this->fontSize_, 180, y); } } void MenuEngine::drawWin(void) const { if (this->getPlayers() == 1) this->displayText("You", White, this->fontSize_, 40, 140); else this->displayText("Gamer1", White, this->fontSize_, 40, 140); if (this->player1->getStatus() == Model::WIN) this->displayText("Win !", White, this->fontSize_, 115, 140); else if (this->player1->getStatus() == Model::LOOSE) this->displayText("Lose !", White, this->fontSize_, 115, 140); if (this->ModeGame == Modes::AdventureGame) this->displayText(Common::stringOfNbr<int>(this->getTotalScore()), White, this->fontSize_, 150, 180); else this->displayText(Common::stringOfNbr<int>(this->player1->getScore()), White, this->fontSize_, 150, 180); this->displayText(this->scoreName1_, White, this->fontSize_, 150, 220); if (this->getPlayers() == 2) { this->displayText("Gamer2", White, this->fontSize_, 40, 260); if (this->player2->getStatus() == Model::WIN) this->displayText("Win !", White, this->fontSize_, 115, 260); else if (this->player2->getStatus() == Model::LOOSE) this->displayText("Lose !", White, this->fontSize_, 115, 260); this->displayText("Score", White, this->fontSize_, 70, 300); this->displayText("Name", White, this->fontSize_, 70, 340); this->displayText(Common::stringOfNbr<int>(this->player2->getScore()), White, this->fontSize_, 150, 300); this->displayText(this->scoreName2_, White, this->fontSize_, 150, 340); } } void MenuEngine::drawPreferences(void) const { this->displayText("x", White, this->fontSize_, ((this->getGameMode() == WindowEngine::TWOD) ? 213 : 283), 170); this->displayText("x", White, this->fontSize_, ((this->getMusicStatus()) ? 213 : 283), 200); this->displayText(Common::stringOfNbr<int>(this->getMusicVolume()), White, this->fontSize_, 413, 200); this->displayText("x", White, this->fontSize_, ((this->getSoundStatus()) ? 213 : 283), 230); this->displayText(Common::stringOfNbr<int>(this->getSoundVolume()), White, this->fontSize_, 413, 230); this->displayText(this->getStringKeyOfEvent(InputEngine::Pause), White, this->fontSize_, 257, 300); this->displayText(this->getStringKeyOfEvent(InputEngine::UpCamera), White, this->fontSize_, 257, 330); this->displayText(this->getStringKeyOfEvent(InputEngine::DownCamera), White, this->fontSize_, 437, 330); this->displayText(this->getStringKeyOfEvent(InputEngine::UpGamer1), White, this->fontSize_, 257, 360); this->displayText(this->getStringKeyOfEvent(InputEngine::LeftGamer1), White, this->fontSize_, 437, 360); this->displayText(this->getStringKeyOfEvent(InputEngine::BombGamer1), White, this->fontSize_, 617, 360); this->displayText(this->getStringKeyOfEvent(InputEngine::DownGamer1), White, this->fontSize_, 257, 390); this->displayText(this->getStringKeyOfEvent(InputEngine::RightGamer1), White, this->fontSize_, 437, 390); this->displayText(this->getStringKeyOfEvent(InputEngine::CtrlGamer1), White, this->fontSize_, 617, 390); this->displayText(this->getStringKeyOfEvent(InputEngine::UpGamer2), White, this->fontSize_, 257, 420); this->displayText(this->getStringKeyOfEvent(InputEngine::LeftGamer2), White, this->fontSize_, 437, 420); this->displayText(this->getStringKeyOfEvent(InputEngine::BombGamer2), White, this->fontSize_, 617, 420); this->displayText(this->getStringKeyOfEvent(InputEngine::DownGamer2), White, this->fontSize_, 257, 450); this->displayText(this->getStringKeyOfEvent(InputEngine::RightGamer2), White, this->fontSize_, 437, 450); this->displayText(this->getStringKeyOfEvent(InputEngine::CtrlGamer2), White, this->fontSize_, 617, 450); } void MenuEngine::drawEditor(void) const { this->displayText(Common::stringOfNbr<int>(this->getMapWidth()), White, this->fontSize_, 235, 140); this->displayText(Common::stringOfNbr<int>(this->getMapHeight()), White, this->fontSize_, 235, 180); } void MenuEngine::drawPauseEditor(void) const { this->displayText(this->mapName_, White, this->fontSize_, 180, 140); } void MenuEngine::drawMenu(void) { int fontSize; MenuEngine::t_menumap::const_iterator it = this->menusContent_.begin(); if (this->currentMenu_ == Modes::Stage) this->displayImage("img/next.jpg", 0, 0, 800, 600); else { this->displayImage("img/menu.jpg", 0, 0, 800, 600); for (; it != this->menusContent_.end(); ++it) if (this->currentMenu_ == it->first) { fontSize = this->fontSize_; if (it->second.interactive_ && this->isOnHover(this->getWidthAdapt(it->second.x_), this->getWidthAdapt(it->second.x_ + it->second.width_), this->getHeightAdapt(it->second.y_), this->getHeightAdapt(it->second.y_ + this->fontSize_))) fontSize += 2; this->displayText(it->second.text_, this->fontColor_, fontSize, it->second.x_, it->second.y_); } if (this->currentMenu_ == Modes::Config) this->drawConfig(); else if (this->currentMenu_ == Modes::LoadSaves) this->drawLoadSaves(); else if (this->currentMenu_ == Modes::LoadMaps) this->drawLoadMaps(); else if (this->currentMenu_ == Modes::Scores) this->drawScores(); else if (this->currentMenu_ == Modes::Preferences) this->drawPreferences(); else if (this->currentMenu_ == Modes::Editor) this->drawEditor(); else if (this->currentMenu_ == Modes::PauseEditor) this->drawPauseEditor(); else if (this->currentMenu_ == Modes::Win) this->drawWin(); } this->displayText("", White, 0, 0, 0); }
58.90796
236
0.692707
[ "model", "3d" ]
a7c575f9e1379c05a47121a2cf44337d1dc17852
13,433
hh
C++
dune/xt/grid/type_traits.hh
dune-community/dune-xt
da921524c6fff8d60c715cb4849a0bdd5f020d2b
[ "BSD-2-Clause" ]
2
2020-02-08T04:08:52.000Z
2020-08-01T18:54:14.000Z
dune/xt/grid/type_traits.hh
dune-community/dune-xt
da921524c6fff8d60c715cb4849a0bdd5f020d2b
[ "BSD-2-Clause" ]
35
2019-08-19T12:06:35.000Z
2020-03-27T08:20:39.000Z
dune/xt/grid/type_traits.hh
dune-community/dune-xt
da921524c6fff8d60c715cb4849a0bdd5f020d2b
[ "BSD-2-Clause" ]
1
2020-02-08T04:09:34.000Z
2020-02-08T04:09:34.000Z
// This file is part of the dune-xt project: // https://zivgitlab.uni-muenster.de/ag-ohlberger/dune-community/dune-xt // Copyright 2009-2021 dune-xt developers and contributors. All rights reserved. // License: Dual licensed as BSD 2-Clause License (http://opensource.org/licenses/BSD-2-Clause) // or GPL-2.0+ (http://opensource.org/licenses/gpl-license) // with "runtime exception" (http://www.dune-project.org/license.html) // Authors: // Felix Schindler (2016 - 2020) // René Fritze (2016 - 2020) // Tobias Leibner (2016 - 2020) #ifndef DUNE_XT_GRID_TYPE_TRAITS_HH #define DUNE_XT_GRID_TYPE_TRAITS_HH #include <type_traits> #include <dune/grid/common/entity.hh> #include <dune/grid/common/intersection.hh> #include <dune/grid/common/gridview.hh> #include <dune/xt/common/type_traits.hh> #if HAVE_ALBERTA # include <dune/xt/common/disable_warnings.hh> # include <dune/grid/albertagrid.hh> # include <dune/xt/common/reenable_warnings.hh> #endif #if HAVE_DUNE_ALUGRID # include <dune/alugrid/grid.hh> #endif #if HAVE_DUNE_SPGRID # include <dune/grid/spgrid.hh> # include <dune/grid/spgrid/dgfparser.hh> #endif #if HAVE_DUNE_UGGRID || HAVE_UG # include <dune/grid/uggrid.hh> #endif #include <dune/grid/onedgrid.hh> #include <dune/grid/yaspgrid.hh> namespace Dune { namespace GridGlue { // forward template <typename P0, typename P1, int I, int O> class Intersection; } // namespace GridGlue namespace XT::Grid { namespace internal { template <class T> struct has_traits_helper { DXTC_has_typedef_initialize_once(Traits); static constexpr bool is_candidate = DXTC_has_typedef(Traits)<T>::value; }; // forward template <class CouplingIntersectionType, class MacroIntersectionType> class CouplingIntersectionWithCorrectNormal; } // namespace internal template <class T> struct is_intersection : public std::false_type { using GridType = std::false_type; using InsideElementType = std::false_type; using OutsideElementType = std::false_type; }; template <class G, class I> struct is_intersection<Dune::Intersection<G, I>> : public std::true_type { using GridType = std::remove_const_t<G>; using InsideElementType = typename Dune::Intersection<G, I>::Entity; using OutsideElementType = typename Dune::Intersection<G, I>::Entity; }; template <typename P0, typename P1, int I, int O> struct is_intersection<Dune::GridGlue::Intersection<P0, P1, I, O>> : public std::true_type { using GridType = typename Dune::GridGlue::Intersection<P0, P1, I, O>::InsideGridView::Grid; using InsideElementType = typename Dune::GridGlue::Intersection<P0, P1, I, O>::InsideEntity; using OutsideElementType = typename Dune::GridGlue::Intersection<P0, P1, I, O>::OutsideEntity; }; template <class G, class I, typename P0, typename P1, int It, int O> struct is_intersection< Dune::XT::Grid::internal::CouplingIntersectionWithCorrectNormal<Dune::GridGlue::Intersection<P0, P1, It, O>, Dune::Intersection<G, I>>> : public std::true_type { using GridType = typename Dune::GridGlue::Intersection<P0, P1, It, O>::InsideGridView::Grid; using InsideElementType = typename Dune::GridGlue::Intersection<P0, P1, It, O>::InsideEntity; using OutsideElementType = typename Dune::GridGlue::Intersection<P0, P1, It, O>::OutsideEntity; }; template <class T> using extract_inside_element_t = typename is_intersection<T>::InsideElementType; template <class T> using extract_outside_element_t = typename is_intersection<T>::OutsideElementType; template <class T> struct is_grid : public std::false_type {}; template <class T> struct is_grid<const T> : public is_grid<T> {}; template <> struct is_grid<Dune::OneDGrid> : public std::true_type {}; template <int dim, class Coordinates> struct is_grid<Dune::YaspGrid<dim, Coordinates>> : public std::true_type {}; #if HAVE_ALBERTA template <int dim, int dimworld> struct is_grid<Dune::AlbertaGrid<dim, dimworld>> : public std::true_type {}; #endif // HAVE_ALBERTA #if HAVE_DUNE_ALUGRID template <int dim, int dimworld, ALUGridElementType elType, ALUGridRefinementType refineType, class Comm> struct is_grid<Dune::ALUGrid<dim, dimworld, elType, refineType, Comm>> : public std::true_type {}; template <int dim, int dimworld, ALU3dGridElementType elType, class Comm> struct is_grid<Dune::ALU3dGrid<dim, dimworld, elType, Comm>> : public std::true_type {}; #endif // HAVE_DUNE_ALUGRID #if HAVE_DUNE_UGGRID || HAVE_UG template <int dim> struct is_grid<Dune::UGGrid<dim>> : public std::true_type {}; #endif // HAVE_DUNE_UGGRID || HAVE_UG #if HAVE_DUNE_SPGRID template <class ct, int dim, template <int> class Ref, class Comm> struct is_grid<Dune::SPGrid<ct, dim, Ref, Comm>> : public std::true_type {}; #endif // HAVE_DUNE_SPGRID template <class T, int codim = 0> struct is_entity : public std::false_type {}; template <int cd, int dim, class GridImp, template <int, int, class> class EntityImp> struct is_entity<Dune::Entity<cd, dim, GridImp, EntityImp>, cd> : public std::true_type {}; template <class T, bool candidate = internal::has_traits_helper<std::remove_const_t<T>>::is_candidate> struct is_view : public std::false_type {}; template <class T> struct is_view<const T, true> : public is_view<T, true> {}; template <class T> struct is_view<T, true> : public std::is_base_of<Dune::GridView<typename T::Traits>, std::remove_const_t<T>> {}; template <class T, bool is_candidate = internal::has_traits_helper<T>::is_candidate> struct is_part : public std::false_type {}; template <class T> struct is_layer : public std::integral_constant<bool, is_view<T>::value || is_part<T>::value> {}; template <class T> struct is_yaspgrid : public std::false_type {}; template <int dim, class Coordinates> struct is_yaspgrid<YaspGrid<dim, Coordinates>> : public std::true_type {}; template <class T> struct is_uggrid : public std::false_type {}; #if HAVE_DUNE_UGGRID || HAVE_UG template <int dim> struct is_uggrid<UGGrid<dim>> : public std::true_type {}; #endif template <class T> struct is_alugrid : public std::false_type {}; template <class T> struct is_conforming_alugrid : public std::false_type {}; template <class T> struct is_simplex_alugrid : public std::false_type {}; template <class T> struct is_cube_alugrid : public std::false_type {}; #if HAVE_DUNE_ALUGRID template <int dim, int dimworld, ALUGridElementType elType, ALUGridRefinementType refineType, class Comm> struct is_alugrid<ALUGrid<dim, dimworld, elType, refineType, Comm>> : public std::true_type {}; template <int dim, int dimworld, ALUGridElementType elType, class Comm> struct is_conforming_alugrid<ALUGrid<dim, dimworld, elType, Dune::conforming, Comm>> : public std::true_type {}; template <int dim, int dimworld, ALUGridRefinementType refineType, class Comm> struct is_simplex_alugrid<ALUGrid<dim, dimworld, ALUGridElementType::simplex, refineType, Comm>> : public std::true_type {}; template <int dim, int dimworld, ALUGridRefinementType refineType, class Comm> struct is_cube_alugrid<ALUGrid<dim, dimworld, ALUGridElementType::cube, refineType, Comm>> : public std::true_type {}; #endif // HAVE_DUNE_ALUGRID template <class T, bool view = is_view<T>::value, bool part = is_part<T>::value, bool intersection = is_intersection<T>::value, bool entity = is_entity<T>::value> struct extract_grid : public AlwaysFalse<T> {}; template <class T> struct extract_grid<T, true, false, false, false> { using type = std::decay_t<typename T::Grid>; }; template <class T> struct extract_grid<T, false, true, false, false> { using type = std::decay_t<typename T::GridType>; }; template <class T> struct extract_grid<T, false, false, true, false> { using type = std::decay_t<typename is_intersection<T>::GridType>; }; template <int cd, int dim, class GridImp, template <int, int, class> class EntityImp> struct extract_grid<Dune::Entity<cd, dim, GridImp, EntityImp>, false, false, false, true> { using type = std::decay_t<GridImp>; }; template <class T> using extract_grid_t = typename extract_grid<T>::type; template <class T, bool view = is_view<T>::value, bool part = is_part<T>::value> struct extract_collective_communication : public AlwaysFalse<T> {}; template <class T> struct extract_collective_communication<T, true, false> { using type = typename T::CollectiveCommunication; }; template <class T> struct extract_collective_communication<T, false, true> { using type = typename T::CollectiveCommunicationType; }; template <class T> using extract_collective_communication_t = typename extract_collective_communication<T>::type; template <class T, bool view = is_view<T>::value, bool part = is_part<T>::value> struct extract_index_set : public AlwaysFalse<T> {}; template <class T> struct extract_index_set<T, true, false> { using type = typename T::IndexSet; }; template <class T> struct extract_index_set<T, false, true> { using type = typename T::IndexSetType; }; template <class T> using extract_index_set_t = typename extract_index_set<T>::type; template <class T, bool view = is_view<T>::value, bool part = is_part<T>::value> struct extract_intersection : public AlwaysFalse<T> {}; template <class T> struct extract_intersection<T, true, false> { using type = typename T::Intersection; }; template <class T> struct extract_intersection<T, false, true> { using type = typename T::IntersectionType; }; template <class T> using extract_intersection_t = typename extract_intersection<T>::type; template <class T, bool view = is_view<T>::value, bool part = is_part<T>::value> struct extract_intersection_iterator : public AlwaysFalse<T> {}; template <class T> struct extract_intersection_iterator<T, true, false> { using type = typename T::IntersectionIterator; }; template <class T> struct extract_intersection_iterator<T, false, true> { using type = typename T::IntersectionIteratorType; }; template <class T> using extract_intersection_iterator_t = typename extract_intersection_iterator<T>::type; template <class T, size_t codim = 0, bool view = is_view<T>::value, bool part = is_part<T>::value, bool grid = is_grid<T>::value> struct extract_entity : public AlwaysFalse<T> {}; // template <class T, size_t codim, bool view, bool part> // struct extract_entity<const T&, codim, view, part> : public extract_entity<T, codim, view, part> //{}; template <class T, size_t codim> struct extract_entity<T, codim, true, false, false> { using type = typename T::template Codim<codim>::Entity; }; template <class T, size_t codim> struct extract_entity<T, codim, false, true, false> { using type = typename T::template Codim<codim>::EntityType; }; template <class T, size_t codim> struct extract_entity<T, codim, false, false, true> { using type = typename T::template Codim<codim>::Entity; }; template <class T, size_t codim = 0> using extract_entity_t = typename extract_entity<T, codim>::type; template <class T, size_t codim = 0, bool view = is_view<T>::value, bool part = is_part<T>::value> struct extract_local_geometry : public AlwaysFalse<T> {}; template <class T, size_t codim> struct extract_local_geometry<T, codim, true, false> { using type = typename T::template Codim<codim>::LocalGeometry; }; template <class T, size_t codim> struct extract_local_geometry<T, codim, false, true> { using type = typename T::template Codim<codim>::LocalGeometryType; }; template <class T, size_t codim = 0> using extract_local_geometry_t = typename extract_local_geometry<T, codim>::type; template <class T, size_t codim = 0, bool view = is_view<T>::value, bool part = is_part<T>::value> struct extract_geometry : public AlwaysFalse<T> {}; template <class T, size_t codim> struct extract_geometry<T, codim, true, false> { using type = typename T::template Codim<codim>::Geometry; }; template <class T, size_t codim> struct extract_geometry<T, codim, false, true> { using type = typename T::template Codim<codim>::GeometryType; }; template <class T, size_t codim = 0> using extract_geometry_t = typename extract_geometry<T, codim>::type; template <class T, int c = 0, PartitionIteratorType pit = All_Partition, bool view = is_view<T>::value, bool part = is_part<T>::value> struct extract_iterator : public AlwaysFalse<T> {}; template <class T, int c, PartitionIteratorType pit> struct extract_iterator<T, c, pit, true, false> { using type = typename T::template Codim<c>::template Partition<pit>::Iterator; }; template <class T, int c, PartitionIteratorType pit> struct extract_iterator<T, c, pit, false, true> { using type = typename T::template Codim<c>::template Partition<pit>::IteratorType; }; template <class T, int c = 0, PartitionIteratorType pit = All_Partition> using extract_iterator_t = typename extract_iterator<T, c, pit>::type; //! struct to be used as comparison function e.g. in a std::map<Entity, EntityLess> template <class GV> struct EntityLess { using IndexSet = typename GV::IndexSet; using E = typename GV::Grid::template Codim<0>::Entity; EntityLess(const IndexSet& index_set) : index_set_(index_set) {} bool operator()(const E& a, const E& b) const { return index_set_.index(a) < index_set_.index(b); } const IndexSet& index_set_; }; } // namespace XT::Grid } // namespace Dune #endif // DUNE_XT_GRID_TYPE_TRAITS_HH
27.192308
120
0.733492
[ "geometry" ]
a7c948b1acc087b771c361fc71f78c0c0ea6ee78
8,237
cc
C++
hailo_model_zoo/core/postprocessing/src/roi_align_float.cc
nadaved1/hailo_model_zoo
42b716f337dde4ec602022a34d6a07a1bbd45539
[ "MIT" ]
29
2021-07-19T13:53:18.000Z
2022-01-26T11:20:55.000Z
hailo_model_zoo/core/postprocessing/src/roi_align_float.cc
nadaved1/hailo_model_zoo
42b716f337dde4ec602022a34d6a07a1bbd45539
[ "MIT" ]
1
2022-03-18T03:27:24.000Z
2022-03-20T14:58:41.000Z
hailo_model_zoo/core/postprocessing/src/roi_align_float.cc
nadaved1/hailo_model_zoo
42b716f337dde4ec602022a34d6a07a1bbd45539
[ "MIT" ]
10
2021-07-20T03:19:55.000Z
2022-02-25T13:57:30.000Z
using namespace std; #include <vector> #include "math.h" #include <iostream> struct PreCalc { int pos1; int pos2; int pos3; int pos4; float w1; float w2; float w3; float w4; }; void pre_calc_for_bilinear_interpolate( const int height, const int width, const int pooled_height, const int pooled_width, const int iy_upper, const int ix_upper, float roi_start_h, float roi_start_w, float bin_size_h, float bin_size_w, int roi_bin_grid_h, int roi_bin_grid_w, std::vector<PreCalc>* pre_calc) { int pre_calc_index = 0; for (int ph = 0; ph < pooled_height; ph++) { for (int pw = 0; pw < pooled_width; pw++) { for (int iy = 0; iy < iy_upper; iy++) { const float yy = roi_start_h + ph * bin_size_h + static_cast<float>(iy + .5f) * bin_size_h / static_cast<float>(roi_bin_grid_h); // e.g., 0.5, 1.5 for (int ix = 0; ix < ix_upper; ix++) { const float xx = roi_start_w + pw * bin_size_w + static_cast<float>(ix + .5f) * bin_size_w / static_cast<float>(roi_bin_grid_w); float x = xx; float y = yy; // deal with: inverse elements are out of feature map boundary if (y < -1.0 || y > height || x < -1.0 || x > width) { // empty PreCalc pc; pc.pos1 = 0; pc.pos2 = 0; pc.pos3 = 0; pc.pos4 = 0; pc.w1 = 0; pc.w2 = 0; pc.w3 = 0; pc.w4 = 0; pre_calc->at(pre_calc_index) = pc; pre_calc_index += 1; continue; } if (y <= 0) { y = 0; } if (x <= 0) { x = 0; } int y_low = static_cast<int>(y); int x_low = static_cast<int>(x); int y_high; int x_high; if (y_low >= height - 1) { y_high = y_low = height - 1; y = (float)y_low; } else { y_high = y_low + 1; } if (x_low >= width - 1) { x_high = x_low = width - 1; x = (float)x_low; } else { x_high = x_low + 1; } float ly = y - y_low; float lx = x - x_low; float hy = 1. - ly, hx = 1. - lx; float w1 = hy * hx, w2 = hy * lx, w3 = ly * hx, w4 = ly * lx; // save weights and indeces PreCalc pc; pc.pos1 = y_low * width + x_low; pc.pos2 = y_low * width + x_high; pc.pos3 = y_high * width + x_low; pc.pos4 = y_high * width + x_high; pc.w1 = w1; pc.w2 = w2; pc.w3 = w3; pc.w4 = w4; pre_calc->at(pre_calc_index) = pc; pre_calc_index += 1; } } } } } void ROIAlign( const int n_rois, const float* bottom_data, const float& spatial_scale, const bool position_sensitive, const bool continuous_coordinate, const int channels, const int height, const int width, const int pooled_height, const int pooled_width, const int sampling_ratio, const float* bottom_rois, int roi_cols, float* top_data) { // DCHECK(roi_cols == 4 || roi_cols == 5); // int n_rois = nthreads / channels / pooled_width / pooled_height; // (n, c, ph, pw) is an element in the pooled output // can be parallelized using omp #pragma omp parallel for \ num_threads(12) for (int n = 0; n < n_rois; n++) { int index_n = n * channels * pooled_width * pooled_height; // roi could have 4 or 5 columns const float* offset_bottom_rois = bottom_rois + n * roi_cols; int roi_batch_ind = 0; if (roi_cols == 5) { roi_batch_ind = offset_bottom_rois[0]; if (roi_batch_ind < 0) { top_data[n] = 0; continue; } offset_bottom_rois++; } // Do not using rounding; this implementation detail is critical float roi_offset = continuous_coordinate ? static_cast<float>(0.5) : static_cast<float>(0); float roi_start_w = offset_bottom_rois[0] * spatial_scale - roi_offset; float roi_start_h = offset_bottom_rois[1] * spatial_scale - roi_offset; float roi_end_w = offset_bottom_rois[2] * spatial_scale - roi_offset; float roi_end_h = offset_bottom_rois[3] * spatial_scale - roi_offset; float roi_width = roi_end_w - roi_start_w; float roi_height = roi_end_h - roi_start_h; // if (continuous_coordinate) { // CHECK_GT(roi_width, 0.); // CHECK_GT(roi_height, 0.); // } else { // backward compatiblity // Force malformed ROIs to be 1x1 // roi_width = std::max(roi_width, (T)1.); // roi_height = std::max(roi_height, (T)1.); // } roi_width = std::max(roi_width, (float)1.); roi_height = std::max(roi_height, (float)1.); float bin_size_h = static_cast<float>(roi_height) / static_cast<float>(pooled_height); float bin_size_w = static_cast<float>(roi_width) / static_cast<float>(pooled_width); // We use roi_bin_grid to sample the grid and mimic integral int roi_bin_grid_h = (sampling_ratio > 0) ? sampling_ratio : std::ceil(roi_height / pooled_height); // e.g., = 2 int roi_bin_grid_w = (sampling_ratio > 0) ? sampling_ratio : std::ceil(roi_width / pooled_width); // We do average (integral) pooling inside a bin const float count = roi_bin_grid_h * roi_bin_grid_w; // e.g. = 4 // we want to precalculate indeces and weights shared by all chanels, // this is the key point of optimiation std::vector<PreCalc> pre_calc( roi_bin_grid_h * roi_bin_grid_w * pooled_width * pooled_height); pre_calc_for_bilinear_interpolate( height, width, pooled_height, pooled_width, roi_bin_grid_h, roi_bin_grid_w, roi_start_h, roi_start_w, bin_size_h, bin_size_w, roi_bin_grid_h, roi_bin_grid_w, &pre_calc); for (int c = 0; c < channels; c++) { int index_n_c = index_n + c * pooled_width * pooled_height; int pre_calc_index = 0; for (int ph = 0; ph < pooled_height; ph++) { for (int pw = 0; pw < pooled_width; pw++) { int index = index_n_c + ph * pooled_width + pw; int c_unpooled = c; int channels_unpooled = channels; if (position_sensitive) { c_unpooled = c * pooled_height * pooled_width + ph * pooled_width + pw; channels_unpooled = channels * pooled_height * pooled_width; } const float* offset_bottom_data = bottom_data + (roi_batch_ind * channels_unpooled + c_unpooled) * height * width; float output_val = 0.; for (int iy = 0; iy < roi_bin_grid_h; iy++) { for (int ix = 0; ix < roi_bin_grid_w; ix++) { PreCalc pc = pre_calc[pre_calc_index]; output_val += pc.w1 * offset_bottom_data[pc.pos1] + pc.w2 * offset_bottom_data[pc.pos2] + pc.w3 * offset_bottom_data[pc.pos3] + pc.w4 * offset_bottom_data[pc.pos4]; pre_calc_index += 1; } } output_val /= count; top_data[index] = output_val; } // for pw } // for ph } // for c } // for n } extern "C"{ void ROIAlignC(const int n_rois, const float* bottom_data, const double spatial_scale, const bool position_sensitive, const bool continuous_coordinate, const int channels, const int height, const int width, const int pooled_height, const int pooled_width, const int sampling_ratio, const float* bottom_rois, int roi_cols, float* top_data){ float spatial_scale_float = static_cast<float>(spatial_scale); ROIAlign(n_rois, bottom_data, spatial_scale, position_sensitive, continuous_coordinate, channels, height, width, pooled_height, pooled_width, sampling_ratio, bottom_rois, roi_cols, top_data); } }
31.680769
99
0.562948
[ "vector" ]
a7cbf5666276c321f072c740f6c76310539d6da2
6,022
cpp
C++
AppCUI/src/Graphics/Canvas.cpp
rzaharia/AppCUI
9aa37b154e04d0aa3e69a75798a698f591b0c8ca
[ "MIT" ]
null
null
null
AppCUI/src/Graphics/Canvas.cpp
rzaharia/AppCUI
9aa37b154e04d0aa3e69a75798a698f591b0c8ca
[ "MIT" ]
null
null
null
AppCUI/src/Graphics/Canvas.cpp
rzaharia/AppCUI
9aa37b154e04d0aa3e69a75798a698f591b0c8ca
[ "MIT" ]
null
null
null
#include "AppCUI.hpp" #include <string.h> using namespace AppCUI::Graphics; Canvas::Canvas() { } Canvas::~Canvas() { } bool Canvas::Create(unsigned int width, unsigned int height, int fillCharacter, const ColorPair color) { CHECK(width > 0, false, "Width must be greater than 0."); CHECK(height > 0, false, "Height must be greater than 0."); if ((width == this->Width) && (height = this->Height)) { // no re-allocation required CHECK(Clear(fillCharacter, color), false, ""); return true; } Character* tmp = new Character[width * height]; CHECK(tmp, false, "Fail to allocate %d x %d characters", width, height); // all good --> associate the rows to the screen Character** ofs_tmp = new Character*[height]; CHECK(ofs_tmp, false, "Fail to allocate offset row vector of %d elements", height); Character* p = tmp; for (unsigned int tr = 0; tr < height; tr++, p += width) ofs_tmp[tr] = p; _Destroy(); this->Characters = tmp; this->OffsetRows = ofs_tmp; this->Width = width; this->Height = height; this->Reset(); CHECK(Clear(fillCharacter, color), false, ""); return true; } bool Canvas::Resize(unsigned int width, unsigned int height, int fillCharacter, const ColorPair color) { if (this->Characters == nullptr) return Create(width, height, fillCharacter, color); CHECK(width > 0, false, "Width must be greater than 0."); CHECK(height > 0, false, "Height must be greater than 0."); if ((width == this->Width) && (height == this->Height)) return true; // nothing to resize Character* tmp = new Character[width * height]; CHECK(tmp, false, "Fail to allocate %d x %d characters", width, height); Character** ofs_tmp = new Character*[height]; CHECK(ofs_tmp, false, "Fail to allocate offset row vector of %d elements", height); Character* p = tmp; for (unsigned int tr = 0; tr < height; tr++, p += width) ofs_tmp[tr] = p; unsigned short chr = ' '; if ((fillCharacter >= 0) && (fillCharacter <= 0xFFFF)) chr = (unsigned short) (fillCharacter & 0xFFFF); // copy from Characters to tmp unsigned int min_w = std::min<>(this->Width, width); unsigned int min_h = std::min<>(this->Height, height); for (unsigned int y = 0; y < min_h; y++) { Character* p_temp = tmp + (y * width); Character* p_current = this->Characters + (y * this->Width); for (unsigned int x = 0; x < min_w; x++, p_temp++, p_current++) { *(p_temp) = *(p_current); } } // fill the rest if (min_w < width) { for (unsigned int y = 0; y < height; y++) { Character* p_temp = tmp + (y * width); for (unsigned int x = min_w; x < width; x++, p_temp++) { p_temp->Code = chr; p_temp->Color = color; } } } if (min_h < height) { for (unsigned int y = min_h; y < height; y++) { Character* p_temp = tmp + (y * width); for (unsigned int x = 0; x < min_w; x++, p_temp++) { p_temp->Code = chr; p_temp->Color = color; } } } // destroy old Characters buffer _Destroy(); this->Characters = tmp; this->OffsetRows = ofs_tmp; this->Width = width; this->Height = height; // LOG_INFO("Resize screen canvas to %dx%d", this->Width, this->Height); this->Reset(); return true; } void Canvas::Reset() { this->TranslateX = this->TranslateY = 0; this->Clip.Left = this->Clip.Top = 0; this->Clip.Right = this->Width - 1; this->Clip.Bottom = this->Height - 1; this->Clip.Visible = true; this->ClipCopy.Bottom = this->ClipCopy.Top = this->ClipCopy.Left = this->ClipCopy.Right = -1; this->ClipCopy.Visible = false; this->ClipHasBeenCopied = false; this->HideCursor(); } void Canvas::SetAbsoluteClip(const AppCUI::Graphics::Clip& clip) { if (clip.Visible) { // make sure that clipping coordonates are within screen coordonates this->Clip.Left = std::max<>(clip.ClipRect.X, 0); this->Clip.Top = std::max<>(clip.ClipRect.Y, 0); this->Clip.Right = clip.ClipRect.X + clip.ClipRect.Width - 1; this->Clip.Bottom = clip.ClipRect.Y + clip.ClipRect.Height - 1; if (this->Clip.Right >= (int) this->Width) this->Clip.Right = (int) this->Width - 1; if (this->Clip.Bottom >= (int) this->Height) this->Clip.Bottom = (int) this->Height - 1; this->Clip.Visible = (Clip.Left <= Clip.Right) && (Clip.Top <= Clip.Bottom); } else { this->Clip.Visible = false; } this->ClipHasBeenCopied = false; } void Canvas::ExtendAbsoluteCliptToRightBottomCorner() { if (Clip.Visible) { if ((Clip.Right + 1) < (int) this->Width) Clip.Right++; if ((Clip.Bottom + 1) < (int) this->Height) Clip.Bottom++; } } void Canvas::ClearClip() { this->Clip.Left = 0; this->Clip.Top = 0; this->Clip.Right = this->Width - 1; this->Clip.Bottom = this->Height - 1; this->Clip.Visible = true; this->ClipHasBeenCopied = false; } void Canvas::SetTranslate(int offX, int offY) { this->TranslateX = offX; this->TranslateY = offY; } void Canvas::DarkenScreen() { Character* start = this->Characters; Character* end = this->Characters + (this->Width * this->Height); while (start < end) { start->Color = ColorPair{ Color::Gray, Color::Black }; start++; } } bool Canvas::ClearEntireSurface(int character, const ColorPair color) { return _ClearEntireSurface(character, color); }
33.642458
102
0.557622
[ "vector" ]
a7cf794b0171449a34b4c9d02c371b8f2732cc1c
64,997
cpp
C++
planner/FD/src/VAL/Plan.cpp
karthikv792/PlanningAssistance
5693c844e9067591ea1414ee9586bcd2dfff6f51
[ "MIT" ]
4
2019-04-23T10:41:35.000Z
2019-10-27T05:14:42.000Z
planner/FD/src/VAL/Plan.cpp
karthikv792/PlanningAssistance
5693c844e9067591ea1414ee9586bcd2dfff6f51
[ "MIT" ]
null
null
null
planner/FD/src/VAL/Plan.cpp
karthikv792/PlanningAssistance
5693c844e9067591ea1414ee9586bcd2dfff6f51
[ "MIT" ]
4
2018-01-16T00:00:22.000Z
2019-11-01T23:35:01.000Z
/************************************************************************ * Copyright 2008, Strathclyde Planning Group, * Department of Computer and Information Sciences, * University of Strathclyde, Glasgow, UK * http://planning.cis.strath.ac.uk/ * * Maria Fox, Richard Howey and Derek Long - VAL * Stephen Cresswell - PDDL Parser * * This file is part of VAL, the PDDL validator. * * VAL is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 2 of the License, or * (at your option) any later version. * * VAL 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 VAL. If not, see <http://www.gnu.org/licenses/>. * ************************************************************************/ /*----------------------------------------------------------------------------- VAL - The Automatic Plan Validator for PDDL+ $Date: 2009-02-05 10:50:21 $ $Revision: 1.2 $ Maria Fox, Richard Howey and Derek Long - PDDL+ and VAL Stephen Cresswell - PDDL Parser maria.fox@cis.strath.ac.uk derek.long@cis.strath.ac.uk stephen.cresswell@cis.strath.ac.uk richard.howey@cis.strath.ac.uk By releasing this code we imply no warranty as to its reliability and its use is entirely at your own risk. Strathclyde Planning Group http://planning.cis.strath.ac.uk ----------------------------------------------------------------------------*/ #include "State.h" #include "Plan.h" #include "Action.h" #include "Validator.h" #include "main.h" #include "Polynomial.h" #include "Exceptions.h" #include "ptree.h" #include "RobustAnalyse.h" using std::make_pair; using std::ptr_fun; using std::find; using std::remove; using std::sort; using std::find_if; using std::copy; using std::for_each; using std::bind1st; using std::mem_fun; //#define vector std::vector //#define map std::map //#define list std::list namespace VAL { Happening::Happening(Validator * v,const vector<pair<double,Action*> > & as,double timeEndPlan) : vld(v), time(0.0), actions(), eventHappening(false), realHappening(false), afterPlan(false) { time = as.begin()->first; afterPlan = time > timeEndPlan; std::transform(as.begin(),as.end(),std::back_inserter(actions),select2nd<pair<double,Action*> >()); realHappening = (find_if(actions.begin(),actions.end(),mem_fun(&Action::isRegAction)) != actions.end()); }; Happening::Happening(Validator * v,double timeToExecute,const vector<pair<double,Action*> > & as) : vld(v), time(v->getState().getTime()+timeToExecute),actions(), eventHappening(false), realHappening(false), afterPlan(false) { std::transform(as.begin(),as.end(),std::back_inserter(actions),select2nd<pair<double,Action*> >()); realHappening = (find_if(actions.begin(),actions.end(),mem_fun(&Action::isRegAction)) != actions.end()); }; //for creating event happenings Happening::Happening(Validator * v, vector<const Action*> acts,bool eve): vld(v), time(v->getState().getTime()), actions(acts), eventHappening(eve), realHappening(false), afterPlan(false) { //afterPlan = time > timeEndPlan; may need later for processes, then events may be after the main plan //std::transform(acts.begin(),acts.end(),std::back_inserter(actions)); }; //for creating event happenings Happening::Happening(Validator * v, vector<const Action*> acts,double t,bool eve): vld(v), time(t), actions(acts), eventHappening(eve), realHappening(false), afterPlan(false) { //afterPlan = time > timeEndPlan; may need later for processes, then events may be after the main plan //std::transform(acts.begin(),acts.end(),std::back_inserter(actions)); }; bool Happening::canHappen(const State * s) const { if(!eventHappening) { if(LaTeX) *report << "\\atime{"<<time<<"} \\> \\checkhappening"; else if(Verbose) cout << "Checking next happening (time " << time << ")\n"; } else { if(LaTeX) *report << "\\atime{"<<time<<"} \\> \\eventtriggered \\\\\n"; else if(Verbose) cout << "EVENT triggered at (time " << time << ")\n"; if(Verbose) { for(vector<const Action*>::const_iterator act = actions.begin();act != actions.end();++act) { (*act)->displayEventInfomation(); }; }; return true; //no need to check event preconditions, these are all satisfied! (if not then there is an error calculating the events!) }; bool isOK = true; for(vector<const Action*>::const_iterator a = actions.begin();a != actions.end();++a) { if(!(*a)->confirmPrecondition(s)) { if(LaTeX) { *report << "Plan failed because of unsatisfied precondition in:\\\\\n \\> " << (*a)<< "\\\\\n"; } else if(Verbose) cout << "Plan failed because of unsatisfied precondition in:\n" << (*a)<< "\n"; if(Verbose || ErrorReport) (*a)->addErrorRecord(time,s); if(!ContinueAnyway) return false; isOK = false; }; }; if(!isOK) return false; if(LaTeX) *report << "\\happeningOK\\\\\n"; return true; }; Happening::~Happening() { for(vector<const Action *>::const_iterator i = actions.begin();i != actions.end();++i) { delete (*i); }; }; // Is it best to return a bool or throw an exception? bool Happening::applyTo(State * s) const { /* This function will update the state: * * - for each action, need to determine which conditional effects are active; * - must also mark ownership of propositions and functional expressions; * - confirm no interaction; * - set the time in new state. */ // First establish ownership of preconditions. Ownership own(vld); vector<const Action *> eventsForMutexCheck = vld->getEvents().getEventsForMutexCheck(); //this is in case an event is triggered at the same time as an action if(!eventsForMutexCheck.empty()) { bool repeated; string eventName; vector<const Action*>::iterator b = eventsForMutexCheck.begin(); for(;b != eventsForMutexCheck.end();) { repeated = false; eventName = (*b)->getName0(); for(vector<const Action*>::const_iterator c = actions.begin();c != actions.end();++c) { if((*c)->getName0() == eventName) repeated = true; //there will be only a few possible values of b and c... }; if(repeated) b = eventsForMutexCheck.erase(b); else ++b; }; for(vector<const Action*>::const_iterator b2 = eventsForMutexCheck.begin();b2 != eventsForMutexCheck.end();++b2) { (*b2)->markOwnedPreconditions(own); }; }; //if one action do not mark since cant conflict bool markPreCons = ((actions.size() + eventsForMutexCheck.size()) > 1); if(markPreCons) { for(vector<const Action*>::const_iterator a = actions.begin();a != actions.end();++a) { (*a)->markOwnedPreconditions(own); }; }; EffectsRecord effs; for(vector<const Action*>::const_iterator a1 = actions.begin();a1 != actions.end();++a1) { if(!(*a1)->constructEffects(own,effs,s,markPreCons)) return false; }; EffectsRecord effsDummy; //do not want to apply the effects now only check they do not conflict for(vector<const Action*>::const_iterator b1 = eventsForMutexCheck.begin();b1 != eventsForMutexCheck.end();++b1) { if(!(*b1)->constructEffects(own,effsDummy,s,markPreCons)) return false; }; //display polys/fns if(LaTeX) { if(actions.size() != 0) { vector<const Action*>::const_iterator a2 = actions.begin(); if(CtsEffectAction * cea = dynamic_cast<CtsEffectAction*>(const_cast<Action*>(*a2))) { cea->displayCtsFtns(); }; }; }; effs.enact(s); s->nowUpdated(this); return true; }; void Happening::adjustContext(ExecutionContext & ec) const { for(vector<const Action*>::const_iterator a = actions.begin();a != actions.end();++a) { (*a)->adjustContext(ec); }; }; void Happening::adjustContextInvariants(ExecutionContext & ec) const { for(vector<const Action*>::const_iterator a = actions.begin();a != actions.end();++a) { (*a)->adjustContextInvariants(ec); }; }; void Happening::adjustActiveCtsEffects(ActiveCtsEffects & ace) const { for(vector<const Action*>::const_iterator a = actions.begin();a != actions.end();++a) { (*a)->adjustActiveCtsEffects(ace); }; ace.ctsEffectsProcessed = false; }; void ExecutionContext::addCondAction(const CondCommunicationAction * ca) { invariants.actions.push_back(ca); }; bool ExecutionContext::removeCondAction(const CondCommunicationAction * ca) { vector<const Action *>::iterator i = find(invariants.actions.begin(),invariants.actions.end(),ca); if(i != invariants.actions.end()) { invariants.actions.erase(i); return true; }; return false; }; ExecutionContext::ExecutionContext(Validator * v) : invariants(v) {}; void ExecutionContext::addInvariant(const InvariantAction * a) { if(a != 0) invariants.actions.push_back(a); }; void ExecutionContext::removeInvariant(const InvariantAction * a) { invariants.actions.erase(remove(invariants.actions.begin(),invariants.actions.end(),a), invariants.actions.end()); }; void ExecutionContext::setTime(double t) { invariants.time = t; }; ExecutionContext::~ExecutionContext() { invariants.actions.clear(); }; bool ExecutionContext::hasInvariants() const { return !(invariants.actions.empty()); }; void ActiveFE::addParentFE(const ActiveFE * afe) { //check if activeFE with this FE already exists, if not add it vector<const ActiveFE*>::const_iterator i = find(parentFEs.begin(),parentFEs.end(),afe); if(i == parentFEs.end()) parentFEs.push_back(afe); }; void ActiveFE::removeParentFE(const ActiveFE * a) { parentFEs.erase(remove(parentFEs.begin(),parentFEs.end(),a),parentFEs.end()); }; void ExecutionContext::setActiveCtsEffects(ActiveCtsEffects * ace) { for(vector<const Action*>::const_iterator a = invariants.actions.begin();a != invariants.actions.end();++a) { if(InvariantAction * ia = dynamic_cast<InvariantAction*>(const_cast<Action*>(*a))) ia->setActiveCtsEffects( ace ); else if(CondCommunicationAction * cca = dynamic_cast<CondCommunicationAction*>(const_cast<Action*>(*a))) cca->setActiveCtsEffects( ace ); }; }; ActiveCtsEffects::ActiveCtsEffects(Validator * v) : ctsEffects(v), ctsUpdateHappening(v), vld(v), eventTime(0) {}; void ActiveCtsEffects::addCtsEffect(const CtsEffectAction * a) { if(a != 0) ctsEffects.actions.push_back(a); }; void ActiveCtsEffects::removeCtsEffect(const CtsEffectAction * a) { ctsEffects.actions.erase(remove(ctsEffects.actions.begin(),ctsEffects.actions.end(),a), ctsEffects.actions.end()); }; void ActiveCtsEffects::setTime(double t) { ctsEffects.time = t; }; void ActiveCtsEffects::setLocalUpdateTime(double t) { localUpdateTime = t; }; const Happening * ActiveCtsEffects::getCtsEffectUpdate() const { //return a new happening with only one ctseffectaction that has a pointer to the ace so that they may all be updated ctsUpdateHappening.actions.clear(); ctsUpdateHappening.time = ctsEffects.time; vector<const Action*>::const_iterator a = ctsEffects.actions.begin(); dynamic_cast<CtsEffectAction*>( const_cast<Action*>(*a) )->setActiveCtsEffects( const_cast<ActiveCtsEffects*>(this) ); ctsUpdateHappening.actions.push_back(*a); return &ctsUpdateHappening; }; bool ActiveCtsEffects::isFEactive(const FuncExp * fe) const { map<const FuncExp *,ActiveFE*>::const_iterator i = activeFEs.find(fe); if(i != activeFEs.end()) return true; return false; }; struct FACtsEhandler { Validator * vld; ActiveCtsEffects * ace; const effect_lists * effs; Environment & bds; var_symbol_table::const_iterator i; const var_symbol_table::const_iterator endpt; vector<const_symbol *> cs; FACtsEhandler(Validator * v,ActiveCtsEffects * a,const forall_effect * eff,const Environment & bs) : vld(v), ace(a), effs(eff->getEffects()), bds(*bs.copy(v)), i(eff->getVars()->begin()), endpt(eff->getVars()->end()), cs(vld->range(i->second)) {}; bool handle() { if(i == endpt) { Environment * env = bds.copy(vld); for(list<assignment*>::const_iterator ae = effs->assign_effects.begin(); ae != effs->assign_effects.end();++ae) { ace->addActiveFE(*ae,*env); }; return true; }; var_symbol_table::const_iterator j = i++; vector<const_symbol *> ds = i != endpt?vld->range(i->second):vector<const_symbol *>(); ds.swap(cs); for(vector<const_symbol *>::iterator k = ds.begin();k != ds.end();++k) { bds[j->second] = *k; if(!handle()) return false; }; return true; }; }; void ActiveCtsEffects::addActiveFE(assignment * e,const Environment & bs) { ActiveFE * afe; const FuncExp * lhs = vld->fef.buildFuncExp(e->getFTerm(),bs); bool increase = true; //cout << *lhs <<"\n"; //check if activeFE with this FE already exists, if not add it map<const FuncExp *,ActiveFE*>::const_iterator i = activeFEs.find(lhs); if(i != activeFEs.end()) { afe = i->second; } else { afe = new ActiveFE(lhs); activeFEs[lhs] = afe; //cout<<*lhs<<" \\\\\n added as active fe \n"; }; if(e->getOp() == E_DECREASE) increase = false; //record the expressions that update the FE and if its increasing afe->exprns.push_back(pair<pair<const expression *,bool>,const Environment *>(pair<const expression *,bool>(e->getExpr(),increase),&bs) ); }; void ActiveCtsEffects::addActiveFEs(bool reCalc) { if(ctsEffectsProcessed && !reCalc) return; for(map<const FuncExp *, ActiveFE*>::iterator i = activeFEs.begin(); i != activeFEs.end(); ++i) { //cout << " deleting"<< *(i->first) <<"\n"; delete i->second; }; activeFEs.clear(); //first create list of effects, cts effects will all be assign effects(or cond assign) for(vector<const Action*>::iterator a = ctsEffects.actions.begin(); a != ctsEffects.actions.end();++a) { effect_lists * effects = new effect_lists(); for(list<assignment*>::const_iterator ae = (*a)->getEffects()->assign_effects.begin(); ae != (*a)->getEffects()->assign_effects.end();++ae) { effects->assign_effects.push_back(*ae); }; for(list<forall_effect*>::const_iterator ae1 = (*a)->getEffects()->forall_effects.begin(); ae1 != (*a)->getEffects()->forall_effects.end();++ae1) { effects->forall_effects.push_back(*ae1); }; //status will be true when displaying plan so if there is a possiblity of nonlinear effects an exception will be thrown //loop thro' conditional effects if they are active add them to the effect list for(vector<const CondCommunicationAction*>::const_iterator ca = dynamic_cast<const CtsEffectAction *>(*a)->condActions.begin(); ca != dynamic_cast<const CtsEffectAction *>(*a)->condActions.end();++ca) { if((*ca)->isActive()) { for(list<assignment*>::const_iterator j = (*ca)->getEffects()->assign_effects.begin(); j != (*ca)->getEffects()->assign_effects.end();++j) { effects->assign_effects.push_back(*j); }; for(list<forall_effect*>::const_iterator j1 = (*ca)->getEffects()->forall_effects.begin(); j1 != (*ca)->getEffects()->forall_effects.end();++j1) { effects->forall_effects.push_back(*j1); }; }; }; //loop thro' effects and create active FE objects for(list<assignment*>::const_iterator e = effects->assign_effects.begin(); e != effects->assign_effects.end();++e) { addActiveFE(*e,(*a)->bindings); }; //loop thro' for all effects and create active FE objects for(list<forall_effect*>::const_iterator e1 = effects->forall_effects.begin(); e1 != effects->forall_effects.end();++e1) { FACtsEhandler faceh(vld,this,*e1,(*a)->bindings); faceh.handle(); }; effects->assign_effects.clear(); effects->forall_effects.clear(); delete effects; };//end of creating active FEs from actions //add parentFEs now for(map<const FuncExp *,ActiveFE*>::iterator a1 = activeFEs.begin(); a1 != activeFEs.end();++a1) { for(vector<pair<pair<const expression*,bool>,const Environment *> >::const_iterator i = a1->second->exprns.begin(); i != a1->second->exprns.end();++i) { a1->second->addParentFEs(this,(*i).first.first,(*i).second ); }; }; //build cts functions for each active FE now buildAFECtsFtns(); ctsEffectsProcessed = true; }; void ActiveFE::addParentFEs(const ActiveCtsEffects * ace,const expression * e,const Environment * bs) { if(dynamic_cast<const num_expression *>(e)) return; if(const func_term * fexpression = dynamic_cast<const func_term *>(e)) { const FuncExp * fexp = ace->vld->fef.buildFuncExp(fexpression,*bs ); //check that the FE is changing, it may it constant for this interval for(map<const FuncExp *,ActiveFE*>::const_iterator j = ace->activeFEs.begin();j != ace->activeFEs.end();++j) { if(j->second->fe == fexp) { //cout<<j->second->fe<<" is parent of "<<this->fe<<"\n"; addParentFE(j->second); break; }; }; return; }; if(const binary_expression * bexp = dynamic_cast<const binary_expression *>(e)) { addParentFEs(ace,bexp->getLHS(),bs); addParentFEs(ace,bexp->getRHS(),bs); return; }; if(const uminus_expression * uexp = dynamic_cast<const uminus_expression *>(e)) { addParentFEs(ace,uexp->getExpr(),bs); return; }; if(dynamic_cast<const special_val_expr *>(e)) { return; }; if(Verbose) *report << "Unrecognised expression type\n"; UnrecognisedCondition uc; throw uc; }; bool ActiveFE::appearsInEprsn(const ActiveCtsEffects * ace,const expression * e,const Environment * bs) const { if(const func_term * fexpression = dynamic_cast<const func_term *>(e)) { const FuncExp * fexp = ace->vld->fef.buildFuncExp(fexpression,*bs ); if(fe == fexp) return true; }; if(const binary_expression * bexp = dynamic_cast<const binary_expression *>(e)) { if(appearsInEprsn(ace,bexp->getLHS(),bs)) return true; if(appearsInEprsn(ace,bexp->getRHS(),bs)) return true; }; if(const uminus_expression * uexp = dynamic_cast<const uminus_expression *>(e)) { if(appearsInEprsn(ace,uexp->getExpr(),bs)) return true; }; return false; }; void ActiveCtsEffects::buildAFECtsFtns() { //mark these PNEs as changed ctsly, in order to judder for robustness analysis if(Robust) for(map<const FuncExp*,ActiveFE*>::iterator i = activeFEs.begin();i != activeFEs.end();++i) const_cast<FuncExp*>(i->first)->setChangedCtsly(); //sort out exp (etc) functions first then... //loop thro active FEs in correct order given by dependicies in diff equns (topological sort) //build polys from expresions and then integrate vector<ActiveFE*> topSortActiveFEs; vector<ActiveFE*> listToTopSortTempActiveFEs; vector<ActiveFE*> listToTopSortActiveFEs; vector<ActiveFE*> loopDepTempActiveFEs; vector<ActiveFE*> loopDepActiveFEs; vector<ActiveFE*> loopDepActiveFEs2; bool inList; //sift out loop dependencies for exp functions (df/dt = f) for(map<const FuncExp*,ActiveFE*>::iterator i = activeFEs.begin();i != activeFEs.end();++i) { bool selfDepend = false; for(vector<const ActiveFE*>::iterator j = i->second->parentFEs.begin(); j != i->second->parentFEs.end();++j) { if(*j == i->second) { selfDepend = true; break; }; }; if(selfDepend) loopDepTempActiveFEs.push_back(i->second); else listToTopSortTempActiveFEs.push_back(i->second); }; //sift out dependencies for diff equations that are self dependent and depend on another from the list for(vector<ActiveFE*>::iterator i = loopDepTempActiveFEs.begin();i != loopDepTempActiveFEs.end();++i) { bool otherDepend = false; for(vector<const ActiveFE*>::iterator j = (*i)->parentFEs.begin(); j != (*i)->parentFEs.end();++j) { //check if it depends on another FE from loopDep list for(vector<ActiveFE*>::iterator k = loopDepTempActiveFEs.begin();k != loopDepTempActiveFEs.end();++k) { if( *k == *j && *i != *j) { otherDepend = true; break;}; }; if(otherDepend) break; }; if(otherDepend) loopDepActiveFEs2.push_back(*i); else loopDepActiveFEs.push_back(*i); }; //sift out loop dependencies for exp functions from above list (d f_2/dt = f_1, where f_1 from above list) for(vector<ActiveFE*>::iterator i = listToTopSortTempActiveFEs.begin();i != listToTopSortTempActiveFEs.end();++i) { if( (*i)->parentFEs.size() > 0) { //is in loopDepActiveFEs inList = false; for(vector<ActiveFE*>::iterator j = loopDepActiveFEs.begin();j != loopDepActiveFEs.end();++j) { for(vector<const ActiveFE*>::iterator k = (*i)->parentFEs.begin();k != (*i)->parentFEs.end();++k) { if( *k == *j) { inList = true; break;}; }; if(inList) break; }; if(inList) { loopDepActiveFEs2.push_back(*i); //cout << "\\\\\\> Exp fn 2 "<< (*i)->fe <<"\\\\\n"; } else { //cout << "\\> Top sort fn 2 "<< (*i)->fe <<"\\\\"; listToTopSortActiveFEs.push_back(*i); }; } else { //cout << "\\> Top sort fn default 2 "<< (*i)->fe <<"par szie="<<(*i)->parentFEs.size()<<"\\\\"; listToTopSortActiveFEs.push_back(*i); }; }; //do topological sort on remaining AFEs for(vector<ActiveFE*>::iterator i = listToTopSortActiveFEs.begin();i != listToTopSortActiveFEs.end();++i) { (*i)->colour = 0; //white }; for(vector<ActiveFE*>::iterator i = listToTopSortActiveFEs.begin();i != listToTopSortActiveFEs.end();++i) { visitActiveFE(*i,topSortActiveFEs); }; //define polys from top sorted list should be no errors for(vector<ActiveFE*>::iterator i = topSortActiveFEs.begin();i != topSortActiveFEs.end();++i) { if( (*i)->ctsFtn == 0) (*i)->ctsFtn = buildPoly(*i); }; //define exps now and numerical solutions for(vector<ActiveFE*>::iterator i = loopDepActiveFEs.begin();i != loopDepActiveFEs.end();++i) { // cout << *((*i)->fe) << " is the expression and " << (*i)->exprns.size() << " its size\n"; // for(vector<pair< pair<const expression *,bool> ,const Environment *> >::const_iterator j = (*i)->exprns.begin(); // j != (*i)->exprns.end();++j) // { // cout << *(j->first.first) << " " << j->first.second << "\n"; // // } if( (*i)->canResolveToExp(activeFEs,vld)) { // cout << "We're going to try to build an Exponential here\n"; if( (*i)->ctsFtn == 0) (*i)->ctsFtn = buildExp(*i); } else { if((*i)->ctsFtn == 0) (*i)->ctsFtn = buildNumericalSoln(*i); }; }; //define other exps now for(vector<ActiveFE*>::iterator i = loopDepActiveFEs2.begin();i != loopDepActiveFEs2.end();++i) { if( (*i)->ctsFtn == 0) (*i)->ctsFtn = buildExp(*i); }; }; bool ActiveFE::canResolveToExp(const map<const FuncExp*,ActiveFE*> activeFEs,Validator * vld) const { if(exprns.size() == 1) return true; // Add a new case to handle the situation in which we have two expressions, but one is a constant // multiple of #t if(exprns.size() == 2) { if(isConstLinearChangeExpr(exprns[0],activeFEs,vld) || isConstLinearChangeExpr(exprns[1],activeFEs,vld)) return true; }; return false; }; bool isConstLinearChangeExpr(const ExprnPair & exp,const map<const FuncExp *,ActiveFE *> activeFEs,Validator * vld) { const expression * ex = getRateExpression(exp.first.first); return isConstant(ex,exp.second,activeFEs,vld); }; bool isConstant(const expression * exp,const Environment * env,const map<const FuncExp *,ActiveFE *> activeFEs,Validator * vld) { const func_term * ft = dynamic_cast<const func_term *>(exp); if(ft) { const FuncExp * ftt = vld->fef.buildFuncExp(ft,*env); if(activeFEs.find(ftt) != activeFEs.end()) { // cout << "Found non-constant FuncTerm " << *ftt << "\n"; return false; } else return true; }; const num_expression * nt = dynamic_cast<const num_expression *>(exp); if(nt) { return true; }; const binary_expression * be = dynamic_cast<const binary_expression *>(exp); if(be) { return isConstant(be->getLHS(),env,activeFEs,vld) && isConstant(be->getRHS(),env,activeFEs,vld); }; return false; }; void ActiveCtsEffects::visitActiveFE(ActiveFE * afe,vector<ActiveFE*> & topSAFEs) { if(afe->colour == 1) //check if already been visted and thus a loop { HighOrderDiffEqunError hodee; throw hodee; }; if(afe->colour != 0) return; afe->colour = 1; //grey for(vector<const ActiveFE*>::iterator i = afe->parentFEs.begin();i != afe->parentFEs.end();++i) { visitActiveFE(const_cast<ActiveFE*>(*i),topSAFEs); }; afe->colour = 2; //black topSAFEs.push_back(afe); return; }; //extract just the rate of change for cts effect // - if the syntax of cts effects changes then this will need to be changed const expression* getRateExpression(const expression* aExpression) { const expression * rateExprn; if(const mul_expression * me = dynamic_cast<const mul_expression *>(aExpression)) { if(dynamic_cast<const special_val_expr *>(me->getLHS())) { rateExprn = me->getRHS(); } else if(dynamic_cast<const special_val_expr *>(me->getRHS())) { rateExprn = me->getLHS(); } else { DiffEqunError dee; throw dee; }; } else { DiffEqunError dee; throw dee; }; return rateExprn; }; const Polynomial * ActiveCtsEffects::buildPoly(const ActiveFE * afe) { Polynomial thePoly; //loop thro exprns and create poly from each, the sum integrated is our poly for(vector<pair<pair<const expression*,bool>,const Environment *> >::const_iterator i = afe->exprns.begin(); i != afe->exprns.end();++i) { //extract just the rate of change for cts effect // - if the syntax of cts effects changes then this will need to be changed if(dynamic_cast<const mul_expression *>(i->first.first)) { thePoly += getPoly(getRateExpression(i->first.first),i->first.second,this,i->second); } else if(const special_val_expr * sve = dynamic_cast<const special_val_expr *>(i->first.first)) { if(sve->getKind() == E_HASHT) { Polynomial timet; timet.setCoeff(0,1); if(i->first.second) thePoly += timet; else thePoly -= timet; } else { thePoly += getPoly(i->first.first,i->first.second,this,i->second); }; } else { thePoly += getPoly(i->first.first,i->first.second,this,i->second); }; }; thePoly = thePoly.integrate(); //add boundary condition double bc = afe->fe->evaluate(&(vld->getState())); thePoly.setCoeff(0,bc); //cout << "Boundary for "<<*(afe->fe)<<" is "<<bc<<" -- "<<thePoly <<"\n"; const Polynomial * newPoly = new Polynomial(thePoly); return newPoly; }; const CtsFunction * ActiveCtsEffects::buildExp(const ActiveFE * afe) { const Polynomial * expPoly; // p(t) CoScalar kValue = 0, cValue = 0; // for f(t) = K e^{p(t)} + c const expression* rateExprn; const expression* constExprn = 0; const expression* FEExprn = 0; bool simpleExp = true; //equn of form df/dt = A*f const FuncExp * fexp = 0; //not handling sums of exp functions, yet if(!afe->canResolveToExp(activeFEs,vld)) { DiffEqunError dee; throw dee; }; pair<pair<const expression*,bool>,const Environment *> exprn = * afe->exprns.begin(); rateExprn = getRateExpression(exprn.first.first); const Environment * env = exprn.second; bool incr = exprn.first.second; const expression * constExpA = 0; const Environment * envC = 0; //cout << "Stage 1\n"; if(afe->exprns.size() == 2) { // cout << "Stage 2\n"; if(isConstant(rateExprn,exprn.second,activeFEs,vld)) { constExpA = rateExprn; envC = env; rateExprn = getRateExpression(afe->exprns[1].first.first); env = afe->exprns[1].second; incr = afe->exprns[1].first.second; } else { constExpA = getRateExpression(afe->exprns[1].first.first); envC = afe->exprns[1].second; }; }; // cout << "Stage 3: " << *rateExprn << "\n"; if(const func_term * fexpression = dynamic_cast<const func_term *>(rateExprn)) { fexp = vld->fef.buildFuncExp(fexpression,*env); if(fexp != afe->fe) simpleExp = false; } else if(const mul_expression * me = dynamic_cast<const mul_expression *>(rateExprn)) { // cout << "Stage 4\n"; if(afe->appearsInEprsn(this,me->getLHS(),env)) { constExprn = me->getRHS(); fexp = afe->fe; FEExprn = me->getLHS(); } else if(afe->appearsInEprsn(this,me->getRHS(),env)) { constExprn = me->getLHS(); fexp = afe->fe; FEExprn = me->getRHS(); } else { simpleExp = false; if(afe->parentFEs.size() == 1) fexp = (*afe->parentFEs.begin())->fe; if((*afe->parentFEs.begin())->appearsInEprsn(this,me->getRHS(),env)) { constExprn = me->getLHS(); FEExprn = me->getRHS(); } else { constExprn = me->getRHS(); FEExprn = me->getLHS(); }; }; } else { DiffEqunError dee; throw dee; }; //end of extracting const expression and FE expression //cout << "We are here with " << *fexp << " and " << *constExprn << "\n"; if(fexp == 0) { DiffEqunError dee; throw dee; }; if(simpleExp) //simple in the sense that does not depend on other PNES that are exps { //const exprn depends on the FE? if(afe->appearsInEprsn(this,constExprn,env)) { DiffEqunError dee; throw dee; }; Polynomial bPoly; if(constExprn != 0) { bPoly = getPoly(constExprn,this,env,localUpdateTime); bPoly = bPoly.integrate(); //leave constant term zero, this part of constant } else bPoly.setCoeff(1,1); if(!(incr)) bPoly = - bPoly; //add boundary condition double bc = afe->fe->evaluate(&(vld->getState())); //if poly is constant zero the exp is not an exp! if(bPoly.getDegree() == 0 && bPoly.getCoeff(0) == 0) { Polynomial aPoly; aPoly.setCoeff(0,bc); return new Polynomial(aPoly); }; //handle different cases for FE expression, may be (a-f), (f-a) or f if(dynamic_cast<const func_term *>(FEExprn)) { //cout << "This is the case....\n"; kValue = bc; // divided by e^{b(0)} // We can also deal with the special case where we have two expressions in the exprns list for this // activeFE and one is constant, A, and the other is B.f for constant B. if(constExpA) { // cout << "We are handling our special case...\n"; cValue = -(vld->getState().evaluate(constExpA,*envC)/vld->getState().evaluate(constExprn,*env)); if(!incr) cValue = -cValue; kValue -= cValue; }; } else if(const minus_expression * minexprn = dynamic_cast<const minus_expression *>(FEExprn)) { if(dynamic_cast<const func_term *>(minexprn->getLHS()) && afe->appearsInEprsn(this,minexprn->getLHS(),env)) { if(afe->appearsInEprsn(this,minexprn->getRHS(),env)) { DiffEqunError dee; throw dee; }; FEScalar minExprnConst = vld->getState().evaluate(minexprn->getRHS(),*env); kValue = bc - minExprnConst; cValue = minExprnConst; } else if(dynamic_cast<const func_term *>(minexprn->getRHS()) && afe->appearsInEprsn(this,minexprn->getRHS(),env)) { if(afe->appearsInEprsn(this,minexprn->getLHS(),env)) { DiffEqunError dee; throw dee; }; FEScalar minExprnConst = vld->getState().evaluate(minexprn->getLHS(),*env); kValue = bc - minExprnConst; cValue = minExprnConst; bPoly = - bPoly; } else { DiffEqunError dee; throw dee; }; } else { DiffEqunError dee; throw dee; }; expPoly = new Polynomial(bPoly); } else // dg/dt = k f, where f(t) = k' e^{at} (not simple exp) { map<const FuncExp *,ActiveFE*>::const_iterator i = activeFEs.find(fexp); if(i != activeFEs.end()) { if(const Exponential * cf = dynamic_cast<const Exponential *>((*i).second->ctsFtn)) { if( cf->getPolynomial()->getDegree() != 1) { DiffEqunError dee; throw dee; }; CoScalar aExpVal = cf->getPolynomial()->getCoeff(1);//cf->getA(); CoScalar kExpVal = cf->getK(); if(!(exprn.first.second)) kValue = - kValue; CoScalar constVal = 1; CoScalar bc = afe->fe->evaluate(&(vld->getState())); if(constExprn != 0) constVal = vld->getState().evaluate(constExprn,*env); //if constants are zero the exp is not an exp! if(constVal == 0) { const Polynomial * newPoly = new Polynomial(); return newPoly; }; //for d f_2 /dt = a_2 f_1 //f_2 (t) = (a_2 / a_1) * K_1 e^{a_1 t} + f_0 - (a_2 / a_1) * K_1 kValue = (constVal/aExpVal)*kExpVal; cValue = bc - (constVal/aExpVal)*kExpVal; expPoly = new Polynomial(*cf->getPolynomial()); } else if(const Polynomial * cf = dynamic_cast<const Polynomial *>((*i).second->ctsFtn)) { Polynomial aPoly; aPoly = cf->integrate(); //add boundary condition CoScalar bc = afe->fe->evaluate(&(vld->getState())); aPoly.setCoeff(0,bc); const Polynomial * newPoly = new Polynomial(aPoly); return newPoly; } else { DiffEqunError dee; throw dee; }; } else { DiffEqunError dee; throw dee; }; }; const Exponential * newExp = new Exponential(kValue,expPoly,cValue); return newExp; }; //build numerical solution to equn: dy/dt = p(t) (m-y) + q(t) const CtsFunction * ActiveCtsEffects::buildNumericalSoln(const ActiveFE * afe) { CoScalar accuracy = 0.05; CoScalar mValue; // for dy/dt = p(t) (m-y) + q(t) const expression* rateExprn; const expression* constExprn = 0; const expression* FEExprn = 0; vector<pair<const CtsFunction *,bool> > discharge; pair<pair<const expression*,bool>,const Environment *> exprn; bool exprnDefined = false; // const FuncExp * fexp = 0; for(vector<pair<pair<const expression*,bool>,const Environment *> >::const_iterator i = afe->exprns.begin(); i != afe->exprns.end(); ++i) { if(!afe->appearsInEprsn(this,(*i).first.first ,i->second)) { Polynomial aPoly = (getPoly((*i).first.first,this,i->second)).diff(); discharge.push_back(make_pair(new Polynomial(aPoly),i->first.second)); } else { if(exprnDefined) { DiffEqunError dee; throw dee; }; exprn = *i; exprnDefined = true; }; }; rateExprn = getRateExpression(exprn.first.first); // if(const func_term * fexpression = dynamic_cast<const func_term *>(rateExprn)) // { // // fexp = vld->fef.buildFuncExp(fexpression,*exprn.second); // } // else if(const mul_expression * me = dynamic_cast<const mul_expression *>(rateExprn)) { if(afe->appearsInEprsn(this,me->getLHS(),exprn.second)) { constExprn = me->getRHS(); // fexp = afe->fe; FEExprn = me->getLHS(); } else if(afe->appearsInEprsn(this,me->getRHS(),exprn.second)) { constExprn = me->getLHS(); // fexp = afe->fe; FEExprn = me->getRHS(); } else { DiffEqunError dee; throw dee; }; } else { DiffEqunError dee; throw dee; }; //end of extracting const expression and FE expression //const exprn depends on the FE? if(afe->appearsInEprsn(this,constExprn,exprn.second)) { DiffEqunError dee; throw dee; }; Polynomial bPoly; if(constExprn != 0) { bPoly = getPoly(constExprn,this,exprn.second); } else bPoly.setCoeff(0,1); if(!(exprn.first.second)) bPoly = - bPoly; //if poly is constant zero then soln will be something... //handle different cases for FE expression, may be (m-y), (y-m) or y if(dynamic_cast<const func_term *>(FEExprn)) { mValue = 0; bPoly = - bPoly; } else if(const minus_expression * minexprn = dynamic_cast<const minus_expression *>(FEExprn)) { if(dynamic_cast<const func_term *>(minexprn->getLHS()) && afe->appearsInEprsn(this,minexprn->getLHS(),exprn.second)) { if(afe->appearsInEprsn(this,minexprn->getRHS(),exprn.second)) { DiffEqunError dee; throw dee; }; mValue = vld->getState().evaluate(minexprn->getRHS(),*exprn.second); bPoly = - bPoly; } else if(dynamic_cast<const func_term *>(minexprn->getRHS()) && afe->appearsInEprsn(this,minexprn->getRHS(),exprn.second)) { if(afe->appearsInEprsn(this,minexprn->getLHS(),exprn.second)) { DiffEqunError dee; throw dee; }; mValue = vld->getState().evaluate(minexprn->getLHS(),*exprn.second); } else { DiffEqunError dee; throw dee; }; } else { DiffEqunError dee; throw dee; }; const BatteryCharge * newBatteryCharge = new BatteryCharge(new Polynomial(bPoly),mValue,discharge,0, localUpdateTime,afe->fe->evaluate(&(vld->getState())),accuracy); return newBatteryCharge; }; FEScalar ActiveFE::evaluate(double time) const { return ctsFtn->evaluate(time); }; bool ActiveFE::isLinear() const { if(ctsFtn->isLinear()) return true; return false; }; bool ActiveCtsEffects::areCtsEffectsLinear() const { //return true; for(map<const FuncExp*,ActiveFE*>::const_iterator i = activeFEs.begin();i != activeFEs.end();++i) { //cout << i->second->fe<<" fe chking\n"; if( !(i->second->parentFEs.empty()) ) return false; }; return true; }; ActiveCtsEffects::~ActiveCtsEffects() { ctsEffects.actions.clear(); ctsUpdateHappening.actions.clear(); }; ActiveFE::~ActiveFE() { parentFEs.clear(); exprns.clear(); delete ctsFtn; }; bool ActiveCtsEffects::hasCtsEffects() const { return !(ctsEffects.actions.empty()); }; void ActiveCtsEffects::clearCtsEffects() { ctsEffects.actions.clear(); }; void EffectsRecord::enact(State * s) const { if(!(s->getValidator()->hasEvents()) && !s->hasObservers()) { for(vector<const SimpleProposition *>::const_iterator i = dels.begin();i != dels.end();++i) { s->del(*i); }; for(vector<const SimpleProposition *>::const_iterator i1 = adds.begin();i1 != adds.end();++i1) { s->add(*i1); }; for(vector<Update>::const_iterator i2 = updates.begin();i2 != updates.end();++i2) { i2->update(s); }; } else { s->recordResponsibles(responsibleForProps,responsibleForPNEs); for(vector<const SimpleProposition *>::const_iterator i = dels.begin();i != dels.end();++i) { s->delChange(*i); }; for(vector<const SimpleProposition *>::const_iterator i1 = adds.begin();i1 != adds.end();++i1) { s->addChange(*i1); }; for(vector<Update>::const_iterator i2 = updates.begin();i2 != updates.end();++i2) { i2->updateChange(s); }; }; // for_each(dels.begin(),dels.end(),bind1st(ptr_fun(Deleter),s)); // for_each(adds.begin(),adds.end(),bind1st(ptr_fun(Adder),s)); // for_each(updates.begin(),updates.end(),bind1st(ptr_fun(Assigner),s)); }; /* Tricky bit: * The effect_lists of each action will include universal effects, conditional * effects, add and delete effects and assign effects (ignore timed effects for * the moment). Add and delete effects are easy. Universal effects must be * instantiated for all possible values of the quantified variables - no way round * this I don't think. Conditional effects are more problematic: we have to first * confirm that the condition is satisfied in the current state, marking ownership * as well and then treat the effects using the * standard effect_lists handling machinery - use recursion here. * * At the end of the process we want all the postconditions to be tidily separated * into add, delete and assign effects. Can't enact them as they are checked because * of conditional effects. Therefore, we need to build up the effects as we go along. * */ void insert_effects(effect_lists * el,effect_lists * more) { el->add_effects.insert(el->add_effects.begin(), more->add_effects.begin(),more->add_effects.end()); el->del_effects.insert(el->del_effects.begin(), more->del_effects.begin(),more->del_effects.end()); el->forall_effects.insert(el->forall_effects.begin(), more->forall_effects.begin(),more->forall_effects.end()); el->cond_effects.insert(el->cond_effects.begin(), more->cond_effects.begin(),more->cond_effects.end()); el->assign_effects.insert(el->assign_effects.begin(), more->assign_effects.begin(),more->assign_effects.end()); // Don't need to handle timed effects because this is used to insert effects // from one timed effects structure into another and they cannot be nested. }; bool partOfPlan(const pair<double,Action *> & a) { return a.second->isRealAction(); }; Plan::Plan(Validator * v,const operator_list * ops,const plan * p) : vld(v), timeToProduce(p->getTime()) { if(p->empty()) return; timedActionSeq planStructure; planStructure.reserve(p->size()); for_each(p->begin(),p->end(),planBuilder(v,planStructure,ops)); sort(planStructure.begin(),planStructure.end()); double d = find_if(planStructure.rbegin(),planStructure.rend(),partOfPlan)->first; //*report << "Calculated last useful time as " << d << "\n"; //you don't want this do you? timedActionSeq::iterator i = planStructure.begin(); if(!Robust) { while(i != planStructure.end()) { timedActionSeq::iterator j = find_if(i,planStructure.end(),after(i->first,v->getTolerance())); timedActionSeq vs(i,j); happenings.push_back(new Happening(vld,vs,d)); i = j; }; } else { while(i != planStructure.end()) { timedActionSeq::iterator j = find_if(i,planStructure.end(),sameTime(i->first)); timedActionSeq vs(i,j); happenings.push_back(new Happening(vld,vs,d)); i = j; }; }; }; int Plan::length() const { return happenings.size(); }; void Plan::display() const { if(!LaTeX) { *report << "Plan size: " << length() << "\n"; if(timeToProduce >= 0) *report << "Planner run time: " << timeToProduce << "\n"; }; }; ostream & operator << (ostream & o,const Plan & p) { p.display(); if(p.length() == 0) return o; if(LaTeX) { Plan::const_iterator h = p.begin(); double lastTime = h.getTime(); o << "\\begin{tabbing}\n"; o << "\\headingtimehappening \n"; for(;h != p.end();++h) { if(lastTime != h.getTime()) o << "\\\\"; o << "\\atime{"<< h.getTime() << "} "; o << *h << "\n"; lastTime = h.getTime(); }; o << "\\end{tabbing}\n"; } else { copy(p.begin(),p.end(),ostream_iterator<const Happening *>(o," \n")); }; return o; }; void Happening::write(ostream & o) const { if(LaTeX) { for(vector<const Action*>::const_iterator a = actions.begin();a != actions.end();++a) { o << " \\> \\listrow{" << *a << "}\\\\"; }; } else { o << time << ":\n"; copy(actions.begin(),actions.end(),ostream_iterator<const Action * const>(o,"\n")); }; }; ostream & operator << (ostream & o,const Happening * h) { h->write(o); return o; }; void Update::update(State * s) const { s->update(fe,aop,value); }; void Update::updateChange(State * s) const { s->updateChange(fe,aop,value); }; void handleDAgoals(const goal * gl,goal_list * gls,goal_list * gli,goal_list * gle) { if(const conj_goal * cg = dynamic_cast<const conj_goal *>(gl)) { for(goal_list::const_iterator i = cg->getGoals()->begin();i != cg->getGoals()->end();++i) { if(const timed_goal * tg = dynamic_cast<const timed_goal *>(*i)) { switch(tg->getTime()) { case E_AT_START: gls->push_back(const_cast<goal*>(tg->getGoal())); continue; case E_AT_END: gle->push_back(const_cast<goal*>(tg->getGoal())); continue; case E_OVER_ALL: gli->push_back(const_cast<goal*>(tg->getGoal())); continue; default: continue; }; } else { if(Verbose) *report << "Untimed precondition in a durative action!\n"; UnrecognisedCondition uc; throw uc; }; }; } else { if(const timed_goal * tg = dynamic_cast<const timed_goal *>(gl)) { switch(tg->getTime()) { case E_AT_START: gls->push_back(const_cast<goal*>(tg->getGoal())); break; case E_AT_END: gle->push_back(const_cast<goal*>(tg->getGoal())); break; case E_OVER_ALL: gli->push_back(const_cast<goal*>(tg->getGoal())); break; default: break; }; } else { if(Verbose) *report << "Untimed precondition in a durative action!\n"; UnrecognisedCondition uc; throw uc; }; }; }; void handleDAeffects(const effect_lists * efcts,effect_lists * els,effect_lists * ele,effect_lists * elc) { for(pc_list<timed_effect*>::const_iterator i = efcts->timed_effects.begin(); i != efcts->timed_effects.end();++i) { switch((*i)->ts) { case E_AT_START: insert_effects(els,(*i)->effs); continue; case E_AT_END: insert_effects(ele,(*i)->effs); continue; case E_CONTINUOUS: insert_effects(elc,(*i)->effs); continue; default: continue; }; }; //split forall effects into forall effects at the start for(list<forall_effect*>::const_iterator i1 = efcts->forall_effects.begin(); i1 != efcts->forall_effects.end();++i1) { effect_lists * elsfa = new effect_lists(); effect_lists * elefa = new effect_lists(); effect_lists * elcfa = new effect_lists(); handleDAeffects((*i1)->getEffects(),elsfa,elefa,elcfa); if( !(elsfa->add_effects.empty() && elsfa->del_effects.empty() && elsfa->forall_effects.empty() && elsfa->assign_effects.empty() ) ) { els->forall_effects.push_back(new forall_effect(elsfa,const_cast<var_symbol_list*>((*i1)->getVarsList()),const_cast<var_symbol_table *>((*i1)->getVars()) )); }; if( !(elcfa->add_effects.empty() && elcfa->del_effects.empty() && elcfa->forall_effects.empty() && elcfa->assign_effects.empty() ) ) { elc->forall_effects.push_back(new forall_effect(elcfa,const_cast<var_symbol_list*>((*i1)->getVarsList()),const_cast<var_symbol_table *>((*i1)->getVars()) )); }; if( !(elefa->add_effects.empty() && elefa->del_effects.empty() && elefa->forall_effects.empty() && elefa->assign_effects.empty() ) ) { ele->forall_effects.push_back(new forall_effect(elefa,const_cast<var_symbol_list*>((*i1)->getVarsList()),const_cast<var_symbol_table *>((*i1)->getVars()) )); }; }; }; struct handleDAConditionalEffects { Validator * vld; const durative_action * da; const const_symbol_list * params; effect_lists * els; effect_lists * ele; effect_lists * elc; const var_symbol_list * vars; vector<const CondCommunicationAction *> condActions; vector<const CondCommunicationAction *> ctsCondActions; handleDAConditionalEffects(Validator * v,const durative_action * d,const const_symbol_list * ps, effect_lists * es,effect_lists * ee,effect_lists * ec) : vld(v), da(d), params(ps), els(es), ele(ee), elc(ec), vars(0) {}; handleDAConditionalEffects(Validator * v,const durative_action * d,const const_symbol_list * ps, effect_lists * es,effect_lists * ee,effect_lists * ec,const var_symbol_list * vs) : vld(v), da(d), params(ps), els(es), ele(ee), elc(ec), vars(vs) {}; void operator()(const forall_effect * fa) { if(!fa->getEffects()->cond_effects.empty()) { effect_lists * lels = new effect_lists(); effect_lists * lele = new effect_lists(); effect_lists * lelc = 0; //cts effects - I don't believe this is ever used handleDAConditionalEffects hDAc = for_each(fa->getEffects()->cond_effects.begin(),fa->getEffects()->cond_effects.end(), handleDAConditionalEffects(vld,da,params,lels,lele,lelc,fa->getVarsList())); if(!hDAc.ctsCondActions.empty()) { cout << "Continuous effects spanning durative action, in quantified conditions...\n"; cout << "This is really complex stuff! Unfortunately, VAL doesn't even try to deal with it.\n"; cout << "Tell Derek to fix this!\n"; SyntaxTooComplex stc; throw(stc); }; if(!hDAc.condActions.empty()) { condActions.insert(condActions.end(),hDAc.condActions.begin(),hDAc.condActions.end()); } // These use empty symbol tables, which will protect the variables from being // deleted twice. if(!lels->cond_effects.empty()) { forall_effect * fas = new forall_effect(lels,new var_symbol_list(*(fa->getVarsList())),new var_symbol_table ()); els->forall_effects.push_back(fas); } else { delete lels; }; if(!lele->cond_effects.empty()) { forall_effect * fae = new forall_effect(lele,new var_symbol_list(*(fa->getVarsList())),new var_symbol_table()); ele->forall_effects.push_back(fae); } else { delete lele; }; }; }; void operator()(const cond_effect * ce) { effect_lists * locels = new effect_lists(); effect_lists * locele = new effect_lists(); effect_lists * locelc = new effect_lists(); handleDAeffects(ce->getEffects(),locels,locele,locelc); goal_list * gls = new goal_list(); goal_list * gle = new goal_list(); goal_list * gli = new goal_list(); handleDAgoals(ce->getCondition(),gls,gli,gle); //check for bad conditional effects if( ( ! gli->empty() || ! gle->empty() ) && ( ! locels->add_effects.empty() || ! locels->del_effects.empty() || ! locels->forall_effects.empty() || ! locels->assign_effects.empty() || ! locelc->assign_effects.empty() || ! locelc->forall_effects.empty() ) ) { TemporalDAError tdae; throw tdae; }; if(!(locelc->assign_effects.empty() && locelc->forall_effects.empty())) //cts effects will always be assign effects or forall { ctsCondActions.push_back(new CondCommunicationAction(vld,da,params,gls,gli,gle,0,locelc));//cts cond actions if(locele->add_effects.empty() && locele->del_effects.empty() && locele->forall_effects.empty() && locele->assign_effects.empty() && locels->add_effects.empty() && locels->del_effects.empty() && locels->forall_effects.empty() && locels->assign_effects.empty()) { delete locels; delete locele; return; }; } else { delete locelc; locelc = 0; }; if(locele->add_effects.empty() && locele->del_effects.empty() && locele->forall_effects.empty() //only start effs and goals && locele->assign_effects.empty() && gli->empty() && gle->empty()) { //goal_list * gls = new goal_list(); //handleDAgoals(ce->getCondition(),gls,0,0); cond_effect * nce = new cond_effect(new conj_goal(gls),locels); els->cond_effects.push_back(nce); delete locele; return; } else if(!(locels->add_effects.empty() && locels->del_effects.empty() && locels->forall_effects.empty() //if start effs and other effects && locels->assign_effects.empty())) { cond_effect * nce = new cond_effect(new conj_goal(gls),locels); els->cond_effects.push_back(nce); }; if(gls->empty() && gli->empty()) //only end cond and effs { delete gls; delete gli; cond_effect * nce = new cond_effect(new conj_goal(gle),locele); ele->cond_effects.push_back(nce); delete locels; return; }; Environment bs = buildBindings(da,*params); if(vars) { buildForAllCondActions(vld,da,params,gls,gli,gle,locels,locele,vars,vars->begin(),condActions,&bs); } else { condActions.push_back(new CondCommunicationAction(vld,da,params,gls,gli,gle,locels,locele)); } }; }; void Plan::planBuilder::handleDurativeAction(const durative_action * da,const const_symbol_list * params, double start,double duration,const plan_step * ps) { goal_list * gls = new goal_list(); goal_list * gle = new goal_list(); goal_list * gli = new goal_list(); conj_goal * cgs = new conj_goal(gls); conj_goal * cge = new conj_goal(gle); conj_goal * inv = new conj_goal(gli); handleDAgoals(da->precondition,gls,gli,gle); effect_lists * els = new effect_lists(); effect_lists * ele = new effect_lists(); effect_lists * elc = new effect_lists(); //cts effects handleDAeffects(da->effects,els,ele,elc); handleDAConditionalEffects hDAc = for_each(da->effects->cond_effects.begin(),da->effects->cond_effects.end(), handleDAConditionalEffects(vld,da,params,els,ele,elc)); // Conditional effects can appear in quantified effects, too.... // What we should do is to instantiate the quantified variables in all possible ways // and then create a conditional effect for each one. We only need to do it for the // conditional effects that spread across the span of the action. Others can be // handled as standard quantified conditional effects. hDAc = for_each(da->effects->forall_effects.begin(),da->effects->forall_effects.end(), hDAc); goal_list * ds = new goal_list(); goal_list * de = new goal_list(); if(const conj_goal * cg = dynamic_cast<const conj_goal *>(da->dur_constraint)) { for(goal_list::const_iterator i = cg->getGoals()->begin(); i != cg->getGoals()->end(); ++i) { if(const timed_goal * tg = dynamic_cast<const timed_goal *>(*i)) { switch(tg->getTime()) { case E_AT_START: ds->push_back(const_cast<goal*>(tg->getGoal())); continue; case E_AT_END: de->push_back(const_cast<goal*>(tg->getGoal())); continue; default: continue; }; }; }; } else { if(const timed_goal * tg = dynamic_cast<const timed_goal *>(da->dur_constraint)) { switch(tg->getTime()) { case E_AT_START: ds->push_back(const_cast<goal*>(tg->getGoal())); break; case E_AT_END: de->push_back(const_cast<goal*>(tg->getGoal())); break; default: break; }; }; }; action * das = new safeaction(da->name,da->parameters,cgs,els,da->symtab); action * dae = new safeaction(da->name,da->parameters,cge,ele,da->symtab); // Note that we must use safeactions here, to ensure that the actions we create don't // think they own their components for deletion. StartAction * sa = new StartAction(vld,das,params,inv,elc,duration,ds,hDAc.condActions,hDAc.ctsCondActions,ps); tas.push_back(make_pair(start,sa)); tas.push_back(make_pair(start+duration,new EndAction(vld,dae,params,sa,duration,de,ps))); }; void Plan::planBuilder::operator()(const plan_step * ps) { double t; if(ps->start_time_given) { t = ps->start_time; } else { t = defaultTime++; }; for(operator_list::const_iterator i = ops->begin();i != ops->end();++i) { if((*i)->name->getName() == ps->op_sym->getName()) { if(const action * a = dynamic_cast<const action *>(*i)) { tas.push_back(make_pair(t,new Action(vld,a,ps->params,ps))); return; }; if(const durative_action * da = dynamic_cast<const durative_action *>(*i)) { handleDurativeAction(da,ps->params,t,ps->duration,ps); return; }; if(Verbose) *report << "Unknown operator type in plan: " << (*i)->name->getName() << "\n"; BadOperator bo; throw bo; }; }; if(Verbose) *report << "No matching action defined for " << ps->op_sym->getName() << "\n"; BadOperator bo; throw bo; }; Polynomial getPoly(const expression * e,const ActiveCtsEffects * ace,const Environment & bs,CoScalar endInt) { if(const div_expression * fexpression = dynamic_cast<const div_expression *>(e)) { //return getPoly(dynamic_cast<const div_expression*>(e)->getLHS(),ace,state) / // getPoly(dynamic_cast<const div_expression*>(e)->getRHS(),ace,state); Polynomial numer = getPoly(fexpression->getLHS(),ace,bs,endInt); Polynomial denom = getPoly(fexpression->getRHS(),ace,bs,endInt); Polynomial poly; if(denom.getDegree() == 0) { poly = numer / denom.getCoeff(0); //beware if value is zero! } else { //throw not handled error or use quotient poly *report << "Quotient polynomials are not handled yet!\n"; SyntaxTooComplex stc; throw stc; }; return poly; }; if(dynamic_cast<const minus_expression *>(e)) { return getPoly(dynamic_cast<const minus_expression*>(e)->getLHS(),ace,bs,endInt) - getPoly(dynamic_cast<const minus_expression*>(e)->getRHS(),ace,bs,endInt); }; if(dynamic_cast<const mul_expression *>(e)) { return getPoly(dynamic_cast<const mul_expression*>(e)->getLHS(),ace,bs,endInt) * getPoly(dynamic_cast<const mul_expression*>(e)->getRHS(),ace,bs,endInt); }; if(dynamic_cast<const plus_expression *>(e)) { return getPoly(dynamic_cast<const plus_expression*>(e)->getLHS(),ace,bs,endInt) + getPoly(dynamic_cast<const plus_expression*>(e)->getRHS(),ace,bs,endInt); }; if(dynamic_cast<const num_expression*>(e)) { Polynomial constant; constant.setCoeff(0,dynamic_cast<const num_expression*>(e)->double_value()); return constant; }; if(dynamic_cast<const uminus_expression*>(e)) { return -(getPoly(dynamic_cast<const uminus_expression*>(e)->getExpr(),ace,bs,endInt)); }; if(const func_term * fexpression = dynamic_cast<const func_term *>(e)) { const FuncExp * fexp; fexp = ace->vld->fef.buildFuncExp(fexpression,bs); map<const FuncExp *,ActiveFE*>::const_iterator i = ace->activeFEs.find(fexp); if(i != ace->activeFEs.end()) { if(i->second->ctsFtn != 0) { if(dynamic_cast<const Polynomial *>(i->second->ctsFtn)) return * dynamic_cast<const Polynomial *>(i->second->ctsFtn); else if(dynamic_cast<const Exponential *>(i->second->ctsFtn)) //use approx poly { if(endInt != 0) return (dynamic_cast<const Exponential *>(i->second->ctsFtn))->getApproxPoly(endInt); else { UndefinedPolyError upe; throw upe; }; } else if(dynamic_cast<const NumericalSolution *>(i->second->ctsFtn)) { cout << *(i->second->ctsFtn) << "\n"; InvariantError ie; throw ie; }; } else { UndefinedPolyError upe; throw upe; }; } else { Polynomial constant; constant.setCoeff(0,fexp->evaluate(&(ace->vld->getState()))); return constant; }; }; if(const special_val_expr * sp = dynamic_cast<const special_val_expr *>(e)) { if(sp->getKind() == E_TOTAL_TIME) { Polynomial constant; if(ace->vld->durativePlan()) { constant.setCoeff(0,ace->ctsEffects.getTime() ); } else { constant.setCoeff(0,ace->vld->simpleLength()); }; return constant; }; if(sp->getKind() == E_DURATION_VAR) { Polynomial constant; constant.setCoeff(0,bs.duration); return constant; }; if(sp->getKind() == E_HASHT) { Polynomial timet; timet.setCoeff(1,1); return timet; } }; UnrecognisedCondition uc; throw uc; }; Polynomial getPoly(const expression * e,const ActiveCtsEffects * ace,const Environment * bs,CoScalar endInt) { return getPoly(e,ace,*bs,endInt); }; Polynomial getPoly(const expression * e,bool inc,const ActiveCtsEffects * ace,const Environment & bs,CoScalar endInt) { if(inc) return getPoly(e,ace,bs,endInt); return - getPoly(e,ace,bs,endInt); }; Polynomial getPoly(const expression * e,bool inc,const ActiveCtsEffects * ace,const Environment * bs,CoScalar endInt) { return getPoly(e,inc,ace,*bs,endInt); }; double Plan::timeOf(const Action * a) const { for(HappeningSeq::const_iterator h = happenings.begin();h != happenings.end();++h) { if(find((*h)->getActions()->begin(),(*h)->getActions()->end(),a) != (*h)->getActions()->end()) { //cout << "Time of " << *a << " is " << (*h)->getTime() << "\n"; return (*h)->getTime(); }; }; return 0; }; void Plan::show(ostream & o) const { for(HappeningSeq::const_iterator i = getFirstHappening();i != getEndHappening();++i) { o << *i << "\n"; }; }; void Plan::addHappening(Happening * h) { happenings.push_back(h); }; };
27.800257
170
0.596412
[ "vector", "transform" ]
a7d2eeaed9969d18ea632f408be79e9dd7ef9888
123
cpp
C++
Day18/assignment1/test.cpp
yongsenliu/cxxBootCamp2021
95adfe1a0ec0dc16448dcc44590b3e9d1f00f186
[ "MIT" ]
null
null
null
Day18/assignment1/test.cpp
yongsenliu/cxxBootCamp2021
95adfe1a0ec0dc16448dcc44590b3e9d1f00f186
[ "MIT" ]
1
2021-11-08T12:44:38.000Z
2021-11-10T00:04:10.000Z
Day18/assignment1/test.cpp
yongsenliu/cxxBootCamp2021
95adfe1a0ec0dc16448dcc44590b3e9d1f00f186
[ "MIT" ]
null
null
null
#include "shape.h" int main() { Circle * circ = new Circle(5); circ->print(); delete circ; //return 0; }
12.3
34
0.536585
[ "shape" ]
a7d5673b9580f71cf11cbf44ddf8a296872fe18e
152,514
cpp
C++
core/engine/engine.cpp
neonkingfr/QuadRayC
07a7056c8bda380dc186502a94a6ca354bf2c1c9
[ "MIT" ]
null
null
null
core/engine/engine.cpp
neonkingfr/QuadRayC
07a7056c8bda380dc186502a94a6ca354bf2c1c9
[ "MIT" ]
null
null
null
core/engine/engine.cpp
neonkingfr/QuadRayC
07a7056c8bda380dc186502a94a6ca354bf2c1c9
[ "MIT" ]
null
null
null
/******************************************************************************/ /* Copyright (c) 2013-2022 VectorChief (at github, bitbucket, sourceforge) */ /* Distributed under the MIT software license, see the accompanying */ /* file COPYING or http://www.opensource.org/licenses/mit-license.php */ /******************************************************************************/ #include <string.h> #include "engine.h" #include "rtimag.h" /******************************************************************************/ /********************************* LEGEND *********************************/ /******************************************************************************/ /* * engine.cpp: Implementation of the scene manager. * * Main file of the engine responsible for instantiating and managing scenes. * It contains definitions of Platform, SceneThread and Scene classes along with * a set of algorithms needed to process objects in the scene in order * to prepare data structures used by the rendering backend (tracer.cpp). * * Processing of objects consists of two major steps: update and render, * of which only update is handled by the engine, while render is delegated * to the rendering backend once all data structures have been prepared. * * Update in turn consists of five phases: * 0.5 phase (sequential) - hierarchical update of arrays' transform matrices * 1st phase (multi-threaded) - update surfaces' transform matrices, data fields * 2nd phase (multi-threaded) - update surfaces' clip lists, bounds, tile lists * 2.5 phase (sequential) - hierarchical update of arrays' bounds from surfaces * 3rd phase (multi-threaded) - build updated cross-surface lists * * Some parts of the update are handled by the object hierarchy (object.cpp), * while engine performs building of surface's node, clip and tile lists, * custom per-side light/shadow and reflection/refraction surface lists. * * Both update and render support multi-threading and use array of SceneThread * objects to separate working datasets and therefore avoid thread locking. */ /******************************************************************************/ /****************************** STATE-LOGGING *****************************/ /******************************************************************************/ #define RT_PRINT_STATE_INIT() \ RT_LOGI("*********************************************"); \ RT_LOGI("*********************************************"); \ RT_LOGI("*********************************************"); \ RT_LOGI("\n"); \ RT_LOGI("*********************************************"); \ RT_LOGI("************** print state init *************"); \ RT_LOGI("*********************************************"); \ RT_LOGI("\n"); \ RT_LOGI("*********************************************"); \ RT_LOGI("*********************************************"); \ RT_LOGI("*********************************************"); \ RT_LOGI("\n"); \ RT_LOGI("\n") #define RT_PRINT_TIME(time) \ RT_LOGI("---------------------------------------------"); \ RT_LOGI("---- update time -- %020" PR_Z "d ----", time); \ RT_LOGI("---------------------------------------------"); \ RT_LOGI("\n"); \ RT_LOGI("\n") #define RT_PRINT_GLB() \ RT_LOGI("*********************************************"); \ RT_LOGI("*********************************************"); \ RT_LOGI("*********************************************"); \ RT_LOGI("\n"); \ RT_LOGI("*********************************************"); \ RT_LOGI("******************* GLOBAL ******************"); \ RT_LOGI("*********************************************"); \ RT_LOGI("\n"); \ RT_LOGI("*********************************************"); \ RT_LOGI("*********************************************"); \ RT_LOGI("*********************************************"); \ RT_LOGI("\n"); \ RT_LOGI("\n") /* * Print camera properties. */ static rt_void print_cam(rt_pstr mgn, rt_ELEM *elm, rt_Object *obj) { RT_LOGI("%s", mgn); RT_LOGI("cam: %08X, ", (rt_word)obj); if (obj != RT_NULL) { RT_LOGI(" "); RT_LOGI("rot: {%+.25e, %+.25e, %+.25e}\n", obj->trm->rot[RT_X], obj->trm->rot[RT_Y], obj->trm->rot[RT_Z]); RT_LOGI("%s", mgn); RT_LOGI(" "); RT_LOGI(" "); RT_LOGI("pos: {%+.25e, %+.25e, %+.25e}", obj->trm->pos[RT_X], obj->trm->pos[RT_Y], obj->trm->pos[RT_Z]); } else { RT_LOGI("%s", mgn); RT_LOGI(" "); RT_LOGI(" "); RT_LOGI("empty object"); } RT_LOGI("\n"); } #define RT_PRINT_CAM(cam) \ RT_LOGI("*********************************************"); \ RT_LOGI("*********************************************"); \ RT_LOGI("*********************************************"); \ RT_LOGI("\n"); \ RT_LOGI("*********************************************"); \ RT_LOGI("******************* CAMERA ******************"); \ RT_LOGI("*********************************************"); \ RT_LOGI("\n"); \ RT_LOGI("*********************************************"); \ RT_LOGI("*********************************************"); \ RT_LOGI("*********************************************"); \ RT_LOGI("\n"); \ RT_LOGI("\n"); \ print_cam(" ", RT_NULL, cam); \ RT_LOGI("\n") /* * Print light properties. */ static rt_void print_lgt(rt_pstr mgn, rt_ELEM *elm, rt_Object *obj) { RT_LOGI("%s", mgn); RT_LOGI("lgt: %08X, ", (rt_word)obj); if (obj != RT_NULL) { RT_LOGI(" "); RT_LOGI(" "); RT_LOGI(" "); RT_LOGI("pos: {%+12.6f,%+12.6f,%+12.6f} rad: %7.2f", obj->pos[RT_X], obj->pos[RT_Y], obj->pos[RT_Z], obj->bvbox->rad); } else { RT_LOGI(" "); RT_LOGI("empty object"); } RT_LOGI("\n"); } #define RT_PRINT_LGT(elm, lgt) \ RT_LOGI("---------------------------------------------"); \ RT_LOGI("-------------------- lgt --------------------"); \ RT_LOGI("---------------------------------------------"); \ RT_LOGI("\n"); \ RT_LOGI("\n"); \ print_lgt(" ", elm, lgt); \ RT_LOGI("\n") #define RT_PRINT_LGT_INNER(elm, lgt) \ RT_LOGI("---------------------------------------------"); \ RT_LOGI("-------------------- lgt - inner ------------"); \ RT_LOGI("---------------------------------------------"); \ RT_LOGI("\n"); \ RT_LOGI("\n"); \ print_lgt(" ", elm, lgt); \ RT_LOGI("\n") #define RT_PRINT_LGT_OUTER(elm, lgt) \ RT_LOGI("---------------------------------------------"); \ RT_LOGI("-------------------- lgt - outer ------------"); \ RT_LOGI("---------------------------------------------"); \ RT_LOGI("\n"); \ RT_LOGI("\n"); \ print_lgt(" ", elm, lgt); \ RT_LOGI("\n") static rt_pstr tags[RT_TAG_SURFACE_MAX] = { "PL", "CL", "SP", "CN", "PB", "HB", "PC", "HC", "HP" }; static rt_pstr nodes[] = { "tr", "bv", "xx", "xx", }; static rt_pstr sides[] = { "out of range", "data = inner", "data = 0 ", "data = outer", "out of range", }; static rt_pstr markers[] = { "out of range", "accum marker: enter", "empty object", "accum marker: leave", "out of range", }; /* * Print surface/array properties. */ static rt_void print_obj(rt_pstr mgn, rt_ELEM *elm, rt_Object *obj) { RT_LOGI("%s", mgn); rt_cell d = elm != RT_NULL ? elm->data : 0; rt_cell i = RT_MAX(0, d + 2), t = RT_GET_FLG(d); rt_real r = 0.0f; if (elm != RT_NULL && elm->temp != RT_NULL) { r = ((rt_BOUND *)elm->temp)->rad; } if (obj != RT_NULL) { if (RT_IS_ARRAY(obj)) { RT_LOGI("arr: %08X, ", (rt_word)obj); RT_LOGI(" "); RT_LOGI("tag: AR, trm: %d, flg: %02X, data = %08X %s ", obj->obj_has_trm, elm != RT_NULL && elm->temp != RT_NULL ? ((rt_BOUND *)elm->temp)->flm : 0, ((rt_BOUND *)RT_GET_PTR(d)->temp)->obj, nodes[t]); } else { RT_LOGI("srf: %08X, ", (rt_word)obj); RT_LOGI(" "); RT_LOGI("tag: %s, trm: %d, flg: %02X, %s ", tags[obj->tag], obj->obj_has_trm, elm != RT_NULL && elm->temp != RT_NULL ? ((rt_BOUND *)elm->temp)->flm : 0, sides[RT_MIN(i, RT_ARR_SIZE(sides) - 1)]); r = obj->bvbox->rad; } RT_LOGI(" "); RT_LOGI("pos: {%+12.6f,%+12.6f,%+12.6f} rad: %7.2f", obj->pos[RT_X], obj->pos[RT_Y], obj->pos[RT_Z], r); } else { RT_LOGI("obj: %08X, ", (rt_word)obj); RT_LOGI(" "); RT_LOGI("%s", markers[RT_MIN(i, RT_ARR_SIZE(markers) - 1)]); } RT_LOGI("\n"); } #define RT_PRINT_SRF(srf) \ RT_LOGI("*********************************************"); \ RT_LOGI("*********************************************"); \ RT_LOGI("*********************************************"); \ RT_LOGI("\n"); \ RT_LOGI("*********************************************"); \ RT_LOGI("****************** SURFACE ******************"); \ RT_LOGI("*********************************************"); \ RT_LOGI("\n"); \ RT_LOGI("*********************************************"); \ RT_LOGI("*********************************************"); \ RT_LOGI("*********************************************"); \ RT_LOGI("\n"); \ RT_LOGI("\n"); \ print_obj(" ", RT_NULL, srf); \ RT_LOGI("\n") /* * Print list of objects. */ static rt_void print_lst(rt_pstr mgn, rt_ELEM *elm) { for (; elm != RT_NULL; elm = elm->next) { rt_Object *obj = elm->temp == RT_NULL ? RT_NULL : (rt_Object *)((rt_BOUND *)elm->temp)->obj; if (obj != RT_NULL && RT_IS_LIGHT(obj)) { print_lgt(mgn, elm, obj); } else { print_obj(mgn, elm, obj); } } } #define RT_PRINT_CLP(lst) \ RT_LOGI("---------------------------------------------"); \ RT_LOGI("-------------------- clp --------------------"); \ RT_LOGI("---------------------------------------------"); \ RT_LOGI("\n"); \ RT_LOGI("\n"); \ print_lst(" ", lst); \ RT_LOGI("\n") #define RT_PRINT_LST(lst) \ RT_LOGI("---------------------------------------------"); \ RT_LOGI("-------------------- lst --------------------"); \ RT_LOGI("---------------------------------------------"); \ RT_LOGI("\n"); \ RT_LOGI("\n"); \ print_lst(" ", lst); \ RT_LOGI("\n") #define RT_PRINT_LST_INNER(lst) \ RT_LOGI("---------------------------------------------"); \ RT_LOGI("-------------------- lst - inner ------------"); \ RT_LOGI("---------------------------------------------"); \ RT_LOGI("\n"); \ RT_LOGI("\n"); \ print_lst(" ", lst); \ RT_LOGI("\n") #define RT_PRINT_LST_OUTER(lst) \ RT_LOGI("---------------------------------------------"); \ RT_LOGI("-------------------- lst - outer ------------"); \ RT_LOGI("---------------------------------------------"); \ RT_LOGI("\n"); \ RT_LOGI("\n"); \ print_lst(" ", lst); \ RT_LOGI("\n") #define RT_PRINT_SHW(lst) \ RT_LOGI("---------------------------------------------"); \ RT_LOGI("-------------------- shw --------------------"); \ RT_LOGI("---------------------------------------------"); \ RT_LOGI("\n"); \ RT_LOGI("\n"); \ print_lst(" ", lst); \ RT_LOGI("\n") #define RT_PRINT_SHW_INNER(lst) \ RT_LOGI("---------------------------------------------"); \ RT_LOGI("-------------------- shw - inner ------------"); \ RT_LOGI("---------------------------------------------"); \ RT_LOGI("\n"); \ RT_LOGI("\n"); \ print_lst(" ", lst); \ RT_LOGI("\n") #define RT_PRINT_SHW_OUTER(lst) \ RT_LOGI("---------------------------------------------"); \ RT_LOGI("-------------------- shw - outer ------------"); \ RT_LOGI("---------------------------------------------"); \ RT_LOGI("\n"); \ RT_LOGI("\n"); \ print_lst(" ", lst); \ RT_LOGI("\n") #define RT_PRINT_LGT_LST(lst) \ RT_LOGI("---------------------------------------------"); \ RT_LOGI("-------------------- lgt --------------------"); \ RT_LOGI("---------------------------------------------"); \ RT_LOGI("\n"); \ RT_LOGI("\n"); \ print_lst(" ", lst); \ RT_LOGI("\n") #define RT_PRINT_SRF_LST(lst) \ RT_LOGI("---------------------------------------------"); \ RT_LOGI("-------------------- srf --------------------"); \ RT_LOGI("---------------------------------------------"); \ RT_LOGI("\n"); \ RT_LOGI("\n"); \ print_lst(" ", lst); \ RT_LOGI("\n") #define RT_PRINT_TLS_LST(lst, i, j) \ RT_LOGI("*********************************************"); \ RT_LOGI("*********************************************"); \ RT_LOGI("*********************************************"); \ RT_LOGI("\n"); \ RT_LOGI("*********************************************"); \ RT_LOGI("********* screen tiles[%2d][%2d] list: ********", i, j); \ RT_LOGI("*********************************************"); \ RT_LOGI("\n"); \ RT_LOGI("*********************************************"); \ RT_LOGI("*********************************************"); \ RT_LOGI("*********************************************"); \ RT_LOGI("\n"); \ RT_LOGI("\n"); \ print_lst(" ", lst); \ RT_LOGI("\n") #define RT_PRINT_STATE_DONE() \ RT_LOGI("*********************************************"); \ RT_LOGI("*********************************************"); \ RT_LOGI("*********************************************"); \ RT_LOGI("\n"); \ RT_LOGI("*********************************************"); \ RT_LOGI("************** print state done *************"); \ RT_LOGI("*********************************************"); \ RT_LOGI("\n"); \ RT_LOGI("*********************************************"); \ RT_LOGI("*********************************************"); \ RT_LOGI("*********************************************"); \ RT_LOGI("\n") /******************************************************************************/ /***************************** MULTI-THREADING ****************************/ /******************************************************************************/ /* * Initialize platform-specific pool of "thnum" threads (< 0 - no feedback). * Local stub below is used when platform threading functions are not provided * or during state-logging. */ static rt_void* init_threads(rt_si32 thnum, rt_Platform *pfm) { if (thnum > 0) { pfm->set_thnum(thnum); /* dummy feedback, pass core-count in platform */ } return pfm; } /* * Terminate platform-specific pool of "thnum" threads. * Local stub below is used when platform threading functions are not provided * or during state-logging. */ static rt_void term_threads(rt_void *tdata, rt_si32 thnum) { } /* * Task platform-specific pool of "thnum" threads to update scene, * block until finished. * Local stub below is used when platform threading functions are not provided * or during state-logging. Simulate threading with sequential run. */ static rt_void update_scene(rt_void *tdata, rt_si32 thnum, rt_si32 phase) { rt_Scene *scn; if (thnum < 0) { scn = (rt_Scene *)tdata; thnum = -thnum; } else { scn = ((rt_Platform *)tdata)->get_cur_scene(); } rt_si32 i; for (i = 0; i < thnum; i++) { scn->update_slice(i, phase); } } /* * Task platform-specific pool of "thnum" threads to render scene, * block until finished. * Local stub below is used when platform threading functions are not provided * or during state-logging. Simulate threading with sequential run. */ static rt_void render_scene(rt_void *tdata, rt_si32 thnum, rt_si32 phase) { rt_Scene *scn; if (thnum < 0) { scn = (rt_Scene *)tdata; thnum = -thnum; } else { scn = ((rt_Platform *)tdata)->get_cur_scene(); } rt_si32 i; for (i = 0; i < thnum; i++) { scn->render_slice(i, phase); } } /* * Instantiate platform. * Can only be called from single (main) thread. */ rt_Platform::rt_Platform(rt_FUNC_ALLOC f_alloc, rt_FUNC_FREE f_free, rt_si32 thnum, /* (< 0 - no feedback) */ rt_FUNC_INIT f_init, rt_FUNC_TERM f_term, rt_FUNC_UPDATE f_update, rt_FUNC_RENDER f_render, rt_FUNC_PRINT_LOG f_print_log, /* has global scope */ rt_FUNC_PRINT_ERR f_print_err) : /* has global scope */ rt_LogRedirect(f_print_log, f_print_err), /* must be 1st in platform init */ rt_Heap(f_alloc, f_free) { /* init scene list variables */ head = tail = cur = RT_NULL; /* allocate root SIMD structure */ s_inf = (rt_SIMD_INFOX *) alloc(sizeof(rt_SIMD_INFOX), RT_SIMD_ALIGN); memset(s_inf, 0, sizeof(rt_SIMD_INFOX)); /* allocate regs SIMD structure */ rt_SIMD_REGS *s_reg = (rt_SIMD_REGS *) alloc(sizeof(rt_SIMD_REGS), RT_SIMD_ALIGN); ASM_INIT(s_inf, s_reg) /* init thread management functions */ if (f_init != RT_NULL && f_term != RT_NULL && f_update != RT_NULL && f_render != RT_NULL) { this->f_init = f_init; this->f_term = f_term; this->f_update = f_update; this->f_render = f_render; } else { this->f_init = init_threads; this->f_term = term_threads; this->f_update = update_scene; this->f_render = render_scene; } /* init thread management variables */ thnum = thnum != 0 ? thnum : 1; this->thnum = thnum < 0 ? thnum : -thnum; /* always < 0 at first init */ this->tdata = RT_NULL; /* create platform-specific worker threads */ tdata = this->f_init(thnum, this); thnum = this->thnum; this->thnum = thnum < 0 ? -thnum : thnum; /* always > 0 upon feedback */ /* init tile dimensions */ tile_w = RT_MAX(RT_TILE_W, 1); tile_h = RT_MAX(RT_TILE_H, 1); tile_w = ((tile_w + RT_SIMD_WIDTH - 1) / RT_SIMD_WIDTH) * RT_SIMD_WIDTH; /* init rendering backend, * default SIMD runtime target will be chosen */ fsaa = RT_FSAA_NO; set_simd(0); } /* * Get platform's thread-pool size. */ rt_si32 rt_Platform::get_thnum() { return thnum; } /* * Set platform's thread-pool size (only once after platform's construction). */ rt_si32 rt_Platform::set_thnum(rt_si32 thnum) { if (this->thnum < 0) { this->thnum = thnum; } return this->thnum; } /* * Initialize SIMD target-selection variable from parameters. */ rt_si32 simd_init(rt_si32 n_simd, rt_si32 s_type, rt_si32 k_size) { /* ------ k_size ------- s_type ------- n_simd ------ */ return (k_size << 16) | (s_type << 8) | (n_simd); } /* * When ASM sections are used together with non-trivial logic written in C/C++ * in the same function, optimizing compilers may produce inconsistent results * with optimization levels higher than O0 (tested both clang and g++). * Using separate functions for ASM and C/C++ resolves the issue * if the ASM function is not inlined (thus keeping it in a separate file). */ rt_void simd_version(rt_SIMD_INFOX *s_inf) { ASM_ENTER(s_inf) verxx_xx() ASM_LEAVE(s_inf) } /* * Set current runtime SIMD target with "simd" equal to * SIMD native-size (1,..,16) in 0th (lowest) byte * SIMD type (1,2,4,8, 16,32) in 1st (higher) byte * SIMD size-factor (1, 2, 4) in 2nd (higher) byte */ rt_si32 rt_Platform::set_simd(rt_si32 simd) { simd = switch0(s_inf, simd); simd_quads = (simd & 0xFF) * ((simd >> 16) & 0xFF); simd_width = (simd_quads * 128) / RT_ELEMENT; /* code below blocks SIMD target switch if incompatible with current AA */ rt_si32 fsaa = this->fsaa; set_fsaa(fsaa); if (this->fsaa != fsaa) { this->fsaa = fsaa; simd = this->simd; simd = switch0(s_inf, simd); simd_quads = (simd & 0xFF) * ((simd >> 16) & 0xFF); simd_width = (simd_quads * 128) / RT_ELEMENT; } /* code above blocks SIMD target switch if incompatible with current AA */ this->simd = simd; return simd; } /* * Set current antialiasing mode. */ rt_si32 rt_Platform::set_fsaa(rt_si32 fsaa) { if (fsaa > get_fsaa_max()) { fsaa = get_fsaa_max(); } this->fsaa = fsaa; return fsaa; } /* * Get current antialiasing mode. */ rt_si32 rt_Platform::get_fsaa() { return fsaa; } /* * Get maximmum antialiasing mode * for chosen SIMD target. */ rt_si32 rt_Platform::get_fsaa_max() { if (simd_width >= 8) { return RT_FSAA_4X; /* 8X is reserved */ } else if (simd_width >= 4) { return RT_FSAA_4X; /* 2X alternating */ } return RT_FSAA_NO; } /* * Return tile width in pixels. */ rt_si32 rt_Platform::get_tile_w() { return tile_w; } /* * Add given "scn" to platform's scene list. */ rt_void rt_Platform::add_scene(rt_Scene *scn) { if (head == RT_NULL) { head = tail = cur = scn; } else { tail->next = scn; tail = cur = scn; } scn->next = RT_NULL; } /* * Delete given "scn" from platform's scene list. */ rt_void rt_Platform::del_scene(rt_Scene *scn) { rt_Scene **ptr = &head, *prev = RT_NULL; while (*ptr != RT_NULL) { if (*ptr == scn) { *ptr = scn->next; break; } prev = *ptr; ptr = &prev->next; } if (tail == scn) { tail = prev; } if (cur == scn) { cur = head; } } /* * Return current scene in the list. */ rt_Scene* rt_Platform::get_cur_scene() { return cur; } /* * Set and return current scene in the list. */ rt_Scene* rt_Platform::set_cur_scene(rt_Scene *scn) { rt_Scene *cur = head; while (cur != RT_NULL) { if (cur == scn) { this->cur = cur; break; } cur = cur->next; } return cur; } /* * Select next scene in the list as current. */ rt_void rt_Platform::next_scene() { if (cur != RT_NULL) { if (cur->next != RT_NULL) { cur = cur->next; } else { cur = head; } } } /* * Deinitialize platform. */ rt_Platform::~rt_Platform() { while (head != RT_NULL) { delete head; /* calls del_scene(head) replacing it with next */ } /* destroy platform-specific worker threads */ this->f_term(tdata, thnum); ASM_DONE(s_inf) } /******************************************************************************/ /********************************* THREAD *********************************/ /******************************************************************************/ /* * Allocate scene thread in custom heap. */ rt_pntr rt_SceneThread::operator new(size_t size, rt_Heap *hp) { return hp->alloc(size, RT_ALIGN); } rt_void rt_SceneThread::operator delete(rt_pntr ptr) { } /* * Instantiate scene thread. */ rt_SceneThread::rt_SceneThread(rt_Scene *scene, rt_si32 index) : rt_Heap(scene->f_alloc, scene->f_free) { this->scene = scene; this->index = index; /* allocate root SIMD structure */ s_inf = (rt_SIMD_INFOX *) alloc(sizeof(rt_SIMD_INFOX), RT_SIMD_ALIGN); memset(s_inf, 0, sizeof(rt_SIMD_INFOX)); /* allocate regs SIMD structure */ rt_SIMD_REGS *s_reg = (rt_SIMD_REGS *) alloc(sizeof(rt_SIMD_REGS), RT_SIMD_ALIGN); ASM_INIT(s_inf, s_reg) /* init framebuffer's dimensions and pointer */ s_inf->frm_w = scene->x_res; s_inf->frm_h = scene->y_res; s_inf->frm_row = scene->x_row; s_inf->frame = scene->frame; /* init tilebuffer's dimensions and pointer */ s_inf->tile_w = scene->pfm->tile_w; s_inf->tile_h = scene->pfm->tile_h; s_inf->tls_row = scene->tiles_in_row; s_inf->tiles = scene->tiles; /* init framebuffer's color-planes for path-tracer */ s_inf->ptr_r = scene->ptr_r; s_inf->ptr_g = scene->ptr_g; s_inf->ptr_b = scene->ptr_b; s_inf->pt_on = scene->pt_on; #if RT_PRNG == LCG16 /* init PRNG's constants (32-bit LCG) */ s_inf->pseed = scene->pseed; /* ptr to buffer of PRNG's 32-bit seed */ RT_SIMD_SET(s_inf->prngf, (rt_uelm)214013); /* PRNG's 32-bit factor */ RT_SIMD_SET(s_inf->prnga, (rt_uelm)2531011); /* PRNG's 32-bit addend */ RT_SIMD_SET(s_inf->prngm, (rt_uelm)0xFFFF); /* PRNG's 16-bit mask */ #elif RT_PRNG == LCG24 /* init PRNG's constants (32-bit LCG) */ s_inf->pseed = scene->pseed; /* ptr to buffer of PRNG's 32-bit seed */ RT_SIMD_SET(s_inf->prngf, (rt_uelm)214013); /* PRNG's 32-bit factor */ RT_SIMD_SET(s_inf->prnga, (rt_uelm)2531011); /* PRNG's 32-bit addend */ RT_SIMD_SET(s_inf->prngm, (rt_uelm)0xFFFFFF); /* PRNG's 24-bit mask */ #elif RT_PRNG == LCG32 /* init PRNG's constants (32-bit LCG) */ s_inf->pseed = scene->pseed; /* ptr to buffer of PRNG's 32-bit seed */ RT_SIMD_SET(s_inf->prngf, (rt_uelm)214013); /* PRNG's 32-bit factor */ RT_SIMD_SET(s_inf->prnga, (rt_uelm)2531011); /* PRNG's 32-bit addend */ RT_SIMD_SET(s_inf->prngm, (rt_uelm)0xFFFFFFFF); /* PRNG's 32-bit mask */ #elif RT_PRNG == LCG48 /* init PRNG's constants (48-bit LCG) */ s_inf->pseed = scene->pseed; /* ptr to buffer of PRNG's 48-bit seed */ RT_SIMD_SET(s_inf->prngf, (rt_uelm)LL(25214903917)); /* 48-bit factor */ RT_SIMD_SET(s_inf->prnga, (rt_uelm)LL(11)); /* PRNG's 48-bit addend */ RT_SIMD_SET(s_inf->prngm, (rt_uelm)LL(0x0000FFFFFFFFFFFF)); /* mask */ #endif /* RT_PRNG */ /* init power series constants for sin, cos */ RT_SIMD_SET(s_inf->sin_3, -0.1666666666666666666666666666666666666666666); RT_SIMD_SET(s_inf->sin_5, +0.0083333333333333333333333333333333333333333); RT_SIMD_SET(s_inf->sin_7, -0.0001984126984126984126984126984126984126984); RT_SIMD_SET(s_inf->sin_9, +0.0000027557319223985890652557319223985890652); RT_SIMD_SET(s_inf->cos_4, +0.0416666666666666666666666666666666666666666); RT_SIMD_SET(s_inf->cos_6, -0.0013888888888888888888888888888888888888888); RT_SIMD_SET(s_inf->cos_8, +0.0000248015873015873015873015873015873015873); #if RT_DEBUG >= 1 /* init polynomial constants for asin, acos */ RT_SIMD_SET(s_inf->asn_1, -0.0187293); RT_SIMD_SET(s_inf->asn_2, +0.0742610); RT_SIMD_SET(s_inf->asn_3, -0.2121144); RT_SIMD_SET(s_inf->asn_4, +1.5707288); RT_SIMD_SET(s_inf->tmp_1, +RT_PI_2); #endif /* RT_DEBUG >= 1 */ /* allocate cam SIMD structure */ s_cam = (rt_SIMD_CAMERA *) alloc(sizeof(rt_SIMD_CAMERA), RT_SIMD_ALIGN); memset(s_cam, 0, sizeof(rt_SIMD_CAMERA)); /* allocate ctx SIMD structure */ s_ctx = (rt_SIMD_CONTEXT *) alloc(sizeof(rt_SIMD_CONTEXT) + /* +1 context step for shadows */ RT_STACK_STEP * (1 + scene->depth), RT_SIMD_ALIGN); memset(s_ctx, 0, sizeof(rt_SIMD_CONTEXT)); /* init memory pool in the heap for temporary per-frame allocs */ mpool = RT_NULL; /* estimates are done in Scene once all counters have been initialized */ msize = 0; /* allocate misc arrays for tiling */ txmin = (rt_si32 *)alloc(sizeof(rt_si32) * scene->tiles_in_col, RT_ALIGN); txmax = (rt_si32 *)alloc(sizeof(rt_si32) * scene->tiles_in_col, RT_ALIGN); verts = (rt_VERT *)alloc(sizeof(rt_VERT) * (2 * RT_VERTS_LIMIT + RT_EDGES_LIMIT), RT_ALIGN); } #define RT_UPDATE_TILES_BOUNDS(cy, x1, x2) \ do \ { \ if (x1 < x2) \ { \ if (txmin[cy] > x1) \ { \ txmin[cy] = RT_MAX(x1, xmin); \ } \ if (txmax[cy] < x2) \ { \ txmax[cy] = RT_MIN(x2, xmax); \ } \ } \ else \ { \ if (txmin[cy] > x2) \ { \ txmin[cy] = RT_MAX(x2, xmin); \ } \ if (txmax[cy] < x1) \ { \ txmax[cy] = RT_MIN(x1, xmax); \ } \ } \ } \ while (0) /* "do {...} while (0)" to enforce semicolon ";" at the end */ /* * Update surface's projected bbox boundaries in the tilebuffer * by processing one bbox edge at a time, bbox faces are not used. * The tilebuffer is reset for every surface from outside of this function. */ rt_void rt_SceneThread::tiling(rt_vec2 p1, rt_vec2 p2) { rt_real *pt, n1[3][2], n2[3][2]; rt_real dx, dy, xx, yy, rt, px; rt_si32 x1, y1, x2, y2, i, n, t; /* swap points vertically if needed */ if (p1[RT_Y] > p2[RT_Y]) { pt = p1; p1 = p2; p2 = pt; } /* initialize delta variables */ dx = p2[RT_X] - p1[RT_X]; dy = p2[RT_Y] - p1[RT_Y]; /* prepare new lines with margins */ if ((RT_FABS(dx) <= RT_LINE_THRESHOLD) && (RT_FABS(dy) <= RT_LINE_THRESHOLD)) { rt = 0.0f; xx = dx < 0.0f ? -1.0f : 1.0f; yy = 1.0f; } else if ((RT_FABS(dx) <= RT_LINE_THRESHOLD) || (RT_FABS(dy) <= RT_LINE_THRESHOLD)) { rt = 0.0f; xx = dx; yy = dy; } else { rt = dx / dy; xx = dx; yy = dy; } #if RT_OPTS_TILING_EXT1 != 0 if ((scene->opts & RT_OPTS_TILING_EXT1) != 0) { px = RT_TILE_THRESHOLD / RT_SQRT(xx * xx + yy * yy); xx *= px; yy *= px; n1[0][RT_X] = p1[RT_X] - xx; n1[0][RT_Y] = p1[RT_Y] - yy; n2[0][RT_X] = p2[RT_X] + xx; n2[0][RT_Y] = p2[RT_Y] + yy; n1[1][RT_X] = n1[0][RT_X] - yy; n1[1][RT_Y] = n1[0][RT_Y] + xx; n2[1][RT_X] = n2[0][RT_X] - yy; n2[1][RT_Y] = n2[0][RT_Y] + xx; n1[2][RT_X] = n1[0][RT_X] + yy; n1[2][RT_Y] = n1[0][RT_Y] - xx; n2[2][RT_X] = n2[0][RT_X] + yy; n2[2][RT_Y] = n2[0][RT_Y] - xx; n = 3; } else #endif /* RT_OPTS_TILING_EXT1 */ { n1[0][RT_X] = p1[RT_X]; n1[0][RT_Y] = p1[RT_Y]; n2[0][RT_X] = p2[RT_X]; n2[0][RT_Y] = p2[RT_Y]; n = 1; } /* set inclusive bounds */ rt_si32 xmin = 0; rt_si32 ymin = 0; rt_si32 xmax = scene->tiles_in_row - 1; rt_si32 ymax = scene->tiles_in_col - 1; for (i = 0; i < n; i++) { /* calculate points floor */ x1 = (rt_si32)RT_FLOOR(n1[i][RT_X]); y1 = (rt_si32)RT_FLOOR(n1[i][RT_Y]); x2 = (rt_si32)RT_FLOOR(n2[i][RT_X]); y2 = (rt_si32)RT_FLOOR(n2[i][RT_Y]); /* reject y-outer lines */ if (y1 > ymax || y2 < ymin) { continue; } /* process nearly vertical, nearly horizontal or x-outer line */ if ((x1 == x2 || y1 == y2 || rt == 0.0f) || (x1 < xmin && x2 < xmin) || (x1 > xmax && x2 > xmax)) { if (y1 < ymin) { y1 = ymin; } if (y2 > ymax) { y2 = ymax; } for (t = y1; t <= y2; t++) { RT_UPDATE_TILES_BOUNDS(t, x1, x2); } continue; } /* process regular line */ y1 = y1 < ymin ? ymin : y1 + 1; y2 = y2 > ymax ? ymax : y2 - 1; px = n1[i][RT_X] + (y1 - n1[i][RT_Y]) * rt; x2 = (rt_si32)RT_FLOOR(px); if (y1 > ymin) { RT_UPDATE_TILES_BOUNDS(y1 - 1, x1, x2); } x1 = x2; for (t = y1; t <= y2; t++) { px = px + rt; x2 = (rt_si32)RT_FLOOR(px); RT_UPDATE_TILES_BOUNDS(t, x1, x2); x1 = x2; } if (y2 < ymax) { x2 = (rt_si32)RT_FLOOR(n2[i][RT_X]); RT_UPDATE_TILES_BOUNDS(y2 + 1, x1, x2); } } } /* * Insert new element derived from "tem" to a list "ptr" * for a given object "obj". If "tem" is NULL and "obj" is LIGHT, * insert new element derived from "obj" to a list "ptr". * Return outer-most new element (not always list's head) * or NULL if new element is removed (fully obscured by other elements). */ rt_ELEM* rt_SceneThread::insert(rt_Object *obj, rt_ELEM **ptr, rt_ELEM *tem) { rt_ELEM *elm = RT_NULL, *nxt; if (tem == RT_NULL && obj != RT_NULL && RT_IS_LIGHT(obj)) { rt_Light *lgt = (rt_Light *)obj; /* alloc new element for "lgt" */ elm = (rt_ELEM *)alloc(sizeof(rt_ELEM), RT_QUAD_ALIGN); elm->data = (rt_cell)scene->slist; /* all srf are potential shadows */ elm->simd = lgt->s_lgt; elm->temp = lgt->bvbox; /* insert element as list's head */ elm->next = *ptr; *ptr = elm; } if (tem == RT_NULL) { return elm; } /* only node elements are allowed in surface lists */ rt_Node *nd = (rt_Node *)((rt_BOUND *)tem->temp)->obj; /* alloc new element from template "tem" */ elm = (rt_ELEM *)alloc(sizeof(rt_ELEM), RT_QUAD_ALIGN); elm->data = 0; /* copy only array node's type below */ elm->simd = RT_IS_SURFACE(nd) ? nd->s_srf : (rt_pntr)RT_GET_FLG(tem->simd); elm->temp = tem->temp; /* check if building "hlist/slist" (pass across surfaces in "ssort") */ if (tem->simd == RT_NULL) { rt_Surface *srf = (rt_Surface *)nd; /* prepare surface's trnode/bvnode list for searching */ rt_ELEM *lst = srf->trn, *prv = RT_NULL; #if RT_OPTS_VARRAY != 0 if ((scene->opts & RT_OPTS_VARRAY) != 0) { lst = srf->top; } #endif /* RT_OPTS_VARRAY */ /* search matching existing trnode/bvnode for insertion, * run through the list hierarchy to find the inner-most node element, * element's "simd" field holds pointer to node's sub-list * along with node's type in the lower 4 bits (tr/bv) */ for (nxt = RT_GET_PTR(*ptr); nxt != RT_NULL && lst != RT_NULL;) { if (nxt->temp == lst->temp) { prv = nxt; /* set insertion point to existing node's sub-list */ ptr = RT_GET_ADR(nxt->simd); /* search next inner node in existing node's sub-list */ nxt = RT_GET_PTR(*ptr); lst = lst->next; } else { nxt = nxt->next; } } /* search above is desgined in such a way, that contents * of one array node can now be split across the boundary * of another array node by inserting two different node * elements of the same type belonging to the same array, * one into another array node's sub-list and one outside, * this allows for greater flexibility in trnode/bvnode * relationship, something not allowed in previous versions */ /* allocate new node elements from outer-most to inner-most * if they are not already in the list */ for (; lst != RT_NULL; lst = lst->next) { /* alloc new trnode/bvnode element as none has been found */ nxt = (rt_ELEM *)alloc(sizeof(rt_ELEM), RT_QUAD_ALIGN); nxt->data = (rt_cell)prv; /* link up */ nxt->simd = lst->simd; /* node's type */ nxt->temp = lst->temp; /* insert element according to found position */ nxt->next = RT_GET_PTR(*ptr); RT_SET_PTR(*ptr, rt_ELEM *, nxt); /* set insertion point to new node's sub-list */ ptr = RT_GET_ADR(nxt->simd); prv = nxt; } elm->data = (rt_cell)prv; /* link up */ } /* insert element as list's head */ elm->next = RT_GET_PTR(*ptr); RT_SET_PTR(*ptr, rt_ELEM *, elm); /* prepare new element for sorting * in order to figure out its optimal position in the list * and thus reduce potential overdraw in the rendering backend, * as array node's bounding box and volume are final at this point * it is correct to pass its element through the sorting routine below * before other elements are added into array node's sub-list */ /* sort node elements in the list "ptr" with the new element "elm" * based on the bounding box and volume order as seen from "obj", * sorting is always applied to a single flat list * whether it's a top-level list or array node's sub-list, * treating both surface and array nodes in that list * as single whole elements, thus sorting never violates * the boundaries of array nodes' sub-lists as they are * determined by the search/insert algorithm above */ #if RT_OPTS_INSERT != 0 if ((scene->opts & RT_OPTS_INSERT) == 0 || obj == RT_NULL) /* don't sort "hlist/slist" */ #endif /* RT_OPTS_INSERT */ { return elm; } /* "state" helps avoiding stored-order-value re-computation * when the whole sub-list is being moved without interruption, * the term sub-list used here and below refers to a continuous portion * of a single flat list as opposed to the same term used above * to separate different layers of the list hierarchy */ rt_cell state = 0; rt_ELEM *prv = RT_NULL; /* phase 1, push "elm" through the list "ptr" for as long as possible, * order value re-computation is avoided via "state" variable */ for (nxt = elm->next; nxt != RT_NULL; ) { /* compute the order value between "elm" and "nxt" elements */ rt_cell op = 7 & bbox_sort(obj->bvbox, (rt_BOUND *)elm->temp, (rt_BOUND *)nxt->temp); switch (op) { /* move "elm" forward if the "op" is * either "do swap" or "neutral" */ case 2: /* as the swap operation is performed below * the stored-order-value becomes "no swap" */ op = 1; case 3: elm->next = nxt->next; if (prv != RT_NULL) { if (state != 0) { RT_SET_FLG(prv->data, rt_cell, state); } else { RT_SET_FLG(prv->data, rt_cell, 3 & bbox_sort(obj->bvbox, (rt_BOUND *)prv->temp, (rt_BOUND *)nxt->temp)); } prv->next = nxt; } else { RT_SET_PTR(*ptr, rt_ELEM *, nxt); } /* if current "elm's" position is transitory, "state" keeps * previously computed order value between "prv" and "nxt", * thus the order value can be restored to "prv's" data field * without re-computation as the "elm" advances further */ state = RT_GET_FLG(nxt->data); RT_SET_FLG(nxt->data, rt_cell, op); nxt->next = elm; prv = nxt; nxt = elm->next; break; case 4|1: /* remove "nxt" fully obscured by "elm" */ elm->next = nxt->next; /* reset "state" as "nxt" is removed */ state = 0; nxt = nxt->next; break; case 4|2: /* remove "elm" fully obscured by "nxt" */ if (prv != RT_NULL) { if (state != 0) { RT_SET_FLG(prv->data, rt_cell, state); } else { RT_SET_FLG(prv->data, rt_cell, 3 & bbox_sort(obj->bvbox, (rt_BOUND *)prv->temp, (rt_BOUND *)nxt->temp)); } prv->next = nxt; } else { RT_SET_PTR(*ptr, rt_ELEM *, nxt); } state = 0; /* stop sorting as "elm" is removed */ elm = nxt = RT_NULL; break; /* stop phase 1 if the "op" is "no swap" */ default: RT_SET_FLG(elm->data, rt_cell, op); /* reset "state" as the "elm" has found its place */ state = 0; nxt = RT_NULL; break; } } /* check if "elm" was removed in phase 1 */ if (elm == RT_NULL) { return elm; } rt_ELEM *end, *tlp, *cur, *ipt, *jpt; /* phase 2, find the "end" of the strict-order-chain from "elm", * order value "no swap" is considered strict */ for (end = elm; RT_GET_FLG(end->data) == 1; end = end->next); /* phase 3, move the elements from behind "elm's" strict-order-chain * right in front of the "elm" as computed order value dictates, * order value re-computation is avoided via "state" variables */ for (tlp = cur = end, nxt = end->next; nxt != RT_NULL; ) { rt_bool gr = RT_FALSE; /* compute the order value between "elm" and "nxt" elements */ rt_cell op = 7 & bbox_sort(obj->bvbox, (rt_BOUND *)elm->temp, (rt_BOUND *)nxt->temp); switch (op) { /* move "nxt" in front of the "elm" * if the "op" is "do swap" */ case 2: /* ignore "elm's" removal as it mustn't happen here */ case 4|2: /* as the swap operation is performed below * the stored-order-value becomes "no swap" */ op = 1; /* repair "cur's" stored-order-value * to see if "tlp" needs to catch up with "nxt" */ if (RT_GET_FLG(cur->data) == 0 && cur != tlp) { RT_SET_FLG(cur->data, rt_cell, 3 & bbox_sort(obj->bvbox, (rt_BOUND *)cur->temp, (rt_BOUND *)nxt->temp)); } /* if "cur's" stored-order-value to "nxt" * is "neutral", then strict-order-chain * from "tlp->next" up to "nxt" is broken, * thus "tlp" catches up with "nxt" */ if (RT_GET_FLG(cur->data) == 3 && cur != tlp) { /* repair "tlp's" stored-order-value * before it catches up with "nxt" */ if (RT_GET_FLG(tlp->data) == 0) { ipt = tlp->next; RT_SET_FLG(tlp->data, rt_cell, 3 & bbox_sort(obj->bvbox, (rt_BOUND *)tlp->temp, (rt_BOUND *)ipt->temp)); } /* reset "state" as "tlp" moves forward, thus * breaking the sub-list moving to the front of the "elm" */ state = 0; /* move "tlp" to "cur" right before "nxt" */ tlp = cur; } /* check if there is a tail from "end->next" * up to "tlp" to comb out thoroughly before * moving "nxt" (along with its strict-order-chain * from "tlp->next") to the front of the "elm" */ if (tlp != end) { /* local "state" helps avoiding stored-order-value * re-computation for tail's elements joining the comb */ rt_cell state = 0; cur = tlp; /* run through the tail area from "end->next" * up to "tlp" backwards, while combing out * elements to move along with "nxt" */ while (cur != end) { rt_bool mv = RT_FALSE; /* search for "cur's" previous element */ for (ipt = end; ipt->next != cur; ipt = ipt->next); rt_ELEM *iel = ipt->next; /* run through the strict-order-chain from "tlp->next" * up to "nxt" (which serves as a comb for the tail) * and compute new order values for each tail element */ for (jpt = tlp; jpt != nxt; jpt = jpt->next) { rt_cell op = 0; rt_ELEM *jel = jpt->next; /* if "tlp's" stored-order-value to the first * comb element is not reset, use it as "op", * "cur" serves as "tlp" */ if (cur->next == jel && RT_GET_FLG(cur->data) != 0) { op = RT_GET_FLG(cur->data); } else /* if "state" is not reset, it stores the order value * from "cur" to the first comb element (last moved), * use it as "op" */ if (tlp->next == jel && state != 0) { op = state; } /* compute new order value */ else { op = 3 & bbox_sort(obj->bvbox, (rt_BOUND *)cur->temp, (rt_BOUND *)jel->temp); } /* repair "tlp's" stored-order-value to the first * comb element, "cur" serves as "tlp" */ if (cur->next == jel) { RT_SET_FLG(cur->data, rt_cell, op); } else /* remember "cur's" computed order value to the first * comb element in the "state", if "cur != tlp" */ if (tlp->next == jel) { state = op; } /* check if order is strict, then stop * and mark "cur" as moving with "nxt", * "cur" will then be added to the comb */ if (op == 1) { mv = RT_TRUE; break; } } /* check if "cur" needs to move (join the comb) */ if (mv == RT_TRUE) { gr = RT_TRUE; /* check if "cur" was the last tail's element, * then tail gets shorten by one element "cur", * which at the same time joins the comb */ if (cur == tlp) { /* move "tlp" to its prev, its stored-order-value * is always repaired in the combing stage above */ tlp = ipt; } /* move "cur" from the middle of the tail * to the front of the comb, "iel" serves * as "cur" and "ipt" serves as "cur's" prev */ else { cur = tlp->next; RT_SET_FLG(iel->data, rt_cell, state); /* local "state" keeps previously computed order * value between "cur" and the front of the comb, * thus the order value can be restored to * "cur's" data field without re-computation */ state = RT_GET_FLG(ipt->data); RT_SET_FLG(ipt->data, rt_cell, 0); ipt->next = iel->next; iel->next = cur; RT_SET_FLG(tlp->data, rt_cell, 0); tlp->next = iel; } } /* "cur" doesn't move (stays in the tail) */ else { /* repair "cur's" stored-order-value before it * moves to its prev, "iel" serves as "cur" */ if (RT_GET_FLG(iel->data) == 0) { cur = iel->next; RT_SET_FLG(iel->data, rt_cell, 3 & bbox_sort(obj->bvbox, (rt_BOUND *)iel->temp, (rt_BOUND *)cur->temp)); } /* reset local "state" as tail's sub-list * (joining the comb) is being broken */ state = 0; } /* move "cur" to its prev */ cur = ipt; } /* repair "end's" stored-order-value (to the rest of the tail), * "ipt" serves as "end" */ if (RT_GET_FLG(ipt->data) == 0) { cur = ipt->next; RT_SET_FLG(ipt->data, rt_cell, 3 & bbox_sort(obj->bvbox, (rt_BOUND *)ipt->temp, (rt_BOUND *)cur->temp)); } } /* reset "state" if the comb has grown with tail elements, thus * breaking the sub-list moving to the front of the "elm" */ if (gr == RT_TRUE) { state = 0; } /* move "nxt" along with its comb (if any) * from "tlp->next" to the front of the "elm" */ cur = tlp->next; if (prv != RT_NULL) { if (state != 0) { RT_SET_FLG(prv->data, rt_cell, state); } else { RT_SET_FLG(prv->data, rt_cell, 3 & bbox_sort(obj->bvbox, (rt_BOUND *)prv->temp, (rt_BOUND *)cur->temp)); } prv->next = cur; } else { RT_SET_PTR(*ptr, rt_ELEM *, cur); } cur = nxt->next; RT_SET_FLG(tlp->data, rt_cell, 0); tlp->next = cur; /* "state" keeps previously computed order value between "prv" * and "tlp->next", thus the order value can be restored to * "prv's" data field without re-computation if the whole sub-list * is being moved in front of the "elm" without interruption */ state = RT_GET_FLG(nxt->data); RT_SET_FLG(nxt->data, rt_cell, op); nxt->next = elm; prv = nxt; nxt = cur; /* make sure "cur" is right before "nxt" between the cases */ cur = tlp; break; case 4|1: /* remove "nxt" fully obscured by "elm" */ RT_SET_FLG(cur->data, rt_cell, 0); /* "cur" is always right before "nxt" between the cases */ cur->next = nxt->next; /* reset "state" as the sub-list moving to the front * of the "elm" is broken if "tlp->next" is removed */ if (cur == tlp) { state = 0; } nxt = nxt->next; break; /* move "nxt" forward if the "op" is * either "no swap" or "neutral" */ default: /* repair "cur's" stored-order-value * before it catches up with "nxt" */ if (RT_GET_FLG(cur->data) == 0 && cur != tlp) { RT_SET_FLG(cur->data, rt_cell, 3 & bbox_sort(obj->bvbox, (rt_BOUND *)cur->temp, (rt_BOUND *)nxt->temp)); } /* if "nxt's" or "cur's" stored-order-value * is "neutral", then strict-order-chain * from "tlp->next" up to "nxt" is being broken * as "nxt" moves, thus "tlp" catches up with "nxt" */ if (RT_GET_FLG(nxt->data) == 3 || (RT_GET_FLG(cur->data) == 3 && cur != tlp)) { /* repair "tlp's" stored-order-value * before it catches up with "nxt" */ if (RT_GET_FLG(tlp->data) == 0) { cur = tlp->next; RT_SET_FLG(tlp->data, rt_cell, 3 & bbox_sort(obj->bvbox, (rt_BOUND *)tlp->temp, (rt_BOUND *)cur->temp)); } /* reset "state" as "tlp" moves forward, thus * breaking the sub-list moving to the front of the "elm" */ state = 0; /* move "tlp" to "nxt" before it advances */ tlp = nxt; } /* make sure "cur" is right before "nxt" between the cases */ cur = nxt; /* when "nxt" runs away from "tlp" it grows a * strict-order-chain from "tlp->next" up to "nxt", * which then serves as a comb for the tail area * from "end->next" up to "tlp" */ nxt = nxt->next; break; } } /* repair "tlp's" stored-order-value * if there are elements left behind it */ cur = tlp->next; if (RT_GET_FLG(tlp->data) == 0 && cur != RT_NULL) { RT_SET_FLG(tlp->data, rt_cell, 3 & bbox_sort(obj->bvbox, (rt_BOUND *)tlp->temp, (rt_BOUND *)cur->temp)); } /* return newly inserted element */ return elm; } /* * Filter list "ptr" for a given object "obj" by * converting hierarchical sorted sub-lists back into * a single flat list suitable for rendering backend, * while cleaning "data" and "simd" fields at the same time. * Return last leaf element of the list hierarchy (recursive). */ rt_ELEM* rt_SceneThread::filter(rt_Object *obj, rt_ELEM **ptr) { rt_ELEM *elm = RT_NULL, *nxt; if (ptr == RT_NULL) { return elm; } for (nxt = RT_GET_PTR(*ptr); nxt != RT_NULL; nxt = nxt->next) { /* only node elements are allowed in surface lists */ rt_Node *nd = (rt_Node *)((rt_BOUND *)nxt->temp)->obj; /* if the list element is surface, * reset "data" field used as stored-order-value * in sorting to keep it clean for the backend */ if (RT_IS_SURFACE(nd)) { elm = nxt; nxt->data = 0; } else /* if the list element is array, * find the last leaf element of its sub-list hierarchy * and set it to the "data" field along with node's type, * previously kept in its "simd" field's lower 4 bits */ if (RT_IS_ARRAY(nd)) { rt_Array *arr = (rt_Array *)nd; rt_ELEM **org = RT_GET_ADR(nxt->simd), *prv = elm; elm = filter(obj, org); rt_cell k = RT_GET_FLG(*org); if (elm != RT_NULL) { elm->next = nxt->next; nxt->data = (rt_cell)elm | k; /* node's type */ nxt->next = RT_GET_PTR(*org); nxt->simd = k == 0 ? arr->s_srf : nxt->temp == arr->bvbox ? arr->s_bvb : nxt->temp == arr->inbox ? arr->s_inb : RT_NULL; } else { if (prv != RT_NULL) { prv->next = nxt->next; } else { RT_SET_PTR(*ptr, rt_ELEM *, nxt->next); } elm = prv; continue; } #if RT_OPTS_TILING != 0 /* filter out bvnodes for camera if tiling is enabled */ if ((scene->opts & RT_OPTS_TILING) != 0 && obj != RT_NULL && RT_IS_CAMERA(obj) && k == 1) { if (prv != RT_NULL) { prv->next = nxt->next; } else { RT_SET_PTR(*ptr, rt_ELEM *, nxt->next); } } #endif /* RT_OPTS_TILING */ if (elm != RT_NULL) { nxt = elm; } } } return elm; } /* * Build trnode/bvnode list for a given surface "srf" * after all transform flags have been set in "update_fields", * thus trnode elements are handled properly. */ rt_void rt_SceneThread::snode(rt_Surface *srf) { /* as temporary memory pool is released after every frame, * always rebuild the list even if the scene hasn't changed */ /* reset surface's trnode/bvnode list */ srf->top = RT_NULL; srf->trn = RT_NULL; /* build surface's trnode/bvnode list, * trnode hierarchy is flat as objects with * non-trivial transform are their own trnodes, * while bvnodes can have arbitrary depth * above and below the trnode (if present) */ rt_ELEM *elm; rt_Object *par; /* phase 1, bvnodes (if any) below trnode (if any), * if the same array serves as both trnode and bvnode, * trnode is considered above only if bvnode is split, * thus bvnode is inserted first in this case */ for (par = srf->bvnode; srf->trnode != RT_NULL && par != RT_NULL && par->trnode == srf->trnode && (par->trnode != par || ((rt_Array *)par)->trbox->rad != 0.0f); par = par->bvnode) { rt_Array *arr = (rt_Array *)par; elm = (rt_ELEM *)alloc(sizeof(rt_ELEM), RT_QUAD_ALIGN); elm->data = 0; elm->simd = (rt_pntr)1; /* node's type (bv) */ elm->temp = arr->inbox; elm->next = srf->top; srf->top = elm; } /* phase 2, there can only be one trnode (if any), * even though there might be other trnodes * above and below in the object hierarchy * they themselves don't form the hierarchy * as any trnode is always its own trnode */ if (srf->trnode != RT_NULL && srf->trnode != srf) { rt_Array *arr = (rt_Array *)srf->trnode; elm = (rt_ELEM *)alloc(sizeof(rt_ELEM), RT_QUAD_ALIGN); elm->data = 0; elm->simd = (rt_pntr)0; /* node's type (tr) */ elm->temp = arr->trbox->rad != 0.0f ? arr->trbox : arr->inbox; elm->next = srf->top; srf->top = elm; elm = (rt_ELEM *)alloc(sizeof(rt_ELEM), RT_QUAD_ALIGN); elm->data = 0; elm->simd = (rt_pntr)0; /* node's type (tr) */ elm->temp = srf->top->temp; elm->next = RT_NULL; srf->trn = elm; } /* phase 3, bvnodes (if any) above trnode (if any) */ for (; par != RT_NULL; par = par->bvnode) { rt_Array *arr = (rt_Array *)par; elm = (rt_ELEM *)alloc(sizeof(rt_ELEM), RT_QUAD_ALIGN); elm->data = 0; elm->simd = (rt_pntr)1; /* node's type (bv) */ elm->temp = arr->bvbox->rad != 0.0f ? arr->bvbox : arr->inbox; elm->next = srf->top; srf->top = elm; } } /* * Build custom clippers list from "srf" relations template * after all transform flags have been set in "update_fields", * thus trnode elements are handled properly. */ rt_void rt_SceneThread::sclip(rt_Surface *srf) { /* as temporary memory pool is released after every frame, * always rebuild the list even if the scene hasn't changed */ /* init surface's relations template */ rt_ELEM *lst = srf->rel; /* init and reset custom clippers list */ rt_ELEM **ptr = RT_GET_ADR(srf->s_srf->msc_p[2]); *ptr = RT_NULL; /* build custom clippers list from given template "lst", * as given template "lst" is inverted in surface's "add_relation" * and elements are inserted into the list's head here, * the original relations template from scene data is inverted twice, * thus accum enter/leave markers will end up in correct order */ for (; lst != RT_NULL; lst = lst->next) { rt_ELEM *elm; rt_cell rel = lst->data; rt_Object *obj = lst->temp == RT_NULL ? RT_NULL : (rt_Object *)((rt_BOUND *)lst->temp)->obj; if (obj == RT_NULL) { /* alloc new element for accum marker */ elm = (rt_ELEM *)alloc(sizeof(rt_ELEM), RT_QUAD_ALIGN); elm->data = rel; elm->simd = RT_NULL; /* accum marker */ elm->temp = RT_NULL; /* insert element as list's head */ elm->next = *ptr; *ptr = elm; } else if (RT_IS_SURFACE(obj)) { rt_Surface *srf = (rt_Surface *)obj; /* alloc new element for "srf" */ elm = (rt_ELEM *)alloc(sizeof(rt_ELEM), RT_QUAD_ALIGN); elm->data = rel; elm->simd = srf->s_srf; elm->temp = srf->bvbox; if (srf->trnode != RT_NULL && srf->trnode != srf) { rt_si32 acc = 0; rt_ELEM *nxt; rt_Array *arr = (rt_Array *)srf->trnode; rt_BOUND *trb = arr->trbox; /* not used for clippers */ /* search matching existing trnode for insertion * either within current accum segment * or outside of any accum segment */ for (nxt = *ptr; nxt != RT_NULL; nxt = nxt->next) { /* "acc == 0" either accum-enter-marker * hasn't been inserted yet (current accum segment) * or outside of any accum segment */ if (acc == 0 && nxt->temp == trb) { break; } /* skip all non-accum-marker elements */ if (nxt->temp != RT_NULL) { continue; } /* didn't find trnode within current accum segment, * leaving cycle, new trnode element will be inserted */ if (acc == 0 && nxt->data == RT_ACCUM_LEAVE) { nxt = RT_NULL; break; } /* skip accum segment different from the one * current element is being inserted into */ if (acc == 0 && nxt->data == RT_ACCUM_ENTER) { acc = 1; } /* keep track of accum segments */ if (acc == 1 && nxt->data == RT_ACCUM_LEAVE) { acc = 0; } } if (nxt == RT_NULL) { /* insert element as list's head */ elm->next = *ptr; *ptr = elm; /* alloc new trnode element as none has been found */ nxt = (rt_ELEM *)alloc(sizeof(rt_ELEM), RT_QUAD_ALIGN); nxt->data = (rt_cell)elm; /* trnode's last element */ nxt->simd = arr->s_srf; nxt->temp = trb; /* insert element as list's head */ nxt->next = *ptr; *ptr = nxt; } else { /* insert element under existing trnode */ elm->next = nxt->next; nxt->next = elm; } } else { /* insert element as list's head */ elm->next = *ptr; *ptr = elm; } } } } /* * Build tile list for a given surface "srf" based * on the area its projected bbox occupies in the tilebuffer. */ rt_void rt_SceneThread::stile(rt_Surface *srf) { /* as temporary memory pool is released after every frame, * always rebuild the list even if the scene hasn't changed */ srf->tls = RT_NULL; #if RT_OPTS_TILING != 0 if ((scene->opts & RT_OPTS_TILING) == 0) #endif /* RT_OPTS_TILING */ { return; } rt_ELEM *elm; rt_si32 i, j; rt_si32 k; rt_vec4 vec; rt_real dot; rt_si32 ndx[2]; rt_real tag[2], zed[2]; /* "verts_num" may grow, use "srf->verts_num" if original is needed */ rt_si32 verts_num = srf->bvbox->verts_num; rt_VERT *vrt = srf->bvbox->verts; /* project bbox onto the tilebuffer */ if (verts_num != 0) { for (i = 0; i < scene->tiles_in_col; i++) { txmin[i] = scene->tiles_in_row; txmax[i] = -1; } /* process bbox vertices */ memset(verts, 0, sizeof(rt_VERT) * (2 * verts_num + srf->bvbox->edges_num)); for (k = 0; k < srf->bvbox->verts_num; k++) { RT_VEC3_SUB(vec, vrt[k].pos, scene->org); dot = RT_VEC3_DOT(vec, scene->nrm); verts[k].pos[RT_Z] = dot; verts[k].pos[RT_W] = -1.0f; /* tag: behind screen plane */ /* process vertices in front of or near screen plane, * the rest are processed with edges */ if (dot >= 0.0f || RT_FABS(dot) <= RT_CLIP_THRESHOLD) { RT_VEC3_SUB(vec, vrt[k].pos, scene->pos); dot = RT_VEC3_DOT(vec, scene->nrm) / scene->cam->pov; RT_VEC3_MUL_VAL1(vec, vec, 1.0f / dot); /* dot >= (pov - RT_CLIP_THRESHOLD) */ /* pov >= (2 * RT_CLIP_THRESHOLD) */ /* thus: (dot >= RT_CLIP_THRESHOLD) */ RT_VEC3_SUB(vec, vec, scene->dir); verts[k].pos[RT_X] = RT_VEC3_DOT(vec, scene->htl); verts[k].pos[RT_Y] = RT_VEC3_DOT(vec, scene->vtl); verts[k].pos[RT_W] = +1.0f; /* tag: in front of screen plane */ /* slightly behind (near) screen plane, * generate new vertex */ if (verts[k].pos[RT_Z] < 0.0f) { verts[verts_num].pos[RT_X] = verts[k].pos[RT_X]; verts[verts_num].pos[RT_Y] = verts[k].pos[RT_Y]; verts_num++; verts[k].pos[RT_W] = 0.0f; /* tag: near screen plane */ } } } /* process bbox edges */ for (k = 0; k < srf->bvbox->edges_num; k++) { for (i = 0; i < 2; i++) { ndx[i] = srf->bvbox->edges[k].index[i]; zed[i] = verts[ndx[i]].pos[RT_Z]; tag[i] = verts[ndx[i]].pos[RT_W]; } /* skip edge if both vertices are eihter * behind or near screen plane */ if (tag[0] <= 0.0f && tag[1] <= 0.0f) { continue; } for (i = 0; i < 2; i++) { /* skip vertex if in front of * or near screen plane */ if (tag[i] >= 0.0f) { continue; } /* process edge with one in front of * and one behind screen plane vertices */ j = 1 - i; /* clip edge at screen plane crossing, * generate new vertex */ RT_VEC3_SUB(vec, vrt[ndx[i]].pos, vrt[ndx[j]].pos); dot = zed[j] / (zed[j] - zed[i]); /* () >= RT_CLIP_THRESHOLD */ RT_VEC3_MUL_VAL1(vec, vec, dot); RT_VEC3_ADD(vec, vec, vrt[ndx[j]].pos); RT_VEC3_SUB(vec, vec, scene->org); verts[verts_num].pos[RT_X] = RT_VEC3_DOT(vec, scene->htl); verts[verts_num].pos[RT_Y] = RT_VEC3_DOT(vec, scene->vtl); ndx[i] = verts_num; verts_num++; } /* tile current edge */ tiling(verts[ndx[0]].pos, verts[ndx[1]].pos); } /* tile all newly generated vertex pairs */ for (i = srf->bvbox->verts_num; i < verts_num - 1; i++) { for (j = i + 1; j < verts_num; j++) { tiling(verts[i].pos, verts[j].pos); } } } else { /* mark all tiles in the entire tilbuffer */ for (i = 0; i < scene->tiles_in_col; i++) { txmin[i] = 0; txmax[i] = scene->tiles_in_row - 1; } } rt_ELEM **ptr = RT_GET_ADR(srf->tls); /* fill marked tiles with surface data */ for (i = 0; i < scene->tiles_in_col; i++) { for (j = txmin[i]; j <= txmax[i]; j++) { /* alloc new element for each tile of "srf" */ elm = (rt_ELEM *)alloc(sizeof(rt_ELEM), RT_QUAD_ALIGN); elm->data = i << 16 | j; elm->simd = srf->s_srf; elm->temp = srf->bvbox; /* insert element as list's tail */ *ptr = elm; ptr = &elm->next; } } *ptr = RT_NULL; } /* * Build surface list for a given object "obj". * Surface objects have separate surface lists for each side. */ rt_ELEM* rt_SceneThread::ssort(rt_Object *obj) { /* as temporary memory pool is released after every frame, * always rebuild the list even if the scene hasn't changed */ rt_Surface *srf = RT_NULL; rt_ELEM **pto = RT_NULL; rt_ELEM **pti = RT_NULL; if (obj != RT_NULL && RT_IS_SURFACE(obj)) { srf = (rt_Surface *)obj; if (g_print && srf->s_srf->msc_p[2] != RT_NULL) { RT_PRINT_CLP((rt_ELEM *)srf->s_srf->msc_p[2]); } pto = RT_GET_ADR(srf->s_srf->lst_p[1]); pti = RT_GET_ADR(srf->s_srf->lst_p[3]); #if RT_OPTS_RENDER != 0 if ((scene->opts & RT_OPTS_RENDER) != 0 && (((rt_word)srf->s_srf->mat_p[1] & RT_PROP_REFLECT) != 0 || ((rt_word)srf->s_srf->mat_p[3] & RT_PROP_REFLECT) != 0 || ((rt_word)srf->s_srf->mat_p[1] & RT_PROP_OPAQUE) == 0 || ((rt_word)srf->s_srf->mat_p[3] & RT_PROP_OPAQUE) == 0)) { *pto = RT_NULL; *pti = RT_NULL; /* RT_LOGI("Building slist for surface\n"); */ } else #endif /* RT_OPTS_RENDER */ { *pto = scene->slist; /* all srf are potential rfl/rfr */ *pti = scene->slist; /* all srf are potential rfl/rfr */ return RT_NULL; } } rt_ELEM *lst = RT_NULL; rt_ELEM **ptr = &lst; if (obj == RT_NULL) { rt_Surface *ref; /* linear traversal across surfaces */ for (ref = scene->srf_head; ref != RT_NULL; ref = ref->next) { rt_ELEM tem; tem.data = 0; tem.simd = RT_NULL; /* signal "insert" to build "hlist/slist" */ tem.temp = ref->bvbox; tem.next = RT_NULL; insert(obj, ptr, &tem); } } else { rt_si32 c = 0, r = 0; rt_ELEM *elm, *cur = RT_NULL, *prv = RT_NULL; rt_ELEM *cuo, *cui, *pro = RT_NULL, *pri = RT_NULL; rt_BOUND *abx = RT_NULL; /* hierarchical traversal across nodes */ for (elm = scene->hlist; elm != RT_NULL;) { rt_BOUND *box = (rt_BOUND *)elm->temp; #if RT_OPTS_REMOVE != 0 /* disable array's contents removal by its bbox * when building for surface on the same branch */ if ((scene->opts & RT_OPTS_REMOVE) != 0 && abx != RT_NULL && RT_IS_SURFACE(obj)) { rt_ELEM *top = ((rt_Surface *)obj)->top; for (; top != RT_NULL; top = top->next) { if (abx == top->temp) { abx = RT_NULL; break; } } } r = 0; /* enable array's contents removal by its bbox */ if ((scene->opts & RT_OPTS_REMOVE) != 0 && abx != RT_NULL && abx != box) { r = bbox_sort(obj->bvbox, box, abx); } #endif /* RT_OPTS_REMOVE */ #if RT_OPTS_2SIDED != 0 if ((scene->opts & RT_OPTS_2SIDED) != 0 && srf != RT_NULL) { /* only call "bbox_side" if all arrays above in the hierarchy * are seen from both sides of the surface, don't call * "bbox_side" again if two array elements have the same bbox */ if (cur == RT_NULL && (prv == RT_NULL || prv->temp != box)) { c = bbox_side(box, srf->shape); } /* insert nodes according to * side value computed above */ cuo = RT_NULL; if (c & 2 && r != 6) { cuo = insert(obj, pto, elm); if (cuo != RT_NULL) { RT_SET_PTR(cuo->data, rt_cell, pro); } } cui = RT_NULL; if (c & 1 && r != 6) { cui = insert(obj, pti, elm); if (cui != RT_NULL) { RT_SET_PTR(cui->data, rt_cell, pri); } } /* if array's bbox is only seen from one side of the surface * so are all of array's contents, thus skip "bbox_side" call */ if (RT_IS_ARRAY(box) && (cuo != RT_NULL || cui != RT_NULL)) { /* set array for skipping "bbox_side" call above */ if (cur == RT_NULL && c < 3) { cur = elm; } if (box->fln > 1) /* insert handles "box->fln == 1" case */ { abx = box; } else /* if sub-array isn't removed, "abx" isn't effective */ { abx = RT_NULL; } if (cuo != RT_NULL) { pro = cuo; pto = RT_GET_ADR(cuo->simd); } if (cui != RT_NULL) { pri = cui; pti = RT_GET_ADR(cui->simd); } prv = elm; elm = RT_GET_PTR(elm->simd); } else { /* if anything except bbox's faces isn't removed, * "abx" isn't effective */ if (abx != RT_NULL && !RT_IS_PLANE(box) && r != 6) { abx = RT_NULL; } while (elm != RT_NULL && elm->next == RT_NULL) { if (cur == RT_NULL || c & 2) { pro = pro != RT_NULL ? RT_GET_PTR(pro->data) : RT_NULL; pto = pro != RT_NULL ? RT_GET_ADR(pro->simd) : RT_GET_ADR(srf->s_srf->lst_p[1]); } if (cur == RT_NULL || c & 1) { pri = pri != RT_NULL ? RT_GET_PTR(pri->data) : RT_NULL; pti = pri != RT_NULL ? RT_GET_ADR(pri->simd) : RT_GET_ADR(srf->s_srf->lst_p[3]); } elm = RT_GET_PTR(elm->data); if (elm == cur) { cur = RT_NULL; } abx = RT_NULL; } if (elm != RT_NULL) { elm = elm->next; } prv = RT_NULL; } } else #endif /* RT_OPTS_2SIDED */ { cur = RT_NULL; if (r != 6) { cur = insert(obj, ptr, elm); } if (cur != RT_NULL) { RT_SET_PTR(cur->data, rt_cell, prv); } if (RT_IS_ARRAY(box) && cur != RT_NULL) { if (box->fln > 1) /* insert handles "box->fln == 1" case */ { abx = box; } else /* if sub-array isn't removed, "abx" isn't effective */ { abx = RT_NULL; } prv = cur; ptr = RT_GET_ADR(cur->simd); elm = RT_GET_PTR(elm->simd); } else { /* if anything except bbox's faces isn't removed, * "abx" isn't effective */ if (abx != RT_NULL && !RT_IS_PLANE(box) && r != 6) { abx = RT_NULL; } while (elm != RT_NULL && elm->next == RT_NULL) { prv = prv != RT_NULL ? RT_GET_PTR(prv->data) : RT_NULL; ptr = prv != RT_NULL ? RT_GET_ADR(prv->simd) : &lst; elm = RT_GET_PTR(elm->data); abx = RT_NULL; } if (elm != RT_NULL) { elm = elm->next; } } } } } #if RT_OPTS_INSERT != 0 || RT_OPTS_TARRAY != 0 || RT_OPTS_VARRAY != 0 if ((scene->opts & RT_OPTS_INSERT) != 0 || (scene->opts & RT_OPTS_TARRAY) != 0 || (scene->opts & RT_OPTS_VARRAY) != 0) { if (pto != RT_NULL && *pto != RT_NULL) { filter(obj, pto); } if (pti != RT_NULL && *pti != RT_NULL) { filter(obj, pti); } if (*ptr != RT_NULL && obj != RT_NULL) /* don't filter "hlist/slist" */ { filter(obj, ptr); } } #endif /* RT_OPTS_INSERT, RT_OPTS_TARRAY, RT_OPTS_VARRAY */ if (srf == RT_NULL) { return lst; } if (g_print) { if (*pto != RT_NULL) { RT_PRINT_LST_OUTER(*pto); } if (*pti != RT_NULL) { RT_PRINT_LST_INNER(*pti); } if (*ptr != RT_NULL) { RT_PRINT_LST(*ptr); } } #if RT_OPTS_2SIDED != 0 if ((scene->opts & RT_OPTS_2SIDED) == 0) #endif /* RT_OPTS_2SIDED */ { *pto = lst; *pti = lst; } return RT_NULL; } /* * Build light/shadow list for a given object "obj". * Surface objects have separate light/shadow lists for each side. */ rt_ELEM* rt_SceneThread::lsort(rt_Object *obj) { /* as temporary memory pool is released after every frame, * always rebuild the list even if the scene hasn't changed */ rt_Surface *srf = RT_NULL; rt_ELEM **pto = RT_NULL; rt_ELEM **pti = RT_NULL; if (obj != RT_NULL && RT_IS_SURFACE(obj)) { srf = (rt_Surface *)obj; pto = RT_GET_ADR(srf->s_srf->lst_p[0]); pti = RT_GET_ADR(srf->s_srf->lst_p[2]); #if RT_OPTS_SHADOW != 0 if ((scene->opts & RT_OPTS_SHADOW) != 0) { *pto = RT_NULL; *pti = RT_NULL; /* RT_LOGI("Building llist for surface\n"); */ } else #endif /* RT_OPTS_SHADOW */ { *pto = scene->llist; /* all lgt are potential sources */ *pti = scene->llist; /* all lgt are potential sources */ return RT_NULL; } } rt_ELEM *lst = RT_NULL; rt_ELEM **ptr = &lst; rt_Light *lgt; /* linear traversal across light sources */ for (lgt = scene->lgt_head; lgt != RT_NULL; lgt = lgt->next) { rt_ELEM **pso = RT_NULL; rt_ELEM **psi = RT_NULL; rt_ELEM **psr = RT_NULL; #if RT_OPTS_2SIDED != 0 if ((scene->opts & RT_OPTS_2SIDED) != 0 && srf != RT_NULL) { rt_si32 c = bbox_side(lgt->bvbox, srf->shape); if (c & 2) { insert(lgt, pto, RT_NULL); pso = RT_GET_ADR((*pto)->data); *pso = RT_NULL; if (g_print) { RT_PRINT_LGT_OUTER(*pto, lgt); } } if (c & 1) { insert(lgt, pti, RT_NULL); psi = RT_GET_ADR((*pti)->data); *psi = RT_NULL; if (g_print) { RT_PRINT_LGT_INNER(*pto, lgt); } } } else #endif /* RT_OPTS_2SIDED */ { insert(lgt, ptr, RT_NULL); psr = RT_GET_ADR((*ptr)->data); if (g_print && srf != RT_NULL) { RT_PRINT_LGT(*ptr, lgt); } } #if RT_OPTS_SHADOW != 0 if (srf == RT_NULL) { continue; } if (psr != RT_NULL) { *psr = RT_NULL; } rt_si32 c = 0, s = 0; rt_ELEM *elm, *cur = RT_NULL, *prv = RT_NULL; rt_ELEM *cuo, *cui, *pro = RT_NULL, *pri = RT_NULL; /* hierarchical traversal across nodes */ for (elm = scene->hlist; elm != RT_NULL;) { rt_BOUND *box = (rt_BOUND *)elm->temp; /* only call "bbox_shad" if all arrays above in the hierarchy * cast shadow on the surface, don't call * "bbox_shad" again if two array elements have the same bbox */ if (prv == RT_NULL || prv->temp != box) { s = bbox_shad(lgt->bvbox, box, srf->bvbox); } #if RT_OPTS_2SIDED != 0 if ((scene->opts & RT_OPTS_2SIDED) != 0) { /* only call "bbox_side" if all arrays above in the hierarchy * are seen from both sides of the surface, don't call * "bbox_side" again if two array elements have the same bbox */ if (cur == RT_NULL && (prv == RT_NULL || prv->temp != box) && s) { c = bbox_side(box, srf->shape); } /* insert nodes according to * side value computed above */ cuo = RT_NULL; if (c & 2 && pso != RT_NULL && s) { cuo = insert(obj, pso, elm); if (cuo != RT_NULL) { RT_SET_PTR(cuo->data, rt_cell, pro); } } cui = RT_NULL; if (c & 1 && psi != RT_NULL && s) { cui = insert(obj, psi, elm); if (cui != RT_NULL) { RT_SET_PTR(cui->data, rt_cell, pri); } } /* if array's bbox is only seen from one side of the surface * so are all of array's contents, thus skip "bbox_side" call */ if (RT_IS_ARRAY(box) && c != 0 && s && (cuo != RT_NULL || cui != RT_NULL)) { /* set array for skipping "bbox_side" call above */ if (cur == RT_NULL && c < 3) { cur = elm; } if (cuo != RT_NULL) { pro = cuo; pso = RT_GET_ADR(cuo->simd); } if (cui != RT_NULL) { pri = cui; psi = RT_GET_ADR(cui->simd); } prv = elm; elm = RT_GET_PTR(elm->simd); } else { while (elm != RT_NULL && elm->next == RT_NULL) { if ((cur == RT_NULL || c & 2) && pso != RT_NULL) { pro = pro != RT_NULL ? RT_GET_PTR(pro->data) : RT_NULL; pso = pro != RT_NULL ? RT_GET_ADR(pro->simd) : RT_GET_ADR((*pto)->data); } if ((cur == RT_NULL || c & 1) && psi != RT_NULL) { pri = pri != RT_NULL ? RT_GET_PTR(pri->data) : RT_NULL; psi = pri != RT_NULL ? RT_GET_ADR(pri->simd) : RT_GET_ADR((*pti)->data); } elm = RT_GET_PTR(elm->data); if (elm == cur) { cur = RT_NULL; } } if (elm != RT_NULL) { elm = elm->next; } prv = RT_NULL; } } else #endif /* RT_OPTS_2SIDED */ { if (s) { cur = insert(obj, psr, elm); if (cur != RT_NULL) { RT_SET_PTR(cur->data, rt_cell, prv); } } if (RT_IS_ARRAY(box) && cur != RT_NULL && s) { prv = cur; psr = RT_GET_ADR(cur->simd); elm = RT_GET_PTR(elm->simd); } else { while (elm != RT_NULL && elm->next == RT_NULL) { prv = prv != RT_NULL ? RT_GET_PTR(prv->data) : RT_NULL; psr = prv != RT_NULL ? RT_GET_ADR(prv->simd) : RT_GET_ADR((*ptr)->data); elm = RT_GET_PTR(elm->data); } if (elm != RT_NULL) { elm = elm->next; } } } } #if RT_OPTS_INSERT != 0 || RT_OPTS_TARRAY != 0 || RT_OPTS_VARRAY != 0 if ((scene->opts & RT_OPTS_INSERT) != 0 || (scene->opts & RT_OPTS_TARRAY) != 0 || (scene->opts & RT_OPTS_VARRAY) != 0) { if (pso != RT_NULL && *pso != RT_NULL) { filter(RT_NULL, pso); } if (psi != RT_NULL && *psi != RT_NULL) { filter(RT_NULL, psi); } if (psr != RT_NULL && *psr != RT_NULL) { filter(RT_NULL, psr); } } #endif /* RT_OPTS_INSERT, RT_OPTS_TARRAY, RT_OPTS_VARRAY */ if (g_print) { if (pso != RT_NULL && *pso != RT_NULL) { RT_PRINT_SHW_OUTER(*pso); } if (psi != RT_NULL && *psi != RT_NULL) { RT_PRINT_SHW_INNER(*psi); } if (psr != RT_NULL && *psr != RT_NULL) { RT_PRINT_SHW(*psr); } } #endif /* RT_OPTS_SHADOW */ } if (srf == RT_NULL) { return lst; } #if RT_OPTS_2SIDED != 0 if ((scene->opts & RT_OPTS_2SIDED) == 0) #endif /* RT_OPTS_2SIDED */ { *pto = lst; *pti = lst; } return RT_NULL; } /* * Deinitialize scene thread. */ rt_SceneThread::~rt_SceneThread() { ASM_DONE(s_inf) } /******************************************************************************/ /********************************** SCENE *********************************/ /******************************************************************************/ /* * Allocate scene in custom heap. * Heap "hp" must be the same object as platform "pfm" in constructor. */ rt_pntr rt_Scene::operator new(size_t size, rt_Heap *hp) { return hp->obj_alloc(size, RT_ALIGN); } /* * Delete scene from custom heap. */ rt_void rt_Scene::operator delete(rt_pntr ptr) { ((rt_Scene *)ptr)->pfm->obj_free(ptr); } /* * Instantiate scene. * Can only be called from single (main) thread. * Platform "pfm" must be the same object as heap "hp" in custom "new". */ rt_Scene::rt_Scene(rt_SCENE *scn, /* "frame" must be SIMD-aligned or NULL */ rt_si32 x_res, rt_si32 y_res, rt_si32 x_row, rt_ui32 *frame, rt_Platform *pfm) : rt_Registry(pfm->f_alloc, pfm->f_free), rt_List<rt_Scene>(RT_NULL) { this->pfm = pfm; pfm->add_scene(this); thnum = pfm->thnum; tdata = pfm->tdata; thr_num = thnum; /* for registry of object hierarchy */ f_update = pfm->f_update; f_render = pfm->f_render; this->scn = scn; /* check for locked scene data, not thread safe! (it's ok, not a bug) */ if (scn->lock != RT_NULL) { throw rt_Exception("scene data is locked by another instance"); } /* "x_row", frame's stride (in 32-bit pixels, not bytes!), * can be greater than "x_res", in which case the frame * occupies only a portion (rectangle) of the framebuffer, * or negative, in which case frame starts at the last line * and consecutive lines are located backwards in memory, * "x_row" must contain the whole number of SIMD widths */ if (x_res == 0 || y_res == 0 || RT_ABS32(x_row) < x_res) { throw rt_Exception("frambuffer's dimensions are not valid"); } #if (RT_POINTER - RT_ADDRESS) != 0 /* always reallocate frame in custom heap for 64-bit * if 32-bit address range is enabled in makefiles */ frame = RT_NULL; #endif /* (RT_POINTER - RT_ADDRESS) */ if (((rt_word)frame & (RT_SIMD_ALIGN - 1)) != 0 || frame == RT_NULL || (RT_ABS32(x_row) & (RT_SIMD_WIDTH - 1)) != 0) { rt_si32 y_sgn = RT_SIGN(x_row); x_row = RT_ABS32(x_row); x_row = ((x_row + RT_SIMD_WIDTH - 1) / RT_SIMD_WIDTH) * RT_SIMD_WIDTH; frame = (rt_ui32 *) alloc(x_row * y_res * sizeof(rt_ui32), RT_SIMD_ALIGN); x_row *= y_sgn; if (x_row < 0) { frame += RT_ABS32(x_row) * (y_res - 1); } } memset(frame, 0, x_row * y_res * sizeof(rt_ui32)); /* init framebuffer's dimensions and pointer */ this->x_res = x_res; this->y_res = y_res; this->x_row = x_row; this->frame = frame; /* init tilebuffer's dimensions and pointer */ tiles_in_row = (x_res + pfm->tile_w - 1) / pfm->tile_w; tiles_in_col = (y_res + pfm->tile_h - 1) / pfm->tile_h; tiles = (rt_ELEM **) alloc(tiles_in_row * tiles_in_col * sizeof(rt_ELEM *), RT_ALIGN); memset(tiles, 0, tiles_in_row * tiles_in_col * sizeof(rt_ELEM *)); /* init pixel-width, aspect-ratio, ray-depth */ factor = 1.0f / (rt_real)x_res; aspect = (rt_real)y_res * factor; depth = RT_MAX(RT_STACK_DEPTH, 0); opts &= ~scn->opts; pseed = RT_NULL; ptr_r = RT_NULL; ptr_g = RT_NULL; ptr_b = RT_NULL; if ((opts & RT_OPTS_PT) == 0 || (opts & RT_OPTS_BUFFERS) == 0) { /* alloc framebuffer's color-planes for path-tracer */ ptr_r = (rt_real *) alloc(4 * x_row * y_res * sizeof(rt_real), RT_SIMD_ALIGN); ptr_g = (rt_real *) alloc(4 * x_row * y_res * sizeof(rt_real), RT_SIMD_ALIGN); ptr_b = (rt_real *) alloc(4 * x_row * y_res * sizeof(rt_real), RT_SIMD_ALIGN); /* ptr_* is initialized in reset_color() */ } if ((opts & RT_OPTS_BUFFERS) == 0) { reset_color(); } if ((opts & RT_OPTS_PT) == 0) { /* alloc framebuffer's seed-plane for path-tracer */ pseed = (rt_elem *) alloc(4 * x_row * y_res * sizeof(rt_elem), RT_SIMD_ALIGN); /* pseed is initialized in reset_pseed() */ } pts_c = 0.0f; pt_on = RT_FALSE; fsaa = pfm->fsaa; /* instantiate object hierarchy */ memset(&rootobj, 0, sizeof(rt_OBJECT)); rootobj.trm.scl[RT_I] = 1.0f; rootobj.trm.scl[RT_J] = 1.0f; rootobj.trm.scl[RT_K] = 1.0f; rootobj.obj = scn->root; if (!RT_IS_ARRAY(&scn->root)) { throw rt_Exception("scene's root is not an array"); } root = new(this) rt_Array(this, RT_NULL, &rootobj); /* also init "*_num" */ if (cam_head == RT_NULL) { throw rt_Exception("scene doesn't contain camera"); } cam = cam_head; cam_idx = 0; /* lock scene data, when scene's constructor can no longer fail */ scn->lock = this; /* create scene threads array */ tharr = (rt_SceneThread **) alloc(sizeof(rt_SceneThread *) * thnum, RT_ALIGN); rt_si32 i; for (i = 0; i < thnum; i++) { tharr[i] = new(this) rt_SceneThread(this, i); /* estimate per-frame allocs to reduce system calls per thread */ tharr[i]->msize = /* upper bound per surface for tiling */ (tiles_in_row * tiles_in_col + /* plus array nodes list */ (arr_num + 2) + /* plus reflections/refractions */ (srf_num + arr_num * 2 + /* plus lights and shadows */ (srf_num + arr_num * 2 + 1) * lgt_num) * 2) * /* for both sides */ sizeof(rt_ELEM) * (srf_num + thnum - 1) / thnum; /* per thread */ } pending = 0; /* init memory pool in the heap for temporary per-frame allocs */ mpool = RT_NULL; /* rough estimate for surface relations/templates */ msize = ((srf_num + 1) * (srf_num + 1) * 2 + /* plus two surface lists */ (srf_num + arr_num * 1) * 2 + /* plus lights and shadows list */ (srf_num + arr_num * 2 + 1) * lgt_num + /* plus array nodes */ tiles_in_row * tiles_in_col * arr_num) * /* for tiling */ sizeof(rt_ELEM); /* for main thread */ /* in the estimates above ("arr_num" * x) depends on whether both * trnode/bvnode are allowed in the list or just one of them, * if the estimates are not accurate the engine should still work, * though not as efficient due to unnecessary allocations per frame * or unused extra memory reservation resulting in larger footprint */ } /* * Update current camera with given "action" for a given "time". */ rt_void rt_Scene::update(rt_time time, rt_si32 action) { cam->update_action(time, action); } /* * Update backend data structures and render frame for a given "time". */ rt_void rt_Scene::render(rt_time time) { rt_si32 i; #if RT_OPTS_UPDATE_EXT0 != 0 if ((opts & RT_OPTS_UPDATE_EXT0) == 0 || rootobj.time == -1) { /* -->---->-- skip update1 -->---->-- */ #endif /* RT_OPTS_UPDATE_EXT0 */ if (pending) { pending = 0; /* release memory for temporary per-frame allocs */ for (i = 0; i < thnum; i++) { tharr[i]->release(tharr[i]->mpool); } release(mpool); } /* reserve memory for temporary per-frame allocs */ mpool = reserve(msize, RT_QUAD_ALIGN); for (i = 0; i < thnum; i++) { tharr[i]->mpool = tharr[i]->reserve(tharr[i]->msize, RT_QUAD_ALIGN); } /* print state init */ if (g_print) { RT_PRINT_STATE_INIT(); RT_PRINT_TIME(time); } /* phase 0.5, hierarchical update of arrays' transform matrices */ root->update_object(time, 0, RT_NULL, iden4); if (pt_on && (root->scn_changed || pfm->fsaa != fsaa)) { reset_color(); } /* update current antialiasing mode per scene */ fsaa = pfm->fsaa; /* 1st phase of multi-threaded update */ #if RT_OPTS_THREAD != 0 if ((opts & RT_OPTS_THREAD) != 0 && this == pfm->get_cur_scene() && !g_print #if RT_OPTS_UPDATE_EXT1 != 0 && (opts & RT_OPTS_UPDATE_EXT1) == 0 #endif /* RT_OPTS_UPDATE_EXT1 */ ) { this->f_update(tdata, thnum, 1); } else #endif /* RT_OPTS_THREAD */ { update_scene(this, -thnum, 1); } /* update ray positioning and steppers */ rt_real h, v; RT_VEC3_SET(pos, cam->pos); RT_VEC3_SET(hor, cam->hor); RT_VEC3_SET(ver, cam->ver); RT_VEC3_SET(nrm, cam->nrm); h = -0.5f * 1.0f; v = -0.5f * aspect; /* aim rays at camera's top-left corner */ RT_VEC3_MUL_VAL1(dir, nrm, cam->pov); RT_VEC3_MAD_VAL1(dir, hor, h); RT_VEC3_MAD_VAL1(dir, ver, v); /* update tile positioning and steppers */ RT_VEC3_ADD(org, pos, dir); h = 1.0f / (factor * pfm->tile_w); /* x_res / tile_w */ v = 1.0f / (factor * pfm->tile_h); /* x_res / tile_h */ RT_VEC3_MUL_VAL1(htl, hor, h); RT_VEC3_MUL_VAL1(vtl, ver, v); /* 2nd phase of multi-threaded update */ #if RT_OPTS_THREAD != 0 if ((opts & RT_OPTS_THREAD) != 0 && this == pfm->get_cur_scene() && !g_print #if RT_OPTS_UPDATE_EXT2 != 0 && (opts & RT_OPTS_UPDATE_EXT2) == 0 #endif /* RT_OPTS_UPDATE_EXT2 */ ) { this->f_update(tdata, thnum, 2); } else #endif /* RT_OPTS_THREAD */ { update_scene(this, -thnum, 2); } /* phase 2.5, hierarchical update of arrays' bounds from surfaces */ root->update_bounds(); rt_Surface *srf; /* update surfaces' node lists */ for (srf = srf_head; srf != RT_NULL; srf = srf->next) { /* rebuild surface's node list (per-surface) * based on transform flags and arrays' bounds */ tharr[0]->snode(srf); } /* rebuild global hierarchical list */ hlist = tharr[0]->ssort(RT_NULL); /* rebuild global surface/node list */ slist = tharr[0]->ssort(RT_NULL); tharr[0]->filter(RT_NULL, &slist); /* rebuild global light/shadow list, * "slist" is needed inside */ llist = tharr[0]->lsort(RT_NULL); /* rebuild camera's surface/node list, * "slist" is needed inside */ clist = tharr[0]->ssort(cam); if (g_print) { RT_PRINT_GLB(); RT_PRINT_SRF_LST(slist); RT_PRINT_LGT_LST(llist); RT_PRINT_CAM(cam); RT_PRINT_SRF_LST(clist); } /* 3rd phase of multi-threaded update */ #if RT_OPTS_THREAD != 0 if ((opts & RT_OPTS_THREAD) != 0 && this == pfm->get_cur_scene() && !g_print #if RT_OPTS_UPDATE_EXT3 != 0 && (opts & RT_OPTS_UPDATE_EXT3) == 0 #endif /* RT_OPTS_UPDATE_EXT3 */ ) { this->f_update(tdata, thnum, 3); } else #endif /* RT_OPTS_THREAD */ { update_scene(this, -thnum, 3); } /* screen tiling */ rt_si32 tline, j; #if RT_OPTS_TILING != 0 if ((opts & RT_OPTS_TILING) != 0) { memset(tiles, 0, sizeof(rt_ELEM *) * tiles_in_row * tiles_in_col); rt_ELEM *elm, *nxt, *ctail = RT_NULL, **ptr = &ctail; /* build exact copy of reversed "clist" (should be cheap), * trnode elements become tailing rather than heading, * elements grouping for cached transform is retained */ for (nxt = clist; nxt != RT_NULL; nxt = nxt->next) { /* alloc new element as "nxt's" copy */ elm = (rt_ELEM *)alloc(sizeof(rt_ELEM), RT_QUAD_ALIGN); elm->data = nxt->data; elm->simd = nxt->simd; elm->temp = nxt->temp; /* insert element as list's head */ elm->next = *ptr; *ptr = elm; } /* traverse reversed "clist" to keep original "clist's" order * and optimize trnode handling for each tile */ for (elm = ctail; elm != RT_NULL; elm = elm->next) { rt_Node *nd = (rt_Node *)((rt_BOUND *)elm->temp)->obj; /* skip trnode elements from reversed "clist" * as they are handled separately for each tile */ if (RT_IS_ARRAY(nd)) { continue; } rt_Surface *srf = (rt_Surface *)nd; rt_ELEM *tls = srf->tls, *trn; if (srf->trnode != RT_NULL && srf->trnode != srf) { for (; tls != RT_NULL; tls = nxt) { i = (rt_word)tls->data >> 16; j = (rt_word)tls->data & 0xFFFF; nxt = tls->next; tls->data = 0; tline = i * tiles_in_row; /* check matching existing trnode for insertion, * only tile list's head needs to be checked as elements * grouping for cached transform is retained from "clist" */ trn = tiles[tline + j]; rt_Array *arr = (rt_Array *)srf->trnode; rt_BOUND *trb = (rt_BOUND *)srf->trn->temp; if (trn != RT_NULL && trn->temp == trb) { /* insert element under existing trnode */ tls->next = trn->next; trn->next = tls; } else { /* insert element as list's head */ tls->next = tiles[tline + j]; tiles[tline + j] = tls; /* alloc new trnode element as none has been found */ trn = (rt_ELEM *)alloc(sizeof(rt_ELEM), RT_QUAD_ALIGN); trn->data = (rt_cell)tls; /* trnode's last element */ trn->simd = arr->s_srf; trn->temp = trb; /* insert element as list's head */ trn->next = tiles[tline + j]; tiles[tline + j] = trn; } } } else { for (; tls != RT_NULL; tls = nxt) { i = (rt_word)tls->data >> 16; j = (rt_word)tls->data & 0xFFFF; nxt = tls->next; tls->data = 0; tline = i * tiles_in_row; /* insert element as list's head */ tls->next = tiles[tline + j]; tiles[tline + j] = tls; } } } if (g_print) { rt_si32 i = 0, j = 0; tline = i * tiles_in_row; RT_PRINT_TLS_LST(tiles[tline + j], i, j); } } else #endif /* RT_OPTS_TILING */ { for (i = 0; i < tiles_in_col; i++) { tline = i * tiles_in_row; for (j = 0; j < tiles_in_row; j++) { tiles[tline + j] = clist; } } } /* aim rays at pixel centers */ RT_VEC3_MUL_VAL1(hor, hor, factor); RT_VEC3_MUL_VAL1(ver, ver, factor); RT_VEC3_MAD_VAL1(dir, hor, 0.5f); RT_VEC3_MAD_VAL1(dir, ver, 0.5f); /* accumulate ambient from camera and all light sources */ RT_VEC3_MUL_VAL1(amb, cam->cam->col.hdr, cam->cam->lum[0]); amb[RT_A] = cam->cam->lum[0]; rt_Light *lgt = RT_NULL; for (lgt = lgt_head; lgt != RT_NULL; lgt = lgt->next) { RT_VEC3_MAD_VAL1(amb, lgt->lgt->col.hdr, lgt->lgt->lum[0]); amb[RT_A] += lgt->lgt->lum[0]; } #if RT_OPTS_UPDATE_EXT0 != 0 } /* --<----<-- skip update1 --<----<-- */ #endif /* RT_OPTS_UPDATE_EXT0 */ #if RT_OPTS_RENDER_EXT0 != 0 if ((opts & RT_OPTS_RENDER_EXT0) == 0) { /* -->---->-- skip render0 -->---->-- */ #endif /* RT_OPTS_RENDER_EXT0 */ #if 0 /* SIMD-buffers don't normally require reset between frames */ reset_color(); #endif /* enable for SIMD-buffers as a debug option if needed */ /* multi-threaded render */ #if RT_OPTS_THREAD != 0 if ((opts & RT_OPTS_THREAD) != 0 && this == pfm->get_cur_scene() #if RT_OPTS_RENDER_EXT1 != 0 && (opts & RT_OPTS_RENDER_EXT1) == 0 #endif /* RT_OPTS_RENDER_EXT1 */ ) { this->f_render(tdata, thnum, 1); } else #endif /* RT_OPTS_THREAD */ { render_scene(this, -thnum, 1); } pts_c = tharr[0]->s_inf->pts_c[0]; #if RT_OPTS_RENDER_EXT0 != 0 } /* --<----<-- skip render0 --<----<-- */ #endif /* RT_OPTS_RENDER_EXT0 */ #if RT_OPTS_UPDATE_EXT0 != 0 if ((opts & RT_OPTS_UPDATE_EXT0) == 0) { /* -->---->-- skip update2 -->---->-- */ #endif /* RT_OPTS_UPDATE_EXT0 */ /* print state done */ if (g_print) { RT_PRINT_STATE_DONE(); g_print = RT_FALSE; } /* release memory for temporary per-frame allocs */ for (i = 0; i < thnum; i++) { tharr[i]->release(tharr[i]->mpool); } release(mpool); #if RT_OPTS_UPDATE_EXT0 != 0 } /* --<----<-- skip update2 --<----<-- */ else { pending = 1; } #endif /* RT_OPTS_UPDATE_EXT0 */ } /* * Update portion of the scene with given "index" * as part of the multi-threaded update. */ rt_void rt_Scene::update_slice(rt_si32 index, rt_si32 phase) { rt_si32 i; rt_Array *arr; rt_Camera *cam; rt_Light *lgt; rt_Surface *srf; if (phase == 1) { for (arr = arr_head, i = 0; arr != RT_NULL; arr = arr->next, i++) { if ((i % thnum) != index) { continue; } /* update array's fields from transform matrix * updated in sequential phase 0.5 */ arr->update_fields(); } for (cam = cam_head, i = 0; cam != RT_NULL; cam = cam->next, i++) { if ((i % thnum) != index) { continue; } /* update camera's fields and transform matrix * from parent array's transform matrix * updated in sequential phase 0.5 */ cam->update_fields(); } for (lgt = lgt_head, i = 0; lgt != RT_NULL; lgt = lgt->next, i++) { if ((i % thnum) != index) { continue; } /* update light's fields and transform matrix * from parent array's transform matrix * updated in sequential phase 0.5 */ lgt->update_fields(); } for (srf = srf_head, i = 0; srf != RT_NULL; srf = srf->next, i++) { if ((i % thnum) != index) { continue; } /* update surface's fields and transform matrix * from parent array's transform matrix * updated in sequential phase 0.5 */ srf->update_fields(); } } else if (phase == 2) { for (srf = srf_head, i = 0; srf != RT_NULL; srf = srf->next, i++) { if ((i % thnum) != index) { continue; } /* rebuild surface's clip list (cross-surface) * based on transform flags updated in 1st phase above */ tharr[index]->sclip(srf); /* update surface's bounds taking into account surfaces * from custom clippers list updated above */ srf->update_bounds(); /* rebuild surface's tile list (per-surface) * based on surface bounds updated above */ tharr[index]->stile(srf); } } else if (phase == 3) { for (srf = srf_head, i = 0; srf != RT_NULL; srf = srf->next, i++) { if ((i % thnum) != index) { continue; } if (g_print) { RT_PRINT_SRF(srf); } /* rebuild surface's rfl/rfr surface lists (cross-surface) * based on surface bounds updated in 2nd phase above * and array bounds updated in sequential phase 2.5 */ tharr[index]->ssort(srf); /* rebuild surface's light/shadow lists (cross-surface) * based on surface bounds updated in 2nd phase above * and array bounds updated in sequential phase 2.5 */ tharr[index]->lsort(srf); /* update surface's backend-related parts */ pfm->update0(srf->s_srf); #if 0 /* SIMD-buffers don't normally require reset between frames */ memset(srf->s_srf->msc_p[0], 255, RT_BUFFER_POOL*thnum); #endif /* enable for SIMD-buffers as a debug option if needed */ } } } /* * Render portion of the frame with given "index" * as part of the multi-threaded render. */ rt_void rt_Scene::render_slice(rt_si32 index, rt_si32 phase) { /* adjust ray steppers according to antialiasing mode */ rt_real fha[RT_SIMD_WIDTH], fhi[RT_SIMD_WIDTH], fhu; /* h - hor */ rt_real fva[RT_SIMD_WIDTH], fvi[RT_SIMD_WIDTH], fvu; /* v - ver */ rt_si32 i, n; if (pfm->fsaa == RT_FSAA_NO) { for (i = 0; i < pfm->simd_width; i++) { fha[i] = 0.0f; fva[i] = 0.0f; fhi[i] = (rt_real)i; fvi[i] = (rt_real)index; } fhu = (rt_real)(pfm->simd_width); fvu = (rt_real)thnum; } else if (pfm->fsaa == RT_FSAA_2X) /* alternating */ { rt_real as = 0.25f; #if RT_FSAA_REGULAR rt_real ar = 0.00f; #else /* RT_FSAA_REGULAR */ rt_real ar = 0.08f; #endif /* RT_FSAA_REGULAR */ for (i = 0; i < pfm->simd_width / 4; i++) { fha[i*4+0] = (-ar+as); fha[i*4+1] = (+ar-as); fha[i*4+2] = (+ar-as); fha[i*4+3] = (-ar+as); fva[i*4+0] = (+ar+as); fva[i*4+1] = (-ar-as); fva[i*4+2] = (+ar+as); fva[i*4+3] = (-ar-as); fhi[i*4+0] = (rt_real)(i*2+0); fhi[i*4+1] = (rt_real)(i*2+0); fhi[i*4+2] = (rt_real)(i*2+1); fhi[i*4+3] = (rt_real)(i*2+1); fvi[i*4+0] = (rt_real)index; fvi[i*4+1] = (rt_real)index; fvi[i*4+2] = (rt_real)index; fvi[i*4+3] = (rt_real)index; } fhu = (rt_real)(pfm->simd_width / 2); fvu = (rt_real)thnum; } else if (pfm->fsaa == RT_FSAA_4X) { rt_real as = 0.25f; #if RT_FSAA_REGULAR rt_real ar = 0.00f; #else /* RT_FSAA_REGULAR */ rt_real ar = 0.08f; #endif /* RT_FSAA_REGULAR */ for (i = 0; i < pfm->simd_width / 4; i++) { fha[i*4+0] = (-ar-as); fha[i*4+1] = (-ar+as); fha[i*4+2] = (+ar-as); fha[i*4+3] = (+ar+as); fva[i*4+0] = (+ar-as); fva[i*4+1] = (-ar-as); fva[i*4+2] = (+ar+as); fva[i*4+3] = (-ar+as); fhi[i*4+0] = (rt_real)i; fhi[i*4+1] = (rt_real)i; fhi[i*4+2] = (rt_real)i; fhi[i*4+3] = (rt_real)i; fvi[i*4+0] = (rt_real)index; fvi[i*4+1] = (rt_real)index; fvi[i*4+2] = (rt_real)index; fvi[i*4+3] = (rt_real)index; } fhu = (rt_real)(pfm->simd_width / 4); fvu = (rt_real)thnum; } else if (pfm->fsaa == RT_FSAA_8X) /* 8x reserved */ { ; } /* rt_SIMD_CAMERA */ rt_SIMD_CAMERA *s_cam = tharr[index]->s_cam; RT_SIMD_SET(s_cam->t_max, RT_INF); RT_SIMD_SET(s_cam->dir_x, dir[RT_X]); RT_SIMD_SET(s_cam->dir_y, dir[RT_Y]); RT_SIMD_SET(s_cam->dir_z, dir[RT_Z]); RT_SIMD_SET(s_cam->hor_x, hor[RT_X]); RT_SIMD_SET(s_cam->hor_y, hor[RT_Y]); RT_SIMD_SET(s_cam->hor_z, hor[RT_Z]); RT_SIMD_SET(s_cam->ver_x, ver[RT_X]); RT_SIMD_SET(s_cam->ver_y, ver[RT_Y]); RT_SIMD_SET(s_cam->ver_z, ver[RT_Z]); RT_SIMD_SET(s_cam->hor_u, fhu); RT_SIMD_SET(s_cam->ver_u, fvu); RT_SIMD_SET(s_cam->clamp, (rt_real)255); RT_SIMD_SET(s_cam->cmask, (rt_elem)255); RT_SIMD_SET(s_cam->col_r, amb[RT_R]); RT_SIMD_SET(s_cam->col_g, amb[RT_G]); RT_SIMD_SET(s_cam->col_b, amb[RT_B]); RT_SIMD_SET(s_cam->l_amb, amb[RT_A]); RT_SIMD_SET(s_cam->x_row, (rt_real)(x_row << pfm->fsaa)); RT_SIMD_SET(s_cam->idx_h, pfm->simd_width); /* rt_SIMD_CONTEXT */ rt_SIMD_CONTEXT *s_ctx = tharr[index]->s_ctx; s_ctx->param[1] = -((opts & RT_OPTS_GAMMA) == 0) & RT_PROP_GAMMA; RT_SIMD_SET(s_ctx->t_min, cam->pov); RT_SIMD_SET(s_ctx->wmask, -1); RT_SIMD_SET(s_ctx->org_x, pos[RT_X]); RT_SIMD_SET(s_ctx->org_y, pos[RT_Y]); RT_SIMD_SET(s_ctx->org_z, pos[RT_Z]); /* rt_SIMD_INFOX */ rt_SIMD_INFOX *s_inf = tharr[index]->s_inf; s_inf->ctx = s_ctx; s_inf->cam = s_cam; s_inf->lst = clist; s_inf->thndx = index; s_inf->thnum = thnum; s_inf->depth = depth; s_inf->fsaa = pfm->fsaa; s_inf->pt_on = pt_on; RT_SIMD_SET(s_inf->pts_c, pts_c); for (n = RT_MAX(1, pt_on); n > 0; n--) { /* use of integer indices for primary rays update * makes related fp-math independent from SIMD width */ for (i = 0; i < pfm->simd_width; i++) { s_cam->index[i] = i; s_inf->hor_c[i] = fhi[i]; s_inf->hor_i[i] = fhi[i]; s_inf->ver_i[i] = fvi[i]; s_cam->hor_a[i] = fha[i]; s_cam->ver_a[i] = fva[i]; } s_inf->depth = depth; RT_SIMD_SET(s_ctx->wmask, -1); /* render frame based on tilebuffer */ pfm->render0(s_inf); } } /* * Return framebuffer's stride in pixels. */ rt_si32 rt_Scene::get_x_row() { return x_row; } /* * Print current state during next render-call. * Has global scope and effect on any instance. * The flag is reset upon rendering completion. */ rt_void rt_Scene::print_state() { g_print = RT_TRUE; } /* * Generate next random number using XX-bit LCG method. */ static rt_ui64 randomXX(rt_ui64 seed) { #if RT_PRNG != LCG48 /* use 48-bit seeding to decorrelate lesser LCG */ return (seed * LL(25214903917) + 11) & LL(0x0000FFFFFFFFFFFF); #else /* RT_PRNG == LCG48 */ /* use 32-bit seeding to decorrelate 48-bit LCG */ return (seed * 214013 + 2531011) & 0xFFFFFFFF; #endif /* RT_PRNG == LCG48 */ } /* * Reset current state of framebuffer's seed-plane for path-tracer. */ rt_void rt_Scene::reset_pseed() { if ((opts & RT_OPTS_PT) != 0) { return; } rt_si32 k, n = 4 * x_row * y_res; rt_ui64 seed = 1; for (k = 0; k < n; k++) { seed = randomXX(seed); pseed[k] = (rt_elem)seed; } } /* * Reset current state of framebuffer's color-planes for path-tracer. */ rt_void rt_Scene::reset_color() { if ((opts & RT_OPTS_PT) != 0) { return; } pts_c = 0.0f; memset(ptr_r, 0, 4 * x_row * y_res * sizeof(rt_real)); memset(ptr_g, 0, 4 * x_row * y_res * sizeof(rt_real)); memset(ptr_b, 0, 4 * x_row * y_res * sizeof(rt_real)); } /* * Get runtime optimization flags. */ rt_si32 rt_Scene::get_opts() { return opts; } /* * Set runtime optimization flags, * except those turned off in the original scene definition. */ rt_si32 rt_Scene::set_opts(rt_si32 opts) { this->opts = opts & ~scn->opts; /* trigger update of the whole hierarchy, * safe to reset time as "rootobj" never has an animator, * "rootobj's" time is restored within the update */ rootobj.time = -1; return opts; } /* * Get path-tracer mode: 0 - off, n - on (number of frames between updates). */ rt_si32 rt_Scene::get_pton() { return this->pt_on; } /* * Set path-tracer mode: 0 - off, n - on (number of frames between updates). */ rt_si32 rt_Scene::set_pton(rt_si32 pton) { if ((opts & RT_OPTS_PT) == 0) /* if path-tracer is not optimized out */ { rt_si32 pt_on = this->pt_on; this->pt_on = pton; if (this->pt_on && !pt_on) { reset_pseed(); reset_color(); } } return this->pt_on; } /* * Return current camera index. */ rt_si32 rt_Scene::get_cam_idx() { return cam_idx; } /* * Select next camera in the list, return its index. */ rt_si32 rt_Scene::next_cam() { if (cam->next != RT_NULL) { cam = cam->next; cam_idx++; } else { cam = cam_head; cam_idx = 0; } return cam_idx; } /* * Return pointer to the framebuffer. */ rt_ui32* rt_Scene::get_frame() { return frame; } /* * Save current frame to an image. */ rt_void rt_Scene::save_frame(rt_si32 index) { rt_char name[20]; if (index < 1000) { strncpy(name, "scrXXX.bmp", 20); } else { strncpy(name, "scrXXX-Y.bmp", 20); } /* prepare filename string */ name[5] = '0' + (index % 10); index /= 10; name[4] = '0' + (index % 10); index /= 10; name[3] = '0' + (index % 10); if (index >= 10) { index /= 10; index -= 1; name[7] = '0' + (index % 10); } /* prepare frame's image */ rt_TEX tex; tex.ptex = get_frame(); tex.tex_num = +x_row; /* <- temp fix for frame's stride */ tex.x_dim = +x_res; tex.y_dim = -y_res; /* save frame's image */ save_image(this, name, &tex); } /* * Return pointer to the platform container. */ rt_Platform* rt_Scene::get_platform() { return pfm; } /* * Deinitialize scene. */ rt_Scene::~rt_Scene() { rt_si32 i; pfm->del_scene(this); /* destroy scene threads array */ for (i = 0; i < thnum; i++) { delete tharr[i]; } /* destroy object hierarchy */ delete root; /* destroy textures */ while (tex_head) { rt_Texture *tex = tex_head->next; delete tex_head; tex_head = tex; } /* unlock scene data */ scn->lock = RT_NULL; } /******************************************************************************/ /***************************** MISC RENDERING *****************************/ /******************************************************************************/ #define II 0xFF000000 #define OO 0xFFFFFFFF #define dW 5 #define dH 7 rt_ui32 digits[10][dH][dW] = { { OO, OO, OO, OO, OO, OO, II, II, II, OO, OO, II, OO, II, OO, OO, II, OO, II, OO, OO, II, OO, II, OO, OO, II, II, II, OO, OO, OO, OO, OO, OO, }, { OO, OO, OO, OO, OO, OO, OO, II, OO, OO, OO, II, II, OO, OO, OO, OO, II, OO, OO, OO, OO, II, OO, OO, OO, II, II, II, OO, OO, OO, OO, OO, OO, }, { OO, OO, OO, OO, OO, OO, II, II, II, OO, OO, OO, OO, II, OO, OO, II, II, II, OO, OO, II, OO, OO, OO, OO, II, II, II, OO, OO, OO, OO, OO, OO, }, { OO, OO, OO, OO, OO, OO, II, II, II, OO, OO, OO, OO, II, OO, OO, II, II, II, OO, OO, OO, OO, II, OO, OO, II, II, II, OO, OO, OO, OO, OO, OO, }, { OO, OO, OO, OO, OO, OO, II, OO, II, OO, OO, II, OO, II, OO, OO, II, II, II, OO, OO, OO, OO, II, OO, OO, OO, OO, II, OO, OO, OO, OO, OO, OO, }, { OO, OO, OO, OO, OO, OO, II, II, II, OO, OO, II, OO, OO, OO, OO, II, II, II, OO, OO, OO, OO, II, OO, OO, II, II, II, OO, OO, OO, OO, OO, OO, }, { OO, OO, OO, OO, OO, OO, II, II, II, OO, OO, II, OO, OO, OO, OO, II, II, II, OO, OO, II, OO, II, OO, OO, II, II, II, OO, OO, OO, OO, OO, OO, }, { OO, OO, OO, OO, OO, OO, II, II, II, OO, OO, OO, OO, II, OO, OO, OO, OO, II, OO, OO, OO, OO, II, OO, OO, OO, OO, II, OO, OO, OO, OO, OO, OO, }, { OO, OO, OO, OO, OO, OO, II, II, II, OO, OO, II, OO, II, OO, OO, II, II, II, OO, OO, II, OO, II, OO, OO, II, II, II, OO, OO, OO, OO, OO, OO, }, { OO, OO, OO, OO, OO, OO, II, II, II, OO, OO, II, OO, II, OO, OO, II, II, II, OO, OO, OO, OO, II, OO, OO, II, II, II, OO, OO, OO, OO, OO, OO, }, }; /* * Render given number "num" on the screen at given coords "x" and "y". * Parameters "d" and "z" specify direction and zoom respectively. */ rt_void rt_Scene::render_num(rt_si32 x, rt_si32 y, rt_si32 d, rt_si32 z, rt_ui32 num) { rt_si32 arr[16], i, c, k; for (i = 0, c = 0; i < 16; i++) { k = num % 10; num /= 10; arr[i] = k; if (k != 0) { c = i; } } c++; d = (d + 1) / 2; rt_si32 xd, yd, xz, yz; rt_ui32 *src, *dst; for (i = 0; i < c; i++) { k = arr[i]; src = &digits[k][0][0]; dst = frame + y * x_row + x + (c * d - 1 - i) * dW * z; for (yd = 0; yd < dH; yd++) { for (yz = 0; yz < z; yz++) { for (xd = 0; xd < dW; xd++) { for (xz = 0; xz < z; xz++) { if (dst >= frame && dst < frame + y_res * x_row) { *dst++ = *src; } } src++; } dst += x_row - dW * z; src -= dW; } src += dW; } } } /******************************************************************************/ #define RT_PLOT_FRAGS 1 /* 1 enables (on -z) plotting of FSAA samples */ #define RT_PLOT_FUNCS 1 /* 1 enables (on -z) plotting of Fresnel funcs */ #define RT_PLOT_TRIGS 1 /* 1 enables (on -z) plotting of sin/cos funcs */ /* * Plot fragments into their respective framebuffers then save. * Scene's framebuffer is first cleared then overwritten. */ rt_void rt_Scene::plot_frags() { if (RT_ELEMENT != 32) { /* plotting of funcs and trigs is ignored, use fp32 target */ RT_LOGI("(no funcs, use fp32) "); } #if RT_PLOT_FRAGS rt_real fdh[8], fdv[8]; rt_si32 r = RT_MIN(x_res, y_res) - 1, i; rt_si32 x = (x_res - r) / 2, y = (y_res - r) / 2; memset(frame, 0, x_row * y_res * sizeof(rt_ui32)); for (i = 0; i <= r; i++) { frame[(y+0)*x_row+(x+i)] = 0x000000FF; frame[(y+i)*x_row+(x+0)] = 0x000000FF; frame[(y+i)*x_row+(x+r)] = 0x000000FF; frame[(y+r)*x_row+(x+i)] = 0x000000FF; } /* plot samples for 2X alternating slope pattern */ { rt_real as = 0.25f; #if RT_FSAA_REGULAR rt_real ar = 0.00f; #else /* RT_FSAA_REGULAR */ rt_real ar = 0.08f; #endif /* RT_FSAA_REGULAR */ fdh[0] = ((-ar+as) + 0.5f) * r + 0.5f; fdh[1] = ((+ar-as) + 0.5f) * r + 0.5f; fdh[2] = ((+ar-as) + 0.5f) * r + 0.5f; fdh[3] = ((-ar+as) + 0.5f) * r + 0.5f; fdv[0] = ((+ar+as) + 0.5f) * r + 0.5f; fdv[1] = ((-ar-as) + 0.5f) * r + 0.5f; fdv[2] = ((+ar+as) + 0.5f) * r + 0.5f; fdv[3] = ((-ar-as) + 0.5f) * r + 0.5f; frame[(y + rt_si32(fdv[0]))*x_row+(x + rt_si32(fdh[0]))] = 0x00FF0000; frame[(y + rt_si32(fdv[1]))*x_row+(x + rt_si32(fdh[1]))] = 0x00FF0000; frame[(y + rt_si32(fdv[2]))*x_row+(x + rt_si32(fdh[2]))] = 0x0000FF00; frame[(y + rt_si32(fdv[3]))*x_row+(x + rt_si32(fdh[3]))] = 0x0000FF00; } save_frame(820); memset(frame, 0, x_row * y_res * sizeof(rt_ui32)); for (i = 0; i <= r; i++) { frame[(y+0)*x_row+(x+i)] = 0x000000FF; frame[(y+i)*x_row+(x+0)] = 0x000000FF; frame[(y+i)*x_row+(x+r)] = 0x000000FF; frame[(y+r)*x_row+(x+i)] = 0x000000FF; } /* plot samples for 4X rotated grid pattern */ { rt_real as = 0.25f; #if RT_FSAA_REGULAR rt_real ar = 0.00f; #else /* RT_FSAA_REGULAR */ rt_real ar = 0.08f; #endif /* RT_FSAA_REGULAR */ fdh[0] = ((-ar-as) + 0.5f) * r + 0.5f; fdh[1] = ((-ar+as) + 0.5f) * r + 0.5f; fdh[2] = ((+ar-as) + 0.5f) * r + 0.5f; fdh[3] = ((+ar+as) + 0.5f) * r + 0.5f; fdv[0] = ((+ar-as) + 0.5f) * r + 0.5f; fdv[1] = ((-ar-as) + 0.5f) * r + 0.5f; fdv[2] = ((+ar+as) + 0.5f) * r + 0.5f; fdv[3] = ((-ar+as) + 0.5f) * r + 0.5f; frame[(y + rt_si32(fdv[0]))*x_row+(x + rt_si32(fdh[0]))] = 0x00FF0000; frame[(y + rt_si32(fdv[1]))*x_row+(x + rt_si32(fdh[1]))] = 0x00FF0000; frame[(y + rt_si32(fdv[2]))*x_row+(x + rt_si32(fdh[2]))] = 0x00FF0000; frame[(y + rt_si32(fdv[3]))*x_row+(x + rt_si32(fdh[3]))] = 0x00FF0000; } save_frame(840); #endif /* RT_PLOT_FRAGS */ } /* * Swap (v4) for available 128-bit target before enabling plot, use 32-bit fp. */ #if RT_PLOT_FUNCS namespace rt_simd_128v4 { rt_void plot_fresnel(rt_SIMD_INFOP *s_inf); } namespace rt_simd_128v4 { rt_void plot_schlick(rt_SIMD_INFOP *s_inf); } namespace rt_simd_128v4 { rt_void plot_fresnel_metal_fast(rt_SIMD_INFOP *s_inf); } namespace rt_simd_128v4 { rt_void plot_fresnel_metal_slow(rt_SIMD_INFOP *s_inf); } #endif /* RT_PLOT_FUNCS */ /* * Plot functions into their respective framebuffers then save. * Scene's framebuffer is first cleared then overwritten. */ rt_void rt_Scene::plot_funcs() { if (RT_ELEMENT != 32) { /* plotting of funcs and trigs is ignored, use fp32 target */ return; } #if RT_PLOT_FUNCS /* reserve memory for temporary buffer in the heap */ rt_pntr s_ptr = reserve(4000, RT_SIMD_ALIGN); /* allocate root SIMD structure */ rt_SIMD_INFOP *s_inf = (rt_SIMD_INFOP *) alloc(sizeof(rt_SIMD_INFOP), RT_SIMD_ALIGN); memset(s_inf, 0, sizeof(rt_SIMD_INFOP)); /* allocate regs SIMD structure */ rt_SIMD_REGS *s_reg = (rt_SIMD_REGS *) alloc(sizeof(rt_SIMD_REGS), RT_SIMD_ALIGN); ASM_INIT(s_inf, s_reg) rt_si32 i, h = y_res - 1; rt_fp32 s = RT_PI_2 / x_res; RT_SIMD_SET(s_inf->c_rfr, (1.0/1.5)); RT_SIMD_SET(s_inf->rfr_2, (1.0/1.5)*(1.0/1.5)); memset(frame, 0, x_row * y_res * sizeof(rt_ui32)); for (i = 0; i < x_res / 4; i++) { s_inf->i_cos[0*4+0] = -RT_COS(s*(i*4+0)); s_inf->i_cos[0*4+1] = -RT_COS(s*(i*4+1)); s_inf->i_cos[0*4+2] = -RT_COS(s*(i*4+2)); s_inf->i_cos[0*4+3] = -RT_COS(s*(i*4+3)); rt_simd_128v4::plot_fresnel(s_inf); frame[rt_si32((1.0f-s_inf->o_rfl[0*4+0])*h)*x_row+i*4+0] = 0x000000FF; frame[rt_si32((1.0f-s_inf->o_rfl[0*4+1])*h)*x_row+i*4+1] = 0x000000FF; frame[rt_si32((1.0f-s_inf->o_rfl[0*4+2])*h)*x_row+i*4+2] = 0x000000FF; frame[rt_si32((1.0f-s_inf->o_rfl[0*4+3])*h)*x_row+i*4+3] = 0x000000FF; #if RT_DEBUG >= 2 RT_LOGI("Fresnel_outer[%03X] = %f\n", i*4+0, s_inf->o_rfl[0*4+0]); RT_LOGI("Fresnel_outer[%03X] = %f\n", i*4+1, s_inf->o_rfl[0*4+1]); RT_LOGI("Fresnel_outer[%03X] = %f\n", i*4+2, s_inf->o_rfl[0*4+2]); RT_LOGI("Fresnel_outer[%03X] = %f\n", i*4+3, s_inf->o_rfl[0*4+3]); #endif /* RT_DEBUG */ } save_frame(910); memset(frame, 0, x_row * y_res * sizeof(rt_ui32)); for (i = 0; i < x_res / 4; i++) { s_inf->i_cos[0*4+0] = -RT_COS(s*(i*4+0)); s_inf->i_cos[0*4+1] = -RT_COS(s*(i*4+1)); s_inf->i_cos[0*4+2] = -RT_COS(s*(i*4+2)); s_inf->i_cos[0*4+3] = -RT_COS(s*(i*4+3)); rt_simd_128v4::plot_schlick(s_inf); frame[rt_si32((1.0f-s_inf->o_rfl[0*4+0])*h)*x_row+i*4+0] = 0x00FF0000; frame[rt_si32((1.0f-s_inf->o_rfl[0*4+1])*h)*x_row+i*4+1] = 0x00FF0000; frame[rt_si32((1.0f-s_inf->o_rfl[0*4+2])*h)*x_row+i*4+2] = 0x00FF0000; frame[rt_si32((1.0f-s_inf->o_rfl[0*4+3])*h)*x_row+i*4+3] = 0x00FF0000; #if RT_DEBUG >= 2 RT_LOGI("Schlick_outer[%03X] = %f\n", i*4+0, s_inf->o_rfl[0*4+0]); RT_LOGI("Schlick_outer[%03X] = %f\n", i*4+1, s_inf->o_rfl[0*4+1]); RT_LOGI("Schlick_outer[%03X] = %f\n", i*4+2, s_inf->o_rfl[0*4+2]); RT_LOGI("Schlick_outer[%03X] = %f\n", i*4+3, s_inf->o_rfl[0*4+3]); #endif /* RT_DEBUG */ } save_frame(920); RT_SIMD_SET(s_inf->c_rfr, (1.5/1.0)); RT_SIMD_SET(s_inf->rfr_2, (1.5/1.0)*(1.5/1.0)); memset(frame, 0, x_row * y_res * sizeof(rt_ui32)); for (i = 0; i < x_res / 4; i++) { s_inf->i_cos[0*4+0] = -RT_COS(s*(i*4+0)); s_inf->i_cos[0*4+1] = -RT_COS(s*(i*4+1)); s_inf->i_cos[0*4+2] = -RT_COS(s*(i*4+2)); s_inf->i_cos[0*4+3] = -RT_COS(s*(i*4+3)); rt_simd_128v4::plot_fresnel(s_inf); frame[rt_si32((1.0f-s_inf->o_rfl[0*4+0])*h)*x_row+i*4+0] = 0x000000FF; frame[rt_si32((1.0f-s_inf->o_rfl[0*4+1])*h)*x_row+i*4+1] = 0x000000FF; frame[rt_si32((1.0f-s_inf->o_rfl[0*4+2])*h)*x_row+i*4+2] = 0x000000FF; frame[rt_si32((1.0f-s_inf->o_rfl[0*4+3])*h)*x_row+i*4+3] = 0x000000FF; #if RT_DEBUG >= 2 RT_LOGI("Fresnel_inner[%03X] = %f\n", i*4+0, s_inf->o_rfl[0*4+0]); RT_LOGI("Fresnel_inner[%03X] = %f\n", i*4+1, s_inf->o_rfl[0*4+1]); RT_LOGI("Fresnel_inner[%03X] = %f\n", i*4+2, s_inf->o_rfl[0*4+2]); RT_LOGI("Fresnel_inner[%03X] = %f\n", i*4+3, s_inf->o_rfl[0*4+3]); #endif /* RT_DEBUG */ } save_frame(930); memset(frame, 0, x_row * y_res * sizeof(rt_ui32)); for (i = 0; i < x_res / 4; i++) { s_inf->i_cos[0*4+0] = -RT_COS(s*(i*4+0)); s_inf->i_cos[0*4+1] = -RT_COS(s*(i*4+1)); s_inf->i_cos[0*4+2] = -RT_COS(s*(i*4+2)); s_inf->i_cos[0*4+3] = -RT_COS(s*(i*4+3)); rt_simd_128v4::plot_schlick(s_inf); frame[rt_si32((1.0f-s_inf->o_rfl[0*4+0])*h)*x_row+i*4+0] = 0x00FF0000; frame[rt_si32((1.0f-s_inf->o_rfl[0*4+1])*h)*x_row+i*4+1] = 0x00FF0000; frame[rt_si32((1.0f-s_inf->o_rfl[0*4+2])*h)*x_row+i*4+2] = 0x00FF0000; frame[rt_si32((1.0f-s_inf->o_rfl[0*4+3])*h)*x_row+i*4+3] = 0x00FF0000; #if RT_DEBUG >= 2 RT_LOGI("Schlick_inner[%03X] = %f\n", i*4+0, s_inf->o_rfl[0*4+0]); RT_LOGI("Schlick_inner[%03X] = %f\n", i*4+1, s_inf->o_rfl[0*4+1]); RT_LOGI("Schlick_inner[%03X] = %f\n", i*4+2, s_inf->o_rfl[0*4+2]); RT_LOGI("Schlick_inner[%03X] = %f\n", i*4+3, s_inf->o_rfl[0*4+3]); #endif /* RT_DEBUG */ } save_frame(940); RT_SIMD_SET(s_inf->c_rcp, (0.27)); RT_SIMD_SET(s_inf->ext_2, (2.77)*(2.77)); memset(frame, 0, x_row * y_res * sizeof(rt_ui32)); for (i = 0; i < x_res / 4; i++) { s_inf->i_cos[0*4+0] = -RT_COS(s*(i*4+0)); s_inf->i_cos[0*4+1] = -RT_COS(s*(i*4+1)); s_inf->i_cos[0*4+2] = -RT_COS(s*(i*4+2)); s_inf->i_cos[0*4+3] = -RT_COS(s*(i*4+3)); rt_simd_128v4::plot_fresnel_metal_fast(s_inf); frame[rt_si32((1.0f-s_inf->o_rfl[0*4+0])*h)*x_row+i*4+0] = 0x000000FF; frame[rt_si32((1.0f-s_inf->o_rfl[0*4+1])*h)*x_row+i*4+1] = 0x000000FF; frame[rt_si32((1.0f-s_inf->o_rfl[0*4+2])*h)*x_row+i*4+2] = 0x000000FF; frame[rt_si32((1.0f-s_inf->o_rfl[0*4+3])*h)*x_row+i*4+3] = 0x000000FF; #if RT_DEBUG >= 2 RT_LOGI("Fresnel_metal_fast[%03X] = %f\n", i*4+0, s_inf->o_rfl[0*4+0]); RT_LOGI("Fresnel_metal_fast[%03X] = %f\n", i*4+1, s_inf->o_rfl[0*4+1]); RT_LOGI("Fresnel_metal_fast[%03X] = %f\n", i*4+2, s_inf->o_rfl[0*4+2]); RT_LOGI("Fresnel_metal_fast[%03X] = %f\n", i*4+3, s_inf->o_rfl[0*4+3]); #endif /* RT_DEBUG */ } save_frame(950); memset(frame, 0, x_row * y_res * sizeof(rt_ui32)); for (i = 0; i < x_res / 4; i++) { s_inf->i_cos[0*4+0] = -RT_COS(s*(i*4+0)); s_inf->i_cos[0*4+1] = -RT_COS(s*(i*4+1)); s_inf->i_cos[0*4+2] = -RT_COS(s*(i*4+2)); s_inf->i_cos[0*4+3] = -RT_COS(s*(i*4+3)); rt_simd_128v4::plot_fresnel_metal_slow(s_inf); frame[rt_si32((1.0f-s_inf->o_rfl[0*4+0])*h)*x_row+i*4+0] = 0x000000FF; frame[rt_si32((1.0f-s_inf->o_rfl[0*4+1])*h)*x_row+i*4+1] = 0x000000FF; frame[rt_si32((1.0f-s_inf->o_rfl[0*4+2])*h)*x_row+i*4+2] = 0x000000FF; frame[rt_si32((1.0f-s_inf->o_rfl[0*4+3])*h)*x_row+i*4+3] = 0x000000FF; #if RT_DEBUG >= 2 RT_LOGI("Fresnel_metal_slow[%03X] = %f\n", i*4+0, s_inf->o_rfl[0*4+0]); RT_LOGI("Fresnel_metal_slow[%03X] = %f\n", i*4+1, s_inf->o_rfl[0*4+1]); RT_LOGI("Fresnel_metal_slow[%03X] = %f\n", i*4+2, s_inf->o_rfl[0*4+2]); RT_LOGI("Fresnel_metal_slow[%03X] = %f\n", i*4+3, s_inf->o_rfl[0*4+3]); #endif /* RT_DEBUG */ } save_frame(960); ASM_DONE(s_inf) release(s_ptr); rt_si32 r = RT_MIN(x_res, y_res) - 1; rt_si32 x = (x_res - r) / 2, y = (y_res - r) / 2; memset(frame, 0, x_row * y_res * sizeof(rt_ui32)); for (i = 0; i <= r; i++) { frame[(y+0)*x_row+(x+i)] = 0x000000FF; frame[(y+i)*x_row+(x+0)] = 0x000000FF; frame[(y+i)*x_row+(x+r)] = 0x000000FF; frame[(y+r)*x_row+(x+i)] = 0x000000FF; } /* plot reference and actual Gamma color conversion */ for (i = 0, s = r; i <= r; i++) { frame[(y+rt_si32((1.0f-RT_POW(i/s,1/2.2))*s))*x_row+x+i] = 0x00FF0000; frame[(y+rt_si32((1.0f-RT_POW(i/s, 2.2))*s))*x_row+x+i] = 0x00FF0000; frame[(y+rt_si32((1.0f-RT_POW(i/s,1/2.0))*s))*x_row+x+i] = 0x0000FF00; frame[(y+rt_si32((1.0f-RT_POW(i/s, 2.0))*s))*x_row+x+i] = 0x0000FF00; } save_frame(970); #endif /* RT_PLOT_FUNCS */ } /* * Swap (v4) for available 128-bit target before enabling plot, use 32-bit fp. */ #if RT_PLOT_TRIGS namespace rt_simd_128v4 { rt_void plot_sin(rt_SIMD_INFOX *s_inf); } namespace rt_simd_128v4 { rt_void plot_cos(rt_SIMD_INFOX *s_inf); } namespace rt_simd_128v4 { rt_void plot_asin(rt_SIMD_INFOX *s_inf); } namespace rt_simd_128v4 { rt_void plot_acos(rt_SIMD_INFOX *s_inf); } #endif /* RT_PLOT_TRIGS */ /* * Plot trigonometrics into their respective framebuffers then save. * Scene's framebuffer is first cleared then overwritten. */ rt_void rt_Scene::plot_trigs() { if (RT_ELEMENT != 32) { /* plotting of funcs and trigs is ignored, use fp32 target */ return; } #if RT_PLOT_TRIGS /* reserve memory for temporary buffer in the heap */ rt_pntr s_ptr = reserve(4000, RT_SIMD_ALIGN); /* allocate root SIMD structure */ rt_SIMD_INFOX *s_inf = (rt_SIMD_INFOX *) alloc(sizeof(rt_SIMD_INFOX), RT_SIMD_ALIGN); memset(s_inf, 0, sizeof(rt_SIMD_INFOX)); /* init power series constants for sin, cos */ RT_SIMD_SET(s_inf->sin_3, -0.1666666666666666666666666666666666666666666); RT_SIMD_SET(s_inf->sin_5, +0.0083333333333333333333333333333333333333333); RT_SIMD_SET(s_inf->sin_7, -0.0001984126984126984126984126984126984126984); RT_SIMD_SET(s_inf->sin_9, +0.0000027557319223985890652557319223985890652); RT_SIMD_SET(s_inf->cos_4, +0.0416666666666666666666666666666666666666666); RT_SIMD_SET(s_inf->cos_6, -0.0013888888888888888888888888888888888888888); RT_SIMD_SET(s_inf->cos_8, +0.0000248015873015873015873015873015873015873); #if RT_DEBUG >= 1 /* init polynomial constants for asin, acos */ RT_SIMD_SET(s_inf->asn_1, -0.0187293); RT_SIMD_SET(s_inf->asn_2, +0.0742610); RT_SIMD_SET(s_inf->asn_3, -0.2121144); RT_SIMD_SET(s_inf->asn_4, +1.5707288); RT_SIMD_SET(s_inf->tmp_1, +RT_PI_2); #endif /* RT_DEBUG >= 1 */ /* allocate regs SIMD structure */ rt_SIMD_REGS *s_reg = (rt_SIMD_REGS *) alloc(sizeof(rt_SIMD_REGS), RT_SIMD_ALIGN); ASM_INIT(s_inf, s_reg) rt_si32 i, k = (y_res - 1) / 2; rt_fp32 s = RT_2_PI / x_res, t = 0.53f; memset(frame, 0, x_row * y_res * sizeof(rt_ui32)); for (i = 0; i < x_res / 4; i++) { s_inf->hor_i[0*4+0] = s*(i*4+0 - x_res/2); s_inf->hor_i[0*4+1] = s*(i*4+1 - x_res/2); s_inf->hor_i[0*4+2] = s*(i*4+2 - x_res/2); s_inf->hor_i[0*4+3] = s*(i*4+3 - x_res/2); rt_simd_128v4::plot_sin(s_inf); frame[rt_si32((1.0f-s_inf->pts_o[0*4+0]*t)*k)*x_row+i*4+0] = 0x000000FF; frame[rt_si32((1.0f-s_inf->pts_o[0*4+1]*t)*k)*x_row+i*4+1] = 0x000000FF; frame[rt_si32((1.0f-s_inf->pts_o[0*4+2]*t)*k)*x_row+i*4+2] = 0x000000FF; frame[rt_si32((1.0f-s_inf->pts_o[0*4+3]*t)*k)*x_row+i*4+3] = 0x000000FF; #if RT_DEBUG >= 2 RT_LOGI("sin[%03X] = %f\n", i*4+0, s_inf->pts_o[0*4+0]); RT_LOGI("sin[%03X] = %f\n", i*4+1, s_inf->pts_o[0*4+1]); RT_LOGI("sin[%03X] = %f\n", i*4+2, s_inf->pts_o[0*4+2]); RT_LOGI("sin[%03X] = %f\n", i*4+3, s_inf->pts_o[0*4+3]); #endif /* RT_DEBUG */ } save_frame(980); memset(frame, 0, x_row * y_res * sizeof(rt_ui32)); for (i = 0; i < x_res / 4; i++) { s_inf->hor_i[0*4+0] = s*(i*4+0 - x_res/2); s_inf->hor_i[0*4+1] = s*(i*4+1 - x_res/2); s_inf->hor_i[0*4+2] = s*(i*4+2 - x_res/2); s_inf->hor_i[0*4+3] = s*(i*4+3 - x_res/2); rt_simd_128v4::plot_cos(s_inf); frame[rt_si32((1.0f-s_inf->pts_o[0*4+0]*t)*k)*x_row+i*4+0] = 0x000000FF; frame[rt_si32((1.0f-s_inf->pts_o[0*4+1]*t)*k)*x_row+i*4+1] = 0x000000FF; frame[rt_si32((1.0f-s_inf->pts_o[0*4+2]*t)*k)*x_row+i*4+2] = 0x000000FF; frame[rt_si32((1.0f-s_inf->pts_o[0*4+3]*t)*k)*x_row+i*4+3] = 0x000000FF; #if RT_DEBUG >= 2 RT_LOGI("cos[%03X] = %f\n", i*4+0, s_inf->pts_o[0*4+0]); RT_LOGI("cos[%03X] = %f\n", i*4+1, s_inf->pts_o[0*4+1]); RT_LOGI("cos[%03X] = %f\n", i*4+2, s_inf->pts_o[0*4+2]); RT_LOGI("cos[%03X] = %f\n", i*4+3, s_inf->pts_o[0*4+3]); #endif /* RT_DEBUG */ } save_frame(990); #if RT_DEBUG >= 1 /* asin/acos plotting is not up to scale yet */ s = 2.0f / x_res; t = 1.0f / RT_PI; memset(frame, 0, x_row * y_res * sizeof(rt_ui32)); for (i = 0; i < x_res / 4; i++) { s_inf->hor_i[0*4+0] = s*(i*4+0 - x_res/2); s_inf->hor_i[0*4+1] = s*(i*4+1 - x_res/2); s_inf->hor_i[0*4+2] = s*(i*4+2 - x_res/2); s_inf->hor_i[0*4+3] = s*(i*4+3 - x_res/2); rt_simd_128v4::plot_acos(s_inf); frame[rt_si32((1.0f-s_inf->pts_o[0*4+0]*t)*k)*x_row+i*4+0] = 0x000000FF; frame[rt_si32((1.0f-s_inf->pts_o[0*4+1]*t)*k)*x_row+i*4+1] = 0x000000FF; frame[rt_si32((1.0f-s_inf->pts_o[0*4+2]*t)*k)*x_row+i*4+2] = 0x000000FF; frame[rt_si32((1.0f-s_inf->pts_o[0*4+3]*t)*k)*x_row+i*4+3] = 0x000000FF; #if RT_DEBUG >= 2 RT_LOGI("acos[%03X] = %f\n", i*4+0, s_inf->pts_o[0*4+0]); RT_LOGI("acos[%03X] = %f\n", i*4+1, s_inf->pts_o[0*4+1]); RT_LOGI("acos[%03X] = %f\n", i*4+2, s_inf->pts_o[0*4+2]); RT_LOGI("acos[%03X] = %f\n", i*4+3, s_inf->pts_o[0*4+3]); #endif /* RT_DEBUG */ } save_frame(900); #endif /* RT_DEBUG >= 1 */ ASM_DONE(s_inf) release(s_ptr); #endif /* RT_PLOT_TRIGS */ } /******************************************************************************/ /******************************************************************************/ /******************************************************************************/
32.791658
81
0.433855
[ "render", "object", "shape", "transform" ]
a7d90f33f2f896ea5d20dcf1278e12f325b8b69e
10,232
cc
C++
src/vnsw/agent/test/control_node_mock.cc
zhongyangni/controller
439032d46767dd033ba55c1e5c34e7f2213da8b3
[ "Apache-2.0" ]
1
2019-01-11T06:16:10.000Z
2019-01-11T06:16:10.000Z
src/vnsw/agent/test/control_node_mock.cc
zhongyangni/controller
439032d46767dd033ba55c1e5c34e7f2213da8b3
[ "Apache-2.0" ]
2
2018-12-04T02:20:52.000Z
2018-12-22T06:16:30.000Z
src/vnsw/agent/test/control_node_mock.cc
zhongyangni/controller
439032d46767dd033ba55c1e5c34e7f2213da8b3
[ "Apache-2.0" ]
1
2020-06-08T11:50:36.000Z
2020-06-08T11:50:36.000Z
/* * Copyright (c) 2013 Juniper Networks, Inc. All rights reserved. */ #include <vector> #include <xml/xml_base.h> #include "xml/xml_pugi.h" #include "xmpp_unicast_types.h" #include <base/logging.h> #include <boost/bind.hpp> #include <net/bgp_af.h> #include "xmpp/xmpp_init.h" #include "xmpp/test/xmpp_test_util.h" #include "control_node_mock.h" using namespace std; using namespace pugi; using namespace autogen; namespace test { ControlNodeMock::ControlNodeMock(EventManager *evm, string address) : evm_(evm), address_(address), channel_(NULL) { xs = new XmppServer(evm_, XmppInit::kControlNodeJID); xs->Initialize(0, false); server_port_ = xs->GetPort(); xs->RegisterConnectionEvent(xmps::BGP, boost::bind(&ControlNodeMock::XmppChannelEvent, this, _1, _2)); } ControlNodeMock::~ControlNodeMock() { if (channel_) channel_->UnRegisterWriteReady(xmps::BGP); for(vector<VrfEntry *>::iterator it = vrf_list_.begin(); it != vrf_list_.end(); ) { VrfEntry *ent = *it; std::map<std::string, RouteEntry *>::iterator x; for(x = ent->route_list_.begin(); x != ent->route_list_.end();) { std::string address = x->first; delete x->second; x++; ent->route_list_.erase(address); } delete *it; it = vrf_list_.erase(it); } TcpServerManager::DeleteServer(xs); } void ControlNodeMock::Shutdown() { xs->Shutdown(); } ControlNodeMock::VrfEntry* ControlNodeMock::GetVrf(const string &vrf) { VrfEntry *ent = NULL; for(vector<VrfEntry *>::iterator it = vrf_list_.begin(); it != vrf_list_.end(); ++it) { if ((*it)->name == vrf) { ent = *it; break; } } return ent; } ControlNodeMock::VrfEntry* ControlNodeMock::AddVrf(const string &vrf) { VrfEntry *ent; ent = GetVrf(vrf); if (!ent) { ent = new VrfEntry; ent->name = vrf; ent->subscribed = false; vrf_list_.push_back(ent); } return ent; } void ControlNodeMock::SubscribeVrf(const string &vrf) { VrfEntry *ent; ent = AddVrf(vrf); ent->subscribed = true; //Replay all routes now std::map<std::string, RouteEntry *>::iterator x; for(x = ent->route_list_.begin();x != ent->route_list_.end(); x++) { RouteEntry *rt = x->second; SendRoute(ent->name, rt, true); } } void ControlNodeMock::UnSubscribeVrf(const string &vrf) { vector<VrfEntry *>::iterator it; VrfEntry *ent = NULL; for(it = vrf_list_.begin(); it != vrf_list_.end(); ++it) { if ((*it)->name == vrf) { ent = *it; break; } } if (!ent) { return; } ent->subscribed = false; } ControlNodeMock::RouteEntry* ControlNodeMock::InsertRoute(string &vrf_name, string &address, string &nh, int label, string &vn) { VrfEntry *vrf = AddVrf(vrf_name); RouteEntry *ent = vrf->route_list_[address]; if (!ent) { ent = new RouteEntry; } ent->address = address; ent->vn = vn; //Populate the nexthop NHEntry nh_entry; nh_entry.nh = nh; nh_entry.label = label; std::vector<NHEntry>::iterator it = ent->nh_list_.begin(); while (it != ent->nh_list_.end()) { //If entry is present overwrite the entry if (nh_entry.nh == it->nh) { it->label = label; break; } it++; } if (it == ent->nh_list_.end()) { ent->nh_list_.push_back(nh_entry); } vrf->route_list_[address] = ent; return ent; } ControlNodeMock::RouteEntry* ControlNodeMock::RemoveRoute(string &vrf_name, string &address, string &nh, int label, string &vn, bool &send_delete) { VrfEntry *vrf = AddVrf(vrf_name); RouteEntry *ent = vrf->route_list_[address]; if (!ent) { return NULL; } ent->address = address; ent->vn = vn; //Populate the nexthop NHEntry nh_entry; nh_entry.nh = nh; nh_entry.label = label; std::vector<NHEntry>::iterator it = ent->nh_list_.begin(); while (it != ent->nh_list_.end()) { //If entry is present overwrite the entry if (nh_entry.nh == it->nh) { ent->nh_list_.erase(it); break; } it++; } if (ent->nh_list_.size() == 0) { send_delete = true; } vrf->route_list_[address] = ent; return ent; } void ControlNodeMock::GetRoutes(string vrf, const XmppStanza::XmppMessage *msg) { XmlBase *impl = msg->dom.get(); const XmppStanza::XmppMessageIq *iq = static_cast<const XmppStanza::XmppMessageIq *>(msg); XmlPugi *pugi = reinterpret_cast<XmlPugi *>(impl); for (xml_node node = pugi->FindNode("item"); node; node = node.next_sibling()) { if (strcmp(node.name(), "item") == 0) { //process route. For time being consider only add ItemType item; item.Clear(); if (!item.XmlParse(node)) { return; } bool add = false; if (iq->is_as_node) { add = true; } RouteEntry *rt = InsertRoute(vrf, item.entry.nlri.address, item.entry.next_hops.next_hop[0].address, item.entry.next_hops.next_hop[0].label, item.entry.virtual_network); SendRoute(vrf, rt, add); } } } void ControlNodeMock::ReceiveUpdate(const XmppStanza::XmppMessage *msg) { if (msg->type == XmppStanza::IQ_STANZA) { const XmppStanza::XmppMessageIq *iq = static_cast<const XmppStanza::XmppMessageIq *>(msg); if (iq->iq_type.compare("set") == 0) { if (iq->action.compare("subscribe") == 0) { SubscribeVrf(iq->node); } else if (iq->action.compare("unsubscribe") == 0) { UnSubscribeVrf(iq->node); } else if (iq->action.compare("publish") == 0) { GetRoutes(iq->node, msg); } } } } void ControlNodeMock::XmppChannelEvent(XmppChannel *channel, xmps::PeerState state) { if (state == xmps::READY) { channel_ = channel; channel_->RegisterReceive(xmps::BGP, boost::bind(&ControlNodeMock::ReceiveUpdate, this, _1)); } else if (state == xmps::NOT_READY) { if (channel_) { channel_->UnRegisterReceive(xmps::BGP); } channel_ = NULL; } } xml_node ControlNodeMock::AddXmppHdr() { xdoc_.reset(); xml_node msg = xdoc_.append_child("message"); string str(channel_->connection()->ToString().c_str()); str += "/"; str += XmppInit::kBgpPeer; msg.append_attribute("from") = XmppInit::kControlNodeJID; msg.append_attribute("to") = str.c_str(); xml_node event = msg.append_child("event"); event.append_attribute("xmlns") = "http://jabber.org/protocol/pubsub"; return event; } void ControlNodeMock::SendUpdate(xmps::PeerId id) { ostringstream oss; xdoc_.save(oss); string msg = oss.str(); channel_->Send(reinterpret_cast<const uint8_t *>(msg.data()), msg.size(), id, boost::bind(&ControlNodeMock::WriteReadyCb, this, _1)); } void ControlNodeMock::WriteReadyCb(const boost::system::error_code &ec) { } bool ControlNodeMock::IsEstablished() { if (channel_ && channel_->GetPeerState() == xmps::READY) { return true; } return false; } void ControlNodeMock::AddRoute(string vrf, string address, string nh, int label, string vn) { RouteEntry *rt = InsertRoute(vrf, address, nh, label, vn); VrfEntry *ent = GetVrf(vrf); if (ent->subscribed == false) { return; } SendRoute(vrf, rt, true); } void ControlNodeMock::DeleteRoute(string vrf, string address, string nh, int label, string vn) { bool send_delete = false; RouteEntry *rt = RemoveRoute(vrf, address, nh, label, vn, send_delete); VrfEntry *ent = GetVrf(vrf); if (ent->subscribed == false) { return; } if (rt) { SendRoute(vrf, rt, !send_delete); } } void ControlNodeMock::SendRoute(string vrf, RouteEntry *rt, bool add) { xml_node event = AddXmppHdr(); xml_node items = event.append_child("items"); stringstream nodestr; nodestr << BgpAf::IPv4 << "/" << BgpAf::Unicast << "/" << vrf.c_str(); items.append_attribute("node") = nodestr.str().c_str(); autogen::ItemType item; autogen::NextHopType item_nexthop; std::vector<NHEntry>::iterator it = rt->nh_list_.begin(); for (;it != rt->nh_list_.end(); it++) { item_nexthop.af = BgpAf::IPv4; item_nexthop.address = it->nh; item_nexthop.label = it->label; item.entry.next_hops.next_hop.push_back(item_nexthop); } item.entry.nlri.af = BgpAf::IPv4; item.entry.nlri.safi = BgpAf::Unicast; item.entry.nlri.address = rt->address; item.entry.version = 1; item.entry.virtual_network = rt->vn; if (add) { xdoc_.append_child("associate"); } else { xdoc_.append_child("dissociate"); xml_node id = items.append_child("retract"); id.append_attribute("id") = rt->address.c_str(); } xml_node node = items.append_child("item"); node.append_attribute("id") = rt->address.c_str(); item.Encode(&node); SendUpdate(xmps::BGP); } void ControlNodeMock::Clear() { for(vector<VrfEntry *>::iterator it = vrf_list_.begin(); it != vrf_list_.end(); ) { VrfEntry *ent = *it; std::map<std::string, RouteEntry *>::iterator x; for(x = ent->route_list_.begin(); x != ent->route_list_.end();) { std::string address = x->first; delete x->second; x++; ent->route_list_.erase(address); } delete *it; it = vrf_list_.erase(it); } } } // namespace test
26.645833
91
0.572029
[ "vector" ]
a7dd046b33af2edcdb6979453c66e76f28bff89b
411
cpp
C++
Sejur.cpp
mcmarius/turism-1511-2021
1cf571dada270b91a267d77a166dd097f1a77c25
[ "Unlicense" ]
null
null
null
Sejur.cpp
mcmarius/turism-1511-2021
1cf571dada270b91a267d77a166dd097f1a77c25
[ "Unlicense" ]
null
null
null
Sejur.cpp
mcmarius/turism-1511-2021
1cf571dada270b91a267d77a166dd097f1a77c25
[ "Unlicense" ]
null
null
null
// // Created by marius on 2021-03-04. // #include "Sejur.h" void Sejur::adauga_ghid() { ghid = true; } double Sejur::pret_total() { double total = 0; for(auto &locatie : locatii) total += locatie->getPret(); return total; } Sejur::Sejur(std::vector <std::unique_ptr <Locatie>> &&locatii) { for(auto &&locatie : locatii) this->locatii.emplace_back(std::move(locatie)); }
18.681818
65
0.618005
[ "vector" ]
a7e5ee78c21a8a19ca6015960e1b7ac899f778e0
54,580
cc
C++
chrome/browser/gtk/bookmark_manager_gtk.cc
rwatson/chromium-capsicum
b03da8e897f897c6ad2cda03ceda217b760fd528
[ "BSD-3-Clause" ]
11
2015-03-20T04:08:08.000Z
2021-11-15T15:51:36.000Z
chrome/browser/gtk/bookmark_manager_gtk.cc
rwatson/chromium-capsicum
b03da8e897f897c6ad2cda03ceda217b760fd528
[ "BSD-3-Clause" ]
null
null
null
chrome/browser/gtk/bookmark_manager_gtk.cc
rwatson/chromium-capsicum
b03da8e897f897c6ad2cda03ceda217b760fd528
[ "BSD-3-Clause" ]
null
null
null
// Copyright (c) 2009 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 "chrome/browser/gtk/bookmark_manager_gtk.h" #include <gdk/gdkkeysyms.h> #include <vector> #include "app/gtk_dnd_util.h" #include "app/l10n_util.h" #include "app/resource_bundle.h" #include "base/path_service.h" #include "base/string16.h" #include "base/thread.h" #include "chrome/browser/bookmarks/bookmark_html_writer.h" #include "chrome/browser/bookmarks/bookmark_manager.h" #include "chrome/browser/bookmarks/bookmark_model.h" #include "chrome/browser/bookmarks/bookmark_table_model.h" #include "chrome/browser/bookmarks/bookmark_utils.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/gtk/bookmark_tree_model.h" #include "chrome/browser/gtk/bookmark_utils_gtk.h" #include "chrome/browser/importer/importer.h" #include "chrome/browser/profile.h" #include "chrome/browser/sync/sync_ui_util.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/gtk_util.h" #include "chrome/common/pref_names.h" #include "chrome/common/pref_service.h" #include "grit/app_resources.h" #include "grit/generated_resources.h" #include "grit/locale_settings.h" #include "grit/theme_resources.h" namespace { // Number of bookmarks shown in recently bookmarked. const int kRecentlyBookmarkedCount = 50; // IDs for the recently added and search nodes. These values assume that node // IDs will be strictly non-negative, which is an implementation detail of // BookmarkModel, so this is sort of a hack. const int64 kRecentID = -1; const int64 kSearchID = -2; // Padding between "Search:" and the entry field, in pixels. const int kSearchPadding = 5; // Time between a user action in the search box and when we perform the search. const int kSearchDelayMS = 200; // The default width of a column in the right tree view. Since we set the // columns to ellipsize, if we don't explicitly set a width they will be // wide enough to display only '...'. This will be overridden if the user // resizes the column. const int kDefaultColumnWidth = 200; // The destination targets that the right tree view accepts for dragging. const int kDestTargetList[] = { GtkDndUtil::CHROME_BOOKMARK_ITEM, -1 }; // The source targets that the right tree view supports for dragging. const int kSourceTargetMask = GtkDndUtil::CHROME_BOOKMARK_ITEM | GtkDndUtil::TEXT_URI_LIST | GtkDndUtil::TEXT_PLAIN; // We only have one manager open at a time. BookmarkManagerGtk* manager = NULL; // Observer installed on the importer. When done importing the newly created // folder is selected in the bookmark manager. // This class is taken almost directly from BookmarkManagerView and should be // kept in sync with it. class ImportObserverImpl : public ImportObserver { public: explicit ImportObserverImpl(Profile* profile) : profile_(profile) { BookmarkModel* model = profile->GetBookmarkModel(); initial_other_count_ = model->other_node()->GetChildCount(); } virtual void ImportCanceled() { delete this; } virtual void ImportComplete() { // We aren't needed anymore. MessageLoop::current()->DeleteSoon(FROM_HERE, this); if (!manager || manager->profile() != profile_) return; BookmarkModel* model = profile_->GetBookmarkModel(); int other_count = model->other_node()->GetChildCount(); if (other_count == initial_other_count_ + 1) { const BookmarkNode* imported_node = model->other_node()->GetChild(initial_other_count_); manager->SelectInTree(imported_node, true); } } private: Profile* profile_; // Number of children in the other bookmarks folder at the time we were // created. int initial_other_count_; DISALLOW_COPY_AND_ASSIGN(ImportObserverImpl); }; void SetMenuBarStyle() { static bool style_was_set = false; if (style_was_set) return; style_was_set = true; gtk_rc_parse_string( "style \"chrome-bm-menubar\" {" " GtkMenuBar::shadow-type = GTK_SHADOW_NONE" "}" "widget \"*chrome-bm-menubar\" style \"chrome-bm-menubar\""); } bool CursorIsOverSelection(GtkTreeView* tree_view) { bool rv = false; gint x, y; gtk_widget_get_pointer(GTK_WIDGET(tree_view), &x, &y); gint bx, by; gtk_tree_view_convert_widget_to_bin_window_coords(tree_view, x, y, &bx, &by); GtkTreePath* path; if (gtk_tree_view_get_path_at_pos(tree_view, bx, by, &path, NULL, NULL, NULL)) { if (gtk_tree_selection_path_is_selected( gtk_tree_view_get_selection(tree_view), path)) { rv = true; } gtk_tree_path_free(path); } return rv; } } // namespace // BookmarkManager ------------------------------------------------------------- void BookmarkManager::SelectInTree(Profile* profile, const BookmarkNode* node) { if (manager && manager->profile() == profile) manager->SelectInTree(node, false); } void BookmarkManager::Show(Profile* profile) { BookmarkManagerGtk::Show(profile); } // BookmarkManagerGtk, public -------------------------------------------------- void BookmarkManagerGtk::SelectInTree(const BookmarkNode* node, bool expand) { if (expand) DCHECK(node->is_folder()); // Expand the left tree view to |node| if |node| is a folder, or to the parent // folder of |node| if it is a URL. GtkTreeIter iter = { 0, }; int64 id = node->is_folder() ? node->id() : node->GetParent()->id(); if (RecursiveFind(GTK_TREE_MODEL(left_store_), &iter, id)) { GtkTreePath* path = gtk_tree_model_get_path(GTK_TREE_MODEL(left_store_), &iter); gtk_tree_view_expand_to_path(GTK_TREE_VIEW(left_tree_view_), path); gtk_tree_selection_select_path(left_selection(), path); if (expand) gtk_tree_view_expand_row(GTK_TREE_VIEW(left_tree_view_), path, true); gtk_tree_path_free(path); } if (node->is_url()) { GtkTreeIter iter; bool found = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(right_store_), &iter); while (found) { if (node->id() == GetRowIDAt(GTK_TREE_MODEL(right_store_), &iter)) { gtk_tree_selection_select_iter(right_selection(), &iter); break; } found = gtk_tree_model_iter_next(GTK_TREE_MODEL(right_store_), &iter); } DCHECK(found); } } // static void BookmarkManagerGtk::Show(Profile* profile) { if (!profile->GetBookmarkModel()) return; if (!manager) manager = new BookmarkManagerGtk(profile); else gtk_window_present(GTK_WINDOW(manager->window_)); } void BookmarkManagerGtk::BookmarkManagerGtk::Loaded(BookmarkModel* model) { BuildLeftStore(); BuildRightStore(); g_signal_connect(left_selection(), "changed", G_CALLBACK(OnLeftSelectionChanged), this); ResetOrganizeMenu(false); } void BookmarkManagerGtk::BookmarkModelBeingDeleted(BookmarkModel* model) { gtk_widget_destroy(window_); } void BookmarkManagerGtk::BookmarkNodeMoved(BookmarkModel* model, const BookmarkNode* old_parent, int old_index, const BookmarkNode* new_parent, int new_index) { BookmarkNodeRemoved(model, old_parent, old_index, new_parent->GetChild(new_index)); BookmarkNodeAdded(model, new_parent, new_index); } void BookmarkManagerGtk::BookmarkNodeAdded(BookmarkModel* model, const BookmarkNode* parent, int index) { const BookmarkNode* node = parent->GetChild(index); if (node->is_folder()) { GtkTreeIter iter = { 0, }; if (RecursiveFind(GTK_TREE_MODEL(left_store_), &iter, parent->id())) bookmark_utils::AddToTreeStoreAt(node, 0, left_store_, NULL, &iter); } } void BookmarkManagerGtk::BookmarkNodeRemoved(BookmarkModel* model, const BookmarkNode* parent, int old_index, const BookmarkNode* node) { if (node->is_folder()) { GtkTreeIter iter = { 0, }; if (RecursiveFind(GTK_TREE_MODEL(left_store_), &iter, node->id())) { // If we are deleting the currently selected folder, set the selection to // its parent. if (gtk_tree_selection_iter_is_selected(left_selection(), &iter)) { GtkTreeIter parent; gtk_tree_model_iter_parent(GTK_TREE_MODEL(left_store_), &parent, &iter); gtk_tree_selection_select_iter(left_selection(), &parent); } gtk_tree_store_remove(left_store_, &iter); } } } void BookmarkManagerGtk::BookmarkNodeChanged(BookmarkModel* model, const BookmarkNode* node) { if (node->is_folder()) { GtkTreeIter iter = { 0, }; if (RecursiveFind(GTK_TREE_MODEL(left_store_), &iter, node->id())) { gtk_tree_store_set(left_store_, &iter, bookmark_utils::FOLDER_NAME, WideToUTF8(node->GetTitle()).c_str(), bookmark_utils::ITEM_ID, node->id(), -1); } } } void BookmarkManagerGtk::BookmarkNodeChildrenReordered( BookmarkModel* model, const BookmarkNode* node) { // TODO(estade): reorder in the left tree view. } void BookmarkManagerGtk::BookmarkNodeFavIconLoaded(BookmarkModel* model, const BookmarkNode* node) { // I don't think we have anything to do, as we should never get this for a // folder node and we handle it via OnItemsChanged for any URL node. } void BookmarkManagerGtk::OnModelChanged() { ResetRightStoreModel(); } void BookmarkManagerGtk::SetColumnValues(int row, GtkTreeIter* iter) { // TODO(estade): building the path could be optimized out when we aren't // showing the path column. const BookmarkNode* node = right_tree_model_->GetNodeForRow(row); GdkPixbuf* pixbuf = bookmark_utils::GetPixbufForNode(node, model_, true); std::wstring title = right_tree_model_->GetText(row, IDS_BOOKMARK_TABLE_TITLE); std::wstring url = right_tree_model_->GetText(row, IDS_BOOKMARK_TABLE_URL); std::wstring path = right_tree_model_->GetText(row, IDS_BOOKMARK_TABLE_PATH); gtk_list_store_set(right_store_, iter, RIGHT_PANE_PIXBUF, pixbuf, RIGHT_PANE_TITLE, WideToUTF8(title).c_str(), RIGHT_PANE_URL, WideToUTF8(url).c_str(), RIGHT_PANE_PATH, WideToUTF8(path).c_str(), RIGHT_PANE_ID, node->id(), -1); g_object_unref(pixbuf); } // BookmarkManagerGtk, private ------------------------------------------------- BookmarkManagerGtk::BookmarkManagerGtk(Profile* profile) : profile_(profile), model_(profile->GetBookmarkModel()), organize_is_for_left_(true), sync_status_menu_(NULL), sync_service_(NULL), sync_relogin_required_(false), search_factory_(this), select_file_dialog_(SelectFileDialog::Create(this)), delaying_mousedown_(false), sending_delayed_mousedown_(false), ignore_rightclicks_(false) { InitWidgets(); ConnectAccelerators(); model_->AddObserver(this); if (model_->IsLoaded()) Loaded(model_); if (profile_->GetProfileSyncService()) { sync_service_ = profile_->GetProfileSyncService(); sync_service_->AddObserver(this); UpdateSyncStatus(); } gtk_widget_show_all(window_); } BookmarkManagerGtk::~BookmarkManagerGtk() { g_browser_process->local_state()->SetInteger( prefs::kBookmarkManagerSplitLocation, gtk_paned_get_position(GTK_PANED(paned_))); SaveColumnConfiguration(); model_->RemoveObserver(this); if (sync_service_) sync_service_->RemoveObserver(this); gtk_accel_group_disconnect_key(accel_group_, GDK_w, GDK_CONTROL_MASK); gtk_window_remove_accel_group(GTK_WINDOW(window_), accel_group_); g_object_unref(accel_group_); } void BookmarkManagerGtk::InitWidgets() { window_ = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_title(GTK_WINDOW(window_), l10n_util::GetStringUTF8(IDS_BOOKMARK_MANAGER_TITLE).c_str()); g_signal_connect( window_, "configure-event", G_CALLBACK(OnWindowConfiguredThunk), this); g_signal_connect( window_, "destroy", G_CALLBACK(OnWindowDestroyedThunk), this); g_signal_connect( window_, "window-state-event", G_CALLBACK(OnWindowStateChangedThunk), this); // Add this window to its own unique window group to allow for // window-to-parent modality. gtk_window_group_add_window(gtk_window_group_new(), GTK_WINDOW(window_)); g_object_unref(gtk_window_get_group(GTK_WINDOW(window_))); SetInitialWindowSize(); gint x = 0, y = 0, width = 1, height = 1; gtk_window_get_position(GTK_WINDOW(window_), &x, &y); gtk_window_get_size(GTK_WINDOW(window_), &width, &height); window_bounds_.SetRect(x, y, width, height); // Build the organize and tools menus. organize_ = gtk_menu_item_new_with_label( l10n_util::GetStringUTF8(IDS_BOOKMARK_MANAGER_ORGANIZE_MENU).c_str()); GtkWidget* import_item = gtk_menu_item_new_with_mnemonic( gtk_util::ConvertAcceleratorsFromWindowsStyle( l10n_util::GetStringUTF8(IDS_BOOKMARK_MANAGER_IMPORT_MENU)).c_str()); g_signal_connect(import_item, "activate", G_CALLBACK(OnImportItemActivated), this); GtkWidget* export_item = gtk_menu_item_new_with_mnemonic( gtk_util::ConvertAcceleratorsFromWindowsStyle( l10n_util::GetStringUTF8(IDS_BOOKMARK_MANAGER_EXPORT_MENU)).c_str()); g_signal_connect(export_item, "activate", G_CALLBACK(OnExportItemActivated), this); GtkWidget* tools_menu = gtk_menu_new(); gtk_menu_shell_append(GTK_MENU_SHELL(tools_menu), import_item); gtk_menu_shell_append(GTK_MENU_SHELL(tools_menu), export_item); GtkWidget* tools = gtk_menu_item_new_with_label( l10n_util::GetStringUTF8(IDS_BOOKMARK_MANAGER_TOOLS_MENU).c_str()); gtk_menu_item_set_submenu(GTK_MENU_ITEM(tools), tools_menu); // Build the sync status menu item. sync_status_menu_ = gtk_menu_item_new_with_label(""); g_signal_connect(sync_status_menu_, "activate", G_CALLBACK(OnSyncStatusMenuActivated), this); GtkWidget* menu_bar = gtk_menu_bar_new(); gtk_menu_shell_append(GTK_MENU_SHELL(menu_bar), organize_); gtk_menu_shell_append(GTK_MENU_SHELL(menu_bar), tools); gtk_menu_shell_append(GTK_MENU_SHELL(menu_bar), sync_status_menu_); SetMenuBarStyle(); gtk_widget_set_name(menu_bar, "chrome-bm-menubar"); GtkWidget* search_label = gtk_label_new( l10n_util::GetStringUTF8(IDS_BOOKMARK_MANAGER_SEARCH_TITLE).c_str()); search_entry_ = gtk_entry_new(); g_signal_connect(search_entry_, "changed", G_CALLBACK(OnSearchTextChangedThunk), this); GtkWidget* hbox = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(hbox), menu_bar, FALSE, FALSE, 0); gtk_box_pack_end(GTK_BOX(hbox), search_entry_, FALSE, FALSE, 0); gtk_box_pack_end(GTK_BOX(hbox), search_label, FALSE, FALSE, kSearchPadding); GtkWidget* left_pane = MakeLeftPane(); GtkWidget* right_pane = MakeRightPane(); paned_ = gtk_hpaned_new(); gtk_paned_pack1(GTK_PANED(paned_), left_pane, FALSE, FALSE); gtk_paned_pack2(GTK_PANED(paned_), right_pane, TRUE, FALSE); // Set the initial position of the pane divider. int split_x = g_browser_process->local_state()->GetInteger( prefs::kBookmarkManagerSplitLocation); if (split_x == -1) { split_x = width / 3; } else { int min_split_size = width / 8; // Make sure the user can see both the tree/table. split_x = std::min(width - min_split_size, std::max(min_split_size, split_x)); } gtk_paned_set_position(GTK_PANED(paned_), split_x); GtkWidget* vbox = gtk_vbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox), paned_, TRUE, TRUE, 0); gtk_container_add(GTK_CONTAINER(window_), vbox); } void BookmarkManagerGtk::ConnectAccelerators() { accel_group_ = gtk_accel_group_new(); gtk_window_add_accel_group(GTK_WINDOW(window_), accel_group_); gtk_accel_group_connect(accel_group_, GDK_w, GDK_CONTROL_MASK, GtkAccelFlags(0), g_cclosure_new(G_CALLBACK(OnGtkAccelerator), this, NULL)); } GtkWidget* BookmarkManagerGtk::MakeLeftPane() { left_store_ = bookmark_utils::MakeFolderTreeStore(); left_tree_view_ = bookmark_utils::MakeTreeViewForStore(left_store_); // When a row is collapsed that contained the selected node, we want to select // it. g_signal_connect(left_tree_view_, "row-collapsed", G_CALLBACK(OnLeftTreeViewRowCollapsed), this); g_signal_connect(left_tree_view_, "focus-in-event", G_CALLBACK(OnLeftTreeViewFocusIn), this); g_signal_connect(left_tree_view_, "button-press-event", G_CALLBACK(OnTreeViewButtonPress), this); g_signal_connect(left_tree_view_, "button-release-event", G_CALLBACK(OnTreeViewButtonRelease), this); g_signal_connect(left_tree_view_, "key-press-event", G_CALLBACK(OnTreeViewKeyPress), this); GtkCellRenderer* cell_renderer_text = bookmark_utils::GetCellRendererText( GTK_TREE_VIEW(left_tree_view_)); g_signal_connect(cell_renderer_text, "edited", G_CALLBACK(OnFolderNameEdited), this); // The left side is only a drag destination (not a source). gtk_drag_dest_set(left_tree_view_, GTK_DEST_DEFAULT_DROP, NULL, 0, GDK_ACTION_MOVE); GtkDndUtil::SetDestTargetList(left_tree_view_, kDestTargetList); g_signal_connect(left_tree_view_, "drag-data-received", G_CALLBACK(&OnLeftTreeViewDragReceived), this); g_signal_connect(left_tree_view_, "drag-motion", G_CALLBACK(&OnLeftTreeViewDragMotion), this); GtkWidget* scrolled = gtk_scrolled_window_new(NULL, NULL); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolled), GTK_SHADOW_ETCHED_IN); gtk_container_add(GTK_CONTAINER(scrolled), left_tree_view_); return scrolled; } GtkWidget* BookmarkManagerGtk::MakeRightPane() { right_store_ = gtk_list_store_new(RIGHT_PANE_NUM, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INT64); right_tree_adapter_.reset(new gtk_tree::TableAdapter(this, right_store_, NULL)); title_column_ = gtk_tree_view_column_new(); gtk_tree_view_column_set_title(title_column_, l10n_util::GetStringUTF8(IDS_BOOKMARK_TABLE_TITLE).c_str()); GtkCellRenderer* image_renderer = gtk_cell_renderer_pixbuf_new(); gtk_tree_view_column_pack_start(title_column_, image_renderer, FALSE); gtk_tree_view_column_add_attribute(title_column_, image_renderer, "pixbuf", RIGHT_PANE_PIXBUF); GtkCellRenderer* text_renderer = gtk_cell_renderer_text_new(); g_object_set(text_renderer, "ellipsize", PANGO_ELLIPSIZE_END, NULL); gtk_tree_view_column_pack_start(title_column_, text_renderer, TRUE); gtk_tree_view_column_add_attribute(title_column_, text_renderer, "text", RIGHT_PANE_TITLE); url_column_ = gtk_tree_view_column_new_with_attributes( l10n_util::GetStringUTF8(IDS_BOOKMARK_TABLE_URL).c_str(), text_renderer, "text", RIGHT_PANE_URL, NULL); path_column_ = gtk_tree_view_column_new_with_attributes( l10n_util::GetStringUTF8(IDS_BOOKMARK_TABLE_PATH).c_str(), text_renderer, "text", RIGHT_PANE_PATH, NULL); right_tree_view_ = gtk_tree_view_new_with_model(GTK_TREE_MODEL(right_store_)); // Let |tree_view| own the store. g_object_unref(right_store_); gtk_tree_view_append_column(GTK_TREE_VIEW(right_tree_view_), title_column_); gtk_tree_view_append_column(GTK_TREE_VIEW(right_tree_view_), url_column_); gtk_tree_view_append_column(GTK_TREE_VIEW(right_tree_view_), path_column_); gtk_tree_selection_set_mode(right_selection(), GTK_SELECTION_MULTIPLE); g_signal_connect(right_tree_view_, "row-activated", G_CALLBACK(OnRightTreeViewRowActivated), this); g_signal_connect(right_selection(), "changed", G_CALLBACK(OnRightSelectionChanged), this); g_signal_connect(right_tree_view_, "focus-in-event", G_CALLBACK(OnRightTreeViewFocusIn), this); g_signal_connect(right_tree_view_, "button-press-event", G_CALLBACK(OnRightTreeViewButtonPress), this); g_signal_connect(right_tree_view_, "motion-notify-event", G_CALLBACK(OnRightTreeViewMotion), this); // This handler just controls showing the context menu. g_signal_connect(right_tree_view_, "button-press-event", G_CALLBACK(OnTreeViewButtonPress), this); g_signal_connect(right_tree_view_, "button-release-event", G_CALLBACK(OnTreeViewButtonRelease), this); g_signal_connect(right_tree_view_, "key-press-event", G_CALLBACK(OnTreeViewKeyPress), this); // We don't advertise GDK_ACTION_COPY, but since we don't explicitly do // any deleting following a succesful move, this should work. gtk_drag_source_set(right_tree_view_, GDK_BUTTON1_MASK, NULL, 0, GDK_ACTION_MOVE); GtkDndUtil::SetSourceTargetListFromCodeMask( right_tree_view_, kSourceTargetMask); // We connect to drag dest signals, but we don't actually enable the widget // as a drag destination unless it corresponds to the contents of a folder. // See BuildRightStore(). g_signal_connect(right_tree_view_, "drag-data-get", G_CALLBACK(&OnRightTreeViewDragGet), this); g_signal_connect(right_tree_view_, "drag-data-received", G_CALLBACK(&OnRightTreeViewDragReceived), this); g_signal_connect(right_tree_view_, "drag-motion", G_CALLBACK(&OnRightTreeViewDragMotion), this); g_signal_connect(right_tree_view_, "drag-begin", G_CALLBACK(&OnRightTreeViewDragBegin), this); GtkWidget* scrolled = gtk_scrolled_window_new(NULL, NULL); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolled), GTK_SHADOW_ETCHED_IN); gtk_container_add(GTK_CONTAINER(scrolled), right_tree_view_); return scrolled; } // static BookmarkManagerGtk* BookmarkManagerGtk::GetCurrentManager() { return manager; } void BookmarkManagerGtk::SetInitialWindowSize() { // If we previously saved the window's bounds, use them. if (g_browser_process->local_state()) { const DictionaryValue* placement_pref = g_browser_process->local_state()->GetDictionary( prefs::kBookmarkManagerPlacement); int top = 0, left = 0, bottom = 1, right = 1; if (placement_pref && placement_pref->GetInteger(L"top", &top) && placement_pref->GetInteger(L"left", &left) && placement_pref->GetInteger(L"bottom", &bottom) && placement_pref->GetInteger(L"right", &right)) { int width = std::max(1, right - left); int height = std::max(1, bottom - top); gtk_window_resize(GTK_WINDOW(window_), width, height); return; } } // Otherwise, just set a default size (GTK will override this if it's not // large enough to hold the window's contents). gtk_widget_realize(window_); int width = 1, height = 1; gtk_util::GetWidgetSizeFromResources( window_, IDS_BOOKMARK_MANAGER_DIALOG_WIDTH_CHARS, IDS_BOOKMARK_MANAGER_DIALOG_HEIGHT_LINES, &width, &height); gtk_window_set_default_size(GTK_WINDOW(window_), width, height); } void BookmarkManagerGtk::ResetOrganizeMenu(bool left) { organize_is_for_left_ = left; const BookmarkNode* parent = GetFolder(); std::vector<const BookmarkNode*> nodes; if (!left) nodes = GetRightSelection(); else if (parent) nodes.push_back(parent); // We DeleteSoon on the old one to give any reference holders (e.g. // the event that caused this reset) a chance to release their refs. BookmarkContextMenuGtk* old_menu = organize_menu_.release(); if (old_menu) MessageLoop::current()->DeleteSoon(FROM_HERE, old_menu); organize_menu_.reset(new BookmarkContextMenuGtk(GTK_WINDOW(window_), profile_, NULL, NULL, parent, nodes, BookmarkContextMenuGtk::BOOKMARK_MANAGER_ORGANIZE_MENU, NULL)); gtk_menu_item_set_submenu(GTK_MENU_ITEM(organize_), organize_menu_->menu()); } void BookmarkManagerGtk::BuildLeftStore() { GtkTreeIter select_iter; bookmark_utils::AddToTreeStore(model_, model_->GetBookmarkBarNode()->id(), left_store_, &select_iter); gtk_tree_selection_select_iter(left_selection(), &select_iter); // TODO(estade): is there a decent stock icon we can use here? ResourceBundle& rb = ResourceBundle::GetSharedInstance(); gtk_tree_store_append(left_store_, &select_iter, NULL); gtk_tree_store_set(left_store_, &select_iter, bookmark_utils::FOLDER_ICON, rb.GetPixbufNamed(IDR_BOOKMARK_MANAGER_RECENT_ICON), bookmark_utils::FOLDER_NAME, l10n_util::GetStringUTF8( IDS_BOOKMARK_TREE_RECENTLY_BOOKMARKED_NODE_TITLE).c_str(), bookmark_utils::ITEM_ID, kRecentID, bookmark_utils::IS_EDITABLE, FALSE, -1); GdkPixbuf* search_icon = gtk_widget_render_icon( window_, GTK_STOCK_FIND, GTK_ICON_SIZE_MENU, NULL); gtk_tree_store_append(left_store_, &select_iter, NULL); gtk_tree_store_set(left_store_, &select_iter, bookmark_utils::FOLDER_ICON, search_icon, bookmark_utils::FOLDER_NAME, l10n_util::GetStringUTF8( IDS_BOOKMARK_TREE_SEARCH_NODE_TITLE).c_str(), bookmark_utils::ITEM_ID, kSearchID, bookmark_utils::IS_EDITABLE, FALSE, -1); g_object_unref(search_icon); } void BookmarkManagerGtk::BuildRightStore() { right_tree_adapter_->OnModelChanged(); } void BookmarkManagerGtk::ResetRightStoreModel() { const BookmarkNode* node = GetFolder(); if (node) { SaveColumnConfiguration(); gtk_tree_view_column_set_visible(path_column_, FALSE); SizeColumns(); right_tree_model_.reset( BookmarkTableModel::CreateBookmarkTableModelForFolder(model_, node)); gtk_drag_dest_set(right_tree_view_, GTK_DEST_DEFAULT_ALL, NULL, 0, GDK_ACTION_MOVE); GtkDndUtil::SetDestTargetList(right_tree_view_, kDestTargetList); } else { SaveColumnConfiguration(); gtk_tree_view_column_set_visible(path_column_, TRUE); SizeColumns(); int id = GetSelectedRowID(); if (kRecentID == id) { right_tree_model_.reset( BookmarkTableModel::CreateRecentlyBookmarkedModel(model_)); } else { // kSearchID == id search_factory_.RevokeAll(); std::wstring search_text( UTF8ToWide(gtk_entry_get_text(GTK_ENTRY(search_entry_)))); std::wstring languages = profile_->GetPrefs()->GetString(prefs::kAcceptLanguages); right_tree_model_.reset( BookmarkTableModel::CreateSearchTableModel(model_, search_text, languages)); } gtk_drag_dest_unset(right_tree_view_); } right_tree_adapter_->SetModel(right_tree_model_.get()); } int64 BookmarkManagerGtk::GetRowIDAt(GtkTreeModel* model, GtkTreeIter* iter) { bool left = model == GTK_TREE_MODEL(left_store_); GValue value = { 0, }; if (left) gtk_tree_model_get_value(model, iter, bookmark_utils::ITEM_ID, &value); else gtk_tree_model_get_value(model, iter, RIGHT_PANE_ID, &value); int64 id = g_value_get_int64(&value); g_value_unset(&value); return id; } const BookmarkNode* BookmarkManagerGtk::GetNodeAt(GtkTreeModel* model, GtkTreeIter* iter) { int64 id = GetRowIDAt(model, iter); if (id > 0) return model_->GetNodeByID(id); else return NULL; } const BookmarkNode* BookmarkManagerGtk::GetFolder() { GtkTreeModel* model; GtkTreeIter iter; if (!gtk_tree_selection_get_selected(left_selection(), &model, &iter)) return NULL; return GetNodeAt(model, &iter); } int BookmarkManagerGtk::GetSelectedRowID() { GtkTreeModel* model; GtkTreeIter iter; gtk_tree_selection_get_selected(left_selection(), &model, &iter); return GetRowIDAt(model, &iter); } std::vector<const BookmarkNode*> BookmarkManagerGtk::GetRightSelection() { GtkTreeModel* model; GList* paths = gtk_tree_selection_get_selected_rows(right_selection(), &model); std::vector<const BookmarkNode*> nodes; for (GList* item = paths; item; item = item->next) { GtkTreeIter iter; gtk_tree_model_get_iter(model, &iter, reinterpret_cast<GtkTreePath*>(item->data)); nodes.push_back(GetNodeAt(model, &iter)); } g_list_free(paths); return nodes; } void BookmarkManagerGtk::SizeColumn(GtkTreeViewColumn* column, const wchar_t* prefname) { gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_FIXED); gtk_tree_view_column_set_resizable(column, TRUE); PrefService* prefs = profile_->GetPrefs(); if (!prefs) return; int width = prefs->GetInteger(prefname); if (width <= 0) width = kDefaultColumnWidth; gtk_tree_view_column_set_fixed_width(column, width); } void BookmarkManagerGtk::SizeColumns() { if (gtk_tree_view_column_get_visible(path_column_)) { SizeColumn(title_column_, prefs::kBookmarkTableNameWidth2); SizeColumn(url_column_, prefs::kBookmarkTableURLWidth2); SizeColumn(path_column_, prefs::kBookmarkTablePathWidth); } else { SizeColumn(title_column_, prefs::kBookmarkTableNameWidth1); SizeColumn(url_column_, prefs::kBookmarkTableURLWidth1); } } void BookmarkManagerGtk::SaveColumnConfiguration() { PrefService* prefs = profile_->GetPrefs(); if (!prefs) return; if (gtk_tree_view_column_get_visible(path_column_)) { prefs->SetInteger(prefs::kBookmarkTableNameWidth2, gtk_tree_view_column_get_width(title_column_)); prefs->SetInteger(prefs::kBookmarkTableURLWidth2, gtk_tree_view_column_get_width(url_column_)); prefs->SetInteger(prefs::kBookmarkTablePathWidth, gtk_tree_view_column_get_width(path_column_)); } else { prefs->SetInteger(prefs::kBookmarkTableNameWidth1, gtk_tree_view_column_get_width(title_column_)); prefs->SetInteger(prefs::kBookmarkTableURLWidth1, gtk_tree_view_column_get_width(url_column_)); } } void BookmarkManagerGtk::SendDelayedMousedown() { sending_delayed_mousedown_ = true; gtk_propagate_event(right_tree_view_, reinterpret_cast<GdkEvent*>(&mousedown_event_)); sending_delayed_mousedown_ = false; delaying_mousedown_ = false; } bool BookmarkManagerGtk::RecursiveFind(GtkTreeModel* model, GtkTreeIter* iter, int64 target) { GValue value = { 0, }; bool left = model == GTK_TREE_MODEL(left_store_); if (left) { if (iter->stamp == 0) gtk_tree_model_get_iter_first(GTK_TREE_MODEL(left_store_), iter); gtk_tree_model_get_value(model, iter, bookmark_utils::ITEM_ID, &value); } else { if (iter->stamp == 0) gtk_tree_model_get_iter_first(GTK_TREE_MODEL(right_store_), iter); gtk_tree_model_get_value(model, iter, RIGHT_PANE_ID, &value); } int64 id = g_value_get_int64(&value); g_value_unset(&value); if (id == target) { return true; } GtkTreeIter child; // Check the first child. if (gtk_tree_model_iter_children(model, &child, iter)) { if (RecursiveFind(model, &child, target)) { *iter = child; return true; } } // Check siblings. while (gtk_tree_model_iter_next(model, iter)) { if (RecursiveFind(model, iter, target)) return true; } return false; } void BookmarkManagerGtk::PerformSearch() { bool search_selected = GetSelectedRowID() == kSearchID; // If the search node is not selected, we'll select it to force a search. if (!search_selected) { int index = gtk_tree_model_iter_n_children(GTK_TREE_MODEL(left_store_), NULL) - 1; GtkTreeIter iter; gtk_tree_model_iter_nth_child(GTK_TREE_MODEL(left_store_), &iter, NULL, index); gtk_tree_selection_select_iter(left_selection(), &iter); } else { BuildRightStore(); } } void BookmarkManagerGtk::OnSearchTextChanged() { search_factory_.RevokeAll(); MessageLoop::current()->PostDelayedTask(FROM_HERE, search_factory_.NewRunnableMethod(&BookmarkManagerGtk::PerformSearch), kSearchDelayMS); } // static void BookmarkManagerGtk::OnLeftSelectionChanged(GtkTreeSelection* selection, BookmarkManagerGtk* bm) { // If the selection is (newly) empty, then make the right tree view take // over the organize menu. if (gtk_tree_selection_count_selected_rows(selection) == 0) { bm->ResetOrganizeMenu(false); return; } bm->ResetOrganizeMenu(true); bm->BuildRightStore(); } // static void BookmarkManagerGtk::OnRightSelectionChanged(GtkTreeSelection* selection, BookmarkManagerGtk* bm) { // If the selection is (newly) empty, then make the left tree view take // over the organize menu. if (gtk_tree_selection_count_selected_rows(selection) == 0) { bm->ResetOrganizeMenu(true); return; } bm->ResetOrganizeMenu(false); } // static void BookmarkManagerGtk::OnLeftTreeViewDragReceived( GtkWidget* tree_view, GdkDragContext* context, gint x, gint y, GtkSelectionData* selection_data, guint target_type, guint time, BookmarkManagerGtk* bm) { gboolean get_nodes_success = FALSE; gboolean delete_selection_data = FALSE; std::vector<const BookmarkNode*> nodes = bookmark_utils::GetNodesFromSelection(context, selection_data, target_type, bm->profile_, &delete_selection_data, &get_nodes_success); if (nodes.empty() || !get_nodes_success) { gtk_drag_finish(context, FALSE, delete_selection_data, time); return; } GtkTreePath* path; GtkTreeViewDropPosition pos; gtk_tree_view_get_dest_row_at_pos(GTK_TREE_VIEW(tree_view), x, y, &path, &pos); if (!path) { gtk_drag_finish(context, FALSE, delete_selection_data, time); return; } GtkTreeIter iter; gtk_tree_model_get_iter(GTK_TREE_MODEL(bm->left_store_), &iter, path); const BookmarkNode* folder = bm->GetNodeAt(GTK_TREE_MODEL(bm->left_store_), &iter); gboolean dnd_success = FALSE; if (folder) { for (std::vector<const BookmarkNode*>::iterator it = nodes.begin(); it != nodes.end(); ++it) { // Don't try to drop a node into one of its descendants. if (!folder->HasAncestor(*it)) { bm->model_->Move(*it, folder, folder->GetChildCount()); dnd_success = TRUE; } } } gtk_tree_path_free(path); gtk_drag_finish(context, dnd_success, delete_selection_data && dnd_success, time); } // static gboolean BookmarkManagerGtk::OnLeftTreeViewDragMotion( GtkWidget* tree_view, GdkDragContext* context, gint x, gint y, guint time, BookmarkManagerGtk* bm) { GtkTreePath* path; GtkTreeViewDropPosition pos; gtk_tree_view_get_dest_row_at_pos(GTK_TREE_VIEW(tree_view), x, y, &path, &pos); if (path) { // Only allow INTO. if (pos == GTK_TREE_VIEW_DROP_BEFORE) pos = GTK_TREE_VIEW_DROP_INTO_OR_BEFORE; else if (pos == GTK_TREE_VIEW_DROP_AFTER) pos = GTK_TREE_VIEW_DROP_INTO_OR_AFTER; gtk_tree_view_set_drag_dest_row(GTK_TREE_VIEW(tree_view), path, pos); } else { return FALSE; } gdk_drag_status(context, GDK_ACTION_MOVE, time); gtk_tree_path_free(path); return TRUE; } // static void BookmarkManagerGtk::OnLeftTreeViewRowCollapsed( GtkTreeView *tree_view, GtkTreeIter* iter, GtkTreePath* path, BookmarkManagerGtk* bm) { // If a selection still exists, do nothing. if (gtk_tree_selection_get_selected(bm->left_selection(), NULL, NULL)) return; gtk_tree_selection_select_path(bm->left_selection(), path); } // static void BookmarkManagerGtk::OnRightTreeViewDragGet( GtkWidget* tree_view, GdkDragContext* context, GtkSelectionData* selection_data, guint target_type, guint time, BookmarkManagerGtk* bm) { // No selection, do nothing. This shouldn't get hit, but if it does an early // return avoids a crash. if (gtk_tree_selection_count_selected_rows(bm->right_selection()) == 0) { NOTREACHED(); return; } bookmark_utils::WriteBookmarksToSelection(bm->GetRightSelection(), selection_data, target_type, bm->profile_); } // static void BookmarkManagerGtk::OnRightTreeViewDragReceived( GtkWidget* tree_view, GdkDragContext* context, gint x, gint y, GtkSelectionData* selection_data, guint target_type, guint time, BookmarkManagerGtk* bm) { gboolean dnd_success = FALSE; gboolean delete_selection_data = FALSE; std::vector<const BookmarkNode*> nodes = bookmark_utils::GetNodesFromSelection(context, selection_data, target_type, bm->profile_, &delete_selection_data, &dnd_success); if (nodes.empty()) { gtk_drag_finish(context, dnd_success, delete_selection_data, time); return; } GtkTreePath* path; GtkTreeViewDropPosition pos; gtk_tree_view_get_dest_row_at_pos(GTK_TREE_VIEW(tree_view), x, y, &path, &pos); bool drop_before = pos == GTK_TREE_VIEW_DROP_BEFORE; bool drop_after = pos == GTK_TREE_VIEW_DROP_AFTER; // The parent folder and index therein to drop the nodes. const BookmarkNode* parent = NULL; int idx = -1; // |path| will be null when we are looking at an empty folder. if (!drop_before && !drop_after && path) { GtkTreeIter iter; GtkTreeModel* model = GTK_TREE_MODEL(bm->right_store_); gtk_tree_model_get_iter(model, &iter, path); const BookmarkNode* node = bm->GetNodeAt(model, &iter); if (node && node->is_folder()) { parent = node; idx = parent->GetChildCount(); } else { drop_before = pos == GTK_TREE_VIEW_DROP_INTO_OR_BEFORE; drop_after = pos == GTK_TREE_VIEW_DROP_INTO_OR_AFTER; } } if (drop_before || drop_after || !path) { if (path && drop_after) gtk_tree_path_next(path); // We will get a null path when the drop is below the lowest row. parent = bm->GetFolder(); idx = !path ? parent->GetChildCount() : gtk_tree_path_get_indices(path)[0]; } for (std::vector<const BookmarkNode*>::iterator it = nodes.begin(); it != nodes.end(); ++it) { // Don't try to drop a node into one of its descendants. if (!parent->HasAncestor(*it)) { bm->model_->Move(*it, parent, idx); idx = parent->IndexOfChild(*it) + 1; } } gtk_tree_path_free(path); gtk_drag_finish(context, dnd_success, delete_selection_data, time); } // static void BookmarkManagerGtk::OnRightTreeViewDragBegin( GtkWidget* tree_view, GdkDragContext* drag_context, BookmarkManagerGtk* bm) { gtk_drag_set_icon_stock(drag_context, GTK_STOCK_DND, 0, 0); } // static gboolean BookmarkManagerGtk::OnRightTreeViewDragMotion( GtkWidget* tree_view, GdkDragContext* context, gint x, gint y, guint time, BookmarkManagerGtk* bm) { GtkTreePath* path; GtkTreeViewDropPosition pos; gtk_tree_view_get_dest_row_at_pos(GTK_TREE_VIEW(tree_view), x, y, &path, &pos); const BookmarkNode* parent = bm->GetFolder(); if (path) { int idx = gtk_tree_path_get_indices(path)[gtk_tree_path_get_depth(path) - 1]; // Only allow INTO if the node is a folder. if (parent->GetChild(idx)->is_url()) { if (pos == GTK_TREE_VIEW_DROP_INTO_OR_BEFORE) pos = GTK_TREE_VIEW_DROP_BEFORE; else if (pos == GTK_TREE_VIEW_DROP_INTO_OR_AFTER) pos = GTK_TREE_VIEW_DROP_AFTER; } gtk_tree_view_set_drag_dest_row(GTK_TREE_VIEW(tree_view), path, pos); } else { // We allow a drop if the drag is over the bottom of the tree view, // but we don't draw any indication. } gdk_drag_status(context, GDK_ACTION_MOVE, time); return TRUE; } // static void BookmarkManagerGtk::OnRightTreeViewRowActivated( GtkTreeView* tree_view, GtkTreePath* path, GtkTreeViewColumn* column, BookmarkManagerGtk* bm) { std::vector<const BookmarkNode*> nodes = bm->GetRightSelection(); if (nodes.empty()) return; if (nodes.size() == 1 && nodes[0]->is_folder()) { // Double click on a folder descends into the folder. bm->SelectInTree(nodes[0], false); return; } bookmark_utils::OpenAll(GTK_WINDOW(bm->window_), bm->profile_, NULL, nodes, CURRENT_TAB); } // static void BookmarkManagerGtk::OnLeftTreeViewFocusIn( GtkTreeView* tree_view, GdkEventFocus* event, BookmarkManagerGtk* bm) { if (!bm->organize_is_for_left_) bm->ResetOrganizeMenu(true); } // static void BookmarkManagerGtk::OnRightTreeViewFocusIn( GtkTreeView* tree_view, GdkEventFocus* event, BookmarkManagerGtk* bm) { if (bm->organize_is_for_left_) bm->ResetOrganizeMenu(false); } // We do a couple things in this handler. // // 1. On left clicks that occur below the lowest row, unselect all selected // rows. This is not a native GtkTreeView behavior, but it is added by libegg // and is thus present in Nautilus. This is the path == NULL path. // 2. Cache left clicks that occur on an already active selection. If the user // begins a drag, then we will throw away this event and initiate a drag on the // tree view manually. If the user doesn't begin a drag (e.g. just releases the // button), send both events to the tree view. This is a workaround for // http://crbug.com/15240. If we don't do this, when the user tries to drag // a group of selected rows, the click at the start of the drag will deselect // all rows except the one the cursor is over. // // We return TRUE for when we want to ignore events (i.e., stop the default // handler from handling them), and FALSE for when we want to continue // propagation. // // static gboolean BookmarkManagerGtk::OnRightTreeViewButtonPress( GtkWidget* tree_view, GdkEventButton* event, BookmarkManagerGtk* bm) { // Always let cached mousedown events through. if (bm->sending_delayed_mousedown_) return FALSE; if (event->button != 1) return FALSE; // If a user double clicks, we will get two button presses in a row without // any intervening mouse up, hence we must flush delayed mousedowns here as // well as in the button release handler. if (bm->delaying_mousedown_) { bm->SendDelayedMousedown(); return FALSE; } GtkTreePath* path; gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(tree_view), static_cast<gint>(event->x), static_cast<gint>(event->y), &path, NULL, NULL, NULL); if (path == NULL) { // Checking that the widget already has focus matches libegg behavior. if (GTK_WIDGET_HAS_FOCUS(tree_view)) gtk_tree_selection_unselect_all(bm->right_selection()); return FALSE; } if (gtk_tree_selection_path_is_selected(bm->right_selection(), path)) { bm->mousedown_event_ = *event; bm->delaying_mousedown_ = true; gtk_tree_path_free(path); return TRUE; } gtk_tree_path_free(path); return FALSE; } // static gboolean BookmarkManagerGtk::OnRightTreeViewMotion( GtkWidget* tree_view, GdkEventMotion* event, BookmarkManagerGtk* bm) { // Swallow motion events when no row is selected. This prevents the initiation // of empty drags. if (gtk_tree_selection_count_selected_rows(bm->right_selection()) == 0) return TRUE; // Otherwise this handler is only used for the multi-drag workaround. if (!bm->delaying_mousedown_) return FALSE; if (gtk_drag_check_threshold(tree_view, static_cast<gint>(bm->mousedown_event_.x), static_cast<gint>(bm->mousedown_event_.y), static_cast<gint>(event->x), static_cast<gint>(event->y))) { bm->delaying_mousedown_ = false; GtkTargetList* targets = GtkDndUtil::GetTargetListFromCodeMask( kSourceTargetMask); gtk_drag_begin(tree_view, targets, GDK_ACTION_MOVE, 1, reinterpret_cast<GdkEvent*>(event)); // The drag adds a ref; let it own the list. gtk_target_list_unref(targets); } return FALSE; } // static gboolean BookmarkManagerGtk::OnTreeViewButtonPress( GtkWidget* tree_view, GdkEventButton* button, BookmarkManagerGtk* bm) { if (button->button != 3) return FALSE; if (bm->ignore_rightclicks_) return FALSE; // If the cursor is not hovering over a selected row, let it propagate // to the default handler so that a selection change may occur. if (!CursorIsOverSelection(GTK_TREE_VIEW(tree_view))) { bm->ignore_rightclicks_ = true; gtk_propagate_event(tree_view, reinterpret_cast<GdkEvent*>(button)); bm->ignore_rightclicks_ = false; } bm->organize_menu_->PopupAsContext(button->time); return TRUE; } // static gboolean BookmarkManagerGtk::OnTreeViewButtonRelease( GtkWidget* tree_view, GdkEventButton* button, BookmarkManagerGtk* bm) { if (bm->delaying_mousedown_ && (tree_view == bm->right_tree_view_)) bm->SendDelayedMousedown(); return FALSE; } // static gboolean BookmarkManagerGtk::OnTreeViewKeyPress( GtkWidget* tree_view, GdkEventKey* key, BookmarkManagerGtk* bm) { int command = -1; if ((key->state & gtk_accelerator_get_default_mod_mask()) == GDK_SHIFT_MASK) { if (key->keyval == GDK_Delete) command = IDS_CUT; else if (key->keyval == GDK_Insert) command = IDS_PASTE; } else if ((key->state & gtk_accelerator_get_default_mod_mask()) == GDK_CONTROL_MASK) { switch (key->keyval) { case GDK_c: case GDK_Insert: command = IDS_COPY; break; case GDK_x: command = IDS_CUT; break; case GDK_v: command = IDS_PASTE; break; default: break; } } else if (key->keyval == GDK_Delete) { command = IDS_BOOKMARK_BAR_REMOVE; } if (command == -1) return FALSE; if (bm->organize_menu_.get() && bm->organize_menu_->IsCommandEnabled(command)) { bm->organize_menu_->ExecuteCommandById(command); return TRUE; } return FALSE; } // static void BookmarkManagerGtk::OnFolderNameEdited(GtkCellRendererText* render, gchar* path, gchar* new_folder_name, BookmarkManagerGtk* bm) { // A folder named was edited in place. Sync the change to the bookmark // model. GtkTreeIter iter; GtkTreePath* tree_path = gtk_tree_path_new_from_string(path); gboolean rv = gtk_tree_model_get_iter(GTK_TREE_MODEL(bm->left_store_), &iter, tree_path); DCHECK(rv); bm->model_->SetTitle(bm->GetNodeAt(GTK_TREE_MODEL(bm->left_store_), &iter), UTF8ToWide(new_folder_name)); } // static void BookmarkManagerGtk::OnImportItemActivated( GtkMenuItem* menuitem, BookmarkManagerGtk* bm) { SelectFileDialog::FileTypeInfo file_type_info; file_type_info.extensions.resize(1); file_type_info.extensions[0].push_back(FILE_PATH_LITERAL("html")); file_type_info.extensions[0].push_back(FILE_PATH_LITERAL("htm")); file_type_info.include_all_files = true; bm->select_file_dialog_->SelectFile( SelectFileDialog::SELECT_OPEN_FILE, string16(), FilePath(""), &file_type_info, 0, std::string(), GTK_WINDOW(bm->window_), reinterpret_cast<void*>(IDS_BOOKMARK_MANAGER_IMPORT_MENU)); } // static void BookmarkManagerGtk::OnExportItemActivated( GtkMenuItem* menuitem, BookmarkManagerGtk* bm) { SelectFileDialog::FileTypeInfo file_type_info; file_type_info.extensions.resize(1); file_type_info.extensions[0].push_back(FILE_PATH_LITERAL("html")); file_type_info.include_all_files = true; // TODO(estade): If a user exports a bookmark file then we will remember the // download location. If the user subsequently downloads a file, we will // suggest this cached download location. This is bad! We ought to remember // save locations differently for different user tasks. FilePath suggested_path; PathService::Get(chrome::DIR_USER_DATA, &suggested_path); bm->select_file_dialog_->SelectFile( SelectFileDialog::SELECT_SAVEAS_FILE, string16(), suggested_path.Append("bookmarks.html"), &file_type_info, 0, "html", GTK_WINDOW(bm->window_), reinterpret_cast<void*>(IDS_BOOKMARK_MANAGER_EXPORT_MENU)); } // static void BookmarkManagerGtk::OnSyncStatusMenuActivated(GtkMenuItem* menu_item, BookmarkManagerGtk* bm) { if (bm->sync_relogin_required_) { DCHECK(bm->sync_service_); bm->sync_service_->ShowLoginDialog(); } else { sync_ui_util::OpenSyncMyBookmarksDialog( bm->profile_, ProfileSyncService::START_FROM_BOOKMARK_MANAGER); } } gboolean BookmarkManagerGtk::OnWindowDestroyed(GtkWidget* window) { DCHECK_EQ(this, manager); if (g_browser_process->local_state()) { DictionaryValue* placement_pref = g_browser_process->local_state()->GetMutableDictionary( prefs::kBookmarkManagerPlacement); // Note that we store left/top for consistency with Windows, but that we // *don't* restore them. placement_pref->SetInteger(L"left", window_bounds_.x()); placement_pref->SetInteger(L"top", window_bounds_.y()); placement_pref->SetInteger(L"right", window_bounds_.right()); placement_pref->SetInteger(L"bottom", window_bounds_.bottom()); placement_pref->SetBoolean(L"maximized", false); } delete manager; manager = NULL; return FALSE; } gboolean BookmarkManagerGtk::OnWindowStateChanged(GtkWidget* window, GdkEventWindowState* event) { DCHECK_EQ(this, manager); window_state_ = event->new_window_state; return FALSE; } gboolean BookmarkManagerGtk::OnWindowConfigured(GtkWidget* window, GdkEventConfigure* event) { DCHECK_EQ(this, manager); // Don't save the size if we're in an abnormal state. if (!(window_state_ & (GDK_WINDOW_STATE_MAXIMIZED | GDK_WINDOW_STATE_WITHDRAWN | GDK_WINDOW_STATE_FULLSCREEN | GDK_WINDOW_STATE_ICONIFIED))) { window_bounds_.SetRect(event->x, event->y, event->width, event->height); } return FALSE; } void BookmarkManagerGtk::FileSelected(const FilePath& path, int index, void* params) { int id = reinterpret_cast<intptr_t>(params); if (id == IDS_BOOKMARK_MANAGER_IMPORT_MENU) { // ImporterHost is ref counted and will delete itself when done. ImporterHost* host = new ImporterHost(); ProfileInfo profile_info; profile_info.browser_type = BOOKMARKS_HTML; profile_info.source_path = path.ToWStringHack(); StartImportingWithUI(GTK_WINDOW(window_), FAVORITES, host, profile_info, profile_, new ImportObserverImpl(profile()), false); } else if (id == IDS_BOOKMARK_MANAGER_EXPORT_MENU) { bookmark_html_writer::WriteBookmarks(model_, path); } else { NOTREACHED(); } } void BookmarkManagerGtk::OnStateChanged() { UpdateSyncStatus(); } // static gboolean BookmarkManagerGtk::OnGtkAccelerator(GtkAccelGroup* accel_group, GObject* acceleratable, guint keyval, GdkModifierType modifier, BookmarkManagerGtk* bookmark_manager) { modifier = static_cast<GdkModifierType>( modifier & gtk_accelerator_get_default_mod_mask()); // The only accelerator we have registered is ctrl+w, so any other value is a // non-fatal error. DCHECK_EQ(keyval, static_cast<guint>(GDK_w)); DCHECK_EQ(modifier, GDK_CONTROL_MASK); gtk_widget_destroy(bookmark_manager->window_); return TRUE; } void BookmarkManagerGtk::UpdateSyncStatus() { DCHECK(sync_service_); string16 status_label; string16 link_label; sync_relogin_required_ = sync_ui_util::GetStatusLabels( sync_service_, &status_label, &link_label) == sync_ui_util::SYNC_ERROR; if (sync_relogin_required_) { GtkWidget* sync_status_label = gtk_bin_get_child( GTK_BIN(sync_status_menu_)); gtk_label_set_label( GTK_LABEL(sync_status_label), l10n_util::GetStringUTF8(IDS_SYNC_BOOKMARK_BAR_ERROR).c_str()); return; } if (sync_service_->HasSyncSetupCompleted()) { string16 username = sync_service_->GetAuthenticatedUsername(); status_label = l10n_util::GetStringFUTF16(IDS_SYNC_NTP_SYNCED_TO, username); } else if (sync_service_->SetupInProgress()) { status_label = l10n_util::GetStringUTF16(IDS_SYNC_NTP_SETUP_IN_PROGRESS); } else { status_label = l10n_util::GetStringUTF16(IDS_SYNC_START_SYNC_BUTTON_LABEL); } GtkWidget* sync_status_label = gtk_bin_get_child(GTK_BIN(sync_status_menu_)); gtk_label_set_label(GTK_LABEL(sync_status_label), UTF16ToUTF8(status_label).c_str()); }
35.931534
80
0.689483
[ "render", "vector", "model" ]
a7eae1d5f0eda20e3df06cc93df50de74b55d670
8,966
cpp
C++
source/uuclock.cpp
serge567/F767ZI-DS1302-NODEMCU-LCD1602
698ebcc9d35f60146e94539b6f8ee89f16476660
[ "Apache-2.0" ]
null
null
null
source/uuclock.cpp
serge567/F767ZI-DS1302-NODEMCU-LCD1602
698ebcc9d35f60146e94539b6f8ee89f16476660
[ "Apache-2.0" ]
null
null
null
source/uuclock.cpp
serge567/F767ZI-DS1302-NODEMCU-LCD1602
698ebcc9d35f60146e94539b6f8ee89f16476660
[ "Apache-2.0" ]
null
null
null
#include "globalvars.h" #include "mbed.h" #include "ds1302.h" // RTC module #include "TextLCD.h" // LCD 1602 with PCF8574, I2C bus #include <string> #include "Json.h" //WIFI #include "ESP8266Interface.h" //WIFI ESP8266Interface wifi(D1, D0); DigitalOut ES8266RST(D2); DigitalIn userButton(USER_BUTTON); //LCD 1602 I2C i2c_lcd(D14,D15); // SDA, SCL // 1001110 - 0x4E // 100111 - 0x27 TextLCD_I2C lcd(&i2c_lcd, 0x4E, TextLCD::LCD16x2); // I2C bus, PCF8574 Slaveaddress, LCD Type Ticker SecTick; // Time synchronization time_t timestamp; // RTC module -> #define SCLK D13 // CLK #define IO D12 // DATA #define CE D8 // RST const char *swd[8] = { "", "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" }; const char *smth[13] = {"", "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}; struct tm * timeinfo; unsigned char day; unsigned char mth; unsigned char year; unsigned char dow; unsigned char hr; unsigned char minu; unsigned char sec; ds1302 clk(SCLK, IO, CE); // <- RTC module // Interrupts bool bOneSecTick = false; // const char *sec2str(nsapi_security_t sec) { switch (sec) { case NSAPI_SECURITY_NONE: return "None"; case NSAPI_SECURITY_WEP: return "WEP"; case NSAPI_SECURITY_WPA: return "WPA"; case NSAPI_SECURITY_WPA2: return "WPA2"; case NSAPI_SECURITY_WPA_WPA2: return "WPA/WPA2"; case NSAPI_SECURITY_UNKNOWN: default: return "Unknown"; } } void scan_demo(WiFiInterface *wifi) { WiFiAccessPoint *ap; printf("Scan:\r\n"); int count = wifi->scan(NULL, 0); /* Limit number of network arbitrary to 15 */ count = count < 15 ? count : 15; ap = new WiFiAccessPoint[count]; count = wifi->scan(ap, count); for (int i = 0; i < count; i++) { printf("Network: %s secured: %s BSSID: %hhX:%hhX:%hhX:%hhx:%hhx:%hhx RSSI: %hhd Ch: %hhd\r\n", ap[i].get_ssid(), sec2str(ap[i].get_security()), ap[i].get_bssid()[0], ap[i].get_bssid()[1], ap[i].get_bssid()[2], ap[i].get_bssid()[3], ap[i].get_bssid()[4], ap[i].get_bssid()[5], ap[i].get_rssi(), ap[i].get_channel()); } printf("%d networks available.\r\n", count); delete[] ap; } time_t http_demo(NetworkInterface *net) { // Open a socket on the network interface, and create a TCP connection to mbed.org TCPSocket socket; socket.open(net); SocketAddress a; net->gethostbyname("worldtimeapi.org", &a); a.set_port(80); socket.connect(a); // Send a simple http request char sbuffer[] = "GET /api/timezone/Asia/Tokyo HTTP/1.1\r\nHost: worldtimeapi.org\r\n\r\n"; int scount = socket.send(sbuffer, sizeof sbuffer); // DEBUG // printf("sent %d [%.*s]\r\n", scount, strstr(sbuffer, "\r\n") - sbuffer, sbuffer); // Recieve a simple http response and print out the response line char rbuffer[1024]; int rcount = socket.recv(rbuffer, sizeof rbuffer); // DEBUG // printf("recv %d [%.*s]\n", rcount, strstr(rbuffer, "\r\n") - rbuffer, rbuffer); // printf("recv %s\r\n", rbuffer); string sJSON = rbuffer; // Close the socket to return its memory and bring down the network interface socket.close(); size_t posb = sJSON.find("{"); size_t pose = sJSON.find("}"); sJSON = sJSON.substr(posb, pose - posb + 1); // DEBUG // printf("%s \r\n", sJSON.c_str()); Json oJSON ( sJSON.c_str(), strlen ( sJSON.c_str() ) ); if ( !oJSON.isValidJson () ) { printf("Invalid JSON: %s \r\n", sJSON.c_str()); return 0; } if ( oJSON.type (0) != JSMN_OBJECT ) { printf ( "Invalid JSON. ROOT element is not Object: %s \r\n", sJSON.c_str() ); return 0; } int unixtimeIndex = oJSON.findKeyIndexIn ( "unixtime", 0 ); char unixtimeValue [ 32 ]; if ( unixtimeIndex == -1 ) { printf ("%s \r\n"," unixtime JSON key does not exist." ); } else { int unixtimeValueIndex = oJSON.findChildIndexOf ( unixtimeIndex, -1 ); if ( unixtimeValueIndex > 0 ) { const char * valueStart = oJSON.tokenAddress ( unixtimeValueIndex ); int valueLength = oJSON.tokenLength ( unixtimeValueIndex ); strncpy ( unixtimeValue, valueStart, valueLength ); unixtimeValue [ valueLength ] = 0; // NULL-terminate the string // DEBUG // printf ( "unixtime: %s \r\n", unixtimeValue ); time_t tmconv; sscanf(unixtimeValue, "%d", &tmconv); return (time_t) tmconv; } } return 0; } string StrLeadZero(unsigned char number) { string snumber = to_string(number); if (snumber.length() == 1) { snumber = "0" + snumber; } return snumber; } void RTC_PrintDateTime() { clk.get_date(day, mth, year, dow); clk.get_time(hr, minu, sec); printf("RTC module date and time: %s, %s %s, %d %s:%s:%s \r\n", swd[dow], smth[mth], StrLeadZero(day).c_str(), year + 2000, StrLeadZero(hr).c_str(), StrLeadZero(minu).c_str(), StrLeadZero(sec).c_str()); } void RTC_Synch() { // printf("%s", "Reseting ESP8266 WIFI. \r\n"); ES8266RST = 0; ThisThread::sleep_for(3s); ES8266RST = 1; ThisThread::sleep_for(10s); SocketAddress a; printf("WiFi example\r\n\r\n"); // DEBUG // scan_demo(&wifi); printf("\r\nConnecting...\r\n"); int ret = wifi.connect("UsagiMoomin", "usachumuchu", NSAPI_SECURITY_WPA_WPA2); if (ret == 0) { printf("Success\r\n\r\n"); printf("MAC: %s\r\n", wifi.get_mac_address()); wifi.get_ip_address(&a); printf("IP: %s\r\n", a.get_ip_address()); wifi.get_netmask(&a); printf("Netmask: %s\r\n", a.get_ip_address()); wifi.get_gateway(&a); printf("Gateway: %s\r\n", a.get_ip_address()); printf("RSSI: %d\r\n\r\n", wifi.get_rssi()); timestamp = http_demo(&wifi); wifi.disconnect(); printf("\r\nDone\r\n"); } else { printf("\r\nConnection error\r\n"); timestamp = 0; } // printf("\r\ntimestamp: %d\r\n", timestamp); timestamp = timestamp + 3600 * 9; // Japan Time +9 hours offset timeinfo = localtime(&timestamp); year = (unsigned char) (timeinfo -> tm_year + 1900 - 2000); if ((year < 20) || (year > 25)) // 2020 and 2025 years { printf("An error occurred when getting the time. %d year got, it must be more 2020 and less 2025 \r\n", year + 2000); } else { printf("Current time is %s\r\n", ctime(&timestamp)); day = (unsigned char) timeinfo -> tm_mday; mth = (unsigned char) (timeinfo -> tm_mon + 1); dow = (unsigned char) (timeinfo -> tm_wday + 1); hr = (unsigned char) timeinfo -> tm_hour; minu = (unsigned char) timeinfo -> tm_min; sec = (unsigned char) timeinfo -> tm_sec; clk.set_datetime(day, mth, year, dow, hr, minu, sec); printf("RTC module date and time: %s, %s %d, %d %d:%d:%d synchronized with NTP sertver.\r\n", swd[dow], smth[mth], day, year + 2000, hr, minu, sec); } lcd.cls(); } void LCDDisplayTime() { clk.get_date(day, mth, year, dow); clk.get_time(hr, minu, sec); lcd.locate(0, 0); lcd.printf("%s %s %s, %d ", swd[dow], smth[mth], StrLeadZero(day).c_str(), year + 2000); lcd.locate(0, 1); lcd.printf(" %s:%s:%s ", StrLeadZero(hr).c_str(), StrLeadZero(minu).c_str(), StrLeadZero(sec).c_str()); } void fSecondTick() { bOneSecTick = true; // avoid here to input instructions which required long execution time such as printf .. } int uclock() { //LCD 1602 lcd.cls(); lcd.setBacklight(TextLCD::LightOn); //DS1302 RTC Module --> clk.init(); RTC_PrintDateTime(); RTC_Synch(); RTC_PrintDateTime(); // <-- DS1302 RTC Module //LCD 1602 lcd.cls(); SecTick.attach(&fSecondTick, 1000ms); while(1) { // ThisThread::sleep_for(1s); if (userButton && bOneSecTick) { lcd.cls(); lcd.locate(0, 0); lcd.printf("%s", "USER BUTTON"); lcd.locate(0, 1); lcd.printf("%s", "PRESSED!"); ThisThread::sleep_for(3s); lcd.cls(); RTC_Synch(); } if (bOneSecTick) { bOneSecTick = false; LCDDisplayTime(); } messdateandtime.year = year; messdateandtime.day = day; messdateandtime.mth = mth; messdateandtime.dow = dow; messdateandtime.hr = hr; messdateandtime.minu = minu; messdateandtime.sec = sec; messdateandtime.smonth = smth[mth]; messdateandtime.weekday = swd[dow]; } }
29.205212
210
0.571604
[ "object" ]
a7eba49775f796917acd299afcc60de02f194b0b
1,274
cpp
C++
c++/primitive_root.cpp
forgotter/Snippets
bb4e39cafe7ef2c1ef3ac24b450a72df350a248b
[ "MIT" ]
38
2018-09-17T18:16:24.000Z
2022-02-10T10:26:23.000Z
c++/primitive_root.cpp
forgotter/Snippets
bb4e39cafe7ef2c1ef3ac24b450a72df350a248b
[ "MIT" ]
1
2020-10-01T10:48:45.000Z
2020-10-04T11:27:44.000Z
c++/primitive_root.cpp
forgotter/Snippets
bb4e39cafe7ef2c1ef3ac24b450a72df350a248b
[ "MIT" ]
12
2018-11-13T13:36:41.000Z
2021-05-02T10:07:44.000Z
/// Name: PrimitiveRoot /// Description: Primitive root is a generator in ring of modulo m. /// Detail: Maths, Number Theory, Modular Ring, Modular Arithmetic /// Guarantee: } // PrimitiveRoot /// Dependencies: modexp, prime_factor, totient /* Primitive root of a number is such a number which can produce all other numbers modulo m, when raised to some power p (p belongs to [0,m-1]) There are phi(phi(m)) primitive roots, if there are any. */ // checks if given number is primitive root bool check(int x, int phi, int n, vector<pair<int,int>>& prime_factors) { for(auto z: prime_factors) { if(modexp(x, phi/z.first, n) == 1) return 0; } return 1; } int primitiveRoot(int n) { int phi = totient(n); vector<pair<int,int>>factors = prime_factor(phi); for(int i=2; i<n; i++) { if(__gcd(i,n) == 1 && check(i, phi, n, factors)) return i; } return -1; } vector<int> allPrimitiveRoot(int n) { int x = primitiveRoot(n); int phi = totient(n); vector<int> primitiveRoots; if(x != -1) for(int i=1; i<phi; i++) { if(__gcd(i,phi) == 1) primitiveRoots.push_back(modexp(x,i,n)); } return primitiveRoots; } // PrimitiveRoot
25.48
75
0.604396
[ "vector" ]
a7f0d41b37a803c263df16b1c6f0e14b2c1ffd6f
6,743
cpp
C++
source/plugin/joycon/joycon_manager.cpp
mbenkmann/moltengamepad
7fc91a4ac2dee105745e1a81ca2cbb293be4c4a8
[ "MIT" ]
204
2015-12-25T06:40:16.000Z
2022-03-14T06:27:20.000Z
source/plugin/joycon/joycon_manager.cpp
mbenkmann/moltengamepad
7fc91a4ac2dee105745e1a81ca2cbb293be4c4a8
[ "MIT" ]
96
2016-04-03T23:53:56.000Z
2022-03-06T16:24:38.000Z
source/plugin/joycon/joycon_manager.cpp
mbenkmann/moltengamepad
7fc91a4ac2dee105745e1a81ca2cbb293be4c4a8
[ "MIT" ]
37
2016-01-02T01:04:13.000Z
2022-03-22T19:31:02.000Z
#include "joycon.h" #include <linux/input.h> #include <linux/hidraw.h> #include <sys/ioctl.h> #include <stdio.h> manager_methods joycon_manager::methods; int (*joycon_manager::grab_permissions) (udev_device*, bool); joycon_manager::joycon_manager() { } int joycon_manager::init(device_manager* ref) { this->ref = ref; init_profile(); return 0; } int joycon_manager::start() { return 0; } joycon_manager::~joycon_manager() { //as of now, this is only called as MoltenGamepad exits. //Now would be a good time to tidy any files or sockets. } void joycon_manager::init_profile() { const event_decl* ev = &joycon_events[0]; for (int i = 0; ev->name && *ev->name; ev = &joycon_events[++i]) { methods.register_event(ref, *ev); } //create a convenience function... auto set_alias = [&] (const char* external, const char* internal) { methods.register_alias(ref, external, internal); }; //Init some aliases... set_alias("first","a"); set_alias("second","b"); set_alias("third","x"); set_alias("fourth","y"); set_alias("tr","r"); set_alias("tl","l"); set_alias("mode","home"); set_alias("tr2","zr"); set_alias("tl2","zl"); set_alias("start","plus"); set_alias("select","minus"); methods.register_event_group(ref, {"solo_stick","solo_x,solo_y","Solo JoyCon Stick","stick(left_x,left_y)"}); }; int joycon_manager::accept_device(struct udev* udev, struct udev_device* dev) { const char* subsystem = udev_device_get_subsystem(dev); const char* action = udev_device_get_action(dev); const char* syspath = udev_device_get_syspath(dev); if (!subsystem || strncmp(subsystem,"hidraw",6)) return DEVICE_UNCLAIMED; //check for removal events //This is a bit complicated, as we might remove only one half of a JoyCon partnership. if (action && !strcmp(action,"remove") && syspath) { std::lock_guard<std::mutex> guard(lock); std::string syspath_str(syspath); auto it = joycons.begin(); joycon* jc = nullptr; int foundside = -1; //search list for any joycon with this syspath. //A JoyCon object might represent a partnership, where only one side is being removed... for (it = joycons.begin(); it != joycons.end(); it++) { jc = it->jc; if (jc->path[0] == syspath_str) { close(jc->fds[0]); foundside = 0; break; } else if (jc->path[1] == syspath_str) { close(jc->fds[1]); foundside = 1; break; } } //Did we get a match? if (foundside >= 0) { joycon* remainingside = nullptr; int otherside = 1 - foundside; if (jc->fds[otherside] > 0 && jc->path[otherside] != syspath_str) { //Our match was in a partnership! //Make sure to keep the other joycon around. jc->close_out_fd[otherside] = false; //We are going to delete the partnership. //Treat the remaining joycon as if it was a new device. //(Which fits with our joycon activation logic...) remainingside = new joycon(jc->fds[otherside], -1, jc->sides[otherside], UNKNOWN_JOYCON, jc->path[otherside].c_str(), nullptr, this); } methods.remove_device(ref,jc->ref); joycons.erase(it); if (remainingside) { joycon_info info; info.jc = remainingside; info.active_trigger = false; joycons.push_back(info); methods.add_device(ref,joycon_dev, remainingside); } return DEVICE_CLAIMED; } return DEVICE_UNCLAIMED; } if (action && strncmp(action,"add",3)) { //this is neither an enumeration (action is nullptr) or an add event return DEVICE_UNCLAIMED; } const char* path = udev_device_get_devnode(dev); if (!path) return DEVICE_UNCLAIMED; //try to open it to use some ioctls for info gathering. //Safe to do on unrelated hidraw nodes? //Also catches permission issues... //A bit hackish, and poor error reporting. Perhaps try to identify JoyCon before opening node. int fd = open(path, O_RDWR | O_NONBLOCK); if (fd < 0) return DEVICE_UNCLAIMED; char buffer[256]; memset(buffer,0,256); int res = ioctl(fd, HIDIOCGRAWNAME(256), buffer); if (res < 0) { close(fd); return DEVICE_UNCLAIMED; } JoyConSide side = UNKNOWN_JOYCON; if (!strcmp(buffer,RIGHT_JOYCON_NAME)) side = RIGHT_JOYCON; if (!strcmp(buffer,LEFT_JOYCON_NAME)) side = LEFT_JOYCON; if (side == UNKNOWN_JOYCON) { close(fd); return DEVICE_UNCLAIMED; } std::lock_guard<std::mutex> guard(lock); grab_permissions(dev, true); joycon* new_joycon = new joycon(fd,-1, side, UNKNOWN_JOYCON, syspath, nullptr, this); joycon_info info; info.jc = new_joycon; info.active_trigger = false; joycons.push_back(info); methods.add_device(ref,joycon_dev,new_joycon); return DEVICE_CLAIMED; } int joycon_manager::process_option(const char* name, const MGField value) { return 0; } void joycon_manager::check_partnership(joycon* jc) { if (!jc) return; if (jc->fds[0] > 0 && jc->fds[1] > 0) { //this should not happen... //TODO: Break the pair into two pending separate joycon* } int jc_index = -1; int partner_index = -1; bool do_solo = false; if (jc->active_solo_btns[0]) { do_solo = true; } //search for this jc in our list... for (uint i = 0; i < joycons.size(); i++) { if ( joycons[i].jc == jc) { jc_index = i; joycons[i].active_trigger = jc->active_trigger[0]; if (!jc->active_trigger[0] || do_solo) break; //we are done here... } //skip ones that aren't looking to partner with this one. if ( joycons[i].jc->activated || joycons[i].jc->sides[0] == jc->sides[0]) continue; //For now, don't allow partnering two of the same JoyCon. if (jc->active_trigger[0] && joycons[i].active_trigger) partner_index = i; } if (jc_index < 0) { //not in our list of joycons? } if (do_solo && jc_index >= 0) { jc->mode = SOLO; jc->activated = true; methods.print(ref,"Activating a solo JoyCon"); return; } if (jc_index >= 0 && partner_index >= 0 && jc_index != partner_index) { joycon* partner = joycons[partner_index].jc; if (partner == jc) return; //remove the partner as a separate device, but keep its file descriptors. partner->close_out_fd[0] = false; joycons.erase(joycons.begin() + partner_index); jc->sides[1] = partner->sides[0]; jc->path[1] = partner->path[0]; jc->fds[1] = partner->fds[0]; methods.remove_device(ref,partner->ref); jc->methods.watch_file(jc->ref, jc->fds[1], (void*) 1); jc->mode = PARTNERED; jc->activated = true; methods.print(ref, "Activating two combined JoyCon"); } }
27.979253
141
0.640813
[ "object" ]
a7f21f245910e169a76ad99ab7599030d624b3fb
4,750
cc
C++
src/binding.cc
pingjiang/node-rar
3e85f127cecd5f32a291e560ae51b16159861e22
[ "MIT" ]
17
2015-01-23T00:02:48.000Z
2021-07-24T16:55:03.000Z
src/binding.cc
pingjiang/node-rar
3e85f127cecd5f32a291e560ae51b16159861e22
[ "MIT" ]
3
2015-06-14T20:47:31.000Z
2016-03-08T07:21:06.000Z
src/binding.cc
pingjiang/node-rar
3e85f127cecd5f32a291e560ae51b16159861e22
[ "MIT" ]
7
2015-06-28T15:32:44.000Z
2018-12-17T16:04:41.000Z
#include <node.h> #include <v8.h> #include "rar.hpp" #include <iostream> #ifdef _DEBUG #define _D(msg) do {\ std::cout << __FILE__ << ":" << __LINE__ << ">> " << msg << std::endl;\ } while(0) #else #define _D(msg) #endif // _DEBUG static void reset_RARHeaderDataEx(struct RARHeaderDataEx* s) { memset(s, 0, sizeof(struct RARHeaderDataEx)); } static void reset_RAROpenArchiveDataEx(struct RAROpenArchiveDataEx* s) { memset(s, 0, sizeof(struct RAROpenArchiveDataEx)); } using namespace v8; /// mode: 0 list, 1 extract, 2 list inc split /// op: 0 skip, 1 test, 2 extract int _processArchive(int mode, int op, char* filepath, char* toDir, char* password, Local<Function> cb) { struct RAROpenArchiveDataEx archiveData; reset_RAROpenArchiveDataEx(&archiveData); archiveData.ArcName = filepath; archiveData.OpenMode = mode; HANDLE handler = RAROpenArchiveEx(&archiveData); if (archiveData.OpenResult != ERAR_SUCCESS) { _D("open archive error: " << archiveData.OpenResult); return archiveData.OpenResult; } if (password != NULL) { _D("password: " << password); RARSetPassword(handler, password); } int result = 0; while (result == 0) { struct RARHeaderDataEx entry; reset_RARHeaderDataEx(&entry); result = RARReadHeaderEx(handler, &entry); if (result == 0) { result = RARProcessFile(handler, op, toDir, NULL); } if (result != 0) break; Local<Object> entryObj = Object::New(); entryObj->Set(String::NewSymbol("FileName"), String::New(entry.FileName)); _D("FileName: " << entry.FileName); if (!cb.IsEmpty()) { const unsigned argc = 1; Local<Value> argv[argc] = { entryObj }; cb->Call(Context::GetCurrent()->Global(), argc, argv); } else { _D("cb is empty"); } } if (result == ERAR_END_ARCHIVE) { result = 0; } _D("list archive result: " << result); return result; } Handle<Value> DUMMY(const Arguments& args) { HandleScope scope; return scope.Close(Undefined()); } // processArchive(options, cb) Handle<Value> processArchive(const Arguments& args) { HandleScope scope; if (args.Length() < 1) { ThrowException(Exception::TypeError(String::New("Wrong arguments"))); return scope.Close(Undefined()); } int openMode = 0; bool isTest = false; Local<Object> options = args[0]->IsString() ? Object::New() : args[0]->ToObject(); if (args[0]->IsString()) { options->Set(String::NewSymbol("filepath"), args[0]->ToString()); } Local<Value> openModeValue = options->Get(String::NewSymbol("openMode")); if (openModeValue->IsNumber()) { openMode = openModeValue->NumberValue(); } Local<Value> filepathValue = options->Get(String::NewSymbol("filepath")); if (!filepathValue->IsString()) { ThrowException(Exception::TypeError(String::New("Wrong arguments `filepath`"))); return scope.Close(Undefined()); } String::Utf8Value value(filepathValue); const char* filepathStr = (const char*)*value; char archiveFilePath[2048]; strncpy(archiveFilePath, filepathStr, 2048); Local<Value> passwordValue = options->Get(String::NewSymbol("password")); char passwordBuf[128]; if (passwordValue->IsString()) { String::Utf8Value value1(passwordValue); const char* passwordStr = (const char*)*value1; strncpy(passwordBuf, passwordStr, 128); } Local<Function> cb = (args.Length()> 1 && args[1]->IsFunction()) ? Local<Function>::Cast(args[1]) : FunctionTemplate::New(DUMMY)->GetFunction(); Local<Value> isTestValue = options->Get(String::NewSymbol("test")); if (!isTestValue->IsUndefined()) { isTest = true; } char toDirBuf[1024] = { 0 }; Local<Value> toDirValue = options->Get(String::NewSymbol("toDir")); if (openMode == 1) { if (toDirValue->IsString()) { String::Utf8Value value2(toDirValue); const char* toDirStr = (const char*)*value2; strncpy(toDirBuf, toDirStr, 1024); } else { if (!isTest) { ThrowException(Exception::TypeError(String::New("Wrong arguments `toDir` for extract mode"))); return scope.Close(Undefined()); } } } int ret = _processArchive(openMode, isTest ? 1 : (openMode == 0 ? 0 : 2), archiveFilePath, toDirValue->IsString() ? toDirBuf : NULL, passwordValue->IsString() ? passwordBuf : NULL, cb); if (ret != 0) { ThrowException(Exception::Error(String::New("Process archive error"))); _D("error code is " << ret); } return scope.Close(Undefined()); } void init(Handle<Object> exports) { setlocale(LC_ALL,""); exports->Set(String::NewSymbol("processArchive"), FunctionTemplate::New(processArchive)->GetFunction()); } NODE_MODULE(unrar, init);
30.645161
146
0.653053
[ "object" ]
a7f99cd4ac7802d0ff82acf199f6f2e1aae363bd
454
cpp
C++
Dataset/Leetcode/train/78/274.cpp
kkcookies99/UAST
fff81885aa07901786141a71e5600a08d7cb4868
[ "MIT" ]
null
null
null
Dataset/Leetcode/train/78/274.cpp
kkcookies99/UAST
fff81885aa07901786141a71e5600a08d7cb4868
[ "MIT" ]
null
null
null
Dataset/Leetcode/train/78/274.cpp
kkcookies99/UAST
fff81885aa07901786141a71e5600a08d7cb4868
[ "MIT" ]
null
null
null
class Solution { public: vector<vector<int>> XXX(vector<int>& nums) { vector<vector<int>> result; vector<int> res; int si=nums.size(); for(int i=0;i<(1<<si);i++) { for(int j=0;j<si;j++) { if((1<<j)&i) res.push_back(nums[j]); } result.push_back(res); res.clear(); } return result; } };
20.636364
50
0.398678
[ "vector" ]
a7fee1d9e6e371e71279481c03cc7870712f0916
1,470
cpp
C++
android-29/android/media/Session2CommandGroup_Builder.cpp
YJBeetle/QtAndroidAPI
1468b5dc6eafaf7709f0b00ba1a6ec2b70684266
[ "Apache-2.0" ]
12
2020-03-26T02:38:56.000Z
2022-03-14T08:17:26.000Z
android-31/android/media/Session2CommandGroup_Builder.cpp
YJBeetle/QtAndroidAPI
1468b5dc6eafaf7709f0b00ba1a6ec2b70684266
[ "Apache-2.0" ]
1
2021-01-27T06:07:45.000Z
2021-11-13T19:19:43.000Z
android-30/android/media/Session2CommandGroup_Builder.cpp
YJBeetle/QtAndroidAPI
1468b5dc6eafaf7709f0b00ba1a6ec2b70684266
[ "Apache-2.0" ]
3
2021-02-02T12:34:55.000Z
2022-03-08T07:45:57.000Z
#include "./Session2Command.hpp" #include "./Session2CommandGroup.hpp" #include "./Session2CommandGroup_Builder.hpp" namespace android::media { // Fields // QJniObject forward Session2CommandGroup_Builder::Session2CommandGroup_Builder(QJniObject obj) : JObject(obj) {} // Constructors Session2CommandGroup_Builder::Session2CommandGroup_Builder() : JObject( "android.media.Session2CommandGroup$Builder", "()V" ) {} Session2CommandGroup_Builder::Session2CommandGroup_Builder(android::media::Session2CommandGroup arg0) : JObject( "android.media.Session2CommandGroup$Builder", "(Landroid/media/Session2CommandGroup;)V", arg0.object() ) {} // Methods android::media::Session2CommandGroup_Builder Session2CommandGroup_Builder::addCommand(android::media::Session2Command arg0) const { return callObjectMethod( "addCommand", "(Landroid/media/Session2Command;)Landroid/media/Session2CommandGroup$Builder;", arg0.object() ); } android::media::Session2CommandGroup Session2CommandGroup_Builder::build() const { return callObjectMethod( "build", "()Landroid/media/Session2CommandGroup;" ); } android::media::Session2CommandGroup_Builder Session2CommandGroup_Builder::removeCommand(android::media::Session2Command arg0) const { return callObjectMethod( "removeCommand", "(Landroid/media/Session2Command;)Landroid/media/Session2CommandGroup$Builder;", arg0.object() ); } } // namespace android::media
28.823529
133
0.765306
[ "object" ]
c501507c5f3bfe2a7486719e2d1ff1ee2d3f9872
13,702
hpp
C++
ad_map_access/impl/include/ad/map/match/AdMapMatching.hpp
hulk-mk/map
261e7329afdc56d6f8cfb63285039764b2dc6361
[ "MIT" ]
null
null
null
ad_map_access/impl/include/ad/map/match/AdMapMatching.hpp
hulk-mk/map
261e7329afdc56d6f8cfb63285039764b2dc6361
[ "MIT" ]
null
null
null
ad_map_access/impl/include/ad/map/match/AdMapMatching.hpp
hulk-mk/map
261e7329afdc56d6f8cfb63285039764b2dc6361
[ "MIT" ]
null
null
null
// ----------------- BEGIN LICENSE BLOCK --------------------------------- // // Copyright (C) 2018-2020 Intel Corporation // // SPDX-License-Identifier: MIT // // ----------------- END LICENSE BLOCK ----------------------------------- #pragma once #include <list> #include "ad/map/match/Types.hpp" #include "ad/map/point/Operation.hpp" #include "ad/map/route/Types.hpp" /* @brief namespace admap */ namespace ad { /* @brief namespace map */ namespace map { /* @brief namespace match */ namespace match { /** * @class AdMapMatching * @brief performs map matching of a given point to the map * * In general, there are multiple possible matches for a given point available, * especially if the point is e.g. located within an intersection area. * Therefore, map matching always returns a std::multimap of map matched positions ordered by their probabilities. * * Besides the actual position, there are additional input parameters influencing the probabilistic calculation. * Observed heading or possible routes of a vehicle/object can be provided to influence the map matching result. */ class AdMapMatching { public: /** * @brief default constructor */ AdMapMatching(); /** * @brief destructor */ ~AdMapMatching() = default; /** * @brief set the maximum probability multiplier for heading hints */ void setMaxHeadingHintFactor(double newHeadingHintFactor) { mHeadingHintFactor = std::max(1., newHeadingHintFactor); } /** * @brief get the maximum probability multiplier for heading hints */ double getMaxHeadingHintFactor() const { return mHeadingHintFactor; } /** * @brief set the probability multiplier for valid route hints */ void setRouteHintFactor(double newRouteHintFactor) { mRouteHintFactor = std::max(1., newRouteHintFactor); } /** * @brief get the probability multiplier for valid route hints */ double getRouteHintFactor() const { return mRouteHintFactor; } /** * @brief add a hint for the heading of the vehicle/object * * It is possible to provide hints on the heading of the vehicle/object to be considered on map matching. * This increases the map matching probabilities for lanes with respective direction. * The matches are multiplied with a headingFactor: * 1. <= headingFactor <= getMaxHeadingHintFactor() * * @param[in] headingHint the heading hint of the object/vehicle to consider */ void addHeadingHint(point::ECEFHeading const &headingHint) { mHeadingHints.push_back(headingHint); } /** * @brief add a hint for the heading of the vehicle/object * * It is possible to provide hints on the heading of the vehicle/object to be considered on map matching. * This increases the map matching probabilities for lanes with respective direction. * * @param[in] yaw the yaw of the object/vehicle to consider * @param[in] enuReferencePoint the reference point of the corresponding ENUCoordinate system */ void addHeadingHint(point::ENUHeading const &yaw, point::GeoPoint const &enuReferencePoint) { mHeadingHints.push_back(point::createECEFHeading(yaw, enuReferencePoint)); } /** * @brief clears the list of heading hints */ void clearHeadingHints() { mHeadingHints.clear(); } /** * @brief add a hint for the route of the vehicle/object * * This function allows to provide a hint for the current route of the object. * This increases the map matching probabilities for lanes along the route. * * @param[in] routeHint the route hint to consider */ void addRouteHint(route::FullRoute const &routeHint) { mRouteHints.push_back(routeHint); } /** * @brief clears the list of route hints */ void clearRouteHints() { mRouteHints.clear(); } /** * @brief clears route and heading hints at once */ void clearHints() { clearRouteHints(); clearHeadingHints(); } /** * @brief get the map matched positions * * Calculate the map matched positions and return these. * * @param[in] geoPoint position to match against the map * @param[in] distance search radius around geoPoint to select a lane as a match * @param[in] minProbabilty A probability threshold to be considered for the results. */ MapMatchedPositionConfidenceList getMapMatchedPositions(point::GeoPoint const &geoPoint, physics::Distance const &distance, physics::Probability const &minProbability) const; /** * @brief get the map matched positions * * Calculate the map matched positions and return these. * * @param[in] enuPoint position to match against the map in ENU coordinate frame * @param[in] enuReferencePoint the enu reference point * @param[in] distance search radius around geoPoint to select a lane as a match * @param[in] minProbabilty A probability threshold to be considered for the results. */ MapMatchedPositionConfidenceList getMapMatchedPositions(point::ENUPoint const &enuPoint, point::GeoPoint const &enuReferencePoint, physics::Distance const &distance, physics::Probability const &minProbability) const; /** * @brief get the map matched positions * * Calculate the map matched positions and return these. * * @param[in] enuPoint position to match against the map in ENU coordinate frame * @param[in] distance search radius around geoPoint to select a lane as a match * @param[in] minProbabilty A probability threshold to be considered for the results. * * This function makes use of the globally set ENUReferencePoint * (see AdMapAccess::setENUReferencePoint()) */ MapMatchedPositionConfidenceList getMapMatchedPositions(point::ENUPoint const &enuPoint, physics::Distance const &distance, physics::Probability const &minProbability) const; /** * @brief get the map matched positions * * Calculate the map matched positions and return these. * * @param[in] enuObjectPosition object position, orientation, dimensions and ENRReferencePoint * to match against the map in ENU coordinate frame * @param[in] distance search radius around geoPoint to select a lane as a match * @param[in] minProbabilty A probability threshold to be considered for the results. * * The orientation of the ENUObjectPosition is set as heading hint before matching and cleared afterwards * This function makes use of the ENUReferencePoint of the provided ENUObjectPosition. * The dimensions of the ENUObjectPosition is not required. */ MapMatchedPositionConfidenceList getMapMatchedPositions(ENUObjectPosition const &enuObjectPosition, physics::Distance const &distance, physics::Probability const &minProbability); /** * @brief get the map matched bounding box * * Calculate the map matched bounding box. * This will calculate the map matched positions of all the corner points and the center point * In addition it will calculate all lane regions that are covered by the bounding box by sampling * the objects geometry in between with the provided \c samplingDistance * * @param[in] enuObjectPosition object position, orientation, dimensions and ENRReferencePoint * to match against the map in ENU coordinate frame * @param[in] samplingDistance The step size to be used to perform map matching in between the vehicle boundaries * This parameter is heavily influencing the performance of this function: * A samplingDistance of 0.1 at a car (3x5m) means 1500x map matching. With a distance of 1.0 we get only 15x map * matching. * * @returns the map matched bounding box of the object */ MapMatchedObjectBoundingBox getMapMatchedBoundingBox(ENUObjectPosition const &enuObjectPosition, physics::Distance const &samplingDistance = physics::Distance(1.)) const; /** * @brief get the lane occupied regions from a list of ENUObjectPositionList * * Merge the lane occupied regions of the getMapMatchedBoundingBox() results of all * position entries. See getMapMatchedBoundingBox() for a detailed description. * For a correct handling of the inner borders crossed on matching a bigger object, this function * only works as expected if the the provided enuObjectPositionList covers the whole object. * * @param[in] enuObjectPositionList list of ENUObjectPosition entries * @param[in] samplingDistance The step size to be used to perform map matching in between the vehicle boundaries * A samplingDistance of 0.1 at a car (3x5m) means 1500x map matching. With a distance of 1.0 we get only 15x map * matching. * * @returns the map matched bounding box of the object */ LaneOccupiedRegionList getLaneOccupiedRegions(ENUObjectPositionList enuObjectPositionList, physics::Distance const &samplingDistance = physics::Distance(1.)) const; /** * @brief Method to be called to retrieve the lane heading at a mapMatchedPosition */ point::ENUHeading getLaneENUHeading(MapMatchedPosition const &mapMatchedPosition) const; /** * @brief Spatial Lane Search. * Returns all Lanes where any part of surface is less than specified physics::Distance * from given point. * @param[in] ecefPoint Point that is used as base for the search. * @param[in] distance Search radius. * * This static function doesn't make use of any matching hints. * * @returns Map matching results that satisfy search criteria. */ static MapMatchedPositionConfidenceList findLanes(point::ECEFPoint const &ecefPoint, physics::Distance const &distance); /** * @brief Spatial Lane Search. * Returns all Lanes where any part of surface is less than specified physics::Distance * from given point. * @param[in] geoPoint Point that is used as base for the search. * @param[in] distance Search radius. * * This static function doesn't make use of any matching hints. * * @returns Map matching results that satisfy search criteria. The individual matching result probabilities are equal. */ static MapMatchedPositionConfidenceList findLanes(point::GeoPoint const &geoPoint, physics::Distance const &distance); /** * @brief Spatial Lane Search. * Returns the map matched position in respect to all Lanes of the given route. * @param[in] ecefPoint Point that is used as base for the search. * @param[in] route The route providing the lane subset to be searched. * * This static function doesn't make use of any matching hints. * * @returns The individual matching result probabilities are relative to the actual distance of the matchedPoint to * the queryPoint. */ static MapMatchedPositionConfidenceList findRouteLanes(point::ECEFPoint const &ecefPoint, route::FullRoute const &route); private: // Copy operators and constructors are deleted to avoid accidental copies AdMapMatching(AdMapMatching const &) = delete; AdMapMatching(AdMapMatching &&) = delete; AdMapMatching &operator=(AdMapMatching &&) = delete; AdMapMatching &operator=(AdMapMatching const &) = delete; static match::MapMatchedPositionConfidenceList findLanesInputChecked(point::ECEFPoint const &ecefPoint, physics::Distance const &distance); static match::MapMatchedPositionConfidenceList findLanesInputChecked(std::vector<lane::Lane::ConstPtr> const &relevantLanes, point::ECEFPoint const &ecefPoint, physics::Distance const &distance); static std::vector<lane::Lane::ConstPtr> getRelevantLanesInputChecked(point::ECEFPoint const &ecefPoint, physics::Distance const &distance); /** * @brief extract the mapMatchedPositions and write them into a map of occuppied regions * * @param[in,out] laneOccupiedRegions vector containing the occupied regions * @param[in] mapMatchedPositions */ void addLaneRegions(LaneOccupiedRegionList &laneOccupiedRegions, MapMatchedPositionConfidenceList const &mapMatchedPositions) const; void addLaneRegions(LaneOccupiedRegionList &laneOccupiedRegions, LaneOccupiedRegionList const &otherLaneOccupiedRegions) const; MapMatchedPositionConfidenceList considerMapMatchingHints(MapMatchedPositionConfidenceList const &mapMatchedPositions, physics::Probability const &minProbability) const; bool isLanePartOfRouteHints(lane::LaneId const &laneId) const; double getHeadingFactor(MapMatchedPosition const &matchedPosition) const; std::list<point::ECEFHeading> mHeadingHints; double mHeadingHintFactor{2.}; std::list<route::FullRoute> mRouteHints; double mRouteHintFactor{10.}; }; } // namespace match } // namespace map } // namespace ad
40.418879
120
0.675449
[ "geometry", "object", "vector" ]
c5081819b0b4a5dbdefdb525d38a262c5c3614a5
13,133
cpp
C++
Code en C++ de Mage War Online/Boulder.cpp
Drakandes/Portfolio_NicolasPaulBonneau
c8115d5ecd6c284113766d64d0f907c074315cff
[ "MIT" ]
null
null
null
Code en C++ de Mage War Online/Boulder.cpp
Drakandes/Portfolio_NicolasPaulBonneau
c8115d5ecd6c284113766d64d0f907c074315cff
[ "MIT" ]
null
null
null
Code en C++ de Mage War Online/Boulder.cpp
Drakandes/Portfolio_NicolasPaulBonneau
c8115d5ecd6c284113766d64d0f907c074315cff
[ "MIT" ]
null
null
null
#include "stdafx.h" #include "Boulder.h" Boulder::Boulder() { if (!texture.loadFromFile("Boulder.png")) { std::cout << "Error: Couldn't load Boulder texture" << std::endl; } if (!shadow_texture.loadFromFile("BoulderShadow.png")) { std::cout << "Error while loading Boulder projectile shadow texture" << std::endl; } shadow = GlobalFunction::CreateSprite(sf::Vector2f(0, 0), size_projectile, shadow_texture); listAllSkills = ListObjectsSingleton::instance()->GetListSkill(); } Boulder::~Boulder() { parent.reset(); listAllSkills.clear(); } void Boulder::Texture_loading() { } void Boulder::Init(sf::Vector2f &position_player, float angle_received, float player_damage, std::shared_ptr<Player> player, float speed_modifier) { parent = player; player.reset(); projectile_rotation = angle_received; projectile_position_origin = position_player; projectile = GlobalFunction::CreateSprite(position_player, size_projectile, texture); damage_initial = player_damage; damage = player_damage; touching_projectile = false; projectile.setRotation(projectile_rotation); shadow.setRotation(projectile_rotation); been_init = true; projectile_range = projectile_range * (parent->GetProjectileRangeBonus() / 100 + 1); speed_projectile = speed_projectile*speed_modifier; slow_percent = parent->GetSlowPercentDebuffOnHit(); if (slow_percent > 0) { type_slow = TranquilizerTalentSlow_E; slow_duration = parent->GetSlowDurationDebuffOnHit(); can_slow = true; } stun_duration = parent->GetStunDurationDebuffOnHit(); if (stun_duration > 0) { can_stun = true; } } void Boulder::InitFromSkill(sf::Vector2f &position_player, float player_damage, sf::Vector2f mouse_position, float stun_duration_received, std::shared_ptr<Player> player, float range_modifier, float speed_modifier) { parent = player; player.reset(); stun_duration = stun_duration_received; SetAngles(mouse_position, position_player); projectile_position_origin = position_player; projectile.setPosition(sf::Vector2f(position_player.x, position_player.y)); projectile.setTexture(texture); projectile_animation = 0; projectile.setOrigin(sf::Vector2f(size_projectile.x / 2, size_projectile.y / 2)); damage = player_damage; damage_initial = player_damage; projectile_rotation = projectile_rotation; shadow.setRotation(projectile_rotation); AngleGestion(); init_from_skill = true; touching_projectile = false; projectile.setRotation(projectile_rotation); been_init = true; projectile_range = projectile_range*range_modifier; speed_projectile = speed_projectile*speed_modifier; } void Boulder::SetAngles(sf::Vector2f &mouse_position, sf::Vector2f &position) { #pragma region GetAngle if (mouse_position.x > position.x && mouse_position.y < position.y) { projectile_rotation = 270 + ((((atan((mouse_position.x - position.x) / (position.y - mouse_position.y))) * 180 / PI))); } if (mouse_position.x < position.x && mouse_position.y < position.y) { projectile_rotation = 270 + ((atan((mouse_position.x - position.x) / (position.y - mouse_position.y))) * 180 / PI); } if (mouse_position.x > position.x && mouse_position.y > position.y) { projectile_rotation = (90 - ((atan((mouse_position.x - position.x) / (mouse_position.y - position.y)) * 180 / PI))); } if (mouse_position.x < position.x && mouse_position.y > position.y) { projectile_rotation = (180 - (((atan((position.y - mouse_position.y) / (mouse_position.x - position.x))) * 180 / PI))); } if (mouse_position.x == position.x && mouse_position.y <= position.y) { projectile_rotation = 270; } if (mouse_position.x == position.x && mouse_position.y >= position.y) { projectile_rotation = 90; } if (mouse_position.y == position.y && mouse_position.x >= position.x) { projectile_rotation = 0; } if (mouse_position.y == position.y && mouse_position.x <= position.x) { projectile_rotation = 180; } #pragma endregion GetAngle if (projectile_rotation <= 315 && projectile_rotation >= 225) { projectileDirectionToPlayer = Up; } if (projectile_rotation <= 135 && projectile_rotation >= 45) { projectileDirectionToPlayer = Down; } if ((projectile_rotation <= 45 && projectile_rotation >= 0) || (projectile_rotation >= 315 && projectile_rotation <= 360)) { projectileDirectionToPlayer = Right; } if (projectile_rotation <= 225 && projectile_rotation >= 135) { projectileDirectionToPlayer = Left; } } void Boulder::Update(float DELTATIME, sf::Vector2f player_position) { Movement_of_projectile(DELTATIME); projectile_animation_gestion(); } void Boulder::Movement_of_projectile(float DELTATIME) { projectile.move((cos(projectile_rotation * PI / 180))*speed_projectile*DELTATIME, (sin(projectile_rotation * PI / 180))*speed_projectile*DELTATIME); sf::Vector2f position_2 = GetCurrentPosition(); if (sqrt(((projectile_position_origin.x - position_2.x)*(projectile_position_origin.x - position_2.x)) + ((projectile_position_origin.y - position_2.y)*(projectile_position_origin.y - position_2.y))) >= projectile_range) { if (!init_from_skill) { parent->last_target_id = -3; parent->same_target_hit_time = 0; } is_to_delete = true; } } sf::Vector2f Boulder::GetCurrentPosition() { return projectile.getPosition(); } void Boulder::projectile_animation_gestion() { if (clock_animation_of_projectile.getElapsedTime().asSeconds() >= 0.1) { been_drawed = true; projectile.setTextureRect(sf::IntRect(number_hit * size_projectile.x, 0, size_projectile.x, size_projectile.y)); shadow.setTextureRect(sf::IntRect(number_hit * size_projectile.x, 0, size_projectile.x, size_projectile.y)); clock_animation_of_projectile.restart(); } } sf::Vector2f Boulder::GetSize() { return size_projectile; } int Boulder::GetRayon() { return rayon; } float Boulder::GetDamage() { return damage; } bool Boulder::IsNeedToDelete() { return is_to_delete; } bool Boulder::CheckCollision(sf::FloatRect rect_collision, int id_object, sf::Vector2f position_object) { /*if (GlobalFunction::Check_collision(rayon_1, GetRayon(), position_1, GetCurrentPosition(), size_1, GetSize())) { is_to_delete = true; if (!init_from_skill) { CheckPassiveSkills(id_object); return true; } } return false;*/ if (projectile.getGlobalBounds().intersects(rect_collision)) { is_to_delete = true; if (!init_from_skill) { CheckPassiveSkills(id_object); return true; } } return false; } void Boulder::ChangeProjectileRotation(float angle) { projectile_rotation += angle; } void Boulder::Initialized(int player_id) { id_parent = player_id; } bool Boulder::GetInitStatus() { return been_init; } void Boulder::AngleGestion() { if (projectile_rotation < 0) { projectile_rotation = 360 + projectile_rotation; } else if (projectile_rotation > 360) { projectile_rotation = projectile_rotation - 360; } } void Boulder::Draw(sf::RenderWindow &window) { if (been_drawed) { window.draw(projectile); } } void Boulder::DrawShadow(sf::RenderWindow &window) { if (init_from_skill) { if (been_drawed) { shadow.setPosition(projectile.getPosition() + sf::Vector2f(0, 30)); window.draw(shadow); } } else { shadow.setPosition(projectile.getPosition() + sf::Vector2f(0, 18)); window.draw(shadow); } } sf::Vector2f Boulder::GetCurrentPositionShadow() { return shadow.getPosition() + sf::Vector2f(0, 0); } bool Boulder::CanAffectMonster() { return true; } bool Boulder::CanAffectPlayer() { return false; } bool Boulder::CanStun() { if (init_from_skill || can_stun) { return true; } else { return false; } } float Boulder::GetStunTime() { return stun_duration; } void Boulder::CheckPassiveSkills(int id_entity) { int target_id = parent->last_target_id; if (parent->CheckIfPlayerHasSkill(AccurateShotEnum)) { if (id_entity == target_id) { parent->same_target_hit_time++; damage += damage_initial * parent->same_target_hit_time / 100 * listAllSkills[AccurateShotEnum]->GetPassiveBonusValue(parent->GetLevelSpecificSkill(AccurateShotEnum), parent->GetCurrentClassPlayer(), parent->GetCurrentRuneForSpecificSkill(AccurateShotEnum)); parent->same_target_hit_time++; } else { parent->last_target_id = id_entity; parent->same_target_hit_time = 0; } } if (parent->CheckIfPlayerHasSkill(BurningShotEnum)) { int skill_level = parent->GetLevelSpecificSkill(BurningShotEnum); can_ignite = true; ignition_duration = listAllSkills[BurningShotEnum]->GetPassiveBonusDuration(skill_level, parent->GetCurrentClassPlayer(), parent->GetCurrentRuneForSpecificSkill(BurningShotEnum)); type_ignition = listAllSkills[BurningShotEnum]->GetPassiveBonusType(); ignition_damage = listAllSkills[BurningShotEnum]->GetPassiveBonusValue(skill_level, parent->GetCurrentClassPlayer(), parent->GetCurrentRuneForSpecificSkill(BurningShotEnum)); } } bool Boulder::CanIgnite() { return can_ignite; } int Boulder::GetTypeIgnition() { return type_ignition; } float Boulder::GetIgnitionDuration() { return ignition_duration; } float Boulder::GetIgnitionDamage() { return ignition_damage; } void Boulder::DealWithCollision(std::shared_ptr<CollisionalObject> object_collided) { int type_object = object_collided->GetTypeCollisionalObject(); sf::Vector2f position_self = GetCurrentPosition(); sf::Vector2f position_objet = object_collided->GetCurrentPosition(); sf::Vector2f size_object = object_collided->GetSize(); float armor_penetration = parent->GetArmorPenetrationPercent(); int id_object = object_collided->GetId(); if (CheckIdObject(id_object)) { if (type_object == Player_E) { if (CanAffectPlayer()) { if (!init_from_skill) { if (number_hit == 0) { CheckPassiveSkills(id_object); } } number_hit++; if (number_hit >= 3) { projectile_position_origin = GetCurrentPosition(); damage -= damage*0.33; is_to_delete; } float damage_dealt = object_collided->GotDamaged(GetDamage(), id_parent, armor_penetration); if (CanPush()) { object_collided->GetPushedAway(GetDistancePushing(), StrongPush, position_objet, position_self); } if (CanStun()) { object_collided->ChangeStunTime(GetStunTime()); } if (CanChangeObjectStat()) { for (int i = 0; i < GetNumberObjectStatChange(); i++) { object_collided->GivePlayerChangeStat(GetObjectStatChanging(i), GetObjectStatChangeDuration(i), GetObjectStatChangValue(i)); } } if (CanChangeSkillCooldown()) { object_collided->ChangeASkillCooldown(GetSkillCooldownChanging(), GetNewSkillCooldown()); } if (CanSlow()) { object_collided->GetSlowed(type_slow, GetDurationSlow(), GetPercentSlow()); } } } if (type_object == Monster_E) { if (CanAffectMonster()) { if (!init_from_skill) { if (number_hit == 0) { CheckPassiveSkills(id_object); } } number_hit++; if (number_hit >= 3) { projectile_position_origin = GetCurrentPosition(); damage -= damage*0.33; is_to_delete; } float damage_dealt = object_collided->GotDamaged(GetDamage(), id_parent, armor_penetration); if (init_from_skill) { parent->OnHitGestion(id_object, damage_dealt, type_object, SkillProjectile_E); } else { parent->OnHitGestion(id_object, damage_dealt, type_object, BasicAttackProjectile_E); } TextGenerator::instance()->GenerateOneTextForBlob(position_objet, damage_dealt, size_object, object_collided); if (CanIgnite()) { object_collided->GetIgnited(GetTypeIgnition(), GetIgnitionDuration(), GetIgnitionDamage()); } if (CanPush()) { object_collided->GetPushedAway(GetDistancePushing(), StrongPush, position_objet, position_self); } if (CanSlow()) { object_collided->GetSlowed(type_slow, GetDurationSlow(), GetPercentSlow()); } if (CanStun()) { object_collided->ChangeStunTime(GetStunTime()); } } } if (type_object == NatureObject_E) { if (!object_collided->CheckIfProjectileDisable()) { number_hit++; is_to_delete = true; } } } } void Boulder::PutItBackInQuadtree() { need_to_be_put_in_quadtree = true; } bool Boulder::CheckIfNeedGoBackQuadtree() { bool holder = need_to_be_put_in_quadtree; need_to_be_put_in_quadtree = false; return holder; } bool Boulder::CheckIdObject(int id_object) { bool new_object = true; std::vector<int>::iterator iterator = ListIdObject.begin(); while (iterator != ListIdObject.end()) { if ((*iterator) == id_object) { return false; } iterator++; } if (new_object) { ListIdObject.push_back(id_object); } return true; }
27.190476
262
0.699155
[ "vector" ]
c50ac54a464e5a3e8e987be576923dd2c3444604
6,743
cc
C++
src/libs/jelly/rectangular_binary_matrix.cc
sauloal/cnidaria
fe6f8c8dfed86d39c80f2804a753c05bb2e485b4
[ "MIT" ]
3
2015-11-20T08:44:42.000Z
2016-12-14T01:40:03.000Z
src/libs/jelly/rectangular_binary_matrix.cc
sauloal/cnidaria
fe6f8c8dfed86d39c80f2804a753c05bb2e485b4
[ "MIT" ]
1
2017-09-04T14:04:32.000Z
2020-05-26T19:04:00.000Z
src/libs/jelly/rectangular_binary_matrix.cc
sauloal/cnidaria
fe6f8c8dfed86d39c80f2804a753c05bb2e485b4
[ "MIT" ]
null
null
null
/* This file is part of Jellyfish. Jellyfish 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. Jellyfish 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 Jellyfish. If not, see <http://www.gnu.org/licenses/>. */ #include <new> #include <stdexcept> #include <vector> #include <sstream> #include <assert.h> #include <jellyfish/rectangular_binary_matrix.hpp> uint64_t *jellyfish::RectangularBinaryMatrix::alloc(unsigned int r, unsigned int c) { if(r > (sizeof(uint64_t) * 8) || r == 0 || c == 0) { std::ostringstream err; err << "Invalid matrix size " << r << "x" << c; throw std::out_of_range(err.str()); } void *mem; // Make sure the number of words allocated is a multiple of // 8. Necessary for loop unrolling of vector multiplication size_t alloc_columns = (c / 8 + (c % 8 != 0)) * 8; if(posix_memalign(&mem, sizeof(uint64_t) * 2, alloc_columns * sizeof(uint64_t))) throw std::bad_alloc(); memset(mem, '\0', sizeof(uint64_t) * alloc_columns); return (uint64_t *)mem; } void jellyfish::RectangularBinaryMatrix::init_low_identity() { memset(_columns, '\0', sizeof(uint64_t) * _c); unsigned int row = std::min(_c, _r); unsigned int col = _c - row; _columns[col] = (uint64_t)1 << (row - 1); for(unsigned int i = col + 1; i < _c; ++i) _columns[i] = _columns[i - 1] >> 1; } bool jellyfish::RectangularBinaryMatrix::is_low_identity() { unsigned int row = std::min(_c, _r); unsigned int col = _c - row; for(unsigned int i = 0; i < col; ++i) if(_columns[i]) return false; if(_columns[col] != (uint64_t)1 << (row - 1)) return false; for(unsigned int i = col + 1; i < _c; ++i) if(_columns[i] != _columns[i - 1] >> 1) return false; return true; } jellyfish::RectangularBinaryMatrix jellyfish::RectangularBinaryMatrix::pseudo_multiplication(const jellyfish::RectangularBinaryMatrix &rhs) const { if(_r != rhs._r || _c != rhs._c) throw std::domain_error("Matrices of different size"); RectangularBinaryMatrix res(_r, _c); // v is a vector. The lower part is equal to the given column of rhs // and the high part is the identity matrix. // uint64_t v[nb_words()]; uint64_t *v = new uint64_t[nb_words()]; memset(v, '\0', sizeof(uint64_t) * nb_words()); unsigned int j = nb_words() - 1; v[j] = msb(); const unsigned int row = std::min(_c, _r); const unsigned int col = _c - row; unsigned int i; for(i = 0; i < col; ++i) { // Set the lower part to rhs and do vector multiplication v[0] ^= rhs[i]; res.get(i) = this->times(&v[0]); //res.get(i) = this->times_loop(v); // Zero the lower part and shift the one down the diagonal. v[0] ^= rhs[i]; v[j] >>= 1; if(!v[j]) v[--j] = (uint64_t)1 << (sizeof(uint64_t) * 8 - 1); } // No more identity part to deal with memset(v, '\0', sizeof(uint64_t) * nb_words()); for( ; i < _c; ++i) { v[0] = rhs[i]; res.get(i) = this->times(v); //res.get(i) = this->times_loop(v); } delete[] v; return res; } unsigned int jellyfish::RectangularBinaryMatrix::pseudo_rank() const { unsigned int rank = _c; RectangularBinaryMatrix pivot(*this); // Make the matrix lower triangular. unsigned int srow = std::min(_r, _c); unsigned int scol = _c - srow; uint64_t mask = (uint64_t)1 << (srow - 1); for(unsigned int i = scol; i < _c; ++i, mask >>= 1) { if(!(pivot.get(i) & mask)) { // current column has a 0 in the diagonal. XOR it with another // column to get a 1. unsigned int j; for(j = i + 1; j < _c; ++j) if(pivot.get(j) & mask) break; if(j == _c) { // Did not find one, the matrix is not full rank. rank = i; break; } pivot.get(i) ^= pivot.get(j); } // Zero out every ones on the ith row in the upper part of the // matrix. for(unsigned int j = i + 1; j < _c; ++j) if(pivot.get(j) & mask) pivot.get(j) ^= pivot.get(i); } return rank; } jellyfish::RectangularBinaryMatrix jellyfish::RectangularBinaryMatrix::pseudo_inverse() const { RectangularBinaryMatrix pivot(*this); RectangularBinaryMatrix res(_r, _c); res.init_low_identity(); unsigned int i, j; uint64_t mask; // Do gaussian elimination on the columns and apply the same // operation to res. // Make pivot lower triangular. unsigned int srow = std::min(_r, _c); unsigned int scol = _c - srow; mask = (uint64_t)1 << (srow - 1); for(i = scol; i < _c; ++i, mask >>= 1) { if(!(pivot.get(i) & mask)) { // current column has a 0 in the diagonal. XOR it with another // column to get a 1. unsigned int j; for(j = i + 1; j < _c; ++j) if(pivot.get(j) & mask) break; if(j == _c) throw std::domain_error("Matrix is singular"); pivot.get(i) ^= pivot.get(j); res.get(i) ^= res.get(j); } // Zero out every ones on the ith row in the upper part of the // matrix. for(j = i + 1; j < _c; ++j) { if(pivot.get(j) & mask) { pivot.get(j) ^= pivot.get(i); res.get(j) ^= res.get(i); } } } // Make pivot the lower identity mask = (uint64_t)1 << (srow - 1); for(i = scol; i < _c; ++i, mask >>= 1) { for(j = 0; j < i; ++j) { if(pivot.get(j) & mask) { pivot.get(j) ^= pivot.get(i); res.get(j) ^= res.get(i); } } } return res; } void jellyfish::RectangularBinaryMatrix::print(std::ostream &os) const { uint64_t mask = (uint64_t)1 << (_r - 1); for( ; mask; mask >>= 1) { for(unsigned int j = 0; j < _c; ++j) { os << (mask & _columns[j] ? "1" : "0"); } os << "\n"; } } template<typename T> void jellyfish::RectangularBinaryMatrix::print_vector(std::ostream &os, const T &v) const { uint64_t mask = msb(); for(int i = nb_words() - 1; i >= 0; --i) { for( ; mask; mask >>= 1) os << (v[i] & mask ? "1" : "0"); mask = (uint64_t)1 << (sizeof(uint64_t) * 8 - 1); } os << "\n"; } jellyfish::RectangularBinaryMatrix jellyfish::RectangularBinaryMatrix::randomize_pseudo_inverse(uint64_t (*rng)()) { while(true) { randomize(rng); try { return pseudo_inverse(); } catch(std::domain_error &e) { } } }
31.073733
147
0.598992
[ "vector" ]
c50c1f00e7d60c51bfba0755fb77c4b37b480fa9
1,061
cpp
C++
code/src/main.cpp
Shutter-Island-Team/Shutter-island
c5e7c0b2c60c34055e64104dcbc396b9e1635f33
[ "MIT" ]
4
2016-06-24T09:22:18.000Z
2019-06-13T13:50:53.000Z
code/src/main.cpp
Shutter-Island-Team/Shutter-island
c5e7c0b2c60c34055e64104dcbc396b9e1635f33
[ "MIT" ]
null
null
null
code/src/main.cpp
Shutter-Island-Team/Shutter-island
c5e7c0b2c60c34055e64104dcbc396b9e1635f33
[ "MIT" ]
2
2016-06-10T12:46:17.000Z
2018-10-14T06:37:21.000Z
#include "../include/Viewer.hpp" #include "../include/log.hpp" #include <glm/glm.hpp> #include <iostream> #include <sstream> #include <vector> #include "../include/initialize_scene.hpp" #include "../include/Utils.hpp" int main( int argc, char* argv[] ) { std::srand(std::time(0)); Viewer viewer(1280,720); /* * Parsing the JSon file containing the simulation parameters for the map. */ MapParameters mapParameters("../mapData/MapParameters.json"); /* * Creating the map generator and generating the map. */ MapGenerator mapGenerator(mapParameters, mapParameters.getMapSize()); mapGenerator.compute(); /* Setting the pointer on the "mapGenerator" inside the viewer. */ viewer.setMapGenerator(&mapGenerator); initialize_test_scene(viewer, mapGenerator, mapParameters.getMapSize()); while( viewer.isRunning() ) { viewer.handleEvent(); viewer.animate(); viewer.draw(); viewer.display(); } return EXIT_SUCCESS; }
23.577778
79
0.639962
[ "vector" ]
c50d2994d4bf0782bbff6618b5f1fb2d2186e75e
4,093
cpp
C++
lib/CUDA/vec3d_mult2.cpp
Bensuperpc/BenLib
1708a27e272a54f437cda50b2ca98ed92f03d721
[ "MIT" ]
5
2020-12-02T21:17:14.000Z
2021-05-24T19:57:42.000Z
lib/CUDA/vec3d_mult2.cpp
bensuperpc/BenLib
1708a27e272a54f437cda50b2ca98ed92f03d721
[ "MIT" ]
null
null
null
lib/CUDA/vec3d_mult2.cpp
bensuperpc/BenLib
1708a27e272a54f437cda50b2ca98ed92f03d721
[ "MIT" ]
1
2021-02-28T08:43:46.000Z
2021-02-28T08:43:46.000Z
////////////////////////////////////////////////////////////// // ____ // // | __ ) ___ _ __ ___ _ _ _ __ ___ _ __ _ __ ___ // // | _ \ / _ \ '_ \/ __| | | | '_ \ / _ \ '__| '_ \ / __| // // | |_) | __/ | | \__ \ |_| | |_) | __/ | | |_) | (__ // // |____/ \___|_| |_|___/\__,_| .__/ \___|_| | .__/ \___| // // |_| |_| // ////////////////////////////////////////////////////////////// // // // BenLib, 2021 // // Created: 19, March, 2021 // // Modified: 19, March, 2021 // // file: OpenCL_test.cpp // // Crypto // // Source: https://github.com/Kaixhin/cuda-workshop // // https://forums.developer.nvidia.com/t/double-pointer-allocation/9390 // // https://stackoverflow.com/a/31382775/10152334 // // https://github.com/kberkay/Cuda-Matrix-Multiplication/blob/master/matrix_Multiplication.cu // // https://docs.nvidia.com/cuda/cuda-c-best-practices-guide/index.html#optimize // https://medium.com/gpgpu/multi-gpu-programming-6768eeb42e2c // https://stackoverflow.com/questions/12924155/sending-3d-array-to-cuda-kernel // CPU: ALL // // // ////////////////////////////////////////////////////////////// #include <cstdio> #include <cuda.h> #include <cuda_runtime_api.h> #include <fstream> #include <iomanip> #include <iostream> #include <stdio.h> #include <stdlib.h> #include "cuda_runtime.h" #include "device_launch_parameters.h" inline void GPUassert(cudaError_t code, char *file, int line, bool Abort = true) { if (code != 0) { fprintf(stderr, "GPUassert: %s %s %d\n", cudaGetErrorString(code), file, line); if (Abort) exit(code); } } #define GPUerrchk(ans) \ { \ GPUassert((ans), __FILE__, __LINE__); \ } __global__ void doSmth(int ***a) { for (int i = 0; i < 2; i++) for (int j = 0; j < 2; j++) for (int k = 0; k < 2; k++) a[i][j][k] = i + j + k; } int main() { int ***h_c = (int ***)malloc(2 * sizeof(int **)); for (int i = 0; i < 2; i++) { h_c[i] = (int **)malloc(2 * sizeof(int *)); for (int j = 0; j < 2; j++) GPUerrchk(cudaMalloc((void **)&h_c[i][j], 2 * sizeof(int))); } int ***h_c1 = (int ***)malloc(2 * sizeof(int **)); for (int i = 0; i < 2; i++) { GPUerrchk(cudaMalloc((void ***)&(h_c1[i]), 2 * sizeof(int *))); GPUerrchk(cudaMemcpy(h_c1[i], h_c[i], 2 * sizeof(int *), cudaMemcpyHostToDevice)); } int ***d_c; GPUerrchk(cudaMalloc((void ****)&d_c, 2 * sizeof(int **))); GPUerrchk(cudaMemcpy(d_c, h_c1, 2 * sizeof(int **), cudaMemcpyHostToDevice)); // doSmth<<<1,1>>>(d_c); GPUerrchk(cudaPeekAtLastError()); int res[2][2][2]; for (int i = 0; i < 2; i++) for (int j = 0; j < 2; j++) GPUerrchk(cudaMemcpy(&res[i][j][0], h_c[i][j], 2 * sizeof(int), cudaMemcpyDeviceToHost)); for (int i = 0; i < 2; i++) for (int j = 0; j < 2; j++) for (int k = 0; k < 2; k++) printf("[%d][%d][%d]=%d\n", i, j, k, res[i][j][k]); }
48.152941
160
0.367701
[ "3d" ]
c50f0c166e9bf3f9c2477beabc7cd0f035ea5595
207,868
cc
C++
Implementation/Sparkfun Edge/Applications/SZC_motion_1B6S_3IN/model/multi_motions.cc
DarkSZChao/Big-Little_NN_Strategies
5821765c5ed1a2cbdfe7d9586df7bd36e08fa6fd
[ "MIT" ]
null
null
null
Implementation/Sparkfun Edge/Applications/SZC_motion_1B6S_3IN/model/multi_motions.cc
DarkSZChao/Big-Little_NN_Strategies
5821765c5ed1a2cbdfe7d9586df7bd36e08fa6fd
[ "MIT" ]
null
null
null
Implementation/Sparkfun Edge/Applications/SZC_motion_1B6S_3IN/model/multi_motions.cc
DarkSZChao/Big-Little_NN_Strategies
5821765c5ed1a2cbdfe7d9586df7bd36e08fa6fd
[ "MIT" ]
null
null
null
#include "model.h" // Name of model tflite flatbuffer. const unsigned char multi_motions_model_tflite_name[] = {"model"}; // Model data tflite flatbuffer. const unsigned char multi_motions_model_tflite[] = { 0x1c, 0x00, 0x00, 0x00, 0x54, 0x46, 0x4c, 0x33, 0x00, 0x00, 0x12, 0x00, 0x1c, 0x00, 0x04, 0x00, 0x08, 0x00, 0x0c, 0x00, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x18, 0x00, 0x12, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x34, 0x81, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x9c, 0x05, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x70, 0x05, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x54, 0x4f, 0x43, 0x4f, 0x20, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x74, 0x65, 0x64, 0x2e, 0x00, 0x87, 0x00, 0x00, 0x00, 0x3c, 0x05, 0x00, 0x00, 0x30, 0x05, 0x00, 0x00, 0x24, 0x05, 0x00, 0x00, 0x18, 0x05, 0x00, 0x00, 0x0c, 0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0xf4, 0x04, 0x00, 0x00, 0xe8, 0x04, 0x00, 0x00, 0xdc, 0x04, 0x00, 0x00, 0xd0, 0x04, 0x00, 0x00, 0xc4, 0x04, 0x00, 0x00, 0xb8, 0x04, 0x00, 0x00, 0xac, 0x04, 0x00, 0x00, 0xa0, 0x04, 0x00, 0x00, 0x94, 0x04, 0x00, 0x00, 0x88, 0x04, 0x00, 0x00, 0x7c, 0x04, 0x00, 0x00, 0x70, 0x04, 0x00, 0x00, 0x64, 0x04, 0x00, 0x00, 0x58, 0x04, 0x00, 0x00, 0x4c, 0x04, 0x00, 0x00, 0x40, 0x04, 0x00, 0x00, 0x34, 0x04, 0x00, 0x00, 0x28, 0x04, 0x00, 0x00, 0x1c, 0x04, 0x00, 0x00, 0x10, 0x04, 0x00, 0x00, 0x04, 0x04, 0x00, 0x00, 0xf8, 0x03, 0x00, 0x00, 0xec, 0x03, 0x00, 0x00, 0xe0, 0x03, 0x00, 0x00, 0xd4, 0x03, 0x00, 0x00, 0xc8, 0x03, 0x00, 0x00, 0xbc, 0x03, 0x00, 0x00, 0xb0, 0x03, 0x00, 0x00, 0xa4, 0x03, 0x00, 0x00, 0x9c, 0x03, 0x00, 0x00, 0x94, 0x03, 0x00, 0x00, 0x88, 0x03, 0x00, 0x00, 0x7c, 0x03, 0x00, 0x00, 0x70, 0x03, 0x00, 0x00, 0x64, 0x03, 0x00, 0x00, 0x58, 0x03, 0x00, 0x00, 0x4c, 0x03, 0x00, 0x00, 0x44, 0x03, 0x00, 0x00, 0x3c, 0x03, 0x00, 0x00, 0x30, 0x03, 0x00, 0x00, 0x24, 0x03, 0x00, 0x00, 0x18, 0x03, 0x00, 0x00, 0x0c, 0x03, 0x00, 0x00, 0x04, 0x03, 0x00, 0x00, 0xfc, 0x02, 0x00, 0x00, 0xf0, 0x02, 0x00, 0x00, 0xe8, 0x02, 0x00, 0x00, 0xdc, 0x02, 0x00, 0x00, 0xd4, 0x02, 0x00, 0x00, 0xcc, 0x02, 0x00, 0x00, 0xc0, 0x02, 0x00, 0x00, 0xb8, 0x02, 0x00, 0x00, 0xb0, 0x02, 0x00, 0x00, 0xa8, 0x02, 0x00, 0x00, 0xa0, 0x02, 0x00, 0x00, 0x98, 0x02, 0x00, 0x00, 0x90, 0x02, 0x00, 0x00, 0x88, 0x02, 0x00, 0x00, 0x7c, 0x02, 0x00, 0x00, 0x74, 0x02, 0x00, 0x00, 0x6c, 0x02, 0x00, 0x00, 0x64, 0x02, 0x00, 0x00, 0x5c, 0x02, 0x00, 0x00, 0x54, 0x02, 0x00, 0x00, 0x4c, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x38, 0x02, 0x00, 0x00, 0x30, 0x02, 0x00, 0x00, 0x28, 0x02, 0x00, 0x00, 0x20, 0x02, 0x00, 0x00, 0x18, 0x02, 0x00, 0x00, 0x10, 0x02, 0x00, 0x00, 0x04, 0x02, 0x00, 0x00, 0xfc, 0x01, 0x00, 0x00, 0xf4, 0x01, 0x00, 0x00, 0xec, 0x01, 0x00, 0x00, 0xe0, 0x01, 0x00, 0x00, 0xd8, 0x01, 0x00, 0x00, 0xd0, 0x01, 0x00, 0x00, 0xc8, 0x01, 0x00, 0x00, 0xbc, 0x01, 0x00, 0x00, 0xb4, 0x01, 0x00, 0x00, 0xa8, 0x01, 0x00, 0x00, 0xa0, 0x01, 0x00, 0x00, 0x94, 0x01, 0x00, 0x00, 0x8c, 0x01, 0x00, 0x00, 0x84, 0x01, 0x00, 0x00, 0x7c, 0x01, 0x00, 0x00, 0x74, 0x01, 0x00, 0x00, 0x6c, 0x01, 0x00, 0x00, 0x64, 0x01, 0x00, 0x00, 0x5c, 0x01, 0x00, 0x00, 0x54, 0x01, 0x00, 0x00, 0x4c, 0x01, 0x00, 0x00, 0x44, 0x01, 0x00, 0x00, 0x3c, 0x01, 0x00, 0x00, 0x34, 0x01, 0x00, 0x00, 0x2c, 0x01, 0x00, 0x00, 0x24, 0x01, 0x00, 0x00, 0x1c, 0x01, 0x00, 0x00, 0x10, 0x01, 0x00, 0x00, 0x04, 0x01, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, 0xf4, 0x00, 0x00, 0x00, 0xe8, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0xd4, 0x00, 0x00, 0x00, 0xcc, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0xb8, 0x00, 0x00, 0x00, 0xb0, 0x00, 0x00, 0x00, 0xa8, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x94, 0x00, 0x00, 0x00, 0x8c, 0x00, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x46, 0x81, 0xff, 0xff, 0x20, 0x03, 0x00, 0x00, 0x28, 0x94, 0xff, 0xff, 0x2c, 0x94, 0xff, 0xff, 0x30, 0x94, 0xff, 0xff, 0x5a, 0x81, 0xff, 0xff, 0x64, 0x07, 0x00, 0x00, 0x3c, 0x94, 0xff, 0xff, 0x66, 0x81, 0xff, 0xff, 0x78, 0x08, 0x00, 0x00, 0x48, 0x94, 0xff, 0xff, 0x72, 0x81, 0xff, 0xff, 0x00, 0x0b, 0x00, 0x00, 0x54, 0x94, 0xff, 0xff, 0x7e, 0x81, 0xff, 0xff, 0x64, 0x0c, 0x00, 0x00, 0x86, 0x81, 0xff, 0xff, 0xec, 0x0f, 0x00, 0x00, 0x68, 0x94, 0xff, 0xff, 0x6c, 0x94, 0xff, 0xff, 0x70, 0x94, 0xff, 0xff, 0x9a, 0x81, 0xff, 0xff, 0xcc, 0x11, 0x00, 0x00, 0x7c, 0x94, 0xff, 0xff, 0x80, 0x94, 0xff, 0xff, 0x84, 0x94, 0xff, 0xff, 0x88, 0x94, 0xff, 0xff, 0xb2, 0x81, 0xff, 0xff, 0x70, 0x14, 0x00, 0x00, 0x94, 0x94, 0xff, 0xff, 0xbe, 0x81, 0xff, 0xff, 0x70, 0x15, 0x00, 0x00, 0xa0, 0x94, 0xff, 0xff, 0xca, 0x81, 0xff, 0xff, 0x50, 0x16, 0x00, 0x00, 0xac, 0x94, 0xff, 0xff, 0xb0, 0x94, 0xff, 0xff, 0xda, 0x81, 0xff, 0xff, 0xb0, 0x17, 0x00, 0x00, 0xe2, 0x81, 0xff, 0xff, 0x0c, 0x18, 0x00, 0x00, 0xc4, 0x94, 0xff, 0xff, 0xc8, 0x94, 0xff, 0xff, 0xcc, 0x94, 0xff, 0xff, 0xd0, 0x94, 0xff, 0xff, 0xd4, 0x94, 0xff, 0xff, 0xd8, 0x94, 0xff, 0xff, 0xdc, 0x94, 0xff, 0xff, 0xe0, 0x94, 0xff, 0xff, 0xe4, 0x94, 0xff, 0xff, 0xe8, 0x94, 0xff, 0xff, 0xec, 0x94, 0xff, 0xff, 0xf0, 0x94, 0xff, 0xff, 0xf4, 0x94, 0xff, 0xff, 0xf8, 0x94, 0xff, 0xff, 0xfc, 0x94, 0xff, 0xff, 0x26, 0x82, 0xff, 0xff, 0xf8, 0x1f, 0x00, 0x00, 0x08, 0x95, 0xff, 0xff, 0x32, 0x82, 0xff, 0xff, 0x3c, 0x21, 0x00, 0x00, 0x14, 0x95, 0xff, 0xff, 0x3e, 0x82, 0xff, 0xff, 0x58, 0x22, 0x00, 0x00, 0x20, 0x95, 0xff, 0xff, 0x24, 0x95, 0xff, 0xff, 0x28, 0x95, 0xff, 0xff, 0x52, 0x82, 0xff, 0xff, 0x18, 0x24, 0x00, 0x00, 0x34, 0x95, 0xff, 0xff, 0x38, 0x95, 0xff, 0xff, 0x3c, 0x95, 0xff, 0xff, 0x66, 0x82, 0xff, 0xff, 0x08, 0x26, 0x00, 0x00, 0x48, 0x95, 0xff, 0xff, 0x4c, 0x95, 0xff, 0xff, 0x50, 0x95, 0xff, 0xff, 0x54, 0x95, 0xff, 0xff, 0x58, 0x95, 0xff, 0xff, 0x5c, 0x95, 0xff, 0xff, 0x86, 0x82, 0xff, 0xff, 0xa8, 0x29, 0x00, 0x00, 0x68, 0x95, 0xff, 0xff, 0x6c, 0x95, 0xff, 0xff, 0x70, 0x95, 0xff, 0xff, 0x74, 0x95, 0xff, 0xff, 0x78, 0x95, 0xff, 0xff, 0x7c, 0x95, 0xff, 0xff, 0xa6, 0x82, 0xff, 0xff, 0x14, 0x2d, 0x00, 0x00, 0x88, 0x95, 0xff, 0xff, 0x8c, 0x95, 0xff, 0xff, 0x90, 0x95, 0xff, 0xff, 0x94, 0x95, 0xff, 0xff, 0x98, 0x95, 0xff, 0xff, 0x9c, 0x95, 0xff, 0xff, 0xa0, 0x95, 0xff, 0xff, 0xca, 0x82, 0xff, 0xff, 0xf8, 0x30, 0x00, 0x00, 0xac, 0x95, 0xff, 0xff, 0xb0, 0x95, 0xff, 0xff, 0xda, 0x82, 0xff, 0xff, 0x44, 0x32, 0x00, 0x00, 0xbc, 0x95, 0xff, 0xff, 0xe6, 0x82, 0xff, 0xff, 0x18, 0x33, 0x00, 0x00, 0xc8, 0x95, 0xff, 0xff, 0xcc, 0x95, 0xff, 0xff, 0xf6, 0x82, 0xff, 0xff, 0x80, 0x34, 0x00, 0x00, 0xfe, 0x82, 0xff, 0xff, 0xec, 0x34, 0x00, 0x00, 0x06, 0x83, 0xff, 0xff, 0x38, 0x35, 0x00, 0x00, 0x0e, 0x83, 0xff, 0xff, 0x7c, 0x35, 0x00, 0x00, 0xf0, 0x95, 0xff, 0xff, 0xf4, 0x95, 0xff, 0xff, 0x1e, 0x83, 0xff, 0xff, 0xb0, 0x36, 0x00, 0x00, 0x26, 0x83, 0xff, 0xff, 0x1c, 0x37, 0x00, 0x00, 0x2e, 0x83, 0xff, 0xff, 0xa8, 0x37, 0x00, 0x00, 0x36, 0x83, 0xff, 0xff, 0x04, 0x38, 0x00, 0x00, 0x3e, 0x83, 0xff, 0xff, 0x9c, 0x38, 0x00, 0x00, 0x46, 0x83, 0xff, 0xff, 0x18, 0x39, 0x00, 0x00, 0x28, 0x96, 0xff, 0xff, 0x2c, 0x96, 0xff, 0xff, 0x56, 0x83, 0xff, 0xff, 0x90, 0x3a, 0x00, 0x00, 0x5e, 0x83, 0xff, 0xff, 0x48, 0x3b, 0x00, 0x00, 0x66, 0x83, 0xff, 0xff, 0xc4, 0x3b, 0x00, 0x00, 0x6e, 0x83, 0xff, 0xff, 0x6c, 0x3c, 0x00, 0x00, 0x76, 0x83, 0xff, 0xff, 0x74, 0x3e, 0x00, 0x00, 0x7e, 0x83, 0xff, 0xff, 0x78, 0x40, 0x00, 0x00, 0x86, 0x83, 0xff, 0xff, 0xd4, 0x46, 0x00, 0x00, 0x8e, 0x83, 0xff, 0xff, 0xd8, 0x47, 0x00, 0x00, 0x96, 0x83, 0xff, 0xff, 0x34, 0x4e, 0x00, 0x00, 0x9e, 0x83, 0xff, 0xff, 0x38, 0x4f, 0x00, 0x00, 0xa6, 0x83, 0xff, 0xff, 0x94, 0x55, 0x00, 0x00, 0xae, 0x83, 0xff, 0xff, 0x98, 0x56, 0x00, 0x00, 0xb6, 0x83, 0xff, 0xff, 0xf4, 0x59, 0x00, 0x00, 0xbe, 0x83, 0xff, 0xff, 0x98, 0x5a, 0x00, 0x00, 0xc6, 0x83, 0xff, 0xff, 0xf0, 0x5d, 0x00, 0x00, 0xce, 0x83, 0xff, 0xff, 0x98, 0x5e, 0x00, 0x00, 0xd6, 0x83, 0xff, 0xff, 0x40, 0x61, 0x00, 0x00, 0xde, 0x83, 0xff, 0xff, 0xa0, 0x61, 0x00, 0x00, 0xe6, 0x83, 0xff, 0xff, 0xfc, 0x61, 0x00, 0x00, 0xee, 0x83, 0xff, 0xff, 0x58, 0x62, 0x00, 0x00, 0xf6, 0x83, 0xff, 0xff, 0xb4, 0x62, 0x00, 0x00, 0xfe, 0x83, 0xff, 0xff, 0x10, 0x63, 0x00, 0x00, 0x06, 0x84, 0xff, 0xff, 0x6c, 0x63, 0x00, 0x00, 0x0e, 0x84, 0xff, 0xff, 0xc8, 0x63, 0x00, 0x00, 0x16, 0x84, 0xff, 0xff, 0x24, 0x64, 0x00, 0x00, 0x1e, 0x84, 0xff, 0xff, 0x80, 0x64, 0x00, 0x00, 0x26, 0x84, 0xff, 0xff, 0xdc, 0x64, 0x00, 0x00, 0x2e, 0x84, 0xff, 0xff, 0x38, 0x65, 0x00, 0x00, 0x36, 0x84, 0xff, 0xff, 0x94, 0x65, 0x00, 0x00, 0x3e, 0x84, 0xff, 0xff, 0xf0, 0x65, 0x00, 0x00, 0x46, 0x84, 0xff, 0xff, 0x4c, 0x66, 0x00, 0x00, 0x4e, 0x84, 0xff, 0xff, 0xa8, 0x66, 0x00, 0x00, 0x56, 0x84, 0xff, 0xff, 0x04, 0x67, 0x00, 0x00, 0x5e, 0x84, 0xff, 0xff, 0x70, 0x67, 0x00, 0x00, 0x40, 0x97, 0xff, 0xff, 0x05, 0x00, 0x00, 0x00, 0x31, 0x2e, 0x35, 0x2e, 0x30, 0x00, 0x00, 0x00, 0x08, 0x00, 0x0c, 0x00, 0x04, 0x00, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x86, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x6d, 0x69, 0x6e, 0x5f, 0x72, 0x75, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x00, 0x7c, 0xa2, 0xff, 0xff, 0x28, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x34, 0x67, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x82, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x81, 0x00, 0x00, 0x00, 0x85, 0x00, 0x00, 0x00, 0xdc, 0x1f, 0x00, 0x00, 0xa0, 0x37, 0x00, 0x00, 0xc4, 0x19, 0x00, 0x00, 0xa8, 0x34, 0x00, 0x00, 0xbc, 0x10, 0x00, 0x00, 0x7c, 0x2a, 0x00, 0x00, 0x2c, 0x19, 0x00, 0x00, 0x70, 0x61, 0x00, 0x00, 0x70, 0x38, 0x00, 0x00, 0x3c, 0x13, 0x00, 0x00, 0x54, 0x39, 0x00, 0x00, 0xec, 0x37, 0x00, 0x00, 0x7c, 0x0e, 0x00, 0x00, 0xe8, 0x35, 0x00, 0x00, 0xe0, 0x0b, 0x00, 0x00, 0xf8, 0x36, 0x00, 0x00, 0x54, 0x06, 0x00, 0x00, 0x9c, 0x30, 0x00, 0x00, 0xd0, 0x06, 0x00, 0x00, 0x18, 0x1b, 0x00, 0x00, 0xfc, 0x31, 0x00, 0x00, 0x20, 0x25, 0x00, 0x00, 0x28, 0x63, 0x00, 0x00, 0x34, 0x3c, 0x00, 0x00, 0x1c, 0x26, 0x00, 0x00, 0xb0, 0x34, 0x00, 0x00, 0x24, 0x29, 0x00, 0x00, 0xdc, 0x63, 0x00, 0x00, 0x10, 0x4d, 0x00, 0x00, 0xc0, 0x0e, 0x00, 0x00, 0x94, 0x53, 0x00, 0x00, 0x20, 0x2d, 0x00, 0x00, 0x58, 0x65, 0x00, 0x00, 0x7c, 0x58, 0x00, 0x00, 0x04, 0x2f, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x2c, 0x22, 0x00, 0x00, 0x88, 0x62, 0x00, 0x00, 0xe8, 0x39, 0x00, 0x00, 0xb4, 0x1f, 0x00, 0x00, 0xa4, 0x22, 0x00, 0x00, 0x40, 0x13, 0x00, 0x00, 0x54, 0x12, 0x00, 0x00, 0xf4, 0x3d, 0x00, 0x00, 0x10, 0x18, 0x00, 0x00, 0x78, 0x44, 0x00, 0x00, 0xd4, 0x2b, 0x00, 0x00, 0x10, 0x32, 0x00, 0x00, 0x30, 0x54, 0x00, 0x00, 0x5c, 0x2d, 0x00, 0x00, 0x3c, 0x11, 0x00, 0x00, 0x84, 0x0c, 0x00, 0x00, 0x5c, 0x15, 0x00, 0x00, 0xe4, 0x34, 0x00, 0x00, 0xa8, 0x35, 0x00, 0x00, 0x28, 0x26, 0x00, 0x00, 0x64, 0x0f, 0x00, 0x00, 0xec, 0x13, 0x00, 0x00, 0x30, 0x1d, 0x00, 0x00, 0xc4, 0x20, 0x00, 0x00, 0x0c, 0x39, 0x00, 0x00, 0x40, 0x21, 0x00, 0x00, 0x50, 0x0d, 0x00, 0x00, 0x8c, 0x03, 0x00, 0x00, 0xf8, 0x24, 0x00, 0x00, 0xf0, 0x1b, 0x00, 0x00, 0xfc, 0x27, 0x00, 0x00, 0x40, 0x20, 0x00, 0x00, 0x00, 0x45, 0x00, 0x00, 0xfc, 0x28, 0x00, 0x00, 0x84, 0x4b, 0x00, 0x00, 0xf8, 0x2b, 0x00, 0x00, 0x54, 0x64, 0x00, 0x00, 0x64, 0x07, 0x00, 0x00, 0xe0, 0x2d, 0x00, 0x00, 0x50, 0x57, 0x00, 0x00, 0x98, 0x32, 0x00, 0x00, 0xfc, 0x31, 0x00, 0x00, 0xcc, 0x1d, 0x00, 0x00, 0xd4, 0x2e, 0x00, 0x00, 0x94, 0x1f, 0x00, 0x00, 0x38, 0x32, 0x00, 0x00, 0x94, 0x19, 0x00, 0x00, 0x18, 0x5f, 0x00, 0x00, 0x48, 0x01, 0x00, 0x00, 0x40, 0x1c, 0x00, 0x00, 0x98, 0x60, 0x00, 0x00, 0x94, 0x23, 0x00, 0x00, 0xbc, 0x01, 0x00, 0x00, 0xc4, 0x5f, 0x00, 0x00, 0xac, 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x48, 0x61, 0x00, 0x00, 0x40, 0x15, 0x00, 0x00, 0x84, 0x26, 0x00, 0x00, 0xf0, 0x12, 0x00, 0x00, 0x4c, 0x0b, 0x00, 0x00, 0xf8, 0x0f, 0x00, 0x00, 0xf0, 0x1d, 0x00, 0x00, 0x78, 0x2a, 0x00, 0x00, 0xb4, 0x2f, 0x00, 0x00, 0x1c, 0x65, 0x00, 0x00, 0x2c, 0x16, 0x00, 0x00, 0xd8, 0x25, 0x00, 0x00, 0x44, 0x62, 0x00, 0x00, 0xcc, 0x1a, 0x00, 0x00, 0x44, 0x1a, 0x00, 0x00, 0x00, 0x63, 0x00, 0x00, 0x50, 0x29, 0x00, 0x00, 0x50, 0x02, 0x00, 0x00, 0xec, 0x2c, 0x00, 0x00, 0xc4, 0x26, 0x00, 0x00, 0xfc, 0x0d, 0x00, 0x00, 0x00, 0x5f, 0x00, 0x00, 0xe0, 0x13, 0x00, 0x00, 0x18, 0x22, 0x00, 0x00, 0x84, 0x60, 0x00, 0x00, 0xf4, 0x0b, 0x00, 0x00, 0x64, 0x15, 0x00, 0x00, 0xc4, 0x01, 0x00, 0x00, 0x28, 0x06, 0x00, 0x00, 0x70, 0x18, 0x00, 0x00, 0x28, 0x63, 0x00, 0x00, 0x94, 0x29, 0x00, 0x00, 0x6c, 0x2e, 0x00, 0x00, 0x48, 0x64, 0x00, 0x00, 0xd0, 0x2f, 0x00, 0x00, 0x50, 0x16, 0x00, 0x00, 0x34, 0x13, 0x00, 0x00, 0x80, 0x10, 0x00, 0x00, 0x30, 0x32, 0x00, 0x00, 0xd0, 0x5d, 0x00, 0x00, 0xfc, 0x5a, 0x00, 0x00, 0x72, 0x9b, 0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0x10, 0x00, 0x00, 0x00, 0x85, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x78, 0x5f, 0x70, 0x6f, 0x6f, 0x6c, 0x69, 0x6e, 0x67, 0x31, 0x64, 0x5f, 0x31, 0x30, 0x2f, 0x4d, 0x61, 0x78, 0x50, 0x6f, 0x6f, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x0c, 0xa5, 0xff, 0xff, 0x2c, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x43, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf6, 0x9b, 0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0x10, 0x00, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x78, 0x5f, 0x70, 0x6f, 0x6f, 0x6c, 0x69, 0x6e, 0x67, 0x31, 0x64, 0x2f, 0x4d, 0x61, 0x78, 0x50, 0x6f, 0x6f, 0x6c, 0x00, 0x00, 0x00, 0x8c, 0xa5, 0xff, 0xff, 0x30, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x43, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7a, 0x9c, 0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0x10, 0x00, 0x00, 0x00, 0x83, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x78, 0x5f, 0x70, 0x6f, 0x6f, 0x6c, 0x69, 0x6e, 0x67, 0x31, 0x64, 0x5f, 0x31, 0x30, 0x2f, 0x45, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x44, 0x69, 0x6d, 0x73, 0x00, 0x14, 0xa6, 0xff, 0xff, 0x2c, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x43, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x9c, 0xff, 0xff, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x00, 0x00, 0x82, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x78, 0x5f, 0x70, 0x6f, 0x6f, 0x6c, 0x69, 0x6e, 0x67, 0x31, 0x64, 0x5f, 0x37, 0x2f, 0x45, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x44, 0x69, 0x6d, 0x73, 0x2f, 0x64, 0x69, 0x6d, 0x5f, 0x30, 0x00, 0x00, 0x00, 0x00, 0x98, 0x9b, 0xff, 0xff, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x62, 0x9d, 0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0x10, 0x00, 0x00, 0x00, 0x81, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x78, 0x5f, 0x70, 0x6f, 0x6f, 0x6c, 0x69, 0x6e, 0x67, 0x31, 0x64, 0x5f, 0x34, 0x2f, 0x45, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x44, 0x69, 0x6d, 0x73, 0x00, 0x00, 0xfc, 0xa6, 0xff, 0xff, 0x2c, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x43, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe6, 0x9d, 0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0x10, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x5f, 0x37, 0x2f, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x2f, 0x45, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x44, 0x69, 0x6d, 0x73, 0x5f, 0x31, 0x00, 0x00, 0x00, 0x00, 0x84, 0xa7, 0xff, 0xff, 0x2c, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x82, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x83, 0x95, 0xa6, 0x3b, 0x01, 0x00, 0x00, 0x00, 0xbc, 0x28, 0x23, 0x3f, 0x01, 0x00, 0x00, 0x00, 0x1f, 0xb5, 0x28, 0xbf, 0x80, 0x01, 0x00, 0x00, 0x92, 0x4b, 0xb3, 0x65, 0x5a, 0x5b, 0x52, 0xb1, 0x9c, 0x55, 0x83, 0x61, 0x99, 0x47, 0x91, 0x69, 0x64, 0xaf, 0x54, 0x73, 0xaa, 0x68, 0xa3, 0x65, 0x86, 0x89, 0x56, 0xaa, 0x6e, 0xa1, 0x9e, 0xc0, 0x6f, 0x53, 0x30, 0x44, 0x5e, 0x98, 0x5b, 0x8c, 0x4b, 0xa6, 0x6c, 0x92, 0x78, 0x96, 0x54, 0x9e, 0x5e, 0xaa, 0xa1, 0xb3, 0xab, 0x7b, 0xce, 0xc0, 0x91, 0xac, 0xa4, 0x32, 0xa0, 0x56, 0x80, 0x8f, 0x5f, 0xaf, 0x6b, 0x3d, 0x53, 0x18, 0x38, 0x53, 0xcb, 0xff, 0xa6, 0x4e, 0xac, 0x2a, 0x8e, 0x78, 0x5b, 0x67, 0x34, 0x8b, 0x50, 0x9b, 0x52, 0x78, 0x6c, 0x40, 0x58, 0x9f, 0x87, 0xbc, 0x69, 0xb7, 0x74, 0x8e, 0xbe, 0x76, 0xcc, 0xa8, 0x6c, 0xc8, 0x94, 0x26, 0xbd, 0x5c, 0x8f, 0x94, 0x54, 0x7e, 0x88, 0x91, 0x67, 0x7d, 0x55, 0x3a, 0x8b, 0x5d, 0x63, 0xee, 0x81, 0x4d, 0xa0, 0x52, 0x9a, 0x9d, 0xc0, 0x76, 0x8c, 0xcd, 0x62, 0x4d, 0xdc, 0xb2, 0xad, 0x61, 0x8d, 0xb8, 0xdd, 0x79, 0x8d, 0x8f, 0xc7, 0x56, 0x7c, 0x8a, 0x4d, 0x67, 0x6b, 0x42, 0x94, 0x72, 0x7f, 0x3f, 0xd0, 0x76, 0x97, 0x2b, 0x8b, 0xa9, 0x69, 0xd4, 0x9b, 0x86, 0xb8, 0x9d, 0x76, 0xa3, 0x8a, 0x86, 0xdb, 0x49, 0x84, 0x4a, 0x73, 0x78, 0x9e, 0x57, 0x5a, 0x80, 0x42, 0x9b, 0xa9, 0xaf, 0x81, 0xa4, 0x38, 0xa5, 0x98, 0x98, 0x47, 0x4c, 0x52, 0x94, 0x27, 0x76, 0x8d, 0x85, 0x9b, 0x6b, 0xc0, 0x4f, 0x94, 0x8b, 0xbc, 0x4a, 0x96, 0xa9, 0xdb, 0x5a, 0xa0, 0x76, 0xc3, 0x87, 0xb3, 0x6f, 0x80, 0x92, 0xbc, 0xb4, 0xaf, 0x65, 0x53, 0x5b, 0x51, 0x6f, 0x30, 0x3b, 0x7f, 0x77, 0x9d, 0x58, 0x93, 0x97, 0x56, 0xa9, 0xad, 0x82, 0xa0, 0x40, 0x90, 0x89, 0xae, 0x5d, 0x51, 0x67, 0xc0, 0xac, 0xa2, 0xb8, 0x87, 0x64, 0x82, 0x5d, 0x5d, 0x89, 0x9d, 0x9d, 0x59, 0x43, 0x52, 0x45, 0xb5, 0x9d, 0xb7, 0x9a, 0x5e, 0x4c, 0x71, 0x98, 0x7f, 0x76, 0x6f, 0x52, 0xbf, 0x94, 0xdb, 0x46, 0x4c, 0xa1, 0x5d, 0x91, 0x3d, 0xb3, 0x92, 0x96, 0xa7, 0xbf, 0xa1, 0x8a, 0x72, 0x71, 0x49, 0x5f, 0xbf, 0xa5, 0x92, 0x81, 0x85, 0x51, 0xa0, 0x4f, 0xa1, 0x49, 0xcd, 0x5d, 0xd1, 0x93, 0xb8, 0xb4, 0x79, 0x42, 0x7d, 0x9e, 0x8f, 0x2e, 0x3b, 0x64, 0x8c, 0xc1, 0xa8, 0x86, 0x72, 0xa1, 0x6c, 0x58, 0x50, 0xb5, 0x52, 0x54, 0x92, 0x3f, 0x57, 0x4a, 0x43, 0x0b, 0x51, 0x60, 0x22, 0x58, 0xb0, 0x9f, 0x42, 0x2b, 0x70, 0x82, 0x88, 0x9e, 0x5e, 0xbf, 0x8b, 0xa8, 0x81, 0x85, 0x8c, 0x81, 0x8f, 0xa8, 0x7c, 0xbf, 0x9d, 0x6b, 0x7f, 0xa6, 0xba, 0x74, 0x67, 0xe3, 0x55, 0x49, 0x4c, 0x0d, 0x46, 0x55, 0x00, 0x66, 0x38, 0x61, 0x7d, 0x8d, 0x85, 0x3b, 0xf2, 0x9f, 0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0x10, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x5f, 0x31, 0x31, 0x2f, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x2f, 0x45, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x44, 0x69, 0x6d, 0x73, 0x00, 0x8c, 0xa9, 0xff, 0xff, 0x2c, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x43, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xa0, 0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0x10, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x5f, 0x31, 0x31, 0x2f, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x2f, 0x45, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x44, 0x69, 0x6d, 0x73, 0x5f, 0x31, 0x00, 0x00, 0x00, 0x14, 0xaa, 0xff, 0xff, 0x30, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xc9, 0xba, 0xa3, 0x3b, 0x01, 0x00, 0x00, 0x00, 0xec, 0x47, 0x33, 0x3f, 0x01, 0x00, 0x00, 0x00, 0x31, 0xe6, 0x12, 0xbf, 0x60, 0x00, 0x00, 0x00, 0x94, 0xc2, 0x93, 0xa5, 0x3c, 0x9f, 0x70, 0x8e, 0x6e, 0xbe, 0xab, 0x4a, 0x68, 0x46, 0x48, 0x5f, 0x9b, 0xbe, 0x21, 0xcb, 0x73, 0xc5, 0x78, 0x9d, 0x2f, 0x95, 0x87, 0x56, 0x8d, 0x77, 0x2b, 0x4d, 0xa3, 0x2b, 0x54, 0x93, 0x28, 0x95, 0x1b, 0x79, 0x53, 0x87, 0x7a, 0xb7, 0x25, 0xa9, 0xff, 0x62, 0x00, 0x5a, 0x9a, 0x8e, 0x52, 0x34, 0x99, 0xb2, 0x77, 0x41, 0x6a, 0xb0, 0x0a, 0x3f, 0x96, 0x9a, 0x12, 0x70, 0x82, 0x88, 0x22, 0x82, 0x2d, 0xae, 0x39, 0x85, 0x39, 0x7a, 0x7f, 0x62, 0x98, 0xff, 0xd6, 0x52, 0x80, 0x55, 0x24, 0x9c, 0x5a, 0x8f, 0x6a, 0x9c, 0xc3, 0x64, 0x43, 0x44, 0x6e, 0x4f, 0x66, 0xa1, 0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0x10, 0x00, 0x00, 0x00, 0x7d, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x78, 0x5f, 0x70, 0x6f, 0x6f, 0x6c, 0x69, 0x6e, 0x67, 0x31, 0x64, 0x5f, 0x37, 0x2f, 0x4d, 0x61, 0x78, 0x50, 0x6f, 0x6f, 0x6c, 0x00, 0xfc, 0xaa, 0xff, 0xff, 0x2c, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x43, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe6, 0xa1, 0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0x10, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x5f, 0x39, 0x2f, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x2f, 0x45, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x44, 0x69, 0x6d, 0x73, 0x5f, 0x31, 0x00, 0x00, 0x00, 0x00, 0x84, 0xab, 0xff, 0xff, 0x30, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x7b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x3e, 0x46, 0xa1, 0x3b, 0x01, 0x00, 0x00, 0x00, 0x90, 0x94, 0x26, 0x3f, 0x01, 0x00, 0x00, 0x00, 0x5f, 0xb5, 0x1a, 0xbf, 0x00, 0x03, 0x00, 0x00, 0x91, 0x67, 0x93, 0x6b, 0x90, 0xa3, 0x3a, 0x88, 0xad, 0xa2, 0x6c, 0x98, 0x8b, 0x7c, 0x99, 0x47, 0x9e, 0x8d, 0x6c, 0x90, 0x8f, 0x9f, 0x6a, 0x47, 0x5d, 0x96, 0xb9, 0x6a, 0x84, 0x9b, 0x9b, 0x72, 0xa3, 0x7f, 0x83, 0x66, 0xb1, 0xbd, 0x63, 0x6e, 0xa5, 0x5b, 0x8a, 0x5e, 0xa2, 0xad, 0x49, 0x60, 0xa7, 0x90, 0x8e, 0x88, 0xca, 0x53, 0x81, 0x45, 0x59, 0x6b, 0x47, 0x5a, 0x71, 0x62, 0x93, 0x87, 0x7c, 0x5a, 0x8e, 0x61, 0xbe, 0xbd, 0x39, 0x7e, 0x61, 0x6a, 0x78, 0x83, 0x64, 0x6e, 0x7f, 0x5b, 0xd3, 0xb6, 0xa8, 0x8e, 0x7f, 0x7b, 0xb2, 0x31, 0x4a, 0x7a, 0xb1, 0x8c, 0x95, 0x8f, 0xb6, 0x76, 0x7c, 0x6c, 0x7d, 0x57, 0x65, 0x8f, 0x87, 0x77, 0x52, 0x81, 0x3d, 0x7c, 0x75, 0x5e, 0x7b, 0x58, 0x59, 0x80, 0x93, 0x58, 0x91, 0x5e, 0x54, 0x92, 0x6c, 0x97, 0x56, 0x78, 0x74, 0x59, 0x66, 0x6b, 0x8e, 0x5b, 0x64, 0xa5, 0x76, 0x76, 0x6d, 0xb0, 0x78, 0x9a, 0x5a, 0x60, 0x96, 0x72, 0x60, 0xaa, 0x5c, 0x60, 0x7b, 0x5c, 0x71, 0x97, 0x84, 0x92, 0x84, 0x7f, 0x86, 0x81, 0x51, 0x8a, 0x96, 0x84, 0x6f, 0x61, 0x8a, 0x99, 0x77, 0x9a, 0x7c, 0x84, 0x72, 0x70, 0x37, 0x56, 0x90, 0x84, 0x68, 0x5b, 0x3b, 0x65, 0x99, 0x42, 0x73, 0x45, 0x86, 0x6d, 0x89, 0x7a, 0xa3, 0x6a, 0x8e, 0x90, 0x8a, 0x5e, 0x74, 0xa0, 0x4e, 0x75, 0x54, 0x58, 0x6c, 0x71, 0x4e, 0x71, 0x65, 0x3c, 0x94, 0x6c, 0x6b, 0x83, 0x60, 0x4a, 0x77, 0x64, 0x81, 0x69, 0xa4, 0x9e, 0x45, 0x8c, 0x60, 0x66, 0x70, 0x94, 0x7a, 0x8f, 0x4d, 0x7b, 0x9b, 0x69, 0x55, 0x7f, 0x5f, 0x9e, 0x6e, 0x3f, 0x5b, 0x68, 0x7e, 0x6e, 0x6b, 0x8d, 0x9a, 0x62, 0x48, 0x40, 0x75, 0x89, 0x54, 0x40, 0x49, 0x64, 0x84, 0x7b, 0x73, 0x9e, 0x70, 0x51, 0x68, 0x55, 0xa1, 0x88, 0x83, 0x3a, 0x8b, 0xa0, 0x9c, 0x71, 0x76, 0x65, 0x7f, 0x42, 0x77, 0x57, 0x72, 0x91, 0x7f, 0x70, 0x6b, 0x51, 0x4f, 0x54, 0x54, 0x9b, 0x9c, 0x5a, 0x5b, 0x71, 0x67, 0x90, 0x81, 0x66, 0x90, 0x66, 0xe0, 0x6f, 0x55, 0x92, 0x52, 0x3b, 0x73, 0x88, 0x01, 0x6f, 0x7e, 0x93, 0x73, 0x04, 0xac, 0x3a, 0x5f, 0x5b, 0x2e, 0x89, 0x6d, 0x9a, 0x6f, 0xb2, 0x96, 0x99, 0x91, 0x88, 0x64, 0x3f, 0x52, 0xb9, 0x63, 0xb5, 0x58, 0x7a, 0x77, 0x65, 0xa7, 0x6e, 0x7e, 0x88, 0x87, 0x71, 0x7d, 0x6e, 0x51, 0x7e, 0xa3, 0x65, 0x69, 0x69, 0xff, 0x50, 0x17, 0x21, 0x67, 0x7f, 0x7d, 0xa4, 0x6b, 0x91, 0x66, 0x81, 0xa9, 0x71, 0xab, 0x8c, 0x80, 0xa9, 0x8b, 0x66, 0x9c, 0x61, 0x55, 0xc2, 0x7b, 0x88, 0x91, 0x60, 0x84, 0x86, 0x9b, 0x94, 0x87, 0x83, 0x95, 0x7c, 0x97, 0x96, 0x53, 0x6b, 0x50, 0x7c, 0x86, 0x66, 0x6b, 0x89, 0x74, 0x65, 0x40, 0x4f, 0x65, 0x93, 0x9b, 0x5a, 0x40, 0xa0, 0x63, 0x42, 0x6f, 0x82, 0x8d, 0x89, 0x6c, 0x6e, 0x5a, 0x7d, 0x5d, 0xaa, 0x88, 0x83, 0x80, 0x7f, 0x80, 0x5f, 0x9c, 0x60, 0x61, 0x93, 0x57, 0x73, 0x8f, 0xa6, 0x72, 0x56, 0x5d, 0x6a, 0x4b, 0x93, 0x56, 0x6f, 0x54, 0x52, 0x6d, 0x4f, 0x91, 0x8a, 0x75, 0x96, 0x8f, 0x61, 0x59, 0x98, 0x8e, 0x64, 0x83, 0x81, 0x77, 0x5a, 0x6b, 0x4a, 0x65, 0x9a, 0x68, 0x70, 0x5e, 0x6e, 0x7e, 0x75, 0x7e, 0x40, 0x87, 0x93, 0x91, 0x69, 0x80, 0x64, 0x64, 0x58, 0x62, 0x69, 0x66, 0x77, 0x6e, 0x4b, 0x58, 0x5c, 0x9e, 0x6f, 0x9f, 0x5b, 0x9c, 0xa4, 0x6c, 0x75, 0x8f, 0x7d, 0x5e, 0x8a, 0x81, 0x95, 0x9b, 0x99, 0x6f, 0x8b, 0x7d, 0x94, 0x45, 0x4c, 0x89, 0x70, 0x3c, 0x54, 0x8e, 0x68, 0x88, 0x64, 0x7a, 0x72, 0x73, 0x57, 0x56, 0x86, 0x27, 0xb7, 0x7e, 0x8a, 0x98, 0x8c, 0x8b, 0x4e, 0x74, 0x90, 0x68, 0x72, 0x86, 0x9d, 0x81, 0x72, 0x6f, 0x46, 0x6b, 0x7b, 0x0d, 0x75, 0xb6, 0x73, 0x80, 0x68, 0x9f, 0x6d, 0xa9, 0xb1, 0x7a, 0x56, 0x6c, 0x8b, 0x93, 0x8f, 0x81, 0xa9, 0x8a, 0x96, 0x67, 0x92, 0x83, 0x55, 0x99, 0x75, 0x77, 0x7b, 0x59, 0x92, 0x77, 0x8c, 0x33, 0x67, 0x61, 0xbd, 0x90, 0xa5, 0x7b, 0x7d, 0x7e, 0x4f, 0x93, 0x6f, 0x82, 0x7d, 0xc5, 0x58, 0x6f, 0x77, 0x20, 0x0d, 0x83, 0x7b, 0x8e, 0x77, 0x75, 0x99, 0x00, 0x57, 0x88, 0x78, 0x4f, 0x6b, 0x6b, 0x8b, 0x83, 0x30, 0xdb, 0x86, 0x3e, 0x74, 0x6a, 0x7f, 0x7a, 0x96, 0x56, 0x75, 0x83, 0x91, 0x83, 0x6c, 0x77, 0x5b, 0x53, 0x69, 0x91, 0x66, 0x6f, 0x5d, 0x89, 0x8e, 0x68, 0x8a, 0x69, 0x79, 0xb8, 0x75, 0x77, 0x71, 0x66, 0x7f, 0x8c, 0x82, 0x9c, 0x81, 0x98, 0xaa, 0x72, 0x7c, 0x5c, 0x7c, 0x34, 0xc6, 0x8f, 0x57, 0x78, 0xbe, 0x4f, 0x8c, 0x62, 0xa0, 0x55, 0xab, 0x65, 0x5d, 0xa5, 0xaf, 0xb2, 0x78, 0x93, 0xa5, 0x7a, 0x73, 0x7e, 0x86, 0x73, 0x6f, 0xa8, 0xbf, 0x8a, 0xaf, 0x6c, 0x81, 0x62, 0x56, 0xbd, 0xc7, 0xae, 0x79, 0x8c, 0x68, 0x9c, 0x91, 0x8d, 0xa4, 0x3f, 0x52, 0x7d, 0xb2, 0xae, 0x79, 0x59, 0x88, 0x6e, 0x9c, 0x7e, 0x9b, 0x8a, 0x7f, 0x6a, 0x71, 0x0c, 0xa6, 0x96, 0x86, 0x57, 0x83, 0x56, 0x88, 0x62, 0x73, 0xb5, 0x52, 0x84, 0x71, 0x91, 0x7e, 0x94, 0x92, 0x71, 0x53, 0x77, 0x8c, 0x9b, 0x70, 0x7e, 0x77, 0x92, 0x8f, 0x74, 0x90, 0x6e, 0x5d, 0x80, 0x78, 0x77, 0x7f, 0x97, 0x3b, 0x4f, 0x62, 0xa2, 0x05, 0x5f, 0x9a, 0x91, 0x5b, 0x8e, 0x92, 0x2e, 0x71, 0x48, 0x57, 0x41, 0xa5, 0x7d, 0x44, 0x75, 0x62, 0x3f, 0x52, 0x76, 0xa5, 0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0x10, 0x00, 0x00, 0x00, 0x7b, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x5f, 0x31, 0x30, 0x2f, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x2f, 0x45, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x44, 0x69, 0x6d, 0x73, 0x5f, 0x31, 0x00, 0x00, 0x00, 0x14, 0xaf, 0xff, 0xff, 0x30, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x8c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x7b, 0x5f, 0x98, 0x3b, 0x01, 0x00, 0x00, 0x00, 0x85, 0x59, 0x08, 0x3f, 0x01, 0x00, 0x00, 0x00, 0xb2, 0x34, 0x27, 0xbf, 0x24, 0x00, 0x00, 0x00, 0x0d, 0x95, 0xbb, 0xb8, 0x09, 0xa0, 0xfd, 0xc4, 0x94, 0xdc, 0x35, 0xd0, 0xa8, 0x0d, 0x8a, 0xc5, 0xad, 0x67, 0x00, 0x5c, 0x8b, 0xab, 0x93, 0xcd, 0x33, 0xc6, 0x90, 0x6b, 0x30, 0x32, 0x3f, 0xb4, 0xff, 0x23, 0xc4, 0x65, 0x2a, 0xa6, 0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0x10, 0x00, 0x00, 0x00, 0x7a, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x78, 0x5f, 0x70, 0x6f, 0x6f, 0x6c, 0x69, 0x6e, 0x67, 0x31, 0x64, 0x5f, 0x31, 0x32, 0x2f, 0x4d, 0x61, 0x78, 0x50, 0x6f, 0x6f, 0x6c, 0x00, 0x00, 0x00, 0x00, 0xc4, 0xaf, 0xff, 0xff, 0x2c, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x43, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xae, 0xa6, 0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0x10, 0x00, 0x00, 0x00, 0x79, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x5f, 0x35, 0x2f, 0x52, 0x65, 0x6c, 0x75, 0x00, 0x00, 0x00, 0x3c, 0xb0, 0xff, 0xff, 0x2c, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x43, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x26, 0xa7, 0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0x10, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x78, 0x5f, 0x70, 0x6f, 0x6f, 0x6c, 0x69, 0x6e, 0x67, 0x31, 0x64, 0x5f, 0x36, 0x2f, 0x4d, 0x61, 0x78, 0x50, 0x6f, 0x6f, 0x6c, 0x00, 0xbc, 0xb0, 0xff, 0xff, 0x2c, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x43, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa6, 0xa7, 0xff, 0xff, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x5f, 0x37, 0x2f, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x2f, 0x45, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x44, 0x69, 0x6d, 0x73, 0x2f, 0x64, 0x69, 0x6d, 0x5f, 0x30, 0x00, 0x00, 0x00, 0x00, 0x40, 0xa6, 0xff, 0xff, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x0a, 0xa8, 0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0x10, 0x00, 0x00, 0x00, 0x76, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x5f, 0x31, 0x30, 0x2f, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x2f, 0x45, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x44, 0x69, 0x6d, 0x73, 0x00, 0xa4, 0xb1, 0xff, 0xff, 0x30, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x43, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x92, 0xa8, 0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0x10, 0x00, 0x00, 0x00, 0x75, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x5f, 0x31, 0x33, 0x2f, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x2f, 0x53, 0x71, 0x75, 0x65, 0x65, 0x7a, 0x65, 0x00, 0x00, 0x00, 0x00, 0x2c, 0xb2, 0xff, 0xff, 0x30, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x43, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1a, 0xa9, 0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0x10, 0x00, 0x00, 0x00, 0x74, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x78, 0x5f, 0x70, 0x6f, 0x6f, 0x6c, 0x69, 0x6e, 0x67, 0x31, 0x64, 0x5f, 0x35, 0x2f, 0x45, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x44, 0x69, 0x6d, 0x73, 0x00, 0x00, 0xb4, 0xb2, 0xff, 0xff, 0x30, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x43, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa2, 0xa9, 0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0x10, 0x00, 0x00, 0x00, 0x73, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x5f, 0x36, 0x2f, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x2f, 0x45, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x44, 0x69, 0x6d, 0x73, 0x00, 0x00, 0x3c, 0xb3, 0xff, 0xff, 0x30, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x43, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2a, 0xaa, 0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0x10, 0x00, 0x00, 0x00, 0x72, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x2f, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x2f, 0x45, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x44, 0x69, 0x6d, 0x73, 0x5f, 0x31, 0x00, 0x00, 0xc4, 0xb3, 0xff, 0xff, 0x30, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x94, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x09, 0x6b, 0x3b, 0x01, 0x00, 0x00, 0x00, 0xe2, 0xb1, 0xc4, 0x3e, 0x01, 0x00, 0x00, 0x00, 0x4d, 0xc5, 0x07, 0xbf, 0x24, 0x00, 0x00, 0x00, 0x6d, 0x00, 0xe1, 0x25, 0x19, 0xff, 0xa6, 0x45, 0xee, 0xf9, 0xf1, 0x6e, 0x84, 0x39, 0xe8, 0xe6, 0xb2, 0xf0, 0xfa, 0x49, 0xa2, 0x71, 0xd2, 0x58, 0xf0, 0x1f, 0xd0, 0xef, 0x7d, 0x4d, 0x27, 0xec, 0x42, 0xd2, 0x27, 0x79, 0xda, 0xaa, 0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0x10, 0x00, 0x00, 0x00, 0x71, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x78, 0x5f, 0x70, 0x6f, 0x6f, 0x6c, 0x69, 0x6e, 0x67, 0x31, 0x64, 0x5f, 0x31, 0x33, 0x2f, 0x45, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x44, 0x69, 0x6d, 0x73, 0x00, 0x74, 0xb4, 0xff, 0xff, 0x30, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x43, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x62, 0xab, 0xff, 0xff, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x5f, 0x34, 0x2f, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x5f, 0x62, 0x69, 0x61, 0x73, 0x00, 0x00, 0x00, 0x00, 0x24, 0xb2, 0xff, 0xff, 0x14, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x4f, 0x05, 0x43, 0x3b, 0x20, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0xf6, 0xff, 0xff, 0xff, 0xf7, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0xf3, 0xff, 0xff, 0xff, 0xf2, 0xff, 0xff, 0xff, 0xfa, 0xff, 0xff, 0xff, 0xe9, 0xff, 0xff, 0xff, 0xe2, 0xab, 0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0x10, 0x00, 0x00, 0x00, 0x6f, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x33, 0x00, 0x00, 0x00, 0x00, 0x6c, 0xb5, 0xff, 0xff, 0x30, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x43, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5a, 0xac, 0xff, 0xff, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x00, 0x00, 0x6e, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x5f, 0x33, 0x2f, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x2f, 0x45, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x44, 0x69, 0x6d, 0x73, 0x2f, 0x64, 0x69, 0x6d, 0x5f, 0x30, 0x00, 0x00, 0x00, 0x00, 0xf4, 0xaa, 0xff, 0xff, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0xbe, 0xac, 0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0x10, 0x00, 0x00, 0x00, 0x6d, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x5f, 0x31, 0x2f, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x2f, 0x53, 0x71, 0x75, 0x65, 0x65, 0x7a, 0x65, 0x00, 0x54, 0xb6, 0xff, 0xff, 0x30, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x43, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0xad, 0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0x10, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x5f, 0x33, 0x2f, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x2f, 0x45, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x44, 0x69, 0x6d, 0x73, 0x00, 0x00, 0xdc, 0xb6, 0xff, 0xff, 0x30, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x43, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xca, 0xad, 0xff, 0xff, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x00, 0x00, 0x6b, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x78, 0x5f, 0x70, 0x6f, 0x6f, 0x6c, 0x69, 0x6e, 0x67, 0x31, 0x64, 0x5f, 0x31, 0x32, 0x2f, 0x45, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x44, 0x69, 0x6d, 0x73, 0x2f, 0x64, 0x69, 0x6d, 0x5f, 0x30, 0x00, 0x00, 0x00, 0x64, 0xac, 0xff, 0xff, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x2e, 0xae, 0xff, 0xff, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x00, 0x00, 0x6a, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x5f, 0x36, 0x2f, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x2f, 0x45, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x44, 0x69, 0x6d, 0x73, 0x2f, 0x64, 0x69, 0x6d, 0x5f, 0x30, 0x00, 0x00, 0x00, 0x00, 0xc8, 0xac, 0xff, 0xff, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x92, 0xae, 0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0x10, 0x00, 0x00, 0x00, 0x69, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x32, 0x00, 0x00, 0x00, 0x00, 0x1c, 0xb8, 0xff, 0xff, 0x2c, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x43, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0xaf, 0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0x10, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x78, 0x5f, 0x70, 0x6f, 0x6f, 0x6c, 0x69, 0x6e, 0x67, 0x31, 0x64, 0x5f, 0x35, 0x2f, 0x4d, 0x61, 0x78, 0x50, 0x6f, 0x6f, 0x6c, 0x00, 0x9c, 0xb8, 0xff, 0xff, 0x30, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x43, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8a, 0xaf, 0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0x10, 0x00, 0x00, 0x00, 0x67, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x5f, 0x35, 0x2f, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x2f, 0x45, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x44, 0x69, 0x6d, 0x73, 0x00, 0x00, 0x24, 0xb9, 0xff, 0xff, 0x30, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x43, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0xb0, 0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0x10, 0x00, 0x00, 0x00, 0x66, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x78, 0x5f, 0x70, 0x6f, 0x6f, 0x6c, 0x69, 0x6e, 0x67, 0x31, 0x64, 0x5f, 0x31, 0x31, 0x2f, 0x4d, 0x61, 0x78, 0x50, 0x6f, 0x6f, 0x6c, 0x00, 0x00, 0x00, 0x00, 0xac, 0xb9, 0xff, 0xff, 0x30, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x43, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9a, 0xb0, 0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0x10, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x78, 0x5f, 0x70, 0x6f, 0x6f, 0x6c, 0x69, 0x6e, 0x67, 0x31, 0x64, 0x5f, 0x37, 0x2f, 0x45, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x44, 0x69, 0x6d, 0x73, 0x00, 0x00, 0x34, 0xba, 0xff, 0xff, 0x30, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x43, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x22, 0xb1, 0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0x10, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x78, 0x5f, 0x70, 0x6f, 0x6f, 0x6c, 0x69, 0x6e, 0x67, 0x31, 0x64, 0x5f, 0x31, 0x34, 0x2f, 0x4d, 0x61, 0x78, 0x50, 0x6f, 0x6f, 0x6c, 0x00, 0x00, 0x00, 0x00, 0xbc, 0xba, 0xff, 0xff, 0x30, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x43, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xaa, 0xb1, 0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0x10, 0x00, 0x00, 0x00, 0x63, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x31, 0x00, 0x00, 0x00, 0x00, 0x34, 0xbb, 0xff, 0xff, 0x2c, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x43, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0xb2, 0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0x10, 0x00, 0x00, 0x00, 0x62, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x5f, 0x33, 0x2f, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x2f, 0x53, 0x71, 0x75, 0x65, 0x65, 0x7a, 0x65, 0x00, 0xb4, 0xbb, 0xff, 0xff, 0x30, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x43, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa2, 0xb2, 0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0x10, 0x00, 0x00, 0x00, 0x61, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x5f, 0x31, 0x2f, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x2f, 0x45, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x44, 0x69, 0x6d, 0x73, 0x00, 0x00, 0x3c, 0xbc, 0xff, 0xff, 0x30, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x43, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2a, 0xb3, 0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0x10, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x2f, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x2f, 0x45, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x44, 0x69, 0x6d, 0x73, 0x00, 0x00, 0x00, 0x00, 0xc4, 0xbc, 0xff, 0xff, 0x30, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x43, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb2, 0xb3, 0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0x10, 0x00, 0x00, 0x00, 0x5f, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x78, 0x5f, 0x70, 0x6f, 0x6f, 0x6c, 0x69, 0x6e, 0x67, 0x31, 0x64, 0x5f, 0x38, 0x2f, 0x45, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x44, 0x69, 0x6d, 0x73, 0x00, 0x00, 0x4c, 0xbd, 0xff, 0xff, 0x30, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x43, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3a, 0xb4, 0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0x10, 0x00, 0x00, 0x00, 0x5e, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x78, 0x5f, 0x70, 0x6f, 0x6f, 0x6c, 0x69, 0x6e, 0x67, 0x31, 0x64, 0x2f, 0x45, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x44, 0x69, 0x6d, 0x73, 0x00, 0x00, 0x00, 0x00, 0xd4, 0xbd, 0xff, 0xff, 0x30, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x43, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc2, 0xb4, 0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0x10, 0x00, 0x00, 0x00, 0x5d, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x5f, 0x31, 0x31, 0x2f, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x2f, 0x53, 0x71, 0x75, 0x65, 0x65, 0x7a, 0x65, 0x00, 0x00, 0x00, 0x00, 0x5c, 0xbe, 0xff, 0xff, 0x30, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x43, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4a, 0xb5, 0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0x10, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x78, 0x5f, 0x70, 0x6f, 0x6f, 0x6c, 0x69, 0x6e, 0x67, 0x31, 0x64, 0x5f, 0x33, 0x2f, 0x45, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x44, 0x69, 0x6d, 0x73, 0x00, 0x00, 0xe4, 0xbe, 0xff, 0xff, 0x2c, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x43, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xce, 0xb5, 0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0x10, 0x00, 0x00, 0x00, 0x5b, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x78, 0x5f, 0x70, 0x6f, 0x6f, 0x6c, 0x69, 0x6e, 0x67, 0x31, 0x64, 0x5f, 0x32, 0x2f, 0x4d, 0x61, 0x78, 0x50, 0x6f, 0x6f, 0x6c, 0x00, 0x64, 0xbf, 0xff, 0xff, 0x30, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x43, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x52, 0xb6, 0xff, 0xff, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x00, 0x00, 0x5a, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x5f, 0x37, 0x2f, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x5f, 0x62, 0x69, 0x61, 0x73, 0x00, 0x00, 0x00, 0x00, 0x14, 0xbd, 0xff, 0xff, 0x14, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x83, 0x95, 0xa6, 0x3b, 0x40, 0x00, 0x00, 0x00, 0xf0, 0xff, 0xff, 0xff, 0xbb, 0xff, 0xff, 0xff, 0x12, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x16, 0x00, 0x00, 0x00, 0xd2, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xff, 0x0b, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0xac, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0xe9, 0xff, 0xff, 0xff, 0xe7, 0xff, 0xff, 0xff, 0xec, 0xff, 0xff, 0xff, 0xb7, 0xff, 0xff, 0xff, 0x17, 0x00, 0x00, 0x00, 0xf2, 0xb6, 0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0x10, 0x00, 0x00, 0x00, 0x59, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x78, 0x5f, 0x70, 0x6f, 0x6f, 0x6c, 0x69, 0x6e, 0x67, 0x31, 0x64, 0x5f, 0x31, 0x2f, 0x45, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x44, 0x69, 0x6d, 0x73, 0x00, 0x00, 0x8c, 0xc0, 0xff, 0xff, 0x2c, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x43, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xb7, 0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0x10, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x5f, 0x36, 0x2f, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x2f, 0x45, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x44, 0x69, 0x6d, 0x73, 0x5f, 0x31, 0x00, 0x00, 0x00, 0x00, 0x14, 0xc1, 0xff, 0xff, 0x2c, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x83, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x82, 0x99, 0x92, 0x3b, 0x01, 0x00, 0x00, 0x00, 0x43, 0x14, 0x0e, 0x3f, 0x01, 0x00, 0x00, 0x00, 0x8e, 0xf9, 0x15, 0xbf, 0x60, 0x00, 0x00, 0x00, 0x87, 0x4e, 0x80, 0x8d, 0x87, 0x3e, 0xb6, 0xbb, 0x85, 0xba, 0x7a, 0x1a, 0x74, 0x23, 0xb4, 0x3d, 0x66, 0x2b, 0xe6, 0x8d, 0xa8, 0x44, 0x78, 0x2d, 0x2a, 0x00, 0xda, 0xba, 0xbd, 0x82, 0xb4, 0x9d, 0x48, 0x2c, 0x38, 0x04, 0x69, 0x3d, 0x90, 0x74, 0x54, 0xc3, 0xaa, 0x5d, 0x28, 0x5f, 0xd5, 0xd2, 0x29, 0x2b, 0xa7, 0xdb, 0x50, 0xcb, 0x8b, 0x5f, 0x2e, 0x57, 0x57, 0x59, 0xb0, 0x6a, 0x4c, 0xd6, 0x56, 0x5e, 0xc9, 0xa6, 0x7d, 0xff, 0x3c, 0xbb, 0x4d, 0xa5, 0x55, 0xc4, 0x37, 0x8e, 0xde, 0x0b, 0x92, 0x9d, 0xc3, 0xbc, 0xbd, 0xd3, 0xd2, 0xcc, 0x96, 0x70, 0x49, 0x87, 0x9e, 0x9f, 0x58, 0xa4, 0x62, 0xb8, 0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0x10, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x66, 0x6c, 0x61, 0x74, 0x74, 0x65, 0x6e, 0x5f, 0x31, 0x2f, 0x52, 0x65, 0x73, 0x68, 0x61, 0x70, 0x65, 0x00, 0x00, 0x00, 0xec, 0xc1, 0xff, 0xff, 0x2c, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x43, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd6, 0xb8, 0xff, 0xff, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x00, 0x00, 0x56, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x78, 0x5f, 0x70, 0x6f, 0x6f, 0x6c, 0x69, 0x6e, 0x67, 0x31, 0x64, 0x5f, 0x31, 0x33, 0x2f, 0x45, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x44, 0x69, 0x6d, 0x73, 0x2f, 0x64, 0x69, 0x6d, 0x5f, 0x30, 0x00, 0x00, 0x00, 0x70, 0xb7, 0xff, 0xff, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x3a, 0xb9, 0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0x10, 0x00, 0x00, 0x00, 0x55, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x6e, 0x63, 0x61, 0x74, 0x65, 0x6e, 0x61, 0x74, 0x65, 0x2f, 0x63, 0x6f, 0x6e, 0x63, 0x61, 0x74, 0x00, 0x00, 0xc4, 0xc2, 0xff, 0xff, 0x2c, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x43, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xae, 0xb9, 0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0x10, 0x00, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x5f, 0x32, 0x2f, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x2f, 0x53, 0x71, 0x75, 0x65, 0x65, 0x7a, 0x65, 0x00, 0x44, 0xc3, 0xff, 0xff, 0x30, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x43, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32, 0xba, 0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0x10, 0x00, 0x00, 0x00, 0x53, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x66, 0x6c, 0x61, 0x74, 0x74, 0x65, 0x6e, 0x5f, 0x32, 0x2f, 0x52, 0x65, 0x73, 0x68, 0x61, 0x70, 0x65, 0x00, 0x00, 0x00, 0xbc, 0xc3, 0xff, 0xff, 0x30, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x43, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xaa, 0xba, 0xff, 0xff, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x00, 0x00, 0x52, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x5f, 0x38, 0x2f, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x2f, 0x45, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x44, 0x69, 0x6d, 0x73, 0x2f, 0x64, 0x69, 0x6d, 0x5f, 0x30, 0x00, 0x00, 0x00, 0x00, 0x44, 0xb9, 0xff, 0xff, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x0e, 0xbb, 0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0x10, 0x00, 0x00, 0x00, 0x51, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x5f, 0x36, 0x2f, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x2f, 0x53, 0x71, 0x75, 0x65, 0x65, 0x7a, 0x65, 0x00, 0xa4, 0xc4, 0xff, 0xff, 0x30, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x43, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x92, 0xbb, 0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0x10, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x5f, 0x37, 0x2f, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x2f, 0x45, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x44, 0x69, 0x6d, 0x73, 0x00, 0x00, 0x2c, 0xc5, 0xff, 0xff, 0x30, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x43, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1a, 0xbc, 0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0x10, 0x00, 0x00, 0x00, 0x4f, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x5f, 0x32, 0x2f, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x2f, 0x45, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x44, 0x69, 0x6d, 0x73, 0x00, 0x00, 0xb4, 0xc5, 0xff, 0xff, 0x30, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x43, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa2, 0xbc, 0xff, 0xff, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x5f, 0x32, 0x2f, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x5f, 0x62, 0x69, 0x61, 0x73, 0x00, 0x00, 0x00, 0x00, 0x64, 0xc3, 0xff, 0xff, 0x14, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0d, 0x12, 0x28, 0x3b, 0x40, 0x00, 0x00, 0x00, 0xf3, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xf6, 0xff, 0xff, 0xff, 0xef, 0xff, 0xff, 0xff, 0x20, 0x00, 0x00, 0x00, 0xee, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xeb, 0xff, 0xff, 0xff, 0xf2, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xeb, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xff, 0xff, 0xff, 0xed, 0xff, 0xff, 0xff, 0x08, 0x00, 0x00, 0x00, 0xfb, 0xff, 0xff, 0xff, 0x42, 0xbd, 0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0x10, 0x00, 0x00, 0x00, 0x4d, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x78, 0x5f, 0x70, 0x6f, 0x6f, 0x6c, 0x69, 0x6e, 0x67, 0x31, 0x64, 0x5f, 0x36, 0x2f, 0x45, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x44, 0x69, 0x6d, 0x73, 0x00, 0x00, 0xdc, 0xc6, 0xff, 0xff, 0x30, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x43, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xca, 0xbd, 0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0x10, 0x00, 0x00, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x78, 0x5f, 0x70, 0x6f, 0x6f, 0x6c, 0x69, 0x6e, 0x67, 0x31, 0x64, 0x5f, 0x31, 0x31, 0x2f, 0x45, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x44, 0x69, 0x6d, 0x73, 0x00, 0x64, 0xc7, 0xff, 0xff, 0x2c, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x43, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e, 0xbe, 0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0x10, 0x00, 0x00, 0x00, 0x4b, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x78, 0x5f, 0x70, 0x6f, 0x6f, 0x6c, 0x69, 0x6e, 0x67, 0x31, 0x64, 0x5f, 0x31, 0x2f, 0x4d, 0x61, 0x78, 0x50, 0x6f, 0x6f, 0x6c, 0x00, 0xe4, 0xc7, 0xff, 0xff, 0x30, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x43, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd2, 0xbe, 0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0x10, 0x00, 0x00, 0x00, 0x4a, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x5f, 0x31, 0x32, 0x2f, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x2f, 0x45, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x44, 0x69, 0x6d, 0x73, 0x00, 0x6c, 0xc8, 0xff, 0xff, 0x2c, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x43, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x56, 0xbf, 0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0x10, 0x00, 0x00, 0x00, 0x49, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x5f, 0x37, 0x2f, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x2f, 0x53, 0x71, 0x75, 0x65, 0x65, 0x7a, 0x65, 0x00, 0xec, 0xc8, 0xff, 0xff, 0x30, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x43, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xda, 0xbf, 0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x5f, 0x31, 0x32, 0x2f, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x2f, 0x53, 0x71, 0x75, 0x65, 0x65, 0x7a, 0x65, 0x00, 0x00, 0x00, 0x00, 0x74, 0xc9, 0xff, 0xff, 0x30, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x43, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x62, 0xc0, 0xff, 0xff, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x00, 0x00, 0x47, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x5f, 0x35, 0x2f, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x5f, 0x62, 0x69, 0x61, 0x73, 0x00, 0x00, 0x00, 0x00, 0x24, 0xc7, 0xff, 0xff, 0x14, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x6d, 0x86, 0x86, 0x3b, 0x10, 0x00, 0x00, 0x00, 0xf6, 0xff, 0xff, 0xff, 0xfa, 0xff, 0xff, 0xff, 0xfa, 0xff, 0xff, 0xff, 0x06, 0x00, 0x00, 0x00, 0xd2, 0xc0, 0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0x10, 0x00, 0x00, 0x00, 0x46, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x78, 0x5f, 0x70, 0x6f, 0x6f, 0x6c, 0x69, 0x6e, 0x67, 0x31, 0x64, 0x5f, 0x32, 0x2f, 0x45, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x44, 0x69, 0x6d, 0x73, 0x00, 0x00, 0x6c, 0xca, 0xff, 0xff, 0x30, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x43, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5a, 0xc1, 0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0x10, 0x00, 0x00, 0x00, 0x45, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x78, 0x5f, 0x70, 0x6f, 0x6f, 0x6c, 0x69, 0x6e, 0x67, 0x31, 0x64, 0x5f, 0x31, 0x32, 0x2f, 0x45, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x44, 0x69, 0x6d, 0x73, 0x00, 0xf4, 0xca, 0xff, 0xff, 0x2c, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x43, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xde, 0xc1, 0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0x10, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x78, 0x5f, 0x70, 0x6f, 0x6f, 0x6c, 0x69, 0x6e, 0x67, 0x31, 0x64, 0x5f, 0x34, 0x2f, 0x4d, 0x61, 0x78, 0x50, 0x6f, 0x6f, 0x6c, 0x00, 0x74, 0xcb, 0xff, 0xff, 0x30, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x43, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x62, 0xc2, 0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0x10, 0x00, 0x00, 0x00, 0x43, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x5f, 0x38, 0x2f, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x2f, 0x45, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x44, 0x69, 0x6d, 0x73, 0x00, 0x00, 0xfc, 0xcb, 0xff, 0xff, 0x30, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x43, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xea, 0xc2, 0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0x10, 0x00, 0x00, 0x00, 0x42, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x5f, 0x31, 0x33, 0x2f, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x2f, 0x45, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x44, 0x69, 0x6d, 0x73, 0x00, 0x84, 0xcc, 0xff, 0xff, 0x2c, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x43, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6e, 0xc3, 0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0x10, 0x00, 0x00, 0x00, 0x41, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x5f, 0x38, 0x2f, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x2f, 0x53, 0x71, 0x75, 0x65, 0x65, 0x7a, 0x65, 0x00, 0x04, 0xcd, 0xff, 0xff, 0x2c, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x43, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xee, 0xc3, 0xff, 0xff, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x2f, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x5f, 0x62, 0x69, 0x61, 0x73, 0x00, 0x00, 0xac, 0xca, 0xff, 0xff, 0x18, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x09, 0x6b, 0x3b, 0x10, 0x00, 0x00, 0x00, 0xf3, 0xff, 0xff, 0xff, 0xf1, 0xff, 0xff, 0xff, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5e, 0xc4, 0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0x10, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x78, 0x5f, 0x70, 0x6f, 0x6f, 0x6c, 0x69, 0x6e, 0x67, 0x31, 0x64, 0x5f, 0x33, 0x2f, 0x4d, 0x61, 0x78, 0x50, 0x6f, 0x6f, 0x6c, 0x00, 0xf4, 0xcd, 0xff, 0xff, 0x2c, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x43, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xde, 0xc4, 0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0x10, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x78, 0x5f, 0x70, 0x6f, 0x6f, 0x6c, 0x69, 0x6e, 0x67, 0x31, 0x64, 0x5f, 0x38, 0x2f, 0x4d, 0x61, 0x78, 0x50, 0x6f, 0x6f, 0x6c, 0x00, 0x74, 0xce, 0xff, 0xff, 0x30, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x43, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x62, 0xc5, 0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0x10, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x78, 0x5f, 0x70, 0x6f, 0x6f, 0x6c, 0x69, 0x6e, 0x67, 0x31, 0x64, 0x5f, 0x31, 0x33, 0x2f, 0x4d, 0x61, 0x78, 0x50, 0x6f, 0x6f, 0x6c, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xce, 0xff, 0xff, 0x30, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x43, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xea, 0xc5, 0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0x10, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x5f, 0x34, 0x2f, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x2f, 0x45, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x44, 0x69, 0x6d, 0x73, 0x00, 0x00, 0x84, 0xcf, 0xff, 0xff, 0x30, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x43, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x72, 0xc6, 0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0x10, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x5f, 0x39, 0x2f, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x2f, 0x45, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x44, 0x69, 0x6d, 0x73, 0x00, 0x00, 0x0c, 0xd0, 0xff, 0xff, 0x30, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x43, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfa, 0xc6, 0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0x10, 0x00, 0x00, 0x00, 0x3a, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x5f, 0x31, 0x34, 0x2f, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x2f, 0x45, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x44, 0x69, 0x6d, 0x73, 0x00, 0x94, 0xd0, 0xff, 0xff, 0x2c, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x43, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0xc7, 0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0x10, 0x00, 0x00, 0x00, 0x39, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x5f, 0x34, 0x2f, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x2f, 0x53, 0x71, 0x75, 0x65, 0x65, 0x7a, 0x65, 0x00, 0x14, 0xd1, 0xff, 0xff, 0x30, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x43, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xc8, 0xff, 0xff, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x78, 0x5f, 0x70, 0x6f, 0x6f, 0x6c, 0x69, 0x6e, 0x67, 0x31, 0x64, 0x5f, 0x34, 0x2f, 0x45, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x44, 0x69, 0x6d, 0x73, 0x2f, 0x64, 0x69, 0x6d, 0x5f, 0x30, 0x00, 0x00, 0x00, 0x00, 0x9c, 0xc6, 0xff, 0xff, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x66, 0xc8, 0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0x10, 0x00, 0x00, 0x00, 0x37, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x5f, 0x39, 0x2f, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x2f, 0x53, 0x71, 0x75, 0x65, 0x65, 0x7a, 0x65, 0x00, 0xfc, 0xd1, 0xff, 0xff, 0x30, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x43, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xea, 0xc8, 0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0x10, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x5f, 0x31, 0x34, 0x2f, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x2f, 0x53, 0x71, 0x75, 0x65, 0x65, 0x7a, 0x65, 0x00, 0x00, 0x00, 0x00, 0x84, 0xd2, 0xff, 0xff, 0x2c, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x43, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6e, 0xc9, 0xff, 0xff, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x00, 0x00, 0x35, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x66, 0x6c, 0x61, 0x74, 0x74, 0x65, 0x6e, 0x5f, 0x31, 0x2f, 0x52, 0x65, 0x73, 0x68, 0x61, 0x70, 0x65, 0x2f, 0x73, 0x68, 0x61, 0x70, 0x65, 0x00, 0xf8, 0xc7, 0xff, 0xff, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xba, 0xc9, 0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0x10, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x78, 0x5f, 0x70, 0x6f, 0x6f, 0x6c, 0x69, 0x6e, 0x67, 0x31, 0x64, 0x5f, 0x39, 0x2f, 0x45, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x44, 0x69, 0x6d, 0x73, 0x00, 0x00, 0x54, 0xd3, 0xff, 0xff, 0x2c, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x43, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0xca, 0xff, 0xff, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x00, 0x00, 0x33, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x5f, 0x31, 0x31, 0x2f, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x2f, 0x45, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x44, 0x69, 0x6d, 0x73, 0x2f, 0x64, 0x69, 0x6d, 0x5f, 0x30, 0x00, 0x00, 0x00, 0xd8, 0xc8, 0xff, 0xff, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0xa2, 0xca, 0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0x10, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x78, 0x5f, 0x70, 0x6f, 0x6f, 0x6c, 0x69, 0x6e, 0x67, 0x31, 0x64, 0x5f, 0x31, 0x34, 0x2f, 0x45, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x44, 0x69, 0x6d, 0x73, 0x00, 0x3c, 0xd4, 0xff, 0xff, 0x2c, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x43, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x26, 0xcb, 0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0x10, 0x00, 0x00, 0x00, 0x31, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x78, 0x5f, 0x70, 0x6f, 0x6f, 0x6c, 0x69, 0x6e, 0x67, 0x31, 0x64, 0x5f, 0x39, 0x2f, 0x4d, 0x61, 0x78, 0x50, 0x6f, 0x6f, 0x6c, 0x00, 0xbc, 0xd4, 0xff, 0xff, 0x30, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x43, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xaa, 0xcb, 0xff, 0xff, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x5f, 0x31, 0x31, 0x2f, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x5f, 0x62, 0x69, 0x61, 0x73, 0x00, 0x00, 0x00, 0x6c, 0xd2, 0xff, 0xff, 0x14, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xc9, 0xba, 0xa3, 0x3b, 0x20, 0x00, 0x00, 0x00, 0xd0, 0xff, 0xff, 0xff, 0xf0, 0xff, 0xff, 0xff, 0x25, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0xe2, 0xff, 0xff, 0xff, 0x2a, 0xcc, 0xff, 0xff, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x00, 0x00, 0x2f, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x5f, 0x34, 0x2f, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x2f, 0x45, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x44, 0x69, 0x6d, 0x73, 0x2f, 0x64, 0x69, 0x6d, 0x5f, 0x30, 0x00, 0x00, 0x00, 0x00, 0xc4, 0xca, 0xff, 0xff, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x8e, 0xcc, 0xff, 0xff, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x00, 0x00, 0x2e, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00, 0x66, 0x6c, 0x61, 0x74, 0x74, 0x65, 0x6e, 0x2f, 0x52, 0x65, 0x73, 0x68, 0x61, 0x70, 0x65, 0x2f, 0x73, 0x68, 0x61, 0x70, 0x65, 0x00, 0x00, 0x00, 0x18, 0xcb, 0xff, 0xff, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xda, 0xcc, 0xff, 0xff, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x00, 0x00, 0x2d, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x66, 0x6c, 0x61, 0x74, 0x74, 0x65, 0x6e, 0x5f, 0x32, 0x2f, 0x52, 0x65, 0x73, 0x68, 0x61, 0x70, 0x65, 0x2f, 0x73, 0x68, 0x61, 0x70, 0x65, 0x00, 0x64, 0xcb, 0xff, 0xff, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x26, 0xcd, 0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0x10, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x66, 0x6c, 0x61, 0x74, 0x74, 0x65, 0x6e, 0x2f, 0x52, 0x65, 0x73, 0x68, 0x61, 0x70, 0x65, 0x00, 0xac, 0xd6, 0xff, 0xff, 0x2c, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x43, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x96, 0xcd, 0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0x10, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x2f, 0x42, 0x69, 0x61, 0x73, 0x41, 0x64, 0x64, 0x00, 0x00, 0x00, 0x00, 0x24, 0xd7, 0xff, 0xff, 0x30, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x43, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0xce, 0xff, 0xff, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x2f, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x2f, 0x45, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x44, 0x69, 0x6d, 0x73, 0x2f, 0x64, 0x69, 0x6d, 0x5f, 0x30, 0x00, 0x00, 0xa8, 0xcc, 0xff, 0xff, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x72, 0xce, 0xff, 0xff, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x00, 0x00, 0x29, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x5f, 0x31, 0x32, 0x2f, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x5f, 0x62, 0x69, 0x61, 0x73, 0x00, 0x00, 0x00, 0x34, 0xd5, 0xff, 0xff, 0x18, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2d, 0xf6, 0xd5, 0x3b, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xde, 0xff, 0xff, 0xff, 0xfb, 0xff, 0xff, 0xff, 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0xe9, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0xdc, 0xff, 0xff, 0xff, 0xed, 0xff, 0xff, 0xff, 0xe8, 0xff, 0xff, 0xff, 0xdf, 0xff, 0xff, 0xff, 0xf9, 0xff, 0xff, 0xff, 0x0a, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0xfb, 0xff, 0xff, 0xff, 0xf8, 0xff, 0xff, 0xff, 0x16, 0xcf, 0xff, 0xff, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x5f, 0x35, 0x2f, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x2f, 0x45, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x44, 0x69, 0x6d, 0x73, 0x2f, 0x64, 0x69, 0x6d, 0x5f, 0x30, 0x00, 0x00, 0x00, 0x00, 0xb0, 0xcd, 0xff, 0xff, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x7a, 0xcf, 0xff, 0xff, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x00, 0x00, 0x27, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x5f, 0x31, 0x30, 0x2f, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x2f, 0x45, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x44, 0x69, 0x6d, 0x73, 0x2f, 0x64, 0x69, 0x6d, 0x5f, 0x30, 0x00, 0x00, 0x00, 0x14, 0xce, 0xff, 0xff, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xde, 0xcf, 0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0x10, 0x00, 0x00, 0x00, 0x26, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x5f, 0x35, 0x2f, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x2f, 0x45, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x44, 0x69, 0x6d, 0x73, 0x5f, 0x31, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xd9, 0xff, 0xff, 0x30, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x75, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x6d, 0x86, 0x86, 0x3b, 0x01, 0x00, 0x00, 0x00, 0xc9, 0x3f, 0x11, 0x3f, 0x01, 0x00, 0x00, 0x00, 0x08, 0x80, 0xf5, 0xbe, 0x24, 0x00, 0x00, 0x00, 0x14, 0x28, 0xe2, 0x7f, 0x7e, 0x14, 0x9a, 0x42, 0x8d, 0x0d, 0x5a, 0x83, 0x2d, 0x2b, 0xc1, 0x6a, 0x78, 0x9f, 0x89, 0x16, 0xe7, 0x53, 0x3e, 0x91, 0x00, 0x02, 0x09, 0x5a, 0xff, 0xa2, 0x09, 0x0b, 0xb3, 0x70, 0xba, 0x36, 0x92, 0xd0, 0xff, 0xff, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x5f, 0x31, 0x30, 0x2f, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x5f, 0x62, 0x69, 0x61, 0x73, 0x00, 0x00, 0x00, 0x54, 0xd7, 0xff, 0xff, 0x14, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x7b, 0x5f, 0x98, 0x3b, 0x10, 0x00, 0x00, 0x00, 0xe2, 0xff, 0xff, 0xff, 0xfd, 0xff, 0xff, 0xff, 0xf1, 0xff, 0xff, 0xff, 0x05, 0x00, 0x00, 0x00, 0x02, 0xd1, 0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0x10, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x2f, 0x52, 0x65, 0x6c, 0x75, 0x00, 0x8c, 0xda, 0xff, 0xff, 0x2c, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x43, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xd1, 0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0x10, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x5f, 0x31, 0x30, 0x2f, 0x52, 0x65, 0x6c, 0x75, 0x00, 0x00, 0x04, 0xdb, 0xff, 0xff, 0x2c, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x43, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xee, 0xd1, 0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0x10, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x5f, 0x31, 0x2f, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x2f, 0x45, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x44, 0x69, 0x6d, 0x73, 0x5f, 0x31, 0x00, 0x00, 0x00, 0x00, 0x8c, 0xdb, 0xff, 0xff, 0x2c, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x8f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xd4, 0x80, 0x85, 0x3b, 0x01, 0x00, 0x00, 0x00, 0x74, 0xc0, 0xe9, 0x3e, 0x01, 0x00, 0x00, 0x00, 0x6c, 0x16, 0x15, 0xbf, 0x60, 0x00, 0x00, 0x00, 0xbd, 0x59, 0xc6, 0x49, 0x34, 0x90, 0xd9, 0x41, 0x62, 0xb0, 0x30, 0xbf, 0x00, 0xb6, 0xda, 0x79, 0x5d, 0xb3, 0x20, 0x65, 0x6e, 0x27, 0x5d, 0xb3, 0xd5, 0xc1, 0x4b, 0x32, 0xb3, 0x75, 0x42, 0xb6, 0x5a, 0x60, 0xe4, 0xa6, 0x8d, 0x69, 0xff, 0xa3, 0xf2, 0xca, 0x9d, 0xda, 0xca, 0xd5, 0xc7, 0x4c, 0xb5, 0x72, 0x99, 0xb9, 0x5b, 0x70, 0x71, 0x58, 0xe4, 0x4f, 0xdf, 0xad, 0x70, 0xd7, 0x9e, 0xbb, 0xd5, 0x79, 0x56, 0xc5, 0x3e, 0x9e, 0x61, 0xd0, 0x89, 0xdd, 0x71, 0xe6, 0x74, 0x90, 0xd4, 0x6d, 0x55, 0xd1, 0x35, 0x5b, 0x41, 0x65, 0x84, 0xbb, 0xd8, 0x83, 0xae, 0xd5, 0xef, 0x31, 0xa6, 0x9b, 0xda, 0xd2, 0xff, 0xff, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x5f, 0x31, 0x2f, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x5f, 0x62, 0x69, 0x61, 0x73, 0x00, 0x00, 0x00, 0x00, 0x9c, 0xd9, 0xff, 0xff, 0x14, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xd4, 0x80, 0x85, 0x3b, 0x20, 0x00, 0x00, 0x00, 0xf0, 0xff, 0xff, 0xff, 0xfa, 0xff, 0xff, 0xff, 0xf5, 0xff, 0xff, 0xff, 0xf3, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xf4, 0xff, 0xff, 0xff, 0xf4, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x5a, 0xd3, 0xff, 0xff, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x5f, 0x36, 0x2f, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x5f, 0x62, 0x69, 0x61, 0x73, 0x00, 0x00, 0x00, 0x00, 0x1c, 0xda, 0xff, 0xff, 0x18, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x82, 0x99, 0x92, 0x3b, 0x20, 0x00, 0x00, 0x00, 0xfb, 0xff, 0xff, 0xff, 0x25, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0xde, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x00, 0x00, 0xd9, 0xff, 0xff, 0xff, 0xfa, 0xff, 0xff, 0xff, 0xb1, 0xff, 0xff, 0xff, 0xde, 0xd3, 0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0x10, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x5f, 0x32, 0x2f, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x2f, 0x45, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x44, 0x69, 0x6d, 0x73, 0x5f, 0x31, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xdd, 0xff, 0xff, 0x30, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x83, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0d, 0x12, 0x28, 0x3b, 0x01, 0x00, 0x00, 0x00, 0x7c, 0xd9, 0xa2, 0x3e, 0x01, 0x00, 0x00, 0x00, 0x79, 0xfa, 0xab, 0xbe, 0x80, 0x01, 0x00, 0x00, 0x46, 0xff, 0x15, 0xce, 0xe9, 0x4c, 0x61, 0xb6, 0xb3, 0x80, 0x60, 0xdf, 0xef, 0x68, 0x40, 0x73, 0x67, 0xd6, 0xa8, 0xad, 0x4b, 0x12, 0x15, 0x8e, 0x78, 0xc2, 0x55, 0x65, 0x8f, 0x30, 0x63, 0x85, 0xe3, 0x70, 0x89, 0x75, 0xb4, 0x69, 0xc1, 0x7e, 0x66, 0x6e, 0x36, 0x15, 0x79, 0x34, 0x66, 0xc4, 0x80, 0x2e, 0x2c, 0xb3, 0xbd, 0xe2, 0x7b, 0x13, 0xe2, 0xca, 0x83, 0x71, 0x90, 0xc9, 0xe5, 0xb9, 0xe8, 0xf1, 0x8b, 0x0e, 0xb9, 0x1e, 0x49, 0xca, 0x3d, 0x1c, 0xa9, 0x66, 0x96, 0x27, 0xc4, 0x76, 0xd8, 0x5f, 0xad, 0x5f, 0x5f, 0x7a, 0x03, 0x7f, 0x78, 0xd0, 0x26, 0xd3, 0x38, 0xa6, 0xd1, 0xa6, 0xd6, 0x8b, 0xe7, 0xc8, 0x28, 0x46, 0xce, 0x9c, 0x60, 0xaa, 0xd9, 0x72, 0x14, 0x8b, 0xe5, 0x8e, 0xa2, 0x55, 0xd7, 0xca, 0x57, 0x3c, 0x5c, 0x8c, 0x53, 0xd1, 0x9a, 0x43, 0x8b, 0x90, 0x1f, 0xa4, 0x3b, 0x31, 0xcb, 0xdc, 0xd1, 0xac, 0x2c, 0xd5, 0xfb, 0xaf, 0xae, 0x41, 0x3f, 0xce, 0x31, 0x4d, 0xa1, 0x80, 0x5f, 0x4a, 0xdc, 0x9c, 0x29, 0xbc, 0x55, 0xe6, 0xc6, 0x5a, 0x3e, 0xea, 0x7e, 0x58, 0x97, 0x77, 0x82, 0x56, 0x31, 0xc0, 0x36, 0x45, 0x9b, 0x3e, 0xc9, 0xa6, 0xc1, 0x6f, 0x18, 0x79, 0x70, 0x52, 0x39, 0xa5, 0xa9, 0xd2, 0xab, 0x1e, 0x8c, 0xbb, 0xca, 0x2b, 0xb0, 0xc9, 0xd9, 0x35, 0x36, 0xb2, 0x93, 0xca, 0x2d, 0x47, 0x35, 0x9c, 0x38, 0xd0, 0x22, 0xde, 0x5b, 0xaf, 0x38, 0x17, 0xa5, 0x75, 0x31, 0x89, 0xb5, 0x6a, 0xb6, 0x74, 0xb6, 0x39, 0x23, 0xeb, 0xbd, 0x5d, 0x9c, 0x5f, 0x5c, 0x5e, 0x98, 0x3d, 0x60, 0x90, 0x21, 0x36, 0x27, 0x8e, 0x25, 0xb0, 0x82, 0x73, 0x19, 0x39, 0x25, 0x6f, 0xce, 0xa0, 0x6f, 0x77, 0x65, 0xe1, 0xb5, 0xdf, 0x2c, 0x40, 0x30, 0xda, 0x21, 0x97, 0x5c, 0x7a, 0xaf, 0x8d, 0x74, 0x2d, 0xd7, 0x73, 0x7c, 0x22, 0x4a, 0xaa, 0x66, 0xbb, 0xb5, 0xc7, 0x72, 0x7b, 0x14, 0x1c, 0x23, 0x2c, 0x54, 0xb6, 0x5a, 0x69, 0xab, 0x1b, 0x90, 0x50, 0x47, 0xf0, 0x15, 0x71, 0xee, 0xb1, 0xeb, 0x96, 0x61, 0xbd, 0x3f, 0xa6, 0x12, 0x96, 0x4d, 0x1e, 0x67, 0xf0, 0x17, 0x73, 0xaa, 0x72, 0x28, 0x55, 0x73, 0xe9, 0x0d, 0xd1, 0xcc, 0x84, 0x16, 0x0d, 0x76, 0xa3, 0xca, 0x11, 0x65, 0xaa, 0x3c, 0x00, 0x9d, 0x8a, 0x8f, 0xbb, 0xba, 0x91, 0x41, 0x0c, 0x75, 0xb8, 0x26, 0x13, 0x33, 0xe4, 0xc7, 0xd4, 0xce, 0x26, 0xd7, 0xae, 0xbd, 0x29, 0x2d, 0xb4, 0x2e, 0x3d, 0xd3, 0x38, 0x58, 0x22, 0xe9, 0x98, 0xe2, 0xc0, 0x82, 0x3d, 0x3a, 0xb0, 0xdb, 0x45, 0x57, 0x71, 0xeb, 0x53, 0xb5, 0x5b, 0xa0, 0x7b, 0x7b, 0xd7, 0x77, 0xaa, 0x62, 0x6a, 0x39, 0xec, 0x7b, 0x8d, 0xee, 0xd5, 0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0x10, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x5f, 0x31, 0x32, 0x2f, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x2f, 0x45, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x44, 0x69, 0x6d, 0x73, 0x5f, 0x31, 0x00, 0x00, 0x00, 0x8c, 0xdf, 0xff, 0xff, 0x30, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2d, 0xf6, 0xd5, 0x3b, 0x01, 0x00, 0x00, 0x00, 0x92, 0xc5, 0x75, 0x3f, 0x01, 0x00, 0x00, 0x00, 0xdb, 0x7a, 0x34, 0xbf, 0x80, 0x01, 0x00, 0x00, 0x80, 0x37, 0x61, 0x8c, 0x82, 0x4e, 0x65, 0x3e, 0x67, 0x29, 0x68, 0x5d, 0x90, 0x77, 0x70, 0x69, 0x57, 0x3a, 0x73, 0x94, 0x51, 0x5f, 0x91, 0x5f, 0x51, 0xc0, 0x1a, 0x6d, 0x3c, 0x4c, 0x70, 0x4c, 0x63, 0x82, 0x7a, 0x73, 0x67, 0x71, 0x89, 0x71, 0x89, 0x6f, 0x3b, 0x4b, 0x20, 0x36, 0x4b, 0x4b, 0x6a, 0x76, 0x9a, 0x31, 0x35, 0x58, 0x42, 0x7b, 0x70, 0x78, 0xa8, 0xb7, 0x70, 0x69, 0x5c, 0x62, 0x83, 0x64, 0x65, 0x96, 0x7e, 0x6f, 0x82, 0x63, 0x61, 0x1c, 0x5f, 0x73, 0x7a, 0x63, 0x6b, 0x84, 0x8f, 0x35, 0x55, 0x4c, 0x94, 0x5c, 0x66, 0x8d, 0x4c, 0x7e, 0x60, 0xa0, 0xa2, 0x66, 0x62, 0x60, 0x53, 0x8b, 0x70, 0x0e, 0x42, 0x66, 0x3b, 0x65, 0x72, 0x2e, 0x8b, 0x32, 0x93, 0x7e, 0x7a, 0x7e, 0x74, 0x58, 0x88, 0x79, 0x1d, 0x73, 0x89, 0x72, 0x8f, 0x89, 0x7b, 0xc2, 0x99, 0x67, 0x7e, 0x47, 0x54, 0x6f, 0x7c, 0x42, 0x64, 0xcb, 0x22, 0x75, 0x99, 0x45, 0x00, 0x44, 0x93, 0xaa, 0x24, 0x63, 0x71, 0x81, 0x49, 0xa9, 0x99, 0xbf, 0x42, 0x65, 0x40, 0x4c, 0x32, 0x64, 0x7b, 0xd4, 0x37, 0x6d, 0x4c, 0x53, 0x4e, 0xef, 0xb4, 0xc5, 0x1f, 0x4b, 0x8a, 0x74, 0x4b, 0x6b, 0x7f, 0x43, 0x3d, 0x6b, 0x5d, 0x44, 0x4c, 0x41, 0x7b, 0x38, 0x9a, 0xa0, 0x50, 0x48, 0x7c, 0x92, 0x66, 0x65, 0x5d, 0xa0, 0x63, 0x42, 0x80, 0x91, 0xae, 0xff, 0x4f, 0x63, 0x7d, 0x57, 0x4f, 0x9c, 0x71, 0x97, 0x70, 0x6a, 0x4e, 0x77, 0x43, 0x9b, 0x51, 0xda, 0x42, 0x69, 0x66, 0x7f, 0xa7, 0x89, 0x79, 0x44, 0x9a, 0x64, 0x83, 0x84, 0x2d, 0x41, 0x62, 0x98, 0x4a, 0x61, 0x7e, 0x62, 0x1d, 0x5a, 0x79, 0x85, 0x37, 0x90, 0x54, 0x98, 0x3f, 0x76, 0x46, 0x60, 0x82, 0x43, 0x8d, 0x62, 0x6a, 0x8a, 0x66, 0x65, 0x2f, 0x62, 0x4d, 0x4e, 0x5e, 0x4f, 0x2d, 0x25, 0x4f, 0x7d, 0x57, 0x55, 0xd0, 0x71, 0x51, 0x2a, 0x7b, 0x4c, 0x5e, 0x87, 0xa3, 0x64, 0x31, 0x71, 0x62, 0x90, 0x42, 0x67, 0x5f, 0x77, 0x74, 0xac, 0x43, 0x61, 0x92, 0x42, 0x74, 0x3b, 0x5e, 0x8c, 0x5c, 0x65, 0x57, 0x31, 0x9f, 0x54, 0x8e, 0x49, 0x85, 0x63, 0x79, 0x77, 0x67, 0x92, 0x60, 0xec, 0x83, 0x4d, 0x7a, 0x2b, 0x33, 0xae, 0x63, 0x78, 0x77, 0x63, 0x7e, 0x73, 0x76, 0x7b, 0x76, 0xa3, 0x80, 0x72, 0x53, 0x57, 0x82, 0x6e, 0x2f, 0xc8, 0x5c, 0x8a, 0x83, 0x95, 0x86, 0xac, 0x88, 0x79, 0x9a, 0x7c, 0x62, 0x45, 0x70, 0x1a, 0x46, 0x77, 0x43, 0x44, 0x54, 0x4c, 0x73, 0x68, 0x73, 0xd4, 0x71, 0x71, 0x56, 0x5f, 0x85, 0x44, 0x54, 0x80, 0x6a, 0x88, 0x7c, 0x4d, 0x98, 0xa8, 0x80, 0x81, 0x92, 0x60, 0x59, 0x4e, 0x72, 0x55, 0x74, 0xae, 0x3d, 0x72, 0xfe, 0xd7, 0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0x10, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x5f, 0x33, 0x2f, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x2f, 0x45, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x44, 0x69, 0x6d, 0x73, 0x5f, 0x31, 0x00, 0x00, 0x00, 0x00, 0x9c, 0xe1, 0xff, 0xff, 0x2c, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x44, 0xd9, 0x20, 0x3b, 0x01, 0x00, 0x00, 0x00, 0xd0, 0xa5, 0xa2, 0x3e, 0x01, 0x00, 0x00, 0x00, 0x05, 0xcb, 0x9d, 0xbe, 0x00, 0x06, 0x00, 0x00, 0xaa, 0x33, 0x9c, 0xc2, 0x41, 0xa9, 0x3d, 0x68, 0x50, 0xb9, 0x61, 0xb5, 0x91, 0x3b, 0xc4, 0xc1, 0x2b, 0xbd, 0x73, 0x80, 0x83, 0x90, 0x93, 0x45, 0x55, 0xaa, 0x5b, 0xbf, 0x70, 0x8e, 0x74, 0x6f, 0xbf, 0xc2, 0x76, 0x57, 0x66, 0xb3, 0x56, 0x36, 0x84, 0xac, 0x72, 0xa6, 0x95, 0x3c, 0x88, 0x7a, 0xb6, 0x62, 0x8a, 0x87, 0x46, 0x8b, 0x85, 0x38, 0xab, 0xc4, 0xa8, 0xab, 0x30, 0x29, 0x5a, 0xc0, 0x32, 0xc8, 0x62, 0x7e, 0x27, 0x97, 0x43, 0x5a, 0x93, 0x7e, 0x64, 0xbd, 0x53, 0xb5, 0xa3, 0x6c, 0x82, 0x2d, 0x9a, 0x6b, 0x5e, 0xb2, 0xc7, 0xb4, 0xb2, 0xb4, 0x78, 0xd1, 0x49, 0xa8, 0xaf, 0x72, 0x9e, 0x99, 0x33, 0xae, 0x2c, 0xc6, 0xcb, 0x65, 0xb4, 0x38, 0xc2, 0xc7, 0x66, 0xbe, 0x95, 0x81, 0xb3, 0xce, 0x93, 0x59, 0xa5, 0x2a, 0xcf, 0x8d, 0x92, 0x8e, 0xbb, 0xa1, 0xbf, 0x2f, 0x6d, 0x47, 0x84, 0xab, 0x31, 0x70, 0x30, 0x48, 0xca, 0xb2, 0xa3, 0xc0, 0xc2, 0x7f, 0x72, 0x28, 0xbe, 0x56, 0x50, 0x68, 0x6b, 0xbb, 0x9f, 0x2f, 0x8e, 0x8e, 0x3f, 0x60, 0xbd, 0x75, 0x47, 0x28, 0x7d, 0x5a, 0x5b, 0x45, 0x3b, 0xa3, 0xc0, 0x2e, 0x38, 0xb3, 0x7d, 0x30, 0x24, 0xa2, 0x66, 0x56, 0x6e, 0x54, 0x6e, 0x46, 0x1d, 0x53, 0x39, 0x5c, 0xaf, 0x50, 0xb9, 0x82, 0x83, 0x2d, 0x75, 0x93, 0x2f, 0x47, 0xaf, 0x3f, 0xcd, 0x35, 0x6c, 0xd0, 0x7f, 0x48, 0x85, 0x84, 0x7d, 0x7f, 0x6e, 0xb3, 0xc0, 0xda, 0x37, 0xa3, 0xbe, 0xd1, 0x4a, 0x9c, 0xbb, 0x68, 0xa9, 0x8f, 0x9d, 0x77, 0x2c, 0xc9, 0xc9, 0x9a, 0xce, 0x73, 0x3c, 0xc3, 0x8e, 0x72, 0x92, 0x22, 0x9a, 0x75, 0x73, 0x9d, 0x8c, 0x97, 0x36, 0x48, 0xcb, 0x84, 0x85, 0x55, 0x2e, 0x60, 0xc8, 0x74, 0xa5, 0x40, 0xa0, 0x54, 0x4f, 0x7b, 0xaa, 0xc3, 0x9a, 0xbe, 0x70, 0x21, 0xa4, 0xc4, 0xb2, 0x50, 0xb5, 0x76, 0x70, 0x91, 0x4f, 0xab, 0x86, 0xaf, 0x36, 0x95, 0x5d, 0xa4, 0x75, 0x9b, 0x69, 0x99, 0xaf, 0x46, 0xbe, 0xa7, 0x7f, 0x2c, 0x96, 0x5c, 0x2a, 0x4d, 0xc8, 0xd2, 0x8f, 0x26, 0x6a, 0xc4, 0x8e, 0x7e, 0x65, 0xb8, 0x85, 0x60, 0x92, 0xd0, 0x52, 0x6d, 0x7d, 0xca, 0xd3, 0x5f, 0x7d, 0xcf, 0x48, 0xa9, 0xa9, 0xa2, 0x7d, 0x54, 0xd1, 0x35, 0x3d, 0x76, 0x2e, 0xcd, 0x7e, 0xae, 0x7c, 0x6e, 0x92, 0xb7, 0x75, 0xb6, 0x53, 0x75, 0x92, 0x8c, 0xb6, 0x2c, 0xd9, 0x60, 0x5d, 0x8d, 0x3d, 0x6a, 0x94, 0x68, 0xbc, 0x3a, 0x33, 0x4a, 0x39, 0xcf, 0x39, 0x83, 0x8b, 0x5d, 0xa6, 0x61, 0x49, 0x3b, 0xc8, 0x4a, 0x4a, 0xca, 0x7a, 0x5e, 0x59, 0x76, 0x95, 0x52, 0x4e, 0x6e, 0x2f, 0x4a, 0x7f, 0x9e, 0x2d, 0xc7, 0xbe, 0x96, 0x74, 0x87, 0x90, 0x72, 0x90, 0x82, 0x2d, 0x57, 0xe6, 0xa7, 0x36, 0xa4, 0x9a, 0x35, 0xca, 0x2f, 0x58, 0xd2, 0x9a, 0xac, 0x68, 0x77, 0x40, 0x4e, 0xc6, 0x73, 0x62, 0x45, 0x73, 0x3f, 0x7b, 0x37, 0xbe, 0x5d, 0x57, 0x84, 0x60, 0x78, 0x93, 0x7e, 0xb0, 0x73, 0x9f, 0x98, 0x2f, 0x31, 0xac, 0x55, 0x5a, 0x86, 0xcf, 0x7b, 0xbc, 0x7f, 0xc2, 0xac, 0x50, 0x51, 0x68, 0x58, 0x00, 0xc2, 0x3a, 0x93, 0x7c, 0x6c, 0x8d, 0x5f, 0x47, 0x3d, 0xe2, 0xca, 0x73, 0x43, 0xb2, 0xdd, 0xab, 0xcd, 0x37, 0x38, 0x8a, 0x59, 0x62, 0x76, 0x2e, 0xb3, 0xb3, 0xae, 0x94, 0x60, 0x49, 0x5c, 0x52, 0x61, 0x66, 0x5e, 0x40, 0x60, 0x3b, 0x92, 0x96, 0x4e, 0xa0, 0x3c, 0xad, 0x4f, 0x44, 0xa4, 0x8a, 0xba, 0x70, 0x44, 0xb8, 0xd0, 0x7e, 0xc7, 0x92, 0xac, 0x70, 0x59, 0x4a, 0x34, 0x88, 0x35, 0x37, 0x82, 0x80, 0x6b, 0x55, 0x3a, 0x2e, 0x42, 0xb9, 0x75, 0xae, 0x4f, 0x74, 0xc3, 0x53, 0x8e, 0x2d, 0xba, 0x36, 0x72, 0xb6, 0x5d, 0x2f, 0xcb, 0x60, 0xa9, 0x52, 0x83, 0xa5, 0x46, 0x82, 0x6e, 0x70, 0x57, 0xdb, 0xb8, 0x74, 0x65, 0x6d, 0x42, 0x6b, 0x55, 0xcd, 0x9f, 0x3b, 0x64, 0x96, 0x79, 0x6d, 0x9f, 0x9b, 0xa1, 0xb0, 0x9f, 0x5b, 0x91, 0x72, 0x79, 0xbc, 0xb5, 0xaf, 0x77, 0x4c, 0x6d, 0x6b, 0x3e, 0x8f, 0x80, 0x71, 0x9c, 0x9a, 0x85, 0x93, 0x72, 0xbf, 0x53, 0x8a, 0x52, 0x9c, 0x40, 0x31, 0x4e, 0x5f, 0x90, 0xc9, 0x5e, 0x48, 0x56, 0xbb, 0x3f, 0x37, 0xb7, 0x5f, 0xcc, 0x3e, 0x9d, 0xa4, 0xb9, 0xc0, 0x5e, 0xaa, 0x63, 0x30, 0xa7, 0x5b, 0x5f, 0xbb, 0x47, 0x4a, 0x62, 0xad, 0x35, 0xb0, 0xac, 0xb5, 0x50, 0x6e, 0x3c, 0xa4, 0x3e, 0x66, 0xbb, 0xb2, 0x7b, 0x6b, 0xa7, 0x70, 0x41, 0x82, 0xce, 0x72, 0xa7, 0x5b, 0xc3, 0x2e, 0xb7, 0xb0, 0x75, 0x60, 0x31, 0x32, 0xc0, 0x92, 0xb1, 0x68, 0xc8, 0x9f, 0x39, 0x5e, 0x47, 0x6c, 0x75, 0xb3, 0x64, 0xa4, 0x87, 0xc1, 0x8d, 0x3c, 0x3d, 0xa4, 0x51, 0xcb, 0x3a, 0xc8, 0x4c, 0x87, 0xac, 0x63, 0x89, 0x53, 0x67, 0x96, 0xb4, 0xb0, 0x77, 0xab, 0xb2, 0x8f, 0x2d, 0xbb, 0x60, 0xd0, 0x7c, 0x38, 0xa3, 0xac, 0x4a, 0x6c, 0x5b, 0x62, 0xad, 0xaf, 0x6e, 0x35, 0x81, 0x74, 0x6f, 0x2e, 0x8c, 0x95, 0x6d, 0xd1, 0x94, 0x60, 0xad, 0xc7, 0x70, 0x40, 0x51, 0xba, 0x84, 0xaf, 0x7f, 0xb5, 0xc1, 0x85, 0x91, 0x7a, 0x6c, 0x9f, 0x3b, 0x7f, 0x67, 0x4f, 0x79, 0x98, 0xb3, 0xbf, 0x58, 0x8a, 0x69, 0x3f, 0x4c, 0xb7, 0x94, 0xb9, 0x6c, 0x6d, 0xa3, 0x7a, 0x78, 0xbb, 0x74, 0x77, 0xac, 0x4a, 0x8c, 0x5c, 0xb1, 0x9e, 0xc2, 0x9a, 0x58, 0xcb, 0xa2, 0x84, 0xac, 0xa5, 0x85, 0x4f, 0x93, 0xd9, 0x47, 0xa5, 0x89, 0xb6, 0x49, 0xb3, 0x53, 0x57, 0x5b, 0x18, 0x62, 0xb0, 0x5b, 0x73, 0x97, 0x88, 0xaf, 0xba, 0x58, 0xb5, 0xa8, 0x43, 0x48, 0x2f, 0xca, 0xb3, 0x8b, 0xc1, 0x88, 0xbf, 0x97, 0x6d, 0x92, 0x5c, 0x8e, 0x3f, 0x91, 0x87, 0x82, 0x96, 0xc1, 0xa2, 0xc9, 0xcb, 0x2e, 0xad, 0x40, 0x2d, 0x46, 0x31, 0x88, 0x29, 0xc9, 0x54, 0x8d, 0x9b, 0xad, 0xab, 0x70, 0x7f, 0xce, 0x61, 0x53, 0x4f, 0x5f, 0x62, 0xb6, 0x46, 0x4d, 0x46, 0x47, 0x74, 0x3c, 0xf0, 0x46, 0x9a, 0x4e, 0x64, 0x88, 0x7e, 0x58, 0xab, 0x65, 0xc2, 0x6d, 0xd0, 0xb8, 0x4c, 0x5b, 0xb1, 0x91, 0x8c, 0x59, 0x56, 0x6c, 0xcd, 0x3d, 0xe4, 0x91, 0xd4, 0x3f, 0x7c, 0xaa, 0xc3, 0xa7, 0x7a, 0x42, 0xcc, 0xb2, 0xb2, 0x6d, 0x6b, 0x90, 0xd8, 0xcb, 0xb4, 0x56, 0x2f, 0x61, 0x83, 0xd0, 0x84, 0xc3, 0x6a, 0xb1, 0xdd, 0x8a, 0x27, 0x9b, 0x4e, 0xbc, 0x51, 0x49, 0xbc, 0x32, 0x37, 0xa4, 0x66, 0xac, 0x6b, 0x71, 0x2c, 0xd6, 0x8d, 0x4b, 0x2e, 0x89, 0x56, 0xb4, 0x25, 0x53, 0x9b, 0x84, 0x27, 0x9d, 0x97, 0xb5, 0x58, 0x66, 0xb1, 0x60, 0x9e, 0x38, 0x21, 0x30, 0x45, 0xa3, 0xa2, 0x3c, 0x55, 0x73, 0x82, 0x44, 0x8b, 0xa9, 0xa5, 0x9f, 0x31, 0x94, 0xb8, 0x6b, 0x9c, 0x5f, 0x97, 0x51, 0x40, 0x8f, 0x55, 0x51, 0xb4, 0xc0, 0x6a, 0x65, 0x99, 0xbe, 0x7e, 0x70, 0x7a, 0x7a, 0x79, 0x36, 0x81, 0x4b, 0x7a, 0x97, 0xba, 0x9d, 0xbd, 0x7d, 0x39, 0x8b, 0x3b, 0xc1, 0x5d, 0x2f, 0x42, 0x2d, 0x37, 0x62, 0x64, 0x8e, 0x5e, 0x7b, 0x52, 0x62, 0x94, 0xcd, 0x80, 0xae, 0x4e, 0x61, 0x7e, 0x33, 0x82, 0x94, 0xa4, 0x98, 0xc4, 0x63, 0xbe, 0x3d, 0x9d, 0x2c, 0x88, 0x43, 0xc3, 0xde, 0xa5, 0x9d, 0x3a, 0x7a, 0x49, 0x89, 0xc4, 0xb3, 0xb5, 0x85, 0x68, 0x2f, 0xbc, 0xce, 0xa6, 0x78, 0x89, 0x42, 0x76, 0x3a, 0x5f, 0x8d, 0x6a, 0x4d, 0x7e, 0x43, 0x52, 0x80, 0xf6, 0x6e, 0x1f, 0x57, 0x6b, 0x1c, 0x23, 0x9c, 0x6f, 0x9d, 0x53, 0x44, 0x28, 0x64, 0x8f, 0xb4, 0x8c, 0x9d, 0xaf, 0x6d, 0xb9, 0x97, 0x24, 0xba, 0x2d, 0x68, 0xa3, 0xc8, 0x36, 0x70, 0x41, 0xaf, 0x88, 0xa7, 0x56, 0xb9, 0x32, 0x4c, 0x55, 0x50, 0x6c, 0x6f, 0x4a, 0x88, 0x9d, 0xb5, 0xa1, 0x93, 0x9d, 0x6f, 0x43, 0x88, 0x48, 0x91, 0x36, 0x42, 0x80, 0x47, 0x55, 0xb9, 0x88, 0xbf, 0x37, 0x51, 0x45, 0xc2, 0xd0, 0x61, 0x36, 0x5f, 0xc6, 0x2c, 0xc8, 0xb1, 0x41, 0x79, 0x51, 0x45, 0x1f, 0x2d, 0xff, 0x8a, 0x76, 0x4e, 0xa8, 0x3d, 0x5b, 0xc8, 0x7d, 0x3f, 0xd0, 0xdc, 0xcf, 0x8a, 0x3c, 0x8d, 0xc3, 0xba, 0x3e, 0x37, 0x7d, 0x79, 0x71, 0x42, 0xc6, 0x63, 0x43, 0xb9, 0x49, 0xaf, 0xde, 0x74, 0xd5, 0x99, 0x86, 0x59, 0xb4, 0xc7, 0x53, 0xc7, 0xda, 0x61, 0x41, 0x7f, 0x98, 0xbd, 0xd6, 0x72, 0xb2, 0x87, 0x59, 0xdb, 0xb0, 0x56, 0x9c, 0x83, 0xb6, 0x37, 0x50, 0x46, 0xba, 0x5b, 0x40, 0xc6, 0x44, 0xec, 0x6c, 0x2c, 0x55, 0x83, 0xae, 0x3a, 0xcf, 0x97, 0x76, 0xd8, 0x63, 0x45, 0x4c, 0x6a, 0x33, 0x74, 0x8b, 0x66, 0xb2, 0xa6, 0x3f, 0x63, 0x7c, 0x41, 0x58, 0xbd, 0x1b, 0xbe, 0xac, 0xce, 0x23, 0x51, 0x6a, 0xa7, 0x45, 0x8e, 0xc4, 0x69, 0x9e, 0x46, 0xb1, 0x4d, 0x3e, 0xe1, 0x87, 0xaa, 0xaa, 0x78, 0x1c, 0x3d, 0x64, 0x67, 0xb5, 0xbc, 0x50, 0xbf, 0xae, 0x9b, 0x8f, 0x5e, 0x45, 0x65, 0xba, 0xa7, 0x51, 0x35, 0x7a, 0xaf, 0x9d, 0xab, 0x72, 0x3b, 0xc7, 0x4b, 0x72, 0x8e, 0xbf, 0x4a, 0xbc, 0xb3, 0x8d, 0x26, 0xbf, 0x81, 0xb4, 0xc8, 0x5a, 0x40, 0x63, 0x5c, 0x2a, 0x4c, 0x4b, 0xbf, 0x2a, 0x26, 0xae, 0x5f, 0x90, 0x58, 0x6c, 0x49, 0x84, 0xc8, 0xaa, 0x56, 0x50, 0x76, 0x6c, 0x53, 0xa1, 0x4c, 0x7b, 0x62, 0x55, 0x3d, 0x63, 0x7f, 0x56, 0xb7, 0x37, 0x88, 0x7c, 0x4a, 0x4b, 0xac, 0x86, 0xa8, 0x27, 0x7e, 0x84, 0x8a, 0x30, 0xb2, 0x7e, 0x44, 0x4d, 0x9f, 0x79, 0xce, 0x4a, 0xc6, 0x27, 0xb7, 0x89, 0x7c, 0x7a, 0xae, 0x45, 0x9b, 0x4e, 0x3e, 0x21, 0xc1, 0x44, 0x85, 0x84, 0xb9, 0xb6, 0x56, 0x4a, 0xc7, 0x6a, 0x60, 0x20, 0xba, 0x78, 0xc8, 0xba, 0xb9, 0x67, 0x47, 0xc1, 0x90, 0xa7, 0x4e, 0x64, 0x60, 0xd0, 0xad, 0x99, 0x6c, 0x6f, 0x52, 0x42, 0x25, 0xb3, 0x28, 0xc9, 0xcb, 0x24, 0x8b, 0x70, 0x2d, 0x65, 0x83, 0x36, 0xa7, 0x61, 0x59, 0x55, 0x6c, 0x35, 0x88, 0xbb, 0x65, 0x71, 0x2e, 0xaa, 0x38, 0x64, 0x8a, 0x5e, 0x5d, 0x55, 0xc1, 0xa0, 0x6c, 0x41, 0x45, 0xb1, 0xc2, 0xcb, 0x3a, 0x60, 0xb1, 0xc5, 0xad, 0x5d, 0x6d, 0xab, 0x8d, 0x9d, 0xb7, 0xa3, 0x73, 0xb1, 0xb4, 0x77, 0x92, 0x21, 0x79, 0xac, 0x94, 0x93, 0xad, 0xab, 0x60, 0x57, 0x77, 0x95, 0xb0, 0xb8, 0x57, 0xaf, 0x3d, 0x98, 0x84, 0x9b, 0x7f, 0x92, 0x7c, 0xa0, 0x5e, 0xc5, 0xc4, 0x8a, 0x75, 0x54, 0x36, 0x4d, 0x7d, 0xd2, 0x9a, 0xbe, 0x32, 0x70, 0x57, 0x61, 0x45, 0xae, 0xa7, 0x84, 0x72, 0x80, 0x43, 0xc5, 0xce, 0x5a, 0x72, 0xcc, 0x91, 0x6c, 0x3e, 0x2f, 0x42, 0xc7, 0x6a, 0xcf, 0xb0, 0xad, 0x4f, 0x45, 0x7c, 0x47, 0x8a, 0xbc, 0x52, 0xa1, 0x30, 0x4e, 0x38, 0x6f, 0x2f, 0xca, 0x6f, 0xc7, 0xce, 0x8e, 0x5b, 0x40, 0x9a, 0x8e, 0x87, 0x93, 0x80, 0x23, 0x47, 0xb0, 0xaf, 0xb3, 0x32, 0x3c, 0x87, 0x48, 0x86, 0x97, 0xa2, 0x2e, 0x21, 0x58, 0x9b, 0xa9, 0xaa, 0xc6, 0xa6, 0x7c, 0xaa, 0x8a, 0xde, 0xff, 0xff, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x5f, 0x33, 0x2f, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x5f, 0x62, 0x69, 0x61, 0x73, 0x00, 0x00, 0x00, 0x00, 0x4c, 0xe5, 0xff, 0xff, 0x18, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x44, 0xd9, 0x20, 0x3b, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfb, 0xff, 0xff, 0xff, 0xf3, 0xff, 0xff, 0xff, 0xf6, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0xef, 0xff, 0xff, 0xff, 0x47, 0x00, 0x00, 0x00, 0xf8, 0xff, 0xff, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x27, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xef, 0xff, 0xff, 0xff, 0xf4, 0xff, 0xff, 0xff, 0xf5, 0xff, 0xff, 0xff, 0xf7, 0xff, 0xff, 0xff, 0xee, 0xff, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00, 0xef, 0xff, 0xff, 0xff, 0xec, 0xff, 0xff, 0xff, 0xf4, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x22, 0x00, 0x00, 0x00, 0xe5, 0xff, 0xff, 0xff, 0xfc, 0xff, 0xff, 0xff, 0xf3, 0xff, 0xff, 0xff, 0xed, 0xff, 0xff, 0xff, 0xdf, 0xff, 0xff, 0xff, 0xf2, 0xff, 0xff, 0xff, 0xf1, 0xff, 0xff, 0xff, 0xfb, 0xff, 0xff, 0xff, 0x19, 0x00, 0x00, 0x00, 0xf4, 0xff, 0xff, 0xff, 0x6e, 0xdf, 0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0x10, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x5f, 0x38, 0x2f, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x2f, 0x45, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x44, 0x69, 0x6d, 0x73, 0x5f, 0x31, 0x00, 0x00, 0x00, 0x00, 0x0c, 0xe9, 0xff, 0xff, 0x2c, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x8f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xe4, 0xc0, 0xa9, 0x3b, 0x01, 0x00, 0x00, 0x00, 0xeb, 0xdf, 0x14, 0x3f, 0x01, 0x00, 0x00, 0x00, 0x5b, 0x4e, 0x3d, 0xbf, 0x00, 0x06, 0x00, 0x00, 0x72, 0x8d, 0x7c, 0xc2, 0x62, 0x94, 0xa0, 0x8c, 0x89, 0xc7, 0xa0, 0xc2, 0x7c, 0x8b, 0x9d, 0x88, 0xa1, 0x82, 0x83, 0x5f, 0x58, 0x8b, 0x75, 0x73, 0x95, 0x67, 0xc1, 0x66, 0x52, 0x73, 0x80, 0x7c, 0x88, 0xae, 0x75, 0x9c, 0x7a, 0x9f, 0x71, 0x81, 0x85, 0xa5, 0x7e, 0x99, 0xa3, 0xad, 0xa3, 0x92, 0x71, 0x8c, 0x9e, 0x87, 0x76, 0x62, 0xa2, 0x5c, 0x7f, 0x5f, 0x8f, 0x9f, 0x50, 0xa8, 0x71, 0xa7, 0x7c, 0x88, 0x79, 0xa0, 0x87, 0xb7, 0x87, 0x63, 0x7b, 0x98, 0x81, 0xb0, 0x7e, 0xac, 0x64, 0x71, 0x9a, 0x69, 0x70, 0x7a, 0x7c, 0x70, 0xb5, 0xaf, 0xb8, 0x89, 0x9e, 0xac, 0x88, 0xbf, 0x70, 0xa4, 0x72, 0x74, 0x7a, 0x7f, 0x68, 0x83, 0x74, 0x7f, 0x84, 0x80, 0x6d, 0x62, 0x74, 0xad, 0x51, 0x8a, 0xa6, 0x71, 0x61, 0x65, 0x98, 0x9a, 0x76, 0x85, 0x66, 0x68, 0x80, 0x8a, 0x8c, 0x96, 0x86, 0x7b, 0x90, 0x6e, 0x61, 0x6a, 0x92, 0x6d, 0x73, 0x91, 0x84, 0xa0, 0x79, 0x87, 0x65, 0x80, 0x73, 0x8f, 0x97, 0xa5, 0x77, 0x90, 0x84, 0x81, 0x9d, 0xb3, 0x94, 0x63, 0x85, 0xa1, 0x48, 0x6e, 0x92, 0x6c, 0x7d, 0x71, 0xa7, 0x85, 0xbc, 0x91, 0x9c, 0x80, 0x6b, 0x46, 0x84, 0x86, 0x75, 0x7b, 0xb7, 0xa9, 0x63, 0x7b, 0x8f, 0xba, 0x2c, 0x4e, 0x8e, 0x9a, 0x6f, 0x55, 0xa6, 0x87, 0x7e, 0xa7, 0x72, 0x9c, 0xb7, 0x6b, 0x64, 0xb4, 0x18, 0xc2, 0xff, 0x83, 0xa6, 0x94, 0x9e, 0xc8, 0xc0, 0x6e, 0x72, 0xc4, 0x75, 0x95, 0xad, 0xc4, 0x65, 0x6f, 0x58, 0x87, 0x8d, 0x6f, 0xbb, 0x8e, 0x61, 0x7c, 0xc6, 0x66, 0x93, 0xa6, 0x23, 0x33, 0x84, 0x75, 0x85, 0x9d, 0x97, 0x87, 0x9c, 0x49, 0x66, 0x7c, 0x7c, 0x5c, 0xab, 0xb0, 0x7d, 0xcd, 0x43, 0x88, 0x72, 0x88, 0x6c, 0x85, 0x7b, 0xac, 0x6b, 0x68, 0xb0, 0x72, 0x96, 0x6c, 0x55, 0x6e, 0x9e, 0x5b, 0x67, 0x49, 0x7c, 0x8b, 0xab, 0x90, 0x58, 0x78, 0x74, 0x8d, 0xac, 0x70, 0x43, 0x6b, 0x45, 0xd0, 0xa1, 0x66, 0xb4, 0x9d, 0x70, 0x7f, 0x84, 0x6f, 0x98, 0x52, 0x96, 0x3a, 0x3c, 0xa5, 0x47, 0x86, 0x99, 0xa9, 0x23, 0x78, 0x7b, 0x9c, 0x7d, 0xae, 0x84, 0x8f, 0xaa, 0x6d, 0x41, 0x78, 0x7b, 0xab, 0x98, 0xb8, 0xd1, 0x90, 0xc1, 0x93, 0xa8, 0xb7, 0xb2, 0x94, 0x66, 0x8f, 0xd3, 0x48, 0xa9, 0x7d, 0x76, 0x5a, 0x9b, 0x96, 0x5e, 0xaa, 0x9b, 0x8b, 0x6d, 0x89, 0x6f, 0x81, 0x88, 0x72, 0x7b, 0x99, 0x7a, 0x8a, 0x78, 0x68, 0x80, 0xaf, 0x5e, 0x91, 0x6c, 0x94, 0x5d, 0x92, 0x96, 0x9a, 0x9f, 0x9a, 0xa3, 0xa9, 0x6b, 0x72, 0x73, 0x65, 0x91, 0xa4, 0x9f, 0x7d, 0x86, 0x71, 0x7c, 0x8e, 0x62, 0x58, 0x85, 0x91, 0x6c, 0x84, 0x9b, 0x75, 0x69, 0x7a, 0x87, 0x83, 0xaa, 0x6a, 0x7b, 0x99, 0x8b, 0xab, 0x90, 0x9c, 0xa1, 0x5b, 0xa8, 0x5d, 0xbc, 0xa5, 0x81, 0x91, 0x7f, 0x63, 0xaf, 0x71, 0xab, 0x5b, 0x66, 0x97, 0x6e, 0x97, 0xa2, 0xb2, 0x86, 0x6e, 0x74, 0xa0, 0x66, 0x9c, 0x8e, 0x92, 0x8f, 0x8c, 0x97, 0xa9, 0xbc, 0x61, 0x68, 0x58, 0x7f, 0x40, 0x85, 0x83, 0x77, 0x75, 0x72, 0xa9, 0x7a, 0x96, 0x9c, 0x81, 0xbb, 0xaa, 0x6a, 0x9b, 0xcb, 0xa6, 0x8d, 0x77, 0x9a, 0x79, 0x4c, 0xaa, 0x74, 0x85, 0x58, 0x74, 0x7a, 0xa1, 0xa1, 0x88, 0x72, 0x8c, 0xa8, 0x46, 0x68, 0xbf, 0x99, 0x9e, 0x63, 0xb0, 0x97, 0x89, 0x82, 0xc6, 0xbc, 0x8f, 0xbe, 0xaf, 0x9e, 0x8e, 0x9a, 0xcf, 0x6e, 0x5b, 0xc2, 0x5c, 0x6d, 0x5a, 0x83, 0x9b, 0xba, 0x72, 0x5c, 0xa9, 0xb8, 0x97, 0x89, 0x81, 0xa9, 0x85, 0xc3, 0x77, 0x92, 0x7f, 0x85, 0x86, 0x8f, 0x9f, 0x9f, 0x62, 0x84, 0xac, 0x61, 0x9b, 0x5b, 0x79, 0x41, 0xa9, 0xc4, 0x94, 0xa4, 0x6d, 0x99, 0xae, 0x9b, 0xa1, 0x69, 0x62, 0x91, 0xdd, 0xba, 0x5a, 0xfd, 0x83, 0x89, 0x7b, 0x6d, 0xbe, 0xbf, 0x98, 0x9d, 0xa1, 0x99, 0x74, 0x64, 0xa4, 0x9c, 0x58, 0x6c, 0x77, 0x8b, 0x8b, 0xa7, 0x8b, 0x96, 0x96, 0x6c, 0xb4, 0xa3, 0x9c, 0x7b, 0x65, 0x93, 0x69, 0xb2, 0x93, 0x68, 0x85, 0x85, 0x7d, 0x52, 0x7a, 0x7f, 0x6c, 0x89, 0x6c, 0x96, 0x97, 0xa6, 0x7e, 0xb7, 0x75, 0x77, 0x6a, 0x77, 0xac, 0x9b, 0xbc, 0x62, 0x67, 0x67, 0x8d, 0x7f, 0x88, 0x76, 0xbc, 0x7a, 0x9b, 0x8f, 0x6c, 0x5a, 0x6e, 0x94, 0x92, 0x6f, 0x9b, 0x6f, 0xb4, 0x98, 0x75, 0x70, 0x54, 0x9e, 0x92, 0x5f, 0x50, 0xa2, 0x69, 0x8b, 0x96, 0xb9, 0x9a, 0x81, 0xba, 0xa8, 0x7e, 0x8b, 0xb1, 0x3d, 0x80, 0x57, 0x97, 0x75, 0xa1, 0xa2, 0x9b, 0x8a, 0x90, 0xa6, 0xba, 0xb3, 0x83, 0x82, 0x6a, 0x88, 0xb0, 0x77, 0x75, 0x85, 0x7f, 0x82, 0x81, 0x82, 0x73, 0xa7, 0x6f, 0x82, 0xc2, 0x61, 0xb5, 0x38, 0xb2, 0xc4, 0xbf, 0x82, 0xa7, 0xa2, 0xdc, 0xa6, 0x76, 0xc3, 0x4b, 0xa7, 0x4c, 0x59, 0x77, 0x8a, 0x4d, 0x92, 0x8f, 0x87, 0x6b, 0x7e, 0x88, 0x56, 0xa3, 0x90, 0x86, 0x7e, 0xa6, 0xb1, 0x6a, 0x91, 0xa1, 0x79, 0x7d, 0x5e, 0x92, 0x76, 0x80, 0x61, 0xad, 0x71, 0x90, 0x69, 0x8e, 0x9a, 0x93, 0x84, 0xa2, 0xaf, 0x86, 0x6e, 0x6c, 0x8d, 0x62, 0x7f, 0x69, 0x8e, 0x73, 0x66, 0x86, 0x93, 0xa5, 0x41, 0x4b, 0x1f, 0xa6, 0x34, 0x83, 0xa6, 0xa3, 0x57, 0x95, 0xb9, 0x42, 0xab, 0x9e, 0xa2, 0xad, 0x47, 0x87, 0x63, 0x48, 0x6c, 0x8b, 0x82, 0x80, 0xa5, 0xae, 0xb3, 0x7c, 0x9f, 0x92, 0x5b, 0x66, 0x8c, 0x47, 0x64, 0xa6, 0x1a, 0x85, 0x9f, 0x69, 0x57, 0x74, 0xb0, 0x62, 0x79, 0x94, 0xae, 0xb5, 0x74, 0x99, 0x97, 0xbb, 0xa2, 0xa4, 0xc0, 0xb6, 0x6f, 0x99, 0x7d, 0xa4, 0x97, 0x9d, 0xa6, 0x6b, 0xc1, 0x44, 0xa0, 0xaf, 0x6b, 0x83, 0x94, 0x56, 0x2a, 0x6f, 0xa7, 0xd7, 0x8b, 0x50, 0x6a, 0x7f, 0xb5, 0xca, 0x82, 0x9e, 0x6b, 0xb2, 0x7e, 0xa9, 0xc7, 0x91, 0x4f, 0xa8, 0x8b, 0x71, 0xd3, 0x55, 0xb2, 0x83, 0x8b, 0x79, 0x89, 0x81, 0x8f, 0x69, 0x8c, 0x93, 0x96, 0xd7, 0xb7, 0x9d, 0xa1, 0xca, 0xa7, 0xa2, 0xae, 0x8c, 0x8d, 0xb1, 0xc3, 0xc9, 0x7b, 0x91, 0x93, 0x6a, 0xa2, 0x96, 0x96, 0x67, 0x8e, 0x9f, 0x6c, 0x83, 0xdc, 0x48, 0x62, 0x72, 0xd6, 0x71, 0xb3, 0x5b, 0x75, 0xbe, 0x8b, 0x83, 0x9b, 0xac, 0x75, 0x94, 0xab, 0x60, 0x9b, 0x7d, 0x93, 0x69, 0xcf, 0x7d, 0xa3, 0x93, 0xbd, 0x98, 0xaf, 0x7d, 0xb1, 0xb2, 0x7c, 0x8a, 0xc6, 0x91, 0x66, 0x7b, 0x8f, 0xad, 0x69, 0x5b, 0x90, 0x8b, 0x9b, 0xb6, 0x4f, 0x7f, 0x7a, 0xaa, 0x83, 0x73, 0xca, 0x94, 0x49, 0x90, 0x86, 0xb3, 0xbb, 0xa2, 0xac, 0x7e, 0x9a, 0xc8, 0x9f, 0xa7, 0x90, 0x85, 0x98, 0xa2, 0x82, 0x95, 0x79, 0x9b, 0x80, 0x83, 0xa0, 0x80, 0x8d, 0x8d, 0xa9, 0xb4, 0x90, 0xc0, 0x5e, 0x98, 0x4f, 0x7b, 0x8b, 0x86, 0x6d, 0x8d, 0x68, 0xb8, 0x9c, 0x7a, 0xaa, 0x74, 0x84, 0x7d, 0xbc, 0x8a, 0xac, 0x71, 0x82, 0x53, 0xb1, 0xb9, 0x8a, 0x51, 0x99, 0x8d, 0x7a, 0x77, 0xb6, 0x49, 0x53, 0x66, 0xaa, 0xc1, 0xa7, 0x76, 0x7c, 0x6d, 0xc1, 0x7e, 0xe5, 0x8d, 0x91, 0xa1, 0x73, 0x9e, 0xc4, 0x42, 0x5a, 0xab, 0x78, 0xb9, 0xb7, 0xc1, 0x6a, 0x97, 0xc0, 0x78, 0x9e, 0x7b, 0x83, 0xc8, 0xa3, 0x7a, 0x9d, 0x87, 0x6e, 0x63, 0x95, 0xbf, 0x69, 0xc1, 0xa1, 0x98, 0xb1, 0x90, 0x8e, 0xa5, 0xac, 0x72, 0x91, 0x96, 0x78, 0x85, 0x73, 0xc6, 0xc6, 0x7f, 0x51, 0xb7, 0xa7, 0x94, 0xb4, 0x73, 0xad, 0xbd, 0x79, 0x95, 0x71, 0x89, 0xaa, 0x7f, 0x9b, 0x75, 0xaa, 0x6f, 0x5c, 0x77, 0xb5, 0xab, 0x61, 0x5d, 0xb6, 0xaa, 0x84, 0x8c, 0xa7, 0x74, 0xb9, 0xa5, 0xd5, 0xa6, 0x7e, 0x82, 0x70, 0xab, 0x88, 0xaf, 0x78, 0xc2, 0x7c, 0x7e, 0xa7, 0x90, 0x9e, 0xb7, 0xa4, 0x97, 0x88, 0x8e, 0x9f, 0x89, 0x9f, 0x86, 0x9a, 0x66, 0xa9, 0x92, 0xb4, 0xd3, 0x93, 0x82, 0x70, 0xb3, 0x4b, 0xb8, 0x75, 0x71, 0xb2, 0x9d, 0x7b, 0xaa, 0x87, 0xbf, 0x96, 0x61, 0xcf, 0x7f, 0x06, 0x8c, 0xa2, 0x90, 0x73, 0x98, 0x86, 0x87, 0xa5, 0x9e, 0x9c, 0x9d, 0x7d, 0x99, 0x5f, 0x91, 0x45, 0x2c, 0x75, 0x79, 0x70, 0x68, 0x50, 0x84, 0x98, 0x76, 0xa5, 0xc1, 0x62, 0x8e, 0x60, 0x9c, 0x7d, 0xaf, 0x3d, 0x85, 0x89, 0xbd, 0x4b, 0xa4, 0xa5, 0x99, 0x69, 0xa5, 0x78, 0x70, 0xce, 0x8c, 0x67, 0x58, 0x5f, 0xae, 0x72, 0x70, 0x5c, 0x70, 0x39, 0x58, 0x99, 0x88, 0x41, 0x9c, 0x90, 0x3b, 0x72, 0x59, 0x00, 0x5e, 0xbc, 0xa0, 0x6c, 0x90, 0x46, 0x82, 0xaf, 0xa2, 0x1a, 0xd4, 0x41, 0x9c, 0xd6, 0xdd, 0xb0, 0xa1, 0xb5, 0xaa, 0xa0, 0x92, 0xbf, 0x32, 0x6a, 0x7f, 0x79, 0x77, 0x8c, 0x81, 0x80, 0x66, 0x75, 0x79, 0x9a, 0x7f, 0x64, 0x8a, 0x6d, 0x90, 0x9d, 0xa1, 0x78, 0x65, 0x94, 0x72, 0x90, 0x90, 0x64, 0x6f, 0x7a, 0x84, 0x9a, 0x87, 0xa5, 0x6d, 0x94, 0x7f, 0x69, 0xa8, 0x8b, 0x65, 0xad, 0x7c, 0x8e, 0x66, 0x7e, 0x68, 0xa3, 0x9f, 0x93, 0xa4, 0xb5, 0x76, 0x81, 0x79, 0xaa, 0x89, 0x9a, 0x75, 0x91, 0x72, 0x94, 0x8c, 0xa8, 0x9f, 0x66, 0xb3, 0xac, 0x55, 0x91, 0x98, 0xa7, 0xca, 0xb4, 0x80, 0xbf, 0x6f, 0xa3, 0x4d, 0xb3, 0xc9, 0x6f, 0x6d, 0x75, 0xa1, 0xc0, 0x89, 0x9e, 0x81, 0x78, 0x99, 0x66, 0xae, 0xcd, 0x66, 0x61, 0x70, 0x6f, 0xb1, 0x92, 0xb6, 0xa3, 0xaa, 0x63, 0x97, 0x51, 0xb0, 0xb3, 0x98, 0x7f, 0x8a, 0x67, 0xb9, 0x8c, 0x5d, 0xb4, 0xcb, 0x61, 0x52, 0x86, 0x94, 0x77, 0x8a, 0xc9, 0xaf, 0xd4, 0x86, 0x98, 0xc4, 0xa3, 0x9f, 0x90, 0xa2, 0x43, 0xa8, 0x59, 0xad, 0x75, 0x6e, 0x84, 0x80, 0x6d, 0xa1, 0x80, 0x59, 0x65, 0xa0, 0x88, 0x73, 0x58, 0xb8, 0x54, 0x90, 0xc5, 0x9f, 0x6e, 0x81, 0x6b, 0x72, 0xb3, 0x82, 0x7a, 0x9c, 0x78, 0x9b, 0x96, 0x59, 0x7d, 0x6b, 0x6e, 0x5d, 0xb7, 0x58, 0xaf, 0xa6, 0x81, 0x91, 0xac, 0x9c, 0x8e, 0xad, 0xb4, 0x85, 0x8e, 0x55, 0x73, 0x61, 0x88, 0x48, 0x7a, 0x4d, 0x5e, 0xa7, 0x6e, 0x93, 0x8a, 0x8f, 0x6a, 0x76, 0x9b, 0xaa, 0x97, 0x85, 0x85, 0x6c, 0x70, 0x61, 0xa3, 0x7b, 0x77, 0x51, 0x8e, 0x99, 0x8b, 0x67, 0x5b, 0x71, 0x88, 0x6e, 0x95, 0x9a, 0xa2, 0x8d, 0x7f, 0x75, 0x93, 0x82, 0x76, 0x9d, 0xa2, 0x8f, 0x76, 0x81, 0x79, 0x97, 0x76, 0x6d, 0x66, 0x75, 0x8b, 0xa3, 0x5f, 0x84, 0x72, 0x9e, 0x9a, 0xc7, 0x3d, 0x7d, 0x83, 0x93, 0x99, 0x81, 0x94, 0x98, 0xa6, 0x96, 0xa0, 0xa7, 0x70, 0x92, 0x98, 0x78, 0xbd, 0x60, 0x4e, 0xa8, 0x88, 0x51, 0x89, 0x42, 0x80, 0x92, 0x89, 0xcd, 0x8d, 0x82, 0x42, 0xd4, 0x87, 0xab, 0xcd, 0x95, 0x80, 0xab, 0x82, 0xb8, 0x92, 0x9c, 0x85, 0x7b, 0x65, 0x4e, 0x7f, 0x98, 0x7f, 0x5a, 0x6d, 0x81, 0x89, 0x81, 0x78, 0x98, 0x8c, 0x8a, 0x98, 0x6c, 0x6b, 0x8e, 0x69, 0x8c, 0x6f, 0x5e, 0xa2, 0x78, 0x68, 0x5e, 0x8d, 0x63, 0x69, 0x8b, 0x9d, 0x95, 0x97, 0x87, 0x64, 0x71, 0x6c, 0x87, 0xb2, 0x7d, 0x8e, 0x5c, 0x6c, 0x76, 0x87, 0xa8, 0x56, 0x6a, 0xfa, 0xe5, 0xff, 0xff, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x5f, 0x38, 0x2f, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x5f, 0x62, 0x69, 0x61, 0x73, 0x00, 0x00, 0x00, 0x00, 0xbc, 0xec, 0xff, 0xff, 0x18, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xe4, 0xc0, 0xa9, 0x3b, 0x80, 0x00, 0x00, 0x00, 0xef, 0xff, 0xff, 0xff, 0xee, 0xff, 0xff, 0xff, 0xf7, 0xff, 0xff, 0xff, 0xeb, 0xff, 0xff, 0xff, 0x05, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, 0xf5, 0xff, 0xff, 0xff, 0xec, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0xb3, 0xff, 0xff, 0xff, 0xee, 0xff, 0xff, 0xff, 0xf0, 0xff, 0xff, 0xff, 0xef, 0xff, 0xff, 0xff, 0xe8, 0xff, 0xff, 0xff, 0xfd, 0xff, 0xff, 0xff, 0xe6, 0xff, 0xff, 0xff, 0xf8, 0xff, 0xff, 0xff, 0xf2, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xff, 0xe4, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xf5, 0xff, 0xff, 0xff, 0xd2, 0xff, 0xff, 0xff, 0xf6, 0xff, 0xff, 0xff, 0xf2, 0xff, 0xff, 0xff, 0xda, 0xff, 0xff, 0xff, 0xd4, 0xff, 0xff, 0xff, 0xf0, 0xff, 0xff, 0xff, 0xdf, 0xff, 0xff, 0xff, 0xfa, 0xff, 0xff, 0xff, 0xe7, 0xff, 0xff, 0xff, 0xde, 0xe6, 0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0x10, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x5f, 0x31, 0x33, 0x2f, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x2f, 0x45, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x44, 0x69, 0x6d, 0x73, 0x5f, 0x31, 0x00, 0x00, 0x00, 0x7c, 0xf0, 0xff, 0xff, 0x2c, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x7b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x93, 0x45, 0x9f, 0x3b, 0x01, 0x00, 0x00, 0x00, 0xac, 0x57, 0x24, 0x3f, 0x01, 0x00, 0x00, 0x00, 0xee, 0xf4, 0x18, 0xbf, 0x00, 0x06, 0x00, 0x00, 0x83, 0x5f, 0x66, 0xa0, 0x51, 0x53, 0xe8, 0x56, 0xab, 0x4f, 0x79, 0x85, 0x83, 0x6b, 0x7f, 0xa4, 0x57, 0x77, 0x5d, 0x8d, 0x50, 0x72, 0xb4, 0x9b, 0x50, 0x99, 0x95, 0xbf, 0x78, 0x88, 0x4d, 0x6a, 0xd2, 0x56, 0x47, 0x4e, 0xc4, 0x4c, 0xa4, 0x4b, 0x93, 0x54, 0x8b, 0x89, 0x8b, 0x94, 0x98, 0xce, 0x8f, 0x55, 0x7b, 0x8f, 0x7f, 0x85, 0x7f, 0x7e, 0x7d, 0x63, 0x85, 0x75, 0xa1, 0xae, 0x6b, 0x74, 0x7a, 0x5c, 0x63, 0x59, 0x87, 0xaf, 0xe9, 0x69, 0x5c, 0xb3, 0xa3, 0xa0, 0x86, 0xa7, 0x8c, 0x7f, 0xa9, 0x51, 0x6f, 0x9e, 0x5f, 0xa1, 0xb7, 0x92, 0xac, 0x7b, 0x7f, 0xa9, 0xa2, 0x9e, 0x8a, 0x71, 0x97, 0x70, 0x53, 0x63, 0x47, 0x6d, 0x8a, 0xaf, 0x81, 0x29, 0x6b, 0xa2, 0x89, 0x7c, 0x74, 0xac, 0x66, 0x64, 0x5b, 0x63, 0x77, 0x52, 0x64, 0x8c, 0x82, 0x34, 0x3f, 0xdb, 0x73, 0x8d, 0x8c, 0x86, 0x6b, 0x9e, 0x70, 0x16, 0x61, 0xa9, 0xa9, 0x91, 0x6b, 0x86, 0xac, 0x5a, 0xbe, 0x69, 0xb9, 0x53, 0xa8, 0x6a, 0x69, 0x89, 0x82, 0x4f, 0x8a, 0x90, 0x8c, 0x4c, 0x71, 0x75, 0x35, 0x58, 0x72, 0x86, 0x3c, 0x64, 0x28, 0x60, 0x7a, 0x3c, 0x89, 0x5b, 0x98, 0x3b, 0x59, 0x53, 0x33, 0x83, 0x95, 0x51, 0x46, 0x47, 0x57, 0x55, 0x9e, 0x7c, 0x3a, 0x95, 0x41, 0x3b, 0x8c, 0xa2, 0x78, 0x75, 0x70, 0x5e, 0xb9, 0x63, 0x72, 0x96, 0x9c, 0x5f, 0x41, 0xaf, 0x76, 0x8a, 0x91, 0x71, 0xa3, 0x92, 0x6a, 0x9b, 0xc4, 0x6c, 0x64, 0x48, 0x24, 0x59, 0x8d, 0x4e, 0x63, 0x25, 0x3e, 0x75, 0x68, 0x31, 0x56, 0x87, 0x76, 0xaa, 0x5f, 0x52, 0x47, 0x86, 0x81, 0x77, 0x63, 0x69, 0x62, 0x58, 0xc7, 0x76, 0x32, 0x2b, 0x5a, 0x6f, 0x92, 0x69, 0x61, 0x94, 0xc0, 0xbd, 0x97, 0x60, 0x77, 0x8f, 0xa0, 0xa4, 0x8c, 0xa3, 0x86, 0x5e, 0x83, 0x7b, 0x95, 0x4d, 0x60, 0x95, 0xc6, 0x77, 0x7d, 0x41, 0x61, 0x96, 0x79, 0x58, 0x7e, 0x66, 0x64, 0x87, 0xe3, 0x6d, 0x50, 0x6b, 0xa9, 0x99, 0x6d, 0xbc, 0x80, 0x68, 0x77, 0xca, 0x75, 0x83, 0x7b, 0xa5, 0x62, 0x52, 0x7b, 0x9d, 0x8d, 0x95, 0xa4, 0x64, 0x47, 0x5d, 0x90, 0x9a, 0x8f, 0x92, 0x96, 0x74, 0x7b, 0x3b, 0x57, 0x5f, 0x64, 0x4f, 0x87, 0x6b, 0x64, 0x71, 0x82, 0x48, 0x57, 0x9e, 0x76, 0x86, 0x5e, 0x46, 0x9f, 0x8a, 0x7c, 0x57, 0x5c, 0x9f, 0x73, 0x92, 0x9d, 0x4e, 0x82, 0x6f, 0x85, 0x6b, 0x90, 0x84, 0x60, 0x60, 0x7b, 0x65, 0x86, 0x6a, 0x78, 0x6a, 0x7d, 0x79, 0x61, 0x53, 0x73, 0x86, 0x48, 0x4c, 0x60, 0x5f, 0x68, 0x5d, 0x67, 0x63, 0x7a, 0x77, 0x77, 0x7f, 0x6a, 0x88, 0x4e, 0x7e, 0x86, 0x62, 0x94, 0x59, 0x5a, 0x54, 0x58, 0x77, 0x52, 0x6b, 0x78, 0x56, 0x84, 0x95, 0x82, 0xa0, 0x85, 0x85, 0xb0, 0x5f, 0x98, 0xa0, 0x54, 0x7b, 0xae, 0xaa, 0xae, 0x7c, 0x86, 0x52, 0x95, 0x79, 0xa7, 0x7e, 0x74, 0x90, 0xb4, 0x75, 0x9d, 0x8d, 0xa6, 0x8c, 0x6f, 0x5b, 0x97, 0x4e, 0x64, 0x8f, 0x6f, 0x8c, 0x6d, 0x5b, 0xf1, 0x47, 0x77, 0x5e, 0x64, 0x69, 0x65, 0xa1, 0x70, 0x5d, 0x78, 0x99, 0x56, 0x6e, 0x44, 0x66, 0x75, 0x5e, 0x91, 0x6a, 0x80, 0x8c, 0x60, 0x65, 0x62, 0x88, 0x91, 0x8a, 0x90, 0x79, 0x6f, 0x73, 0x6e, 0x51, 0x7a, 0x3e, 0x8e, 0x8d, 0x80, 0x48, 0x93, 0x58, 0x61, 0x87, 0x5b, 0x5d, 0x77, 0x99, 0xb3, 0x97, 0x8b, 0x6b, 0x8b, 0x50, 0x85, 0x7c, 0x92, 0x76, 0x73, 0x72, 0x73, 0x58, 0x36, 0x98, 0x8b, 0x8c, 0x8f, 0x65, 0x54, 0x61, 0x6f, 0x8d, 0x67, 0x68, 0x94, 0x58, 0x63, 0x94, 0x97, 0x7b, 0xdf, 0x62, 0x54, 0xd6, 0x6b, 0x6b, 0x8b, 0xad, 0x6d, 0x55, 0x82, 0x6b, 0x97, 0x5a, 0x7e, 0x8e, 0x75, 0x98, 0x5a, 0x64, 0x72, 0x74, 0x80, 0x6d, 0x88, 0x7e, 0x7f, 0x45, 0x81, 0x66, 0x6f, 0xa3, 0x57, 0xa2, 0x9d, 0x82, 0x73, 0x95, 0x43, 0x73, 0x65, 0x7a, 0x6d, 0x84, 0x98, 0x6d, 0x80, 0xa4, 0x6c, 0x6e, 0x79, 0xca, 0x79, 0x71, 0xad, 0xa1, 0xa4, 0x61, 0x96, 0x88, 0x47, 0x6e, 0x71, 0x58, 0x4f, 0x6c, 0x5b, 0x71, 0x52, 0xab, 0x34, 0x63, 0x81, 0x66, 0x5f, 0x5c, 0x56, 0x6f, 0xad, 0x70, 0x5a, 0x86, 0xa2, 0xa9, 0x78, 0x61, 0x56, 0x6e, 0x5a, 0x6c, 0x95, 0x5e, 0x6d, 0x7f, 0x7f, 0x62, 0x5e, 0x42, 0x9e, 0x75, 0x5c, 0x67, 0x69, 0x99, 0x8a, 0x9b, 0x70, 0x5d, 0x66, 0x5a, 0x65, 0xa0, 0x4f, 0x8f, 0x84, 0x5f, 0x83, 0x82, 0x5a, 0x6d, 0x74, 0x96, 0x91, 0x5e, 0x5f, 0x97, 0x93, 0x63, 0x79, 0x5e, 0x6b, 0x4d, 0x5e, 0x95, 0x4f, 0xa1, 0x88, 0x84, 0x7d, 0x8e, 0x92, 0x8c, 0x7a, 0x4b, 0xbe, 0x68, 0x57, 0x20, 0x58, 0x74, 0x7a, 0x75, 0x7b, 0x6c, 0x77, 0x8a, 0xa3, 0x9d, 0xa3, 0x42, 0x68, 0x7b, 0x82, 0x6f, 0x9e, 0x99, 0x8a, 0x72, 0x65, 0x7c, 0xb0, 0x4d, 0x4a, 0x69, 0x5f, 0xae, 0x4e, 0xa3, 0x8e, 0xbd, 0x95, 0x8f, 0x66, 0x54, 0x8b, 0x74, 0x54, 0x6c, 0x3a, 0xb1, 0x84, 0x51, 0x9c, 0x6e, 0x4b, 0x6f, 0x4c, 0x62, 0x92, 0xb5, 0xa6, 0x4c, 0x79, 0x9f, 0xdc, 0x7b, 0x43, 0x61, 0xb0, 0x54, 0x85, 0x76, 0xb2, 0xa5, 0xa5, 0xb4, 0x88, 0x85, 0x99, 0x4f, 0x50, 0x52, 0x97, 0x97, 0x83, 0x70, 0x76, 0xa5, 0x4f, 0x91, 0x6b, 0x6e, 0x59, 0x50, 0x5e, 0x53, 0x9d, 0x62, 0xab, 0x4a, 0xa1, 0x5a, 0x57, 0x8a, 0x85, 0x97, 0x6e, 0xa4, 0x91, 0x66, 0x8b, 0x9f, 0x9a, 0x6c, 0x7f, 0x73, 0x31, 0x87, 0x98, 0x80, 0x72, 0x5c, 0x84, 0x94, 0x8b, 0x55, 0x69, 0x17, 0x4a, 0x93, 0x79, 0x70, 0x56, 0x85, 0x82, 0x21, 0x86, 0x63, 0x56, 0x64, 0x72, 0x9a, 0x66, 0x95, 0x6d, 0x91, 0x31, 0x6c, 0x99, 0xa8, 0x8f, 0x72, 0x8b, 0x7e, 0x83, 0x8a, 0x61, 0xaa, 0x99, 0x5a, 0x44, 0x9a, 0x7b, 0x73, 0x37, 0x81, 0x77, 0x62, 0x8a, 0x8e, 0x82, 0x47, 0x56, 0x4a, 0x47, 0x3d, 0x6c, 0x94, 0x79, 0x80, 0x83, 0x4c, 0x90, 0x79, 0x7c, 0x8a, 0x8d, 0x61, 0x4d, 0x4f, 0x8c, 0x87, 0x65, 0x5e, 0x71, 0x63, 0x97, 0x86, 0x41, 0x80, 0x76, 0x49, 0x7f, 0x6d, 0x73, 0x6f, 0x58, 0x72, 0x57, 0x96, 0x75, 0x4f, 0x7c, 0x52, 0x7f, 0x59, 0x51, 0x74, 0x79, 0x76, 0x7d, 0x48, 0x65, 0x60, 0x80, 0x8e, 0x86, 0x86, 0x4d, 0x53, 0x6d, 0x6d, 0x45, 0x86, 0x55, 0x85, 0x7e, 0x70, 0x91, 0x75, 0x57, 0x92, 0x8d, 0x81, 0x74, 0x5a, 0x76, 0x78, 0x93, 0x6f, 0x6b, 0x92, 0x94, 0x9b, 0x97, 0xa0, 0x7f, 0x9c, 0x75, 0x76, 0x9c, 0xaa, 0x92, 0x75, 0x69, 0x99, 0x2a, 0x6b, 0xbf, 0x91, 0x8d, 0x78, 0xa0, 0x88, 0x6d, 0xab, 0x90, 0x7f, 0xb6, 0xc2, 0x94, 0xa1, 0x77, 0x9e, 0x63, 0x90, 0x61, 0x51, 0x5f, 0x39, 0x4b, 0x95, 0xb2, 0x71, 0x69, 0x74, 0x7f, 0x8d, 0x56, 0x57, 0x57, 0x6c, 0x55, 0x73, 0x00, 0x7a, 0x66, 0x93, 0x31, 0x87, 0x89, 0x28, 0x3d, 0x7a, 0x88, 0x2f, 0x99, 0x61, 0x3d, 0x9e, 0x7d, 0x68, 0x60, 0xb1, 0x8f, 0x82, 0x64, 0x74, 0x4c, 0x5c, 0x62, 0x57, 0x5f, 0x4f, 0x5d, 0xb6, 0x8d, 0x66, 0x65, 0x60, 0x5d, 0x4c, 0x68, 0x55, 0x7a, 0x8c, 0x61, 0x50, 0x9f, 0x49, 0x4e, 0x91, 0xa4, 0x4f, 0x5e, 0x5c, 0x9a, 0x76, 0x97, 0x3b, 0x8d, 0x6f, 0x99, 0x79, 0xff, 0x7e, 0x3e, 0x4e, 0x6d, 0x36, 0xa2, 0x78, 0x7d, 0x3a, 0x4d, 0xab, 0x90, 0x86, 0x6e, 0xb2, 0xef, 0x4d, 0x78, 0x67, 0x89, 0x6e, 0xeb, 0x47, 0x7d, 0x75, 0x44, 0x91, 0x71, 0x6c, 0x94, 0x6b, 0x6f, 0x4a, 0x83, 0xb0, 0xb3, 0x89, 0xb6, 0x7f, 0xd7, 0x92, 0x5e, 0x86, 0x59, 0x77, 0x8a, 0x76, 0x4d, 0x54, 0x5e, 0x5e, 0x81, 0x6f, 0x65, 0x90, 0x70, 0x61, 0x8b, 0x45, 0x7d, 0x5a, 0x6c, 0x69, 0x9a, 0x82, 0x8d, 0x93, 0x81, 0x93, 0x7a, 0x87, 0x9a, 0x5c, 0xa0, 0x73, 0x55, 0x6d, 0x7a, 0x69, 0x85, 0x61, 0x65, 0x5b, 0x7d, 0x8a, 0x5f, 0x96, 0x5d, 0x66, 0x57, 0xb0, 0x7d, 0x7f, 0x5b, 0x3a, 0x6b, 0x51, 0x50, 0x79, 0x69, 0x66, 0x72, 0x83, 0x9d, 0x90, 0x92, 0xa6, 0x3d, 0x6a, 0x71, 0x4f, 0x65, 0x8a, 0x8f, 0x78, 0x65, 0x7c, 0x47, 0x4e, 0x69, 0x63, 0x79, 0x71, 0x53, 0x84, 0x85, 0x8d, 0x76, 0x79, 0x5a, 0x6b, 0x71, 0x7e, 0x85, 0x72, 0x61, 0x5f, 0x8e, 0x5d, 0x56, 0x7f, 0x56, 0x4e, 0x9b, 0x92, 0x6b, 0x8b, 0x73, 0x63, 0x79, 0x4a, 0x66, 0x96, 0x35, 0x41, 0x73, 0x9b, 0x69, 0x7c, 0x80, 0x85, 0x88, 0x8b, 0x94, 0x79, 0x81, 0x5d, 0x92, 0x62, 0x86, 0x81, 0x7e, 0x5d, 0x75, 0x89, 0x8f, 0x84, 0x7e, 0x6c, 0xf5, 0xa1, 0x6e, 0x78, 0x4e, 0x63, 0x85, 0x6a, 0x4e, 0x93, 0x78, 0x81, 0x83, 0x6b, 0x5d, 0x84, 0x79, 0x57, 0x6b, 0x85, 0x48, 0x32, 0xa1, 0xaf, 0x56, 0x68, 0x52, 0x4d, 0x77, 0x77, 0xa5, 0x79, 0x92, 0x5e, 0x64, 0x6d, 0x62, 0x3c, 0x6a, 0x79, 0x79, 0x75, 0x85, 0x40, 0xba, 0x9c, 0x59, 0xa4, 0x88, 0x6c, 0x94, 0x52, 0x71, 0x4f, 0x83, 0xc5, 0x5b, 0x8d, 0x76, 0xc3, 0xac, 0x77, 0x7c, 0x53, 0x9a, 0x90, 0x8c, 0x89, 0x3a, 0x9f, 0xbf, 0x78, 0x7e, 0x68, 0x66, 0x5c, 0x5e, 0x8b, 0x64, 0x7c, 0x79, 0xb2, 0x88, 0x9b, 0x6b, 0xa3, 0x98, 0x66, 0x62, 0xaa, 0xa5, 0x72, 0x70, 0x42, 0x70, 0x41, 0x62, 0x7b, 0x5c, 0x65, 0xd6, 0x6b, 0x65, 0x7c, 0x74, 0x46, 0xaa, 0x8d, 0x5f, 0x64, 0x9b, 0xbe, 0xba, 0x41, 0x91, 0x87, 0x8f, 0x64, 0x8c, 0x8f, 0x89, 0x69, 0xa7, 0xa1, 0x66, 0x85, 0x4b, 0x87, 0x9e, 0x70, 0x5c, 0x9e, 0x91, 0x7c, 0x93, 0x6e, 0x65, 0x71, 0x65, 0xa3, 0xa9, 0x8f, 0x62, 0x0e, 0x6a, 0x6a, 0x8a, 0xe5, 0x6b, 0x5f, 0xa3, 0x79, 0xb4, 0x76, 0xdf, 0xa1, 0x58, 0x78, 0xaa, 0x8d, 0x8e, 0xb3, 0xbd, 0x81, 0xa2, 0x58, 0x69, 0x97, 0x52, 0xa2, 0x5f, 0x7c, 0x6f, 0x5e, 0x6b, 0x9a, 0x94, 0x78, 0x9a, 0x7e, 0xa3, 0x64, 0x81, 0x87, 0x5d, 0x7c, 0x7e, 0x68, 0xa0, 0x57, 0xc0, 0xbc, 0x92, 0x97, 0xdb, 0x5d, 0xd1, 0x72, 0x5e, 0xa5, 0x95, 0x70, 0x30, 0xa6, 0x58, 0x5f, 0xaa, 0x1f, 0x4d, 0x6a, 0x65, 0x62, 0x5e, 0x85, 0x9b, 0xb8, 0x9b, 0x80, 0x6b, 0x53, 0x88, 0x86, 0x77, 0x89, 0x65, 0x92, 0x3e, 0x96, 0x79, 0x85, 0xad, 0x2f, 0x8f, 0xa0, 0x76, 0x69, 0x6e, 0x85, 0x83, 0x8c, 0x80, 0x7f, 0x94, 0x5a, 0x9c, 0x53, 0x74, 0x95, 0xab, 0x89, 0x7c, 0xa1, 0x86, 0x83, 0x8a, 0x6a, 0x97, 0x96, 0xd1, 0x87, 0xa0, 0x8b, 0x7a, 0x68, 0x53, 0x5d, 0xa0, 0x94, 0x67, 0x4b, 0x76, 0xa4, 0xb0, 0x84, 0x91, 0x61, 0xaf, 0x69, 0x6b, 0x71, 0x7f, 0x48, 0xb7, 0x7b, 0x80, 0x2a, 0x74, 0x97, 0xe6, 0x5a, 0xb3, 0x98, 0xd8, 0x84, 0x9a, 0xae, 0x6c, 0x73, 0x51, 0x7a, 0x6d, 0x6e, 0x67, 0x61, 0x60, 0x62, 0xa4, 0x87, 0x5b, 0x90, 0x97, 0x72, 0x78, 0x99, 0x64, 0x77, 0x82, 0x73, 0x84, 0x6b, 0x59, 0x6c, 0x72, 0x7e, 0x9a, 0x6a, 0x77, 0xa2, 0x74, 0x58, 0x69, 0x81, 0x75, 0x83, 0x5d, 0x94, 0x67, 0x73, 0x5f, 0x87, 0x90, 0x7e, 0x55, 0x78, 0x62, 0x53, 0x6d, 0x61, 0x6a, 0xed, 0xff, 0xff, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x5f, 0x31, 0x33, 0x2f, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x5f, 0x62, 0x69, 0x61, 0x73, 0x00, 0x00, 0x00, 0x2c, 0xf4, 0xff, 0xff, 0x18, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x93, 0x45, 0x9f, 0x3b, 0x80, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0xe2, 0xff, 0xff, 0xff, 0xce, 0xff, 0xff, 0xff, 0xf6, 0xff, 0xff, 0xff, 0xf8, 0xff, 0xff, 0xff, 0xf6, 0xff, 0xff, 0xff, 0xf5, 0xff, 0xff, 0xff, 0x22, 0x00, 0x00, 0x00, 0xe6, 0xff, 0xff, 0xff, 0xf8, 0xff, 0xff, 0xff, 0xf8, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf9, 0xff, 0xff, 0xff, 0xd8, 0xff, 0xff, 0xff, 0xe3, 0xff, 0xff, 0xff, 0xd7, 0xff, 0xff, 0xff, 0xd7, 0xff, 0xff, 0xff, 0xe4, 0xff, 0xff, 0xff, 0x0e, 0x00, 0x00, 0x00, 0xf4, 0xff, 0xff, 0xff, 0xf1, 0xff, 0xff, 0xff, 0x02, 0x00, 0x00, 0x00, 0xfd, 0xff, 0xff, 0xff, 0xeb, 0xff, 0xff, 0xff, 0xdb, 0xff, 0xff, 0xff, 0xee, 0xff, 0xff, 0xff, 0x04, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xee, 0xff, 0xff, 0xff, 0x4e, 0xee, 0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0x10, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x5f, 0x34, 0x2f, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x2f, 0x45, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x44, 0x69, 0x6d, 0x73, 0x5f, 0x31, 0x00, 0x00, 0x00, 0x00, 0xec, 0xf7, 0xff, 0xff, 0x2c, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xb1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x4f, 0x05, 0x43, 0x3b, 0x01, 0x00, 0x00, 0x00, 0xf2, 0x61, 0x6e, 0x3e, 0x01, 0x00, 0x00, 0x00, 0xcd, 0xa9, 0x06, 0xbf, 0x00, 0x03, 0x00, 0x00, 0xf1, 0x9e, 0xd5, 0x9e, 0x5c, 0xb9, 0xea, 0x73, 0xf8, 0xc0, 0x69, 0x7f, 0xdd, 0xf5, 0xaf, 0xb7, 0x5d, 0x27, 0x83, 0xad, 0x67, 0x6f, 0xed, 0x46, 0x68, 0xd3, 0xae, 0xd4, 0xc4, 0xd5, 0x8f, 0xd0, 0x6f, 0xbd, 0xd1, 0xcf, 0xe4, 0xc3, 0xe4, 0xca, 0xb8, 0xd5, 0x7b, 0x84, 0x9f, 0xd5, 0xda, 0xcf, 0xdf, 0xc4, 0x6a, 0xb6, 0xee, 0xcc, 0xa4, 0xc3, 0x73, 0x74, 0x9c, 0xa7, 0xbb, 0xe4, 0xf5, 0xaa, 0x73, 0xe2, 0xc4, 0xf1, 0x6e, 0xa6, 0x7c, 0x93, 0xc5, 0x90, 0x90, 0xd5, 0x6f, 0x81, 0x7d, 0x6b, 0x6d, 0x95, 0xc9, 0x5c, 0x74, 0x62, 0xd1, 0x65, 0x5d, 0xac, 0xda, 0xe5, 0x92, 0xd3, 0xd5, 0x88, 0xd4, 0xcd, 0x7c, 0x7a, 0xbd, 0xaa, 0x9d, 0xd1, 0xb7, 0xa5, 0x7d, 0x8f, 0x86, 0xa8, 0x8a, 0xd1, 0xd0, 0xf8, 0x92, 0x93, 0xdc, 0x70, 0x72, 0xb1, 0xde, 0x97, 0xb8, 0xf2, 0xf6, 0x69, 0x9b, 0x7a, 0x6d, 0xf2, 0xc5, 0xd7, 0xe8, 0xd0, 0x65, 0xe9, 0x61, 0x71, 0xe1, 0x5f, 0x7e, 0x6b, 0xd8, 0x6c, 0xd3, 0xdb, 0xb7, 0xbf, 0x8c, 0x80, 0xd7, 0xf1, 0x99, 0x87, 0x7c, 0x9c, 0x7f, 0x90, 0x7b, 0xc1, 0xbb, 0x6b, 0xf1, 0xd2, 0xcf, 0xbe, 0x5d, 0x9d, 0xb0, 0x6e, 0xe5, 0xd9, 0xc9, 0x81, 0xa5, 0xbe, 0xba, 0x81, 0xa8, 0x75, 0xe8, 0x9a, 0x94, 0x8a, 0xe2, 0x98, 0x9d, 0x6c, 0x8a, 0xe7, 0xde, 0xca, 0xeb, 0xa3, 0x79, 0xb2, 0xc5, 0x83, 0xd3, 0x90, 0xac, 0xd1, 0xc1, 0xa1, 0xba, 0x79, 0xe1, 0x66, 0x72, 0xdb, 0xba, 0xde, 0xbc, 0x92, 0xcf, 0x97, 0x7f, 0x9e, 0xf0, 0xc7, 0x7d, 0xe4, 0x92, 0x96, 0xe7, 0xec, 0xeb, 0xce, 0xe7, 0xff, 0x78, 0xb3, 0xa5, 0x94, 0xf9, 0xdb, 0xf7, 0xc5, 0x91, 0xc6, 0xd5, 0xaa, 0x61, 0x7a, 0xce, 0xbd, 0xd3, 0xe2, 0xa5, 0xe9, 0x82, 0x85, 0xb7, 0xe4, 0x77, 0xe9, 0xae, 0xe1, 0xb9, 0xa4, 0x83, 0x81, 0x80, 0xb2, 0x78, 0xf0, 0xc6, 0x98, 0xb0, 0xd9, 0x75, 0x80, 0xcf, 0xf5, 0xb1, 0x68, 0x97, 0x70, 0xaa, 0x67, 0x69, 0xd8, 0xb7, 0xdc, 0x9e, 0x72, 0xa2, 0x75, 0xf5, 0xc8, 0xdb, 0x5a, 0xb1, 0xa5, 0x85, 0xb1, 0xca, 0xb1, 0xd8, 0x56, 0xe1, 0xe8, 0xbd, 0xbf, 0xe7, 0x4e, 0x80, 0x85, 0x97, 0xa8, 0xc5, 0x00, 0x76, 0xfb, 0x95, 0xc3, 0xd2, 0xee, 0xe6, 0xe4, 0x79, 0x79, 0x84, 0xef, 0xbe, 0x84, 0xf6, 0x97, 0xd5, 0xd1, 0xf7, 0xf6, 0x78, 0xe8, 0x9d, 0xa0, 0xdc, 0xf2, 0xf1, 0xbc, 0x95, 0xfe, 0xd6, 0xf5, 0x87, 0x84, 0xa6, 0xc6, 0xf3, 0xef, 0x97, 0xb5, 0x95, 0x72, 0xb2, 0xe5, 0x64, 0xef, 0x69, 0xfb, 0x84, 0xec, 0xb9, 0xbd, 0xd9, 0x6d, 0xba, 0x93, 0xb7, 0xde, 0xa2, 0xc0, 0xe9, 0x9e, 0xe9, 0x8a, 0xb2, 0xa4, 0x68, 0xe5, 0x7b, 0x8f, 0xa1, 0xe3, 0xfc, 0x80, 0xc0, 0xbf, 0xd7, 0x6f, 0x91, 0xad, 0x85, 0xc2, 0xd1, 0x6d, 0xba, 0x80, 0x9e, 0xc8, 0xe7, 0xd0, 0x6c, 0x71, 0xb6, 0xae, 0xbb, 0xbe, 0xbc, 0x67, 0xbc, 0xce, 0xe2, 0x9a, 0x9f, 0xc6, 0xa2, 0x99, 0x85, 0xb6, 0x95, 0xde, 0x93, 0xac, 0x83, 0xb5, 0xc8, 0xab, 0x61, 0xc5, 0x68, 0xae, 0x71, 0xd7, 0x6f, 0x9e, 0x98, 0x84, 0x9b, 0xa5, 0x5c, 0xec, 0xe4, 0xdf, 0xcb, 0xa2, 0x62, 0xd6, 0xb2, 0x97, 0xa9, 0x5e, 0x9b, 0xea, 0x8c, 0x8d, 0x67, 0xaa, 0x92, 0x73, 0x94, 0x8b, 0x75, 0x82, 0xbf, 0xce, 0xe3, 0x68, 0xf9, 0x78, 0xd4, 0x72, 0xea, 0xc7, 0x5e, 0xbc, 0x6f, 0xb0, 0xbe, 0xc6, 0x99, 0xfc, 0xb9, 0x6d, 0x81, 0x66, 0xba, 0xcc, 0xdc, 0xec, 0x72, 0x6d, 0x80, 0xbd, 0xb0, 0x87, 0x93, 0xa0, 0x92, 0xdd, 0x7f, 0xd2, 0x7a, 0x8a, 0xef, 0xc5, 0x6f, 0x73, 0xee, 0x85, 0x7a, 0xdf, 0xa9, 0xad, 0x9a, 0xb1, 0xb6, 0x8d, 0x69, 0x7f, 0xaf, 0x9d, 0xcc, 0x75, 0x9b, 0xec, 0xe5, 0xb6, 0x6a, 0x89, 0xc4, 0x9c, 0x7e, 0xf3, 0xab, 0x61, 0xe1, 0xbe, 0xd1, 0x78, 0xeb, 0xce, 0x82, 0x75, 0xa7, 0x64, 0xa8, 0xe3, 0x8c, 0xda, 0x93, 0x92, 0x8c, 0x83, 0x7d, 0xd4, 0x7e, 0x6a, 0xb7, 0x77, 0x5c, 0x7c, 0x90, 0xf2, 0xd7, 0xa1, 0xa5, 0x80, 0x97, 0x97, 0x8f, 0xf1, 0x79, 0xa4, 0xaf, 0x87, 0xcd, 0x84, 0xb2, 0xea, 0xa5, 0x5f, 0x67, 0xef, 0xd5, 0xc1, 0x74, 0xaa, 0xc7, 0x73, 0xaa, 0x91, 0xc3, 0x9e, 0x9f, 0xc4, 0xe2, 0x69, 0x9c, 0x71, 0xc7, 0x5e, 0xae, 0xfb, 0xe2, 0x71, 0xa2, 0x85, 0x73, 0xb7, 0xb6, 0xf3, 0xd2, 0x69, 0xdc, 0xef, 0x81, 0x62, 0x92, 0x78, 0xb7, 0xe0, 0xda, 0xb5, 0x77, 0x74, 0x5e, 0xbb, 0xe1, 0x86, 0x7c, 0x86, 0xc0, 0x9b, 0x81, 0xc9, 0x80, 0x60, 0xcf, 0xa9, 0x76, 0x6a, 0x9b, 0x8c, 0xb4, 0x9e, 0xba, 0xe3, 0xab, 0xad, 0x7e, 0x95, 0xd9, 0xdc, 0xbd, 0xb1, 0xd5, 0xb3, 0x91, 0xe0, 0x97, 0x80, 0x86, 0x8d, 0x9f, 0x8a, 0x9e, 0x69, 0xbd, 0x6e, 0xa3, 0xc9, 0x6d, 0x91, 0x80, 0xc7, 0x9f, 0xbd, 0xb4, 0xb1, 0x54, 0xa7, 0xe7, 0xcd, 0x81, 0xb8, 0xc7, 0xd5, 0x53, 0xac, 0xa8, 0xa7, 0xa6, 0xcd, 0x77, 0xf1, 0xd2, 0x92, 0xd7, 0x65, 0x9f, 0xc2, 0xa3, 0xd0, 0xf2, 0xd5, 0xe3, 0xa4, 0x85, 0x91, 0x57, 0xb5, 0xab, 0x82, 0x8b, 0x8f, 0xc0, 0x7c, 0x6b, 0x55, 0xbe, 0xeb, 0xae, 0xc8, 0xc5, 0xb8, 0xe5, 0xf4, 0xad, 0x85, 0x74, 0x96, 0xc0, 0xe0, 0x83, 0xaf, 0xdc, 0x5c, 0x62, 0xb6, 0xac, 0xcb, 0xa8, 0xde, 0xc9, 0x64, 0x70, 0x6b, 0xa3, 0xcb, 0xce, 0xb7, 0xa1, 0xe8, 0xca, 0x70, 0xb3, 0xf0, 0xe5, 0x92, 0x84, 0xb1, 0xe6, 0xa9, 0xa0, 0xb4, 0xa4, 0xe0, 0xda, 0xf1, 0xff, 0xff, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x5f, 0x39, 0x2f, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x5f, 0x62, 0x69, 0x61, 0x73, 0x00, 0x00, 0x00, 0x00, 0x9c, 0xf8, 0xff, 0xff, 0x18, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x3e, 0x46, 0xa1, 0x3b, 0x20, 0x00, 0x00, 0x00, 0xfb, 0xff, 0xff, 0xff, 0xf9, 0xff, 0xff, 0xff, 0xfa, 0xff, 0xff, 0xff, 0xfc, 0xff, 0xff, 0xff, 0xf5, 0xff, 0xff, 0xff, 0xd7, 0xff, 0xff, 0xff, 0xea, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xff, 0x5e, 0xf2, 0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0x10, 0x00, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x5f, 0x31, 0x34, 0x2f, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x2f, 0x45, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x44, 0x69, 0x6d, 0x73, 0x5f, 0x31, 0x00, 0x00, 0x00, 0xfc, 0xfb, 0xff, 0xff, 0x2c, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x6d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x1c, 0x07, 0xa5, 0x3b, 0x01, 0x00, 0x00, 0x00, 0x25, 0x08, 0x3c, 0x3f, 0x01, 0x00, 0x00, 0x00, 0x05, 0xbc, 0x0c, 0xbf, 0x00, 0x03, 0x00, 0x00, 0x7b, 0x24, 0x38, 0x83, 0x2a, 0x7d, 0x80, 0x59, 0x38, 0x79, 0x93, 0x7c, 0x40, 0x5c, 0xba, 0x7d, 0x64, 0x5e, 0x70, 0x54, 0x74, 0x28, 0x6a, 0x7c, 0x8d, 0x87, 0x9e, 0x7e, 0xa1, 0x7c, 0x4d, 0x46, 0x6f, 0x6d, 0x6b, 0x6e, 0x2a, 0x52, 0x4a, 0x6e, 0x42, 0x6c, 0x4c, 0x52, 0x8c, 0x5e, 0x43, 0x7b, 0x59, 0x6a, 0x81, 0x80, 0x7e, 0x98, 0x1b, 0x7e, 0x46, 0x88, 0xac, 0x67, 0x97, 0x47, 0x8e, 0x80, 0x3f, 0x40, 0x19, 0x58, 0x3b, 0x40, 0x69, 0x64, 0x48, 0x66, 0x8a, 0x51, 0x52, 0x77, 0x8d, 0x68, 0x57, 0x64, 0x7e, 0x60, 0x56, 0x70, 0x73, 0x90, 0x83, 0x32, 0x91, 0x4a, 0x85, 0x8c, 0x85, 0x6b, 0xa5, 0x73, 0xa0, 0x70, 0xac, 0xad, 0x55, 0x6e, 0x67, 0x80, 0xa5, 0x9e, 0xbe, 0x6a, 0x86, 0x3f, 0x8a, 0x88, 0x91, 0x80, 0x3e, 0x56, 0x69, 0x38, 0x59, 0x94, 0xae, 0x7c, 0x60, 0x7b, 0x55, 0xa7, 0x6b, 0x79, 0x9c, 0x3b, 0xa4, 0x66, 0x87, 0x6a, 0xab, 0x8d, 0x6d, 0xb1, 0x88, 0x4c, 0x62, 0x64, 0x6b, 0x29, 0x49, 0xaf, 0x51, 0x65, 0xff, 0x71, 0x52, 0x59, 0x91, 0xa1, 0x4d, 0x8e, 0x7d, 0x5b, 0x34, 0xb8, 0xdd, 0x65, 0xb3, 0xc2, 0x6d, 0x56, 0x63, 0x64, 0xae, 0xb6, 0xf0, 0x68, 0x5a, 0x76, 0x5d, 0x93, 0xde, 0x4f, 0x7f, 0x92, 0xb2, 0x77, 0x64, 0x16, 0x5e, 0x95, 0xa6, 0x5b, 0xc6, 0x9d, 0x5c, 0x6c, 0x57, 0x42, 0x83, 0x6b, 0x74, 0x51, 0x75, 0x60, 0x4e, 0x67, 0x69, 0x76, 0x5f, 0x67, 0x42, 0x30, 0x41, 0x5d, 0x70, 0xb2, 0x34, 0x7a, 0x5d, 0x2e, 0x50, 0x00, 0xad, 0x4d, 0x98, 0x58, 0x40, 0x8e, 0x68, 0x7c, 0x51, 0x8f, 0x63, 0x71, 0x83, 0x6e, 0x5e, 0x60, 0x69, 0x72, 0x67, 0x6a, 0x4e, 0x55, 0x78, 0x55, 0x9c, 0xb2, 0x7f, 0x67, 0x66, 0x5b, 0x62, 0x3e, 0x7f, 0x83, 0x41, 0x83, 0x3b, 0x8e, 0x8b, 0x82, 0x77, 0x7e, 0x8b, 0x55, 0x86, 0x40, 0x4f, 0x37, 0x68, 0x5b, 0x49, 0x3b, 0x3d, 0x6b, 0x7d, 0x53, 0x8b, 0x83, 0x5d, 0x42, 0x4c, 0x6f, 0x70, 0x8f, 0x83, 0x7f, 0x95, 0x5f, 0x46, 0x5a, 0xac, 0x4f, 0xa1, 0x50, 0x68, 0x63, 0x70, 0x5c, 0x7f, 0x36, 0x95, 0x8c, 0x37, 0x3f, 0x5a, 0x6b, 0x76, 0x1f, 0x3f, 0xa9, 0x5b, 0x8e, 0x85, 0x5b, 0x48, 0x8a, 0x55, 0x6c, 0x67, 0x48, 0xa8, 0x67, 0xa4, 0x5d, 0x7d, 0x51, 0x81, 0x80, 0x4b, 0x63, 0x52, 0x4c, 0x5b, 0x51, 0x63, 0x50, 0x70, 0x8e, 0x9b, 0x94, 0x81, 0x62, 0x5e, 0x7f, 0x7c, 0x75, 0x7d, 0x8c, 0x83, 0x76, 0x67, 0x47, 0xa2, 0x2c, 0x5b, 0x6e, 0x3c, 0x80, 0x9a, 0x66, 0x3c, 0x72, 0x70, 0x9d, 0x64, 0x50, 0x53, 0x79, 0x4c, 0x80, 0x6e, 0xaf, 0x8f, 0x94, 0x81, 0x76, 0x52, 0x8f, 0x44, 0x8c, 0x73, 0x84, 0x4e, 0x91, 0x87, 0x7c, 0x9c, 0x69, 0xb2, 0x55, 0x3f, 0x79, 0x4d, 0x53, 0x91, 0x7c, 0x6d, 0x88, 0x76, 0x7b, 0x62, 0x76, 0x50, 0x9a, 0x66, 0x57, 0x50, 0x56, 0x6e, 0x6f, 0x62, 0x70, 0x64, 0x62, 0x50, 0x71, 0x85, 0x40, 0x74, 0x65, 0x98, 0x74, 0x8c, 0x8d, 0x87, 0x77, 0x82, 0x52, 0x61, 0x85, 0x37, 0x69, 0x72, 0x5d, 0x4f, 0x4a, 0xb3, 0x60, 0x6d, 0x99, 0x7b, 0x8a, 0x3b, 0x8e, 0x76, 0x3b, 0x8b, 0x87, 0x66, 0x2d, 0x5e, 0x8b, 0x6f, 0x41, 0x7d, 0x55, 0x3f, 0x8a, 0x75, 0x69, 0x7f, 0x4d, 0x69, 0x7c, 0x3d, 0x7f, 0x6f, 0xaa, 0x67, 0x3f, 0x81, 0x9b, 0x6b, 0x8c, 0x69, 0x61, 0x4e, 0x64, 0x42, 0x68, 0x3b, 0x43, 0x78, 0x65, 0x8e, 0x63, 0x63, 0x6c, 0x81, 0x8b, 0x56, 0x79, 0x93, 0x54, 0x60, 0x51, 0x8f, 0x73, 0x4d, 0x8f, 0x92, 0x91, 0x9b, 0x88, 0x50, 0xa9, 0x8f, 0x69, 0x81, 0x5c, 0x90, 0x54, 0x96, 0x40, 0x67, 0x7e, 0x69, 0x67, 0x58, 0x7d, 0x71, 0x81, 0x88, 0x8a, 0x8a, 0x69, 0x54, 0x98, 0x57, 0x7c, 0x78, 0x7a, 0x72, 0x53, 0x66, 0xa5, 0x65, 0xac, 0x4c, 0x65, 0x42, 0x5a, 0x51, 0x86, 0x52, 0x83, 0x43, 0x6e, 0x6a, 0x6e, 0x80, 0x67, 0x51, 0x93, 0x41, 0x46, 0x41, 0x49, 0x3b, 0x75, 0x4f, 0x6a, 0x51, 0x69, 0x81, 0x4f, 0x88, 0x7b, 0x4e, 0x95, 0x58, 0x4f, 0x68, 0x4b, 0x62, 0x4d, 0x78, 0x7f, 0x73, 0x74, 0x89, 0x4a, 0x65, 0x93, 0x96, 0x78, 0x7f, 0x5a, 0x75, 0x61, 0x63, 0x75, 0x5b, 0x75, 0x6d, 0x38, 0x8e, 0x9b, 0x2a, 0x7e, 0x6e, 0x4e, 0x8c, 0x79, 0x8f, 0x6c, 0x9d, 0x97, 0x85, 0x95, 0x7d, 0x2e, 0x5a, 0xa8, 0x51, 0x63, 0x9e, 0x70, 0x9b, 0x66, 0xa7, 0x84, 0x9a, 0x7e, 0x3e, 0x70, 0x78, 0x5b, 0x69, 0xa0, 0x71, 0x63, 0x80, 0x90, 0x88, 0x59, 0x8e, 0x41, 0x9b, 0x4c, 0xd4, 0x86, 0x85, 0x8d, 0x3d, 0x6a, 0x2b, 0x71, 0x7f, 0x47, 0x78, 0x37, 0x5c, 0x41, 0x90, 0x86, 0x2d, 0x58, 0x3e, 0x02, 0x8a, 0x82, 0xa9, 0x76, 0x68, 0x9f, 0x29, 0x91, 0x98, 0xa2, 0x61, 0x8c, 0x78, 0x33, 0x6a, 0x77, 0x79, 0x72, 0x5e, 0x6b, 0x5c, 0x62, 0x99, 0x67, 0x9d, 0x78, 0xc1, 0x82, 0x94, 0x6d, 0xa3, 0x4a, 0x6b, 0x7b, 0x75, 0x75, 0x58, 0x7c, 0x7f, 0x2a, 0x32, 0x8f, 0x63, 0x9c, 0x7c, 0x4e, 0x37, 0x64, 0x7a, 0x7f, 0x48, 0x89, 0x68, 0x76, 0x6d, 0x61, 0x54, 0x76, 0xa8, 0x95, 0x76, 0x7a, 0x91, 0x58, 0x7b, 0xd5, 0x84, 0x4a, 0x64, 0x93, 0x94, 0x53, 0x4a, 0x74, 0x7f, 0x73, 0xb6, 0x7d, 0x67, 0x4c, 0x65, 0x6f, 0x31, 0x4a, 0x71, 0x42, 0x4f, 0x58, 0x93, 0x85, 0x66, 0x7b, 0x8d, 0x45, 0xa6, 0x44, 0x80, 0x31, 0x6f, 0x6b, 0x9d, 0x5e, 0x5f, 0x3c, 0x6b, 0x57, 0x83, 0x5f, 0xea, 0xf5, 0xff, 0xff, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x5f, 0x31, 0x34, 0x2f, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x5f, 0x62, 0x69, 0x61, 0x73, 0x00, 0x00, 0x00, 0xac, 0xfc, 0xff, 0xff, 0x14, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x1c, 0x07, 0xa5, 0x3b, 0x20, 0x00, 0x00, 0x00, 0xfd, 0xff, 0xff, 0xff, 0xd9, 0xff, 0xff, 0xff, 0xf9, 0xff, 0xff, 0xff, 0xf1, 0xff, 0xff, 0xff, 0xe9, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xdb, 0xff, 0xff, 0xff, 0x6a, 0xf6, 0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0x10, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x2f, 0x6b, 0x65, 0x72, 0x6e, 0x65, 0x6c, 0x2f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x73, 0x65, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x14, 0x00, 0x04, 0x00, 0x08, 0x00, 0x0c, 0x00, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xb3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xe2, 0x12, 0xc2, 0x3b, 0x01, 0x00, 0x00, 0x00, 0x93, 0x03, 0xe6, 0x3e, 0x01, 0x00, 0x00, 0x00, 0xea, 0xcf, 0x87, 0xbf, 0x40, 0x02, 0x00, 0x00, 0xa2, 0x9d, 0xc9, 0x95, 0xa0, 0xc0, 0xbf, 0xcc, 0xbc, 0x94, 0xad, 0x95, 0xa2, 0xac, 0x9e, 0x9e, 0xa5, 0xaa, 0x93, 0xd6, 0xd7, 0xd0, 0xcb, 0x8f, 0xc9, 0xa1, 0xd5, 0xb5, 0xc4, 0xc3, 0x8f, 0xac, 0xd0, 0x9a, 0xac, 0x9b, 0xbd, 0xc6, 0xa7, 0xb9, 0xe6, 0x9b, 0xd3, 0xc7, 0xa9, 0xd7, 0x44, 0x57, 0xd7, 0xb8, 0xbe, 0xb6, 0xd7, 0xa2, 0x54, 0x79, 0xe6, 0xd6, 0xd4, 0xb2, 0xb5, 0xd9, 0x97, 0xd4, 0x8d, 0x82, 0x9a, 0xbe, 0xa5, 0xd0, 0x78, 0xba, 0xa7, 0xab, 0x8c, 0xd6, 0xa1, 0x99, 0x90, 0xa6, 0xc4, 0xa7, 0x9e, 0xba, 0xcb, 0xcf, 0x98, 0xab, 0xc5, 0xb8, 0x9e, 0x84, 0xd6, 0xae, 0x90, 0xa2, 0xa9, 0xd5, 0xa1, 0xa9, 0x9f, 0xaa, 0xb9, 0x9d, 0xa5, 0xcc, 0x93, 0x93, 0xa8, 0xcc, 0x9e, 0xaa, 0xa4, 0xd5, 0xcd, 0xab, 0xca, 0xc5, 0x9a, 0xdd, 0xa9, 0xb4, 0xd0, 0xbf, 0xc1, 0xb5, 0xbe, 0xad, 0xb6, 0xd2, 0xc3, 0xb1, 0xbc, 0xbe, 0xb7, 0xc2, 0xae, 0xc1, 0xc1, 0xda, 0x9c, 0xd1, 0xb5, 0xa7, 0xab, 0xac, 0xbf, 0xdc, 0x99, 0x96, 0xd7, 0xd5, 0x94, 0xc8, 0xa3, 0xca, 0xb4, 0xc6, 0xd2, 0xb4, 0x9b, 0x9e, 0xcd, 0x8d, 0xd7, 0xc2, 0xad, 0xc2, 0xce, 0xbb, 0x36, 0xba, 0xa9, 0xa6, 0xee, 0xe8, 0xa9, 0xc9, 0x40, 0xac, 0xbf, 0xa9, 0xfc, 0xca, 0xda, 0xad, 0xa6, 0x98, 0xbf, 0xc7, 0xa9, 0xd4, 0xa5, 0xce, 0xcb, 0xb5, 0x9d, 0x9f, 0xaa, 0x9f, 0x94, 0xc8, 0xdb, 0xe0, 0x97, 0xa1, 0xa1, 0xc0, 0x90, 0xd5, 0xbd, 0xc7, 0xb3, 0x92, 0x97, 0x99, 0x9f, 0xb4, 0xa5, 0x97, 0xc7, 0xca, 0xc6, 0xdd, 0xa0, 0xdf, 0xbd, 0x83, 0x9f, 0xd8, 0xae, 0xb3, 0xb9, 0xba, 0xb0, 0x77, 0xb0, 0xdf, 0xcb, 0xed, 0xa1, 0xd9, 0xab, 0x96, 0xab, 0xbf, 0xe8, 0xff, 0xad, 0xd0, 0xb3, 0x85, 0x95, 0xc9, 0xbd, 0xc2, 0xb1, 0xbf, 0xc7, 0xb3, 0xd8, 0xa3, 0x6e, 0x9a, 0xa1, 0xe3, 0x97, 0xe4, 0xbe, 0xbf, 0x6c, 0xd0, 0x97, 0xe9, 0x5f, 0xe7, 0xa1, 0xad, 0xa4, 0xb3, 0xb0, 0xc1, 0xcf, 0xb6, 0xc9, 0xcc, 0xab, 0xbe, 0xd2, 0x9c, 0x93, 0xa2, 0x9a, 0xcb, 0x9f, 0xad, 0xb3, 0xb4, 0xb5, 0xb8, 0xe1, 0xd3, 0x86, 0xa1, 0xac, 0x99, 0xb1, 0xb8, 0xb1, 0xa0, 0x8e, 0x95, 0xd3, 0xce, 0xc6, 0xbc, 0x9b, 0xbb, 0xd3, 0x9d, 0x79, 0xac, 0xa7, 0xc7, 0xc2, 0xc4, 0x94, 0xc7, 0x49, 0xc1, 0x9b, 0x6f, 0x87, 0x7b, 0x69, 0xb0, 0x88, 0xb0, 0x96, 0x8a, 0x73, 0x64, 0x7b, 0x8e, 0x4f, 0x8c, 0xcf, 0xa4, 0xa8, 0xa7, 0xaf, 0x99, 0xc2, 0xda, 0xb8, 0xa4, 0xb7, 0xdd, 0x92, 0xbc, 0x9c, 0x52, 0xd7, 0xa3, 0xa3, 0xa7, 0xb0, 0x8c, 0xb4, 0x76, 0x9d, 0x9a, 0xc6, 0xc8, 0x52, 0xb7, 0xad, 0x78, 0xb9, 0xd8, 0x9f, 0xcf, 0xa4, 0xc8, 0xcf, 0xc8, 0x9a, 0x8a, 0xaf, 0xb2, 0xaf, 0x8e, 0xca, 0x94, 0xce, 0xad, 0xd4, 0x91, 0xaa, 0xb0, 0x9c, 0xc5, 0x9a, 0xc0, 0x8a, 0xa9, 0xb8, 0xb0, 0xd2, 0xa0, 0x94, 0xcb, 0xd3, 0x92, 0x9d, 0xc5, 0xac, 0x9e, 0xca, 0xb6, 0xd3, 0x74, 0xa8, 0x79, 0xaa, 0xce, 0xd8, 0xb8, 0x9a, 0x7c, 0x9c, 0xa0, 0x69, 0xaf, 0xc2, 0xcc, 0x6c, 0xbe, 0x67, 0xa4, 0xb7, 0xb5, 0x96, 0xb4, 0xa2, 0x8a, 0x82, 0xc0, 0xd2, 0x93, 0xc6, 0xaf, 0xb1, 0xc4, 0x8d, 0xb9, 0xca, 0x29, 0x52, 0x9e, 0xd3, 0xa6, 0x9e, 0xad, 0x93, 0x00, 0x7e, 0xcd, 0xc6, 0xa0, 0xa4, 0x99, 0x97, 0xb8, 0xd1, 0xb3, 0xa4, 0xae, 0xa2, 0xc0, 0xad, 0x97, 0xab, 0xc2, 0xcb, 0xba, 0xa6, 0xb6, 0xa6, 0xba, 0xd1, 0xcd, 0xc5, 0x92, 0xb3, 0x9b, 0xc3, 0xbd, 0xce, 0xb5, 0xb3, 0xaa, 0xc0, 0xc7, 0xc2, 0xae, 0xab, 0x87, 0xa4, 0x89, 0x8e, 0xa7, 0x7a, 0xcb, 0xd1, 0xa1, 0xd4, 0x76, 0x94, 0x94, 0xab, 0x91, 0xac, 0xac, 0x9c, 0xa2, 0xb0, 0x90, 0x7e, 0xad, 0xbb, 0xb1, 0xc8, 0xa7, 0x84, 0xd0, 0x83, 0x9e, 0x8a, 0xc3, 0x88, 0x98, 0x72, 0xab, 0xdd, 0xd3, 0x9c, 0xd7, 0x99, 0xd7, 0xeb, 0xcb, 0x9a, 0x96, 0xaf, 0x97, 0x9c, 0xaa, 0xda, 0x8b, 0xc0, 0xaf, 0xc9, 0x95, 0xcc, 0xbb, 0xe4, 0xba, 0xce, 0x5e, 0xc4, 0xa5, 0x95, 0xad, 0xb8, 0xb8, 0x3a, 0xf9, 0xff, 0xff, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x2f, 0x4d, 0x61, 0x74, 0x4d, 0x75, 0x6c, 0x5f, 0x62, 0x69, 0x61, 0x73, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x08, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xe2, 0x12, 0xc2, 0x3b, 0x18, 0x00, 0x00, 0x00, 0xfd, 0xff, 0xff, 0xff, 0xfb, 0xff, 0xff, 0xff, 0xe8, 0xff, 0xff, 0xff, 0x06, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xf7, 0xff, 0xff, 0xff, 0xc2, 0xf9, 0xff, 0xff, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x78, 0x5f, 0x70, 0x6f, 0x6f, 0x6c, 0x69, 0x6e, 0x67, 0x31, 0x64, 0x2f, 0x45, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x44, 0x69, 0x6d, 0x73, 0x2f, 0x64, 0x69, 0x6d, 0x5f, 0x30, 0x00, 0x00, 0x58, 0xf8, 0xff, 0xff, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x22, 0xfa, 0xff, 0xff, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x78, 0x5f, 0x70, 0x6f, 0x6f, 0x6c, 0x69, 0x6e, 0x67, 0x31, 0x64, 0x5f, 0x35, 0x2f, 0x45, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x44, 0x69, 0x6d, 0x73, 0x2f, 0x64, 0x69, 0x6d, 0x5f, 0x30, 0x00, 0x00, 0x00, 0x00, 0xbc, 0xf8, 0xff, 0xff, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x86, 0xfa, 0xff, 0xff, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x78, 0x5f, 0x70, 0x6f, 0x6f, 0x6c, 0x69, 0x6e, 0x67, 0x31, 0x64, 0x5f, 0x31, 0x30, 0x2f, 0x45, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x44, 0x69, 0x6d, 0x73, 0x2f, 0x64, 0x69, 0x6d, 0x5f, 0x30, 0x00, 0x00, 0x00, 0x20, 0xf9, 0xff, 0xff, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0xea, 0xfa, 0xff, 0xff, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x5f, 0x31, 0x2f, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x2f, 0x45, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x44, 0x69, 0x6d, 0x73, 0x2f, 0x64, 0x69, 0x6d, 0x5f, 0x30, 0x00, 0x00, 0x00, 0x00, 0x84, 0xf9, 0xff, 0xff, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x4e, 0xfb, 0xff, 0xff, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x78, 0x5f, 0x70, 0x6f, 0x6f, 0x6c, 0x69, 0x6e, 0x67, 0x31, 0x64, 0x5f, 0x31, 0x2f, 0x45, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x44, 0x69, 0x6d, 0x73, 0x2f, 0x64, 0x69, 0x6d, 0x5f, 0x30, 0x00, 0x00, 0x00, 0x00, 0xe8, 0xf9, 0xff, 0xff, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0xb2, 0xfb, 0xff, 0xff, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x78, 0x5f, 0x70, 0x6f, 0x6f, 0x6c, 0x69, 0x6e, 0x67, 0x31, 0x64, 0x5f, 0x36, 0x2f, 0x45, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x44, 0x69, 0x6d, 0x73, 0x2f, 0x64, 0x69, 0x6d, 0x5f, 0x30, 0x00, 0x00, 0x00, 0x00, 0x4c, 0xfa, 0xff, 0xff, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x16, 0xfc, 0xff, 0xff, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x78, 0x5f, 0x70, 0x6f, 0x6f, 0x6c, 0x69, 0x6e, 0x67, 0x31, 0x64, 0x5f, 0x31, 0x31, 0x2f, 0x45, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x44, 0x69, 0x6d, 0x73, 0x2f, 0x64, 0x69, 0x6d, 0x5f, 0x30, 0x00, 0x00, 0x00, 0xb0, 0xfa, 0xff, 0xff, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x7a, 0xfc, 0xff, 0xff, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x5f, 0x32, 0x2f, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x2f, 0x45, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x44, 0x69, 0x6d, 0x73, 0x2f, 0x64, 0x69, 0x6d, 0x5f, 0x30, 0x00, 0x00, 0x00, 0x00, 0x14, 0xfb, 0xff, 0xff, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0xde, 0xfc, 0xff, 0xff, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x5f, 0x31, 0x32, 0x2f, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x2f, 0x45, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x44, 0x69, 0x6d, 0x73, 0x2f, 0x64, 0x69, 0x6d, 0x5f, 0x30, 0x00, 0x00, 0x00, 0x78, 0xfb, 0xff, 0xff, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x42, 0xfd, 0xff, 0xff, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x78, 0x5f, 0x70, 0x6f, 0x6f, 0x6c, 0x69, 0x6e, 0x67, 0x31, 0x64, 0x5f, 0x32, 0x2f, 0x45, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x44, 0x69, 0x6d, 0x73, 0x2f, 0x64, 0x69, 0x6d, 0x5f, 0x30, 0x00, 0x00, 0x00, 0x00, 0xdc, 0xfb, 0xff, 0xff, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0xa6, 0xfd, 0xff, 0xff, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x5f, 0x31, 0x33, 0x2f, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x2f, 0x45, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x44, 0x69, 0x6d, 0x73, 0x2f, 0x64, 0x69, 0x6d, 0x5f, 0x30, 0x00, 0x00, 0x00, 0x40, 0xfc, 0xff, 0xff, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x0a, 0xfe, 0xff, 0xff, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x78, 0x5f, 0x70, 0x6f, 0x6f, 0x6c, 0x69, 0x6e, 0x67, 0x31, 0x64, 0x5f, 0x33, 0x2f, 0x45, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x44, 0x69, 0x6d, 0x73, 0x2f, 0x64, 0x69, 0x6d, 0x5f, 0x30, 0x00, 0x00, 0x00, 0x00, 0xa4, 0xfc, 0xff, 0xff, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x6e, 0xfe, 0xff, 0xff, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x78, 0x5f, 0x70, 0x6f, 0x6f, 0x6c, 0x69, 0x6e, 0x67, 0x31, 0x64, 0x5f, 0x38, 0x2f, 0x45, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x44, 0x69, 0x6d, 0x73, 0x2f, 0x64, 0x69, 0x6d, 0x5f, 0x30, 0x00, 0x00, 0x00, 0x00, 0x08, 0xfd, 0xff, 0xff, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0xd2, 0xfe, 0xff, 0xff, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x5f, 0x39, 0x2f, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x2f, 0x45, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x44, 0x69, 0x6d, 0x73, 0x2f, 0x64, 0x69, 0x6d, 0x5f, 0x30, 0x00, 0x00, 0x00, 0x00, 0x6c, 0xfd, 0xff, 0xff, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x36, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x5f, 0x31, 0x34, 0x2f, 0x63, 0x6f, 0x6e, 0x76, 0x31, 0x64, 0x2f, 0x45, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x44, 0x69, 0x6d, 0x73, 0x2f, 0x64, 0x69, 0x6d, 0x5f, 0x30, 0x00, 0x00, 0x00, 0xd0, 0xfd, 0xff, 0xff, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x9a, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x78, 0x5f, 0x70, 0x6f, 0x6f, 0x6c, 0x69, 0x6e, 0x67, 0x31, 0x64, 0x5f, 0x39, 0x2f, 0x45, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x44, 0x69, 0x6d, 0x73, 0x2f, 0x64, 0x69, 0x6d, 0x5f, 0x30, 0x00, 0x00, 0x00, 0x00, 0x34, 0xfe, 0xff, 0xff, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x18, 0x00, 0x08, 0x00, 0x07, 0x00, 0x0c, 0x00, 0x10, 0x00, 0x14, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x78, 0x5f, 0x70, 0x6f, 0x6f, 0x6c, 0x69, 0x6e, 0x67, 0x31, 0x64, 0x5f, 0x31, 0x34, 0x2f, 0x45, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x44, 0x69, 0x6d, 0x73, 0x2f, 0x64, 0x69, 0x6d, 0x5f, 0x30, 0x00, 0x00, 0x00, 0xa8, 0xfe, 0xff, 0xff, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x41, 0x00, 0x00, 0x00, 0xe0, 0x13, 0x00, 0x00, 0x78, 0x13, 0x00, 0x00, 0x24, 0x13, 0x00, 0x00, 0xd0, 0x12, 0x00, 0x00, 0x88, 0x12, 0x00, 0x00, 0x40, 0x12, 0x00, 0x00, 0xec, 0x11, 0x00, 0x00, 0x98, 0x11, 0x00, 0x00, 0x44, 0x11, 0x00, 0x00, 0xe8, 0x10, 0x00, 0x00, 0x9c, 0x10, 0x00, 0x00, 0x50, 0x10, 0x00, 0x00, 0xfc, 0x0f, 0x00, 0x00, 0xa8, 0x0f, 0x00, 0x00, 0x54, 0x0f, 0x00, 0x00, 0x0c, 0x0f, 0x00, 0x00, 0xc4, 0x0e, 0x00, 0x00, 0x7c, 0x0e, 0x00, 0x00, 0x28, 0x0e, 0x00, 0x00, 0xd4, 0x0d, 0x00, 0x00, 0x80, 0x0d, 0x00, 0x00, 0x34, 0x0d, 0x00, 0x00, 0xe8, 0x0c, 0x00, 0x00, 0x9c, 0x0c, 0x00, 0x00, 0x48, 0x0c, 0x00, 0x00, 0xf4, 0x0b, 0x00, 0x00, 0xa0, 0x0b, 0x00, 0x00, 0x58, 0x0b, 0x00, 0x00, 0x10, 0x0b, 0x00, 0x00, 0xc8, 0x0a, 0x00, 0x00, 0x74, 0x0a, 0x00, 0x00, 0x20, 0x0a, 0x00, 0x00, 0xcc, 0x09, 0x00, 0x00, 0x80, 0x09, 0x00, 0x00, 0x34, 0x09, 0x00, 0x00, 0xe8, 0x08, 0x00, 0x00, 0x94, 0x08, 0x00, 0x00, 0x40, 0x08, 0x00, 0x00, 0xec, 0x07, 0x00, 0x00, 0xa4, 0x07, 0x00, 0x00, 0x5c, 0x07, 0x00, 0x00, 0x14, 0x07, 0x00, 0x00, 0xc0, 0x06, 0x00, 0x00, 0x6c, 0x06, 0x00, 0x00, 0x18, 0x06, 0x00, 0x00, 0xcc, 0x05, 0x00, 0x00, 0x80, 0x05, 0x00, 0x00, 0x34, 0x05, 0x00, 0x00, 0xe0, 0x04, 0x00, 0x00, 0x8c, 0x04, 0x00, 0x00, 0x38, 0x04, 0x00, 0x00, 0xf0, 0x03, 0x00, 0x00, 0xa8, 0x03, 0x00, 0x00, 0x60, 0x03, 0x00, 0x00, 0x0c, 0x03, 0x00, 0x00, 0xb8, 0x02, 0x00, 0x00, 0x64, 0x02, 0x00, 0x00, 0x18, 0x02, 0x00, 0x00, 0xcc, 0x01, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x34, 0x01, 0x00, 0x00, 0xe8, 0x00, 0x00, 0x00, 0x9c, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x38, 0xed, 0xff, 0xff, 0x00, 0x00, 0x00, 0x08, 0x02, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, 0x83, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x82, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x14, 0x00, 0x18, 0x00, 0x00, 0x00, 0x08, 0x00, 0x0c, 0x00, 0x07, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x10, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xed, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0xc8, 0xed, 0xff, 0xff, 0x00, 0x00, 0x00, 0x11, 0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x66, 0x00, 0x00, 0x00, 0x51, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb2, 0xed, 0xff, 0xff, 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x10, 0xee, 0xff, 0xff, 0x00, 0x00, 0x00, 0x11, 0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x4f, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfa, 0xed, 0xff, 0xff, 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x58, 0xee, 0xff, 0xff, 0x00, 0x00, 0x00, 0x11, 0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x6f, 0x00, 0x00, 0x00, 0x4d, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0xee, 0xff, 0xff, 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xa0, 0xee, 0xff, 0xff, 0x00, 0x00, 0x00, 0x05, 0x03, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5e, 0xf1, 0xff, 0xff, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0xe8, 0xee, 0xff, 0xff, 0x00, 0x00, 0x00, 0x05, 0x03, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa6, 0xf1, 0xff, 0xff, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x30, 0xef, 0xff, 0xff, 0x00, 0x00, 0x00, 0x05, 0x03, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x6d, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x6f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xee, 0xf1, 0xff, 0xff, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x78, 0xef, 0xff, 0xff, 0x00, 0x00, 0x00, 0x11, 0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x62, 0xef, 0xff, 0xff, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0xc8, 0xef, 0xff, 0xff, 0x00, 0x00, 0x00, 0x11, 0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x4a, 0x00, 0x00, 0x00, 0x7d, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb2, 0xef, 0xff, 0xff, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x18, 0xf0, 0xff, 0xff, 0x00, 0x00, 0x00, 0x11, 0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x31, 0x00, 0x00, 0x00, 0x6e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x6d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xf0, 0xff, 0xff, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x68, 0xf0, 0xff, 0xff, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x56, 0xf1, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xac, 0xf0, 0xff, 0xff, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x47, 0x00, 0x00, 0x00, 0x49, 0x00, 0x00, 0x00, 0x4b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x4a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9a, 0xf1, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xf0, 0xf0, 0xff, 0xff, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x2e, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x31, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xde, 0xf1, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x34, 0xf1, 0xff, 0xff, 0x00, 0x00, 0x00, 0x11, 0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x63, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0xf1, 0xff, 0xff, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x84, 0xf1, 0xff, 0xff, 0x00, 0x00, 0x00, 0x11, 0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x7b, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x47, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6e, 0xf1, 0xff, 0xff, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0xd4, 0xf1, 0xff, 0xff, 0x00, 0x00, 0x00, 0x11, 0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00, 0x2f, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xbe, 0xf1, 0xff, 0xff, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x24, 0xf2, 0xff, 0xff, 0x00, 0x00, 0x00, 0x05, 0x03, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x61, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x63, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe2, 0xf4, 0xff, 0xff, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x6c, 0xf2, 0xff, 0xff, 0x00, 0x00, 0x00, 0x05, 0x03, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x79, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x7b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2a, 0xf5, 0xff, 0xff, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0xb4, 0xf2, 0xff, 0xff, 0x00, 0x00, 0x00, 0x05, 0x03, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x6a, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x72, 0xf5, 0xff, 0xff, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0xfc, 0xf2, 0xff, 0xff, 0x00, 0x00, 0x00, 0x11, 0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x62, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe6, 0xf2, 0xff, 0xff, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x4c, 0xf3, 0xff, 0xff, 0x00, 0x00, 0x00, 0x11, 0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x45, 0x00, 0x00, 0x00, 0x7a, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x79, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0xf3, 0xff, 0xff, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x9c, 0xf3, 0xff, 0xff, 0x00, 0x00, 0x00, 0x11, 0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, 0x6b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x6a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x86, 0xf3, 0xff, 0xff, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0xec, 0xf3, 0xff, 0xff, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xda, 0xf4, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x30, 0xf4, 0xff, 0xff, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x42, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x46, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x45, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0xf5, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x74, 0xf4, 0xff, 0xff, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x29, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x00, 0x00, 0x2d, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x62, 0xf5, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xb8, 0xf4, 0xff, 0xff, 0x00, 0x00, 0x00, 0x11, 0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa2, 0xf4, 0xff, 0xff, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x08, 0xf5, 0xff, 0xff, 0x00, 0x00, 0x00, 0x11, 0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x43, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x42, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf2, 0xf4, 0xff, 0xff, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x58, 0xf5, 0xff, 0xff, 0x00, 0x00, 0x00, 0x11, 0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x69, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x29, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0xf5, 0xff, 0xff, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0xa8, 0xf5, 0xff, 0xff, 0x00, 0x00, 0x00, 0x05, 0x03, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x5e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0xf8, 0xff, 0xff, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0xf0, 0xf5, 0xff, 0xff, 0x00, 0x00, 0x00, 0x05, 0x03, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x76, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xae, 0xf8, 0xff, 0xff, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x38, 0xf6, 0xff, 0xff, 0x00, 0x00, 0x00, 0x05, 0x03, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x67, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x69, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf6, 0xf8, 0xff, 0xff, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0xf6, 0xff, 0xff, 0x00, 0x00, 0x00, 0x11, 0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x5f, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x5e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6a, 0xf6, 0xff, 0xff, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0xd0, 0xf6, 0xff, 0xff, 0x00, 0x00, 0x00, 0x11, 0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x76, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xba, 0xf6, 0xff, 0xff, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x20, 0xf7, 0xff, 0xff, 0x00, 0x00, 0x00, 0x11, 0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x27, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x67, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0xf7, 0xff, 0xff, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x70, 0xf7, 0xff, 0xff, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5e, 0xf8, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xb4, 0xf7, 0xff, 0xff, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x41, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa2, 0xf8, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xf8, 0xf7, 0xff, 0xff, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x26, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x27, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe6, 0xf8, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x3c, 0xf8, 0xff, 0xff, 0x00, 0x00, 0x00, 0x11, 0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x5d, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x26, 0xf8, 0xff, 0xff, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x8c, 0xf8, 0xff, 0xff, 0x00, 0x00, 0x00, 0x11, 0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x75, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xf8, 0xff, 0xff, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0xdc, 0xf8, 0xff, 0xff, 0x00, 0x00, 0x00, 0x11, 0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xf8, 0xff, 0xff, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x2c, 0xf9, 0xff, 0xff, 0x00, 0x00, 0x00, 0x05, 0x03, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x5b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x5d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xea, 0xfb, 0xff, 0xff, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x74, 0xf9, 0xff, 0xff, 0x00, 0x00, 0x00, 0x05, 0x03, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x73, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x75, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32, 0xfc, 0xff, 0xff, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0xbc, 0xf9, 0xff, 0xff, 0x00, 0x00, 0x00, 0x05, 0x03, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x55, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7a, 0xfc, 0xff, 0xff, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0xfa, 0xff, 0xff, 0x00, 0x00, 0x00, 0x11, 0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x5b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xee, 0xf9, 0xff, 0xff, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x54, 0xfa, 0xff, 0xff, 0x00, 0x00, 0x00, 0x11, 0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x00, 0x00, 0x74, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0xfa, 0xff, 0xff, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0xa4, 0xfa, 0xff, 0xff, 0x00, 0x00, 0x00, 0x11, 0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x56, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8e, 0xfa, 0xff, 0xff, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0xf4, 0xfa, 0xff, 0xff, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe2, 0xfb, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x38, 0xfb, 0xff, 0xff, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x3a, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x26, 0xfc, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x7c, 0xfb, 0xff, 0xff, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6a, 0xfc, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xc0, 0xfb, 0xff, 0xff, 0x00, 0x00, 0x00, 0x11, 0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x5a, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xaa, 0xfb, 0xff, 0xff, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x10, 0xfc, 0xff, 0xff, 0x00, 0x00, 0x00, 0x11, 0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x72, 0x00, 0x00, 0x00, 0x39, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfa, 0xfb, 0xff, 0xff, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x60, 0xfc, 0xff, 0xff, 0x00, 0x00, 0x00, 0x11, 0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4a, 0xfc, 0xff, 0xff, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0xb0, 0xfc, 0xff, 0xff, 0x00, 0x00, 0x00, 0x05, 0x03, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x5a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6e, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0xf8, 0xfc, 0xff, 0xff, 0x00, 0x00, 0x00, 0x05, 0x03, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x72, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb6, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x40, 0xfd, 0xff, 0xff, 0x00, 0x00, 0x00, 0x05, 0x03, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x52, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x18, 0x00, 0x07, 0x00, 0x08, 0x00, 0x0c, 0x00, 0x10, 0x00, 0x14, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x98, 0xfd, 0xff, 0xff, 0x00, 0x00, 0x00, 0x11, 0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x59, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x82, 0xfd, 0xff, 0xff, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0xe8, 0xfd, 0xff, 0xff, 0x00, 0x00, 0x00, 0x11, 0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x33, 0x00, 0x00, 0x00, 0x71, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd2, 0xfd, 0xff, 0xff, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x38, 0xfe, 0xff, 0xff, 0x00, 0x00, 0x00, 0x11, 0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x53, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x52, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x22, 0xfe, 0xff, 0xff, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x88, 0xfe, 0xff, 0xff, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xcc, 0xfe, 0xff, 0xff, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x00, 0x37, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x33, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xba, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x08, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x60, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x11, 0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x81, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4a, 0xff, 0xff, 0xff, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xb0, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x11, 0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x35, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9a, 0xff, 0xff, 0xff, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x14, 0x00, 0x1c, 0x00, 0x08, 0x00, 0x0c, 0x00, 0x10, 0x00, 0x07, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x08, 0x00, 0x04, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xfe, 0xfd, 0xff, 0xff, 0x00, 0x00, 0x00, 0x09, 0x06, 0xfe, 0xff, 0xff, 0x00, 0x00, 0x00, 0x02, 0x0e, 0xfe, 0xff, 0xff, 0x00, 0x00, 0x00, 0x16, 0x16, 0xfe, 0xff, 0xff, 0x00, 0x00, 0x00, 0x16, 0x1e, 0xfe, 0xff, 0xff, 0x00, 0x00, 0x00, 0x16, 0x26, 0xfe, 0xff, 0xff, 0x00, 0x00, 0x00, 0x11, 0x2e, 0xfe, 0xff, 0xff, 0x00, 0x00, 0x00, 0x11, 0x36, 0xfe, 0xff, 0xff, 0x00, 0x00, 0x00, 0x11, 0x3e, 0xfe, 0xff, 0xff, 0x00, 0x00, 0x00, 0x16, 0x46, 0xfe, 0xff, 0xff, 0x00, 0x00, 0x00, 0x16, 0x4e, 0xfe, 0xff, 0xff, 0x00, 0x00, 0x00, 0x16, 0x56, 0xfe, 0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0x5e, 0xfe, 0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0x66, 0xfe, 0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0x6e, 0xfe, 0xff, 0xff, 0x00, 0x00, 0x00, 0x16, 0x76, 0xfe, 0xff, 0xff, 0x00, 0x00, 0x00, 0x16, 0x7e, 0xfe, 0xff, 0xff, 0x00, 0x00, 0x00, 0x16, 0x86, 0xfe, 0xff, 0xff, 0x00, 0x00, 0x00, 0x11, 0x8e, 0xfe, 0xff, 0xff, 0x00, 0x00, 0x00, 0x11, 0x96, 0xfe, 0xff, 0xff, 0x00, 0x00, 0x00, 0x11, 0x9e, 0xfe, 0xff, 0xff, 0x00, 0x00, 0x00, 0x16, 0xa6, 0xfe, 0xff, 0xff, 0x00, 0x00, 0x00, 0x16, 0xae, 0xfe, 0xff, 0xff, 0x00, 0x00, 0x00, 0x16, 0xb6, 0xfe, 0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0xbe, 0xfe, 0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0xc6, 0xfe, 0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0xce, 0xfe, 0xff, 0xff, 0x00, 0x00, 0x00, 0x16, 0xd6, 0xfe, 0xff, 0xff, 0x00, 0x00, 0x00, 0x16, 0xde, 0xfe, 0xff, 0xff, 0x00, 0x00, 0x00, 0x16, 0xe6, 0xfe, 0xff, 0xff, 0x00, 0x00, 0x00, 0x11, 0xee, 0xfe, 0xff, 0xff, 0x00, 0x00, 0x00, 0x11, 0xf6, 0xfe, 0xff, 0xff, 0x00, 0x00, 0x00, 0x11, 0xfe, 0xfe, 0xff, 0xff, 0x00, 0x00, 0x00, 0x16, 0x06, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x16, 0x0e, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x16, 0x16, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0x1e, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0x26, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0x2e, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x16, 0x36, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x16, 0x3e, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x16, 0x46, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x11, 0x4e, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x11, 0x56, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x11, 0x5e, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x16, 0x66, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x16, 0x6e, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x16, 0x76, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0x7e, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0x86, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0x8e, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x16, 0x96, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x16, 0x9e, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x16, 0xa6, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x11, 0xae, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x11, 0xb6, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x11, 0xbe, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x16, 0xc6, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x16, 0xce, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x16, 0xd6, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0xde, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0xe6, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0xfa, 0xff, 0xff, 0xff, 0x00, 0x16, 0x06, 0x00, 0x06, 0x00, 0x05, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x16, 0x06, 0x00, 0x08, 0x00, 0x07, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16 }; const unsigned int multi_motions_model_tflite_len = 33664;
73.790557
73
0.648816
[ "model" ]